@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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @copilotkit/runtime
2
2
 
3
+ ## 1.8.2-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 4eedf97: - fix: handle failure to fetch langgraph schema
8
+ - @copilotkit/shared@1.8.2-next.2
9
+
10
+ ## 1.8.2-next.1
11
+
12
+ ### Patch Changes
13
+
14
+ - e95bb0e: - fix: clarify difference between lgp endpoints to fastapi endpoints
15
+ - @copilotkit/shared@1.8.2-next.1
16
+
3
17
  ## 1.8.2-next.0
4
18
 
5
19
  ### Patch Changes
@@ -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(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
22
22
  export {
23
23
  copilotRuntimeNestEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-UGVXD6KK.mjs.map
25
+ //# sourceMappingURL=chunk-2VYBYZPK.mjs.map
@@ -1,12 +1,3 @@
1
- import {
2
- ActionExecutionMessage,
3
- AgentStateMessage,
4
- ResultMessage,
5
- TextMessage
6
- } from "./chunk-RTFJTJMA.mjs";
7
- import {
8
- BaseMessageInput
9
- } from "./chunk-2OZAGFV3.mjs";
10
1
  import {
11
2
  EmptyAdapter,
12
3
  RemoteChain,
@@ -19,6 +10,15 @@ import {
19
10
  SuccessResponseStatus,
20
11
  UnknownErrorResponse
21
12
  } from "./chunk-5BIEM2UU.mjs";
13
+ import {
14
+ ActionExecutionMessage,
15
+ AgentStateMessage,
16
+ ResultMessage,
17
+ TextMessage
18
+ } from "./chunk-RTFJTJMA.mjs";
19
+ import {
20
+ BaseMessageInput
21
+ } from "./chunk-2OZAGFV3.mjs";
22
22
  import {
23
23
  __commonJS,
24
24
  __name,
@@ -39,7 +39,7 @@ var require_package = __commonJS({
39
39
  publishConfig: {
40
40
  access: "public"
41
41
  },
42
- version: "1.8.2-next.0",
42
+ version: "1.8.2-next.2",
43
43
  sideEffects: false,
44
44
  main: "./dist/index.js",
45
45
  module: "./dist/index.mjs",
@@ -1807,7 +1807,7 @@ async function streamEvents(controller, args) {
1807
1807
  const graphInfo = await client.assistants.getGraph(assistantId);
1808
1808
  const graphSchema = await client.assistants.getSchemas(assistantId);
1809
1809
  const schemaKeys = getSchemaKeys(graphSchema);
1810
- if (payload.input && schemaKeys.input) {
1810
+ if (payload.input && (schemaKeys == null ? void 0 : schemaKeys.input)) {
1811
1811
  payload.input = Object.fromEntries(Object.entries(payload.input).filter(([key]) => schemaKeys.input.includes(key)));
1812
1812
  }
1813
1813
  let streamingStateExtractor = new StreamingStateExtractor([]);
@@ -1981,7 +1981,7 @@ function getStateSyncEvent({ threadId, runId, agentName, nodeName, state, runnin
1981
1981
  messages: langchainMessagesToCopilotKit(state.messages || [])
1982
1982
  };
1983
1983
  }
1984
- if (schemaKeys.output) {
1984
+ if (schemaKeys == null ? void 0 : schemaKeys.output) {
1985
1985
  state = Object.fromEntries(Object.entries(state).filter(([key]) => schemaKeys.output.includes(key)));
1986
1986
  }
1987
1987
  return JSON.stringify({
@@ -2223,6 +2223,9 @@ function getSchemaKeys(graphSchema) {
2223
2223
  "messages",
2224
2224
  "copilotkit"
2225
2225
  ];
2226
+ if (!graphSchema.input_schema.properties || !graphSchema.output_schema.properties) {
2227
+ return null;
2228
+ }
2226
2229
  const inputSchema = Object.keys(graphSchema.input_schema.properties);
2227
2230
  const outputSchema = Object.keys(graphSchema.output_schema.properties);
2228
2231
  return {
@@ -2920,8 +2923,22 @@ please use an LLM adapter instead.`
2920
2923
  ...propertyHeaders
2921
2924
  }
2922
2925
  });
2923
- const data = await client.assistants.search();
2924
- const endpointAgents = (data ?? []).map((entry) => ({
2926
+ let data = [];
2927
+ try {
2928
+ data = await client.assistants.search();
2929
+ if (data && "detail" in data && data.detail.toLowerCase() === "not found") {
2930
+ throw new CopilotKitAgentDiscoveryError();
2931
+ }
2932
+ } catch (e) {
2933
+ throw new CopilotKitMisuseError({
2934
+ message: `
2935
+ Failed to find or contact remote endpoint at url ${endpoint.deploymentUrl}.
2936
+ Make sure the API is running and that it's indeed a LangGraph platform url.
2937
+
2938
+ See more: https://docs.copilotkit.ai/troubleshooting/common-issues`
2939
+ });
2940
+ }
2941
+ const endpointAgents = data.map((entry) => ({
2925
2942
  name: entry.graph_id,
2926
2943
  id: entry.assistant_id,
2927
2944
  description: "",
@@ -4555,4 +4572,4 @@ export {
4555
4572
  getCommonConfig,
4556
4573
  copilotRuntimeNodeHttpEndpoint
4557
4574
  };
4558
- //# sourceMappingURL=chunk-QZFOLVUA.mjs.map
4575
+ //# sourceMappingURL=chunk-H5AAJZIT.mjs.map