@copilotkit/runtime 1.5.12-next.5 → 1.5.12-next.6
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 +10 -0
- package/dist/{chunk-QDMAQO2C.mjs → chunk-BKIGYRXE.mjs} +2 -2
- package/dist/{chunk-MFDRA3BJ.mjs → chunk-ON4AESON.mjs} +125 -77
- package/dist/chunk-ON4AESON.mjs.map +1 -0
- package/dist/{chunk-NORCONUM.mjs → chunk-XM2VJFL6.mjs} +2 -2
- package/dist/{chunk-XRW7ZSWJ.mjs → chunk-YGXAWYRB.mjs} +2 -2
- package/dist/{copilot-runtime-1a224a0f.d.ts → copilot-runtime-da917bd5.d.ts} +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +136 -88
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +136 -88
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +4 -4
- package/dist/lib/integrations/index.d.ts +2 -2
- package/dist/lib/integrations/index.js +12 -10
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +4 -4
- package/dist/lib/integrations/nest/index.d.ts +1 -1
- package/dist/lib/integrations/nest/index.js +12 -10
- 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.d.ts +1 -1
- package/dist/lib/integrations/node-express/index.js +12 -10
- 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.d.ts +1 -1
- package/dist/lib/integrations/node-http/index.js +12 -10
- 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 +61 -27
- package/src/lib/runtime/remote-action-constructors.ts +42 -33
- package/src/lib/runtime/remote-actions.ts +12 -7
- package/dist/chunk-MFDRA3BJ.mjs.map +0 -1
- /package/dist/{chunk-QDMAQO2C.mjs.map → chunk-BKIGYRXE.mjs.map} +0 -0
- /package/dist/{chunk-NORCONUM.mjs.map → chunk-XM2VJFL6.mjs.map} +0 -0
- /package/dist/{chunk-XRW7ZSWJ.mjs.map → chunk-YGXAWYRB.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-BKIGYRXE.mjs";
|
|
7
7
|
import {
|
|
8
8
|
copilotRuntimeNestEndpoint
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YGXAWYRB.mjs";
|
|
10
10
|
import {
|
|
11
11
|
copilotRuntimeNodeExpressEndpoint
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XM2VJFL6.mjs";
|
|
13
13
|
import {
|
|
14
14
|
CopilotRuntime,
|
|
15
15
|
buildSchema,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
getCommonConfig,
|
|
21
21
|
langGraphPlatformEndpoint,
|
|
22
22
|
resolveEndpointType
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ON4AESON.mjs";
|
|
24
24
|
import {
|
|
25
25
|
AnthropicAdapter,
|
|
26
26
|
EmptyAdapter,
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { h as CommonConfig, b as CopilotRequestContextProperties, a as CopilotRuntime, C as CopilotRuntimeConstructorParams, d as CreateCopilotRuntimeServerOptions, G as GraphQLContext, g as buildSchema, c as copilotKitEndpoint, e as createContext, f as flattenToolCallsNoDuplicates, i as getCommonConfig, l as langGraphPlatformEndpoint, r as resolveEndpointType } from '../copilot-runtime-
|
|
1
|
+
export { h as CommonConfig, b as CopilotRequestContextProperties, a as CopilotRuntime, C as CopilotRuntimeConstructorParams, d as CreateCopilotRuntimeServerOptions, G as GraphQLContext, g as buildSchema, c as copilotKitEndpoint, e as createContext, f as flattenToolCallsNoDuplicates, i as getCommonConfig, l as langGraphPlatformEndpoint, r as resolveEndpointType } from '../copilot-runtime-da917bd5.js';
|
|
2
2
|
export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from '../groq-adapter-c35c5374.js';
|
|
3
3
|
export { CopilotRuntimeServerInstance, config, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint } from './integrations/index.js';
|
|
4
4
|
export { copilotRuntimeNodeHttpEndpoint } from './integrations/node-http/index.js';
|
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.5.12-next.
|
|
47
|
+
version: "1.5.12-next.6",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -148,7 +148,8 @@ __export(lib_exports, {
|
|
|
148
148
|
module.exports = __toCommonJS(lib_exports);
|
|
149
149
|
|
|
150
150
|
// src/lib/runtime/copilot-runtime.ts
|
|
151
|
-
var
|
|
151
|
+
var import_shared12 = require("@copilotkit/shared");
|
|
152
|
+
var import_langgraph_sdk2 = require("@langchain/langgraph-sdk");
|
|
152
153
|
|
|
153
154
|
// src/service-adapters/langchain/langserve.ts
|
|
154
155
|
var import_remote = require("langchain/runnables/remote");
|
|
@@ -1215,11 +1216,11 @@ var EmptyAdapter = class {
|
|
|
1215
1216
|
__name(EmptyAdapter, "EmptyAdapter");
|
|
1216
1217
|
|
|
1217
1218
|
// src/service-adapters/events.ts
|
|
1218
|
-
var
|
|
1219
|
+
var import_shared11 = require("@copilotkit/shared");
|
|
1219
1220
|
var import_rxjs2 = require("rxjs");
|
|
1220
1221
|
|
|
1221
1222
|
// src/lib/telemetry-client.ts
|
|
1222
|
-
var
|
|
1223
|
+
var import_shared10 = require("@copilotkit/shared");
|
|
1223
1224
|
|
|
1224
1225
|
// src/lib/runtime/remote-action-constructors.ts
|
|
1225
1226
|
var import_node_crypto2 = require("crypto");
|
|
@@ -1969,6 +1970,7 @@ function copilotkitMessagesToLangChain(messages) {
|
|
|
1969
1970
|
__name(copilotkitMessagesToLangChain, "copilotkitMessagesToLangChain");
|
|
1970
1971
|
|
|
1971
1972
|
// src/lib/runtime/remote-action-constructors.ts
|
|
1973
|
+
var import_shared8 = require("@copilotkit/shared");
|
|
1972
1974
|
function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, messages, agentStates }) {
|
|
1973
1975
|
const agents = endpoint.agents.map((agent) => ({
|
|
1974
1976
|
name: agent.name,
|
|
@@ -2049,8 +2051,9 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
2049
2051
|
type: "self-hosted",
|
|
2050
2052
|
agentsAmount: totalAgents
|
|
2051
2053
|
});
|
|
2054
|
+
const fetchUrl = `${url}/actions/execute`;
|
|
2052
2055
|
try {
|
|
2053
|
-
const response = await fetch(
|
|
2056
|
+
const response = await fetch(fetchUrl, {
|
|
2054
2057
|
method: "POST",
|
|
2055
2058
|
headers,
|
|
2056
2059
|
body: JSON.stringify({
|
|
@@ -2075,10 +2078,13 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
2075
2078
|
}, "Executed remote action");
|
|
2076
2079
|
return result;
|
|
2077
2080
|
} catch (error) {
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
}
|
|
2081
|
-
|
|
2081
|
+
if (error instanceof import_shared8.CopilotKitError) {
|
|
2082
|
+
throw error;
|
|
2083
|
+
}
|
|
2084
|
+
throw new import_shared8.CopilotKitLowLevelError({
|
|
2085
|
+
error,
|
|
2086
|
+
url: fetchUrl
|
|
2087
|
+
});
|
|
2082
2088
|
}
|
|
2083
2089
|
}
|
|
2084
2090
|
}));
|
|
@@ -2106,37 +2112,48 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
2106
2112
|
state = JSON.parse(jsonState);
|
|
2107
2113
|
}
|
|
2108
2114
|
}
|
|
2109
|
-
const
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2115
|
+
const fetchUrl = `${url}/agents/execute`;
|
|
2116
|
+
try {
|
|
2117
|
+
const response = await fetch(fetchUrl, {
|
|
2118
|
+
method: "POST",
|
|
2119
|
+
headers,
|
|
2120
|
+
body: JSON.stringify({
|
|
2121
|
+
name,
|
|
2122
|
+
threadId,
|
|
2123
|
+
nodeName,
|
|
2124
|
+
messages: [
|
|
2125
|
+
...messages,
|
|
2126
|
+
...additionalMessages
|
|
2127
|
+
],
|
|
2128
|
+
state,
|
|
2129
|
+
properties: graphqlContext.properties,
|
|
2130
|
+
actions: actionInputsWithoutAgents.map((action) => ({
|
|
2131
|
+
name: action.name,
|
|
2132
|
+
description: action.description,
|
|
2133
|
+
parameters: JSON.parse(action.jsonSchema)
|
|
2134
|
+
}))
|
|
2135
|
+
})
|
|
2136
|
+
});
|
|
2137
|
+
if (!response.ok) {
|
|
2138
|
+
logger2.error({
|
|
2139
|
+
url,
|
|
2140
|
+
status: response.status,
|
|
2141
|
+
body: await response.text()
|
|
2142
|
+
}, "Failed to execute remote agent");
|
|
2143
|
+
throw new Error("Failed to execute remote agent");
|
|
2144
|
+
}
|
|
2145
|
+
const eventSource = new RemoteLangGraphEventSource();
|
|
2146
|
+
streamResponse(response.body, eventSource.eventStream$);
|
|
2147
|
+
return eventSource.processLangGraphEvents();
|
|
2148
|
+
} catch (error) {
|
|
2149
|
+
if (error instanceof import_shared8.CopilotKitError) {
|
|
2150
|
+
throw error;
|
|
2151
|
+
}
|
|
2152
|
+
throw new import_shared8.CopilotKitLowLevelError({
|
|
2153
|
+
error,
|
|
2154
|
+
url: fetchUrl
|
|
2155
|
+
});
|
|
2136
2156
|
}
|
|
2137
|
-
const eventSource = new RemoteLangGraphEventSource();
|
|
2138
|
-
streamResponse(response.body, eventSource.eventStream$);
|
|
2139
|
-
return eventSource.processLangGraphEvents();
|
|
2140
2157
|
}
|
|
2141
2158
|
})) : [];
|
|
2142
2159
|
return [
|
|
@@ -2206,6 +2223,7 @@ function createHeaders(onBeforeRequest, graphqlContext) {
|
|
|
2206
2223
|
__name(createHeaders, "createHeaders");
|
|
2207
2224
|
|
|
2208
2225
|
// src/lib/runtime/remote-actions.ts
|
|
2226
|
+
var import_shared9 = require("@copilotkit/shared");
|
|
2209
2227
|
var EndpointType;
|
|
2210
2228
|
(function(EndpointType2) {
|
|
2211
2229
|
EndpointType2["CopilotKit"] = "copilotKit";
|
|
@@ -2223,8 +2241,9 @@ async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: l
|
|
|
2223
2241
|
url
|
|
2224
2242
|
}, "Fetching actions from url");
|
|
2225
2243
|
const headers = createHeaders(onBeforeRequest, graphqlContext);
|
|
2244
|
+
const fetchUrl = `${url}/info`;
|
|
2226
2245
|
try {
|
|
2227
|
-
const response = await fetch(
|
|
2246
|
+
const response = await fetch(fetchUrl, {
|
|
2228
2247
|
method: "POST",
|
|
2229
2248
|
headers,
|
|
2230
2249
|
body: JSON.stringify({
|
|
@@ -2238,10 +2257,10 @@ async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: l
|
|
|
2238
2257
|
status: response.status,
|
|
2239
2258
|
body: await response.text()
|
|
2240
2259
|
}, "Failed to fetch actions from url");
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
};
|
|
2260
|
+
throw new import_shared9.ResolvedCopilotKitError({
|
|
2261
|
+
status: response.status,
|
|
2262
|
+
isRemoteEndpoint: true
|
|
2263
|
+
});
|
|
2245
2264
|
}
|
|
2246
2265
|
const json = await response.json();
|
|
2247
2266
|
logger2.debug({
|
|
@@ -2249,13 +2268,13 @@ async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: l
|
|
|
2249
2268
|
}, "Fetched actions from url");
|
|
2250
2269
|
return json;
|
|
2251
2270
|
} catch (error) {
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
}
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
};
|
|
2271
|
+
if (error instanceof import_shared9.CopilotKitError) {
|
|
2272
|
+
throw error;
|
|
2273
|
+
}
|
|
2274
|
+
throw new import_shared9.CopilotKitLowLevelError({
|
|
2275
|
+
error,
|
|
2276
|
+
url: fetchUrl
|
|
2277
|
+
});
|
|
2259
2278
|
}
|
|
2260
2279
|
}
|
|
2261
2280
|
__name(fetchRemoteInfo, "fetchRemoteInfo");
|
|
@@ -2315,7 +2334,7 @@ __name(setupRemoteActions, "setupRemoteActions");
|
|
|
2315
2334
|
// src/lib/telemetry-client.ts
|
|
2316
2335
|
var import_node_crypto3 = require("crypto");
|
|
2317
2336
|
var packageJson = require_package();
|
|
2318
|
-
var telemetryClient = new
|
|
2337
|
+
var telemetryClient = new import_shared10.TelemetryClient({
|
|
2319
2338
|
packageName: packageJson.name,
|
|
2320
2339
|
packageVersion: packageJson.version
|
|
2321
2340
|
});
|
|
@@ -2625,10 +2644,10 @@ var RuntimeEventSource = class {
|
|
|
2625
2644
|
const errorMessage = `\u274C ${message}`;
|
|
2626
2645
|
if (!this.callback) {
|
|
2627
2646
|
this.stream(async (eventStream$) => {
|
|
2628
|
-
eventStream$.sendTextMessage((0,
|
|
2647
|
+
eventStream$.sendTextMessage((0, import_shared11.randomId)(), errorMessage);
|
|
2629
2648
|
});
|
|
2630
2649
|
} else {
|
|
2631
|
-
this.eventStream$.sendTextMessage((0,
|
|
2650
|
+
this.eventStream$.sendTextMessage((0, import_shared11.randomId)(), errorMessage);
|
|
2632
2651
|
}
|
|
2633
2652
|
}
|
|
2634
2653
|
processRuntimeEvents({ serverSideActions, guardrailsResult$, actionInputsWithoutAgents }) {
|
|
@@ -2860,9 +2879,11 @@ var CopilotRuntime = class {
|
|
|
2860
2879
|
return await this.processAgentRequest(request);
|
|
2861
2880
|
}
|
|
2862
2881
|
if (serviceAdapter instanceof EmptyAdapter) {
|
|
2863
|
-
throw new
|
|
2882
|
+
throw new import_shared12.CopilotKitMisuseError({
|
|
2883
|
+
message: `Invalid adapter configuration: EmptyAdapter is only meant to be used with agent lock mode.
|
|
2864
2884
|
For non-agent components like useCopilotChatSuggestions, CopilotTextarea, or CopilotTask,
|
|
2865
|
-
please use an LLM adapter instead.`
|
|
2885
|
+
please use an LLM adapter instead.`
|
|
2886
|
+
});
|
|
2866
2887
|
}
|
|
2867
2888
|
const messages = rawMessages.filter((message) => !message.agentStateMessage);
|
|
2868
2889
|
const inputMessages = convertGqlInputToMessages(messages);
|
|
@@ -2870,7 +2891,7 @@ please use an LLM adapter instead.`);
|
|
|
2870
2891
|
const serverSideActionsInput = serverSideActions.map((action) => ({
|
|
2871
2892
|
name: action.name,
|
|
2872
2893
|
description: action.description,
|
|
2873
|
-
jsonSchema: JSON.stringify((0,
|
|
2894
|
+
jsonSchema: JSON.stringify((0, import_shared12.actionParametersToJsonSchema)(action.parameters))
|
|
2874
2895
|
}));
|
|
2875
2896
|
const actionInputs = flattenToolCallsNoDuplicates([
|
|
2876
2897
|
...serverSideActionsInput,
|
|
@@ -2917,6 +2938,9 @@ please use an LLM adapter instead.`);
|
|
|
2917
2938
|
))
|
|
2918
2939
|
};
|
|
2919
2940
|
} catch (error) {
|
|
2941
|
+
if (error instanceof import_shared12.CopilotKitError) {
|
|
2942
|
+
throw error;
|
|
2943
|
+
}
|
|
2920
2944
|
console.error("Error getting response:", error);
|
|
2921
2945
|
eventSource.sendErrorMessageToChat();
|
|
2922
2946
|
throw error;
|
|
@@ -2927,37 +2951,59 @@ please use an LLM adapter instead.`);
|
|
|
2927
2951
|
const agents = this.remoteEndpointDefinitions.reduce(async (acc, endpoint) => {
|
|
2928
2952
|
const agents2 = await acc;
|
|
2929
2953
|
if (endpoint.type === EndpointType.LangGraphPlatform) {
|
|
2930
|
-
const
|
|
2931
|
-
|
|
2932
|
-
|
|
2954
|
+
const client = new import_langgraph_sdk2.Client({
|
|
2955
|
+
apiUrl: endpoint.deploymentUrl,
|
|
2956
|
+
apiKey: endpoint.langsmithApiKey
|
|
2933
2957
|
});
|
|
2934
|
-
const
|
|
2935
|
-
const
|
|
2958
|
+
const data = await client.assistants.search();
|
|
2959
|
+
const endpointAgents = (data ?? []).map((entry) => ({
|
|
2936
2960
|
name: entry.graph_id,
|
|
2937
|
-
id: entry.assistant_id
|
|
2961
|
+
id: entry.assistant_id,
|
|
2962
|
+
description: "",
|
|
2963
|
+
endpoint
|
|
2938
2964
|
}));
|
|
2939
2965
|
return [
|
|
2940
2966
|
...agents2,
|
|
2941
|
-
...
|
|
2967
|
+
...endpointAgents
|
|
2942
2968
|
];
|
|
2943
2969
|
}
|
|
2944
|
-
const
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2970
|
+
const fetchUrl = `${endpoint.url}/info`;
|
|
2971
|
+
try {
|
|
2972
|
+
const response = await fetch(fetchUrl, {
|
|
2973
|
+
method: "POST",
|
|
2974
|
+
headers,
|
|
2975
|
+
body: JSON.stringify({
|
|
2976
|
+
properties: graphqlContext.properties
|
|
2977
|
+
})
|
|
2978
|
+
});
|
|
2979
|
+
if (!response.ok) {
|
|
2980
|
+
if (response.status === 404) {
|
|
2981
|
+
throw new import_shared12.CopilotKitApiDiscoveryError();
|
|
2982
|
+
}
|
|
2983
|
+
throw new import_shared12.ResolvedCopilotKitError({
|
|
2984
|
+
status: response.status,
|
|
2985
|
+
isRemoteEndpoint: true
|
|
2986
|
+
});
|
|
2987
|
+
}
|
|
2988
|
+
const data = await response.json();
|
|
2989
|
+
const endpointAgents = ((data == null ? void 0 : data.agents) ?? []).map((agent) => ({
|
|
2990
|
+
name: agent.name,
|
|
2991
|
+
description: agent.description ?? "",
|
|
2992
|
+
id: (0, import_shared12.randomId)()
|
|
2993
|
+
}));
|
|
2994
|
+
return [
|
|
2995
|
+
...agents2,
|
|
2996
|
+
...endpointAgents
|
|
2997
|
+
];
|
|
2998
|
+
} catch (error) {
|
|
2999
|
+
if (error instanceof import_shared12.CopilotKitError) {
|
|
3000
|
+
throw error;
|
|
3001
|
+
}
|
|
3002
|
+
throw new import_shared12.CopilotKitLowLevelError({
|
|
3003
|
+
error,
|
|
3004
|
+
url: fetchUrl
|
|
3005
|
+
});
|
|
3006
|
+
}
|
|
2961
3007
|
}, Promise.resolve([]));
|
|
2962
3008
|
return agents;
|
|
2963
3009
|
}
|
|
@@ -2969,12 +3015,14 @@ please use an LLM adapter instead.`);
|
|
|
2969
3015
|
const messages = convertGqlInputToMessages(rawMessages);
|
|
2970
3016
|
const agent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
|
|
2971
3017
|
if (!agent) {
|
|
2972
|
-
throw new
|
|
3018
|
+
throw new import_shared12.CopilotKitAgentDiscoveryError({
|
|
3019
|
+
agentName
|
|
3020
|
+
});
|
|
2973
3021
|
}
|
|
2974
3022
|
const serverSideActionsInput = serverSideActions.filter((action) => !isLangGraphAgentAction(action)).map((action) => ({
|
|
2975
3023
|
name: action.name,
|
|
2976
3024
|
description: action.description,
|
|
2977
|
-
jsonSchema: JSON.stringify((0,
|
|
3025
|
+
jsonSchema: JSON.stringify((0, import_shared12.actionParametersToJsonSchema)(action.parameters))
|
|
2978
3026
|
}));
|
|
2979
3027
|
const actionInputsWithoutAgents = flattenToolCallsNoDuplicates([
|
|
2980
3028
|
...serverSideActionsInput,
|
|
@@ -4168,7 +4216,7 @@ var UnknownErrorResponse = class extends FailedResponseStatus {
|
|
|
4168
4216
|
__name(UnknownErrorResponse, "UnknownErrorResponse");
|
|
4169
4217
|
|
|
4170
4218
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
4171
|
-
var
|
|
4219
|
+
var import_shared13 = require("@copilotkit/shared");
|
|
4172
4220
|
|
|
4173
4221
|
// src/graphql/types/agents-response.type.ts
|
|
4174
4222
|
var import_type_graphql15 = require("type-graphql");
|
|
@@ -4351,7 +4399,7 @@ var CopilotResolver = class {
|
|
|
4351
4399
|
rejectOutputMessagesPromise = reject;
|
|
4352
4400
|
});
|
|
4353
4401
|
logger2.debug("Processing");
|
|
4354
|
-
const { eventSource, threadId = (0,
|
|
4402
|
+
const { eventSource, threadId = (0, import_shared13.randomId)(), runId, serverSideActions, actionInputsWithoutAgents } = await copilotRuntime.processRuntimeRequest({
|
|
4355
4403
|
serviceAdapter,
|
|
4356
4404
|
messages: data.messages,
|
|
4357
4405
|
actions: data.frontend.actions.filter((action) => action.available !== ActionInputAvailability.disabled),
|
|
@@ -4396,7 +4444,7 @@ var CopilotResolver = class {
|
|
|
4396
4444
|
});
|
|
4397
4445
|
outputMessages = [
|
|
4398
4446
|
(0, import_class_transformer3.plainToInstance)(TextMessage, {
|
|
4399
|
-
id: (0,
|
|
4447
|
+
id: (0, import_shared13.randomId)(),
|
|
4400
4448
|
createdAt: /* @__PURE__ */ new Date(),
|
|
4401
4449
|
content: result.reason,
|
|
4402
4450
|
role: MessageRole.assistant
|
|
@@ -4587,7 +4635,7 @@ var CopilotResolver = class {
|
|
|
4587
4635
|
event
|
|
4588
4636
|
}, "Agent message event received");
|
|
4589
4637
|
pushMessage({
|
|
4590
|
-
id: (0,
|
|
4638
|
+
id: (0, import_shared13.randomId)(),
|
|
4591
4639
|
status: new SuccessMessageStatus(),
|
|
4592
4640
|
threadId: event.threadId,
|
|
4593
4641
|
agentName: event.agentName,
|
|
@@ -4600,7 +4648,7 @@ var CopilotResolver = class {
|
|
|
4600
4648
|
createdAt: /* @__PURE__ */ new Date()
|
|
4601
4649
|
});
|
|
4602
4650
|
outputMessages.push((0, import_class_transformer3.plainToInstance)(AgentStateMessage, {
|
|
4603
|
-
id: (0,
|
|
4651
|
+
id: (0, import_shared13.randomId)(),
|
|
4604
4652
|
threadId: event.threadId,
|
|
4605
4653
|
agentName: event.agentName,
|
|
4606
4654
|
nodeName: event.nodeName,
|