@copilotkit/runtime 1.8.2-next.1 → 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 (30) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/{chunk-C6HNX5KB.mjs → chunk-2VYBYZPK.mjs} +2 -2
  3. package/dist/{chunk-HLUPHHYT.mjs → chunk-H5AAJZIT.mjs} +7 -4
  4. package/dist/chunk-H5AAJZIT.mjs.map +1 -0
  5. package/dist/{chunk-CKEC4T6B.mjs → chunk-NLQY44UU.mjs} +2 -2
  6. package/dist/{chunk-KHL2SKIB.mjs → chunk-TD5ENJ33.mjs} +2 -2
  7. package/dist/index.js +6 -3
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +4 -4
  10. package/dist/lib/index.js +6 -3
  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 +9 -5
  27. package/dist/chunk-HLUPHHYT.mjs.map +0 -1
  28. /package/dist/{chunk-C6HNX5KB.mjs.map → chunk-2VYBYZPK.mjs.map} +0 -0
  29. /package/dist/{chunk-CKEC4T6B.mjs.map → chunk-NLQY44UU.mjs.map} +0 -0
  30. /package/dist/{chunk-KHL2SKIB.mjs.map → chunk-TD5ENJ33.mjs.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  copilotRuntimeNodeHttpEndpoint
3
- } from "../../../chunk-HLUPHHYT.mjs";
3
+ } from "../../../chunk-H5AAJZIT.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.2-next.1",
12
+ "version": "1.8.2-next.2",
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.2-next.1"
62
+ "@copilotkit/shared": "1.8.2-next.2"
63
63
  },
64
64
  "keywords": [
65
65
  "copilotkit",
@@ -68,6 +68,8 @@ type LangGraphPlatformMessage =
68
68
  | LangGraphPlatformResultMessage
69
69
  | BaseLangGraphPlatformMessage;
70
70
 
71
+ type SchemaKeys = { input: string[] | null; output: string[] | null } | null;
72
+
71
73
  let activeInterruptEvent = false;
72
74
 
73
75
  export async function execute(args: ExecutionArgs): Promise<ReadableStream<Uint8Array>> {
@@ -206,9 +208,8 @@ async function streamEvents(controller: ReadableStreamDefaultController, args: E
206
208
  const graphInfo = await client.assistants.getGraph(assistantId);
207
209
  const graphSchema = await client.assistants.getSchemas(assistantId);
208
210
  const schemaKeys = getSchemaKeys(graphSchema);
209
-
210
211
  // Do not input keys that are not part of the input schema
211
- if (payload.input && schemaKeys.input) {
212
+ if (payload.input && schemaKeys?.input) {
212
213
  payload.input = Object.fromEntries(
213
214
  Object.entries(payload.input).filter(([key]) => schemaKeys.input.includes(key)),
214
215
  );
@@ -449,7 +450,7 @@ function getStateSyncEvent({
449
450
  running: boolean;
450
451
  active: boolean;
451
452
  includeMessages?: boolean;
452
- schemaKeys: { input: string[] | null; output: string[] | null };
453
+ schemaKeys: SchemaKeys;
453
454
  }): string {
454
455
  if (!includeMessages) {
455
456
  state = Object.keys(state).reduce((acc, key) => {
@@ -466,7 +467,7 @@ function getStateSyncEvent({
466
467
  }
467
468
 
468
469
  // Do not emit state keys that are not part of the output schema
469
- if (schemaKeys.output) {
470
+ if (schemaKeys?.output) {
470
471
  state = Object.fromEntries(
471
472
  Object.entries(state).filter(([key]) => schemaKeys.output.includes(key)),
472
473
  );
@@ -761,8 +762,11 @@ function copilotkitMessagesToLangChain(messages: Message[]): LangGraphPlatformMe
761
762
  return result;
762
763
  }
763
764
 
764
- function getSchemaKeys(graphSchema: GraphSchema) {
765
+ function getSchemaKeys(graphSchema: GraphSchema): SchemaKeys {
765
766
  const CONSTANT_KEYS = ["messages", "copilotkit"];
767
+ if (!graphSchema.input_schema.properties || !graphSchema.output_schema.properties) {
768
+ return null;
769
+ }
766
770
  const inputSchema = Object.keys(graphSchema.input_schema.properties);
767
771
  const outputSchema = Object.keys(graphSchema.output_schema.properties);
768
772