@copilotkit/runtime 1.4.2-tyler-reset-chat.2 → 1.4.3-pre.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 (30) hide show
  1. package/CHANGELOG.md +8 -14
  2. package/dist/{chunk-3GHAUJSO.mjs → chunk-5EGHJ5PO.mjs} +2 -2
  3. package/dist/{chunk-FMXSCJME.mjs → chunk-BS3MYV4N.mjs} +2 -2
  4. package/dist/{chunk-PT6VQ5GO.mjs → chunk-C4CRNTIN.mjs} +2 -2
  5. package/dist/{chunk-LQRRU6LE.mjs → chunk-D6CE7W37.mjs} +18 -10
  6. package/dist/chunk-D6CE7W37.mjs.map +1 -0
  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-LQRRU6LE.mjs.map +0 -1
  28. /package/dist/{chunk-3GHAUJSO.mjs.map → chunk-5EGHJ5PO.mjs.map} +0 -0
  29. /package/dist/{chunk-FMXSCJME.mjs.map → chunk-BS3MYV4N.mjs.map} +0 -0
  30. /package/dist/{chunk-PT6VQ5GO.mjs.map → chunk-C4CRNTIN.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,28 +1,22 @@
1
1
  # @copilotkit/runtime
2
2
 
3
- ## 1.4.2-tyler-reset-chat.2
3
+ ## 1.4.3-pre.0
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Don't send an empty message when an abort occurs"
7
+ - - Better error surfacing when using LangGraph Platform streaming
8
+ - Ensure state is immediately set without using flushSync
8
9
  - Updated dependencies
9
- - @copilotkit/shared@1.4.2-tyler-reset-chat.2
10
+ - @copilotkit/shared@1.4.3-pre.0
10
11
 
11
- ## 1.4.2-tyler-reset-chat.1
12
+ ## 1.4.2
12
13
 
13
14
  ### Patch Changes
14
15
 
15
- - Fixing a small issue where the abort controller reference was being clobbered
16
+ - - Make sure agent state is set immediately (#1077)
17
+ - Support running an agent without messages (#1075)
16
18
  - Updated dependencies
17
- - @copilotkit/shared@1.4.2-tyler-reset-chat.1
18
-
19
- ## 1.4.2-tyler-reset-chat.0
20
-
21
- ### Patch Changes
22
-
23
- - Add Markus' reset chat changes along with everything in 1.4.1 + a fix for resetting the agent during front-end action calls
24
- - Updated dependencies
25
- - @copilotkit/shared@1.4.2-tyler-reset-chat.0
19
+ - @copilotkit/shared@1.4.2
26
20
 
27
21
  ## 1.4.1
28
22
 
@@ -2,7 +2,7 @@ import {
2
2
  getCommonConfig,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-LQRRU6LE.mjs";
5
+ } from "./chunk-D6CE7W37.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-44O2JGUY.mjs";
@@ -77,4 +77,4 @@ export {
77
77
  config,
78
78
  copilotRuntimeNextJSPagesRouterEndpoint
79
79
  };
80
- //# sourceMappingURL=chunk-3GHAUJSO.mjs.map
80
+ //# sourceMappingURL=chunk-5EGHJ5PO.mjs.map
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-LQRRU6LE.mjs";
5
+ } from "./chunk-D6CE7W37.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-44O2JGUY.mjs";
@@ -22,4 +22,4 @@ __name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
22
22
  export {
23
23
  copilotRuntimeNodeExpressEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-FMXSCJME.mjs.map
25
+ //# sourceMappingURL=chunk-BS3MYV4N.mjs.map
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-LQRRU6LE.mjs";
5
+ } from "./chunk-D6CE7W37.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-44O2JGUY.mjs";
@@ -22,4 +22,4 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
22
22
  export {
23
23
  copilotRuntimeNestEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-PT6VQ5GO.mjs.map
25
+ //# sourceMappingURL=chunk-C4CRNTIN.mjs.map
@@ -37,7 +37,7 @@ var require_package = __commonJS({
37
37
  publishConfig: {
38
38
  access: "public"
39
39
  },
40
- version: "1.4.2-tyler-reset-chat.2",
40
+ version: "1.4.3-pre.0",
41
41
  sideEffects: false,
42
42
  main: "./dist/index.js",
43
43
  module: "./dist/index.mjs",
@@ -1313,8 +1313,6 @@ async function streamEvents(controller, args) {
1313
1313
  if (initialThreadId && initialThreadId.startsWith("ck-")) {
1314
1314
  initialThreadId = initialThreadId.substring(3);
1315
1315
  }
1316
- const assistants = await client.assistants.search();
1317
- const retrievedAssistant = assistants.find((a) => a.name === name);
1318
1316
  const threadId = initialThreadId ?? randomUUID();
1319
1317
  if (initialThreadId === threadId) {
1320
1318
  await client.threads.get(threadId);
@@ -1345,8 +1343,16 @@ async function streamEvents(controller, args) {
1345
1343
  asNode: nodeName
1346
1344
  });
1347
1345
  }
1348
- const assistantId = initialAssistantId ?? (retrievedAssistant == null ? void 0 : retrievedAssistant.assistant_id);
1349
- if (!assistantId) {
1346
+ let streamInfo = {
1347
+ hashedLgcKey: createHash("sha256").update(langsmithApiKey).digest("hex")
1348
+ };
1349
+ const assistants = await client.assistants.search();
1350
+ const retrievedAssistant = assistants.find((a) => a.name === name || a.assistant_id === initialAssistantId);
1351
+ if (!retrievedAssistant) {
1352
+ telemetry_client_default.capture("oss.runtime.agent_execution_stream_errored", {
1353
+ ...streamInfo,
1354
+ error: `Found no assistants for given information, while ${assistants.length} assistants exists`
1355
+ });
1350
1356
  console.error(`
1351
1357
  No agent found for the agent name specified in CopilotKit provider
1352
1358
  Please check your available agents or provide an agent ID in the LangGraph Platform endpoint definition.
@@ -1356,6 +1362,7 @@ async function streamEvents(controller, args) {
1356
1362
  `);
1357
1363
  throw new Error("No agent id found");
1358
1364
  }
1365
+ const assistantId = retrievedAssistant.assistant_id;
1359
1366
  const graphInfo = await client.assistants.getGraph(assistantId);
1360
1367
  const streamInput = mode === "start" ? state : null;
1361
1368
  let streamingStateExtractor = new StreamingStateExtractor([]);
@@ -1374,9 +1381,6 @@ async function streamEvents(controller, args) {
1374
1381
  let latestStateValues = {};
1375
1382
  let updatedState = state;
1376
1383
  let manuallyEmittedState = null;
1377
- let streamInfo = {
1378
- hashedLgcKey: createHash("sha256").update(langsmithApiKey).digest("hex")
1379
- };
1380
1384
  try {
1381
1385
  telemetry_client_default.capture("oss.runtime.agent_execution_stream_started", {
1382
1386
  hashedLgcKey: streamInfo.hashedLgcKey
@@ -1389,7 +1393,6 @@ async function streamEvents(controller, args) {
1389
1393
  ].includes(chunk.event))
1390
1394
  continue;
1391
1395
  if (chunk.event === "error") {
1392
- logger2.error(chunk, `Error event thrown: ${chunk.data.message}`);
1393
1396
  throw new Error(`Error event thrown: ${chunk.data.message}`);
1394
1397
  }
1395
1398
  if (chunk.event === "values") {
@@ -1486,6 +1489,11 @@ async function streamEvents(controller, args) {
1486
1489
  }));
1487
1490
  return Promise.resolve();
1488
1491
  } catch (e) {
1492
+ logger2.error(e);
1493
+ telemetry_client_default.capture("oss.runtime.agent_execution_stream_errored", {
1494
+ ...streamInfo,
1495
+ error: e.message
1496
+ });
1489
1497
  return Promise.resolve();
1490
1498
  }
1491
1499
  }
@@ -3144,4 +3152,4 @@ export {
3144
3152
  getCommonConfig,
3145
3153
  copilotRuntimeNodeHttpEndpoint
3146
3154
  };
3147
- //# sourceMappingURL=chunk-LQRRU6LE.mjs.map
3155
+ //# sourceMappingURL=chunk-D6CE7W37.mjs.map