@copilotkit/runtime 1.5.18-next.1 → 1.5.18-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 +8 -0
- package/dist/{chunk-2NWLEHMA.mjs → chunk-6LFPAZDL.mjs} +70 -24
- package/dist/chunk-6LFPAZDL.mjs.map +1 -0
- package/dist/{chunk-CJZ7QUXU.mjs → chunk-BMKRXGMW.mjs} +2 -2
- package/dist/{chunk-OS4N57XE.mjs → chunk-BNJW4KHS.mjs} +2 -2
- package/dist/{chunk-326WWZNE.mjs → chunk-KZ3RUNSQ.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-BMKRXGMW.mjs.map} +0 -0
- /package/dist/{chunk-OS4N57XE.mjs.map → chunk-BNJW4KHS.mjs.map} +0 -0
- /package/dist/{chunk-326WWZNE.mjs.map → chunk-KZ3RUNSQ.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -39,7 +39,7 @@ var require_package = __commonJS({
|
|
|
39
39
|
publishConfig: {
|
|
40
40
|
access: "public"
|
|
41
41
|
},
|
|
42
|
-
version: "1.5.18-next.
|
|
42
|
+
version: "1.5.18-next.2",
|
|
43
43
|
sideEffects: false,
|
|
44
44
|
main: "./dist/index.js",
|
|
45
45
|
module: "./dist/index.mjs",
|
|
@@ -2191,6 +2191,7 @@ __name(copilotkitMessagesToLangChain, "copilotkitMessagesToLangChain");
|
|
|
2191
2191
|
|
|
2192
2192
|
// src/lib/runtime/remote-action-constructors.ts
|
|
2193
2193
|
import { CopilotKitError, CopilotKitLowLevelError } from "@copilotkit/shared";
|
|
2194
|
+
import { CopilotKitApiDiscoveryError, ResolvedCopilotKitError } from "@copilotkit/shared";
|
|
2194
2195
|
function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, messages, agentStates }) {
|
|
2195
2196
|
const agents = endpoint.agents.map((agent) => ({
|
|
2196
2197
|
name: agent.name,
|
|
@@ -2291,7 +2292,16 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
2291
2292
|
status: response.status,
|
|
2292
2293
|
body: await response.text()
|
|
2293
2294
|
}, "Failed to execute remote action");
|
|
2294
|
-
|
|
2295
|
+
if (response.status === 404) {
|
|
2296
|
+
throw new CopilotKitApiDiscoveryError({
|
|
2297
|
+
url: fetchUrl
|
|
2298
|
+
});
|
|
2299
|
+
}
|
|
2300
|
+
throw new ResolvedCopilotKitError({
|
|
2301
|
+
status: response.status,
|
|
2302
|
+
url: fetchUrl,
|
|
2303
|
+
isRemoteEndpoint: true
|
|
2304
|
+
});
|
|
2295
2305
|
}
|
|
2296
2306
|
const requestResult = await response.json();
|
|
2297
2307
|
const result = requestResult["result"];
|
|
@@ -2364,7 +2374,16 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
2364
2374
|
status: response.status,
|
|
2365
2375
|
body: await response.text()
|
|
2366
2376
|
}, "Failed to execute remote agent");
|
|
2367
|
-
|
|
2377
|
+
if (response.status === 404) {
|
|
2378
|
+
throw new CopilotKitApiDiscoveryError({
|
|
2379
|
+
url: fetchUrl
|
|
2380
|
+
});
|
|
2381
|
+
}
|
|
2382
|
+
throw new ResolvedCopilotKitError({
|
|
2383
|
+
status: response.status,
|
|
2384
|
+
url: fetchUrl,
|
|
2385
|
+
isRemoteEndpoint: true
|
|
2386
|
+
});
|
|
2368
2387
|
}
|
|
2369
2388
|
const eventSource = new RemoteLangGraphEventSource();
|
|
2370
2389
|
streamResponse(response.body, eventSource.eventStream$);
|
|
@@ -2447,7 +2466,7 @@ function createHeaders(onBeforeRequest, graphqlContext) {
|
|
|
2447
2466
|
__name(createHeaders, "createHeaders");
|
|
2448
2467
|
|
|
2449
2468
|
// src/lib/runtime/remote-actions.ts
|
|
2450
|
-
import { CopilotKitLowLevelError as CopilotKitLowLevelError2, ResolvedCopilotKitError, CopilotKitError as CopilotKitError2 } from "@copilotkit/shared";
|
|
2469
|
+
import { CopilotKitLowLevelError as CopilotKitLowLevelError2, ResolvedCopilotKitError as ResolvedCopilotKitError2, CopilotKitError as CopilotKitError2 } from "@copilotkit/shared";
|
|
2451
2470
|
var EndpointType;
|
|
2452
2471
|
(function(EndpointType2) {
|
|
2453
2472
|
EndpointType2["CopilotKit"] = "copilotKit";
|
|
@@ -2481,8 +2500,9 @@ async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: l
|
|
|
2481
2500
|
status: response.status,
|
|
2482
2501
|
body: await response.text()
|
|
2483
2502
|
}, "Failed to fetch actions from url");
|
|
2484
|
-
throw new
|
|
2503
|
+
throw new ResolvedCopilotKitError2({
|
|
2485
2504
|
status: response.status,
|
|
2505
|
+
url: fetchUrl,
|
|
2486
2506
|
isRemoteEndpoint: true
|
|
2487
2507
|
});
|
|
2488
2508
|
}
|
|
@@ -2559,7 +2579,7 @@ __name(setupRemoteActions, "setupRemoteActions");
|
|
|
2559
2579
|
import { createHash as createHash3 } from "crypto";
|
|
2560
2580
|
|
|
2561
2581
|
// src/lib/runtime/copilot-runtime.ts
|
|
2562
|
-
import { actionParametersToJsonSchema, ResolvedCopilotKitError as
|
|
2582
|
+
import { actionParametersToJsonSchema, ResolvedCopilotKitError as ResolvedCopilotKitError3, CopilotKitApiDiscoveryError as CopilotKitApiDiscoveryError2, randomId as randomId2, CopilotKitError as CopilotKitError3, CopilotKitLowLevelError as CopilotKitLowLevelError3, CopilotKitAgentDiscoveryError, CopilotKitMisuseError } from "@copilotkit/shared";
|
|
2563
2583
|
|
|
2564
2584
|
// src/service-adapters/conversion.ts
|
|
2565
2585
|
import { plainToInstance } from "class-transformer";
|
|
@@ -2750,10 +2770,13 @@ please use an LLM adapter instead.`
|
|
|
2750
2770
|
});
|
|
2751
2771
|
if (!response.ok) {
|
|
2752
2772
|
if (response.status === 404) {
|
|
2753
|
-
throw new
|
|
2773
|
+
throw new CopilotKitApiDiscoveryError2({
|
|
2774
|
+
url: fetchUrl
|
|
2775
|
+
});
|
|
2754
2776
|
}
|
|
2755
|
-
throw new
|
|
2777
|
+
throw new ResolvedCopilotKitError3({
|
|
2756
2778
|
status: response.status,
|
|
2779
|
+
url: fetchUrl,
|
|
2757
2780
|
isRemoteEndpoint: true
|
|
2758
2781
|
});
|
|
2759
2782
|
}
|
|
@@ -2821,21 +2844,44 @@ please use an LLM adapter instead.`
|
|
|
2821
2844
|
};
|
|
2822
2845
|
}
|
|
2823
2846
|
} else if (agentWithEndpoint.endpoint.type === EndpointType.CopilotKit || !("type" in agentWithEndpoint.endpoint)) {
|
|
2824
|
-
const
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2847
|
+
const fetchUrl = `${agentWithEndpoint.endpoint.url}/agents/state`;
|
|
2848
|
+
try {
|
|
2849
|
+
const response = await fetch(fetchUrl, {
|
|
2850
|
+
method: "POST",
|
|
2851
|
+
headers,
|
|
2852
|
+
body: JSON.stringify({
|
|
2853
|
+
properties: graphqlContext.properties,
|
|
2854
|
+
threadId,
|
|
2855
|
+
name: agentName
|
|
2856
|
+
})
|
|
2857
|
+
});
|
|
2858
|
+
if (!response.ok) {
|
|
2859
|
+
if (response.status === 404) {
|
|
2860
|
+
throw new CopilotKitApiDiscoveryError2({
|
|
2861
|
+
url: fetchUrl
|
|
2862
|
+
});
|
|
2863
|
+
}
|
|
2864
|
+
throw new ResolvedCopilotKitError3({
|
|
2865
|
+
status: response.status,
|
|
2866
|
+
url: fetchUrl,
|
|
2867
|
+
isRemoteEndpoint: true
|
|
2868
|
+
});
|
|
2869
|
+
}
|
|
2870
|
+
const data = await response.json();
|
|
2871
|
+
return {
|
|
2872
|
+
...data,
|
|
2873
|
+
state: JSON.stringify(data.state),
|
|
2874
|
+
messages: JSON.stringify(data.messages)
|
|
2875
|
+
};
|
|
2876
|
+
} catch (error) {
|
|
2877
|
+
if (error instanceof CopilotKitError3) {
|
|
2878
|
+
throw error;
|
|
2879
|
+
}
|
|
2880
|
+
throw new CopilotKitLowLevelError3({
|
|
2881
|
+
error,
|
|
2882
|
+
url: fetchUrl
|
|
2883
|
+
});
|
|
2884
|
+
}
|
|
2839
2885
|
} else {
|
|
2840
2886
|
throw new Error(`Unknown endpoint type: ${agentWithEndpoint.endpoint.type}`);
|
|
2841
2887
|
}
|
|
@@ -4198,4 +4244,4 @@ export {
|
|
|
4198
4244
|
getCommonConfig,
|
|
4199
4245
|
copilotRuntimeNodeHttpEndpoint
|
|
4200
4246
|
};
|
|
4201
|
-
//# sourceMappingURL=chunk-
|
|
4247
|
+
//# sourceMappingURL=chunk-6LFPAZDL.mjs.map
|