@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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  copilotRuntimeNodeHttpEndpoint
3
- } from "../../../chunk-ZWY6JDFI.mjs";
3
+ } from "../../../chunk-5X2H5HLD.mjs";
4
4
  import "../../../chunk-FZJAYGIR.mjs";
5
5
  import "../../../chunk-5BIEM2UU.mjs";
6
6
  import "../../../chunk-RTFJTJMA.mjs";
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.8.4-next.2",
12
+ "version": "1.8.4-next.4",
13
13
  "sideEffects": false,
14
14
  "main": "./dist/index.js",
15
15
  "module": "./dist/index.mjs",
@@ -59,7 +59,7 @@
59
59
  "rxjs": "^7.8.1",
60
60
  "type-graphql": "2.0.0-rc.1",
61
61
  "zod": "^3.23.3",
62
- "@copilotkit/shared": "1.8.4-next.2"
62
+ "@copilotkit/shared": "1.8.4-next.4"
63
63
  },
64
64
  "keywords": [
65
65
  "copilotkit",
@@ -68,7 +68,11 @@ type LangGraphPlatformMessage =
68
68
  | LangGraphPlatformResultMessage
69
69
  | BaseLangGraphPlatformMessage;
70
70
 
71
- type SchemaKeys = { input: string[] | null; output: string[] | null } | null;
71
+ type SchemaKeys = {
72
+ input: string[] | null;
73
+ output: string[] | null;
74
+ config: string[] | null;
75
+ } | null;
72
76
 
73
77
  let activeInterruptEvent = false;
74
78
 
@@ -202,17 +206,19 @@ async function streamEvents(controller: ReadableStreamDefaultController, args: E
202
206
  }
203
207
  const assistantId = retrievedAssistant.assistant_id;
204
208
 
205
- if (configurable) {
206
- await client.assistants.update(assistantId, { config: { configurable } });
207
- }
208
209
  const graphInfo = await client.assistants.getGraph(assistantId);
209
210
  const graphSchema = await client.assistants.getSchemas(assistantId);
210
211
  const schemaKeys = getSchemaKeys(graphSchema);
212
+ if (configurable) {
213
+ const filteredConfigurable = schemaKeys?.config
214
+ ? filterObjectBySchemaKeys(configurable, schemaKeys?.config)
215
+ : configurable;
216
+ await client.assistants.update(assistantId, { config: { configurable: filteredConfigurable } });
217
+ }
218
+
211
219
  // Do not input keys that are not part of the input schema
212
220
  if (payload.input && schemaKeys?.input) {
213
- payload.input = Object.fromEntries(
214
- Object.entries(payload.input).filter(([key]) => schemaKeys.input.includes(key)),
215
- );
221
+ payload.input = filterObjectBySchemaKeys(payload.input, schemaKeys.input);
216
222
  }
217
223
 
218
224
  let streamingStateExtractor = new StreamingStateExtractor([]);
@@ -468,9 +474,7 @@ function getStateSyncEvent({
468
474
 
469
475
  // Do not emit state keys that are not part of the output schema
470
476
  if (schemaKeys?.output) {
471
- state = Object.fromEntries(
472
- Object.entries(state).filter(([key]) => schemaKeys.output.includes(key)),
473
- );
477
+ state = filterObjectBySchemaKeys(state, schemaKeys.output);
474
478
  }
475
479
 
476
480
  return (
@@ -764,8 +768,12 @@ function copilotkitMessagesToLangChain(messages: Message[]): LangGraphPlatformMe
764
768
 
765
769
  function getSchemaKeys(graphSchema: GraphSchema): SchemaKeys {
766
770
  const CONSTANT_KEYS = ["messages", "copilotkit"];
771
+ let configSchema = null;
772
+ if (graphSchema.config_schema.properties) {
773
+ configSchema = Object.keys(graphSchema.config_schema.properties);
774
+ }
767
775
  if (!graphSchema.input_schema.properties || !graphSchema.output_schema.properties) {
768
- return null;
776
+ return configSchema;
769
777
  }
770
778
  const inputSchema = Object.keys(graphSchema.input_schema.properties);
771
779
  const outputSchema = Object.keys(graphSchema.output_schema.properties);
@@ -773,5 +781,10 @@ function getSchemaKeys(graphSchema: GraphSchema): SchemaKeys {
773
781
  return {
774
782
  input: inputSchema && inputSchema.length ? [...inputSchema, ...CONSTANT_KEYS] : null,
775
783
  output: outputSchema && outputSchema.length ? [...outputSchema, ...CONSTANT_KEYS] : null,
784
+ config: configSchema,
776
785
  };
777
786
  }
787
+
788
+ function filterObjectBySchemaKeys(obj: Record<string, any>, schemaKeys: string[]) {
789
+ return Object.fromEntries(Object.entries(obj).filter(([key]) => schemaKeys.includes(key)));
790
+ }