@copilotkit/runtime 1.5.18-next.1 → 1.5.18-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 +15 -0
- package/dist/{chunk-2NWLEHMA.mjs → chunk-JTTO2AKP.mjs} +70 -24
- package/dist/chunk-JTTO2AKP.mjs.map +1 -0
- package/dist/{chunk-CJZ7QUXU.mjs → chunk-SHQLPOL4.mjs} +2 -2
- package/dist/{chunk-OS4N57XE.mjs → chunk-THWPPRSF.mjs} +2 -2
- package/dist/{chunk-326WWZNE.mjs → chunk-V2PWHEPG.mjs} +2 -2
- package/dist/index.js +89 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/lib/index.js +89 -43
- 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/copilot-runtime.ts +33 -13
- package/src/lib/runtime/remote-action-constructors.ts +17 -2
- package/src/lib/runtime/remote-actions.ts +5 -1
- package/dist/chunk-2NWLEHMA.mjs.map +0 -1
- /package/dist/{chunk-CJZ7QUXU.mjs.map → chunk-SHQLPOL4.mjs.map} +0 -0
- /package/dist/{chunk-OS4N57XE.mjs.map → chunk-THWPPRSF.mjs.map} +0 -0
- /package/dist/{chunk-326WWZNE.mjs.map → chunk-V2PWHEPG.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.5.18-next.
|
|
12
|
+
"version": "1.5.18-next.3",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.mjs",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"rxjs": "^7.8.1",
|
|
59
59
|
"type-graphql": "2.0.0-rc.1",
|
|
60
60
|
"zod": "^3.23.3",
|
|
61
|
-
"@copilotkit/shared": "1.5.18-next.
|
|
61
|
+
"@copilotkit/shared": "1.5.18-next.3"
|
|
62
62
|
},
|
|
63
63
|
"keywords": [
|
|
64
64
|
"copilotkit",
|
|
@@ -359,9 +359,13 @@ please use an LLM adapter instead.`,
|
|
|
359
359
|
});
|
|
360
360
|
if (!response.ok) {
|
|
361
361
|
if (response.status === 404) {
|
|
362
|
-
throw new CopilotKitApiDiscoveryError();
|
|
362
|
+
throw new CopilotKitApiDiscoveryError({ url: fetchUrl });
|
|
363
363
|
}
|
|
364
|
-
throw new ResolvedCopilotKitError({
|
|
364
|
+
throw new ResolvedCopilotKitError({
|
|
365
|
+
status: response.status,
|
|
366
|
+
url: fetchUrl,
|
|
367
|
+
isRemoteEndpoint: true,
|
|
368
|
+
});
|
|
365
369
|
}
|
|
366
370
|
|
|
367
371
|
const data: InfoResponse = await response.json();
|
|
@@ -434,9 +438,9 @@ please use an LLM adapter instead.`,
|
|
|
434
438
|
agentWithEndpoint.endpoint.type === EndpointType.CopilotKit ||
|
|
435
439
|
!("type" in agentWithEndpoint.endpoint)
|
|
436
440
|
) {
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
{
|
|
441
|
+
const fetchUrl = `${(agentWithEndpoint.endpoint as CopilotKitEndpoint).url}/agents/state`;
|
|
442
|
+
try {
|
|
443
|
+
const response = await fetch(fetchUrl, {
|
|
440
444
|
method: "POST",
|
|
441
445
|
headers,
|
|
442
446
|
body: JSON.stringify({
|
|
@@ -444,15 +448,31 @@ please use an LLM adapter instead.`,
|
|
|
444
448
|
threadId,
|
|
445
449
|
name: agentName,
|
|
446
450
|
}),
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
|
|
451
|
+
});
|
|
452
|
+
if (!response.ok) {
|
|
453
|
+
if (response.status === 404) {
|
|
454
|
+
throw new CopilotKitApiDiscoveryError({ url: fetchUrl });
|
|
455
|
+
}
|
|
456
|
+
throw new ResolvedCopilotKitError({
|
|
457
|
+
status: response.status,
|
|
458
|
+
url: fetchUrl,
|
|
459
|
+
isRemoteEndpoint: true,
|
|
460
|
+
});
|
|
461
|
+
}
|
|
450
462
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
463
|
+
const data: LoadAgentStateResponse = await response.json();
|
|
464
|
+
|
|
465
|
+
return {
|
|
466
|
+
...data,
|
|
467
|
+
state: JSON.stringify(data.state),
|
|
468
|
+
messages: JSON.stringify(data.messages),
|
|
469
|
+
};
|
|
470
|
+
} catch (error) {
|
|
471
|
+
if (error instanceof CopilotKitError) {
|
|
472
|
+
throw error;
|
|
473
|
+
}
|
|
474
|
+
throw new CopilotKitLowLevelError({ error, url: fetchUrl });
|
|
475
|
+
}
|
|
456
476
|
} else {
|
|
457
477
|
throw new Error(`Unknown endpoint type: ${(agentWithEndpoint.endpoint as any).type}`);
|
|
458
478
|
}
|
|
@@ -17,6 +17,7 @@ import { Action } from "@copilotkit/shared";
|
|
|
17
17
|
import { LangGraphEvent } from "../../agents/langgraph/events";
|
|
18
18
|
import { execute } from "./remote-lg-action";
|
|
19
19
|
import { CopilotKitError, CopilotKitLowLevelError } from "@copilotkit/shared";
|
|
20
|
+
import { CopilotKitApiDiscoveryError, ResolvedCopilotKitError } from "@copilotkit/shared";
|
|
20
21
|
|
|
21
22
|
export function constructLGCRemoteAction({
|
|
22
23
|
endpoint,
|
|
@@ -146,7 +147,14 @@ export function constructRemoteActions({
|
|
|
146
147
|
{ url, status: response.status, body: await response.text() },
|
|
147
148
|
"Failed to execute remote action",
|
|
148
149
|
);
|
|
149
|
-
|
|
150
|
+
if (response.status === 404) {
|
|
151
|
+
throw new CopilotKitApiDiscoveryError({ url: fetchUrl });
|
|
152
|
+
}
|
|
153
|
+
throw new ResolvedCopilotKitError({
|
|
154
|
+
status: response.status,
|
|
155
|
+
url: fetchUrl,
|
|
156
|
+
isRemoteEndpoint: true,
|
|
157
|
+
});
|
|
150
158
|
}
|
|
151
159
|
|
|
152
160
|
const requestResult = await response.json();
|
|
@@ -221,7 +229,14 @@ export function constructRemoteActions({
|
|
|
221
229
|
{ url, status: response.status, body: await response.text() },
|
|
222
230
|
"Failed to execute remote agent",
|
|
223
231
|
);
|
|
224
|
-
|
|
232
|
+
if (response.status === 404) {
|
|
233
|
+
throw new CopilotKitApiDiscoveryError({ url: fetchUrl });
|
|
234
|
+
}
|
|
235
|
+
throw new ResolvedCopilotKitError({
|
|
236
|
+
status: response.status,
|
|
237
|
+
url: fetchUrl,
|
|
238
|
+
isRemoteEndpoint: true,
|
|
239
|
+
});
|
|
225
240
|
}
|
|
226
241
|
|
|
227
242
|
const eventSource = new RemoteLangGraphEventSource();
|
|
@@ -103,7 +103,11 @@ async function fetchRemoteInfo({
|
|
|
103
103
|
{ url, status: response.status, body: await response.text() },
|
|
104
104
|
"Failed to fetch actions from url",
|
|
105
105
|
);
|
|
106
|
-
throw new ResolvedCopilotKitError({
|
|
106
|
+
throw new ResolvedCopilotKitError({
|
|
107
|
+
status: response.status,
|
|
108
|
+
url: fetchUrl,
|
|
109
|
+
isRemoteEndpoint: true,
|
|
110
|
+
});
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
const json = await response.json();
|