@copilotkit/runtime 1.8.4-next.2 → 1.8.4-next.4

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 +13 -0
  2. package/dist/{chunk-ZWY6JDFI.mjs → chunk-5X2H5HLD.mjs} +20 -10
  3. package/dist/chunk-5X2H5HLD.mjs.map +1 -0
  4. package/dist/{chunk-FJ7VCD4V.mjs → chunk-6K4HPVLV.mjs} +2 -2
  5. package/dist/{chunk-E6VXSOGW.mjs → chunk-I3SJAMYV.mjs} +2 -2
  6. package/dist/{chunk-B45VFLS3.mjs → chunk-Z5YMBYPF.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-FJ7VCD4V.mjs.map → chunk-6K4HPVLV.mjs.map} +0 -0
  29. /package/dist/{chunk-E6VXSOGW.mjs.map → chunk-I3SJAMYV.mjs.map} +0 -0
  30. /package/dist/{chunk-B45VFLS3.mjs.map → chunk-Z5YMBYPF.mjs.map} +0 -0
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-ZWY6JDFI.mjs";
5
+ } from "./chunk-5X2H5HLD.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-FJ7VCD4V.mjs.map
25
+ //# sourceMappingURL=chunk-6K4HPVLV.mjs.map
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-ZWY6JDFI.mjs";
5
+ } from "./chunk-5X2H5HLD.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-I3SJAMYV.mjs.map
@@ -2,7 +2,7 @@ import {
2
2
  getCommonConfig,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-ZWY6JDFI.mjs";
5
+ } from "./chunk-5X2H5HLD.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-B45VFLS3.mjs.map
80
+ //# sourceMappingURL=chunk-Z5YMBYPF.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.4-next.2",
47
+ version: "1.8.4-next.4",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -2620,18 +2620,19 @@ async function streamEvents(controller, args) {
2620
2620
  throw new Error("No agent id found");
2621
2621
  }
2622
2622
  const assistantId = retrievedAssistant.assistant_id;
2623
+ const graphInfo = await client.assistants.getGraph(assistantId);
2624
+ const graphSchema = await client.assistants.getSchemas(assistantId);
2625
+ const schemaKeys = getSchemaKeys(graphSchema);
2623
2626
  if (configurable) {
2627
+ const filteredConfigurable = (schemaKeys == null ? void 0 : schemaKeys.config) ? filterObjectBySchemaKeys(configurable, schemaKeys == null ? void 0 : schemaKeys.config) : configurable;
2624
2628
  await client.assistants.update(assistantId, {
2625
2629
  config: {
2626
- configurable
2630
+ configurable: filteredConfigurable
2627
2631
  }
2628
2632
  });
2629
2633
  }
2630
- const graphInfo = await client.assistants.getGraph(assistantId);
2631
- const graphSchema = await client.assistants.getSchemas(assistantId);
2632
- const schemaKeys = getSchemaKeys(graphSchema);
2633
2634
  if (payload.input && (schemaKeys == null ? void 0 : schemaKeys.input)) {
2634
- payload.input = Object.fromEntries(Object.entries(payload.input).filter(([key]) => schemaKeys.input.includes(key)));
2635
+ payload.input = filterObjectBySchemaKeys(payload.input, schemaKeys.input);
2635
2636
  }
2636
2637
  let streamingStateExtractor = new StreamingStateExtractor([]);
2637
2638
  let prevNodeName = null;
@@ -2805,7 +2806,7 @@ function getStateSyncEvent({ threadId, runId, agentName, nodeName, state, runnin
2805
2806
  };
2806
2807
  }
2807
2808
  if (schemaKeys == null ? void 0 : schemaKeys.output) {
2808
- state = Object.fromEntries(Object.entries(state).filter(([key]) => schemaKeys.output.includes(key)));
2809
+ state = filterObjectBySchemaKeys(state, schemaKeys.output);
2809
2810
  }
2810
2811
  return JSON.stringify({
2811
2812
  event: LangGraphEventTypes.OnCopilotKitStateSync,
@@ -3046,8 +3047,12 @@ function getSchemaKeys(graphSchema) {
3046
3047
  "messages",
3047
3048
  "copilotkit"
3048
3049
  ];
3050
+ let configSchema = null;
3051
+ if (graphSchema.config_schema.properties) {
3052
+ configSchema = Object.keys(graphSchema.config_schema.properties);
3053
+ }
3049
3054
  if (!graphSchema.input_schema.properties || !graphSchema.output_schema.properties) {
3050
- return null;
3055
+ return configSchema;
3051
3056
  }
3052
3057
  const inputSchema = Object.keys(graphSchema.input_schema.properties);
3053
3058
  const outputSchema = Object.keys(graphSchema.output_schema.properties);
@@ -3059,10 +3064,15 @@ function getSchemaKeys(graphSchema) {
3059
3064
  output: outputSchema && outputSchema.length ? [
3060
3065
  ...outputSchema,
3061
3066
  ...CONSTANT_KEYS
3062
- ] : null
3067
+ ] : null,
3068
+ config: configSchema
3063
3069
  };
3064
3070
  }
3065
3071
  __name(getSchemaKeys, "getSchemaKeys");
3072
+ function filterObjectBySchemaKeys(obj, schemaKeys) {
3073
+ return Object.fromEntries(Object.entries(obj).filter(([key]) => schemaKeys.includes(key)));
3074
+ }
3075
+ __name(filterObjectBySchemaKeys, "filterObjectBySchemaKeys");
3066
3076
 
3067
3077
  // src/lib/runtime/remote-action-constructors.ts
3068
3078
  var import_shared13 = require("@copilotkit/shared");