@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
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-QZFOLVUA.mjs";
5
+ } from "./chunk-H5AAJZIT.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-FHD4JECV.mjs";
@@ -22,4 +22,4 @@ __name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
22
22
  export {
23
23
  copilotRuntimeNodeExpressEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-TNMBPY25.mjs.map
25
+ //# sourceMappingURL=chunk-NLQY44UU.mjs.map
@@ -2,7 +2,7 @@ import {
2
2
  getCommonConfig,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-QZFOLVUA.mjs";
5
+ } from "./chunk-H5AAJZIT.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-FHD4JECV.mjs";
@@ -77,4 +77,4 @@ export {
77
77
  config,
78
78
  copilotRuntimeNextJSPagesRouterEndpoint
79
79
  };
80
- //# sourceMappingURL=chunk-QAPB44C7.mjs.map
80
+ //# sourceMappingURL=chunk-TD5ENJ33.mjs.map
package/dist/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",
@@ -2630,7 +2630,7 @@ async function streamEvents(controller, args) {
2630
2630
  const graphInfo = await client.assistants.getGraph(assistantId);
2631
2631
  const graphSchema = await client.assistants.getSchemas(assistantId);
2632
2632
  const schemaKeys = getSchemaKeys(graphSchema);
2633
- if (payload.input && schemaKeys.input) {
2633
+ if (payload.input && (schemaKeys == null ? void 0 : schemaKeys.input)) {
2634
2634
  payload.input = Object.fromEntries(Object.entries(payload.input).filter(([key]) => schemaKeys.input.includes(key)));
2635
2635
  }
2636
2636
  let streamingStateExtractor = new StreamingStateExtractor([]);
@@ -2804,7 +2804,7 @@ function getStateSyncEvent({ threadId, runId, agentName, nodeName, state, runnin
2804
2804
  messages: langchainMessagesToCopilotKit(state.messages || [])
2805
2805
  };
2806
2806
  }
2807
- if (schemaKeys.output) {
2807
+ if (schemaKeys == null ? void 0 : schemaKeys.output) {
2808
2808
  state = Object.fromEntries(Object.entries(state).filter(([key]) => schemaKeys.output.includes(key)));
2809
2809
  }
2810
2810
  return JSON.stringify({
@@ -3046,6 +3046,9 @@ function getSchemaKeys(graphSchema) {
3046
3046
  "messages",
3047
3047
  "copilotkit"
3048
3048
  ];
3049
+ if (!graphSchema.input_schema.properties || !graphSchema.output_schema.properties) {
3050
+ return null;
3051
+ }
3049
3052
  const inputSchema = Object.keys(graphSchema.input_schema.properties);
3050
3053
  const outputSchema = Object.keys(graphSchema.output_schema.properties);
3051
3054
  return {
@@ -4217,8 +4220,22 @@ please use an LLM adapter instead.`
4217
4220
  ...propertyHeaders
4218
4221
  }
4219
4222
  });
4220
- const data = await client.assistants.search();
4221
- const endpointAgents = (data ?? []).map((entry) => ({
4223
+ let data = [];
4224
+ try {
4225
+ data = await client.assistants.search();
4226
+ if (data && "detail" in data && data.detail.toLowerCase() === "not found") {
4227
+ throw new import_shared20.CopilotKitAgentDiscoveryError();
4228
+ }
4229
+ } catch (e) {
4230
+ throw new import_shared20.CopilotKitMisuseError({
4231
+ message: `
4232
+ Failed to find or contact remote endpoint at url ${endpoint.deploymentUrl}.
4233
+ Make sure the API is running and that it's indeed a LangGraph platform url.
4234
+
4235
+ See more: https://docs.copilotkit.ai/troubleshooting/common-issues`
4236
+ });
4237
+ }
4238
+ const endpointAgents = data.map((entry) => ({
4222
4239
  name: entry.graph_id,
4223
4240
  id: entry.assistant_id,
4224
4241
  description: "",