MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / createAgentStreamError

Function createAgentStreamError

apps/cli/src/ai/chat-command.ts:65–78  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

63}
64
65function createAgentStreamError(error: unknown): Error {
66 if (error instanceof Error) return error
67 if (typeof error === 'string' && error) return new Error(error)
68 if (typeof error === 'object' && error !== null) {
69 const record = error as { name?: unknown; message?: unknown; stack?: unknown }
70 const streamError = new Error(
71 typeof record.message === 'string' && record.message ? record.message : 'Agent stream failed'
72 )
73 if (typeof record.name === 'string' && record.name) streamError.name = record.name
74 if (typeof record.stack === 'string' && record.stack) streamError.stack = record.stack
75 return streamError
76 }
77 return new Error('Agent stream failed')
78}
79
80function isRecord(value: unknown): value is Record<string, unknown> {
81 return typeof value === 'object' && value !== null && !Array.isArray(value)

Callers 1

runChatTurnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected