@copilotkit/runtime 1.1.2 → 1.1.3-feat-runtime-remote-actions.0
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/README.md +32 -37
- package/__snapshots__/schema/schema.graphql +42 -0
- package/dist/chunk-4WFNRUBE.mjs +260 -0
- package/dist/chunk-4WFNRUBE.mjs.map +1 -0
- package/dist/{chunk-MKV3LEJ6.mjs → chunk-6X5MPWIC.mjs} +795 -159
- package/dist/chunk-6X5MPWIC.mjs.map +1 -0
- package/dist/{chunk-URMISMK2.mjs → chunk-73NMP3DI.mjs} +2 -2
- package/dist/{chunk-CUVWSISN.mjs → chunk-BJ2LVHWA.mjs} +22 -4
- package/dist/chunk-BJ2LVHWA.mjs.map +1 -0
- package/dist/{chunk-74B76SMO.mjs → chunk-HYNSUFUM.mjs} +2 -2
- package/dist/{chunk-6PAC74F2.mjs → chunk-JV3CSVW6.mjs} +2 -2
- package/dist/{chunk-NPCP4YZB.mjs → chunk-OYUVLDJF.mjs} +2 -2
- package/dist/{chunk-GEIBJJQ4.mjs → chunk-TBZGOJJX.mjs} +14 -2
- package/dist/chunk-TBZGOJJX.mjs.map +1 -0
- package/dist/{shared-ec6c7db5.d.ts → copilot-runtime-d427e991.d.ts} +68 -37
- package/dist/graphql/types/converted/index.d.ts +1 -1
- package/dist/graphql/types/converted/index.js +13 -0
- package/dist/graphql/types/converted/index.js.map +1 -1
- package/dist/graphql/types/converted/index.mjs +3 -1
- package/dist/{index-aa091e3c.d.ts → index-0476e4f7.d.ts} +24 -2
- package/dist/{groq-adapter-675b30c6.d.ts → index-079752b9.d.ts} +31 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +1012 -246
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/{langserve-a54438c6.d.ts → langserve-d6073a3b.d.ts} +24 -11
- package/dist/lib/index.d.ts +8 -8
- package/dist/lib/index.js +1012 -246
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +8 -8
- package/dist/lib/integrations/index.d.ts +26 -7
- package/dist/lib/integrations/index.js +446 -183
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +6 -6
- package/dist/lib/integrations/nest/index.d.ts +5 -5
- package/dist/lib/integrations/nest/index.js +446 -183
- 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.d.ts +5 -5
- package/dist/lib/integrations/node-express/index.js +446 -183
- 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.d.ts +5 -5
- package/dist/lib/integrations/node-http/index.js +446 -183
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +3 -3
- package/dist/service-adapters/index.d.ts +3 -3
- package/dist/service-adapters/index.js +19 -1
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +3 -3
- package/dist/utils/index.d.ts +49 -1
- package/package.json +7 -5
- package/src/agents/langgraph/event-source.ts +222 -0
- package/src/agents/langgraph/events.ts +309 -0
- package/src/graphql/inputs/agent-session.input.ts +13 -0
- package/src/graphql/inputs/agent-state.input.ts +10 -0
- package/src/graphql/inputs/frontend.input.ts +3 -0
- package/src/graphql/inputs/generate-copilot-response.input.ts +11 -0
- package/src/graphql/inputs/message.input.ts +30 -0
- package/src/graphql/resolvers/copilot.resolver.ts +57 -12
- package/src/graphql/types/converted/index.ts +15 -0
- package/src/graphql/types/copilot-response.type.ts +29 -0
- package/src/graphql/types/enums.ts +1 -0
- package/src/lib/index.ts +1 -1
- package/src/lib/integrations/shared.ts +1 -1
- package/src/lib/runtime/copilot-runtime.ts +360 -0
- package/src/lib/runtime/remote-actions.ts +241 -0
- package/src/service-adapters/conversion.ts +16 -0
- package/src/service-adapters/events.ts +101 -19
- package/src/service-adapters/groq/groq-adapter.ts +13 -0
- package/src/service-adapters/openai/openai-adapter.ts +13 -0
- package/src/service-adapters/openai/openai-assistant-adapter.ts +14 -0
- package/dist/chunk-CUVWSISN.mjs.map +0 -1
- package/dist/chunk-GEIBJJQ4.mjs.map +0 -1
- package/dist/chunk-MKV3LEJ6.mjs.map +0 -1
- package/dist/chunk-RDEOIOQR.mjs +0 -155
- package/dist/chunk-RDEOIOQR.mjs.map +0 -1
- package/dist/failed-response-status-reasons-0ab19e06.d.ts +0 -49
- package/dist/pages-router-df82c666.d.ts +0 -21
- package/src/lib/copilot-runtime.ts +0 -225
- /package/dist/{chunk-URMISMK2.mjs.map → chunk-73NMP3DI.mjs.map} +0 -0
- /package/dist/{chunk-74B76SMO.mjs.map → chunk-HYNSUFUM.mjs.map} +0 -0
- /package/dist/{chunk-6PAC74F2.mjs.map → chunk-JV3CSVW6.mjs.map} +0 -0
- /package/dist/{chunk-NPCP4YZB.mjs.map → chunk-OYUVLDJF.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -12,11 +12,11 @@ var __export = (target, all) => {
|
|
|
12
12
|
for (var name in all)
|
|
13
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
14
|
};
|
|
15
|
-
var __copyProps = (to,
|
|
16
|
-
if (
|
|
17
|
-
for (let key of __getOwnPropNames(
|
|
15
|
+
var __copyProps = (to, from3, except, desc) => {
|
|
16
|
+
if (from3 && typeof from3 === "object" || typeof from3 === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from3))
|
|
18
18
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () =>
|
|
19
|
+
__defProp(to, key, { get: () => from3[key], enumerable: !(desc = __getOwnPropDesc(from3, key)) || desc.enumerable });
|
|
20
20
|
}
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
@@ -44,7 +44,7 @@ var require_package = __commonJS({
|
|
|
44
44
|
publishConfig: {
|
|
45
45
|
access: "public"
|
|
46
46
|
},
|
|
47
|
-
version: "1.1.
|
|
47
|
+
version: "1.1.3-feat-runtime-remote-actions.0",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -59,7 +59,9 @@ var require_package = __commonJS({
|
|
|
59
59
|
test: "jest --passWithNoTests",
|
|
60
60
|
"check-types": "tsc --noEmit",
|
|
61
61
|
clean: "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next && rm -rf __snapshots__",
|
|
62
|
-
"generate-graphql-schema": "rm -rf __snapshots__ && ts-node ./scripts/generate-gql-schema.ts"
|
|
62
|
+
"generate-graphql-schema": "rm -rf __snapshots__ && ts-node ./scripts/generate-gql-schema.ts",
|
|
63
|
+
"link:global": "pnpm link --global",
|
|
64
|
+
"unlink:global": "pnpm unlink --global"
|
|
63
65
|
},
|
|
64
66
|
devDependencies: {
|
|
65
67
|
"@swc/core": "1.5.28",
|
|
@@ -142,8 +144,8 @@ __export(src_exports, {
|
|
|
142
144
|
module.exports = __toCommonJS(src_exports);
|
|
143
145
|
var import_reflect_metadata = require("reflect-metadata");
|
|
144
146
|
|
|
145
|
-
// src/lib/copilot-runtime.ts
|
|
146
|
-
var
|
|
147
|
+
// src/lib/runtime/copilot-runtime.ts
|
|
148
|
+
var import_shared8 = require("@copilotkit/shared");
|
|
147
149
|
|
|
148
150
|
// src/service-adapters/openai/openai-adapter.ts
|
|
149
151
|
var import_openai = __toESM(require("openai"));
|
|
@@ -201,6 +203,17 @@ var ResultMessage = class extends BaseMessage {
|
|
|
201
203
|
result;
|
|
202
204
|
};
|
|
203
205
|
__name(ResultMessage, "ResultMessage");
|
|
206
|
+
var AgentStateMessage = class extends BaseMessage {
|
|
207
|
+
threadId;
|
|
208
|
+
agentName;
|
|
209
|
+
nodeName;
|
|
210
|
+
runId;
|
|
211
|
+
active;
|
|
212
|
+
role;
|
|
213
|
+
state;
|
|
214
|
+
running;
|
|
215
|
+
};
|
|
216
|
+
__name(AgentStateMessage, "AgentStateMessage");
|
|
204
217
|
|
|
205
218
|
// src/service-adapters/openai/utils.ts
|
|
206
219
|
function limitMessagesToTokenCount(messages, tools, model, maxTokens) {
|
|
@@ -346,6 +359,7 @@ var import_shared = require("@copilotkit/shared");
|
|
|
346
359
|
var DEFAULT_MODEL = "gpt-4o";
|
|
347
360
|
var OpenAIAdapter = class {
|
|
348
361
|
model = DEFAULT_MODEL;
|
|
362
|
+
disableParallelToolCalls = false;
|
|
349
363
|
_openai;
|
|
350
364
|
get openai() {
|
|
351
365
|
return this._openai;
|
|
@@ -355,6 +369,7 @@ var OpenAIAdapter = class {
|
|
|
355
369
|
if (params == null ? void 0 : params.model) {
|
|
356
370
|
this.model = params.model;
|
|
357
371
|
}
|
|
372
|
+
this.disableParallelToolCalls = (params == null ? void 0 : params.disableParallelToolCalls) || false;
|
|
358
373
|
}
|
|
359
374
|
async process(request) {
|
|
360
375
|
const { threadId, model = this.model, messages, actions, eventSource, forwardedParameters } = request;
|
|
@@ -385,6 +400,9 @@ var OpenAIAdapter = class {
|
|
|
385
400
|
},
|
|
386
401
|
...toolChoice && {
|
|
387
402
|
tool_choice: toolChoice
|
|
403
|
+
},
|
|
404
|
+
...this.disableParallelToolCalls && {
|
|
405
|
+
parallel_tool_calls: false
|
|
388
406
|
}
|
|
389
407
|
});
|
|
390
408
|
eventSource.stream(async (eventStream$) => {
|
|
@@ -436,11 +454,13 @@ var OpenAIAssistantAdapter = class {
|
|
|
436
454
|
codeInterpreterEnabled;
|
|
437
455
|
assistantId;
|
|
438
456
|
fileSearchEnabled;
|
|
457
|
+
disableParallelToolCalls;
|
|
439
458
|
constructor(params) {
|
|
440
459
|
this.openai = params.openai || new import_openai2.default({});
|
|
441
460
|
this.codeInterpreterEnabled = params.codeInterpreterEnabled === false || true;
|
|
442
461
|
this.fileSearchEnabled = params.fileSearchEnabled === false || true;
|
|
443
462
|
this.assistantId = params.assistantId;
|
|
463
|
+
this.disableParallelToolCalls = (params == null ? void 0 : params.disableParallelToolCalls) || false;
|
|
444
464
|
}
|
|
445
465
|
async process(request) {
|
|
446
466
|
const { messages, actions, eventSource, runId, forwardedParameters } = request;
|
|
@@ -476,7 +496,10 @@ var OpenAIAssistantAdapter = class {
|
|
|
476
496
|
};
|
|
477
497
|
});
|
|
478
498
|
const stream = this.openai.beta.threads.runs.submitToolOutputsStream(threadId, runId, {
|
|
479
|
-
tool_outputs: toolOutputs
|
|
499
|
+
tool_outputs: toolOutputs,
|
|
500
|
+
...this.disableParallelToolCalls && {
|
|
501
|
+
parallel_tool_calls: false
|
|
502
|
+
}
|
|
480
503
|
});
|
|
481
504
|
await this.streamResponse(stream, eventSource);
|
|
482
505
|
return runId;
|
|
@@ -515,6 +538,9 @@ var OpenAIAssistantAdapter = class {
|
|
|
515
538
|
tools,
|
|
516
539
|
...(forwardedParameters == null ? void 0 : forwardedParameters.maxTokens) && {
|
|
517
540
|
max_completion_tokens: forwardedParameters.maxTokens
|
|
541
|
+
},
|
|
542
|
+
...this.disableParallelToolCalls && {
|
|
543
|
+
parallel_tool_calls: false
|
|
518
544
|
}
|
|
519
545
|
});
|
|
520
546
|
await this.streamResponse(stream, eventSource);
|
|
@@ -1168,6 +1194,7 @@ var import_shared6 = require("@copilotkit/shared");
|
|
|
1168
1194
|
var DEFAULT_MODEL2 = "llama3-groq-70b-8192-tool-use-preview";
|
|
1169
1195
|
var GroqAdapter = class {
|
|
1170
1196
|
model = DEFAULT_MODEL2;
|
|
1197
|
+
disableParallelToolCalls = false;
|
|
1171
1198
|
_groq;
|
|
1172
1199
|
get groq() {
|
|
1173
1200
|
return this._groq;
|
|
@@ -1177,6 +1204,7 @@ var GroqAdapter = class {
|
|
|
1177
1204
|
if (params == null ? void 0 : params.model) {
|
|
1178
1205
|
this.model = params.model;
|
|
1179
1206
|
}
|
|
1207
|
+
this.disableParallelToolCalls = (params == null ? void 0 : params.disableParallelToolCalls) || false;
|
|
1180
1208
|
}
|
|
1181
1209
|
async process(request) {
|
|
1182
1210
|
const { threadId, model = this.model, messages, actions, eventSource, forwardedParameters } = request;
|
|
@@ -1207,6 +1235,9 @@ var GroqAdapter = class {
|
|
|
1207
1235
|
},
|
|
1208
1236
|
...toolChoice && {
|
|
1209
1237
|
tool_choice: toolChoice
|
|
1238
|
+
},
|
|
1239
|
+
...this.disableParallelToolCalls && {
|
|
1240
|
+
parallel_tool_calls: false
|
|
1210
1241
|
}
|
|
1211
1242
|
});
|
|
1212
1243
|
eventSource.stream(async (eventStream$) => {
|
|
@@ -1252,7 +1283,366 @@ var GroqAdapter = class {
|
|
|
1252
1283
|
__name(GroqAdapter, "GroqAdapter");
|
|
1253
1284
|
|
|
1254
1285
|
// src/service-adapters/events.ts
|
|
1286
|
+
var import_rxjs2 = require("rxjs");
|
|
1287
|
+
|
|
1288
|
+
// src/lib/telemetry-client.ts
|
|
1289
|
+
var import_shared7 = require("@copilotkit/shared");
|
|
1290
|
+
var packageJson = require_package();
|
|
1291
|
+
var telemetryClient = new import_shared7.TelemetryClient({
|
|
1292
|
+
packageName: packageJson.name,
|
|
1293
|
+
packageVersion: packageJson.version
|
|
1294
|
+
});
|
|
1295
|
+
var telemetry_client_default = telemetryClient;
|
|
1296
|
+
|
|
1297
|
+
// src/agents/langgraph/event-source.ts
|
|
1255
1298
|
var import_rxjs = require("rxjs");
|
|
1299
|
+
|
|
1300
|
+
// src/agents/langgraph/events.ts
|
|
1301
|
+
var LangGraphEventTypes;
|
|
1302
|
+
(function(LangGraphEventTypes2) {
|
|
1303
|
+
LangGraphEventTypes2["OnChainStart"] = "on_chain_start";
|
|
1304
|
+
LangGraphEventTypes2["OnChainStream"] = "on_chain_stream";
|
|
1305
|
+
LangGraphEventTypes2["OnChainEnd"] = "on_chain_end";
|
|
1306
|
+
LangGraphEventTypes2["OnChatModelStart"] = "on_chat_model_start";
|
|
1307
|
+
LangGraphEventTypes2["OnChatModelStream"] = "on_chat_model_stream";
|
|
1308
|
+
LangGraphEventTypes2["OnChatModelEnd"] = "on_chat_model_end";
|
|
1309
|
+
LangGraphEventTypes2["OnToolStart"] = "on_tool_start";
|
|
1310
|
+
LangGraphEventTypes2["OnToolEnd"] = "on_tool_end";
|
|
1311
|
+
LangGraphEventTypes2["OnCopilotKitStateSync"] = "on_copilotkit_state_sync";
|
|
1312
|
+
})(LangGraphEventTypes || (LangGraphEventTypes = {}));
|
|
1313
|
+
|
|
1314
|
+
// src/agents/langgraph/event-source.ts
|
|
1315
|
+
var RemoteLangGraphEventSource = class {
|
|
1316
|
+
eventStream$ = new import_rxjs.ReplaySubject();
|
|
1317
|
+
async streamResponse(response) {
|
|
1318
|
+
const reader = response.body.getReader();
|
|
1319
|
+
const decoder = new TextDecoder();
|
|
1320
|
+
let buffer = [];
|
|
1321
|
+
const eventStream$ = this.eventStream$;
|
|
1322
|
+
function flushBuffer() {
|
|
1323
|
+
const currentBuffer = buffer.join("");
|
|
1324
|
+
if (currentBuffer.trim().length === 0) {
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
const parts = currentBuffer.split("\n");
|
|
1328
|
+
if (parts.length === 0) {
|
|
1329
|
+
return;
|
|
1330
|
+
}
|
|
1331
|
+
const lastPartIsComplete = currentBuffer.endsWith("\n");
|
|
1332
|
+
buffer = [];
|
|
1333
|
+
if (!lastPartIsComplete) {
|
|
1334
|
+
buffer.push(parts.pop());
|
|
1335
|
+
}
|
|
1336
|
+
parts.map((part) => part.trim()).filter((part) => part != "").forEach((part) => {
|
|
1337
|
+
eventStream$.next(JSON.parse(part));
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
__name(flushBuffer, "flushBuffer");
|
|
1341
|
+
while (true) {
|
|
1342
|
+
const { done, value } = await reader.read();
|
|
1343
|
+
if (!done) {
|
|
1344
|
+
buffer.push(decoder.decode(value, {
|
|
1345
|
+
stream: true
|
|
1346
|
+
}));
|
|
1347
|
+
}
|
|
1348
|
+
flushBuffer();
|
|
1349
|
+
if (done) {
|
|
1350
|
+
break;
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
eventStream$.complete();
|
|
1354
|
+
}
|
|
1355
|
+
processLangGraphEvents() {
|
|
1356
|
+
return this.eventStream$.pipe((0, import_rxjs.scan)((acc, event) => {
|
|
1357
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1358
|
+
if (event.event === LangGraphEventTypes.OnChatModelStream) {
|
|
1359
|
+
if ((_c = (_b = (_a = event.data) == null ? void 0 : _a.chunk) == null ? void 0 : _b.kwargs) == null ? void 0 : _c.tool_call_chunks) {
|
|
1360
|
+
acc.prevToolCallId = acc.toolCallId;
|
|
1361
|
+
acc.toolCallId = (_d = event.data.chunk.kwargs) == null ? void 0 : _d.id;
|
|
1362
|
+
if ((_e = event.data.chunk.kwargs.tool_call_chunks[0]) == null ? void 0 : _e.name) {
|
|
1363
|
+
acc.toolCallName = event.data.chunk.kwargs.tool_call_chunks[0].name;
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
acc.prevMessageId = acc.messageId;
|
|
1367
|
+
acc.messageId = (_h = (_g = (_f = event.data) == null ? void 0 : _f.chunk) == null ? void 0 : _g.kwargs) == null ? void 0 : _h.id;
|
|
1368
|
+
} else {
|
|
1369
|
+
acc.prevToolCallId = acc.toolCallId;
|
|
1370
|
+
acc.toolCallId = null;
|
|
1371
|
+
acc.prevMessageId = acc.messageId;
|
|
1372
|
+
acc.messageId = null;
|
|
1373
|
+
acc.toolCallName = null;
|
|
1374
|
+
}
|
|
1375
|
+
acc.event = event;
|
|
1376
|
+
return acc;
|
|
1377
|
+
}, {
|
|
1378
|
+
event: null,
|
|
1379
|
+
toolCallId: null,
|
|
1380
|
+
prevToolCallId: null,
|
|
1381
|
+
messageId: null,
|
|
1382
|
+
toolCallName: null,
|
|
1383
|
+
prevMessageId: null
|
|
1384
|
+
}), (0, import_rxjs.mergeMap)((eventWithState) => {
|
|
1385
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1386
|
+
const events = [];
|
|
1387
|
+
let shouldEmitMessages = false;
|
|
1388
|
+
let shouldEmitToolCalls = false;
|
|
1389
|
+
if (eventWithState.event.event == LangGraphEventTypes.OnChatModelStream) {
|
|
1390
|
+
if ((_a = eventWithState.event.tags) == null ? void 0 : _a.includes("copilotkit:emit-tool-calls")) {
|
|
1391
|
+
shouldEmitToolCalls = true;
|
|
1392
|
+
}
|
|
1393
|
+
if ((_b = eventWithState.event.tags) == null ? void 0 : _b.includes("copilotkit:emit-messages")) {
|
|
1394
|
+
shouldEmitMessages = true;
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
if (eventWithState.prevToolCallId !== null && eventWithState.prevToolCallId !== eventWithState.toolCallId && shouldEmitToolCalls) {
|
|
1398
|
+
events.push({
|
|
1399
|
+
type: RuntimeEventTypes.ActionExecutionEnd
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
if (eventWithState.prevMessageId !== null && eventWithState.prevMessageId !== eventWithState.messageId && shouldEmitMessages) {
|
|
1403
|
+
events.push({
|
|
1404
|
+
type: RuntimeEventTypes.TextMessageEnd
|
|
1405
|
+
});
|
|
1406
|
+
}
|
|
1407
|
+
switch (eventWithState.event.event) {
|
|
1408
|
+
case LangGraphEventTypes.OnCopilotKitStateSync:
|
|
1409
|
+
events.push({
|
|
1410
|
+
type: RuntimeEventTypes.AgentStateMessage,
|
|
1411
|
+
threadId: eventWithState.event.thread_id,
|
|
1412
|
+
role: eventWithState.event.role,
|
|
1413
|
+
agentName: eventWithState.event.agent_name,
|
|
1414
|
+
nodeName: eventWithState.event.node_name,
|
|
1415
|
+
runId: eventWithState.event.run_id,
|
|
1416
|
+
active: eventWithState.event.active,
|
|
1417
|
+
state: JSON.stringify(eventWithState.event.state),
|
|
1418
|
+
running: eventWithState.event.running
|
|
1419
|
+
});
|
|
1420
|
+
break;
|
|
1421
|
+
case LangGraphEventTypes.OnToolEnd:
|
|
1422
|
+
break;
|
|
1423
|
+
case LangGraphEventTypes.OnChatModelStream:
|
|
1424
|
+
if (eventWithState.toolCallId !== null && eventWithState.prevToolCallId !== eventWithState.toolCallId) {
|
|
1425
|
+
if (shouldEmitToolCalls) {
|
|
1426
|
+
events.push({
|
|
1427
|
+
type: RuntimeEventTypes.ActionExecutionStart,
|
|
1428
|
+
actionExecutionId: eventWithState.toolCallId,
|
|
1429
|
+
actionName: eventWithState.toolCallName,
|
|
1430
|
+
scope: "client"
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
} else if (eventWithState.messageId !== null && eventWithState.prevMessageId !== eventWithState.messageId) {
|
|
1434
|
+
if (shouldEmitMessages) {
|
|
1435
|
+
events.push({
|
|
1436
|
+
type: RuntimeEventTypes.TextMessageStart,
|
|
1437
|
+
messageId: eventWithState.messageId
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
const args = (_g = (_f = (_e = (_d = (_c = eventWithState.event.data) == null ? void 0 : _c.chunk) == null ? void 0 : _d.kwargs) == null ? void 0 : _e.tool_call_chunks) == null ? void 0 : _f[0]) == null ? void 0 : _g.args;
|
|
1442
|
+
const content = (_j = (_i = (_h = eventWithState.event.data) == null ? void 0 : _h.chunk) == null ? void 0 : _i.kwargs) == null ? void 0 : _j.content;
|
|
1443
|
+
if (args) {
|
|
1444
|
+
if (shouldEmitToolCalls) {
|
|
1445
|
+
events.push({
|
|
1446
|
+
type: RuntimeEventTypes.ActionExecutionArgs,
|
|
1447
|
+
args
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
} else if (eventWithState.messageId !== null && content) {
|
|
1451
|
+
if (shouldEmitMessages) {
|
|
1452
|
+
events.push({
|
|
1453
|
+
type: RuntimeEventTypes.TextMessageContent,
|
|
1454
|
+
content
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
break;
|
|
1459
|
+
}
|
|
1460
|
+
return events;
|
|
1461
|
+
}));
|
|
1462
|
+
}
|
|
1463
|
+
};
|
|
1464
|
+
__name(RemoteLangGraphEventSource, "RemoteLangGraphEventSource");
|
|
1465
|
+
|
|
1466
|
+
// src/lib/runtime/remote-actions.ts
|
|
1467
|
+
function isLangGraphAgentAction(action) {
|
|
1468
|
+
if (!action) {
|
|
1469
|
+
return false;
|
|
1470
|
+
}
|
|
1471
|
+
return typeof action.langGraphAgentHandler === "function";
|
|
1472
|
+
}
|
|
1473
|
+
__name(isLangGraphAgentAction, "isLangGraphAgentAction");
|
|
1474
|
+
function createHeaders(onBeforeRequest, graphqlContext) {
|
|
1475
|
+
const headers = {
|
|
1476
|
+
"Content-Type": "application/json"
|
|
1477
|
+
};
|
|
1478
|
+
if (onBeforeRequest) {
|
|
1479
|
+
const { headers: additionalHeaders } = onBeforeRequest({
|
|
1480
|
+
ctx: graphqlContext
|
|
1481
|
+
});
|
|
1482
|
+
if (additionalHeaders) {
|
|
1483
|
+
Object.assign(headers, additionalHeaders);
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
return headers;
|
|
1487
|
+
}
|
|
1488
|
+
__name(createHeaders, "createHeaders");
|
|
1489
|
+
async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: logger2 }) {
|
|
1490
|
+
logger2.debug({
|
|
1491
|
+
url
|
|
1492
|
+
}, "Fetching actions from url");
|
|
1493
|
+
const headers = createHeaders(onBeforeRequest, graphqlContext);
|
|
1494
|
+
const response = await fetch(`${url}/info`, {
|
|
1495
|
+
method: "POST",
|
|
1496
|
+
headers,
|
|
1497
|
+
body: JSON.stringify({
|
|
1498
|
+
properties: graphqlContext.properties
|
|
1499
|
+
})
|
|
1500
|
+
});
|
|
1501
|
+
if (!response.ok) {
|
|
1502
|
+
logger2.error({
|
|
1503
|
+
url,
|
|
1504
|
+
status: response.status,
|
|
1505
|
+
body: await response.text()
|
|
1506
|
+
}, "Failed to fetch actions from url");
|
|
1507
|
+
return [];
|
|
1508
|
+
}
|
|
1509
|
+
const json = await response.json();
|
|
1510
|
+
logger2.debug({
|
|
1511
|
+
json
|
|
1512
|
+
}, "Fetched actions from url");
|
|
1513
|
+
return json;
|
|
1514
|
+
}
|
|
1515
|
+
__name(fetchRemoteInfo, "fetchRemoteInfo");
|
|
1516
|
+
function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, logger: logger2, messages, agentStates }) {
|
|
1517
|
+
const actions = json["actions"].map((action) => ({
|
|
1518
|
+
name: action.name,
|
|
1519
|
+
description: action.description,
|
|
1520
|
+
parameters: action.parameters,
|
|
1521
|
+
handler: async (args) => {
|
|
1522
|
+
logger2.debug({
|
|
1523
|
+
actionName: action.name,
|
|
1524
|
+
args
|
|
1525
|
+
}, "Executing remote action");
|
|
1526
|
+
const headers = createHeaders(onBeforeRequest, graphqlContext);
|
|
1527
|
+
telemetry_client_default.capture("oss.runtime.remote_action_executed", {});
|
|
1528
|
+
const response = await fetch(`${url}/actions/execute`, {
|
|
1529
|
+
method: "POST",
|
|
1530
|
+
headers,
|
|
1531
|
+
body: JSON.stringify({
|
|
1532
|
+
name: action.name,
|
|
1533
|
+
arguments: args,
|
|
1534
|
+
properties: graphqlContext.properties
|
|
1535
|
+
})
|
|
1536
|
+
});
|
|
1537
|
+
if (!response.ok) {
|
|
1538
|
+
logger2.error({
|
|
1539
|
+
url,
|
|
1540
|
+
status: response.status,
|
|
1541
|
+
body: await response.text()
|
|
1542
|
+
}, "Failed to execute remote action");
|
|
1543
|
+
return "Failed to execute remote action";
|
|
1544
|
+
}
|
|
1545
|
+
const requestResult = await response.json();
|
|
1546
|
+
const result = requestResult["result"];
|
|
1547
|
+
logger2.debug({
|
|
1548
|
+
actionName: action.name,
|
|
1549
|
+
result
|
|
1550
|
+
}, "Executed remote action");
|
|
1551
|
+
return result;
|
|
1552
|
+
}
|
|
1553
|
+
}));
|
|
1554
|
+
const agents = json["agents"].map((agent) => ({
|
|
1555
|
+
name: agent.name,
|
|
1556
|
+
description: agent.description,
|
|
1557
|
+
parameters: [],
|
|
1558
|
+
handler: async (_args) => {
|
|
1559
|
+
},
|
|
1560
|
+
langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName }) => {
|
|
1561
|
+
var _a;
|
|
1562
|
+
logger2.debug({
|
|
1563
|
+
actionName: agent.name
|
|
1564
|
+
}, "Executing remote agent");
|
|
1565
|
+
const headers = createHeaders(onBeforeRequest, graphqlContext);
|
|
1566
|
+
telemetry_client_default.capture("oss.runtime.remote_action_executed", {});
|
|
1567
|
+
let state = {};
|
|
1568
|
+
if (agentStates) {
|
|
1569
|
+
const jsonState = (_a = agentStates.find((state2) => state2.agentName === name)) == null ? void 0 : _a.state;
|
|
1570
|
+
if (jsonState) {
|
|
1571
|
+
state = JSON.parse(jsonState);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
const response = await fetch(`${url}/agents/execute`, {
|
|
1575
|
+
method: "POST",
|
|
1576
|
+
headers,
|
|
1577
|
+
body: JSON.stringify({
|
|
1578
|
+
name,
|
|
1579
|
+
threadId,
|
|
1580
|
+
nodeName,
|
|
1581
|
+
messages,
|
|
1582
|
+
state,
|
|
1583
|
+
properties: graphqlContext.properties,
|
|
1584
|
+
actions: actionInputsWithoutAgents.map((action) => ({
|
|
1585
|
+
name: action.name,
|
|
1586
|
+
description: action.description,
|
|
1587
|
+
parameters: JSON.parse(action.jsonSchema)
|
|
1588
|
+
}))
|
|
1589
|
+
})
|
|
1590
|
+
});
|
|
1591
|
+
if (!response.ok) {
|
|
1592
|
+
logger2.error({
|
|
1593
|
+
url,
|
|
1594
|
+
status: response.status,
|
|
1595
|
+
body: await response.text()
|
|
1596
|
+
}, "Failed to execute remote agent");
|
|
1597
|
+
throw new Error("Failed to execute remote agent");
|
|
1598
|
+
}
|
|
1599
|
+
const eventSource = new RemoteLangGraphEventSource();
|
|
1600
|
+
eventSource.streamResponse(response);
|
|
1601
|
+
return eventSource.processLangGraphEvents();
|
|
1602
|
+
}
|
|
1603
|
+
}));
|
|
1604
|
+
return [
|
|
1605
|
+
...actions,
|
|
1606
|
+
...agents
|
|
1607
|
+
];
|
|
1608
|
+
}
|
|
1609
|
+
__name(constructRemoteActions, "constructRemoteActions");
|
|
1610
|
+
async function setupRemoteActions({ remoteActionDefinitions, graphqlContext, messages, agentStates }) {
|
|
1611
|
+
const logger2 = graphqlContext.logger.child({
|
|
1612
|
+
component: "remote-actions.fetchRemoteActions"
|
|
1613
|
+
});
|
|
1614
|
+
logger2.debug({
|
|
1615
|
+
remoteActionDefinitions
|
|
1616
|
+
}, "Fetching remote actions");
|
|
1617
|
+
const filtered = remoteActionDefinitions.filter((value, index, self) => index === self.findIndex((t) => t.url === value.url));
|
|
1618
|
+
const result = await Promise.all(filtered.map(async (actionDefinition) => {
|
|
1619
|
+
const json = await fetchRemoteInfo({
|
|
1620
|
+
url: actionDefinition.url,
|
|
1621
|
+
onBeforeRequest: actionDefinition.onBeforeRequest,
|
|
1622
|
+
graphqlContext,
|
|
1623
|
+
logger: logger2.child({
|
|
1624
|
+
component: "remote-actions.fetchActionsFromUrl",
|
|
1625
|
+
actionDefinition
|
|
1626
|
+
})
|
|
1627
|
+
});
|
|
1628
|
+
return constructRemoteActions({
|
|
1629
|
+
json,
|
|
1630
|
+
messages,
|
|
1631
|
+
url: actionDefinition.url,
|
|
1632
|
+
onBeforeRequest: actionDefinition.onBeforeRequest,
|
|
1633
|
+
graphqlContext,
|
|
1634
|
+
logger: logger2.child({
|
|
1635
|
+
component: "remote-actions.constructActions",
|
|
1636
|
+
actionDefinition
|
|
1637
|
+
}),
|
|
1638
|
+
agentStates
|
|
1639
|
+
});
|
|
1640
|
+
}));
|
|
1641
|
+
return result.flat();
|
|
1642
|
+
}
|
|
1643
|
+
__name(setupRemoteActions, "setupRemoteActions");
|
|
1644
|
+
|
|
1645
|
+
// src/service-adapters/events.ts
|
|
1256
1646
|
var RuntimeEventTypes;
|
|
1257
1647
|
(function(RuntimeEventTypes2) {
|
|
1258
1648
|
RuntimeEventTypes2["TextMessageStart"] = "TextMessageStart";
|
|
@@ -1262,8 +1652,9 @@ var RuntimeEventTypes;
|
|
|
1262
1652
|
RuntimeEventTypes2["ActionExecutionArgs"] = "ActionExecutionArgs";
|
|
1263
1653
|
RuntimeEventTypes2["ActionExecutionEnd"] = "ActionExecutionEnd";
|
|
1264
1654
|
RuntimeEventTypes2["ActionExecutionResult"] = "ActionExecutionResult";
|
|
1655
|
+
RuntimeEventTypes2["AgentStateMessage"] = "AgentStateMessage";
|
|
1265
1656
|
})(RuntimeEventTypes || (RuntimeEventTypes = {}));
|
|
1266
|
-
var RuntimeEventSubject = class extends
|
|
1657
|
+
var RuntimeEventSubject = class extends import_rxjs2.ReplaySubject {
|
|
1267
1658
|
constructor() {
|
|
1268
1659
|
super();
|
|
1269
1660
|
}
|
|
@@ -1320,6 +1711,19 @@ var RuntimeEventSubject = class extends import_rxjs.ReplaySubject {
|
|
|
1320
1711
|
result
|
|
1321
1712
|
});
|
|
1322
1713
|
}
|
|
1714
|
+
sendAgentStateMessage(threadId, agentName, nodeName, runId, active, role, state, running) {
|
|
1715
|
+
this.next({
|
|
1716
|
+
type: "AgentStateMessage",
|
|
1717
|
+
threadId,
|
|
1718
|
+
agentName,
|
|
1719
|
+
nodeName,
|
|
1720
|
+
runId,
|
|
1721
|
+
active,
|
|
1722
|
+
role,
|
|
1723
|
+
state,
|
|
1724
|
+
running
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1323
1727
|
};
|
|
1324
1728
|
__name(RuntimeEventSubject, "RuntimeEventSubject");
|
|
1325
1729
|
var RuntimeEventSource = class {
|
|
@@ -1328,26 +1732,31 @@ var RuntimeEventSource = class {
|
|
|
1328
1732
|
async stream(callback) {
|
|
1329
1733
|
this.callback = callback;
|
|
1330
1734
|
}
|
|
1331
|
-
|
|
1735
|
+
processRuntimeEvents({ serverSideActions, guardrailsResult$, actionInputsWithoutAgents }) {
|
|
1332
1736
|
this.callback(this.eventStream$).catch((error) => {
|
|
1333
1737
|
console.error("Error in event source callback", error);
|
|
1334
1738
|
});
|
|
1335
1739
|
return this.eventStream$.pipe(
|
|
1336
1740
|
// mark tools for server side execution
|
|
1337
|
-
(0,
|
|
1741
|
+
(0, import_rxjs2.map)((event) => {
|
|
1338
1742
|
if (event.type === "ActionExecutionStart") {
|
|
1339
|
-
|
|
1743
|
+
if (event.scope !== "passThrough") {
|
|
1744
|
+
event.scope = serverSideActions.find((action) => action.name === event.actionName) ? "server" : "client";
|
|
1745
|
+
}
|
|
1340
1746
|
}
|
|
1341
1747
|
return event;
|
|
1342
1748
|
}),
|
|
1343
1749
|
// track state
|
|
1344
|
-
(0,
|
|
1750
|
+
(0, import_rxjs2.scan)((acc, event) => {
|
|
1751
|
+
acc = {
|
|
1752
|
+
...acc
|
|
1753
|
+
};
|
|
1345
1754
|
if (event.type === "ActionExecutionStart") {
|
|
1346
1755
|
acc.callActionServerSide = event.scope === "server";
|
|
1347
1756
|
acc.args = "";
|
|
1348
1757
|
acc.actionExecutionId = event.actionExecutionId;
|
|
1349
1758
|
if (acc.callActionServerSide) {
|
|
1350
|
-
acc.action =
|
|
1759
|
+
acc.action = serverSideActions.find((action) => action.name === event.actionName);
|
|
1351
1760
|
}
|
|
1352
1761
|
} else if (event.type === "ActionExecutionArgs") {
|
|
1353
1762
|
acc.args += event.args;
|
|
@@ -1361,24 +1770,26 @@ var RuntimeEventSource = class {
|
|
|
1361
1770
|
actionExecutionId: null,
|
|
1362
1771
|
action: null
|
|
1363
1772
|
}),
|
|
1364
|
-
(0,
|
|
1773
|
+
(0, import_rxjs2.concatMap)((eventWithState) => {
|
|
1365
1774
|
if (eventWithState.event.type === "ActionExecutionEnd" && eventWithState.callActionServerSide) {
|
|
1366
1775
|
const toolCallEventStream$ = new RuntimeEventSubject();
|
|
1367
|
-
executeAction(toolCallEventStream$, guardrailsResult$ ? guardrailsResult$ : null, eventWithState.action, eventWithState.args, eventWithState.actionExecutionId).catch((error) => {
|
|
1776
|
+
executeAction(toolCallEventStream$, guardrailsResult$ ? guardrailsResult$ : null, eventWithState.action, eventWithState.args, eventWithState.actionExecutionId, actionInputsWithoutAgents).catch((error) => {
|
|
1368
1777
|
console.error(error);
|
|
1369
1778
|
});
|
|
1370
|
-
|
|
1779
|
+
telemetry_client_default.capture("oss.runtime.server_action_executed", {});
|
|
1780
|
+
return (0, import_rxjs2.concat)((0, import_rxjs2.of)(eventWithState.event), toolCallEventStream$);
|
|
1371
1781
|
} else {
|
|
1372
|
-
return (0,
|
|
1782
|
+
return (0, import_rxjs2.of)(eventWithState.event);
|
|
1373
1783
|
}
|
|
1374
1784
|
})
|
|
1375
1785
|
);
|
|
1376
1786
|
}
|
|
1377
1787
|
};
|
|
1378
1788
|
__name(RuntimeEventSource, "RuntimeEventSource");
|
|
1379
|
-
async function executeAction(eventStream$, guardrailsResult$, action, actionArguments, actionExecutionId) {
|
|
1789
|
+
async function executeAction(eventStream$, guardrailsResult$, action, actionArguments, actionExecutionId, actionInputsWithoutAgents) {
|
|
1790
|
+
var _a;
|
|
1380
1791
|
if (guardrailsResult$) {
|
|
1381
|
-
const { status } = await (0,
|
|
1792
|
+
const { status } = await (0, import_rxjs2.firstValueFrom)(guardrailsResult$);
|
|
1382
1793
|
if (status === "denied") {
|
|
1383
1794
|
eventStream$.complete();
|
|
1384
1795
|
return;
|
|
@@ -1388,15 +1799,28 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
|
|
|
1388
1799
|
if (actionArguments) {
|
|
1389
1800
|
args = JSON.parse(actionArguments);
|
|
1390
1801
|
}
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
eventStream$,
|
|
1395
|
-
actionExecution: {
|
|
1802
|
+
if (isLangGraphAgentAction(action)) {
|
|
1803
|
+
eventStream$.sendActionExecutionResult(actionExecutionId, action.name, `${action.name} agent started`);
|
|
1804
|
+
const stream = await action.langGraphAgentHandler({
|
|
1396
1805
|
name: action.name,
|
|
1397
|
-
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1806
|
+
actionInputsWithoutAgents
|
|
1807
|
+
});
|
|
1808
|
+
(0, import_rxjs2.from)(stream).subscribe({
|
|
1809
|
+
next: (event) => eventStream$.next(event),
|
|
1810
|
+
error: (err) => console.error("Error in stream", err),
|
|
1811
|
+
complete: () => eventStream$.complete()
|
|
1812
|
+
});
|
|
1813
|
+
} else {
|
|
1814
|
+
const result = await ((_a = action.handler) == null ? void 0 : _a.call(action, args));
|
|
1815
|
+
await streamLangChainResponse({
|
|
1816
|
+
result,
|
|
1817
|
+
eventStream$,
|
|
1818
|
+
actionExecution: {
|
|
1819
|
+
name: action.name,
|
|
1820
|
+
id: actionExecutionId
|
|
1821
|
+
}
|
|
1822
|
+
});
|
|
1823
|
+
}
|
|
1400
1824
|
}
|
|
1401
1825
|
__name(executeAction, "executeAction");
|
|
1402
1826
|
|
|
@@ -1428,15 +1852,30 @@ function convertGqlInputToMessages(inputMessages) {
|
|
|
1428
1852
|
actionName: message.resultMessage.actionName,
|
|
1429
1853
|
result: message.resultMessage.result
|
|
1430
1854
|
}));
|
|
1855
|
+
} else if (message.agentStateMessage) {
|
|
1856
|
+
messages.push((0, import_class_transformer.plainToInstance)(AgentStateMessage, {
|
|
1857
|
+
id: message.id,
|
|
1858
|
+
threadId: message.agentStateMessage.threadId,
|
|
1859
|
+
createdAt: message.createdAt,
|
|
1860
|
+
agentName: message.agentStateMessage.agentName,
|
|
1861
|
+
nodeName: message.agentStateMessage.nodeName,
|
|
1862
|
+
runId: message.agentStateMessage.runId,
|
|
1863
|
+
active: message.agentStateMessage.active,
|
|
1864
|
+
role: message.agentStateMessage.role,
|
|
1865
|
+
state: JSON.parse(message.agentStateMessage.state),
|
|
1866
|
+
running: message.agentStateMessage.running
|
|
1867
|
+
}));
|
|
1431
1868
|
}
|
|
1432
1869
|
}
|
|
1433
1870
|
return messages;
|
|
1434
1871
|
}
|
|
1435
1872
|
__name(convertGqlInputToMessages, "convertGqlInputToMessages");
|
|
1436
1873
|
|
|
1437
|
-
// src/lib/copilot-runtime.ts
|
|
1874
|
+
// src/lib/runtime/copilot-runtime.ts
|
|
1875
|
+
var import_rxjs3 = require("rxjs");
|
|
1438
1876
|
var CopilotRuntime = class {
|
|
1439
1877
|
actions;
|
|
1878
|
+
remoteActionDefinitions;
|
|
1440
1879
|
langserve = [];
|
|
1441
1880
|
onBeforeRequest;
|
|
1442
1881
|
onAfterRequest;
|
|
@@ -1447,43 +1886,34 @@ var CopilotRuntime = class {
|
|
|
1447
1886
|
const remoteChain = new RemoteChain(chain);
|
|
1448
1887
|
this.langserve.push(remoteChain.toAction());
|
|
1449
1888
|
}
|
|
1889
|
+
this.remoteActionDefinitions = (params == null ? void 0 : params.remoteActions) || [];
|
|
1450
1890
|
this.onBeforeRequest = (_a = params == null ? void 0 : params.middleware) == null ? void 0 : _a.onBeforeRequest;
|
|
1451
1891
|
this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
|
|
1452
1892
|
}
|
|
1453
|
-
async
|
|
1893
|
+
async processRuntimeRequest(request) {
|
|
1454
1894
|
var _a;
|
|
1455
|
-
const { serviceAdapter, messages, actions: clientSideActionsInput, threadId, runId,
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
try {
|
|
1459
|
-
const chain = await chainPromise;
|
|
1460
|
-
langserveFunctions.push(chain);
|
|
1461
|
-
} catch (error) {
|
|
1462
|
-
console.error("Error loading langserve chain:", error);
|
|
1463
|
-
}
|
|
1895
|
+
const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, agentSession, url } = request;
|
|
1896
|
+
if (agentSession) {
|
|
1897
|
+
return this.processAgentRequest(request);
|
|
1464
1898
|
}
|
|
1465
|
-
const
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
const
|
|
1469
|
-
...configuredActions,
|
|
1470
|
-
...langserveFunctions
|
|
1471
|
-
];
|
|
1472
|
-
const serverSideActionsInput = actions.map((action) => ({
|
|
1899
|
+
const messages = rawMessages.filter((message) => !message.agentStateMessage);
|
|
1900
|
+
const inputMessages = convertGqlInputToMessages(messages);
|
|
1901
|
+
const serverSideActions = await this.getServerSideActions(request);
|
|
1902
|
+
const serverSideActionsInput = serverSideActions.map((action) => ({
|
|
1473
1903
|
name: action.name,
|
|
1474
1904
|
description: action.description,
|
|
1475
|
-
jsonSchema: JSON.stringify((0,
|
|
1905
|
+
jsonSchema: JSON.stringify((0, import_shared8.actionParametersToJsonSchema)(action.parameters))
|
|
1476
1906
|
}));
|
|
1477
1907
|
const actionInputs = flattenToolCallsNoDuplicates([
|
|
1478
1908
|
...serverSideActionsInput,
|
|
1479
1909
|
...clientSideActionsInput
|
|
1480
1910
|
]);
|
|
1481
|
-
const inputMessages = convertGqlInputToMessages(messages);
|
|
1482
1911
|
await ((_a = this.onBeforeRequest) == null ? void 0 : _a.call(this, {
|
|
1483
1912
|
threadId,
|
|
1484
1913
|
runId,
|
|
1485
1914
|
inputMessages,
|
|
1486
|
-
properties
|
|
1915
|
+
properties: graphqlContext.properties,
|
|
1916
|
+
url
|
|
1487
1917
|
}));
|
|
1488
1918
|
try {
|
|
1489
1919
|
const eventSource = new RuntimeEventSource();
|
|
@@ -1502,7 +1932,8 @@ var CopilotRuntime = class {
|
|
|
1502
1932
|
runId: result.runId,
|
|
1503
1933
|
inputMessages,
|
|
1504
1934
|
outputMessages,
|
|
1505
|
-
properties
|
|
1935
|
+
properties: graphqlContext.properties,
|
|
1936
|
+
url
|
|
1506
1937
|
});
|
|
1507
1938
|
}).catch((_error) => {
|
|
1508
1939
|
});
|
|
@@ -1510,13 +1941,108 @@ var CopilotRuntime = class {
|
|
|
1510
1941
|
threadId: result.threadId,
|
|
1511
1942
|
runId: result.runId,
|
|
1512
1943
|
eventSource,
|
|
1513
|
-
|
|
1944
|
+
serverSideActions,
|
|
1945
|
+
actionInputsWithoutAgents: actionInputs.filter((action) => (
|
|
1946
|
+
// TODO-AGENTS: do not exclude ALL server side actions
|
|
1947
|
+
!serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
|
|
1948
|
+
))
|
|
1949
|
+
};
|
|
1950
|
+
} catch (error) {
|
|
1951
|
+
console.error("Error getting response:", error);
|
|
1952
|
+
throw error;
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
async processAgentRequest(request) {
|
|
1956
|
+
var _a;
|
|
1957
|
+
const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession } = request;
|
|
1958
|
+
const { threadId = (0, import_shared8.randomId)(), agentName, nodeName } = agentSession;
|
|
1959
|
+
const serverSideActions = await this.getServerSideActions(request);
|
|
1960
|
+
const messages = convertGqlInputToMessages(rawMessages);
|
|
1961
|
+
const agent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
|
|
1962
|
+
if (!agent) {
|
|
1963
|
+
throw new Error(`Agent ${agentName} not found`);
|
|
1964
|
+
}
|
|
1965
|
+
const serverSideActionsInput = serverSideActions.filter((action) => !isLangGraphAgentAction(action)).map((action) => ({
|
|
1966
|
+
name: action.name,
|
|
1967
|
+
description: action.description,
|
|
1968
|
+
jsonSchema: JSON.stringify((0, import_shared8.actionParametersToJsonSchema)(action.parameters))
|
|
1969
|
+
}));
|
|
1970
|
+
const actionInputsWithoutAgents = flattenToolCallsNoDuplicates([
|
|
1971
|
+
...serverSideActionsInput,
|
|
1972
|
+
...request.actions
|
|
1973
|
+
]);
|
|
1974
|
+
await ((_a = this.onBeforeRequest) == null ? void 0 : _a.call(this, {
|
|
1975
|
+
threadId,
|
|
1976
|
+
runId: void 0,
|
|
1977
|
+
inputMessages: messages,
|
|
1978
|
+
properties: graphqlContext.properties
|
|
1979
|
+
}));
|
|
1980
|
+
try {
|
|
1981
|
+
const eventSource = new RuntimeEventSource();
|
|
1982
|
+
const stream = await agent.langGraphAgentHandler({
|
|
1983
|
+
name: agentName,
|
|
1984
|
+
threadId,
|
|
1985
|
+
nodeName,
|
|
1986
|
+
actionInputsWithoutAgents
|
|
1987
|
+
});
|
|
1988
|
+
eventSource.stream(async (eventStream$) => {
|
|
1989
|
+
(0, import_rxjs3.from)(stream).subscribe({
|
|
1990
|
+
next: (event) => eventStream$.next(event),
|
|
1991
|
+
error: (err) => console.error("Error in stream", err),
|
|
1992
|
+
complete: () => eventStream$.complete()
|
|
1993
|
+
});
|
|
1994
|
+
});
|
|
1995
|
+
outputMessagesPromise.then((outputMessages) => {
|
|
1996
|
+
var _a2;
|
|
1997
|
+
(_a2 = this.onAfterRequest) == null ? void 0 : _a2.call(this, {
|
|
1998
|
+
threadId,
|
|
1999
|
+
runId: void 0,
|
|
2000
|
+
inputMessages: messages,
|
|
2001
|
+
outputMessages,
|
|
2002
|
+
properties: graphqlContext.properties
|
|
2003
|
+
});
|
|
2004
|
+
}).catch((_error) => {
|
|
2005
|
+
});
|
|
2006
|
+
return {
|
|
2007
|
+
threadId,
|
|
2008
|
+
runId: void 0,
|
|
2009
|
+
eventSource,
|
|
2010
|
+
serverSideActions: [],
|
|
2011
|
+
actionInputsWithoutAgents
|
|
1514
2012
|
};
|
|
1515
2013
|
} catch (error) {
|
|
1516
2014
|
console.error("Error getting response:", error);
|
|
1517
2015
|
throw error;
|
|
1518
2016
|
}
|
|
1519
2017
|
}
|
|
2018
|
+
async getServerSideActions(request) {
|
|
2019
|
+
const { messages: rawMessages, graphqlContext, agentStates, url } = request;
|
|
2020
|
+
const inputMessages = convertGqlInputToMessages(rawMessages);
|
|
2021
|
+
const langserveFunctions = [];
|
|
2022
|
+
for (const chainPromise of this.langserve) {
|
|
2023
|
+
try {
|
|
2024
|
+
const chain = await chainPromise;
|
|
2025
|
+
langserveFunctions.push(chain);
|
|
2026
|
+
} catch (error) {
|
|
2027
|
+
console.error("Error loading langserve chain:", error);
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
const remoteActions = await setupRemoteActions({
|
|
2031
|
+
remoteActionDefinitions: this.remoteActionDefinitions,
|
|
2032
|
+
graphqlContext,
|
|
2033
|
+
messages: inputMessages,
|
|
2034
|
+
agentStates
|
|
2035
|
+
});
|
|
2036
|
+
const configuredActions = typeof this.actions === "function" ? this.actions({
|
|
2037
|
+
properties: graphqlContext.properties,
|
|
2038
|
+
url
|
|
2039
|
+
}) : this.actions;
|
|
2040
|
+
return [
|
|
2041
|
+
...configuredActions,
|
|
2042
|
+
...langserveFunctions,
|
|
2043
|
+
...remoteActions
|
|
2044
|
+
];
|
|
2045
|
+
}
|
|
1520
2046
|
};
|
|
1521
2047
|
__name(CopilotRuntime, "CopilotRuntime");
|
|
1522
2048
|
function flattenToolCallsNoDuplicates(toolsByPriority) {
|
|
@@ -1533,14 +2059,14 @@ function flattenToolCallsNoDuplicates(toolsByPriority) {
|
|
|
1533
2059
|
__name(flattenToolCallsNoDuplicates, "flattenToolCallsNoDuplicates");
|
|
1534
2060
|
|
|
1535
2061
|
// src/lib/integrations/shared.ts
|
|
1536
|
-
var
|
|
2062
|
+
var import_type_graphql16 = require("type-graphql");
|
|
1537
2063
|
|
|
1538
2064
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
1539
|
-
var
|
|
1540
|
-
var
|
|
2065
|
+
var import_type_graphql15 = require("type-graphql");
|
|
2066
|
+
var import_rxjs4 = require("rxjs");
|
|
1541
2067
|
|
|
1542
2068
|
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
1543
|
-
var
|
|
2069
|
+
var import_type_graphql11 = require("type-graphql");
|
|
1544
2070
|
|
|
1545
2071
|
// src/graphql/inputs/message.input.ts
|
|
1546
2072
|
var import_type_graphql3 = require("type-graphql");
|
|
@@ -1557,6 +2083,7 @@ var ActionExecutionScope;
|
|
|
1557
2083
|
(function(ActionExecutionScope2) {
|
|
1558
2084
|
ActionExecutionScope2["server"] = "server";
|
|
1559
2085
|
ActionExecutionScope2["client"] = "client";
|
|
2086
|
+
ActionExecutionScope2["passThrough"] = "passThrough";
|
|
1560
2087
|
})(ActionExecutionScope || (ActionExecutionScope = {}));
|
|
1561
2088
|
var CopilotRequestType;
|
|
1562
2089
|
(function(CopilotRequestType2) {
|
|
@@ -1600,6 +2127,7 @@ var MessageInput = class extends BaseMessage {
|
|
|
1600
2127
|
textMessage;
|
|
1601
2128
|
actionExecutionMessage;
|
|
1602
2129
|
resultMessage;
|
|
2130
|
+
agentStateMessage;
|
|
1603
2131
|
};
|
|
1604
2132
|
__name(MessageInput, "MessageInput");
|
|
1605
2133
|
_ts_decorate2([
|
|
@@ -1620,6 +2148,12 @@ _ts_decorate2([
|
|
|
1620
2148
|
}),
|
|
1621
2149
|
_ts_metadata2("design:type", typeof ResultMessageInput === "undefined" ? Object : ResultMessageInput)
|
|
1622
2150
|
], MessageInput.prototype, "resultMessage", void 0);
|
|
2151
|
+
_ts_decorate2([
|
|
2152
|
+
(0, import_type_graphql3.Field)(() => AgentStateMessageInput, {
|
|
2153
|
+
nullable: true
|
|
2154
|
+
}),
|
|
2155
|
+
_ts_metadata2("design:type", typeof AgentStateMessageInput === "undefined" ? Object : AgentStateMessageInput)
|
|
2156
|
+
], MessageInput.prototype, "agentStateMessage", void 0);
|
|
1623
2157
|
MessageInput = _ts_decorate2([
|
|
1624
2158
|
(0, import_type_graphql3.InputType)()
|
|
1625
2159
|
], MessageInput);
|
|
@@ -1681,6 +2215,52 @@ _ts_decorate2([
|
|
|
1681
2215
|
ResultMessageInput = _ts_decorate2([
|
|
1682
2216
|
(0, import_type_graphql3.InputType)()
|
|
1683
2217
|
], ResultMessageInput);
|
|
2218
|
+
var AgentStateMessageInput = class {
|
|
2219
|
+
threadId;
|
|
2220
|
+
agentName;
|
|
2221
|
+
role;
|
|
2222
|
+
state;
|
|
2223
|
+
running;
|
|
2224
|
+
nodeName;
|
|
2225
|
+
runId;
|
|
2226
|
+
active;
|
|
2227
|
+
};
|
|
2228
|
+
__name(AgentStateMessageInput, "AgentStateMessageInput");
|
|
2229
|
+
_ts_decorate2([
|
|
2230
|
+
(0, import_type_graphql3.Field)(() => String),
|
|
2231
|
+
_ts_metadata2("design:type", String)
|
|
2232
|
+
], AgentStateMessageInput.prototype, "threadId", void 0);
|
|
2233
|
+
_ts_decorate2([
|
|
2234
|
+
(0, import_type_graphql3.Field)(() => String),
|
|
2235
|
+
_ts_metadata2("design:type", String)
|
|
2236
|
+
], AgentStateMessageInput.prototype, "agentName", void 0);
|
|
2237
|
+
_ts_decorate2([
|
|
2238
|
+
(0, import_type_graphql3.Field)(() => MessageRole),
|
|
2239
|
+
_ts_metadata2("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
|
|
2240
|
+
], AgentStateMessageInput.prototype, "role", void 0);
|
|
2241
|
+
_ts_decorate2([
|
|
2242
|
+
(0, import_type_graphql3.Field)(() => String),
|
|
2243
|
+
_ts_metadata2("design:type", String)
|
|
2244
|
+
], AgentStateMessageInput.prototype, "state", void 0);
|
|
2245
|
+
_ts_decorate2([
|
|
2246
|
+
(0, import_type_graphql3.Field)(() => Boolean),
|
|
2247
|
+
_ts_metadata2("design:type", Boolean)
|
|
2248
|
+
], AgentStateMessageInput.prototype, "running", void 0);
|
|
2249
|
+
_ts_decorate2([
|
|
2250
|
+
(0, import_type_graphql3.Field)(() => String),
|
|
2251
|
+
_ts_metadata2("design:type", String)
|
|
2252
|
+
], AgentStateMessageInput.prototype, "nodeName", void 0);
|
|
2253
|
+
_ts_decorate2([
|
|
2254
|
+
(0, import_type_graphql3.Field)(() => String),
|
|
2255
|
+
_ts_metadata2("design:type", String)
|
|
2256
|
+
], AgentStateMessageInput.prototype, "runId", void 0);
|
|
2257
|
+
_ts_decorate2([
|
|
2258
|
+
(0, import_type_graphql3.Field)(() => Boolean),
|
|
2259
|
+
_ts_metadata2("design:type", Boolean)
|
|
2260
|
+
], AgentStateMessageInput.prototype, "active", void 0);
|
|
2261
|
+
AgentStateMessageInput = _ts_decorate2([
|
|
2262
|
+
(0, import_type_graphql3.InputType)()
|
|
2263
|
+
], AgentStateMessageInput);
|
|
1684
2264
|
|
|
1685
2265
|
// src/graphql/inputs/frontend.input.ts
|
|
1686
2266
|
var import_type_graphql5 = require("type-graphql");
|
|
@@ -1745,6 +2325,7 @@ __name(_ts_metadata4, "_ts_metadata");
|
|
|
1745
2325
|
var FrontendInput = class {
|
|
1746
2326
|
toDeprecate_fullContext;
|
|
1747
2327
|
actions;
|
|
2328
|
+
url;
|
|
1748
2329
|
};
|
|
1749
2330
|
__name(FrontendInput, "FrontendInput");
|
|
1750
2331
|
_ts_decorate4([
|
|
@@ -1759,6 +2340,12 @@ _ts_decorate4([
|
|
|
1759
2340
|
]),
|
|
1760
2341
|
_ts_metadata4("design:type", Array)
|
|
1761
2342
|
], FrontendInput.prototype, "actions", void 0);
|
|
2343
|
+
_ts_decorate4([
|
|
2344
|
+
(0, import_type_graphql5.Field)(() => String, {
|
|
2345
|
+
nullable: true
|
|
2346
|
+
}),
|
|
2347
|
+
_ts_metadata4("design:type", String)
|
|
2348
|
+
], FrontendInput.prototype, "url", void 0);
|
|
1762
2349
|
FrontendInput = _ts_decorate4([
|
|
1763
2350
|
(0, import_type_graphql5.InputType)()
|
|
1764
2351
|
], FrontendInput);
|
|
@@ -1915,7 +2502,8 @@ ForwardedParametersInput = _ts_decorate7([
|
|
|
1915
2502
|
(0, import_type_graphql8.InputType)()
|
|
1916
2503
|
], ForwardedParametersInput);
|
|
1917
2504
|
|
|
1918
|
-
// src/graphql/inputs/
|
|
2505
|
+
// src/graphql/inputs/agent-session.input.ts
|
|
2506
|
+
var import_type_graphql9 = require("type-graphql");
|
|
1919
2507
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
1920
2508
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1921
2509
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1932,18 +2520,96 @@ function _ts_metadata8(k, v) {
|
|
|
1932
2520
|
return Reflect.metadata(k, v);
|
|
1933
2521
|
}
|
|
1934
2522
|
__name(_ts_metadata8, "_ts_metadata");
|
|
2523
|
+
var AgentSessionInput = class {
|
|
2524
|
+
agentName;
|
|
2525
|
+
threadId;
|
|
2526
|
+
nodeName;
|
|
2527
|
+
};
|
|
2528
|
+
__name(AgentSessionInput, "AgentSessionInput");
|
|
2529
|
+
_ts_decorate8([
|
|
2530
|
+
(0, import_type_graphql9.Field)(() => String),
|
|
2531
|
+
_ts_metadata8("design:type", String)
|
|
2532
|
+
], AgentSessionInput.prototype, "agentName", void 0);
|
|
2533
|
+
_ts_decorate8([
|
|
2534
|
+
(0, import_type_graphql9.Field)(() => String, {
|
|
2535
|
+
nullable: true
|
|
2536
|
+
}),
|
|
2537
|
+
_ts_metadata8("design:type", String)
|
|
2538
|
+
], AgentSessionInput.prototype, "threadId", void 0);
|
|
2539
|
+
_ts_decorate8([
|
|
2540
|
+
(0, import_type_graphql9.Field)(() => String, {
|
|
2541
|
+
nullable: true
|
|
2542
|
+
}),
|
|
2543
|
+
_ts_metadata8("design:type", String)
|
|
2544
|
+
], AgentSessionInput.prototype, "nodeName", void 0);
|
|
2545
|
+
AgentSessionInput = _ts_decorate8([
|
|
2546
|
+
(0, import_type_graphql9.InputType)()
|
|
2547
|
+
], AgentSessionInput);
|
|
2548
|
+
|
|
2549
|
+
// src/graphql/inputs/agent-state.input.ts
|
|
2550
|
+
var import_type_graphql10 = require("type-graphql");
|
|
2551
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
2552
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2553
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2554
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
2555
|
+
else
|
|
2556
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
2557
|
+
if (d = decorators[i])
|
|
2558
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2559
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2560
|
+
}
|
|
2561
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
2562
|
+
function _ts_metadata9(k, v) {
|
|
2563
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2564
|
+
return Reflect.metadata(k, v);
|
|
2565
|
+
}
|
|
2566
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
2567
|
+
var AgentStateInput = class {
|
|
2568
|
+
agentName;
|
|
2569
|
+
state;
|
|
2570
|
+
};
|
|
2571
|
+
__name(AgentStateInput, "AgentStateInput");
|
|
2572
|
+
_ts_decorate9([
|
|
2573
|
+
(0, import_type_graphql10.Field)(() => String),
|
|
2574
|
+
_ts_metadata9("design:type", String)
|
|
2575
|
+
], AgentStateInput.prototype, "agentName", void 0);
|
|
2576
|
+
_ts_decorate9([
|
|
2577
|
+
(0, import_type_graphql10.Field)(() => String),
|
|
2578
|
+
_ts_metadata9("design:type", String)
|
|
2579
|
+
], AgentStateInput.prototype, "state", void 0);
|
|
2580
|
+
AgentStateInput = _ts_decorate9([
|
|
2581
|
+
(0, import_type_graphql10.InputType)()
|
|
2582
|
+
], AgentStateInput);
|
|
2583
|
+
|
|
2584
|
+
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
2585
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
2586
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2587
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2588
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
2589
|
+
else
|
|
2590
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
2591
|
+
if (d = decorators[i])
|
|
2592
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2593
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2594
|
+
}
|
|
2595
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
2596
|
+
function _ts_metadata10(k, v) {
|
|
2597
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2598
|
+
return Reflect.metadata(k, v);
|
|
2599
|
+
}
|
|
2600
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
1935
2601
|
var GenerateCopilotResponseMetadataInput = class {
|
|
1936
2602
|
requestType;
|
|
1937
2603
|
};
|
|
1938
2604
|
__name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
|
|
1939
|
-
|
|
1940
|
-
(0,
|
|
2605
|
+
_ts_decorate10([
|
|
2606
|
+
(0, import_type_graphql11.Field)(() => CopilotRequestType, {
|
|
1941
2607
|
nullable: true
|
|
1942
2608
|
}),
|
|
1943
|
-
|
|
2609
|
+
_ts_metadata10("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
|
|
1944
2610
|
], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
|
|
1945
|
-
GenerateCopilotResponseMetadataInput =
|
|
1946
|
-
(0,
|
|
2611
|
+
GenerateCopilotResponseMetadataInput = _ts_decorate10([
|
|
2612
|
+
(0, import_type_graphql11.InputType)()
|
|
1947
2613
|
], GenerateCopilotResponseMetadataInput);
|
|
1948
2614
|
var GenerateCopilotResponseInput = class {
|
|
1949
2615
|
metadata;
|
|
@@ -1953,58 +2619,81 @@ var GenerateCopilotResponseInput = class {
|
|
|
1953
2619
|
frontend;
|
|
1954
2620
|
cloud;
|
|
1955
2621
|
forwardedParameters;
|
|
2622
|
+
agentSession;
|
|
2623
|
+
agentState;
|
|
2624
|
+
agentStates;
|
|
1956
2625
|
};
|
|
1957
2626
|
__name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
|
|
1958
|
-
|
|
1959
|
-
(0,
|
|
2627
|
+
_ts_decorate10([
|
|
2628
|
+
(0, import_type_graphql11.Field)(() => GenerateCopilotResponseMetadataInput, {
|
|
1960
2629
|
nullable: false
|
|
1961
2630
|
}),
|
|
1962
|
-
|
|
2631
|
+
_ts_metadata10("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
|
|
1963
2632
|
], GenerateCopilotResponseInput.prototype, "metadata", void 0);
|
|
1964
|
-
|
|
1965
|
-
(0,
|
|
2633
|
+
_ts_decorate10([
|
|
2634
|
+
(0, import_type_graphql11.Field)(() => String, {
|
|
1966
2635
|
nullable: true
|
|
1967
2636
|
}),
|
|
1968
|
-
|
|
2637
|
+
_ts_metadata10("design:type", String)
|
|
1969
2638
|
], GenerateCopilotResponseInput.prototype, "threadId", void 0);
|
|
1970
|
-
|
|
1971
|
-
(0,
|
|
2639
|
+
_ts_decorate10([
|
|
2640
|
+
(0, import_type_graphql11.Field)(() => String, {
|
|
1972
2641
|
nullable: true
|
|
1973
2642
|
}),
|
|
1974
|
-
|
|
2643
|
+
_ts_metadata10("design:type", String)
|
|
1975
2644
|
], GenerateCopilotResponseInput.prototype, "runId", void 0);
|
|
1976
|
-
|
|
1977
|
-
(0,
|
|
2645
|
+
_ts_decorate10([
|
|
2646
|
+
(0, import_type_graphql11.Field)(() => [
|
|
1978
2647
|
MessageInput
|
|
1979
2648
|
]),
|
|
1980
|
-
|
|
2649
|
+
_ts_metadata10("design:type", Array)
|
|
1981
2650
|
], GenerateCopilotResponseInput.prototype, "messages", void 0);
|
|
1982
|
-
|
|
1983
|
-
(0,
|
|
1984
|
-
|
|
2651
|
+
_ts_decorate10([
|
|
2652
|
+
(0, import_type_graphql11.Field)(() => FrontendInput),
|
|
2653
|
+
_ts_metadata10("design:type", typeof FrontendInput === "undefined" ? Object : FrontendInput)
|
|
1985
2654
|
], GenerateCopilotResponseInput.prototype, "frontend", void 0);
|
|
1986
|
-
|
|
1987
|
-
(0,
|
|
2655
|
+
_ts_decorate10([
|
|
2656
|
+
(0, import_type_graphql11.Field)(() => CloudInput, {
|
|
1988
2657
|
nullable: true
|
|
1989
2658
|
}),
|
|
1990
|
-
|
|
2659
|
+
_ts_metadata10("design:type", typeof CloudInput === "undefined" ? Object : CloudInput)
|
|
1991
2660
|
], GenerateCopilotResponseInput.prototype, "cloud", void 0);
|
|
1992
|
-
|
|
1993
|
-
(0,
|
|
2661
|
+
_ts_decorate10([
|
|
2662
|
+
(0, import_type_graphql11.Field)(() => ForwardedParametersInput, {
|
|
1994
2663
|
nullable: true
|
|
1995
2664
|
}),
|
|
1996
|
-
|
|
2665
|
+
_ts_metadata10("design:type", typeof ForwardedParametersInput === "undefined" ? Object : ForwardedParametersInput)
|
|
1997
2666
|
], GenerateCopilotResponseInput.prototype, "forwardedParameters", void 0);
|
|
1998
|
-
|
|
1999
|
-
(0,
|
|
2667
|
+
_ts_decorate10([
|
|
2668
|
+
(0, import_type_graphql11.Field)(() => AgentSessionInput, {
|
|
2669
|
+
nullable: true
|
|
2670
|
+
}),
|
|
2671
|
+
_ts_metadata10("design:type", typeof AgentSessionInput === "undefined" ? Object : AgentSessionInput)
|
|
2672
|
+
], GenerateCopilotResponseInput.prototype, "agentSession", void 0);
|
|
2673
|
+
_ts_decorate10([
|
|
2674
|
+
(0, import_type_graphql11.Field)(() => AgentStateInput, {
|
|
2675
|
+
nullable: true
|
|
2676
|
+
}),
|
|
2677
|
+
_ts_metadata10("design:type", typeof AgentStateInput === "undefined" ? Object : AgentStateInput)
|
|
2678
|
+
], GenerateCopilotResponseInput.prototype, "agentState", void 0);
|
|
2679
|
+
_ts_decorate10([
|
|
2680
|
+
(0, import_type_graphql11.Field)(() => [
|
|
2681
|
+
AgentStateInput
|
|
2682
|
+
], {
|
|
2683
|
+
nullable: true
|
|
2684
|
+
}),
|
|
2685
|
+
_ts_metadata10("design:type", Array)
|
|
2686
|
+
], GenerateCopilotResponseInput.prototype, "agentStates", void 0);
|
|
2687
|
+
GenerateCopilotResponseInput = _ts_decorate10([
|
|
2688
|
+
(0, import_type_graphql11.InputType)()
|
|
2000
2689
|
], GenerateCopilotResponseInput);
|
|
2001
2690
|
|
|
2002
2691
|
// src/graphql/types/copilot-response.type.ts
|
|
2003
|
-
var
|
|
2692
|
+
var import_type_graphql14 = require("type-graphql");
|
|
2004
2693
|
|
|
2005
2694
|
// src/graphql/types/message-status.type.ts
|
|
2006
|
-
var
|
|
2007
|
-
function
|
|
2695
|
+
var import_type_graphql12 = require("type-graphql");
|
|
2696
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
2008
2697
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2009
2698
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2010
2699
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2014,58 +2703,58 @@ function _ts_decorate9(decorators, target, key, desc) {
|
|
|
2014
2703
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2015
2704
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2016
2705
|
}
|
|
2017
|
-
__name(
|
|
2018
|
-
function
|
|
2706
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
2707
|
+
function _ts_metadata11(k, v) {
|
|
2019
2708
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2020
2709
|
return Reflect.metadata(k, v);
|
|
2021
2710
|
}
|
|
2022
|
-
__name(
|
|
2711
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
2023
2712
|
var MessageStatusCode;
|
|
2024
2713
|
(function(MessageStatusCode2) {
|
|
2025
2714
|
MessageStatusCode2["Pending"] = "pending";
|
|
2026
2715
|
MessageStatusCode2["Success"] = "success";
|
|
2027
2716
|
MessageStatusCode2["Failed"] = "failed";
|
|
2028
2717
|
})(MessageStatusCode || (MessageStatusCode = {}));
|
|
2029
|
-
(0,
|
|
2718
|
+
(0, import_type_graphql12.registerEnumType)(MessageStatusCode, {
|
|
2030
2719
|
name: "MessageStatusCode"
|
|
2031
2720
|
});
|
|
2032
2721
|
var BaseMessageStatus = /* @__PURE__ */ __name(class BaseMessageStatus2 {
|
|
2033
2722
|
code;
|
|
2034
2723
|
}, "BaseMessageStatus");
|
|
2035
|
-
|
|
2036
|
-
(0,
|
|
2037
|
-
|
|
2724
|
+
_ts_decorate11([
|
|
2725
|
+
(0, import_type_graphql12.Field)(() => MessageStatusCode),
|
|
2726
|
+
_ts_metadata11("design:type", String)
|
|
2038
2727
|
], BaseMessageStatus.prototype, "code", void 0);
|
|
2039
|
-
BaseMessageStatus =
|
|
2040
|
-
(0,
|
|
2728
|
+
BaseMessageStatus = _ts_decorate11([
|
|
2729
|
+
(0, import_type_graphql12.ObjectType)()
|
|
2041
2730
|
], BaseMessageStatus);
|
|
2042
2731
|
var PendingMessageStatus = class extends BaseMessageStatus {
|
|
2043
2732
|
code = "pending";
|
|
2044
2733
|
};
|
|
2045
2734
|
__name(PendingMessageStatus, "PendingMessageStatus");
|
|
2046
|
-
PendingMessageStatus =
|
|
2047
|
-
(0,
|
|
2735
|
+
PendingMessageStatus = _ts_decorate11([
|
|
2736
|
+
(0, import_type_graphql12.ObjectType)()
|
|
2048
2737
|
], PendingMessageStatus);
|
|
2049
2738
|
var SuccessMessageStatus = class extends BaseMessageStatus {
|
|
2050
2739
|
code = "success";
|
|
2051
2740
|
};
|
|
2052
2741
|
__name(SuccessMessageStatus, "SuccessMessageStatus");
|
|
2053
|
-
SuccessMessageStatus =
|
|
2054
|
-
(0,
|
|
2742
|
+
SuccessMessageStatus = _ts_decorate11([
|
|
2743
|
+
(0, import_type_graphql12.ObjectType)()
|
|
2055
2744
|
], SuccessMessageStatus);
|
|
2056
2745
|
var FailedMessageStatus = class extends BaseMessageStatus {
|
|
2057
2746
|
code = "failed";
|
|
2058
2747
|
reason;
|
|
2059
2748
|
};
|
|
2060
2749
|
__name(FailedMessageStatus, "FailedMessageStatus");
|
|
2061
|
-
|
|
2062
|
-
(0,
|
|
2063
|
-
|
|
2750
|
+
_ts_decorate11([
|
|
2751
|
+
(0, import_type_graphql12.Field)(() => String),
|
|
2752
|
+
_ts_metadata11("design:type", String)
|
|
2064
2753
|
], FailedMessageStatus.prototype, "reason", void 0);
|
|
2065
|
-
FailedMessageStatus =
|
|
2066
|
-
(0,
|
|
2754
|
+
FailedMessageStatus = _ts_decorate11([
|
|
2755
|
+
(0, import_type_graphql12.ObjectType)()
|
|
2067
2756
|
], FailedMessageStatus);
|
|
2068
|
-
var MessageStatusUnion = (0,
|
|
2757
|
+
var MessageStatusUnion = (0, import_type_graphql12.createUnionType)({
|
|
2069
2758
|
name: "MessageStatus",
|
|
2070
2759
|
types: () => [
|
|
2071
2760
|
PendingMessageStatus,
|
|
@@ -2076,8 +2765,8 @@ var MessageStatusUnion = (0, import_type_graphql10.createUnionType)({
|
|
|
2076
2765
|
|
|
2077
2766
|
// src/graphql/types/response-status.type.ts
|
|
2078
2767
|
var import_graphql_scalars = require("graphql-scalars");
|
|
2079
|
-
var
|
|
2080
|
-
function
|
|
2768
|
+
var import_type_graphql13 = require("type-graphql");
|
|
2769
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
2081
2770
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2082
2771
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2083
2772
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2087,30 +2776,30 @@ function _ts_decorate10(decorators, target, key, desc) {
|
|
|
2087
2776
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2088
2777
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2089
2778
|
}
|
|
2090
|
-
__name(
|
|
2091
|
-
function
|
|
2779
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
2780
|
+
function _ts_metadata12(k, v) {
|
|
2092
2781
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2093
2782
|
return Reflect.metadata(k, v);
|
|
2094
2783
|
}
|
|
2095
|
-
__name(
|
|
2784
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
2096
2785
|
var ResponseStatusCode;
|
|
2097
2786
|
(function(ResponseStatusCode2) {
|
|
2098
2787
|
ResponseStatusCode2["Pending"] = "pending";
|
|
2099
2788
|
ResponseStatusCode2["Success"] = "success";
|
|
2100
2789
|
ResponseStatusCode2["Failed"] = "failed";
|
|
2101
2790
|
})(ResponseStatusCode || (ResponseStatusCode = {}));
|
|
2102
|
-
(0,
|
|
2791
|
+
(0, import_type_graphql13.registerEnumType)(ResponseStatusCode, {
|
|
2103
2792
|
name: "ResponseStatusCode"
|
|
2104
2793
|
});
|
|
2105
2794
|
var BaseResponseStatus = /* @__PURE__ */ __name(class BaseResponseStatus2 {
|
|
2106
2795
|
code;
|
|
2107
2796
|
}, "BaseResponseStatus");
|
|
2108
|
-
|
|
2109
|
-
(0,
|
|
2110
|
-
|
|
2797
|
+
_ts_decorate12([
|
|
2798
|
+
(0, import_type_graphql13.Field)(() => ResponseStatusCode),
|
|
2799
|
+
_ts_metadata12("design:type", String)
|
|
2111
2800
|
], BaseResponseStatus.prototype, "code", void 0);
|
|
2112
|
-
BaseResponseStatus =
|
|
2113
|
-
(0,
|
|
2801
|
+
BaseResponseStatus = _ts_decorate12([
|
|
2802
|
+
(0, import_type_graphql13.InterfaceType)({
|
|
2114
2803
|
resolveType(value) {
|
|
2115
2804
|
if (value.code === "success") {
|
|
2116
2805
|
return SuccessResponseStatus;
|
|
@@ -2122,14 +2811,14 @@ BaseResponseStatus = _ts_decorate10([
|
|
|
2122
2811
|
return void 0;
|
|
2123
2812
|
}
|
|
2124
2813
|
}),
|
|
2125
|
-
(0,
|
|
2814
|
+
(0, import_type_graphql13.ObjectType)()
|
|
2126
2815
|
], BaseResponseStatus);
|
|
2127
2816
|
var PendingResponseStatus = class extends BaseResponseStatus {
|
|
2128
2817
|
code = "pending";
|
|
2129
2818
|
};
|
|
2130
2819
|
__name(PendingResponseStatus, "PendingResponseStatus");
|
|
2131
|
-
PendingResponseStatus =
|
|
2132
|
-
(0,
|
|
2820
|
+
PendingResponseStatus = _ts_decorate12([
|
|
2821
|
+
(0, import_type_graphql13.ObjectType)({
|
|
2133
2822
|
implements: BaseResponseStatus
|
|
2134
2823
|
})
|
|
2135
2824
|
], PendingResponseStatus);
|
|
@@ -2137,8 +2826,8 @@ var SuccessResponseStatus = class extends BaseResponseStatus {
|
|
|
2137
2826
|
code = "success";
|
|
2138
2827
|
};
|
|
2139
2828
|
__name(SuccessResponseStatus, "SuccessResponseStatus");
|
|
2140
|
-
SuccessResponseStatus =
|
|
2141
|
-
(0,
|
|
2829
|
+
SuccessResponseStatus = _ts_decorate12([
|
|
2830
|
+
(0, import_type_graphql13.ObjectType)({
|
|
2142
2831
|
implements: BaseResponseStatus
|
|
2143
2832
|
})
|
|
2144
2833
|
], SuccessResponseStatus);
|
|
@@ -2148,7 +2837,7 @@ var FailedResponseStatusReason;
|
|
|
2148
2837
|
FailedResponseStatusReason2["MESSAGE_STREAM_INTERRUPTED"] = "MESSAGE_STREAM_INTERRUPTED";
|
|
2149
2838
|
FailedResponseStatusReason2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
2150
2839
|
})(FailedResponseStatusReason || (FailedResponseStatusReason = {}));
|
|
2151
|
-
(0,
|
|
2840
|
+
(0, import_type_graphql13.registerEnumType)(FailedResponseStatusReason, {
|
|
2152
2841
|
name: "FailedResponseStatusReason"
|
|
2153
2842
|
});
|
|
2154
2843
|
var FailedResponseStatus = class extends BaseResponseStatus {
|
|
@@ -2157,22 +2846,22 @@ var FailedResponseStatus = class extends BaseResponseStatus {
|
|
|
2157
2846
|
details = null;
|
|
2158
2847
|
};
|
|
2159
2848
|
__name(FailedResponseStatus, "FailedResponseStatus");
|
|
2160
|
-
|
|
2161
|
-
(0,
|
|
2162
|
-
|
|
2849
|
+
_ts_decorate12([
|
|
2850
|
+
(0, import_type_graphql13.Field)(() => FailedResponseStatusReason),
|
|
2851
|
+
_ts_metadata12("design:type", String)
|
|
2163
2852
|
], FailedResponseStatus.prototype, "reason", void 0);
|
|
2164
|
-
|
|
2165
|
-
(0,
|
|
2853
|
+
_ts_decorate12([
|
|
2854
|
+
(0, import_type_graphql13.Field)(() => import_graphql_scalars.GraphQLJSON, {
|
|
2166
2855
|
nullable: true
|
|
2167
2856
|
}),
|
|
2168
|
-
|
|
2857
|
+
_ts_metadata12("design:type", typeof Record === "undefined" ? Object : Record)
|
|
2169
2858
|
], FailedResponseStatus.prototype, "details", void 0);
|
|
2170
|
-
FailedResponseStatus =
|
|
2171
|
-
(0,
|
|
2859
|
+
FailedResponseStatus = _ts_decorate12([
|
|
2860
|
+
(0, import_type_graphql13.ObjectType)({
|
|
2172
2861
|
implements: BaseResponseStatus
|
|
2173
2862
|
})
|
|
2174
2863
|
], FailedResponseStatus);
|
|
2175
|
-
var ResponseStatusUnion = (0,
|
|
2864
|
+
var ResponseStatusUnion = (0, import_type_graphql13.createUnionType)({
|
|
2176
2865
|
name: "ResponseStatus",
|
|
2177
2866
|
types: () => [
|
|
2178
2867
|
PendingResponseStatus,
|
|
@@ -2182,7 +2871,7 @@ var ResponseStatusUnion = (0, import_type_graphql11.createUnionType)({
|
|
|
2182
2871
|
});
|
|
2183
2872
|
|
|
2184
2873
|
// src/graphql/types/copilot-response.type.ts
|
|
2185
|
-
function
|
|
2874
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
2186
2875
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2187
2876
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2188
2877
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2192,31 +2881,31 @@ function _ts_decorate11(decorators, target, key, desc) {
|
|
|
2192
2881
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2193
2882
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2194
2883
|
}
|
|
2195
|
-
__name(
|
|
2196
|
-
function
|
|
2884
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
2885
|
+
function _ts_metadata13(k, v) {
|
|
2197
2886
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2198
2887
|
return Reflect.metadata(k, v);
|
|
2199
2888
|
}
|
|
2200
|
-
__name(
|
|
2889
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
2201
2890
|
var BaseMessageOutput = /* @__PURE__ */ __name(class BaseMessageOutput2 {
|
|
2202
2891
|
id;
|
|
2203
2892
|
createdAt;
|
|
2204
2893
|
status;
|
|
2205
2894
|
}, "BaseMessageOutput");
|
|
2206
|
-
|
|
2207
|
-
(0,
|
|
2208
|
-
|
|
2895
|
+
_ts_decorate13([
|
|
2896
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
2897
|
+
_ts_metadata13("design:type", String)
|
|
2209
2898
|
], BaseMessageOutput.prototype, "id", void 0);
|
|
2210
|
-
|
|
2211
|
-
(0,
|
|
2212
|
-
|
|
2899
|
+
_ts_decorate13([
|
|
2900
|
+
(0, import_type_graphql14.Field)(() => Date),
|
|
2901
|
+
_ts_metadata13("design:type", typeof Date === "undefined" ? Object : Date)
|
|
2213
2902
|
], BaseMessageOutput.prototype, "createdAt", void 0);
|
|
2214
|
-
|
|
2215
|
-
(0,
|
|
2216
|
-
|
|
2903
|
+
_ts_decorate13([
|
|
2904
|
+
(0, import_type_graphql14.Field)(() => MessageStatusUnion),
|
|
2905
|
+
_ts_metadata13("design:type", Object)
|
|
2217
2906
|
], BaseMessageOutput.prototype, "status", void 0);
|
|
2218
|
-
BaseMessageOutput =
|
|
2219
|
-
(0,
|
|
2907
|
+
BaseMessageOutput = _ts_decorate13([
|
|
2908
|
+
(0, import_type_graphql14.InterfaceType)({
|
|
2220
2909
|
resolveType(value) {
|
|
2221
2910
|
if (value.hasOwnProperty("content")) {
|
|
2222
2911
|
return TextMessageOutput;
|
|
@@ -2224,6 +2913,8 @@ BaseMessageOutput = _ts_decorate11([
|
|
|
2224
2913
|
return ActionExecutionMessageOutput;
|
|
2225
2914
|
} else if (value.hasOwnProperty("result")) {
|
|
2226
2915
|
return ResultMessageOutput;
|
|
2916
|
+
} else if (value.hasOwnProperty("state")) {
|
|
2917
|
+
return AgentStateMessageOutput;
|
|
2227
2918
|
}
|
|
2228
2919
|
return void 0;
|
|
2229
2920
|
}
|
|
@@ -2234,18 +2925,18 @@ var TextMessageOutput = class {
|
|
|
2234
2925
|
content;
|
|
2235
2926
|
};
|
|
2236
2927
|
__name(TextMessageOutput, "TextMessageOutput");
|
|
2237
|
-
|
|
2238
|
-
(0,
|
|
2239
|
-
|
|
2928
|
+
_ts_decorate13([
|
|
2929
|
+
(0, import_type_graphql14.Field)(() => MessageRole),
|
|
2930
|
+
_ts_metadata13("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
|
|
2240
2931
|
], TextMessageOutput.prototype, "role", void 0);
|
|
2241
|
-
|
|
2242
|
-
(0,
|
|
2932
|
+
_ts_decorate13([
|
|
2933
|
+
(0, import_type_graphql14.Field)(() => [
|
|
2243
2934
|
String
|
|
2244
2935
|
]),
|
|
2245
|
-
|
|
2936
|
+
_ts_metadata13("design:type", Array)
|
|
2246
2937
|
], TextMessageOutput.prototype, "content", void 0);
|
|
2247
|
-
TextMessageOutput =
|
|
2248
|
-
(0,
|
|
2938
|
+
TextMessageOutput = _ts_decorate13([
|
|
2939
|
+
(0, import_type_graphql14.ObjectType)({
|
|
2249
2940
|
implements: BaseMessageOutput
|
|
2250
2941
|
})
|
|
2251
2942
|
], TextMessageOutput);
|
|
@@ -2255,22 +2946,22 @@ var ActionExecutionMessageOutput = class {
|
|
|
2255
2946
|
arguments;
|
|
2256
2947
|
};
|
|
2257
2948
|
__name(ActionExecutionMessageOutput, "ActionExecutionMessageOutput");
|
|
2258
|
-
|
|
2259
|
-
(0,
|
|
2260
|
-
|
|
2949
|
+
_ts_decorate13([
|
|
2950
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
2951
|
+
_ts_metadata13("design:type", String)
|
|
2261
2952
|
], ActionExecutionMessageOutput.prototype, "name", void 0);
|
|
2262
|
-
|
|
2263
|
-
(0,
|
|
2264
|
-
|
|
2953
|
+
_ts_decorate13([
|
|
2954
|
+
(0, import_type_graphql14.Field)(() => ActionExecutionScope),
|
|
2955
|
+
_ts_metadata13("design:type", typeof ActionExecutionScope === "undefined" ? Object : ActionExecutionScope)
|
|
2265
2956
|
], ActionExecutionMessageOutput.prototype, "scope", void 0);
|
|
2266
|
-
|
|
2267
|
-
(0,
|
|
2957
|
+
_ts_decorate13([
|
|
2958
|
+
(0, import_type_graphql14.Field)(() => [
|
|
2268
2959
|
String
|
|
2269
2960
|
]),
|
|
2270
|
-
|
|
2961
|
+
_ts_metadata13("design:type", Array)
|
|
2271
2962
|
], ActionExecutionMessageOutput.prototype, "arguments", void 0);
|
|
2272
|
-
ActionExecutionMessageOutput =
|
|
2273
|
-
(0,
|
|
2963
|
+
ActionExecutionMessageOutput = _ts_decorate13([
|
|
2964
|
+
(0, import_type_graphql14.ObjectType)({
|
|
2274
2965
|
implements: BaseMessageOutput
|
|
2275
2966
|
})
|
|
2276
2967
|
], ActionExecutionMessageOutput);
|
|
@@ -2280,23 +2971,71 @@ var ResultMessageOutput = class {
|
|
|
2280
2971
|
result;
|
|
2281
2972
|
};
|
|
2282
2973
|
__name(ResultMessageOutput, "ResultMessageOutput");
|
|
2283
|
-
|
|
2284
|
-
(0,
|
|
2285
|
-
|
|
2974
|
+
_ts_decorate13([
|
|
2975
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
2976
|
+
_ts_metadata13("design:type", String)
|
|
2286
2977
|
], ResultMessageOutput.prototype, "actionExecutionId", void 0);
|
|
2287
|
-
|
|
2288
|
-
(0,
|
|
2289
|
-
|
|
2978
|
+
_ts_decorate13([
|
|
2979
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
2980
|
+
_ts_metadata13("design:type", String)
|
|
2290
2981
|
], ResultMessageOutput.prototype, "actionName", void 0);
|
|
2291
|
-
|
|
2292
|
-
(0,
|
|
2293
|
-
|
|
2982
|
+
_ts_decorate13([
|
|
2983
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
2984
|
+
_ts_metadata13("design:type", String)
|
|
2294
2985
|
], ResultMessageOutput.prototype, "result", void 0);
|
|
2295
|
-
ResultMessageOutput =
|
|
2296
|
-
(0,
|
|
2986
|
+
ResultMessageOutput = _ts_decorate13([
|
|
2987
|
+
(0, import_type_graphql14.ObjectType)({
|
|
2297
2988
|
implements: BaseMessageOutput
|
|
2298
2989
|
})
|
|
2299
2990
|
], ResultMessageOutput);
|
|
2991
|
+
var AgentStateMessageOutput = class {
|
|
2992
|
+
threadId;
|
|
2993
|
+
agentName;
|
|
2994
|
+
nodeName;
|
|
2995
|
+
runId;
|
|
2996
|
+
active;
|
|
2997
|
+
role;
|
|
2998
|
+
state;
|
|
2999
|
+
running;
|
|
3000
|
+
};
|
|
3001
|
+
__name(AgentStateMessageOutput, "AgentStateMessageOutput");
|
|
3002
|
+
_ts_decorate13([
|
|
3003
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
3004
|
+
_ts_metadata13("design:type", String)
|
|
3005
|
+
], AgentStateMessageOutput.prototype, "threadId", void 0);
|
|
3006
|
+
_ts_decorate13([
|
|
3007
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
3008
|
+
_ts_metadata13("design:type", String)
|
|
3009
|
+
], AgentStateMessageOutput.prototype, "agentName", void 0);
|
|
3010
|
+
_ts_decorate13([
|
|
3011
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
3012
|
+
_ts_metadata13("design:type", String)
|
|
3013
|
+
], AgentStateMessageOutput.prototype, "nodeName", void 0);
|
|
3014
|
+
_ts_decorate13([
|
|
3015
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
3016
|
+
_ts_metadata13("design:type", String)
|
|
3017
|
+
], AgentStateMessageOutput.prototype, "runId", void 0);
|
|
3018
|
+
_ts_decorate13([
|
|
3019
|
+
(0, import_type_graphql14.Field)(() => Boolean),
|
|
3020
|
+
_ts_metadata13("design:type", Boolean)
|
|
3021
|
+
], AgentStateMessageOutput.prototype, "active", void 0);
|
|
3022
|
+
_ts_decorate13([
|
|
3023
|
+
(0, import_type_graphql14.Field)(() => MessageRole),
|
|
3024
|
+
_ts_metadata13("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
|
|
3025
|
+
], AgentStateMessageOutput.prototype, "role", void 0);
|
|
3026
|
+
_ts_decorate13([
|
|
3027
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
3028
|
+
_ts_metadata13("design:type", String)
|
|
3029
|
+
], AgentStateMessageOutput.prototype, "state", void 0);
|
|
3030
|
+
_ts_decorate13([
|
|
3031
|
+
(0, import_type_graphql14.Field)(() => Boolean),
|
|
3032
|
+
_ts_metadata13("design:type", Boolean)
|
|
3033
|
+
], AgentStateMessageOutput.prototype, "running", void 0);
|
|
3034
|
+
AgentStateMessageOutput = _ts_decorate13([
|
|
3035
|
+
(0, import_type_graphql14.ObjectType)({
|
|
3036
|
+
implements: BaseMessageOutput
|
|
3037
|
+
})
|
|
3038
|
+
], AgentStateMessageOutput);
|
|
2300
3039
|
var CopilotResponse = class {
|
|
2301
3040
|
threadId;
|
|
2302
3041
|
status;
|
|
@@ -2304,28 +3043,28 @@ var CopilotResponse = class {
|
|
|
2304
3043
|
messages;
|
|
2305
3044
|
};
|
|
2306
3045
|
__name(CopilotResponse, "CopilotResponse");
|
|
2307
|
-
|
|
2308
|
-
(0,
|
|
2309
|
-
|
|
3046
|
+
_ts_decorate13([
|
|
3047
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
3048
|
+
_ts_metadata13("design:type", String)
|
|
2310
3049
|
], CopilotResponse.prototype, "threadId", void 0);
|
|
2311
|
-
|
|
2312
|
-
(0,
|
|
2313
|
-
|
|
3050
|
+
_ts_decorate13([
|
|
3051
|
+
(0, import_type_graphql14.Field)(() => ResponseStatusUnion),
|
|
3052
|
+
_ts_metadata13("design:type", Object)
|
|
2314
3053
|
], CopilotResponse.prototype, "status", void 0);
|
|
2315
|
-
|
|
2316
|
-
(0,
|
|
3054
|
+
_ts_decorate13([
|
|
3055
|
+
(0, import_type_graphql14.Field)({
|
|
2317
3056
|
nullable: true
|
|
2318
3057
|
}),
|
|
2319
|
-
|
|
3058
|
+
_ts_metadata13("design:type", String)
|
|
2320
3059
|
], CopilotResponse.prototype, "runId", void 0);
|
|
2321
|
-
|
|
2322
|
-
(0,
|
|
3060
|
+
_ts_decorate13([
|
|
3061
|
+
(0, import_type_graphql14.Field)(() => [
|
|
2323
3062
|
BaseMessageOutput
|
|
2324
3063
|
]),
|
|
2325
|
-
|
|
3064
|
+
_ts_metadata13("design:type", Array)
|
|
2326
3065
|
], CopilotResponse.prototype, "messages", void 0);
|
|
2327
|
-
CopilotResponse =
|
|
2328
|
-
(0,
|
|
3066
|
+
CopilotResponse = _ts_decorate13([
|
|
3067
|
+
(0, import_type_graphql14.ObjectType)()
|
|
2329
3068
|
], CopilotResponse);
|
|
2330
3069
|
|
|
2331
3070
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
@@ -2367,18 +3106,9 @@ var UnknownErrorResponse = class extends FailedResponseStatus {
|
|
|
2367
3106
|
};
|
|
2368
3107
|
__name(UnknownErrorResponse, "UnknownErrorResponse");
|
|
2369
3108
|
|
|
2370
|
-
// src/lib/telemetry-client.ts
|
|
2371
|
-
var import_shared8 = require("@copilotkit/shared");
|
|
2372
|
-
var packageJson = require_package();
|
|
2373
|
-
var telemetryClient = new import_shared8.TelemetryClient({
|
|
2374
|
-
packageName: packageJson.name,
|
|
2375
|
-
packageVersion: packageJson.version
|
|
2376
|
-
});
|
|
2377
|
-
var telemetry_client_default = telemetryClient;
|
|
2378
|
-
|
|
2379
3109
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
2380
3110
|
var import_shared9 = require("@copilotkit/shared");
|
|
2381
|
-
function
|
|
3111
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
2382
3112
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2383
3113
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2384
3114
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2388,12 +3118,12 @@ function _ts_decorate12(decorators, target, key, desc) {
|
|
|
2388
3118
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2389
3119
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2390
3120
|
}
|
|
2391
|
-
__name(
|
|
2392
|
-
function
|
|
3121
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
3122
|
+
function _ts_metadata14(k, v) {
|
|
2393
3123
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2394
3124
|
return Reflect.metadata(k, v);
|
|
2395
3125
|
}
|
|
2396
|
-
__name(
|
|
3126
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
2397
3127
|
function _ts_param(paramIndex, decorator) {
|
|
2398
3128
|
return function(target, key) {
|
|
2399
3129
|
decorator(target, key, paramIndex);
|
|
@@ -2402,7 +3132,6 @@ function _ts_param(paramIndex, decorator) {
|
|
|
2402
3132
|
__name(_ts_param, "_ts_param");
|
|
2403
3133
|
var invokeGuardrails = /* @__PURE__ */ __name(async ({ baseUrl, copilotCloudPublicApiKey, data, onResult, onError }) => {
|
|
2404
3134
|
var _a;
|
|
2405
|
-
console.log("invokeGuardrails.baseUrl", baseUrl);
|
|
2406
3135
|
if (data.messages.length && ((_a = data.messages[data.messages.length - 1].textMessage) == null ? void 0 : _a.role) === MessageRole.user) {
|
|
2407
3136
|
const messages = data.messages.filter((m) => m.textMessage !== void 0 && (m.textMessage.role === MessageRole.user || m.textMessage.role === MessageRole.assistant)).map((m) => ({
|
|
2408
3137
|
role: m.textMessage.role,
|
|
@@ -2448,8 +3177,6 @@ var CopilotResolver = class {
|
|
|
2448
3177
|
logger2.debug({
|
|
2449
3178
|
data
|
|
2450
3179
|
}, "Generating Copilot response");
|
|
2451
|
-
const copilotRuntime = ctx._copilotkit.runtime;
|
|
2452
|
-
const serviceAdapter = ctx._copilotkit.serviceAdapter;
|
|
2453
3180
|
if (properties) {
|
|
2454
3181
|
logger2.debug("Properties provided, merging with context properties");
|
|
2455
3182
|
ctx.properties = {
|
|
@@ -2457,6 +3184,8 @@ var CopilotResolver = class {
|
|
|
2457
3184
|
...properties
|
|
2458
3185
|
};
|
|
2459
3186
|
}
|
|
3187
|
+
const copilotRuntime = ctx._copilotkit.runtime;
|
|
3188
|
+
const serviceAdapter = ctx._copilotkit.serviceAdapter;
|
|
2460
3189
|
let copilotCloudPublicApiKey = null;
|
|
2461
3190
|
let copilotCloudBaseUrl;
|
|
2462
3191
|
if (data.cloud) {
|
|
@@ -2484,9 +3213,9 @@ var CopilotResolver = class {
|
|
|
2484
3213
|
});
|
|
2485
3214
|
}
|
|
2486
3215
|
logger2.debug("Setting up subjects");
|
|
2487
|
-
const responseStatus$ = new
|
|
2488
|
-
const interruptStreaming$ = new
|
|
2489
|
-
const guardrailsResult$ = new
|
|
3216
|
+
const responseStatus$ = new import_rxjs4.ReplaySubject();
|
|
3217
|
+
const interruptStreaming$ = new import_rxjs4.ReplaySubject();
|
|
3218
|
+
const guardrailsResult$ = new import_rxjs4.ReplaySubject();
|
|
2490
3219
|
let outputMessages = [];
|
|
2491
3220
|
let resolveOutputMessagesPromise;
|
|
2492
3221
|
let rejectOutputMessagesPromise;
|
|
@@ -2495,22 +3224,25 @@ var CopilotResolver = class {
|
|
|
2495
3224
|
rejectOutputMessagesPromise = reject;
|
|
2496
3225
|
});
|
|
2497
3226
|
logger2.debug("Processing");
|
|
2498
|
-
const { eventSource, threadId = (0, import_shared9.randomId)(), runId,
|
|
3227
|
+
const { eventSource, threadId = (0, import_shared9.randomId)(), runId, serverSideActions, actionInputsWithoutAgents } = await copilotRuntime.processRuntimeRequest({
|
|
2499
3228
|
serviceAdapter,
|
|
2500
3229
|
messages: data.messages,
|
|
2501
3230
|
actions: data.frontend.actions,
|
|
2502
3231
|
threadId: data.threadId,
|
|
2503
3232
|
runId: data.runId,
|
|
2504
3233
|
publicApiKey: void 0,
|
|
2505
|
-
properties: ctx.properties || {},
|
|
2506
3234
|
outputMessagesPromise,
|
|
2507
|
-
|
|
3235
|
+
graphqlContext: ctx,
|
|
3236
|
+
forwardedParameters: data.forwardedParameters,
|
|
3237
|
+
agentSession: data.agentSession,
|
|
3238
|
+
agentStates: data.agentStates,
|
|
3239
|
+
url: data.frontend.url
|
|
2508
3240
|
});
|
|
2509
3241
|
logger2.debug("Event source created, creating response");
|
|
2510
3242
|
const response = {
|
|
2511
3243
|
threadId,
|
|
2512
3244
|
runId,
|
|
2513
|
-
status: (0,
|
|
3245
|
+
status: (0, import_rxjs4.firstValueFrom)(responseStatus$),
|
|
2514
3246
|
messages: new import_graphql_yoga.Repeater(async (pushMessage, stopStreamingMessages) => {
|
|
2515
3247
|
var _a2, _b2;
|
|
2516
3248
|
logger2.debug("Messages repeater created");
|
|
@@ -2561,14 +3293,18 @@ var CopilotResolver = class {
|
|
|
2561
3293
|
});
|
|
2562
3294
|
}
|
|
2563
3295
|
let eventStreamSubscription;
|
|
2564
|
-
const eventStream = eventSource.
|
|
2565
|
-
|
|
2566
|
-
guardrailsResult$: ((_b2 = data.cloud) == null ? void 0 : _b2.guardrails) ? guardrailsResult$ : null
|
|
3296
|
+
const eventStream = eventSource.processRuntimeEvents({
|
|
3297
|
+
serverSideActions,
|
|
3298
|
+
guardrailsResult$: ((_b2 = data.cloud) == null ? void 0 : _b2.guardrails) ? guardrailsResult$ : null,
|
|
3299
|
+
actionInputsWithoutAgents: actionInputsWithoutAgents.filter(
|
|
3300
|
+
// TODO-AGENTS: do not exclude ALL server side actions
|
|
3301
|
+
(action) => !serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
|
|
3302
|
+
)
|
|
2567
3303
|
}).pipe(
|
|
2568
3304
|
// shareReplay() ensures that later subscribers will see the whole stream instead of
|
|
2569
3305
|
// just the events that were emitted after the subscriber was added.
|
|
2570
|
-
(0,
|
|
2571
|
-
(0,
|
|
3306
|
+
(0, import_rxjs4.shareReplay)(),
|
|
3307
|
+
(0, import_rxjs4.finalize)(() => {
|
|
2572
3308
|
logger2.debug("Event stream finalized");
|
|
2573
3309
|
})
|
|
2574
3310
|
);
|
|
@@ -2579,22 +3315,22 @@ var CopilotResolver = class {
|
|
|
2579
3315
|
case RuntimeEventTypes.TextMessageStart:
|
|
2580
3316
|
const textMessageContentStream = eventStream.pipe(
|
|
2581
3317
|
// skip until this message start event
|
|
2582
|
-
(0,
|
|
3318
|
+
(0, import_rxjs4.skipWhile)((e) => e !== event),
|
|
2583
3319
|
// take until the message end event
|
|
2584
|
-
(0,
|
|
3320
|
+
(0, import_rxjs4.takeWhile)((e) => e.type != RuntimeEventTypes.TextMessageEnd)
|
|
2585
3321
|
);
|
|
2586
|
-
const streamingTextStatus = new
|
|
3322
|
+
const streamingTextStatus = new import_rxjs4.Subject();
|
|
2587
3323
|
const messageId = (0, import_shared9.randomId)();
|
|
2588
3324
|
pushMessage({
|
|
2589
3325
|
id: messageId,
|
|
2590
|
-
status: (0,
|
|
3326
|
+
status: (0, import_rxjs4.firstValueFrom)(streamingTextStatus),
|
|
2591
3327
|
createdAt: /* @__PURE__ */ new Date(),
|
|
2592
3328
|
role: MessageRole.assistant,
|
|
2593
3329
|
content: new import_graphql_yoga.Repeater(async (pushTextChunk, stopStreamingText) => {
|
|
2594
3330
|
logger2.debug("Text message content repeater created");
|
|
2595
3331
|
const textChunks = [];
|
|
2596
3332
|
let textSubscription;
|
|
2597
|
-
interruptStreaming$.pipe((0,
|
|
3333
|
+
interruptStreaming$.pipe((0, import_rxjs4.shareReplay)(), (0, import_rxjs4.take)(1), (0, import_rxjs4.tap)(({ reason, messageId: messageId2 }) => {
|
|
2598
3334
|
logger2.debug({
|
|
2599
3335
|
reason,
|
|
2600
3336
|
messageId: messageId2
|
|
@@ -2645,11 +3381,11 @@ var CopilotResolver = class {
|
|
|
2645
3381
|
break;
|
|
2646
3382
|
case RuntimeEventTypes.ActionExecutionStart:
|
|
2647
3383
|
logger2.debug("Action execution start event received");
|
|
2648
|
-
const actionExecutionArgumentStream = eventStream.pipe((0,
|
|
2649
|
-
const streamingArgumentsStatus = new
|
|
3384
|
+
const actionExecutionArgumentStream = eventStream.pipe((0, import_rxjs4.skipWhile)((e) => e !== event), (0, import_rxjs4.takeWhile)((e) => e.type != RuntimeEventTypes.ActionExecutionEnd));
|
|
3385
|
+
const streamingArgumentsStatus = new import_rxjs4.Subject();
|
|
2650
3386
|
pushMessage({
|
|
2651
3387
|
id: event.actionExecutionId,
|
|
2652
|
-
status: (0,
|
|
3388
|
+
status: (0, import_rxjs4.firstValueFrom)(streamingArgumentsStatus),
|
|
2653
3389
|
createdAt: /* @__PURE__ */ new Date(),
|
|
2654
3390
|
name: event.actionName,
|
|
2655
3391
|
scope: event.scope,
|
|
@@ -2711,6 +3447,36 @@ var CopilotResolver = class {
|
|
|
2711
3447
|
result: event.result
|
|
2712
3448
|
}));
|
|
2713
3449
|
break;
|
|
3450
|
+
case RuntimeEventTypes.AgentStateMessage:
|
|
3451
|
+
logger2.debug({
|
|
3452
|
+
event
|
|
3453
|
+
}, "Agent message event received");
|
|
3454
|
+
pushMessage({
|
|
3455
|
+
id: (0, import_shared9.randomId)(),
|
|
3456
|
+
status: new SuccessMessageStatus(),
|
|
3457
|
+
threadId: event.threadId,
|
|
3458
|
+
agentName: event.agentName,
|
|
3459
|
+
nodeName: event.nodeName,
|
|
3460
|
+
runId: event.runId,
|
|
3461
|
+
active: event.active,
|
|
3462
|
+
state: event.state,
|
|
3463
|
+
running: event.running,
|
|
3464
|
+
role: MessageRole.assistant,
|
|
3465
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
3466
|
+
});
|
|
3467
|
+
outputMessages.push((0, import_class_transformer2.plainToInstance)(AgentStateMessage, {
|
|
3468
|
+
id: (0, import_shared9.randomId)(),
|
|
3469
|
+
threadId: event.threadId,
|
|
3470
|
+
agentName: event.agentName,
|
|
3471
|
+
nodeName: event.nodeName,
|
|
3472
|
+
runId: event.runId,
|
|
3473
|
+
active: event.active,
|
|
3474
|
+
state: event.state,
|
|
3475
|
+
running: event.running,
|
|
3476
|
+
role: MessageRole.assistant,
|
|
3477
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
3478
|
+
}));
|
|
3479
|
+
break;
|
|
2714
3480
|
}
|
|
2715
3481
|
},
|
|
2716
3482
|
error: (err) => {
|
|
@@ -2729,7 +3495,7 @@ var CopilotResolver = class {
|
|
|
2729
3495
|
logger2.debug("Event stream completed");
|
|
2730
3496
|
if ((_a3 = data.cloud) == null ? void 0 : _a3.guardrails) {
|
|
2731
3497
|
logger2.debug("Guardrails is enabled, waiting for guardrails result");
|
|
2732
|
-
await (0,
|
|
3498
|
+
await (0, import_rxjs4.firstValueFrom)(guardrailsResult$);
|
|
2733
3499
|
}
|
|
2734
3500
|
responseStatus$.next(new SuccessResponseStatus());
|
|
2735
3501
|
eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
|
|
@@ -2743,29 +3509,29 @@ var CopilotResolver = class {
|
|
|
2743
3509
|
}
|
|
2744
3510
|
};
|
|
2745
3511
|
__name(CopilotResolver, "CopilotResolver");
|
|
2746
|
-
|
|
2747
|
-
(0,
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
3512
|
+
_ts_decorate14([
|
|
3513
|
+
(0, import_type_graphql15.Query)(() => String),
|
|
3514
|
+
_ts_metadata14("design:type", Function),
|
|
3515
|
+
_ts_metadata14("design:paramtypes", []),
|
|
3516
|
+
_ts_metadata14("design:returntype", Promise)
|
|
2751
3517
|
], CopilotResolver.prototype, "hello", null);
|
|
2752
|
-
|
|
2753
|
-
(0,
|
|
2754
|
-
_ts_param(0, (0,
|
|
2755
|
-
_ts_param(1, (0,
|
|
2756
|
-
_ts_param(2, (0,
|
|
3518
|
+
_ts_decorate14([
|
|
3519
|
+
(0, import_type_graphql15.Mutation)(() => CopilotResponse),
|
|
3520
|
+
_ts_param(0, (0, import_type_graphql15.Ctx)()),
|
|
3521
|
+
_ts_param(1, (0, import_type_graphql15.Arg)("data")),
|
|
3522
|
+
_ts_param(2, (0, import_type_graphql15.Arg)("properties", () => import_graphql_scalars2.GraphQLJSONObject, {
|
|
2757
3523
|
nullable: true
|
|
2758
3524
|
})),
|
|
2759
|
-
|
|
2760
|
-
|
|
3525
|
+
_ts_metadata14("design:type", Function),
|
|
3526
|
+
_ts_metadata14("design:paramtypes", [
|
|
2761
3527
|
typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
|
|
2762
3528
|
typeof GenerateCopilotResponseInput === "undefined" ? Object : GenerateCopilotResponseInput,
|
|
2763
3529
|
typeof CopilotRequestContextProperties === "undefined" ? Object : CopilotRequestContextProperties
|
|
2764
3530
|
]),
|
|
2765
|
-
|
|
3531
|
+
_ts_metadata14("design:returntype", Promise)
|
|
2766
3532
|
], CopilotResolver.prototype, "generateCopilotResponse", null);
|
|
2767
|
-
CopilotResolver =
|
|
2768
|
-
(0,
|
|
3533
|
+
CopilotResolver = _ts_decorate14([
|
|
3534
|
+
(0, import_type_graphql15.Resolver)(() => CopilotResponse)
|
|
2769
3535
|
], CopilotResolver);
|
|
2770
3536
|
|
|
2771
3537
|
// src/lib/integrations/shared.ts
|
|
@@ -2820,7 +3586,7 @@ async function createContext(initialContext, copilotKitContext, contextLogger, p
|
|
|
2820
3586
|
__name(createContext, "createContext");
|
|
2821
3587
|
function buildSchema(options = {}) {
|
|
2822
3588
|
logger.debug("Building GraphQL schema...");
|
|
2823
|
-
const schema = (0,
|
|
3589
|
+
const schema = (0, import_type_graphql16.buildSchemaSync)({
|
|
2824
3590
|
resolvers: [
|
|
2825
3591
|
CopilotResolver
|
|
2826
3592
|
],
|