@copilotkit/runtime 1.3.13 → 1.3.14-fix-handle-execute-agent-error.0

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/{chunk-76K222WC.mjs → chunk-GVAUIADR.mjs} +34 -27
  3. package/dist/chunk-GVAUIADR.mjs.map +1 -0
  4. package/dist/{chunk-3LFBIWWK.mjs → chunk-LB3EPUOQ.mjs} +2 -2
  5. package/dist/{chunk-SPZSO3T3.mjs → chunk-LOMWWP44.mjs} +2 -2
  6. package/dist/{chunk-DEZQR4EM.mjs → chunk-QXHQKRLT.mjs} +2 -2
  7. package/dist/{chunk-MCUYYSCJ.mjs → chunk-VN26GZV4.mjs} +2 -2
  8. package/dist/index.js +33 -26
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.mjs +5 -5
  11. package/dist/lib/index.js +33 -26
  12. package/dist/lib/index.js.map +1 -1
  13. package/dist/lib/index.mjs +5 -5
  14. package/dist/lib/integrations/index.js +1 -1
  15. package/dist/lib/integrations/index.js.map +1 -1
  16. package/dist/lib/integrations/index.mjs +4 -4
  17. package/dist/lib/integrations/nest/index.js +1 -1
  18. package/dist/lib/integrations/nest/index.js.map +1 -1
  19. package/dist/lib/integrations/nest/index.mjs +2 -2
  20. package/dist/lib/integrations/node-express/index.js +1 -1
  21. package/dist/lib/integrations/node-express/index.js.map +1 -1
  22. package/dist/lib/integrations/node-express/index.mjs +2 -2
  23. package/dist/lib/integrations/node-http/index.js +1 -1
  24. package/dist/lib/integrations/node-http/index.js.map +1 -1
  25. package/dist/lib/integrations/node-http/index.mjs +1 -1
  26. package/package.json +4 -4
  27. package/src/lib/runtime/remote-actions.ts +33 -24
  28. package/dist/chunk-76K222WC.mjs.map +0 -1
  29. /package/dist/{chunk-3LFBIWWK.mjs.map → chunk-LB3EPUOQ.mjs.map} +0 -0
  30. /package/dist/{chunk-SPZSO3T3.mjs.map → chunk-LOMWWP44.mjs.map} +0 -0
  31. /package/dist/{chunk-DEZQR4EM.mjs.map → chunk-QXHQKRLT.mjs.map} +0 -0
  32. /package/dist/{chunk-MCUYYSCJ.mjs.map → chunk-VN26GZV4.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-3LFBIWWK.mjs";
4
+ } from "./chunk-LB3EPUOQ.mjs";
5
5
  import {
6
6
  AnthropicAdapter,
7
7
  GoogleGenerativeAIAdapter,
@@ -16,19 +16,19 @@ import {
16
16
  config,
17
17
  copilotRuntimeNextJSAppRouterEndpoint,
18
18
  copilotRuntimeNextJSPagesRouterEndpoint
19
- } from "./chunk-DEZQR4EM.mjs";
19
+ } from "./chunk-QXHQKRLT.mjs";
20
20
  import {
21
21
  copilotRuntimeNestEndpoint
22
- } from "./chunk-SPZSO3T3.mjs";
22
+ } from "./chunk-LOMWWP44.mjs";
23
23
  import {
24
24
  copilotRuntimeNodeExpressEndpoint
25
- } from "./chunk-MCUYYSCJ.mjs";
25
+ } from "./chunk-VN26GZV4.mjs";
26
26
  import {
27
27
  buildSchema,
28
28
  copilotRuntimeNodeHttpEndpoint,
29
29
  createContext,
30
30
  getCommonConfig
31
- } from "./chunk-76K222WC.mjs";
31
+ } from "./chunk-GVAUIADR.mjs";
32
32
  import "./chunk-CPAHDRLS.mjs";
33
33
  import {
34
34
  GuardrailsValidationFailureResponse,
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.13",
47
+ version: "1.3.14-fix-handle-execute-agent-error.0",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -1459,34 +1459,41 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
1459
1459
  state = JSON.parse(jsonState);
1460
1460
  }
1461
1461
  }
1462
- const response = await fetch(`${url}/agents/execute`, {
1463
- method: "POST",
1464
- headers,
1465
- body: JSON.stringify({
1466
- name,
1467
- threadId,
1468
- nodeName,
1469
- messages,
1470
- state,
1471
- properties: graphqlContext.properties,
1472
- actions: actionInputsWithoutAgents.map((action) => ({
1473
- name: action.name,
1474
- description: action.description,
1475
- parameters: JSON.parse(action.jsonSchema)
1476
- }))
1477
- })
1478
- });
1479
- if (!response.ok) {
1462
+ try {
1463
+ const response = await fetch(`${url}/agents/execute`, {
1464
+ method: "POST",
1465
+ headers,
1466
+ body: JSON.stringify({
1467
+ name,
1468
+ threadId,
1469
+ nodeName,
1470
+ messages,
1471
+ state,
1472
+ properties: graphqlContext.properties,
1473
+ actions: actionInputsWithoutAgents.map((action) => ({
1474
+ name: action.name,
1475
+ description: action.description,
1476
+ parameters: JSON.parse(action.jsonSchema)
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) {
1480
1492
  logger2.error({
1481
- url,
1482
- status: response.status,
1483
- body: await response.text()
1493
+ error: error.message ? error.message : error + ""
1484
1494
  }, "Failed to execute remote agent");
1485
- throw new Error("Failed to execute remote agent");
1495
+ throw "Failed to execute remote agent";
1486
1496
  }
1487
- const eventSource = new RemoteLangGraphEventSource();
1488
- eventSource.streamResponse(response);
1489
- return eventSource.processLangGraphEvents();
1490
1497
  }
1491
1498
  }));
1492
1499
  return [