@copilotkit/runtime 1.4.2 → 1.4.3

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 (30) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{chunk-NGIMUY3P.mjs → chunk-7SECLS5W.mjs} +2 -2
  3. package/dist/{chunk-5OSRXQBR.mjs → chunk-KO6WITMC.mjs} +18 -10
  4. package/dist/chunk-KO6WITMC.mjs.map +1 -0
  5. package/dist/{chunk-P37XVLVE.mjs → chunk-PF5ZEXF5.mjs} +2 -2
  6. package/dist/{chunk-P2G5TCZA.mjs → chunk-YJZFFI54.mjs} +2 -2
  7. package/dist/index.js +17 -9
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +4 -4
  10. package/dist/lib/index.js +17 -9
  11. package/dist/lib/index.js.map +1 -1
  12. package/dist/lib/index.mjs +4 -4
  13. package/dist/lib/integrations/index.js +1 -1
  14. package/dist/lib/integrations/index.js.map +1 -1
  15. package/dist/lib/integrations/index.mjs +4 -4
  16. package/dist/lib/integrations/nest/index.js +1 -1
  17. package/dist/lib/integrations/nest/index.js.map +1 -1
  18. package/dist/lib/integrations/nest/index.mjs +2 -2
  19. package/dist/lib/integrations/node-express/index.js +1 -1
  20. package/dist/lib/integrations/node-express/index.js.map +1 -1
  21. package/dist/lib/integrations/node-express/index.mjs +2 -2
  22. package/dist/lib/integrations/node-http/index.js +1 -1
  23. package/dist/lib/integrations/node-http/index.js.map +1 -1
  24. package/dist/lib/integrations/node-http/index.mjs +1 -1
  25. package/package.json +4 -4
  26. package/src/lib/runtime/remote-lg-action.ts +25 -14
  27. package/dist/chunk-5OSRXQBR.mjs.map +0 -1
  28. /package/dist/{chunk-NGIMUY3P.mjs.map → chunk-7SECLS5W.mjs.map} +0 -0
  29. /package/dist/{chunk-P37XVLVE.mjs.map → chunk-PF5ZEXF5.mjs.map} +0 -0
  30. /package/dist/{chunk-P2G5TCZA.mjs.map → chunk-YJZFFI54.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  config,
4
4
  copilotRuntimeNextJSAppRouterEndpoint,
5
5
  copilotRuntimeNextJSPagesRouterEndpoint
6
- } from "./chunk-P2G5TCZA.mjs";
6
+ } from "./chunk-YJZFFI54.mjs";
7
7
  import {
8
8
  copilotRuntimeNestEndpoint
9
- } from "./chunk-NGIMUY3P.mjs";
9
+ } from "./chunk-7SECLS5W.mjs";
10
10
  import {
11
11
  copilotRuntimeNodeExpressEndpoint
12
- } from "./chunk-P37XVLVE.mjs";
12
+ } from "./chunk-PF5ZEXF5.mjs";
13
13
  import {
14
14
  CopilotRuntime,
15
15
  buildSchema,
@@ -20,7 +20,7 @@ import {
20
20
  getCommonConfig,
21
21
  langGraphPlatformEndpoint,
22
22
  resolveEndpointType
23
- } from "./chunk-5OSRXQBR.mjs";
23
+ } from "./chunk-KO6WITMC.mjs";
24
24
  import {
25
25
  AnthropicAdapter,
26
26
  GoogleGenerativeAIAdapter,
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.4.2",
47
+ version: "1.4.3",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -1364,8 +1364,6 @@ async function streamEvents(controller, args) {
1364
1364
  if (initialThreadId && initialThreadId.startsWith("ck-")) {
1365
1365
  initialThreadId = initialThreadId.substring(3);
1366
1366
  }
1367
- const assistants = await client.assistants.search();
1368
- const retrievedAssistant = assistants.find((a) => a.name === name);
1369
1367
  const threadId = initialThreadId ?? (0, import_node_crypto.randomUUID)();
1370
1368
  if (initialThreadId === threadId) {
1371
1369
  await client.threads.get(threadId);
@@ -1396,8 +1394,16 @@ async function streamEvents(controller, args) {
1396
1394
  asNode: nodeName
1397
1395
  });
1398
1396
  }
1399
- const assistantId = initialAssistantId ?? (retrievedAssistant == null ? void 0 : retrievedAssistant.assistant_id);
1400
- if (!assistantId) {
1397
+ let streamInfo = {
1398
+ hashedLgcKey: (0, import_node_crypto.createHash)("sha256").update(langsmithApiKey).digest("hex")
1399
+ };
1400
+ const assistants = await client.assistants.search();
1401
+ const retrievedAssistant = assistants.find((a) => a.name === name || a.assistant_id === initialAssistantId);
1402
+ if (!retrievedAssistant) {
1403
+ telemetry_client_default.capture("oss.runtime.agent_execution_stream_errored", {
1404
+ ...streamInfo,
1405
+ error: `Found no assistants for given information, while ${assistants.length} assistants exists`
1406
+ });
1401
1407
  console.error(`
1402
1408
  No agent found for the agent name specified in CopilotKit provider
1403
1409
  Please check your available agents or provide an agent ID in the LangGraph Platform endpoint definition.
@@ -1407,6 +1413,7 @@ async function streamEvents(controller, args) {
1407
1413
  `);
1408
1414
  throw new Error("No agent id found");
1409
1415
  }
1416
+ const assistantId = retrievedAssistant.assistant_id;
1410
1417
  const graphInfo = await client.assistants.getGraph(assistantId);
1411
1418
  const streamInput = mode === "start" ? state : null;
1412
1419
  let streamingStateExtractor = new StreamingStateExtractor([]);
@@ -1425,9 +1432,6 @@ async function streamEvents(controller, args) {
1425
1432
  let latestStateValues = {};
1426
1433
  let updatedState = state;
1427
1434
  let manuallyEmittedState = null;
1428
- let streamInfo = {
1429
- hashedLgcKey: (0, import_node_crypto.createHash)("sha256").update(langsmithApiKey).digest("hex")
1430
- };
1431
1435
  try {
1432
1436
  telemetry_client_default.capture("oss.runtime.agent_execution_stream_started", {
1433
1437
  hashedLgcKey: streamInfo.hashedLgcKey
@@ -1440,7 +1444,6 @@ async function streamEvents(controller, args) {
1440
1444
  ].includes(chunk.event))
1441
1445
  continue;
1442
1446
  if (chunk.event === "error") {
1443
- logger2.error(chunk, `Error event thrown: ${chunk.data.message}`);
1444
1447
  throw new Error(`Error event thrown: ${chunk.data.message}`);
1445
1448
  }
1446
1449
  if (chunk.event === "values") {
@@ -1537,6 +1540,11 @@ async function streamEvents(controller, args) {
1537
1540
  }));
1538
1541
  return Promise.resolve();
1539
1542
  } catch (e) {
1543
+ logger2.error(e);
1544
+ telemetry_client_default.capture("oss.runtime.agent_execution_stream_errored", {
1545
+ ...streamInfo,
1546
+ error: e.message
1547
+ });
1540
1548
  return Promise.resolve();
1541
1549
  }
1542
1550
  }