@copilotkit/runtime 1.6.0-next.6 → 1.6.0-next.8

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 +17 -0
  2. package/dist/{chunk-5HTQ3NJN.mjs → chunk-C7VKUXWC.mjs} +36 -6
  3. package/dist/chunk-C7VKUXWC.mjs.map +1 -0
  4. package/dist/{chunk-MADVAANL.mjs → chunk-CC5KHDCV.mjs} +2 -2
  5. package/dist/{chunk-KOZEUHQH.mjs → chunk-DI2VJM3I.mjs} +2 -2
  6. package/dist/{chunk-USK52PF7.mjs → chunk-LR7HA4X5.mjs} +2 -2
  7. package/dist/index.js +35 -5
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +4 -4
  10. package/dist/lib/index.js +35 -5
  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 +33 -1
  27. package/dist/chunk-5HTQ3NJN.mjs.map +0 -1
  28. /package/dist/{chunk-MADVAANL.mjs.map → chunk-CC5KHDCV.mjs.map} +0 -0
  29. /package/dist/{chunk-KOZEUHQH.mjs.map → chunk-DI2VJM3I.mjs.map} +0 -0
  30. /package/dist/{chunk-USK52PF7.mjs.map → chunk-LR7HA4X5.mjs.map} +0 -0
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-5HTQ3NJN.mjs";
5
+ } from "./chunk-C7VKUXWC.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-MADVAANL.mjs.map
25
+ //# sourceMappingURL=chunk-CC5KHDCV.mjs.map
@@ -2,7 +2,7 @@ import {
2
2
  getCommonConfig,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-5HTQ3NJN.mjs";
5
+ } from "./chunk-C7VKUXWC.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-KOZEUHQH.mjs.map
80
+ //# sourceMappingURL=chunk-DI2VJM3I.mjs.map
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-5HTQ3NJN.mjs";
5
+ } from "./chunk-C7VKUXWC.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-USK52PF7.mjs.map
25
+ //# sourceMappingURL=chunk-LR7HA4X5.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.6.0-next.6",
47
+ version: "1.6.0-next.8",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -2619,6 +2619,11 @@ async function streamEvents(controller, args) {
2619
2619
  });
2620
2620
  }
2621
2621
  const graphInfo = await client.assistants.getGraph(assistantId);
2622
+ const graphSchema = await client.assistants.getSchemas(assistantId);
2623
+ const schemaKeys = getSchemaKeys(graphSchema);
2624
+ if (payload.input && schemaKeys.input) {
2625
+ payload.input = Object.fromEntries(Object.entries(payload.input).filter(([key]) => schemaKeys.input.includes(key)));
2626
+ }
2622
2627
  let streamingStateExtractor = new StreamingStateExtractor([]);
2623
2628
  let prevNodeName = null;
2624
2629
  let emitIntermediateStateUntilEnd = null;
@@ -2710,7 +2715,8 @@ async function streamEvents(controller, args) {
2710
2715
  nodeName,
2711
2716
  state: manuallyEmittedState,
2712
2717
  running: true,
2713
- active: true
2718
+ active: true,
2719
+ schemaKeys
2714
2720
  }));
2715
2721
  continue;
2716
2722
  }
@@ -2742,7 +2748,8 @@ async function streamEvents(controller, args) {
2742
2748
  nodeName,
2743
2749
  state,
2744
2750
  running: true,
2745
- active: !exitingNode
2751
+ active: !exitingNode,
2752
+ schemaKeys
2746
2753
  }));
2747
2754
  }
2748
2755
  emit(JSON.stringify(event) + "\n");
@@ -2760,7 +2767,8 @@ async function streamEvents(controller, args) {
2760
2767
  state: state.values,
2761
2768
  running: !shouldExit,
2762
2769
  active: false,
2763
- includeMessages: true
2770
+ includeMessages: true,
2771
+ schemaKeys
2764
2772
  }));
2765
2773
  return Promise.resolve();
2766
2774
  } catch (e) {
@@ -2773,7 +2781,7 @@ async function streamEvents(controller, args) {
2773
2781
  }
2774
2782
  }
2775
2783
  __name(streamEvents, "streamEvents");
2776
- function getStateSyncEvent({ threadId, runId, agentName, nodeName, state, running, active, includeMessages = false }) {
2784
+ function getStateSyncEvent({ threadId, runId, agentName, nodeName, state, running, active, includeMessages = false, schemaKeys }) {
2777
2785
  if (!includeMessages) {
2778
2786
  state = Object.keys(state).reduce((acc, key) => {
2779
2787
  if (key !== "messages") {
@@ -2787,6 +2795,9 @@ function getStateSyncEvent({ threadId, runId, agentName, nodeName, state, runnin
2787
2795
  messages: langchainMessagesToCopilotKit(state.messages || [])
2788
2796
  };
2789
2797
  }
2798
+ if (schemaKeys.output) {
2799
+ state = Object.fromEntries(Object.entries(state).filter(([key]) => schemaKeys.output.includes(key)));
2800
+ }
2790
2801
  return JSON.stringify({
2791
2802
  event: LangGraphEventTypes.OnCopilotKitStateSync,
2792
2803
  thread_id: threadId,
@@ -3021,6 +3032,25 @@ function copilotkitMessagesToLangChain(messages) {
3021
3032
  return result;
3022
3033
  }
3023
3034
  __name(copilotkitMessagesToLangChain, "copilotkitMessagesToLangChain");
3035
+ function getSchemaKeys(graphSchema) {
3036
+ const CONSTANT_KEYS = [
3037
+ "messages",
3038
+ "copilotkit"
3039
+ ];
3040
+ const inputSchema = Object.keys(graphSchema.input_schema.properties);
3041
+ const outputSchema = Object.keys(graphSchema.output_schema.properties);
3042
+ return {
3043
+ input: inputSchema && inputSchema.length ? [
3044
+ ...inputSchema,
3045
+ ...CONSTANT_KEYS
3046
+ ] : null,
3047
+ output: outputSchema && outputSchema.length ? [
3048
+ ...outputSchema,
3049
+ ...CONSTANT_KEYS
3050
+ ] : null
3051
+ };
3052
+ }
3053
+ __name(getSchemaKeys, "getSchemaKeys");
3024
3054
 
3025
3055
  // src/lib/runtime/remote-action-constructors.ts
3026
3056
  var import_shared13 = require("@copilotkit/shared");