@copilotkit/runtime 1.8.2-next.0 → 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.
- package/CHANGELOG.md +14 -0
- package/dist/{chunk-UGVXD6KK.mjs → chunk-2VYBYZPK.mjs} +2 -2
- package/dist/{chunk-QZFOLVUA.mjs → chunk-H5AAJZIT.mjs} +32 -15
- package/dist/chunk-H5AAJZIT.mjs.map +1 -0
- package/dist/{chunk-TNMBPY25.mjs → chunk-NLQY44UU.mjs} +2 -2
- package/dist/{chunk-QAPB44C7.mjs → chunk-TD5ENJ33.mjs} +2 -2
- package/dist/index.js +22 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/lib/index.js +22 -5
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +6 -6
- package/dist/lib/integrations/index.js +1 -1
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +6 -6
- 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 +4 -4
- 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 +4 -4
- 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 +3 -3
- package/package.json +4 -4
- package/src/lib/runtime/copilot-runtime.ts +16 -4
- package/src/lib/runtime/remote-lg-action.ts +9 -5
- package/dist/chunk-QZFOLVUA.mjs.map +0 -1
- /package/dist/{chunk-UGVXD6KK.mjs.map → chunk-2VYBYZPK.mjs.map} +0 -0
- /package/dist/{chunk-TNMBPY25.mjs.map → chunk-NLQY44UU.mjs.map} +0 -0
- /package/dist/{chunk-QAPB44C7.mjs.map → chunk-TD5ENJ33.mjs.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
copilotRuntimeNodeHttpEndpoint
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-RTFJTJMA.mjs";
|
|
5
|
-
import "../../../chunk-2OZAGFV3.mjs";
|
|
3
|
+
} from "../../../chunk-H5AAJZIT.mjs";
|
|
6
4
|
import "../../../chunk-FZJAYGIR.mjs";
|
|
7
5
|
import "../../../chunk-5BIEM2UU.mjs";
|
|
6
|
+
import "../../../chunk-RTFJTJMA.mjs";
|
|
7
|
+
import "../../../chunk-2OZAGFV3.mjs";
|
|
8
8
|
import "../../../chunk-FHD4JECV.mjs";
|
|
9
9
|
export {
|
|
10
10
|
copilotRuntimeNodeHttpEndpoint
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.8.2-next.
|
|
12
|
+
"version": "1.8.2-next.2",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.mjs",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"tsup": "^6.7.0",
|
|
33
33
|
"typescript": "^5.2.3",
|
|
34
34
|
"zod-to-json-schema": "^3.23.5",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
35
|
+
"eslint-config-custom": "1.4.6",
|
|
36
|
+
"tsconfig": "1.4.6"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@anthropic-ai/sdk": "^0.27.3",
|
|
@@ -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.
|
|
62
|
+
"@copilotkit/shared": "1.8.2-next.2"
|
|
63
63
|
},
|
|
64
64
|
"keywords": [
|
|
65
65
|
"copilotkit",
|
|
@@ -493,11 +493,23 @@ please use an LLM adapter instead.`,
|
|
|
493
493
|
apiKey: endpoint.langsmithApiKey,
|
|
494
494
|
defaultHeaders: { ...propertyHeaders },
|
|
495
495
|
});
|
|
496
|
+
let data: Array<{ assistant_id: string; graph_id: string }> | { detail: string } = [];
|
|
497
|
+
try {
|
|
498
|
+
data = await client.assistants.search();
|
|
496
499
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
500
|
+
if (data && "detail" in data && (data.detail as string).toLowerCase() === "not found") {
|
|
501
|
+
throw new CopilotKitAgentDiscoveryError();
|
|
502
|
+
}
|
|
503
|
+
} catch (e) {
|
|
504
|
+
throw new CopilotKitMisuseError({
|
|
505
|
+
message: `
|
|
506
|
+
Failed to find or contact remote endpoint at url ${endpoint.deploymentUrl}.
|
|
507
|
+
Make sure the API is running and that it's indeed a LangGraph platform url.
|
|
508
|
+
|
|
509
|
+
See more: https://docs.copilotkit.ai/troubleshooting/common-issues`,
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
const endpointAgents = data.map((entry) => ({
|
|
501
513
|
name: entry.graph_id,
|
|
502
514
|
id: entry.assistant_id,
|
|
503
515
|
description: "",
|
|
@@ -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
|
|
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:
|
|
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
|
|
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
|
|