@copilotkit/shared 1.54.1-next.6 → 1.55.0-next.7
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/CHANGELOG.md +6 -0
- package/dist/constants/index.cjs +5 -0
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.d.cts +4 -1
- package/dist/constants/index.d.cts.map +1 -1
- package/dist/constants/index.d.mts +4 -1
- package/dist/constants/index.d.mts.map +1 -1
- package/dist/constants/index.mjs +4 -1
- package/dist/constants/index.mjs.map +1 -1
- package/dist/finalize-events.cjs +106 -0
- package/dist/finalize-events.cjs.map +1 -0
- package/dist/finalize-events.d.cts +11 -0
- package/dist/finalize-events.d.cts.map +1 -0
- package/dist/finalize-events.d.mts +11 -0
- package/dist/finalize-events.d.mts.map +1 -0
- package/dist/finalize-events.mjs +105 -0
- package/dist/finalize-events.mjs.map +1 -0
- package/dist/index.cjs +25 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +9 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +10 -3
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +286 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/logger.cjs +7 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/logger.d.cts +5 -0
- package/dist/logger.d.cts.map +1 -0
- package/dist/logger.d.mts +5 -0
- package/dist/logger.d.mts.map +1 -0
- package/dist/logger.mjs +6 -0
- package/dist/logger.mjs.map +1 -0
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/standard-schema.cjs +29 -0
- package/dist/standard-schema.cjs.map +1 -0
- package/dist/standard-schema.d.cts +32 -0
- package/dist/standard-schema.d.cts.map +1 -0
- package/dist/standard-schema.d.mts +32 -0
- package/dist/standard-schema.d.mts.map +1 -0
- package/dist/standard-schema.mjs +28 -0
- package/dist/standard-schema.mjs.map +1 -0
- package/dist/transcription-errors.cjs +84 -0
- package/dist/transcription-errors.cjs.map +1 -0
- package/dist/transcription-errors.d.cts +52 -0
- package/dist/transcription-errors.d.cts.map +1 -0
- package/dist/transcription-errors.d.mts +52 -0
- package/dist/transcription-errors.d.mts.map +1 -0
- package/dist/transcription-errors.mjs +82 -0
- package/dist/transcription-errors.mjs.map +1 -0
- package/dist/types/message.d.cts +1 -1
- package/dist/types/message.d.mts +1 -1
- package/dist/utils/index.cjs +49 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +24 -2
- package/dist/utils/index.d.cts.map +1 -1
- package/dist/utils/index.d.mts +24 -2
- package/dist/utils/index.d.mts.map +1 -1
- package/dist/utils/index.mjs +45 -1
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/types.cjs +9 -0
- package/dist/utils/types.cjs.map +1 -0
- package/dist/utils/types.d.cts +12 -1
- package/dist/utils/types.d.cts.map +1 -1
- package/dist/utils/types.d.mts +12 -1
- package/dist/utils/types.d.mts.map +1 -1
- package/dist/utils/types.mjs +7 -0
- package/dist/utils/types.mjs.map +1 -0
- package/package.json +9 -2
- package/src/__tests__/standard-schema-types.test.ts +144 -0
- package/src/__tests__/standard-schema.test.ts +267 -0
- package/src/__tests__/zod-regression.test.ts +319 -0
- package/src/constants/index.ts +5 -0
- package/src/finalize-events.ts +154 -0
- package/src/index.ts +12 -0
- package/src/logger.ts +1 -0
- package/src/standard-schema.ts +76 -0
- package/src/transcription-errors.ts +99 -0
- package/src/types/message.ts +1 -1
- package/src/utils/index.ts +58 -0
- package/src/utils/types.ts +21 -0
- package/src/utils.test.ts +66 -0
- package/tsconfig.json +9 -1
- package/tsdown.config.ts +10 -2
package/dist/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('graphql'), require('zod'), require('uuid'), require('@segment/analytics-node'), require('chalk')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'graphql', 'zod', 'uuid', '@segment/analytics-node', 'chalk'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitShared = {}), global.GraphQL,global.Zod,global.UUID,global.SegmentAnalyticsNode,global.chalk));
|
|
5
|
-
})(this, function(exports, graphql, zod, uuid, _segment_analytics_node, chalk) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('graphql'), require('zod'), require('uuid'), require('partial-json'), require('@segment/analytics-node'), require('chalk'), require('@ag-ui/client')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'graphql', 'zod', 'uuid', 'partial-json', '@segment/analytics-node', 'chalk', '@ag-ui/client'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitShared = {}), global.GraphQL,global.Zod,global.UUID,global.PartialJSON,global.SegmentAnalyticsNode,global.chalk,global.AgUIClient));
|
|
5
|
+
})(this, function(exports, graphql, zod, uuid, partial_json, _segment_analytics_node, chalk, _ag_ui_client) {
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
7
7
|
//#region \0rolldown/runtime.js
|
|
8
8
|
var __create = Object.create;
|
|
@@ -31,6 +31,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
31
31
|
}) : target, mod));
|
|
32
32
|
|
|
33
33
|
//#endregion
|
|
34
|
+
partial_json = __toESM(partial_json);
|
|
34
35
|
|
|
35
36
|
//#region src/utils/conditions.ts
|
|
36
37
|
function executeConditions({ conditions, value }) {
|
|
@@ -715,6 +716,11 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
715
716
|
return convertJsonSchemaToZodSchema(actionParametersToJsonSchema(parameters), true);
|
|
716
717
|
}
|
|
717
718
|
|
|
719
|
+
//#endregion
|
|
720
|
+
//#region src/utils/types.ts
|
|
721
|
+
const RUNTIME_MODE_SSE = "sse";
|
|
722
|
+
const RUNTIME_MODE_INTELLIGENCE = "intelligence";
|
|
723
|
+
|
|
718
724
|
//#endregion
|
|
719
725
|
//#region src/utils/random-id.ts
|
|
720
726
|
function randomId() {
|
|
@@ -817,6 +823,32 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
817
823
|
}
|
|
818
824
|
}
|
|
819
825
|
/**
|
|
826
|
+
* Parses a partial/incomplete JSON string, returning as much valid data as possible.
|
|
827
|
+
* Falls back to an empty object if parsing fails entirely.
|
|
828
|
+
*/
|
|
829
|
+
function partialJSONParse(json) {
|
|
830
|
+
try {
|
|
831
|
+
const parsed = partial_json.parse(json);
|
|
832
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) return parsed;
|
|
833
|
+
return {};
|
|
834
|
+
} catch (error) {
|
|
835
|
+
return {};
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Returns an exponential backoff function suitable for Phoenix.js
|
|
840
|
+
* `reconnectAfterMs` and `rejoinAfterMs` options.
|
|
841
|
+
*
|
|
842
|
+
* @param baseMs - Initial delay for the first retry attempt.
|
|
843
|
+
* @param maxMs - Upper bound — delays are capped at this value.
|
|
844
|
+
*
|
|
845
|
+
* Phoenix calls the returned function with a 1-based `tries` count.
|
|
846
|
+
* The delay doubles on each attempt: baseMs, 2×baseMs, 4×baseMs, …, maxMs.
|
|
847
|
+
*/
|
|
848
|
+
function phoenixExponentialBackoff(baseMs, maxMs) {
|
|
849
|
+
return (tries) => Math.min(baseMs * 2 ** (tries - 1), maxMs);
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
820
852
|
* Maps an array of items to a new array, skipping items that throw errors during mapping
|
|
821
853
|
* @param items The array to map
|
|
822
854
|
* @param callback The mapping function to apply to each item
|
|
@@ -839,6 +871,22 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
839
871
|
function isMacOS() {
|
|
840
872
|
return /Mac|iMac|Macintosh/i.test(navigator.userAgent);
|
|
841
873
|
}
|
|
874
|
+
/**
|
|
875
|
+
* Safely parses a JSON string into a tool arguments object.
|
|
876
|
+
* Returns the parsed object only if it's a plain object (not an array, null, etc.).
|
|
877
|
+
* Falls back to an empty object for any non-object JSON value or parse failure.
|
|
878
|
+
*/
|
|
879
|
+
function safeParseToolArgs(raw) {
|
|
880
|
+
try {
|
|
881
|
+
const parsed = JSON.parse(raw);
|
|
882
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) return parsed;
|
|
883
|
+
console.warn(`[CopilotKit] Tool arguments parsed to non-object (${typeof parsed}), falling back to empty object`);
|
|
884
|
+
return {};
|
|
885
|
+
} catch (_unused) {
|
|
886
|
+
console.warn("[CopilotKit] Failed to parse tool arguments, falling back to empty object");
|
|
887
|
+
return {};
|
|
888
|
+
}
|
|
889
|
+
}
|
|
842
890
|
|
|
843
891
|
//#endregion
|
|
844
892
|
//#region src/constants/index.ts
|
|
@@ -846,6 +894,9 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
846
894
|
const COPILOT_CLOUD_VERSION = "v1";
|
|
847
895
|
const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;
|
|
848
896
|
const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
|
|
897
|
+
const DEFAULT_AGENT_ID = "default";
|
|
898
|
+
/** Phoenix channel event name used for all AG-UI events. */
|
|
899
|
+
const AG_UI_CHANNEL_EVENT = "ag-ui";
|
|
849
900
|
|
|
850
901
|
//#endregion
|
|
851
902
|
//#region src/telemetry/utils.ts
|
|
@@ -860,7 +911,7 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
860
911
|
|
|
861
912
|
//#endregion
|
|
862
913
|
//#region package.json
|
|
863
|
-
var version = "1.
|
|
914
|
+
var version = "1.55.0-next.7";
|
|
864
915
|
|
|
865
916
|
//#endregion
|
|
866
917
|
//#region src/telemetry/scarf-client.ts
|
|
@@ -965,11 +1016,222 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
965
1016
|
}
|
|
966
1017
|
};
|
|
967
1018
|
|
|
1019
|
+
//#endregion
|
|
1020
|
+
//#region src/standard-schema.ts
|
|
1021
|
+
/**
|
|
1022
|
+
* Check whether a schema implements the Standard JSON Schema V1 protocol.
|
|
1023
|
+
*/
|
|
1024
|
+
function hasStandardJsonSchema(schema) {
|
|
1025
|
+
const props = schema["~standard"];
|
|
1026
|
+
return props != null && typeof props === "object" && "jsonSchema" in props && props.jsonSchema != null && typeof props.jsonSchema === "object" && "input" in props.jsonSchema && typeof props.jsonSchema.input === "function";
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Convert any StandardSchemaV1-compatible schema to a JSON Schema object.
|
|
1030
|
+
*
|
|
1031
|
+
* Strategy:
|
|
1032
|
+
* 1. If the schema implements Standard JSON Schema V1 (`~standard.jsonSchema`),
|
|
1033
|
+
* call `schema['~standard'].jsonSchema.input({ target: 'draft-07' })`.
|
|
1034
|
+
* 2. If the schema is a Zod v3 schema (`~standard.vendor === 'zod'`), use the
|
|
1035
|
+
* injected `zodToJsonSchema()` function.
|
|
1036
|
+
* 3. Otherwise throw a descriptive error.
|
|
1037
|
+
*/
|
|
1038
|
+
function schemaToJsonSchema(schema, options) {
|
|
1039
|
+
if (hasStandardJsonSchema(schema)) return schema["~standard"].jsonSchema.input({ target: "draft-07" });
|
|
1040
|
+
const vendor = schema["~standard"].vendor;
|
|
1041
|
+
if (vendor === "zod" && (options === null || options === void 0 ? void 0 : options.zodToJsonSchema)) return options.zodToJsonSchema(schema, { $refStrategy: "none" });
|
|
1042
|
+
throw new Error(`Cannot convert schema to JSON Schema. The schema (vendor: "${vendor}") does not implement Standard JSON Schema V1 and no zodToJsonSchema fallback is available. Use a library that supports Standard JSON Schema (e.g., Zod 3.24+, Valibot v1+, ArkType v2+) or pass a zodToJsonSchema function in options.`);
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
//#endregion
|
|
1046
|
+
//#region src/logger.ts
|
|
1047
|
+
const logger = console;
|
|
1048
|
+
|
|
1049
|
+
//#endregion
|
|
1050
|
+
//#region src/finalize-events.ts
|
|
1051
|
+
const defaultStopMessage = "Run stopped by user";
|
|
1052
|
+
const defaultAbruptEndMessage = "Run ended without emitting a terminal event";
|
|
1053
|
+
function finalizeRunEvents(events, options = {}) {
|
|
1054
|
+
const { stopRequested = false, interruptionMessage } = options;
|
|
1055
|
+
const resolvedStopMessage = interruptionMessage !== null && interruptionMessage !== void 0 ? interruptionMessage : defaultStopMessage;
|
|
1056
|
+
const resolvedAbruptMessage = interruptionMessage && interruptionMessage !== defaultStopMessage ? interruptionMessage : defaultAbruptEndMessage;
|
|
1057
|
+
const appended = [];
|
|
1058
|
+
const openMessageIds = /* @__PURE__ */ new Set();
|
|
1059
|
+
const openToolCalls = /* @__PURE__ */ new Map();
|
|
1060
|
+
for (const event of events) switch (event.type) {
|
|
1061
|
+
case _ag_ui_client.EventType.TEXT_MESSAGE_START: {
|
|
1062
|
+
const messageId = event.messageId;
|
|
1063
|
+
if (typeof messageId === "string") openMessageIds.add(messageId);
|
|
1064
|
+
break;
|
|
1065
|
+
}
|
|
1066
|
+
case _ag_ui_client.EventType.TEXT_MESSAGE_END: {
|
|
1067
|
+
const messageId = event.messageId;
|
|
1068
|
+
if (typeof messageId === "string") openMessageIds.delete(messageId);
|
|
1069
|
+
break;
|
|
1070
|
+
}
|
|
1071
|
+
case _ag_ui_client.EventType.TOOL_CALL_START: {
|
|
1072
|
+
const toolCallId = event.toolCallId;
|
|
1073
|
+
if (typeof toolCallId === "string") openToolCalls.set(toolCallId, {
|
|
1074
|
+
hasEnd: false,
|
|
1075
|
+
hasResult: false
|
|
1076
|
+
});
|
|
1077
|
+
break;
|
|
1078
|
+
}
|
|
1079
|
+
case _ag_ui_client.EventType.TOOL_CALL_END: {
|
|
1080
|
+
const toolCallId = event.toolCallId;
|
|
1081
|
+
const info = toolCallId ? openToolCalls.get(toolCallId) : void 0;
|
|
1082
|
+
if (info) info.hasEnd = true;
|
|
1083
|
+
break;
|
|
1084
|
+
}
|
|
1085
|
+
case _ag_ui_client.EventType.TOOL_CALL_RESULT: {
|
|
1086
|
+
const toolCallId = event.toolCallId;
|
|
1087
|
+
const info = toolCallId ? openToolCalls.get(toolCallId) : void 0;
|
|
1088
|
+
if (info) info.hasResult = true;
|
|
1089
|
+
break;
|
|
1090
|
+
}
|
|
1091
|
+
default: break;
|
|
1092
|
+
}
|
|
1093
|
+
const hasRunFinished = events.some((event) => event.type === _ag_ui_client.EventType.RUN_FINISHED);
|
|
1094
|
+
const hasRunError = events.some((event) => event.type === _ag_ui_client.EventType.RUN_ERROR);
|
|
1095
|
+
const terminalEventMissing = !(hasRunFinished || hasRunError);
|
|
1096
|
+
for (const messageId of openMessageIds) {
|
|
1097
|
+
const endEvent = {
|
|
1098
|
+
type: _ag_ui_client.EventType.TEXT_MESSAGE_END,
|
|
1099
|
+
messageId
|
|
1100
|
+
};
|
|
1101
|
+
events.push(endEvent);
|
|
1102
|
+
appended.push(endEvent);
|
|
1103
|
+
}
|
|
1104
|
+
for (const [toolCallId, info] of openToolCalls) {
|
|
1105
|
+
if (!info.hasEnd) {
|
|
1106
|
+
const endEvent = {
|
|
1107
|
+
type: _ag_ui_client.EventType.TOOL_CALL_END,
|
|
1108
|
+
toolCallId
|
|
1109
|
+
};
|
|
1110
|
+
events.push(endEvent);
|
|
1111
|
+
appended.push(endEvent);
|
|
1112
|
+
}
|
|
1113
|
+
if (terminalEventMissing && !info.hasResult) {
|
|
1114
|
+
const resultEvent = {
|
|
1115
|
+
type: _ag_ui_client.EventType.TOOL_CALL_RESULT,
|
|
1116
|
+
toolCallId,
|
|
1117
|
+
messageId: `${toolCallId !== null && toolCallId !== void 0 ? toolCallId : randomUUID()}-result`,
|
|
1118
|
+
role: "tool",
|
|
1119
|
+
content: JSON.stringify(stopRequested ? {
|
|
1120
|
+
status: "stopped",
|
|
1121
|
+
reason: "stop_requested",
|
|
1122
|
+
message: resolvedStopMessage
|
|
1123
|
+
} : {
|
|
1124
|
+
status: "error",
|
|
1125
|
+
reason: "missing_terminal_event",
|
|
1126
|
+
message: resolvedAbruptMessage
|
|
1127
|
+
})
|
|
1128
|
+
};
|
|
1129
|
+
events.push(resultEvent);
|
|
1130
|
+
appended.push(resultEvent);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
if (terminalEventMissing) if (stopRequested) {
|
|
1134
|
+
const finishedEvent = { type: _ag_ui_client.EventType.RUN_FINISHED };
|
|
1135
|
+
events.push(finishedEvent);
|
|
1136
|
+
appended.push(finishedEvent);
|
|
1137
|
+
} else {
|
|
1138
|
+
const errorEvent = {
|
|
1139
|
+
type: _ag_ui_client.EventType.RUN_ERROR,
|
|
1140
|
+
message: resolvedAbruptMessage,
|
|
1141
|
+
code: "INCOMPLETE_STREAM"
|
|
1142
|
+
};
|
|
1143
|
+
events.push(errorEvent);
|
|
1144
|
+
appended.push(errorEvent);
|
|
1145
|
+
}
|
|
1146
|
+
return appended;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
//#endregion
|
|
1150
|
+
//#region src/transcription-errors.ts
|
|
1151
|
+
/**
|
|
1152
|
+
* Error codes for transcription HTTP responses.
|
|
1153
|
+
* Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.
|
|
1154
|
+
* These codes are returned by the runtime and parsed by the client.
|
|
1155
|
+
*/
|
|
1156
|
+
let TranscriptionErrorCode = /* @__PURE__ */ function(TranscriptionErrorCode) {
|
|
1157
|
+
/** Transcription service not configured in runtime */
|
|
1158
|
+
TranscriptionErrorCode["SERVICE_NOT_CONFIGURED"] = "service_not_configured";
|
|
1159
|
+
/** Audio format not supported */
|
|
1160
|
+
TranscriptionErrorCode["INVALID_AUDIO_FORMAT"] = "invalid_audio_format";
|
|
1161
|
+
/** Audio file is too long */
|
|
1162
|
+
TranscriptionErrorCode["AUDIO_TOO_LONG"] = "audio_too_long";
|
|
1163
|
+
/** Audio file is empty or too short */
|
|
1164
|
+
TranscriptionErrorCode["AUDIO_TOO_SHORT"] = "audio_too_short";
|
|
1165
|
+
/** Rate limited by transcription provider */
|
|
1166
|
+
TranscriptionErrorCode["RATE_LIMITED"] = "rate_limited";
|
|
1167
|
+
/** Authentication failed with transcription provider */
|
|
1168
|
+
TranscriptionErrorCode["AUTH_FAILED"] = "auth_failed";
|
|
1169
|
+
/** Transcription provider returned an error */
|
|
1170
|
+
TranscriptionErrorCode["PROVIDER_ERROR"] = "provider_error";
|
|
1171
|
+
/** Network error during transcription */
|
|
1172
|
+
TranscriptionErrorCode["NETWORK_ERROR"] = "network_error";
|
|
1173
|
+
/** Invalid request format */
|
|
1174
|
+
TranscriptionErrorCode["INVALID_REQUEST"] = "invalid_request";
|
|
1175
|
+
return TranscriptionErrorCode;
|
|
1176
|
+
}({});
|
|
1177
|
+
/**
|
|
1178
|
+
* Helper functions to create transcription error responses.
|
|
1179
|
+
* Used by the runtime to return consistent error responses.
|
|
1180
|
+
*/
|
|
1181
|
+
const TranscriptionErrors = {
|
|
1182
|
+
serviceNotConfigured: () => ({
|
|
1183
|
+
error: TranscriptionErrorCode.SERVICE_NOT_CONFIGURED,
|
|
1184
|
+
message: "Transcription service is not configured",
|
|
1185
|
+
retryable: false
|
|
1186
|
+
}),
|
|
1187
|
+
invalidAudioFormat: (format, supported) => ({
|
|
1188
|
+
error: TranscriptionErrorCode.INVALID_AUDIO_FORMAT,
|
|
1189
|
+
message: `Unsupported audio format: ${format}. Supported: ${supported.join(", ")}`,
|
|
1190
|
+
retryable: false
|
|
1191
|
+
}),
|
|
1192
|
+
invalidRequest: (details) => ({
|
|
1193
|
+
error: TranscriptionErrorCode.INVALID_REQUEST,
|
|
1194
|
+
message: details,
|
|
1195
|
+
retryable: false
|
|
1196
|
+
}),
|
|
1197
|
+
rateLimited: () => ({
|
|
1198
|
+
error: TranscriptionErrorCode.RATE_LIMITED,
|
|
1199
|
+
message: "Rate limited. Please try again later.",
|
|
1200
|
+
retryable: true
|
|
1201
|
+
}),
|
|
1202
|
+
authFailed: () => ({
|
|
1203
|
+
error: TranscriptionErrorCode.AUTH_FAILED,
|
|
1204
|
+
message: "Authentication failed with transcription provider",
|
|
1205
|
+
retryable: false
|
|
1206
|
+
}),
|
|
1207
|
+
providerError: (message) => ({
|
|
1208
|
+
error: TranscriptionErrorCode.PROVIDER_ERROR,
|
|
1209
|
+
message,
|
|
1210
|
+
retryable: true
|
|
1211
|
+
}),
|
|
1212
|
+
networkError: (message = "Network error during transcription") => ({
|
|
1213
|
+
error: TranscriptionErrorCode.NETWORK_ERROR,
|
|
1214
|
+
message,
|
|
1215
|
+
retryable: true
|
|
1216
|
+
}),
|
|
1217
|
+
audioTooLong: () => ({
|
|
1218
|
+
error: TranscriptionErrorCode.AUDIO_TOO_LONG,
|
|
1219
|
+
message: "Audio file is too long",
|
|
1220
|
+
retryable: false
|
|
1221
|
+
}),
|
|
1222
|
+
audioTooShort: () => ({
|
|
1223
|
+
error: TranscriptionErrorCode.AUDIO_TOO_SHORT,
|
|
1224
|
+
message: "Audio is too short to transcribe",
|
|
1225
|
+
retryable: false
|
|
1226
|
+
})
|
|
1227
|
+
};
|
|
1228
|
+
|
|
968
1229
|
//#endregion
|
|
969
1230
|
//#region src/index.ts
|
|
970
1231
|
const COPILOTKIT_VERSION = version;
|
|
971
1232
|
|
|
972
1233
|
//#endregion
|
|
1234
|
+
exports.AG_UI_CHANNEL_EVENT = AG_UI_CHANNEL_EVENT;
|
|
973
1235
|
exports.BANNER_ERROR_NAMES = BANNER_ERROR_NAMES;
|
|
974
1236
|
exports.COPILOTKIT_VERSION = COPILOTKIT_VERSION;
|
|
975
1237
|
exports.COPILOT_CLOUD_API_URL = COPILOT_CLOUD_API_URL;
|
|
@@ -988,19 +1250,25 @@ exports.CopilotKitLowLevelError = CopilotKitLowLevelError;
|
|
|
988
1250
|
exports.CopilotKitMisuseError = CopilotKitMisuseError;
|
|
989
1251
|
exports.CopilotKitRemoteEndpointDiscoveryError = CopilotKitRemoteEndpointDiscoveryError;
|
|
990
1252
|
exports.CopilotKitVersionMismatchError = CopilotKitVersionMismatchError;
|
|
1253
|
+
exports.DEFAULT_AGENT_ID = DEFAULT_AGENT_ID;
|
|
991
1254
|
exports.ERROR_CONFIG = ERROR_CONFIG;
|
|
992
1255
|
exports.ERROR_NAMES = ERROR_NAMES;
|
|
993
1256
|
exports.ErrorVisibility = ErrorVisibility;
|
|
994
1257
|
exports.MissingPublicApiKeyError = MissingPublicApiKeyError;
|
|
1258
|
+
exports.RUNTIME_MODE_INTELLIGENCE = RUNTIME_MODE_INTELLIGENCE;
|
|
1259
|
+
exports.RUNTIME_MODE_SSE = RUNTIME_MODE_SSE;
|
|
995
1260
|
exports.ResolvedCopilotKitError = ResolvedCopilotKitError;
|
|
996
1261
|
exports.Severity = Severity;
|
|
997
1262
|
exports.TelemetryClient = TelemetryClient;
|
|
1263
|
+
exports.TranscriptionErrorCode = TranscriptionErrorCode;
|
|
1264
|
+
exports.TranscriptionErrors = TranscriptionErrors;
|
|
998
1265
|
exports.UpgradeRequiredError = UpgradeRequiredError;
|
|
999
1266
|
exports.actionParametersToJsonSchema = actionParametersToJsonSchema;
|
|
1000
1267
|
exports.convertJsonSchemaToZodSchema = convertJsonSchemaToZodSchema;
|
|
1001
1268
|
exports.dataToUUID = dataToUUID;
|
|
1002
1269
|
exports.ensureStructuredError = ensureStructuredError;
|
|
1003
1270
|
exports.executeConditions = executeConditions;
|
|
1271
|
+
exports.finalizeRunEvents = finalizeRunEvents;
|
|
1004
1272
|
exports.getPossibleVersionMismatch = getPossibleVersionMismatch;
|
|
1005
1273
|
exports.getZodParameters = getZodParameters;
|
|
1006
1274
|
exports.isMacOS = isMacOS;
|
|
@@ -1010,12 +1278,25 @@ exports.isValidUUID = isValidUUID;
|
|
|
1010
1278
|
exports.jsonSchemaToActionParameters = jsonSchemaToActionParameters;
|
|
1011
1279
|
exports.logCopilotKitPlatformMessage = logCopilotKitPlatformMessage;
|
|
1012
1280
|
exports.logStyled = logStyled;
|
|
1281
|
+
exports.logger = logger;
|
|
1013
1282
|
exports.parseJson = parseJson;
|
|
1283
|
+
exports.partialJSONParse = partialJSONParse;
|
|
1284
|
+
exports.phoenixExponentialBackoff = phoenixExponentialBackoff;
|
|
1014
1285
|
exports.publicApiKeyRequired = publicApiKeyRequired;
|
|
1015
1286
|
exports.randomId = randomId;
|
|
1016
1287
|
exports.randomUUID = randomUUID;
|
|
1017
1288
|
exports.readBody = readBody;
|
|
1289
|
+
exports.safeParseToolArgs = safeParseToolArgs;
|
|
1290
|
+
exports.schemaToJsonSchema = schemaToJsonSchema;
|
|
1018
1291
|
exports.styledConsole = styledConsole;
|
|
1019
1292
|
exports.tryMap = tryMap;
|
|
1293
|
+
var _copilotkit_license_verifier = require("@copilotkit/license-verifier");
|
|
1294
|
+
Object.keys(_copilotkit_license_verifier).forEach(function (k) {
|
|
1295
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
1296
|
+
enumerable: true,
|
|
1297
|
+
get: function () { return _copilotkit_license_verifier[k]; }
|
|
1298
|
+
});
|
|
1299
|
+
});
|
|
1300
|
+
|
|
1020
1301
|
});
|
|
1021
1302
|
//# sourceMappingURL=index.umd.js.map
|