@copilotkitnext/shared 1.51.2 → 1.51.3-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -32,4 +32,53 @@ interface FinalizeRunOptions {
|
|
|
32
32
|
}
|
|
33
33
|
declare function finalizeRunEvents(events: BaseEvent[], options?: FinalizeRunOptions): BaseEvent[];
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Error codes for transcription HTTP responses.
|
|
37
|
+
* Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.
|
|
38
|
+
* These codes are returned by the runtime and parsed by the client.
|
|
39
|
+
*/
|
|
40
|
+
declare enum TranscriptionErrorCode {
|
|
41
|
+
/** Transcription service not configured in runtime */
|
|
42
|
+
SERVICE_NOT_CONFIGURED = "service_not_configured",
|
|
43
|
+
/** Audio format not supported */
|
|
44
|
+
INVALID_AUDIO_FORMAT = "invalid_audio_format",
|
|
45
|
+
/** Audio file is too long */
|
|
46
|
+
AUDIO_TOO_LONG = "audio_too_long",
|
|
47
|
+
/** Audio file is empty or too short */
|
|
48
|
+
AUDIO_TOO_SHORT = "audio_too_short",
|
|
49
|
+
/** Rate limited by transcription provider */
|
|
50
|
+
RATE_LIMITED = "rate_limited",
|
|
51
|
+
/** Authentication failed with transcription provider */
|
|
52
|
+
AUTH_FAILED = "auth_failed",
|
|
53
|
+
/** Transcription provider returned an error */
|
|
54
|
+
PROVIDER_ERROR = "provider_error",
|
|
55
|
+
/** Network error during transcription */
|
|
56
|
+
NETWORK_ERROR = "network_error",
|
|
57
|
+
/** Invalid request format */
|
|
58
|
+
INVALID_REQUEST = "invalid_request"
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Error response format returned by the transcription endpoint.
|
|
62
|
+
*/
|
|
63
|
+
interface TranscriptionErrorResponse {
|
|
64
|
+
error: TranscriptionErrorCode;
|
|
65
|
+
message: string;
|
|
66
|
+
retryable?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Helper functions to create transcription error responses.
|
|
70
|
+
* Used by the runtime to return consistent error responses.
|
|
71
|
+
*/
|
|
72
|
+
declare const TranscriptionErrors: {
|
|
73
|
+
serviceNotConfigured: () => TranscriptionErrorResponse;
|
|
74
|
+
invalidAudioFormat: (format: string, supported: string[]) => TranscriptionErrorResponse;
|
|
75
|
+
invalidRequest: (details: string) => TranscriptionErrorResponse;
|
|
76
|
+
rateLimited: () => TranscriptionErrorResponse;
|
|
77
|
+
authFailed: () => TranscriptionErrorResponse;
|
|
78
|
+
providerError: (message: string) => TranscriptionErrorResponse;
|
|
79
|
+
networkError: (message?: string) => TranscriptionErrorResponse;
|
|
80
|
+
audioTooLong: () => TranscriptionErrorResponse;
|
|
81
|
+
audioTooShort: () => TranscriptionErrorResponse;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { type AgentDescription, DEFAULT_AGENT_ID, type MaybePromise, type NonEmptyRecord, type RuntimeInfo, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, finalizeRunEvents, logger, partialJSONParse, randomUUID };
|
package/dist/index.d.ts
CHANGED
|
@@ -32,4 +32,53 @@ interface FinalizeRunOptions {
|
|
|
32
32
|
}
|
|
33
33
|
declare function finalizeRunEvents(events: BaseEvent[], options?: FinalizeRunOptions): BaseEvent[];
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Error codes for transcription HTTP responses.
|
|
37
|
+
* Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.
|
|
38
|
+
* These codes are returned by the runtime and parsed by the client.
|
|
39
|
+
*/
|
|
40
|
+
declare enum TranscriptionErrorCode {
|
|
41
|
+
/** Transcription service not configured in runtime */
|
|
42
|
+
SERVICE_NOT_CONFIGURED = "service_not_configured",
|
|
43
|
+
/** Audio format not supported */
|
|
44
|
+
INVALID_AUDIO_FORMAT = "invalid_audio_format",
|
|
45
|
+
/** Audio file is too long */
|
|
46
|
+
AUDIO_TOO_LONG = "audio_too_long",
|
|
47
|
+
/** Audio file is empty or too short */
|
|
48
|
+
AUDIO_TOO_SHORT = "audio_too_short",
|
|
49
|
+
/** Rate limited by transcription provider */
|
|
50
|
+
RATE_LIMITED = "rate_limited",
|
|
51
|
+
/** Authentication failed with transcription provider */
|
|
52
|
+
AUTH_FAILED = "auth_failed",
|
|
53
|
+
/** Transcription provider returned an error */
|
|
54
|
+
PROVIDER_ERROR = "provider_error",
|
|
55
|
+
/** Network error during transcription */
|
|
56
|
+
NETWORK_ERROR = "network_error",
|
|
57
|
+
/** Invalid request format */
|
|
58
|
+
INVALID_REQUEST = "invalid_request"
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Error response format returned by the transcription endpoint.
|
|
62
|
+
*/
|
|
63
|
+
interface TranscriptionErrorResponse {
|
|
64
|
+
error: TranscriptionErrorCode;
|
|
65
|
+
message: string;
|
|
66
|
+
retryable?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Helper functions to create transcription error responses.
|
|
70
|
+
* Used by the runtime to return consistent error responses.
|
|
71
|
+
*/
|
|
72
|
+
declare const TranscriptionErrors: {
|
|
73
|
+
serviceNotConfigured: () => TranscriptionErrorResponse;
|
|
74
|
+
invalidAudioFormat: (format: string, supported: string[]) => TranscriptionErrorResponse;
|
|
75
|
+
invalidRequest: (details: string) => TranscriptionErrorResponse;
|
|
76
|
+
rateLimited: () => TranscriptionErrorResponse;
|
|
77
|
+
authFailed: () => TranscriptionErrorResponse;
|
|
78
|
+
providerError: (message: string) => TranscriptionErrorResponse;
|
|
79
|
+
networkError: (message?: string) => TranscriptionErrorResponse;
|
|
80
|
+
audioTooLong: () => TranscriptionErrorResponse;
|
|
81
|
+
audioTooShort: () => TranscriptionErrorResponse;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { type AgentDescription, DEFAULT_AGENT_ID, type MaybePromise, type NonEmptyRecord, type RuntimeInfo, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, finalizeRunEvents, logger, partialJSONParse, randomUUID };
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
DEFAULT_AGENT_ID: () => DEFAULT_AGENT_ID,
|
|
34
|
+
TranscriptionErrorCode: () => TranscriptionErrorCode,
|
|
35
|
+
TranscriptionErrors: () => TranscriptionErrors,
|
|
34
36
|
finalizeRunEvents: () => finalizeRunEvents,
|
|
35
37
|
logger: () => logger,
|
|
36
38
|
partialJSONParse: () => partialJSONParse,
|
|
@@ -177,9 +179,72 @@ function finalizeRunEvents(events, options = {}) {
|
|
|
177
179
|
}
|
|
178
180
|
return appended;
|
|
179
181
|
}
|
|
182
|
+
|
|
183
|
+
// src/transcription-errors.ts
|
|
184
|
+
var TranscriptionErrorCode = /* @__PURE__ */ ((TranscriptionErrorCode2) => {
|
|
185
|
+
TranscriptionErrorCode2["SERVICE_NOT_CONFIGURED"] = "service_not_configured";
|
|
186
|
+
TranscriptionErrorCode2["INVALID_AUDIO_FORMAT"] = "invalid_audio_format";
|
|
187
|
+
TranscriptionErrorCode2["AUDIO_TOO_LONG"] = "audio_too_long";
|
|
188
|
+
TranscriptionErrorCode2["AUDIO_TOO_SHORT"] = "audio_too_short";
|
|
189
|
+
TranscriptionErrorCode2["RATE_LIMITED"] = "rate_limited";
|
|
190
|
+
TranscriptionErrorCode2["AUTH_FAILED"] = "auth_failed";
|
|
191
|
+
TranscriptionErrorCode2["PROVIDER_ERROR"] = "provider_error";
|
|
192
|
+
TranscriptionErrorCode2["NETWORK_ERROR"] = "network_error";
|
|
193
|
+
TranscriptionErrorCode2["INVALID_REQUEST"] = "invalid_request";
|
|
194
|
+
return TranscriptionErrorCode2;
|
|
195
|
+
})(TranscriptionErrorCode || {});
|
|
196
|
+
var TranscriptionErrors = {
|
|
197
|
+
serviceNotConfigured: () => ({
|
|
198
|
+
error: "service_not_configured" /* SERVICE_NOT_CONFIGURED */,
|
|
199
|
+
message: "Transcription service is not configured",
|
|
200
|
+
retryable: false
|
|
201
|
+
}),
|
|
202
|
+
invalidAudioFormat: (format, supported) => ({
|
|
203
|
+
error: "invalid_audio_format" /* INVALID_AUDIO_FORMAT */,
|
|
204
|
+
message: `Unsupported audio format: ${format}. Supported: ${supported.join(", ")}`,
|
|
205
|
+
retryable: false
|
|
206
|
+
}),
|
|
207
|
+
invalidRequest: (details) => ({
|
|
208
|
+
error: "invalid_request" /* INVALID_REQUEST */,
|
|
209
|
+
message: details,
|
|
210
|
+
retryable: false
|
|
211
|
+
}),
|
|
212
|
+
rateLimited: () => ({
|
|
213
|
+
error: "rate_limited" /* RATE_LIMITED */,
|
|
214
|
+
message: "Rate limited. Please try again later.",
|
|
215
|
+
retryable: true
|
|
216
|
+
}),
|
|
217
|
+
authFailed: () => ({
|
|
218
|
+
error: "auth_failed" /* AUTH_FAILED */,
|
|
219
|
+
message: "Authentication failed with transcription provider",
|
|
220
|
+
retryable: false
|
|
221
|
+
}),
|
|
222
|
+
providerError: (message) => ({
|
|
223
|
+
error: "provider_error" /* PROVIDER_ERROR */,
|
|
224
|
+
message,
|
|
225
|
+
retryable: true
|
|
226
|
+
}),
|
|
227
|
+
networkError: (message = "Network error during transcription") => ({
|
|
228
|
+
error: "network_error" /* NETWORK_ERROR */,
|
|
229
|
+
message,
|
|
230
|
+
retryable: true
|
|
231
|
+
}),
|
|
232
|
+
audioTooLong: () => ({
|
|
233
|
+
error: "audio_too_long" /* AUDIO_TOO_LONG */,
|
|
234
|
+
message: "Audio file is too long",
|
|
235
|
+
retryable: false
|
|
236
|
+
}),
|
|
237
|
+
audioTooShort: () => ({
|
|
238
|
+
error: "audio_too_short" /* AUDIO_TOO_SHORT */,
|
|
239
|
+
message: "Audio is too short to transcribe",
|
|
240
|
+
retryable: false
|
|
241
|
+
})
|
|
242
|
+
};
|
|
180
243
|
// Annotate the CommonJS export names for ESM import in node:
|
|
181
244
|
0 && (module.exports = {
|
|
182
245
|
DEFAULT_AGENT_ID,
|
|
246
|
+
TranscriptionErrorCode,
|
|
247
|
+
TranscriptionErrors,
|
|
183
248
|
finalizeRunEvents,
|
|
184
249
|
logger,
|
|
185
250
|
partialJSONParse,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/utils.ts","../src/logger.ts","../src/constants.ts","../src/finalize-events.ts"],"sourcesContent":["export {\n type MaybePromise,\n type NonEmptyRecord,\n type AgentDescription,\n type RuntimeInfo,\n} from \"./types\";\n\nexport * from \"./utils\";\n\nexport { logger } from \"./logger\";\nexport { DEFAULT_AGENT_ID } from \"./constants\";\nexport { finalizeRunEvents } from \"./finalize-events\";\n","import { v4 as uuidv4 } from \"uuid\";\nimport * as PartialJSON from \"partial-json\";\n\nexport function randomUUID() {\n return uuidv4();\n}\n\nexport function partialJSONParse(json: string) {\n try {\n return PartialJSON.parse(json);\n } catch (error) {\n return {};\n }\n}\n","export const logger = console;\n","export const DEFAULT_AGENT_ID = \"default\";\n","import {\n BaseEvent,\n EventType,\n RunErrorEvent,\n} from \"@ag-ui/client\";\nimport { randomUUID } from \"./utils\";\n\ninterface FinalizeRunOptions {\n stopRequested?: boolean;\n interruptionMessage?: string;\n}\n\nconst defaultStopMessage = \"Run stopped by user\";\nconst defaultAbruptEndMessage = \"Run ended without emitting a terminal event\";\n\nexport function finalizeRunEvents(\n events: BaseEvent[],\n options: FinalizeRunOptions = {},\n): BaseEvent[] {\n const { stopRequested = false, interruptionMessage } = options;\n\n const resolvedStopMessage = interruptionMessage ?? defaultStopMessage;\n const resolvedAbruptMessage =\n interruptionMessage && interruptionMessage !== defaultStopMessage\n ? interruptionMessage\n : defaultAbruptEndMessage;\n\n const appended: BaseEvent[] = [];\n\n const openMessageIds = new Set<string>();\n const openToolCalls = new Map<\n string,\n {\n hasEnd: boolean;\n hasResult: boolean;\n }\n >();\n\n for (const event of events) {\n switch (event.type) {\n case EventType.TEXT_MESSAGE_START: {\n const messageId = (event as { messageId?: string }).messageId;\n if (typeof messageId === \"string\") {\n openMessageIds.add(messageId);\n }\n break;\n }\n case EventType.TEXT_MESSAGE_END: {\n const messageId = (event as { messageId?: string }).messageId;\n if (typeof messageId === \"string\") {\n openMessageIds.delete(messageId);\n }\n break;\n }\n case EventType.TOOL_CALL_START: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n if (typeof toolCallId === \"string\") {\n openToolCalls.set(toolCallId, {\n hasEnd: false,\n hasResult: false,\n });\n }\n break;\n }\n case EventType.TOOL_CALL_END: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n const info = toolCallId ? openToolCalls.get(toolCallId) : undefined;\n if (info) {\n info.hasEnd = true;\n }\n break;\n }\n case EventType.TOOL_CALL_RESULT: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n const info = toolCallId ? openToolCalls.get(toolCallId) : undefined;\n if (info) {\n info.hasResult = true;\n }\n break;\n }\n default:\n break;\n }\n }\n\n const hasRunFinished = events.some((event) => event.type === EventType.RUN_FINISHED);\n const hasRunError = events.some((event) => event.type === EventType.RUN_ERROR);\n const hasTerminalEvent = hasRunFinished || hasRunError;\n const terminalEventMissing = !hasTerminalEvent;\n\n for (const messageId of openMessageIds) {\n const endEvent = {\n type: EventType.TEXT_MESSAGE_END,\n messageId,\n } as BaseEvent;\n events.push(endEvent);\n appended.push(endEvent);\n }\n\n for (const [toolCallId, info] of openToolCalls) {\n if (!info.hasEnd) {\n const endEvent = {\n type: EventType.TOOL_CALL_END,\n toolCallId,\n } as BaseEvent;\n events.push(endEvent);\n appended.push(endEvent);\n }\n\n if (terminalEventMissing && !info.hasResult) {\n const resultEvent = {\n type: EventType.TOOL_CALL_RESULT,\n toolCallId,\n messageId: `${toolCallId ?? randomUUID()}-result`,\n role: \"tool\",\n content: JSON.stringify(\n stopRequested\n ? {\n status: \"stopped\",\n reason: \"stop_requested\",\n message: resolvedStopMessage,\n }\n : {\n status: \"error\",\n reason: \"missing_terminal_event\",\n message: resolvedAbruptMessage,\n },\n ),\n } as BaseEvent;\n events.push(resultEvent);\n appended.push(resultEvent);\n }\n }\n\n if (terminalEventMissing) {\n if (stopRequested) {\n const finishedEvent = {\n type: EventType.RUN_FINISHED,\n } as BaseEvent;\n events.push(finishedEvent);\n appended.push(finishedEvent);\n } else {\n const errorEvent: RunErrorEvent = {\n type: EventType.RUN_ERROR,\n message: resolvedAbruptMessage,\n code: \"INCOMPLETE_STREAM\",\n };\n events.push(errorEvent);\n appended.push(errorEvent);\n }\n }\n\n return appended;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAA6B;AAC7B,kBAA6B;AAEtB,SAAS,aAAa;AAC3B,aAAO,YAAAA,IAAO;AAChB;AAEO,SAAS,iBAAiB,MAAc;AAC7C,MAAI;AACF,WAAmB,kBAAM,IAAI;AAAA,EAC/B,SAAS,OAAO;AACd,WAAO,CAAC;AAAA,EACV;AACF;;;ACbO,IAAM,SAAS;;;ACAf,IAAM,mBAAmB;;;ACAhC,oBAIO;AAQP,IAAM,qBAAqB;AAC3B,IAAM,0BAA0B;AAEzB,SAAS,kBACd,QACA,UAA8B,CAAC,GAClB;AACb,QAAM,EAAE,gBAAgB,OAAO,oBAAoB,IAAI;AAEvD,QAAM,sBAAsB,uBAAuB;AACnD,QAAM,wBACJ,uBAAuB,wBAAwB,qBAC3C,sBACA;AAEN,QAAM,WAAwB,CAAC;AAE/B,QAAM,iBAAiB,oBAAI,IAAY;AACvC,QAA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,KAAK,QAAQ;AACpB,aAAS,KAAK,QAAQ;AAAA,EACxB;AAEA,aAAW,CAAC,YAAY,IAAI,KAAK,eAAe;AAC9C,QAAI,CAAC,KAAK,QAAQ;AAChB,YAAM,WAAW;AAAA,QACf,MAAM,wBAAU;AAAA,QAChB;AAAA,MACF;AACA,aAAO,KAAK,QAAQ;AACpB,eAAS,KAAK,QAAQ;AAAA,IACxB;AAEA,QAAI,wBAAwB,CAAC,KAAK,WAAW;AAC3C,YAAM,cAAc;AAAA,QAClB,MAAM,wBAAU;AAAA,QAChB;AAAA,QACA,WAAW,GAAG,cAAc,WAAW,CAAC;AAAA,QACxC,MAAM;AAAA,QACN,SAAS,KAAK;AAAA,UACZ,gBACI;AAAA,YACE,QAAQ;AAAA,YACR,QAAQ;AAAA,YACR,SAAS;AAAA,UACX,IACA;AAAA,YACE,QAAQ;AAAA,YACR,QAAQ;AAAA,YACR,SAAS;AAAA,UACX;AAAA,QACN;AAAA,MACF;AACA,aAAO,KAAK,WAAW;AACvB,eAAS,KAAK,WAAW;AAAA,IAC3B;AAAA,EACF;AAEA,MAAI,sBAAsB;AACxB,QAAI,eAAe;AACjB,YAAM,gBAAgB;AAAA,QACpB,MAAM,wBAAU;AAAA,MAClB;AACA,aAAO,KAAK,aAAa;AACzB,eAAS,KAAK,aAAa;AAAA,IAC7B,OAAO;AACL,YAAM,aAA4B;AAAA,QAChC,MAAM,wBAAU;AAAA,QAChB,SAAS;AAAA,QACT,MAAM;AAAA,MACR;AACA,aAAO,KAAK,UAAU;AACtB,eAAS,KAAK,UAAU;AAAA,IAC1B;AAAA,EACF;AAEA,SAAO;AACT;","names":["uuidv4"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/utils.ts","../src/logger.ts","../src/constants.ts","../src/finalize-events.ts","../src/transcription-errors.ts"],"sourcesContent":["export {\n type MaybePromise,\n type NonEmptyRecord,\n type AgentDescription,\n type RuntimeInfo,\n} from \"./types\";\n\nexport * from \"./utils\";\n\nexport { logger } from \"./logger\";\nexport { DEFAULT_AGENT_ID } from \"./constants\";\nexport { finalizeRunEvents } from \"./finalize-events\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n","import { v4 as uuidv4 } from \"uuid\";\nimport * as PartialJSON from \"partial-json\";\n\nexport function randomUUID() {\n return uuidv4();\n}\n\nexport function partialJSONParse(json: string) {\n try {\n return PartialJSON.parse(json);\n } catch (error) {\n return {};\n }\n}\n","export const logger = console;\n","export const DEFAULT_AGENT_ID = \"default\";\n","import {\n BaseEvent,\n EventType,\n RunErrorEvent,\n} from \"@ag-ui/client\";\nimport { randomUUID } from \"./utils\";\n\ninterface FinalizeRunOptions {\n stopRequested?: boolean;\n interruptionMessage?: string;\n}\n\nconst defaultStopMessage = \"Run stopped by user\";\nconst defaultAbruptEndMessage = \"Run ended without emitting a terminal event\";\n\nexport function finalizeRunEvents(\n events: BaseEvent[],\n options: FinalizeRunOptions = {},\n): BaseEvent[] {\n const { stopRequested = false, interruptionMessage } = options;\n\n const resolvedStopMessage = interruptionMessage ?? defaultStopMessage;\n const resolvedAbruptMessage =\n interruptionMessage && interruptionMessage !== defaultStopMessage\n ? interruptionMessage\n : defaultAbruptEndMessage;\n\n const appended: BaseEvent[] = [];\n\n const openMessageIds = new Set<string>();\n const openToolCalls = new Map<\n string,\n {\n hasEnd: boolean;\n hasResult: boolean;\n }\n >();\n\n for (const event of events) {\n switch (event.type) {\n case EventType.TEXT_MESSAGE_START: {\n const messageId = (event as { messageId?: string }).messageId;\n if (typeof messageId === \"string\") {\n openMessageIds.add(messageId);\n }\n break;\n }\n case EventType.TEXT_MESSAGE_END: {\n const messageId = (event as { messageId?: string }).messageId;\n if (typeof messageId === \"string\") {\n openMessageIds.delete(messageId);\n }\n break;\n }\n case EventType.TOOL_CALL_START: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n if (typeof toolCallId === \"string\") {\n openToolCalls.set(toolCallId, {\n hasEnd: false,\n hasResult: false,\n });\n }\n break;\n }\n case EventType.TOOL_CALL_END: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n const info = toolCallId ? openToolCalls.get(toolCallId) : undefined;\n if (info) {\n info.hasEnd = true;\n }\n break;\n }\n case EventType.TOOL_CALL_RESULT: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n const info = toolCallId ? openToolCalls.get(toolCallId) : undefined;\n if (info) {\n info.hasResult = true;\n }\n break;\n }\n default:\n break;\n }\n }\n\n const hasRunFinished = events.some((event) => event.type === EventType.RUN_FINISHED);\n const hasRunError = events.some((event) => event.type === EventType.RUN_ERROR);\n const hasTerminalEvent = hasRunFinished || hasRunError;\n const terminalEventMissing = !hasTerminalEvent;\n\n for (const messageId of openMessageIds) {\n const endEvent = {\n type: EventType.TEXT_MESSAGE_END,\n messageId,\n } as BaseEvent;\n events.push(endEvent);\n appended.push(endEvent);\n }\n\n for (const [toolCallId, info] of openToolCalls) {\n if (!info.hasEnd) {\n const endEvent = {\n type: EventType.TOOL_CALL_END,\n toolCallId,\n } as BaseEvent;\n events.push(endEvent);\n appended.push(endEvent);\n }\n\n if (terminalEventMissing && !info.hasResult) {\n const resultEvent = {\n type: EventType.TOOL_CALL_RESULT,\n toolCallId,\n messageId: `${toolCallId ?? randomUUID()}-result`,\n role: \"tool\",\n content: JSON.stringify(\n stopRequested\n ? {\n status: \"stopped\",\n reason: \"stop_requested\",\n message: resolvedStopMessage,\n }\n : {\n status: \"error\",\n reason: \"missing_terminal_event\",\n message: resolvedAbruptMessage,\n },\n ),\n } as BaseEvent;\n events.push(resultEvent);\n appended.push(resultEvent);\n }\n }\n\n if (terminalEventMissing) {\n if (stopRequested) {\n const finishedEvent = {\n type: EventType.RUN_FINISHED,\n } as BaseEvent;\n events.push(finishedEvent);\n appended.push(finishedEvent);\n } else {\n const errorEvent: RunErrorEvent = {\n type: EventType.RUN_ERROR,\n message: resolvedAbruptMessage,\n code: \"INCOMPLETE_STREAM\",\n };\n events.push(errorEvent);\n appended.push(errorEvent);\n }\n }\n\n return appended;\n}\n","/**\n * Error codes for transcription HTTP responses.\n * Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.\n * These codes are returned by the runtime and parsed by the client.\n */\nexport enum TranscriptionErrorCode {\n /** Transcription service not configured in runtime */\n SERVICE_NOT_CONFIGURED = \"service_not_configured\",\n /** Audio format not supported */\n INVALID_AUDIO_FORMAT = \"invalid_audio_format\",\n /** Audio file is too long */\n AUDIO_TOO_LONG = \"audio_too_long\",\n /** Audio file is empty or too short */\n AUDIO_TOO_SHORT = \"audio_too_short\",\n /** Rate limited by transcription provider */\n RATE_LIMITED = \"rate_limited\",\n /** Authentication failed with transcription provider */\n AUTH_FAILED = \"auth_failed\",\n /** Transcription provider returned an error */\n PROVIDER_ERROR = \"provider_error\",\n /** Network error during transcription */\n NETWORK_ERROR = \"network_error\",\n /** Invalid request format */\n INVALID_REQUEST = \"invalid_request\",\n}\n\n/**\n * Error response format returned by the transcription endpoint.\n */\nexport interface TranscriptionErrorResponse {\n error: TranscriptionErrorCode;\n message: string;\n retryable?: boolean;\n}\n\n/**\n * Helper functions to create transcription error responses.\n * Used by the runtime to return consistent error responses.\n */\nexport const TranscriptionErrors = {\n serviceNotConfigured: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.SERVICE_NOT_CONFIGURED,\n message: \"Transcription service is not configured\",\n retryable: false,\n }),\n\n invalidAudioFormat: (format: string, supported: string[]): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.INVALID_AUDIO_FORMAT,\n message: `Unsupported audio format: ${format}. Supported: ${supported.join(\", \")}`,\n retryable: false,\n }),\n\n invalidRequest: (details: string): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.INVALID_REQUEST,\n message: details,\n retryable: false,\n }),\n\n rateLimited: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.RATE_LIMITED,\n message: \"Rate limited. Please try again later.\",\n retryable: true,\n }),\n\n authFailed: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUTH_FAILED,\n message: \"Authentication failed with transcription provider\",\n retryable: false,\n }),\n\n providerError: (message: string): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.PROVIDER_ERROR,\n message,\n retryable: true,\n }),\n\n networkError: (message: string = \"Network error during transcription\"): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.NETWORK_ERROR,\n message,\n retryable: true,\n }),\n\n audioTooLong: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUDIO_TOO_LONG,\n message: \"Audio file is too long\",\n retryable: false,\n }),\n\n audioTooShort: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUDIO_TOO_SHORT,\n message: \"Audio is too short to transcribe\",\n retryable: false,\n }),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAA6B;AAC7B,kBAA6B;AAEtB,SAAS,aAAa;AAC3B,aAAO,YAAAA,IAAO;AAChB;AAEO,SAAS,iBAAiB,MAAc;AAC7C,MAAI;AACF,WAAmB,kBAAM,IAAI;AAAA,EAC/B,SAAS,OAAO;AACd,WAAO,CAAC;AAAA,EACV;AACF;;;ACbO,IAAM,SAAS;;;ACAf,IAAM,mBAAmB;;;ACAhC,oBAIO;AAQP,IAAM,qBAAqB;AAC3B,IAAM,0BAA0B;AAEzB,SAAS,kBACd,QACA,UAA8B,CAAC,GAClB;AACb,QAAM,EAAE,gBAAgB,OAAO,oBAAoB,IAAI;AAEvD,QAAM,sBAAsB,uBAAuB;AACnD,QAAM,wBACJ,uBAAuB,wBAAwB,qBAC3C,sBACA;AAEN,QAAM,WAAwB,CAAC;AAE/B,QAAM,iBAAiB,oBAAI,IAAY;AACvC,QAAM,gBAAgB,oBAAI,IAMxB;AAEF,aAAW,SAAS,QAAQ;AAC1B,YAAQ,MAAM,MAAM;AAA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;AAlBR,SAAAA;AAAA,GAAA;AAkCL,IAAM,sBAAsB;AAAA,EACjC,sBAAsB,OAAmC;AAAA,IACvD,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EAEA,oBAAoB,CAAC,QAAgB,eAAqD;AAAA,IACxF,OAAO;AAAA,IACP,SAAS,6BAA6B,MAAM,gBAAgB,UAAU,KAAK,IAAI,CAAC;AAAA,IAChF,WAAW;AAAA,EACb;AAAA,EAEA,gBAAgB,CAAC,aAAiD;AAAA,IAChE,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EAEA,aAAa,OAAmC;AAAA,IAC9C,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EAEA,YAAY,OAAmC;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EAEA,eAAe,CAAC,aAAiD;AAAA,IAC/D,OAAO;AAAA,IACP;AAAA,IACA,WAAW;AAAA,EACb;AAAA,EAEA,cAAc,CAAC,UAAkB,0CAAsE;AAAA,IACrG,OAAO;AAAA,IACP;AAAA,IACA,WAAW;AAAA,EACb;AAAA,EAEA,cAAc,OAAmC;AAAA,IAC/C,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EAEA,eAAe,OAAmC;AAAA,IAChD,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AACF;","names":["uuidv4","TranscriptionErrorCode"]}
|
package/dist/index.mjs
CHANGED
|
@@ -139,8 +139,71 @@ function finalizeRunEvents(events, options = {}) {
|
|
|
139
139
|
}
|
|
140
140
|
return appended;
|
|
141
141
|
}
|
|
142
|
+
|
|
143
|
+
// src/transcription-errors.ts
|
|
144
|
+
var TranscriptionErrorCode = /* @__PURE__ */ ((TranscriptionErrorCode2) => {
|
|
145
|
+
TranscriptionErrorCode2["SERVICE_NOT_CONFIGURED"] = "service_not_configured";
|
|
146
|
+
TranscriptionErrorCode2["INVALID_AUDIO_FORMAT"] = "invalid_audio_format";
|
|
147
|
+
TranscriptionErrorCode2["AUDIO_TOO_LONG"] = "audio_too_long";
|
|
148
|
+
TranscriptionErrorCode2["AUDIO_TOO_SHORT"] = "audio_too_short";
|
|
149
|
+
TranscriptionErrorCode2["RATE_LIMITED"] = "rate_limited";
|
|
150
|
+
TranscriptionErrorCode2["AUTH_FAILED"] = "auth_failed";
|
|
151
|
+
TranscriptionErrorCode2["PROVIDER_ERROR"] = "provider_error";
|
|
152
|
+
TranscriptionErrorCode2["NETWORK_ERROR"] = "network_error";
|
|
153
|
+
TranscriptionErrorCode2["INVALID_REQUEST"] = "invalid_request";
|
|
154
|
+
return TranscriptionErrorCode2;
|
|
155
|
+
})(TranscriptionErrorCode || {});
|
|
156
|
+
var TranscriptionErrors = {
|
|
157
|
+
serviceNotConfigured: () => ({
|
|
158
|
+
error: "service_not_configured" /* SERVICE_NOT_CONFIGURED */,
|
|
159
|
+
message: "Transcription service is not configured",
|
|
160
|
+
retryable: false
|
|
161
|
+
}),
|
|
162
|
+
invalidAudioFormat: (format, supported) => ({
|
|
163
|
+
error: "invalid_audio_format" /* INVALID_AUDIO_FORMAT */,
|
|
164
|
+
message: `Unsupported audio format: ${format}. Supported: ${supported.join(", ")}`,
|
|
165
|
+
retryable: false
|
|
166
|
+
}),
|
|
167
|
+
invalidRequest: (details) => ({
|
|
168
|
+
error: "invalid_request" /* INVALID_REQUEST */,
|
|
169
|
+
message: details,
|
|
170
|
+
retryable: false
|
|
171
|
+
}),
|
|
172
|
+
rateLimited: () => ({
|
|
173
|
+
error: "rate_limited" /* RATE_LIMITED */,
|
|
174
|
+
message: "Rate limited. Please try again later.",
|
|
175
|
+
retryable: true
|
|
176
|
+
}),
|
|
177
|
+
authFailed: () => ({
|
|
178
|
+
error: "auth_failed" /* AUTH_FAILED */,
|
|
179
|
+
message: "Authentication failed with transcription provider",
|
|
180
|
+
retryable: false
|
|
181
|
+
}),
|
|
182
|
+
providerError: (message) => ({
|
|
183
|
+
error: "provider_error" /* PROVIDER_ERROR */,
|
|
184
|
+
message,
|
|
185
|
+
retryable: true
|
|
186
|
+
}),
|
|
187
|
+
networkError: (message = "Network error during transcription") => ({
|
|
188
|
+
error: "network_error" /* NETWORK_ERROR */,
|
|
189
|
+
message,
|
|
190
|
+
retryable: true
|
|
191
|
+
}),
|
|
192
|
+
audioTooLong: () => ({
|
|
193
|
+
error: "audio_too_long" /* AUDIO_TOO_LONG */,
|
|
194
|
+
message: "Audio file is too long",
|
|
195
|
+
retryable: false
|
|
196
|
+
}),
|
|
197
|
+
audioTooShort: () => ({
|
|
198
|
+
error: "audio_too_short" /* AUDIO_TOO_SHORT */,
|
|
199
|
+
message: "Audio is too short to transcribe",
|
|
200
|
+
retryable: false
|
|
201
|
+
})
|
|
202
|
+
};
|
|
142
203
|
export {
|
|
143
204
|
DEFAULT_AGENT_ID,
|
|
205
|
+
TranscriptionErrorCode,
|
|
206
|
+
TranscriptionErrors,
|
|
144
207
|
finalizeRunEvents,
|
|
145
208
|
logger,
|
|
146
209
|
partialJSONParse,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils.ts","../src/logger.ts","../src/constants.ts","../src/finalize-events.ts"],"sourcesContent":["import { v4 as uuidv4 } from \"uuid\";\nimport * as PartialJSON from \"partial-json\";\n\nexport function randomUUID() {\n return uuidv4();\n}\n\nexport function partialJSONParse(json: string) {\n try {\n return PartialJSON.parse(json);\n } catch (error) {\n return {};\n }\n}\n","export const logger = console;\n","export const DEFAULT_AGENT_ID = \"default\";\n","import {\n BaseEvent,\n EventType,\n RunErrorEvent,\n} from \"@ag-ui/client\";\nimport { randomUUID } from \"./utils\";\n\ninterface FinalizeRunOptions {\n stopRequested?: boolean;\n interruptionMessage?: string;\n}\n\nconst defaultStopMessage = \"Run stopped by user\";\nconst defaultAbruptEndMessage = \"Run ended without emitting a terminal event\";\n\nexport function finalizeRunEvents(\n events: BaseEvent[],\n options: FinalizeRunOptions = {},\n): BaseEvent[] {\n const { stopRequested = false, interruptionMessage } = options;\n\n const resolvedStopMessage = interruptionMessage ?? defaultStopMessage;\n const resolvedAbruptMessage =\n interruptionMessage && interruptionMessage !== defaultStopMessage\n ? interruptionMessage\n : defaultAbruptEndMessage;\n\n const appended: BaseEvent[] = [];\n\n const openMessageIds = new Set<string>();\n const openToolCalls = new Map<\n string,\n {\n hasEnd: boolean;\n hasResult: boolean;\n }\n >();\n\n for (const event of events) {\n switch (event.type) {\n case EventType.TEXT_MESSAGE_START: {\n const messageId = (event as { messageId?: string }).messageId;\n if (typeof messageId === \"string\") {\n openMessageIds.add(messageId);\n }\n break;\n }\n case EventType.TEXT_MESSAGE_END: {\n const messageId = (event as { messageId?: string }).messageId;\n if (typeof messageId === \"string\") {\n openMessageIds.delete(messageId);\n }\n break;\n }\n case EventType.TOOL_CALL_START: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n if (typeof toolCallId === \"string\") {\n openToolCalls.set(toolCallId, {\n hasEnd: false,\n hasResult: false,\n });\n }\n break;\n }\n case EventType.TOOL_CALL_END: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n const info = toolCallId ? openToolCalls.get(toolCallId) : undefined;\n if (info) {\n info.hasEnd = true;\n }\n break;\n }\n case EventType.TOOL_CALL_RESULT: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n const info = toolCallId ? openToolCalls.get(toolCallId) : undefined;\n if (info) {\n info.hasResult = true;\n }\n break;\n }\n default:\n break;\n }\n }\n\n const hasRunFinished = events.some((event) => event.type === EventType.RUN_FINISHED);\n const hasRunError = events.some((event) => event.type === EventType.RUN_ERROR);\n const hasTerminalEvent = hasRunFinished || hasRunError;\n const terminalEventMissing = !hasTerminalEvent;\n\n for (const messageId of openMessageIds) {\n const endEvent = {\n type: EventType.TEXT_MESSAGE_END,\n messageId,\n } as BaseEvent;\n events.push(endEvent);\n appended.push(endEvent);\n }\n\n for (const [toolCallId, info] of openToolCalls) {\n if (!info.hasEnd) {\n const endEvent = {\n type: EventType.TOOL_CALL_END,\n toolCallId,\n } as BaseEvent;\n events.push(endEvent);\n appended.push(endEvent);\n }\n\n if (terminalEventMissing && !info.hasResult) {\n const resultEvent = {\n type: EventType.TOOL_CALL_RESULT,\n toolCallId,\n messageId: `${toolCallId ?? randomUUID()}-result`,\n role: \"tool\",\n content: JSON.stringify(\n stopRequested\n ? {\n status: \"stopped\",\n reason: \"stop_requested\",\n message: resolvedStopMessage,\n }\n : {\n status: \"error\",\n reason: \"missing_terminal_event\",\n message: resolvedAbruptMessage,\n },\n ),\n } as BaseEvent;\n events.push(resultEvent);\n appended.push(resultEvent);\n }\n }\n\n if (terminalEventMissing) {\n if (stopRequested) {\n const finishedEvent = {\n type: EventType.RUN_FINISHED,\n } as BaseEvent;\n events.push(finishedEvent);\n appended.push(finishedEvent);\n } else {\n const errorEvent: RunErrorEvent = {\n type: EventType.RUN_ERROR,\n message: resolvedAbruptMessage,\n code: \"INCOMPLETE_STREAM\",\n };\n events.push(errorEvent);\n appended.push(errorEvent);\n }\n }\n\n return appended;\n}\n"],"mappings":";AAAA,SAAS,MAAM,cAAc;AAC7B,YAAY,iBAAiB;AAEtB,SAAS,aAAa;AAC3B,SAAO,OAAO;AAChB;AAEO,SAAS,iBAAiB,MAAc;AAC7C,MAAI;AACF,WAAmB,kBAAM,IAAI;AAAA,EAC/B,SAAS,OAAO;AACd,WAAO,CAAC;AAAA,EACV;AACF;;;ACbO,IAAM,SAAS;;;ACAf,IAAM,mBAAmB;;;ACAhC;AAAA,EAEE;AAAA,OAEK;AAQP,IAAM,qBAAqB;AAC3B,IAAM,0BAA0B;AAEzB,SAAS,kBACd,QACA,UAA8B,CAAC,GAClB;AACb,QAAM,EAAE,gBAAgB,OAAO,oBAAoB,IAAI;AAEvD,QAAM,sBAAsB,uBAAuB;AACnD,QAAM,wBACJ,uBAAuB,wBAA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AgB;AACtC,UAAM,WAAW;AAAA,MACf,MAAM,UAAU;AAAA,MAChB;AAAA,IACF;AACA,WAAO,KAAK,QAAQ;AACpB,aAAS,KAAK,QAAQ;AAAA,EACxB;AAEA,aAAW,CAAC,YAAY,IAAI,KAAK,eAAe;AAC9C,QAAI,CAAC,KAAK,QAAQ;AAChB,YAAM,WAAW;AAAA,QACf,MAAM,UAAU;AAAA,QAChB;AAAA,MACF;AACA,aAAO,KAAK,QAAQ;AACpB,eAAS,KAAK,QAAQ;AAAA,IACxB;AAEA,QAAI,wBAAwB,CAAC,KAAK,WAAW;AAC3C,YAAM,cAAc;AAAA,QAClB,MAAM,UAAU;AAAA,QAChB;AAAA,QACA,WAAW,GAAG,cAAc,WAAW,CAAC;AAAA,QACxC,MAAM;AAAA,QACN,SAAS,KAAK;AAAA,UACZ,gBACI;AAAA,YACE,QAAQ;AAAA,YACR,QAAQ;AAAA,YACR,SAAS;AAAA,UACX,IACA;AAAA,YACE,QAAQ;AAAA,YACR,QAAQ;AAAA,YACR,SAAS;AAAA,UACX;AAAA,QACN;AAAA,MACF;AACA,aAAO,KAAK,WAAW;AACvB,eAAS,KAAK,WAAW;AAAA,IAC3B;AAAA,EACF;AAEA,MAAI,sBAAsB;AACxB,QAAI,eAAe;AACjB,YAAM,gBAAgB;AAAA,QACpB,MAAM,UAAU;AAAA,MAClB;AACA,aAAO,KAAK,aAAa;AACzB,eAAS,KAAK,aAAa;AAAA,IAC7B,OAAO;AACL,YAAM,aAA4B;AAAA,QAChC,MAAM,UAAU;AAAA,QAChB,SAAS;AAAA,QACT,MAAM;AAAA,MACR;AACA,aAAO,KAAK,UAAU;AACtB,eAAS,KAAK,UAAU;AAAA,IAC1B;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/utils.ts","../src/logger.ts","../src/constants.ts","../src/finalize-events.ts","../src/transcription-errors.ts"],"sourcesContent":["import { v4 as uuidv4 } from \"uuid\";\nimport * as PartialJSON from \"partial-json\";\n\nexport function randomUUID() {\n return uuidv4();\n}\n\nexport function partialJSONParse(json: string) {\n try {\n return PartialJSON.parse(json);\n } catch (error) {\n return {};\n }\n}\n","export const logger = console;\n","export const DEFAULT_AGENT_ID = \"default\";\n","import {\n BaseEvent,\n EventType,\n RunErrorEvent,\n} from \"@ag-ui/client\";\nimport { randomUUID } from \"./utils\";\n\ninterface FinalizeRunOptions {\n stopRequested?: boolean;\n interruptionMessage?: string;\n}\n\nconst defaultStopMessage = \"Run stopped by user\";\nconst defaultAbruptEndMessage = \"Run ended without emitting a terminal event\";\n\nexport function finalizeRunEvents(\n events: BaseEvent[],\n options: FinalizeRunOptions = {},\n): BaseEvent[] {\n const { stopRequested = false, interruptionMessage } = options;\n\n const resolvedStopMessage = interruptionMessage ?? defaultStopMessage;\n const resolvedAbruptMessage =\n interruptionMessage && interruptionMessage !== defaultStopMessage\n ? interruptionMessage\n : defaultAbruptEndMessage;\n\n const appended: BaseEvent[] = [];\n\n const openMessageIds = new Set<string>();\n const openToolCalls = new Map<\n string,\n {\n hasEnd: boolean;\n hasResult: boolean;\n }\n >();\n\n for (const event of events) {\n switch (event.type) {\n case EventType.TEXT_MESSAGE_START: {\n const messageId = (event as { messageId?: string }).messageId;\n if (typeof messageId === \"string\") {\n openMessageIds.add(messageId);\n }\n break;\n }\n case EventType.TEXT_MESSAGE_END: {\n const messageId = (event as { messageId?: string }).messageId;\n if (typeof messageId === \"string\") {\n openMessageIds.delete(messageId);\n }\n break;\n }\n case EventType.TOOL_CALL_START: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n if (typeof toolCallId === \"string\") {\n openToolCalls.set(toolCallId, {\n hasEnd: false,\n hasResult: false,\n });\n }\n break;\n }\n case EventType.TOOL_CALL_END: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n const info = toolCallId ? openToolCalls.get(toolCallId) : undefined;\n if (info) {\n info.hasEnd = true;\n }\n break;\n }\n case EventType.TOOL_CALL_RESULT: {\n const toolCallId = (event as { toolCallId?: string }).toolCallId;\n const info = toolCallId ? openToolCalls.get(toolCallId) : undefined;\n if (info) {\n info.hasResult = true;\n }\n break;\n }\n default:\n break;\n }\n }\n\n const hasRunFinished = events.some((event) => event.type === EventType.RUN_FINISHED);\n const hasRunError = events.some((event) => event.type === EventType.RUN_ERROR);\n const hasTerminalEvent = hasRunFinished || hasRunError;\n const terminalEventMissing = !hasTerminalEvent;\n\n for (const messageId of openMessageIds) {\n const endEvent = {\n type: EventType.TEXT_MESSAGE_END,\n messageId,\n } as BaseEvent;\n events.push(endEvent);\n appended.push(endEvent);\n }\n\n for (const [toolCallId, info] of openToolCalls) {\n if (!info.hasEnd) {\n const endEvent = {\n type: EventType.TOOL_CALL_END,\n toolCallId,\n } as BaseEvent;\n events.push(endEvent);\n appended.push(endEvent);\n }\n\n if (terminalEventMissing && !info.hasResult) {\n const resultEvent = {\n type: EventType.TOOL_CALL_RESULT,\n toolCallId,\n messageId: `${toolCallId ?? randomUUID()}-result`,\n role: \"tool\",\n content: JSON.stringify(\n stopRequested\n ? {\n status: \"stopped\",\n reason: \"stop_requested\",\n message: resolvedStopMessage,\n }\n : {\n status: \"error\",\n reason: \"missing_terminal_event\",\n message: resolvedAbruptMessage,\n },\n ),\n } as BaseEvent;\n events.push(resultEvent);\n appended.push(resultEvent);\n }\n }\n\n if (terminalEventMissing) {\n if (stopRequested) {\n const finishedEvent = {\n type: EventType.RUN_FINISHED,\n } as BaseEvent;\n events.push(finishedEvent);\n appended.push(finishedEvent);\n } else {\n const errorEvent: RunErrorEvent = {\n type: EventType.RUN_ERROR,\n message: resolvedAbruptMessage,\n code: \"INCOMPLETE_STREAM\",\n };\n events.push(errorEvent);\n appended.push(errorEvent);\n }\n }\n\n return appended;\n}\n","/**\n * Error codes for transcription HTTP responses.\n * Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.\n * These codes are returned by the runtime and parsed by the client.\n */\nexport enum TranscriptionErrorCode {\n /** Transcription service not configured in runtime */\n SERVICE_NOT_CONFIGURED = \"service_not_configured\",\n /** Audio format not supported */\n INVALID_AUDIO_FORMAT = \"invalid_audio_format\",\n /** Audio file is too long */\n AUDIO_TOO_LONG = \"audio_too_long\",\n /** Audio file is empty or too short */\n AUDIO_TOO_SHORT = \"audio_too_short\",\n /** Rate limited by transcription provider */\n RATE_LIMITED = \"rate_limited\",\n /** Authentication failed with transcription provider */\n AUTH_FAILED = \"auth_failed\",\n /** Transcription provider returned an error */\n PROVIDER_ERROR = \"provider_error\",\n /** Network error during transcription */\n NETWORK_ERROR = \"network_error\",\n /** Invalid request format */\n INVALID_REQUEST = \"invalid_request\",\n}\n\n/**\n * Error response format returned by the transcription endpoint.\n */\nexport interface TranscriptionErrorResponse {\n error: TranscriptionErrorCode;\n message: string;\n retryable?: boolean;\n}\n\n/**\n * Helper functions to create transcription error responses.\n * Used by the runtime to return consistent error responses.\n */\nexport const TranscriptionErrors = {\n serviceNotConfigured: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.SERVICE_NOT_CONFIGURED,\n message: \"Transcription service is not configured\",\n retryable: false,\n }),\n\n invalidAudioFormat: (format: string, supported: string[]): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.INVALID_AUDIO_FORMAT,\n message: `Unsupported audio format: ${format}. Supported: ${supported.join(\", \")}`,\n retryable: false,\n }),\n\n invalidRequest: (details: string): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.INVALID_REQUEST,\n message: details,\n retryable: false,\n }),\n\n rateLimited: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.RATE_LIMITED,\n message: \"Rate limited. Please try again later.\",\n retryable: true,\n }),\n\n authFailed: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUTH_FAILED,\n message: \"Authentication failed with transcription provider\",\n retryable: false,\n }),\n\n providerError: (message: string): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.PROVIDER_ERROR,\n message,\n retryable: true,\n }),\n\n networkError: (message: string = \"Network error during transcription\"): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.NETWORK_ERROR,\n message,\n retryable: true,\n }),\n\n audioTooLong: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUDIO_TOO_LONG,\n message: \"Audio file is too long\",\n retryable: false,\n }),\n\n audioTooShort: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUDIO_TOO_SHORT,\n message: \"Audio is too short to transcribe\",\n retryable: false,\n }),\n};\n"],"mappings":";AAAA,SAAS,MAAM,cAAc;AAC7B,YAAY,iBAAiB;AAEtB,SAAS,aAAa;AAC3B,SAAO,OAAO;AAChB;AAEO,SAAS,iBAAiB,MAAc;AAC7C,MAAI;AACF,WAAmB,kBAAM,IAAI;AAAA,EAC/B,SAAS,OAAO;AACd,WAAO,CAAC;AAAA,EACV;AACF;;;ACbO,IAAM,SAAS;;;ACAf,IAAM,mBAAmB;;;ACAhC;AAAA,EAEE;AAAA,OAEK;AAQP,IAAM,qBAAqB;AAC3B,IAAM,0BAA0B;AAEzB,SAAS,kBACd,QACA,UAA8B,CAAC,GAClB;AACb,QAAM,EAAE,gBAAgB,OAAO,oBAAoB,IAAI;AAEvD,QAAM,sBAAsB,uBAAuB;AACnD,QAAM,wBACJ,uBAAuB,wBAAwB,qBAC3C,sBACA;AAEN,QAAM,WAAwB,CAAC;AAE/B,QAAM,iBAAiB,oBAAI,IAAY;AACvC,QAAM,gBAAgB,oBAAI,IAMxB;AAEF,aAAW,SAAS,QAAQ;AAC1B,YAAQ,MAAM,MAAM;AAAA,MAClB,KAAK,UAAU,oBAAoB;AACjC,cAAM,YAAa,MAAiC;AACpD,YAAI,OAAO,cAAc,UAAU;AACjC,yBAAe,IAAI,SAAS;AAAA,QAC9B;AACA;AAAA,MACF;AAAA,MACA,KAAK,UAAU,kBAAkB;AAC/B,cAAM,YAAa,MAAiC;AACpD,YAAI,OAAO,cAAc,UAAU;AACjC,yBAAe,OAAO,SAAS;AAAA,QACjC;AACA;AAAA,M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;AAAA,EAEA,gBAAgB,CAAC,aAAiD;AAAA,IAChE,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EAEA,aAAa,OAAmC;AAAA,IAC9C,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EAEA,YAAY,OAAmC;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EAEA,eAAe,CAAC,aAAiD;AAAA,IAC/D,OAAO;AAAA,IACP;AAAA,IACA,WAAW;AAAA,EACb;AAAA,EAEA,cAAc,CAAC,UAAkB,0CAAsE;AAAA,IACrG,OAAO;AAAA,IACP;AAAA,IACA,WAAW;AAAA,EACb;AAAA,EAEA,cAAc,OAAmC;AAAA,IAC/C,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EAEA,eAAe,OAAmC;AAAA,IAChD,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AACF;","names":["TranscriptionErrorCode"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkitnext/shared",
|
|
3
|
-
"version": "1.51.
|
|
3
|
+
"version": "1.51.3-next.1",
|
|
4
4
|
"description": "Shared utilities and types for CopilotKit2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"eslint": "^9.30.0",
|
|
20
20
|
"tsup": "^8.5.0",
|
|
21
21
|
"typescript": "5.8.2",
|
|
22
|
-
"@copilotkitnext/eslint-config": "1.51.
|
|
23
|
-
"@copilotkitnext/typescript-config": "1.51.
|
|
22
|
+
"@copilotkitnext/eslint-config": "1.51.3-next.1",
|
|
23
|
+
"@copilotkitnext/typescript-config": "1.51.3-next.1"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@ag-ui/client": "0.0.42",
|