@copilotkit/runtime 1.8.4-next.2 → 1.8.4-next.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 +7 -0
  2. package/dist/{chunk-E6VXSOGW.mjs → chunk-6SHV3BGA.mjs} +2 -2
  3. package/dist/{chunk-ZWY6JDFI.mjs → chunk-FEE2BWEL.mjs} +20 -10
  4. package/dist/chunk-FEE2BWEL.mjs.map +1 -0
  5. package/dist/{chunk-B45VFLS3.mjs → chunk-NN5RJK22.mjs} +2 -2
  6. package/dist/{chunk-FJ7VCD4V.mjs → chunk-VT4HR4Q5.mjs} +2 -2
  7. package/dist/index.js +19 -9
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +4 -4
  10. package/dist/lib/index.js +19 -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 +2 -2
  26. package/src/lib/runtime/remote-lg-action.ts +24 -11
  27. package/dist/chunk-ZWY6JDFI.mjs.map +0 -1
  28. /package/dist/{chunk-E6VXSOGW.mjs.map → chunk-6SHV3BGA.mjs.map} +0 -0
  29. /package/dist/{chunk-B45VFLS3.mjs.map → chunk-NN5RJK22.mjs.map} +0 -0
  30. /package/dist/{chunk-FJ7VCD4V.mjs.map → chunk-VT4HR4Q5.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @copilotkit/runtime
2
2
 
3
+ ## 1.8.4-next.3
4
+
5
+ ### Patch Changes
6
+
7
+ - e652aac: - feat: add support for langgraph config schema
8
+ - @copilotkit/shared@1.8.4-next.3
9
+
3
10
  ## 1.8.4-next.2
4
11
 
5
12
  ### Patch Changes
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-ZWY6JDFI.mjs";
5
+ } from "./chunk-FEE2BWEL.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-E6VXSOGW.mjs.map
25
+ //# sourceMappingURL=chunk-6SHV3BGA.mjs.map
@@ -39,7 +39,7 @@ var require_package = __commonJS({
39
39
  publishConfig: {
40
40
  access: "public"
41
41
  },
42
- version: "1.8.4-next.2",
42
+ version: "1.8.4-next.3",
43
43
  sideEffects: false,
44
44
  main: "./dist/index.js",
45
45
  module: "./dist/index.mjs",
@@ -1797,18 +1797,19 @@ async function streamEvents(controller, args) {
1797
1797
  throw new Error("No agent id found");
1798
1798
  }
1799
1799
  const assistantId = retrievedAssistant.assistant_id;
1800
+ const graphInfo = await client.assistants.getGraph(assistantId);
1801
+ const graphSchema = await client.assistants.getSchemas(assistantId);
1802
+ const schemaKeys = getSchemaKeys(graphSchema);
1800
1803
  if (configurable) {
1804
+ const filteredConfigurable = (schemaKeys == null ? void 0 : schemaKeys.config) ? filterObjectBySchemaKeys(configurable, schemaKeys == null ? void 0 : schemaKeys.config) : configurable;
1801
1805
  await client.assistants.update(assistantId, {
1802
1806
  config: {
1803
- configurable
1807
+ configurable: filteredConfigurable
1804
1808
  }
1805
1809
  });
1806
1810
  }
1807
- const graphInfo = await client.assistants.getGraph(assistantId);
1808
- const graphSchema = await client.assistants.getSchemas(assistantId);
1809
- const schemaKeys = getSchemaKeys(graphSchema);
1810
1811
  if (payload.input && (schemaKeys == null ? void 0 : schemaKeys.input)) {
1811
- payload.input = Object.fromEntries(Object.entries(payload.input).filter(([key]) => schemaKeys.input.includes(key)));
1812
+ payload.input = filterObjectBySchemaKeys(payload.input, schemaKeys.input);
1812
1813
  }
1813
1814
  let streamingStateExtractor = new StreamingStateExtractor([]);
1814
1815
  let prevNodeName = null;
@@ -1982,7 +1983,7 @@ function getStateSyncEvent({ threadId, runId, agentName, nodeName, state, runnin
1982
1983
  };
1983
1984
  }
1984
1985
  if (schemaKeys == null ? void 0 : schemaKeys.output) {
1985
- state = Object.fromEntries(Object.entries(state).filter(([key]) => schemaKeys.output.includes(key)));
1986
+ state = filterObjectBySchemaKeys(state, schemaKeys.output);
1986
1987
  }
1987
1988
  return JSON.stringify({
1988
1989
  event: LangGraphEventTypes.OnCopilotKitStateSync,
@@ -2223,8 +2224,12 @@ function getSchemaKeys(graphSchema) {
2223
2224
  "messages",
2224
2225
  "copilotkit"
2225
2226
  ];
2227
+ let configSchema = null;
2228
+ if (graphSchema.config_schema.properties) {
2229
+ configSchema = Object.keys(graphSchema.config_schema.properties);
2230
+ }
2226
2231
  if (!graphSchema.input_schema.properties || !graphSchema.output_schema.properties) {
2227
- return null;
2232
+ return configSchema;
2228
2233
  }
2229
2234
  const inputSchema = Object.keys(graphSchema.input_schema.properties);
2230
2235
  const outputSchema = Object.keys(graphSchema.output_schema.properties);
@@ -2236,10 +2241,15 @@ function getSchemaKeys(graphSchema) {
2236
2241
  output: outputSchema && outputSchema.length ? [
2237
2242
  ...outputSchema,
2238
2243
  ...CONSTANT_KEYS
2239
- ] : null
2244
+ ] : null,
2245
+ config: configSchema
2240
2246
  };
2241
2247
  }
2242
2248
  __name(getSchemaKeys, "getSchemaKeys");
2249
+ function filterObjectBySchemaKeys(obj, schemaKeys) {
2250
+ return Object.fromEntries(Object.entries(obj).filter(([key]) => schemaKeys.includes(key)));
2251
+ }
2252
+ __name(filterObjectBySchemaKeys, "filterObjectBySchemaKeys");
2243
2253
 
2244
2254
  // src/lib/runtime/remote-action-constructors.ts
2245
2255
  import { CopilotKitError, CopilotKitLowLevelError } from "@copilotkit/shared";
@@ -4581,4 +4591,4 @@ export {
4581
4591
  getCommonConfig,
4582
4592
  copilotRuntimeNodeHttpEndpoint
4583
4593
  };
4584
- //# sourceMappingURL=chunk-ZWY6JDFI.mjs.map
4594
+ //# sourceMappingURL=chunk-FEE2BWEL.mjs.map