@copilotkit/runtime 1.3.14-fix-handle-execute-agent-error.0 → 1.3.15
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 +11 -3
- package/dist/{chunk-GVAUIADR.mjs → chunk-3RAQGSAI.mjs} +28 -35
- package/dist/chunk-3RAQGSAI.mjs.map +1 -0
- package/dist/{chunk-LB3EPUOQ.mjs → chunk-CUN5GXCO.mjs} +3 -3
- package/dist/{chunk-LOMWWP44.mjs → chunk-FH4SPOAG.mjs} +2 -2
- package/dist/{chunk-CPAHDRLS.mjs → chunk-MXXPWWBF.mjs} +4 -8
- package/dist/chunk-MXXPWWBF.mjs.map +1 -0
- package/dist/{chunk-Y6RQG5HF.mjs → chunk-NMV7A7VP.mjs} +2 -2
- package/dist/{chunk-VN26GZV4.mjs → chunk-R3IJK6GR.mjs} +2 -2
- package/dist/{chunk-QXHQKRLT.mjs → chunk-WYB2Z6SM.mjs} +2 -2
- package/dist/index.js +29 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/lib/index.js +29 -40
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +7 -7
- package/dist/lib/integrations/index.js +1 -1
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +5 -5
- package/dist/lib/integrations/nest/index.js +1 -1
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +3 -3
- package/dist/lib/integrations/node-express/index.js +1 -1
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +3 -3
- package/dist/lib/integrations/node-http/index.js +1 -1
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +2 -2
- package/dist/service-adapters/index.js +3 -7
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +2 -2
- package/package.json +4 -4
- package/src/lib/runtime/remote-actions.ts +24 -33
- package/src/service-adapters/langchain/utils.ts +3 -7
- package/dist/chunk-CPAHDRLS.mjs.map +0 -1
- package/dist/chunk-GVAUIADR.mjs.map +0 -1
- /package/dist/{chunk-LB3EPUOQ.mjs.map → chunk-CUN5GXCO.mjs.map} +0 -0
- /package/dist/{chunk-LOMWWP44.mjs.map → chunk-FH4SPOAG.mjs.map} +0 -0
- /package/dist/{chunk-Y6RQG5HF.mjs.map → chunk-NMV7A7VP.mjs.map} +0 -0
- /package/dist/{chunk-VN26GZV4.mjs.map → chunk-R3IJK6GR.mjs.map} +0 -0
- /package/dist/{chunk-QXHQKRLT.mjs.map → chunk-WYB2Z6SM.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var require_package = __commonJS({
|
|
|
44
44
|
publishConfig: {
|
|
45
45
|
access: "public"
|
|
46
46
|
},
|
|
47
|
-
version: "1.3.
|
|
47
|
+
version: "1.3.15",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -506,7 +506,7 @@ function convertJsonSchemaToZodSchema(jsonSchema, required) {
|
|
|
506
506
|
for (const [key, value] of Object.entries(jsonSchema.properties)) {
|
|
507
507
|
spec[key] = convertJsonSchemaToZodSchema(value, jsonSchema.required ? jsonSchema.required.includes(key) : false);
|
|
508
508
|
}
|
|
509
|
-
let schema = import_zod.z.object(spec);
|
|
509
|
+
let schema = import_zod.z.object(spec).describe(jsonSchema.description);
|
|
510
510
|
return required ? schema : schema.optional();
|
|
511
511
|
} else if (jsonSchema.type === "string") {
|
|
512
512
|
let schema = import_zod.z.string().describe(jsonSchema.description);
|
|
@@ -519,7 +519,7 @@ function convertJsonSchemaToZodSchema(jsonSchema, required) {
|
|
|
519
519
|
return required ? schema : schema.optional();
|
|
520
520
|
} else if (jsonSchema.type === "array") {
|
|
521
521
|
let itemSchema = convertJsonSchemaToZodSchema(jsonSchema.items, true);
|
|
522
|
-
let schema = import_zod.z.array(itemSchema);
|
|
522
|
+
let schema = import_zod.z.array(itemSchema).describe(jsonSchema.description);
|
|
523
523
|
return required ? schema : schema.optional();
|
|
524
524
|
}
|
|
525
525
|
}
|
|
@@ -595,8 +595,6 @@ async function streamLangChainResponse({ result, eventStream$, actionExecution }
|
|
|
595
595
|
let toolCallName = void 0;
|
|
596
596
|
let toolCallId = void 0;
|
|
597
597
|
let toolCallArgs = void 0;
|
|
598
|
-
let toolCallIndex = void 0;
|
|
599
|
-
let toolCallPrevIndex = void 0;
|
|
600
598
|
let hasToolCall = false;
|
|
601
599
|
let content = value == null ? void 0 : value.content;
|
|
602
600
|
if (isAIMessageChunk(value)) {
|
|
@@ -614,8 +612,6 @@ async function streamLangChainResponse({ result, eventStream$, actionExecution }
|
|
|
614
612
|
toolCallDetails.id = chunk.index != null ? `${chunk.id}-idx-${chunk.index}` : chunk.id;
|
|
615
613
|
toolCallName = toolCallDetails.name;
|
|
616
614
|
toolCallId = toolCallDetails.id;
|
|
617
|
-
toolCallIndex = toolCallDetails.index;
|
|
618
|
-
toolCallPrevIndex = toolCallDetails.prevIndex;
|
|
619
615
|
} else if (isBaseMessageChunk(value)) {
|
|
620
616
|
let chunk = (_f = (_e = value.additional_kwargs) == null ? void 0 : _e.tool_calls) == null ? void 0 : _f[0];
|
|
621
617
|
toolCallName = (_g = chunk == null ? void 0 : chunk.function) == null ? void 0 : _g.name;
|
|
@@ -645,7 +641,7 @@ async function streamLangChainResponse({ result, eventStream$, actionExecution }
|
|
|
645
641
|
if (mode === "message" && content) {
|
|
646
642
|
eventStream$.sendTextMessageContent(Array.isArray(content) ? ((_i = content[0]) == null ? void 0 : _i.text) ?? "" : content);
|
|
647
643
|
} else if (mode === "function" && toolCallArgs) {
|
|
648
|
-
if (
|
|
644
|
+
if (toolCallDetails.index !== toolCallDetails.prevIndex) {
|
|
649
645
|
eventStream$.sendActionExecutionEnd();
|
|
650
646
|
eventStream$.sendActionExecutionStart(toolCallId, toolCallName);
|
|
651
647
|
toolCallDetails.prevIndex = toolCallDetails.index;
|
|
@@ -1729,41 +1725,34 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
1729
1725
|
state = JSON.parse(jsonState);
|
|
1730
1726
|
}
|
|
1731
1727
|
}
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
if (!response.ok) {
|
|
1751
|
-
logger2.error({
|
|
1752
|
-
url,
|
|
1753
|
-
status: response.status,
|
|
1754
|
-
body: await response.text()
|
|
1755
|
-
}, "Failed to execute remote agent");
|
|
1756
|
-
throw "Failed to execute remote agent";
|
|
1757
|
-
}
|
|
1758
|
-
const eventSource = new RemoteLangGraphEventSource();
|
|
1759
|
-
eventSource.streamResponse(response);
|
|
1760
|
-
return eventSource.processLangGraphEvents();
|
|
1761
|
-
} catch (error) {
|
|
1728
|
+
const response = await fetch(`${url}/agents/execute`, {
|
|
1729
|
+
method: "POST",
|
|
1730
|
+
headers,
|
|
1731
|
+
body: JSON.stringify({
|
|
1732
|
+
name,
|
|
1733
|
+
threadId,
|
|
1734
|
+
nodeName,
|
|
1735
|
+
messages,
|
|
1736
|
+
state,
|
|
1737
|
+
properties: graphqlContext.properties,
|
|
1738
|
+
actions: actionInputsWithoutAgents.map((action) => ({
|
|
1739
|
+
name: action.name,
|
|
1740
|
+
description: action.description,
|
|
1741
|
+
parameters: JSON.parse(action.jsonSchema)
|
|
1742
|
+
}))
|
|
1743
|
+
})
|
|
1744
|
+
});
|
|
1745
|
+
if (!response.ok) {
|
|
1762
1746
|
logger2.error({
|
|
1763
|
-
|
|
1747
|
+
url,
|
|
1748
|
+
status: response.status,
|
|
1749
|
+
body: await response.text()
|
|
1764
1750
|
}, "Failed to execute remote agent");
|
|
1765
|
-
throw "Failed to execute remote agent";
|
|
1751
|
+
throw new Error("Failed to execute remote agent");
|
|
1766
1752
|
}
|
|
1753
|
+
const eventSource = new RemoteLangGraphEventSource();
|
|
1754
|
+
eventSource.streamResponse(response);
|
|
1755
|
+
return eventSource.processLangGraphEvents();
|
|
1767
1756
|
}
|
|
1768
1757
|
}));
|
|
1769
1758
|
return [
|