@copilotkit/runtime 1.8.2-next.0 → 1.8.2-next.2

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 (31) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/{chunk-UGVXD6KK.mjs → chunk-2VYBYZPK.mjs} +2 -2
  3. package/dist/{chunk-QZFOLVUA.mjs → chunk-H5AAJZIT.mjs} +32 -15
  4. package/dist/chunk-H5AAJZIT.mjs.map +1 -0
  5. package/dist/{chunk-TNMBPY25.mjs → chunk-NLQY44UU.mjs} +2 -2
  6. package/dist/{chunk-QAPB44C7.mjs → chunk-TD5ENJ33.mjs} +2 -2
  7. package/dist/index.js +22 -5
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +6 -6
  10. package/dist/lib/index.js +22 -5
  11. package/dist/lib/index.js.map +1 -1
  12. package/dist/lib/index.mjs +6 -6
  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 +6 -6
  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 +4 -4
  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 +4 -4
  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 +3 -3
  25. package/package.json +4 -4
  26. package/src/lib/runtime/copilot-runtime.ts +16 -4
  27. package/src/lib/runtime/remote-lg-action.ts +9 -5
  28. package/dist/chunk-QZFOLVUA.mjs.map +0 -1
  29. /package/dist/{chunk-UGVXD6KK.mjs.map → chunk-2VYBYZPK.mjs.map} +0 -0
  30. /package/dist/{chunk-TNMBPY25.mjs.map → chunk-NLQY44UU.mjs.map} +0 -0
  31. /package/dist/{chunk-QAPB44C7.mjs.map → chunk-TD5ENJ33.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-QAPB44C7.mjs";
6
+ } from "./chunk-TD5ENJ33.mjs";
7
7
  import {
8
8
  copilotRuntimeNestEndpoint
9
- } from "./chunk-UGVXD6KK.mjs";
9
+ } from "./chunk-2VYBYZPK.mjs";
10
10
  import {
11
11
  copilotRuntimeNodeExpressEndpoint
12
- } from "./chunk-TNMBPY25.mjs";
12
+ } from "./chunk-NLQY44UU.mjs";
13
13
  import {
14
14
  CopilotRuntime,
15
15
  addCustomHeaderPlugin,
@@ -22,9 +22,7 @@ import {
22
22
  getCommonConfig,
23
23
  langGraphPlatformEndpoint,
24
24
  resolveEndpointType
25
- } from "./chunk-QZFOLVUA.mjs";
26
- import "./chunk-RTFJTJMA.mjs";
27
- import "./chunk-2OZAGFV3.mjs";
25
+ } from "./chunk-H5AAJZIT.mjs";
28
26
  import {
29
27
  AnthropicAdapter,
30
28
  EmptyAdapter,
@@ -43,6 +41,8 @@ import {
43
41
  MessageStreamInterruptedResponse,
44
42
  UnknownErrorResponse
45
43
  } from "./chunk-5BIEM2UU.mjs";
44
+ import "./chunk-RTFJTJMA.mjs";
45
+ import "./chunk-2OZAGFV3.mjs";
46
46
  import "./chunk-FHD4JECV.mjs";
47
47
 
48
48
  // src/index.ts
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.8.2-next.0",
47
+ version: "1.8.2-next.2",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -2294,7 +2294,7 @@ async function streamEvents(controller, args) {
2294
2294
  const graphInfo = await client.assistants.getGraph(assistantId);
2295
2295
  const graphSchema = await client.assistants.getSchemas(assistantId);
2296
2296
  const schemaKeys = getSchemaKeys(graphSchema);
2297
- if (payload.input && schemaKeys.input) {
2297
+ if (payload.input && (schemaKeys == null ? void 0 : schemaKeys.input)) {
2298
2298
  payload.input = Object.fromEntries(Object.entries(payload.input).filter(([key]) => schemaKeys.input.includes(key)));
2299
2299
  }
2300
2300
  let streamingStateExtractor = new StreamingStateExtractor([]);
@@ -2468,7 +2468,7 @@ function getStateSyncEvent({ threadId, runId, agentName, nodeName, state, runnin
2468
2468
  messages: langchainMessagesToCopilotKit(state.messages || [])
2469
2469
  };
2470
2470
  }
2471
- if (schemaKeys.output) {
2471
+ if (schemaKeys == null ? void 0 : schemaKeys.output) {
2472
2472
  state = Object.fromEntries(Object.entries(state).filter(([key]) => schemaKeys.output.includes(key)));
2473
2473
  }
2474
2474
  return JSON.stringify({
@@ -2710,6 +2710,9 @@ function getSchemaKeys(graphSchema) {
2710
2710
  "messages",
2711
2711
  "copilotkit"
2712
2712
  ];
2713
+ if (!graphSchema.input_schema.properties || !graphSchema.output_schema.properties) {
2714
+ return null;
2715
+ }
2713
2716
  const inputSchema = Object.keys(graphSchema.input_schema.properties);
2714
2717
  const outputSchema = Object.keys(graphSchema.output_schema.properties);
2715
2718
  return {
@@ -3881,8 +3884,22 @@ please use an LLM adapter instead.`
3881
3884
  ...propertyHeaders
3882
3885
  }
3883
3886
  });
3884
- const data = await client.assistants.search();
3885
- const endpointAgents = (data ?? []).map((entry) => ({
3887
+ let data = [];
3888
+ try {
3889
+ data = await client.assistants.search();
3890
+ if (data && "detail" in data && data.detail.toLowerCase() === "not found") {
3891
+ throw new import_shared18.CopilotKitAgentDiscoveryError();
3892
+ }
3893
+ } catch (e) {
3894
+ throw new import_shared18.CopilotKitMisuseError({
3895
+ message: `
3896
+ Failed to find or contact remote endpoint at url ${endpoint.deploymentUrl}.
3897
+ Make sure the API is running and that it's indeed a LangGraph platform url.
3898
+
3899
+ See more: https://docs.copilotkit.ai/troubleshooting/common-issues`
3900
+ });
3901
+ }
3902
+ const endpointAgents = data.map((entry) => ({
3886
3903
  name: entry.graph_id,
3887
3904
  id: entry.assistant_id,
3888
3905
  description: "",