@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.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotRuntime,
|
|
3
3
|
flattenToolCallsNoDuplicates
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CUN5GXCO.mjs";
|
|
5
5
|
import {
|
|
6
6
|
AnthropicAdapter,
|
|
7
7
|
GoogleGenerativeAIAdapter,
|
|
@@ -11,25 +11,25 @@ import {
|
|
|
11
11
|
OpenAIAssistantAdapter,
|
|
12
12
|
RemoteChain,
|
|
13
13
|
UnifyAdapter
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-NMV7A7VP.mjs";
|
|
15
15
|
import {
|
|
16
16
|
config,
|
|
17
17
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
18
18
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-WYB2Z6SM.mjs";
|
|
20
20
|
import {
|
|
21
21
|
copilotRuntimeNestEndpoint
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-FH4SPOAG.mjs";
|
|
23
23
|
import {
|
|
24
24
|
copilotRuntimeNodeExpressEndpoint
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-R3IJK6GR.mjs";
|
|
26
26
|
import {
|
|
27
27
|
buildSchema,
|
|
28
28
|
copilotRuntimeNodeHttpEndpoint,
|
|
29
29
|
createContext,
|
|
30
30
|
getCommonConfig
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
} from "./chunk-3RAQGSAI.mjs";
|
|
32
|
+
import "./chunk-MXXPWWBF.mjs";
|
|
33
33
|
import {
|
|
34
34
|
GuardrailsValidationFailureResponse,
|
|
35
35
|
MessageStreamInterruptedResponse,
|
package/dist/lib/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",
|
|
@@ -500,7 +500,7 @@ function convertJsonSchemaToZodSchema(jsonSchema, required) {
|
|
|
500
500
|
for (const [key, value] of Object.entries(jsonSchema.properties)) {
|
|
501
501
|
spec[key] = convertJsonSchemaToZodSchema(value, jsonSchema.required ? jsonSchema.required.includes(key) : false);
|
|
502
502
|
}
|
|
503
|
-
let schema = import_zod.z.object(spec);
|
|
503
|
+
let schema = import_zod.z.object(spec).describe(jsonSchema.description);
|
|
504
504
|
return required ? schema : schema.optional();
|
|
505
505
|
} else if (jsonSchema.type === "string") {
|
|
506
506
|
let schema = import_zod.z.string().describe(jsonSchema.description);
|
|
@@ -513,7 +513,7 @@ function convertJsonSchemaToZodSchema(jsonSchema, required) {
|
|
|
513
513
|
return required ? schema : schema.optional();
|
|
514
514
|
} else if (jsonSchema.type === "array") {
|
|
515
515
|
let itemSchema = convertJsonSchemaToZodSchema(jsonSchema.items, true);
|
|
516
|
-
let schema = import_zod.z.array(itemSchema);
|
|
516
|
+
let schema = import_zod.z.array(itemSchema).describe(jsonSchema.description);
|
|
517
517
|
return required ? schema : schema.optional();
|
|
518
518
|
}
|
|
519
519
|
}
|
|
@@ -589,8 +589,6 @@ async function streamLangChainResponse({ result, eventStream$, actionExecution }
|
|
|
589
589
|
let toolCallName = void 0;
|
|
590
590
|
let toolCallId = void 0;
|
|
591
591
|
let toolCallArgs = void 0;
|
|
592
|
-
let toolCallIndex = void 0;
|
|
593
|
-
let toolCallPrevIndex = void 0;
|
|
594
592
|
let hasToolCall = false;
|
|
595
593
|
let content = value == null ? void 0 : value.content;
|
|
596
594
|
if (isAIMessageChunk(value)) {
|
|
@@ -608,8 +606,6 @@ async function streamLangChainResponse({ result, eventStream$, actionExecution }
|
|
|
608
606
|
toolCallDetails.id = chunk.index != null ? `${chunk.id}-idx-${chunk.index}` : chunk.id;
|
|
609
607
|
toolCallName = toolCallDetails.name;
|
|
610
608
|
toolCallId = toolCallDetails.id;
|
|
611
|
-
toolCallIndex = toolCallDetails.index;
|
|
612
|
-
toolCallPrevIndex = toolCallDetails.prevIndex;
|
|
613
609
|
} else if (isBaseMessageChunk(value)) {
|
|
614
610
|
let chunk = (_f = (_e = value.additional_kwargs) == null ? void 0 : _e.tool_calls) == null ? void 0 : _f[0];
|
|
615
611
|
toolCallName = (_g = chunk == null ? void 0 : chunk.function) == null ? void 0 : _g.name;
|
|
@@ -639,7 +635,7 @@ async function streamLangChainResponse({ result, eventStream$, actionExecution }
|
|
|
639
635
|
if (mode === "message" && content) {
|
|
640
636
|
eventStream$.sendTextMessageContent(Array.isArray(content) ? ((_i = content[0]) == null ? void 0 : _i.text) ?? "" : content);
|
|
641
637
|
} else if (mode === "function" && toolCallArgs) {
|
|
642
|
-
if (
|
|
638
|
+
if (toolCallDetails.index !== toolCallDetails.prevIndex) {
|
|
643
639
|
eventStream$.sendActionExecutionEnd();
|
|
644
640
|
eventStream$.sendActionExecutionStart(toolCallId, toolCallName);
|
|
645
641
|
toolCallDetails.prevIndex = toolCallDetails.index;
|
|
@@ -1459,41 +1455,34 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
1459
1455
|
state = JSON.parse(jsonState);
|
|
1460
1456
|
}
|
|
1461
1457
|
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
if (!response.ok) {
|
|
1481
|
-
logger2.error({
|
|
1482
|
-
url,
|
|
1483
|
-
status: response.status,
|
|
1484
|
-
body: await response.text()
|
|
1485
|
-
}, "Failed to execute remote agent");
|
|
1486
|
-
throw "Failed to execute remote agent";
|
|
1487
|
-
}
|
|
1488
|
-
const eventSource = new RemoteLangGraphEventSource();
|
|
1489
|
-
eventSource.streamResponse(response);
|
|
1490
|
-
return eventSource.processLangGraphEvents();
|
|
1491
|
-
} catch (error) {
|
|
1458
|
+
const response = await fetch(`${url}/agents/execute`, {
|
|
1459
|
+
method: "POST",
|
|
1460
|
+
headers,
|
|
1461
|
+
body: JSON.stringify({
|
|
1462
|
+
name,
|
|
1463
|
+
threadId,
|
|
1464
|
+
nodeName,
|
|
1465
|
+
messages,
|
|
1466
|
+
state,
|
|
1467
|
+
properties: graphqlContext.properties,
|
|
1468
|
+
actions: actionInputsWithoutAgents.map((action) => ({
|
|
1469
|
+
name: action.name,
|
|
1470
|
+
description: action.description,
|
|
1471
|
+
parameters: JSON.parse(action.jsonSchema)
|
|
1472
|
+
}))
|
|
1473
|
+
})
|
|
1474
|
+
});
|
|
1475
|
+
if (!response.ok) {
|
|
1492
1476
|
logger2.error({
|
|
1493
|
-
|
|
1477
|
+
url,
|
|
1478
|
+
status: response.status,
|
|
1479
|
+
body: await response.text()
|
|
1494
1480
|
}, "Failed to execute remote agent");
|
|
1495
|
-
throw "Failed to execute remote agent";
|
|
1481
|
+
throw new Error("Failed to execute remote agent");
|
|
1496
1482
|
}
|
|
1483
|
+
const eventSource = new RemoteLangGraphEventSource();
|
|
1484
|
+
eventSource.streamResponse(response);
|
|
1485
|
+
return eventSource.processLangGraphEvents();
|
|
1497
1486
|
}
|
|
1498
1487
|
}));
|
|
1499
1488
|
return [
|