@copilotkit/runtime 1.6.0-next.7 → 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.
- package/CHANGELOG.md +11 -0
- package/dist/{chunk-SAHKR6PK.mjs → chunk-C7VKUXWC.mjs} +36 -6
- package/dist/chunk-C7VKUXWC.mjs.map +1 -0
- package/dist/{chunk-LVJSZOFH.mjs → chunk-CC5KHDCV.mjs} +2 -2
- package/dist/{chunk-DV4VS5ER.mjs → chunk-DI2VJM3I.mjs} +2 -2
- package/dist/{chunk-LTUE24TH.mjs → chunk-LR7HA4X5.mjs} +2 -2
- package/dist/index.js +35 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/lib/index.js +35 -5
- 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 +33 -1
- package/dist/chunk-SAHKR6PK.mjs.map +0 -1
- /package/dist/{chunk-LVJSZOFH.mjs.map → chunk-CC5KHDCV.mjs.map} +0 -0
- /package/dist/{chunk-DV4VS5ER.mjs.map → chunk-DI2VJM3I.mjs.map} +0 -0
- /package/dist/{chunk-LTUE24TH.mjs.map → chunk-LR7HA4X5.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
config,
|
|
4
4
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
5
5
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DI2VJM3I.mjs";
|
|
7
7
|
import {
|
|
8
8
|
copilotRuntimeNestEndpoint
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LR7HA4X5.mjs";
|
|
10
10
|
import {
|
|
11
11
|
copilotRuntimeNodeExpressEndpoint
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CC5KHDCV.mjs";
|
|
13
13
|
import {
|
|
14
14
|
CopilotRuntime,
|
|
15
15
|
addCustomHeaderPlugin,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
getCommonConfig,
|
|
22
22
|
langGraphPlatformEndpoint,
|
|
23
23
|
resolveEndpointType
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-C7VKUXWC.mjs";
|
|
25
25
|
import {
|
|
26
26
|
AnthropicAdapter,
|
|
27
27
|
EmptyAdapter,
|
package/dist/lib/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.
|
|
47
|
+
version: "1.6.0-next.8",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -2283,6 +2283,11 @@ async function streamEvents(controller, args) {
|
|
|
2283
2283
|
});
|
|
2284
2284
|
}
|
|
2285
2285
|
const graphInfo = await client.assistants.getGraph(assistantId);
|
|
2286
|
+
const graphSchema = await client.assistants.getSchemas(assistantId);
|
|
2287
|
+
const schemaKeys = getSchemaKeys(graphSchema);
|
|
2288
|
+
if (payload.input && schemaKeys.input) {
|
|
2289
|
+
payload.input = Object.fromEntries(Object.entries(payload.input).filter(([key]) => schemaKeys.input.includes(key)));
|
|
2290
|
+
}
|
|
2286
2291
|
let streamingStateExtractor = new StreamingStateExtractor([]);
|
|
2287
2292
|
let prevNodeName = null;
|
|
2288
2293
|
let emitIntermediateStateUntilEnd = null;
|
|
@@ -2374,7 +2379,8 @@ async function streamEvents(controller, args) {
|
|
|
2374
2379
|
nodeName,
|
|
2375
2380
|
state: manuallyEmittedState,
|
|
2376
2381
|
running: true,
|
|
2377
|
-
active: true
|
|
2382
|
+
active: true,
|
|
2383
|
+
schemaKeys
|
|
2378
2384
|
}));
|
|
2379
2385
|
continue;
|
|
2380
2386
|
}
|
|
@@ -2406,7 +2412,8 @@ async function streamEvents(controller, args) {
|
|
|
2406
2412
|
nodeName,
|
|
2407
2413
|
state,
|
|
2408
2414
|
running: true,
|
|
2409
|
-
active: !exitingNode
|
|
2415
|
+
active: !exitingNode,
|
|
2416
|
+
schemaKeys
|
|
2410
2417
|
}));
|
|
2411
2418
|
}
|
|
2412
2419
|
emit(JSON.stringify(event) + "\n");
|
|
@@ -2424,7 +2431,8 @@ async function streamEvents(controller, args) {
|
|
|
2424
2431
|
state: state.values,
|
|
2425
2432
|
running: !shouldExit,
|
|
2426
2433
|
active: false,
|
|
2427
|
-
includeMessages: true
|
|
2434
|
+
includeMessages: true,
|
|
2435
|
+
schemaKeys
|
|
2428
2436
|
}));
|
|
2429
2437
|
return Promise.resolve();
|
|
2430
2438
|
} catch (e) {
|
|
@@ -2437,7 +2445,7 @@ async function streamEvents(controller, args) {
|
|
|
2437
2445
|
}
|
|
2438
2446
|
}
|
|
2439
2447
|
__name(streamEvents, "streamEvents");
|
|
2440
|
-
function getStateSyncEvent({ threadId, runId, agentName, nodeName, state, running, active, includeMessages = false }) {
|
|
2448
|
+
function getStateSyncEvent({ threadId, runId, agentName, nodeName, state, running, active, includeMessages = false, schemaKeys }) {
|
|
2441
2449
|
if (!includeMessages) {
|
|
2442
2450
|
state = Object.keys(state).reduce((acc, key) => {
|
|
2443
2451
|
if (key !== "messages") {
|
|
@@ -2451,6 +2459,9 @@ function getStateSyncEvent({ threadId, runId, agentName, nodeName, state, runnin
|
|
|
2451
2459
|
messages: langchainMessagesToCopilotKit(state.messages || [])
|
|
2452
2460
|
};
|
|
2453
2461
|
}
|
|
2462
|
+
if (schemaKeys.output) {
|
|
2463
|
+
state = Object.fromEntries(Object.entries(state).filter(([key]) => schemaKeys.output.includes(key)));
|
|
2464
|
+
}
|
|
2454
2465
|
return JSON.stringify({
|
|
2455
2466
|
event: LangGraphEventTypes.OnCopilotKitStateSync,
|
|
2456
2467
|
thread_id: threadId,
|
|
@@ -2685,6 +2696,25 @@ function copilotkitMessagesToLangChain(messages) {
|
|
|
2685
2696
|
return result;
|
|
2686
2697
|
}
|
|
2687
2698
|
__name(copilotkitMessagesToLangChain, "copilotkitMessagesToLangChain");
|
|
2699
|
+
function getSchemaKeys(graphSchema) {
|
|
2700
|
+
const CONSTANT_KEYS = [
|
|
2701
|
+
"messages",
|
|
2702
|
+
"copilotkit"
|
|
2703
|
+
];
|
|
2704
|
+
const inputSchema = Object.keys(graphSchema.input_schema.properties);
|
|
2705
|
+
const outputSchema = Object.keys(graphSchema.output_schema.properties);
|
|
2706
|
+
return {
|
|
2707
|
+
input: inputSchema && inputSchema.length ? [
|
|
2708
|
+
...inputSchema,
|
|
2709
|
+
...CONSTANT_KEYS
|
|
2710
|
+
] : null,
|
|
2711
|
+
output: outputSchema && outputSchema.length ? [
|
|
2712
|
+
...outputSchema,
|
|
2713
|
+
...CONSTANT_KEYS
|
|
2714
|
+
] : null
|
|
2715
|
+
};
|
|
2716
|
+
}
|
|
2717
|
+
__name(getSchemaKeys, "getSchemaKeys");
|
|
2688
2718
|
|
|
2689
2719
|
// src/lib/runtime/remote-action-constructors.ts
|
|
2690
2720
|
var import_shared11 = require("@copilotkit/shared");
|