@copilotkit/shared 1.54.1 → 1.55.0-next.8
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 +7 -1
- 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 +11 -4
- 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/CHANGELOG.md
CHANGED
package/dist/constants/index.cjs
CHANGED
|
@@ -4,10 +4,15 @@ const COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
|
|
|
4
4
|
const COPILOT_CLOUD_VERSION = "v1";
|
|
5
5
|
const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;
|
|
6
6
|
const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
|
|
7
|
+
const DEFAULT_AGENT_ID = "default";
|
|
8
|
+
/** Phoenix channel event name used for all AG-UI events. */
|
|
9
|
+
const AG_UI_CHANNEL_EVENT = "ag-ui";
|
|
7
10
|
|
|
8
11
|
//#endregion
|
|
12
|
+
exports.AG_UI_CHANNEL_EVENT = AG_UI_CHANNEL_EVENT;
|
|
9
13
|
exports.COPILOT_CLOUD_API_URL = COPILOT_CLOUD_API_URL;
|
|
10
14
|
exports.COPILOT_CLOUD_CHAT_URL = COPILOT_CLOUD_CHAT_URL;
|
|
11
15
|
exports.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = COPILOT_CLOUD_PUBLIC_API_KEY_HEADER;
|
|
12
16
|
exports.COPILOT_CLOUD_VERSION = COPILOT_CLOUD_VERSION;
|
|
17
|
+
exports.DEFAULT_AGENT_ID = DEFAULT_AGENT_ID;
|
|
13
18
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/constants/index.ts"],"sourcesContent":["export const COPILOT_CLOUD_API_URL = \"https://api.cloud.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;\nexport const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER =\n \"X-CopilotCloud-Public-Api-Key\";\n"],"mappings":";;AAAA,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;AACrC,MAAa,yBAAyB,GAAG,sBAAsB,cAAc;AAC7E,MAAa,sCACX"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/constants/index.ts"],"sourcesContent":["export const COPILOT_CLOUD_API_URL = \"https://api.cloud.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;\nexport const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER =\n \"X-CopilotCloud-Public-Api-Key\";\n\nexport const DEFAULT_AGENT_ID = \"default\";\n\n/** Phoenix channel event name used for all AG-UI events. */\nexport const AG_UI_CHANNEL_EVENT = \"ag-ui\";\n"],"mappings":";;AAAA,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;AACrC,MAAa,yBAAyB,GAAG,sBAAsB,cAAc;AAC7E,MAAa,sCACX;AAEF,MAAa,mBAAmB;;AAGhC,MAAa,sBAAsB"}
|
|
@@ -3,6 +3,9 @@ declare const COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
|
|
|
3
3
|
declare const COPILOT_CLOUD_VERSION = "v1";
|
|
4
4
|
declare const COPILOT_CLOUD_CHAT_URL = "https://api.cloud.copilotkit.ai/copilotkit/v1";
|
|
5
5
|
declare const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
|
|
6
|
+
declare const DEFAULT_AGENT_ID = "default";
|
|
7
|
+
/** Phoenix channel event name used for all AG-UI events. */
|
|
8
|
+
declare const AG_UI_CHANNEL_EVENT = "ag-ui";
|
|
6
9
|
//#endregion
|
|
7
|
-
export { COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION };
|
|
10
|
+
export { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, DEFAULT_AGENT_ID };
|
|
8
11
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/constants/index.ts"],"mappings":";cAAa,qBAAA;AAAA,cACA,qBAAA;AAAA,cACA,sBAAA;AAAA,cACA,mCAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/constants/index.ts"],"mappings":";cAAa,qBAAA;AAAA,cACA,qBAAA;AAAA,cACA,sBAAA;AAAA,cACA,mCAAA;AAAA,cAGA,gBAAA;;cAGA,mBAAA"}
|
|
@@ -3,6 +3,9 @@ declare const COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
|
|
|
3
3
|
declare const COPILOT_CLOUD_VERSION = "v1";
|
|
4
4
|
declare const COPILOT_CLOUD_CHAT_URL = "https://api.cloud.copilotkit.ai/copilotkit/v1";
|
|
5
5
|
declare const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
|
|
6
|
+
declare const DEFAULT_AGENT_ID = "default";
|
|
7
|
+
/** Phoenix channel event name used for all AG-UI events. */
|
|
8
|
+
declare const AG_UI_CHANNEL_EVENT = "ag-ui";
|
|
6
9
|
//#endregion
|
|
7
|
-
export { COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION };
|
|
10
|
+
export { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, DEFAULT_AGENT_ID };
|
|
8
11
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/constants/index.ts"],"mappings":";cAAa,qBAAA;AAAA,cACA,qBAAA;AAAA,cACA,sBAAA;AAAA,cACA,mCAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/constants/index.ts"],"mappings":";cAAa,qBAAA;AAAA,cACA,qBAAA;AAAA,cACA,sBAAA;AAAA,cACA,mCAAA;AAAA,cAGA,gBAAA;;cAGA,mBAAA"}
|
package/dist/constants/index.mjs
CHANGED
|
@@ -3,7 +3,10 @@ const COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
|
|
|
3
3
|
const COPILOT_CLOUD_VERSION = "v1";
|
|
4
4
|
const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;
|
|
5
5
|
const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
|
|
6
|
+
const DEFAULT_AGENT_ID = "default";
|
|
7
|
+
/** Phoenix channel event name used for all AG-UI events. */
|
|
8
|
+
const AG_UI_CHANNEL_EVENT = "ag-ui";
|
|
6
9
|
|
|
7
10
|
//#endregion
|
|
8
|
-
export { COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION };
|
|
11
|
+
export { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, DEFAULT_AGENT_ID };
|
|
9
12
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/constants/index.ts"],"sourcesContent":["export const COPILOT_CLOUD_API_URL = \"https://api.cloud.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;\nexport const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER =\n \"X-CopilotCloud-Public-Api-Key\";\n"],"mappings":";AAAA,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;AACrC,MAAa,yBAAyB,GAAG,sBAAsB,cAAc;AAC7E,MAAa,sCACX"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/constants/index.ts"],"sourcesContent":["export const COPILOT_CLOUD_API_URL = \"https://api.cloud.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;\nexport const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER =\n \"X-CopilotCloud-Public-Api-Key\";\n\nexport const DEFAULT_AGENT_ID = \"default\";\n\n/** Phoenix channel event name used for all AG-UI events. */\nexport const AG_UI_CHANNEL_EVENT = \"ag-ui\";\n"],"mappings":";AAAA,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;AACrC,MAAa,yBAAyB,GAAG,sBAAsB,cAAc;AAC7E,MAAa,sCACX;AAEF,MAAa,mBAAmB;;AAGhC,MAAa,sBAAsB"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_random_id = require('./utils/random-id.cjs');
|
|
3
|
+
let _ag_ui_client = require("@ag-ui/client");
|
|
4
|
+
|
|
5
|
+
//#region src/finalize-events.ts
|
|
6
|
+
const defaultStopMessage = "Run stopped by user";
|
|
7
|
+
const defaultAbruptEndMessage = "Run ended without emitting a terminal event";
|
|
8
|
+
function finalizeRunEvents(events, options = {}) {
|
|
9
|
+
const { stopRequested = false, interruptionMessage } = options;
|
|
10
|
+
const resolvedStopMessage = interruptionMessage ?? defaultStopMessage;
|
|
11
|
+
const resolvedAbruptMessage = interruptionMessage && interruptionMessage !== defaultStopMessage ? interruptionMessage : defaultAbruptEndMessage;
|
|
12
|
+
const appended = [];
|
|
13
|
+
const openMessageIds = /* @__PURE__ */ new Set();
|
|
14
|
+
const openToolCalls = /* @__PURE__ */ new Map();
|
|
15
|
+
for (const event of events) switch (event.type) {
|
|
16
|
+
case _ag_ui_client.EventType.TEXT_MESSAGE_START: {
|
|
17
|
+
const messageId = event.messageId;
|
|
18
|
+
if (typeof messageId === "string") openMessageIds.add(messageId);
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
case _ag_ui_client.EventType.TEXT_MESSAGE_END: {
|
|
22
|
+
const messageId = event.messageId;
|
|
23
|
+
if (typeof messageId === "string") openMessageIds.delete(messageId);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
case _ag_ui_client.EventType.TOOL_CALL_START: {
|
|
27
|
+
const toolCallId = event.toolCallId;
|
|
28
|
+
if (typeof toolCallId === "string") openToolCalls.set(toolCallId, {
|
|
29
|
+
hasEnd: false,
|
|
30
|
+
hasResult: false
|
|
31
|
+
});
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case _ag_ui_client.EventType.TOOL_CALL_END: {
|
|
35
|
+
const toolCallId = event.toolCallId;
|
|
36
|
+
const info = toolCallId ? openToolCalls.get(toolCallId) : void 0;
|
|
37
|
+
if (info) info.hasEnd = true;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case _ag_ui_client.EventType.TOOL_CALL_RESULT: {
|
|
41
|
+
const toolCallId = event.toolCallId;
|
|
42
|
+
const info = toolCallId ? openToolCalls.get(toolCallId) : void 0;
|
|
43
|
+
if (info) info.hasResult = true;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
default: break;
|
|
47
|
+
}
|
|
48
|
+
const hasRunFinished = events.some((event) => event.type === _ag_ui_client.EventType.RUN_FINISHED);
|
|
49
|
+
const hasRunError = events.some((event) => event.type === _ag_ui_client.EventType.RUN_ERROR);
|
|
50
|
+
const terminalEventMissing = !(hasRunFinished || hasRunError);
|
|
51
|
+
for (const messageId of openMessageIds) {
|
|
52
|
+
const endEvent = {
|
|
53
|
+
type: _ag_ui_client.EventType.TEXT_MESSAGE_END,
|
|
54
|
+
messageId
|
|
55
|
+
};
|
|
56
|
+
events.push(endEvent);
|
|
57
|
+
appended.push(endEvent);
|
|
58
|
+
}
|
|
59
|
+
for (const [toolCallId, info] of openToolCalls) {
|
|
60
|
+
if (!info.hasEnd) {
|
|
61
|
+
const endEvent = {
|
|
62
|
+
type: _ag_ui_client.EventType.TOOL_CALL_END,
|
|
63
|
+
toolCallId
|
|
64
|
+
};
|
|
65
|
+
events.push(endEvent);
|
|
66
|
+
appended.push(endEvent);
|
|
67
|
+
}
|
|
68
|
+
if (terminalEventMissing && !info.hasResult) {
|
|
69
|
+
const resultEvent = {
|
|
70
|
+
type: _ag_ui_client.EventType.TOOL_CALL_RESULT,
|
|
71
|
+
toolCallId,
|
|
72
|
+
messageId: `${toolCallId ?? require_random_id.randomUUID()}-result`,
|
|
73
|
+
role: "tool",
|
|
74
|
+
content: JSON.stringify(stopRequested ? {
|
|
75
|
+
status: "stopped",
|
|
76
|
+
reason: "stop_requested",
|
|
77
|
+
message: resolvedStopMessage
|
|
78
|
+
} : {
|
|
79
|
+
status: "error",
|
|
80
|
+
reason: "missing_terminal_event",
|
|
81
|
+
message: resolvedAbruptMessage
|
|
82
|
+
})
|
|
83
|
+
};
|
|
84
|
+
events.push(resultEvent);
|
|
85
|
+
appended.push(resultEvent);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (terminalEventMissing) if (stopRequested) {
|
|
89
|
+
const finishedEvent = { type: _ag_ui_client.EventType.RUN_FINISHED };
|
|
90
|
+
events.push(finishedEvent);
|
|
91
|
+
appended.push(finishedEvent);
|
|
92
|
+
} else {
|
|
93
|
+
const errorEvent = {
|
|
94
|
+
type: _ag_ui_client.EventType.RUN_ERROR,
|
|
95
|
+
message: resolvedAbruptMessage,
|
|
96
|
+
code: "INCOMPLETE_STREAM"
|
|
97
|
+
};
|
|
98
|
+
events.push(errorEvent);
|
|
99
|
+
appended.push(errorEvent);
|
|
100
|
+
}
|
|
101
|
+
return appended;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
//#endregion
|
|
105
|
+
exports.finalizeRunEvents = finalizeRunEvents;
|
|
106
|
+
//# sourceMappingURL=finalize-events.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalize-events.cjs","names":["EventType","randomUUID"],"sources":["../src/finalize-events.ts"],"sourcesContent":["import { BaseEvent, EventType, RunErrorEvent } 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(\n (event) => event.type === EventType.RUN_FINISHED,\n );\n const hasRunError = events.some(\n (event) => event.type === EventType.RUN_ERROR,\n );\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":";;;;;AAQA,MAAM,qBAAqB;AAC3B,MAAM,0BAA0B;AAEhC,SAAgB,kBACd,QACA,UAA8B,EAAE,EACnB;CACb,MAAM,EAAE,gBAAgB,OAAO,wBAAwB;CAEvD,MAAM,sBAAsB,uBAAuB;CACnD,MAAM,wBACJ,uBAAuB,wBAAwB,qBAC3C,sBACA;CAEN,MAAM,WAAwB,EAAE;CAEhC,MAAM,iCAAiB,IAAI,KAAa;CACxC,MAAM,gCAAgB,IAAI,KAMvB;AAEH,MAAK,MAAM,SAAS,OAClB,SAAQ,MAAM,MAAd;EACE,KAAKA,wBAAU,oBAAoB;GACjC,MAAM,YAAa,MAAiC;AACpD,OAAI,OAAO,cAAc,SACvB,gBAAe,IAAI,UAAU;AAE/B;;EAEF,KAAKA,wBAAU,kBAAkB;GAC/B,MAAM,YAAa,MAAiC;AACpD,OAAI,OAAO,cAAc,SACvB,gBAAe,OAAO,UAAU;AAElC;;EAEF,KAAKA,wBAAU,iBAAiB;GAC9B,MAAM,aAAc,MAAkC;AACtD,OAAI,OAAO,eAAe,SACxB,eAAc,IAAI,YAAY;IAC5B,QAAQ;IACR,WAAW;IACZ,CAAC;AAEJ;;EAEF,KAAKA,wBAAU,eAAe;GAC5B,MAAM,aAAc,MAAkC;GACtD,MAAM,OAAO,aAAa,cAAc,IAAI,WAAW,GAAG;AAC1D,OAAI,KACF,MAAK,SAAS;AAEhB;;EAEF,KAAKA,wBAAU,kBAAkB;GAC/B,MAAM,aAAc,MAAkC;GACtD,MAAM,OAAO,aAAa,cAAc,IAAI,WAAW,GAAG;AAC1D,OAAI,KACF,MAAK,YAAY;AAEnB;;EAEF,QACE;;CAIN,MAAM,iBAAiB,OAAO,MAC3B,UAAU,MAAM,SAASA,wBAAU,aACrC;CACD,MAAM,cAAc,OAAO,MACxB,UAAU,MAAM,SAASA,wBAAU,UACrC;CAED,MAAM,uBAAuB,EADJ,kBAAkB;AAG3C,MAAK,MAAM,aAAa,gBAAgB;EACtC,MAAM,WAAW;GACf,MAAMA,wBAAU;GAChB;GACD;AACD,SAAO,KAAK,SAAS;AACrB,WAAS,KAAK,SAAS;;AAGzB,MAAK,MAAM,CAAC,YAAY,SAAS,eAAe;AAC9C,MAAI,CAAC,KAAK,QAAQ;GAChB,MAAM,WAAW;IACf,MAAMA,wBAAU;IAChB;IACD;AACD,UAAO,KAAK,SAAS;AACrB,YAAS,KAAK,SAAS;;AAGzB,MAAI,wBAAwB,CAAC,KAAK,WAAW;GAC3C,MAAM,cAAc;IAClB,MAAMA,wBAAU;IAChB;IACA,WAAW,GAAG,cAAcC,8BAAY,CAAC;IACzC,MAAM;IACN,SAAS,KAAK,UACZ,gBACI;KACE,QAAQ;KACR,QAAQ;KACR,SAAS;KACV,GACD;KACE,QAAQ;KACR,QAAQ;KACR,SAAS;KACV,CACN;IACF;AACD,UAAO,KAAK,YAAY;AACxB,YAAS,KAAK,YAAY;;;AAI9B,KAAI,qBACF,KAAI,eAAe;EACjB,MAAM,gBAAgB,EACpB,MAAMD,wBAAU,cACjB;AACD,SAAO,KAAK,cAAc;AAC1B,WAAS,KAAK,cAAc;QACvB;EACL,MAAM,aAA4B;GAChC,MAAMA,wBAAU;GAChB,SAAS;GACT,MAAM;GACP;AACD,SAAO,KAAK,WAAW;AACvB,WAAS,KAAK,WAAW;;AAI7B,QAAO"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseEvent } from "@ag-ui/client";
|
|
2
|
+
|
|
3
|
+
//#region src/finalize-events.d.ts
|
|
4
|
+
interface FinalizeRunOptions {
|
|
5
|
+
stopRequested?: boolean;
|
|
6
|
+
interruptionMessage?: string;
|
|
7
|
+
}
|
|
8
|
+
declare function finalizeRunEvents(events: BaseEvent[], options?: FinalizeRunOptions): BaseEvent[];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { finalizeRunEvents };
|
|
11
|
+
//# sourceMappingURL=finalize-events.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalize-events.d.cts","names":[],"sources":["../src/finalize-events.ts"],"mappings":";;;UAGU,kBAAA;EACR,aAAA;EACA,mBAAA;AAAA;AAAA,iBAMc,iBAAA,CACd,MAAA,EAAQ,SAAA,IACR,OAAA,GAAS,kBAAA,GACR,SAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseEvent } from "@ag-ui/client";
|
|
2
|
+
|
|
3
|
+
//#region src/finalize-events.d.ts
|
|
4
|
+
interface FinalizeRunOptions {
|
|
5
|
+
stopRequested?: boolean;
|
|
6
|
+
interruptionMessage?: string;
|
|
7
|
+
}
|
|
8
|
+
declare function finalizeRunEvents(events: BaseEvent[], options?: FinalizeRunOptions): BaseEvent[];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { finalizeRunEvents };
|
|
11
|
+
//# sourceMappingURL=finalize-events.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalize-events.d.mts","names":[],"sources":["../src/finalize-events.ts"],"mappings":";;;UAGU,kBAAA;EACR,aAAA;EACA,mBAAA;AAAA;AAAA,iBAMc,iBAAA,CACd,MAAA,EAAQ,SAAA,IACR,OAAA,GAAS,kBAAA,GACR,SAAA"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { randomUUID } from "./utils/random-id.mjs";
|
|
2
|
+
import { EventType } from "@ag-ui/client";
|
|
3
|
+
|
|
4
|
+
//#region src/finalize-events.ts
|
|
5
|
+
const defaultStopMessage = "Run stopped by user";
|
|
6
|
+
const defaultAbruptEndMessage = "Run ended without emitting a terminal event";
|
|
7
|
+
function finalizeRunEvents(events, options = {}) {
|
|
8
|
+
const { stopRequested = false, interruptionMessage } = options;
|
|
9
|
+
const resolvedStopMessage = interruptionMessage ?? defaultStopMessage;
|
|
10
|
+
const resolvedAbruptMessage = interruptionMessage && interruptionMessage !== defaultStopMessage ? interruptionMessage : defaultAbruptEndMessage;
|
|
11
|
+
const appended = [];
|
|
12
|
+
const openMessageIds = /* @__PURE__ */ new Set();
|
|
13
|
+
const openToolCalls = /* @__PURE__ */ new Map();
|
|
14
|
+
for (const event of events) switch (event.type) {
|
|
15
|
+
case EventType.TEXT_MESSAGE_START: {
|
|
16
|
+
const messageId = event.messageId;
|
|
17
|
+
if (typeof messageId === "string") openMessageIds.add(messageId);
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
case EventType.TEXT_MESSAGE_END: {
|
|
21
|
+
const messageId = event.messageId;
|
|
22
|
+
if (typeof messageId === "string") openMessageIds.delete(messageId);
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
case EventType.TOOL_CALL_START: {
|
|
26
|
+
const toolCallId = event.toolCallId;
|
|
27
|
+
if (typeof toolCallId === "string") openToolCalls.set(toolCallId, {
|
|
28
|
+
hasEnd: false,
|
|
29
|
+
hasResult: false
|
|
30
|
+
});
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
case EventType.TOOL_CALL_END: {
|
|
34
|
+
const toolCallId = event.toolCallId;
|
|
35
|
+
const info = toolCallId ? openToolCalls.get(toolCallId) : void 0;
|
|
36
|
+
if (info) info.hasEnd = true;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case EventType.TOOL_CALL_RESULT: {
|
|
40
|
+
const toolCallId = event.toolCallId;
|
|
41
|
+
const info = toolCallId ? openToolCalls.get(toolCallId) : void 0;
|
|
42
|
+
if (info) info.hasResult = true;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
default: break;
|
|
46
|
+
}
|
|
47
|
+
const hasRunFinished = events.some((event) => event.type === EventType.RUN_FINISHED);
|
|
48
|
+
const hasRunError = events.some((event) => event.type === EventType.RUN_ERROR);
|
|
49
|
+
const terminalEventMissing = !(hasRunFinished || hasRunError);
|
|
50
|
+
for (const messageId of openMessageIds) {
|
|
51
|
+
const endEvent = {
|
|
52
|
+
type: EventType.TEXT_MESSAGE_END,
|
|
53
|
+
messageId
|
|
54
|
+
};
|
|
55
|
+
events.push(endEvent);
|
|
56
|
+
appended.push(endEvent);
|
|
57
|
+
}
|
|
58
|
+
for (const [toolCallId, info] of openToolCalls) {
|
|
59
|
+
if (!info.hasEnd) {
|
|
60
|
+
const endEvent = {
|
|
61
|
+
type: EventType.TOOL_CALL_END,
|
|
62
|
+
toolCallId
|
|
63
|
+
};
|
|
64
|
+
events.push(endEvent);
|
|
65
|
+
appended.push(endEvent);
|
|
66
|
+
}
|
|
67
|
+
if (terminalEventMissing && !info.hasResult) {
|
|
68
|
+
const resultEvent = {
|
|
69
|
+
type: EventType.TOOL_CALL_RESULT,
|
|
70
|
+
toolCallId,
|
|
71
|
+
messageId: `${toolCallId ?? randomUUID()}-result`,
|
|
72
|
+
role: "tool",
|
|
73
|
+
content: JSON.stringify(stopRequested ? {
|
|
74
|
+
status: "stopped",
|
|
75
|
+
reason: "stop_requested",
|
|
76
|
+
message: resolvedStopMessage
|
|
77
|
+
} : {
|
|
78
|
+
status: "error",
|
|
79
|
+
reason: "missing_terminal_event",
|
|
80
|
+
message: resolvedAbruptMessage
|
|
81
|
+
})
|
|
82
|
+
};
|
|
83
|
+
events.push(resultEvent);
|
|
84
|
+
appended.push(resultEvent);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (terminalEventMissing) if (stopRequested) {
|
|
88
|
+
const finishedEvent = { type: EventType.RUN_FINISHED };
|
|
89
|
+
events.push(finishedEvent);
|
|
90
|
+
appended.push(finishedEvent);
|
|
91
|
+
} else {
|
|
92
|
+
const errorEvent = {
|
|
93
|
+
type: EventType.RUN_ERROR,
|
|
94
|
+
message: resolvedAbruptMessage,
|
|
95
|
+
code: "INCOMPLETE_STREAM"
|
|
96
|
+
};
|
|
97
|
+
events.push(errorEvent);
|
|
98
|
+
appended.push(errorEvent);
|
|
99
|
+
}
|
|
100
|
+
return appended;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
export { finalizeRunEvents };
|
|
105
|
+
//# sourceMappingURL=finalize-events.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalize-events.mjs","names":[],"sources":["../src/finalize-events.ts"],"sourcesContent":["import { BaseEvent, EventType, RunErrorEvent } 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(\n (event) => event.type === EventType.RUN_FINISHED,\n );\n const hasRunError = events.some(\n (event) => event.type === EventType.RUN_ERROR,\n );\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":";;;;AAQA,MAAM,qBAAqB;AAC3B,MAAM,0BAA0B;AAEhC,SAAgB,kBACd,QACA,UAA8B,EAAE,EACnB;CACb,MAAM,EAAE,gBAAgB,OAAO,wBAAwB;CAEvD,MAAM,sBAAsB,uBAAuB;CACnD,MAAM,wBACJ,uBAAuB,wBAAwB,qBAC3C,sBACA;CAEN,MAAM,WAAwB,EAAE;CAEhC,MAAM,iCAAiB,IAAI,KAAa;CACxC,MAAM,gCAAgB,IAAI,KAMvB;AAEH,MAAK,MAAM,SAAS,OAClB,SAAQ,MAAM,MAAd;EACE,KAAK,UAAU,oBAAoB;GACjC,MAAM,YAAa,MAAiC;AACpD,OAAI,OAAO,cAAc,SACvB,gBAAe,IAAI,UAAU;AAE/B;;EAEF,KAAK,UAAU,kBAAkB;GAC/B,MAAM,YAAa,MAAiC;AACpD,OAAI,OAAO,cAAc,SACvB,gBAAe,OAAO,UAAU;AAElC;;EAEF,KAAK,UAAU,iBAAiB;GAC9B,MAAM,aAAc,MAAkC;AACtD,OAAI,OAAO,eAAe,SACxB,eAAc,IAAI,YAAY;IAC5B,QAAQ;IACR,WAAW;IACZ,CAAC;AAEJ;;EAEF,KAAK,UAAU,eAAe;GAC5B,MAAM,aAAc,MAAkC;GACtD,MAAM,OAAO,aAAa,cAAc,IAAI,WAAW,GAAG;AAC1D,OAAI,KACF,MAAK,SAAS;AAEhB;;EAEF,KAAK,UAAU,kBAAkB;GAC/B,MAAM,aAAc,MAAkC;GACtD,MAAM,OAAO,aAAa,cAAc,IAAI,WAAW,GAAG;AAC1D,OAAI,KACF,MAAK,YAAY;AAEnB;;EAEF,QACE;;CAIN,MAAM,iBAAiB,OAAO,MAC3B,UAAU,MAAM,SAAS,UAAU,aACrC;CACD,MAAM,cAAc,OAAO,MACxB,UAAU,MAAM,SAAS,UAAU,UACrC;CAED,MAAM,uBAAuB,EADJ,kBAAkB;AAG3C,MAAK,MAAM,aAAa,gBAAgB;EACtC,MAAM,WAAW;GACf,MAAM,UAAU;GAChB;GACD;AACD,SAAO,KAAK,SAAS;AACrB,WAAS,KAAK,SAAS;;AAGzB,MAAK,MAAM,CAAC,YAAY,SAAS,eAAe;AAC9C,MAAI,CAAC,KAAK,QAAQ;GAChB,MAAM,WAAW;IACf,MAAM,UAAU;IAChB;IACD;AACD,UAAO,KAAK,SAAS;AACrB,YAAS,KAAK,SAAS;;AAGzB,MAAI,wBAAwB,CAAC,KAAK,WAAW;GAC3C,MAAM,cAAc;IAClB,MAAM,UAAU;IAChB;IACA,WAAW,GAAG,cAAc,YAAY,CAAC;IACzC,MAAM;IACN,SAAS,KAAK,UACZ,gBACI;KACE,QAAQ;KACR,QAAQ;KACR,SAAS;KACV,GACD;KACE,QAAQ;KACR,QAAQ;KACR,SAAS;KACV,CACN;IACF;AACD,UAAO,KAAK,YAAY;AACxB,YAAS,KAAK,YAAY;;;AAI9B,KAAI,qBACF,KAAI,eAAe;EACjB,MAAM,gBAAgB,EACpB,MAAM,UAAU,cACjB;AACD,SAAO,KAAK,cAAc;AAC1B,WAAS,KAAK,cAAc;QACvB;EACL,MAAM,aAA4B;GAChC,MAAM,UAAU;GAChB,SAAS;GACT,MAAM;GACP;AACD,SAAO,KAAK,WAAW;AACvB,WAAS,KAAK,WAAW;;AAI7B,QAAO"}
|
package/dist/index.cjs
CHANGED
|
@@ -3,17 +3,23 @@ const require_conditions = require('./utils/conditions.cjs');
|
|
|
3
3
|
const require_console_styling = require('./utils/console-styling.cjs');
|
|
4
4
|
const require_errors = require('./utils/errors.cjs');
|
|
5
5
|
const require_json_schema = require('./utils/json-schema.cjs');
|
|
6
|
+
const require_types = require('./utils/types.cjs');
|
|
6
7
|
const require_random_id = require('./utils/random-id.cjs');
|
|
7
8
|
const require_requests = require('./utils/requests.cjs');
|
|
8
9
|
const require_index = require('./utils/index.cjs');
|
|
9
10
|
const require_index$1 = require('./constants/index.cjs');
|
|
10
11
|
const require_package = require('./package.cjs');
|
|
11
12
|
const require_telemetry_client = require('./telemetry/telemetry-client.cjs');
|
|
13
|
+
const require_standard_schema = require('./standard-schema.cjs');
|
|
14
|
+
const require_logger = require('./logger.cjs');
|
|
15
|
+
const require_finalize_events = require('./finalize-events.cjs');
|
|
16
|
+
const require_transcription_errors = require('./transcription-errors.cjs');
|
|
12
17
|
|
|
13
18
|
//#region src/index.ts
|
|
14
19
|
const COPILOTKIT_VERSION = require_package.version;
|
|
15
20
|
|
|
16
21
|
//#endregion
|
|
22
|
+
exports.AG_UI_CHANNEL_EVENT = require_index$1.AG_UI_CHANNEL_EVENT;
|
|
17
23
|
exports.BANNER_ERROR_NAMES = require_errors.BANNER_ERROR_NAMES;
|
|
18
24
|
exports.COPILOTKIT_VERSION = COPILOTKIT_VERSION;
|
|
19
25
|
exports.COPILOT_CLOUD_API_URL = require_index$1.COPILOT_CLOUD_API_URL;
|
|
@@ -32,19 +38,25 @@ exports.CopilotKitLowLevelError = require_errors.CopilotKitLowLevelError;
|
|
|
32
38
|
exports.CopilotKitMisuseError = require_errors.CopilotKitMisuseError;
|
|
33
39
|
exports.CopilotKitRemoteEndpointDiscoveryError = require_errors.CopilotKitRemoteEndpointDiscoveryError;
|
|
34
40
|
exports.CopilotKitVersionMismatchError = require_errors.CopilotKitVersionMismatchError;
|
|
41
|
+
exports.DEFAULT_AGENT_ID = require_index$1.DEFAULT_AGENT_ID;
|
|
35
42
|
exports.ERROR_CONFIG = require_errors.ERROR_CONFIG;
|
|
36
43
|
exports.ERROR_NAMES = require_errors.ERROR_NAMES;
|
|
37
44
|
exports.ErrorVisibility = require_errors.ErrorVisibility;
|
|
38
45
|
exports.MissingPublicApiKeyError = require_errors.MissingPublicApiKeyError;
|
|
46
|
+
exports.RUNTIME_MODE_INTELLIGENCE = require_types.RUNTIME_MODE_INTELLIGENCE;
|
|
47
|
+
exports.RUNTIME_MODE_SSE = require_types.RUNTIME_MODE_SSE;
|
|
39
48
|
exports.ResolvedCopilotKitError = require_errors.ResolvedCopilotKitError;
|
|
40
49
|
exports.Severity = require_errors.Severity;
|
|
41
50
|
exports.TelemetryClient = require_telemetry_client.TelemetryClient;
|
|
51
|
+
exports.TranscriptionErrorCode = require_transcription_errors.TranscriptionErrorCode;
|
|
52
|
+
exports.TranscriptionErrors = require_transcription_errors.TranscriptionErrors;
|
|
42
53
|
exports.UpgradeRequiredError = require_errors.UpgradeRequiredError;
|
|
43
54
|
exports.actionParametersToJsonSchema = require_json_schema.actionParametersToJsonSchema;
|
|
44
55
|
exports.convertJsonSchemaToZodSchema = require_json_schema.convertJsonSchemaToZodSchema;
|
|
45
56
|
exports.dataToUUID = require_random_id.dataToUUID;
|
|
46
57
|
exports.ensureStructuredError = require_errors.ensureStructuredError;
|
|
47
58
|
exports.executeConditions = require_conditions.executeConditions;
|
|
59
|
+
exports.finalizeRunEvents = require_finalize_events.finalizeRunEvents;
|
|
48
60
|
exports.getPossibleVersionMismatch = require_errors.getPossibleVersionMismatch;
|
|
49
61
|
exports.getZodParameters = require_json_schema.getZodParameters;
|
|
50
62
|
exports.isMacOS = require_index.isMacOS;
|
|
@@ -54,11 +66,24 @@ exports.isValidUUID = require_random_id.isValidUUID;
|
|
|
54
66
|
exports.jsonSchemaToActionParameters = require_json_schema.jsonSchemaToActionParameters;
|
|
55
67
|
exports.logCopilotKitPlatformMessage = require_console_styling.logCopilotKitPlatformMessage;
|
|
56
68
|
exports.logStyled = require_console_styling.logStyled;
|
|
69
|
+
exports.logger = require_logger.logger;
|
|
57
70
|
exports.parseJson = require_index.parseJson;
|
|
71
|
+
exports.partialJSONParse = require_index.partialJSONParse;
|
|
72
|
+
exports.phoenixExponentialBackoff = require_index.phoenixExponentialBackoff;
|
|
58
73
|
exports.publicApiKeyRequired = require_console_styling.publicApiKeyRequired;
|
|
59
74
|
exports.randomId = require_random_id.randomId;
|
|
60
75
|
exports.randomUUID = require_random_id.randomUUID;
|
|
61
76
|
exports.readBody = require_requests.readBody;
|
|
77
|
+
exports.safeParseToolArgs = require_index.safeParseToolArgs;
|
|
78
|
+
exports.schemaToJsonSchema = require_standard_schema.schemaToJsonSchema;
|
|
62
79
|
exports.styledConsole = require_console_styling.styledConsole;
|
|
63
80
|
exports.tryMap = require_index.tryMap;
|
|
81
|
+
var _copilotkit_license_verifier = require("@copilotkit/license-verifier");
|
|
82
|
+
Object.keys(_copilotkit_license_verifier).forEach(function (k) {
|
|
83
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: function () { return _copilotkit_license_verifier[k]; }
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
64
89
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./standard-schema\";\n\nexport { logger } from \"./logger\";\nexport { finalizeRunEvents } from \"./finalize-events\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\nexport * from \"@copilotkit/license-verifier\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,MAAa"}
|
package/dist/index.d.cts
CHANGED
|
@@ -8,15 +8,20 @@ import { BaseCondition, ComparisonCondition, ComparisonRule, Condition, Existenc
|
|
|
8
8
|
import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.cjs";
|
|
9
9
|
import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, getPossibleVersionMismatch, isStructuredCopilotKitError } from "./utils/errors.cjs";
|
|
10
10
|
import { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters } from "./utils/json-schema.cjs";
|
|
11
|
-
import { AgentDescription, MaybePromise, NonEmptyRecord, RuntimeInfo } from "./utils/types.cjs";
|
|
11
|
+
import { AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode } from "./utils/types.cjs";
|
|
12
12
|
import { dataToUUID, isValidUUID, randomId, randomUUID } from "./utils/random-id.cjs";
|
|
13
13
|
import { readBody } from "./utils/requests.cjs";
|
|
14
|
-
import { isMacOS, parseJson, tryMap } from "./utils/index.cjs";
|
|
15
|
-
import { COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION } from "./constants/index.cjs";
|
|
14
|
+
import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safeParseToolArgs, tryMap } from "./utils/index.cjs";
|
|
15
|
+
import { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, DEFAULT_AGENT_ID } from "./constants/index.cjs";
|
|
16
16
|
import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.cjs";
|
|
17
|
+
import { InferSchemaOutput, SchemaToJsonSchemaOptions, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema } from "./standard-schema.cjs";
|
|
18
|
+
import { logger } from "./logger.cjs";
|
|
19
|
+
import { finalizeRunEvents } from "./finalize-events.cjs";
|
|
20
|
+
import { TranscriptionErrorCode, TranscriptionErrorResponse, TranscriptionErrors } from "./transcription-errors.cjs";
|
|
21
|
+
export * from "@copilotkit/license-verifier";
|
|
17
22
|
|
|
18
23
|
//#region src/index.d.ts
|
|
19
24
|
declare const COPILOTKIT_VERSION: string;
|
|
20
25
|
//#endregion
|
|
21
|
-
export { AIMessage, Action, ActivityMessage, AgentDescription, AssistantMessage, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, CopilotRequestContext, DeveloperMessage, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, ImageData, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, LogicalCondition, LogicalRule, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, NonEmptyRecord, Parameter, PartialBy, ReasoningMessage, RequiredBy, ResolvedCopilotKitError, Role, Rule, RuntimeInfo, Severity, SystemMessage, TelemetryClient, ToolCall, ToolDefinition, ToolResult, UpgradeRequiredError, UserMessage, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, dataToUUID, ensureStructuredError, executeConditions, getPossibleVersionMismatch, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, parseJson, publicApiKeyRequired, randomId, randomUUID, readBody, styledConsole, tryMap };
|
|
26
|
+
export { AG_UI_CHANNEL_EVENT, AIMessage, Action, ActivityMessage, AgentDescription, AssistantMessage, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, CopilotRequestContext, DEFAULT_AGENT_ID, DeveloperMessage, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, ImageData, InferSchemaOutput, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, LogicalCondition, LogicalRule, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, NonEmptyRecord, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RequiredBy, ResolvedCopilotKitError, Role, Rule, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SchemaToJsonSchemaOptions, Severity, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TelemetryClient, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UpgradeRequiredError, UserMessage, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, dataToUUID, ensureStructuredError, executeConditions, finalizeRunEvents, getPossibleVersionMismatch, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
22
27
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;cAgBa,kBAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -8,16 +8,21 @@ import { BaseCondition, ComparisonCondition, ComparisonRule, Condition, Existenc
|
|
|
8
8
|
import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.mjs";
|
|
9
9
|
import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, getPossibleVersionMismatch, isStructuredCopilotKitError } from "./utils/errors.mjs";
|
|
10
10
|
import { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters } from "./utils/json-schema.mjs";
|
|
11
|
-
import { AgentDescription, MaybePromise, NonEmptyRecord, RuntimeInfo } from "./utils/types.mjs";
|
|
11
|
+
import { AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode } from "./utils/types.mjs";
|
|
12
12
|
import { dataToUUID, isValidUUID, randomId, randomUUID } from "./utils/random-id.mjs";
|
|
13
13
|
import { readBody } from "./utils/requests.mjs";
|
|
14
|
-
import { isMacOS, parseJson, tryMap } from "./utils/index.mjs";
|
|
15
|
-
import { COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION } from "./constants/index.mjs";
|
|
14
|
+
import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safeParseToolArgs, tryMap } from "./utils/index.mjs";
|
|
15
|
+
import { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, DEFAULT_AGENT_ID } from "./constants/index.mjs";
|
|
16
16
|
import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.mjs";
|
|
17
17
|
import "./telemetry/index.mjs";
|
|
18
|
+
import { InferSchemaOutput, SchemaToJsonSchemaOptions, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema } from "./standard-schema.mjs";
|
|
19
|
+
import { logger } from "./logger.mjs";
|
|
20
|
+
import { finalizeRunEvents } from "./finalize-events.mjs";
|
|
21
|
+
import { TranscriptionErrorCode, TranscriptionErrorResponse, TranscriptionErrors } from "./transcription-errors.mjs";
|
|
22
|
+
export * from "@copilotkit/license-verifier";
|
|
18
23
|
|
|
19
24
|
//#region src/index.d.ts
|
|
20
25
|
declare const COPILOTKIT_VERSION: string;
|
|
21
26
|
//#endregion
|
|
22
|
-
export { AIMessage, Action, ActivityMessage, AgentDescription, AssistantMessage, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, CopilotRequestContext, DeveloperMessage, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, ImageData, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, LogicalCondition, LogicalRule, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, NonEmptyRecord, Parameter, PartialBy, ReasoningMessage, RequiredBy, ResolvedCopilotKitError, Role, Rule, RuntimeInfo, Severity, SystemMessage, TelemetryClient, ToolCall, ToolDefinition, ToolResult, UpgradeRequiredError, UserMessage, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, dataToUUID, ensureStructuredError, executeConditions, getPossibleVersionMismatch, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, parseJson, publicApiKeyRequired, randomId, randomUUID, readBody, styledConsole, tryMap };
|
|
27
|
+
export { AG_UI_CHANNEL_EVENT, AIMessage, Action, ActivityMessage, AgentDescription, AssistantMessage, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, CopilotRequestContext, DEFAULT_AGENT_ID, DeveloperMessage, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, ImageData, InferSchemaOutput, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, LogicalCondition, LogicalRule, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, NonEmptyRecord, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RequiredBy, ResolvedCopilotKitError, Role, Rule, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SchemaToJsonSchemaOptions, Severity, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TelemetryClient, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UpgradeRequiredError, UserMessage, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, dataToUUID, ensureStructuredError, executeConditions, finalizeRunEvents, getPossibleVersionMismatch, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
23
28
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;cAgBa,kBAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -2,16 +2,23 @@ import { executeConditions } from "./utils/conditions.mjs";
|
|
|
2
2
|
import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.mjs";
|
|
3
3
|
import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, getPossibleVersionMismatch, isStructuredCopilotKitError } from "./utils/errors.mjs";
|
|
4
4
|
import { actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters } from "./utils/json-schema.mjs";
|
|
5
|
+
import { RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE } from "./utils/types.mjs";
|
|
5
6
|
import { dataToUUID, isValidUUID, randomId, randomUUID } from "./utils/random-id.mjs";
|
|
6
7
|
import { readBody } from "./utils/requests.mjs";
|
|
7
|
-
import { isMacOS, parseJson, tryMap } from "./utils/index.mjs";
|
|
8
|
-
import { COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION } from "./constants/index.mjs";
|
|
8
|
+
import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safeParseToolArgs, tryMap } from "./utils/index.mjs";
|
|
9
|
+
import { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, DEFAULT_AGENT_ID } from "./constants/index.mjs";
|
|
9
10
|
import { version } from "./package.mjs";
|
|
10
11
|
import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.mjs";
|
|
12
|
+
import { schemaToJsonSchema } from "./standard-schema.mjs";
|
|
13
|
+
import { logger } from "./logger.mjs";
|
|
14
|
+
import { finalizeRunEvents } from "./finalize-events.mjs";
|
|
15
|
+
import { TranscriptionErrorCode, TranscriptionErrors } from "./transcription-errors.mjs";
|
|
16
|
+
|
|
17
|
+
export * from "@copilotkit/license-verifier"
|
|
11
18
|
|
|
12
19
|
//#region src/index.ts
|
|
13
20
|
const COPILOTKIT_VERSION = version;
|
|
14
21
|
|
|
15
22
|
//#endregion
|
|
16
|
-
export { BANNER_ERROR_NAMES, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, TelemetryClient, UpgradeRequiredError, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, dataToUUID, ensureStructuredError, executeConditions, getPossibleVersionMismatch, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, parseJson, publicApiKeyRequired, randomId, randomUUID, readBody, styledConsole, tryMap };
|
|
23
|
+
export { AG_UI_CHANNEL_EVENT, BANNER_ERROR_NAMES, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, DEFAULT_AGENT_ID, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ResolvedCopilotKitError, Severity, TelemetryClient, TranscriptionErrorCode, TranscriptionErrors, UpgradeRequiredError, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, dataToUUID, ensureStructuredError, executeConditions, finalizeRunEvents, getPossibleVersionMismatch, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
17
24
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["packageJson.version"],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["packageJson.version"],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./standard-schema\";\n\nexport { logger } from \"./logger\";\nexport { finalizeRunEvents } from \"./finalize-events\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\nexport * from \"@copilotkit/license-verifier\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgBA,MAAa,qBAAqBA"}
|