@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.
- package/CHANGELOG.md +7 -0
- package/dist/{chunk-E6VXSOGW.mjs → chunk-6SHV3BGA.mjs} +2 -2
- package/dist/{chunk-ZWY6JDFI.mjs → chunk-FEE2BWEL.mjs} +20 -10
- package/dist/chunk-FEE2BWEL.mjs.map +1 -0
- package/dist/{chunk-B45VFLS3.mjs → chunk-NN5RJK22.mjs} +2 -2
- package/dist/{chunk-FJ7VCD4V.mjs → chunk-VT4HR4Q5.mjs} +2 -2
- package/dist/index.js +19 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/lib/index.js +19 -9
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +4 -4
- package/dist/lib/integrations/index.js +1 -1
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +4 -4
- package/dist/lib/integrations/nest/index.js +1 -1
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +2 -2
- package/dist/lib/integrations/node-express/index.js +1 -1
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +2 -2
- package/dist/lib/integrations/node-http/index.js +1 -1
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/package.json +2 -2
- package/src/lib/runtime/remote-lg-action.ts +24 -11
- package/dist/chunk-ZWY6JDFI.mjs.map +0 -1
- /package/dist/{chunk-E6VXSOGW.mjs.map → chunk-6SHV3BGA.mjs.map} +0 -0
- /package/dist/{chunk-B45VFLS3.mjs.map → chunk-NN5RJK22.mjs.map} +0 -0
- /package/dist/{chunk-FJ7VCD4V.mjs.map → chunk-VT4HR4Q5.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.8.4-next.
|
|
12
|
+
"version": "1.8.4-next.3",
|
|
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.
|
|
62
|
+
"@copilotkit/shared": "1.8.4-next.3"
|
|
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 = {
|
|
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 =
|
|
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 =
|
|
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
|
|
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
|
+
}
|