@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/lib/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",
|
|
@@ -138,8 +140,8 @@ __export(lib_exports, {
|
|
|
138
140
|
});
|
|
139
141
|
module.exports = __toCommonJS(lib_exports);
|
|
140
142
|
|
|
141
|
-
// src/lib/copilot-runtime.ts
|
|
142
|
-
var
|
|
143
|
+
// src/lib/runtime/copilot-runtime.ts
|
|
144
|
+
var import_shared8 = require("@copilotkit/shared");
|
|
143
145
|
|
|
144
146
|
// src/service-adapters/openai/openai-adapter.ts
|
|
145
147
|
var import_openai = __toESM(require("openai"));
|
|
@@ -197,6 +199,17 @@ var ResultMessage = class extends BaseMessage {
|
|
|
197
199
|
result;
|
|
198
200
|
};
|
|
199
201
|
__name(ResultMessage, "ResultMessage");
|
|
202
|
+
var AgentStateMessage = class extends BaseMessage {
|
|
203
|
+
threadId;
|
|
204
|
+
agentName;
|
|
205
|
+
nodeName;
|
|
206
|
+
runId;
|
|
207
|
+
active;
|
|
208
|
+
role;
|
|
209
|
+
state;
|
|
210
|
+
running;
|
|
211
|
+
};
|
|
212
|
+
__name(AgentStateMessage, "AgentStateMessage");
|
|
200
213
|
|
|
201
214
|
// src/service-adapters/openai/utils.ts
|
|
202
215
|
function limitMessagesToTokenCount(messages, tools, model, maxTokens) {
|
|
@@ -342,6 +355,7 @@ var import_shared = require("@copilotkit/shared");
|
|
|
342
355
|
var DEFAULT_MODEL = "gpt-4o";
|
|
343
356
|
var OpenAIAdapter = class {
|
|
344
357
|
model = DEFAULT_MODEL;
|
|
358
|
+
disableParallelToolCalls = false;
|
|
345
359
|
_openai;
|
|
346
360
|
get openai() {
|
|
347
361
|
return this._openai;
|
|
@@ -351,6 +365,7 @@ var OpenAIAdapter = class {
|
|
|
351
365
|
if (params == null ? void 0 : params.model) {
|
|
352
366
|
this.model = params.model;
|
|
353
367
|
}
|
|
368
|
+
this.disableParallelToolCalls = (params == null ? void 0 : params.disableParallelToolCalls) || false;
|
|
354
369
|
}
|
|
355
370
|
async process(request) {
|
|
356
371
|
const { threadId, model = this.model, messages, actions, eventSource, forwardedParameters } = request;
|
|
@@ -381,6 +396,9 @@ var OpenAIAdapter = class {
|
|
|
381
396
|
},
|
|
382
397
|
...toolChoice && {
|
|
383
398
|
tool_choice: toolChoice
|
|
399
|
+
},
|
|
400
|
+
...this.disableParallelToolCalls && {
|
|
401
|
+
parallel_tool_calls: false
|
|
384
402
|
}
|
|
385
403
|
});
|
|
386
404
|
eventSource.stream(async (eventStream$) => {
|
|
@@ -432,11 +450,13 @@ var OpenAIAssistantAdapter = class {
|
|
|
432
450
|
codeInterpreterEnabled;
|
|
433
451
|
assistantId;
|
|
434
452
|
fileSearchEnabled;
|
|
453
|
+
disableParallelToolCalls;
|
|
435
454
|
constructor(params) {
|
|
436
455
|
this.openai = params.openai || new import_openai2.default({});
|
|
437
456
|
this.codeInterpreterEnabled = params.codeInterpreterEnabled === false || true;
|
|
438
457
|
this.fileSearchEnabled = params.fileSearchEnabled === false || true;
|
|
439
458
|
this.assistantId = params.assistantId;
|
|
459
|
+
this.disableParallelToolCalls = (params == null ? void 0 : params.disableParallelToolCalls) || false;
|
|
440
460
|
}
|
|
441
461
|
async process(request) {
|
|
442
462
|
const { messages, actions, eventSource, runId, forwardedParameters } = request;
|
|
@@ -472,7 +492,10 @@ var OpenAIAssistantAdapter = class {
|
|
|
472
492
|
};
|
|
473
493
|
});
|
|
474
494
|
const stream = this.openai.beta.threads.runs.submitToolOutputsStream(threadId, runId, {
|
|
475
|
-
tool_outputs: toolOutputs
|
|
495
|
+
tool_outputs: toolOutputs,
|
|
496
|
+
...this.disableParallelToolCalls && {
|
|
497
|
+
parallel_tool_calls: false
|
|
498
|
+
}
|
|
476
499
|
});
|
|
477
500
|
await this.streamResponse(stream, eventSource);
|
|
478
501
|
return runId;
|
|
@@ -511,6 +534,9 @@ var OpenAIAssistantAdapter = class {
|
|
|
511
534
|
tools,
|
|
512
535
|
...(forwardedParameters == null ? void 0 : forwardedParameters.maxTokens) && {
|
|
513
536
|
max_completion_tokens: forwardedParameters.maxTokens
|
|
537
|
+
},
|
|
538
|
+
...this.disableParallelToolCalls && {
|
|
539
|
+
parallel_tool_calls: false
|
|
514
540
|
}
|
|
515
541
|
});
|
|
516
542
|
await this.streamResponse(stream, eventSource);
|
|
@@ -1164,6 +1190,7 @@ var import_shared6 = require("@copilotkit/shared");
|
|
|
1164
1190
|
var DEFAULT_MODEL2 = "llama3-groq-70b-8192-tool-use-preview";
|
|
1165
1191
|
var GroqAdapter = class {
|
|
1166
1192
|
model = DEFAULT_MODEL2;
|
|
1193
|
+
disableParallelToolCalls = false;
|
|
1167
1194
|
_groq;
|
|
1168
1195
|
get groq() {
|
|
1169
1196
|
return this._groq;
|
|
@@ -1173,6 +1200,7 @@ var GroqAdapter = class {
|
|
|
1173
1200
|
if (params == null ? void 0 : params.model) {
|
|
1174
1201
|
this.model = params.model;
|
|
1175
1202
|
}
|
|
1203
|
+
this.disableParallelToolCalls = (params == null ? void 0 : params.disableParallelToolCalls) || false;
|
|
1176
1204
|
}
|
|
1177
1205
|
async process(request) {
|
|
1178
1206
|
const { threadId, model = this.model, messages, actions, eventSource, forwardedParameters } = request;
|
|
@@ -1203,6 +1231,9 @@ var GroqAdapter = class {
|
|
|
1203
1231
|
},
|
|
1204
1232
|
...toolChoice && {
|
|
1205
1233
|
tool_choice: toolChoice
|
|
1234
|
+
},
|
|
1235
|
+
...this.disableParallelToolCalls && {
|
|
1236
|
+
parallel_tool_calls: false
|
|
1206
1237
|
}
|
|
1207
1238
|
});
|
|
1208
1239
|
eventSource.stream(async (eventStream$) => {
|
|
@@ -1248,7 +1279,366 @@ var GroqAdapter = class {
|
|
|
1248
1279
|
__name(GroqAdapter, "GroqAdapter");
|
|
1249
1280
|
|
|
1250
1281
|
// src/service-adapters/events.ts
|
|
1282
|
+
var import_rxjs2 = require("rxjs");
|
|
1283
|
+
|
|
1284
|
+
// src/lib/telemetry-client.ts
|
|
1285
|
+
var import_shared7 = require("@copilotkit/shared");
|
|
1286
|
+
var packageJson = require_package();
|
|
1287
|
+
var telemetryClient = new import_shared7.TelemetryClient({
|
|
1288
|
+
packageName: packageJson.name,
|
|
1289
|
+
packageVersion: packageJson.version
|
|
1290
|
+
});
|
|
1291
|
+
var telemetry_client_default = telemetryClient;
|
|
1292
|
+
|
|
1293
|
+
// src/agents/langgraph/event-source.ts
|
|
1251
1294
|
var import_rxjs = require("rxjs");
|
|
1295
|
+
|
|
1296
|
+
// src/agents/langgraph/events.ts
|
|
1297
|
+
var LangGraphEventTypes;
|
|
1298
|
+
(function(LangGraphEventTypes2) {
|
|
1299
|
+
LangGraphEventTypes2["OnChainStart"] = "on_chain_start";
|
|
1300
|
+
LangGraphEventTypes2["OnChainStream"] = "on_chain_stream";
|
|
1301
|
+
LangGraphEventTypes2["OnChainEnd"] = "on_chain_end";
|
|
1302
|
+
LangGraphEventTypes2["OnChatModelStart"] = "on_chat_model_start";
|
|
1303
|
+
LangGraphEventTypes2["OnChatModelStream"] = "on_chat_model_stream";
|
|
1304
|
+
LangGraphEventTypes2["OnChatModelEnd"] = "on_chat_model_end";
|
|
1305
|
+
LangGraphEventTypes2["OnToolStart"] = "on_tool_start";
|
|
1306
|
+
LangGraphEventTypes2["OnToolEnd"] = "on_tool_end";
|
|
1307
|
+
LangGraphEventTypes2["OnCopilotKitStateSync"] = "on_copilotkit_state_sync";
|
|
1308
|
+
})(LangGraphEventTypes || (LangGraphEventTypes = {}));
|
|
1309
|
+
|
|
1310
|
+
// src/agents/langgraph/event-source.ts
|
|
1311
|
+
var RemoteLangGraphEventSource = class {
|
|
1312
|
+
eventStream$ = new import_rxjs.ReplaySubject();
|
|
1313
|
+
async streamResponse(response) {
|
|
1314
|
+
const reader = response.body.getReader();
|
|
1315
|
+
const decoder = new TextDecoder();
|
|
1316
|
+
let buffer = [];
|
|
1317
|
+
const eventStream$ = this.eventStream$;
|
|
1318
|
+
function flushBuffer() {
|
|
1319
|
+
const currentBuffer = buffer.join("");
|
|
1320
|
+
if (currentBuffer.trim().length === 0) {
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1323
|
+
const parts = currentBuffer.split("\n");
|
|
1324
|
+
if (parts.length === 0) {
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
const lastPartIsComplete = currentBuffer.endsWith("\n");
|
|
1328
|
+
buffer = [];
|
|
1329
|
+
if (!lastPartIsComplete) {
|
|
1330
|
+
buffer.push(parts.pop());
|
|
1331
|
+
}
|
|
1332
|
+
parts.map((part) => part.trim()).filter((part) => part != "").forEach((part) => {
|
|
1333
|
+
eventStream$.next(JSON.parse(part));
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
__name(flushBuffer, "flushBuffer");
|
|
1337
|
+
while (true) {
|
|
1338
|
+
const { done, value } = await reader.read();
|
|
1339
|
+
if (!done) {
|
|
1340
|
+
buffer.push(decoder.decode(value, {
|
|
1341
|
+
stream: true
|
|
1342
|
+
}));
|
|
1343
|
+
}
|
|
1344
|
+
flushBuffer();
|
|
1345
|
+
if (done) {
|
|
1346
|
+
break;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
eventStream$.complete();
|
|
1350
|
+
}
|
|
1351
|
+
processLangGraphEvents() {
|
|
1352
|
+
return this.eventStream$.pipe((0, import_rxjs.scan)((acc, event) => {
|
|
1353
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1354
|
+
if (event.event === LangGraphEventTypes.OnChatModelStream) {
|
|
1355
|
+
if ((_c = (_b = (_a = event.data) == null ? void 0 : _a.chunk) == null ? void 0 : _b.kwargs) == null ? void 0 : _c.tool_call_chunks) {
|
|
1356
|
+
acc.prevToolCallId = acc.toolCallId;
|
|
1357
|
+
acc.toolCallId = (_d = event.data.chunk.kwargs) == null ? void 0 : _d.id;
|
|
1358
|
+
if ((_e = event.data.chunk.kwargs.tool_call_chunks[0]) == null ? void 0 : _e.name) {
|
|
1359
|
+
acc.toolCallName = event.data.chunk.kwargs.tool_call_chunks[0].name;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
acc.prevMessageId = acc.messageId;
|
|
1363
|
+
acc.messageId = (_h = (_g = (_f = event.data) == null ? void 0 : _f.chunk) == null ? void 0 : _g.kwargs) == null ? void 0 : _h.id;
|
|
1364
|
+
} else {
|
|
1365
|
+
acc.prevToolCallId = acc.toolCallId;
|
|
1366
|
+
acc.toolCallId = null;
|
|
1367
|
+
acc.prevMessageId = acc.messageId;
|
|
1368
|
+
acc.messageId = null;
|
|
1369
|
+
acc.toolCallName = null;
|
|
1370
|
+
}
|
|
1371
|
+
acc.event = event;
|
|
1372
|
+
return acc;
|
|
1373
|
+
}, {
|
|
1374
|
+
event: null,
|
|
1375
|
+
toolCallId: null,
|
|
1376
|
+
prevToolCallId: null,
|
|
1377
|
+
messageId: null,
|
|
1378
|
+
toolCallName: null,
|
|
1379
|
+
prevMessageId: null
|
|
1380
|
+
}), (0, import_rxjs.mergeMap)((eventWithState) => {
|
|
1381
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1382
|
+
const events = [];
|
|
1383
|
+
let shouldEmitMessages = false;
|
|
1384
|
+
let shouldEmitToolCalls = false;
|
|
1385
|
+
if (eventWithState.event.event == LangGraphEventTypes.OnChatModelStream) {
|
|
1386
|
+
if ((_a = eventWithState.event.tags) == null ? void 0 : _a.includes("copilotkit:emit-tool-calls")) {
|
|
1387
|
+
shouldEmitToolCalls = true;
|
|
1388
|
+
}
|
|
1389
|
+
if ((_b = eventWithState.event.tags) == null ? void 0 : _b.includes("copilotkit:emit-messages")) {
|
|
1390
|
+
shouldEmitMessages = true;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
if (eventWithState.prevToolCallId !== null && eventWithState.prevToolCallId !== eventWithState.toolCallId && shouldEmitToolCalls) {
|
|
1394
|
+
events.push({
|
|
1395
|
+
type: RuntimeEventTypes.ActionExecutionEnd
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
if (eventWithState.prevMessageId !== null && eventWithState.prevMessageId !== eventWithState.messageId && shouldEmitMessages) {
|
|
1399
|
+
events.push({
|
|
1400
|
+
type: RuntimeEventTypes.TextMessageEnd
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
switch (eventWithState.event.event) {
|
|
1404
|
+
case LangGraphEventTypes.OnCopilotKitStateSync:
|
|
1405
|
+
events.push({
|
|
1406
|
+
type: RuntimeEventTypes.AgentStateMessage,
|
|
1407
|
+
threadId: eventWithState.event.thread_id,
|
|
1408
|
+
role: eventWithState.event.role,
|
|
1409
|
+
agentName: eventWithState.event.agent_name,
|
|
1410
|
+
nodeName: eventWithState.event.node_name,
|
|
1411
|
+
runId: eventWithState.event.run_id,
|
|
1412
|
+
active: eventWithState.event.active,
|
|
1413
|
+
state: JSON.stringify(eventWithState.event.state),
|
|
1414
|
+
running: eventWithState.event.running
|
|
1415
|
+
});
|
|
1416
|
+
break;
|
|
1417
|
+
case LangGraphEventTypes.OnToolEnd:
|
|
1418
|
+
break;
|
|
1419
|
+
case LangGraphEventTypes.OnChatModelStream:
|
|
1420
|
+
if (eventWithState.toolCallId !== null && eventWithState.prevToolCallId !== eventWithState.toolCallId) {
|
|
1421
|
+
if (shouldEmitToolCalls) {
|
|
1422
|
+
events.push({
|
|
1423
|
+
type: RuntimeEventTypes.ActionExecutionStart,
|
|
1424
|
+
actionExecutionId: eventWithState.toolCallId,
|
|
1425
|
+
actionName: eventWithState.toolCallName,
|
|
1426
|
+
scope: "client"
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
} else if (eventWithState.messageId !== null && eventWithState.prevMessageId !== eventWithState.messageId) {
|
|
1430
|
+
if (shouldEmitMessages) {
|
|
1431
|
+
events.push({
|
|
1432
|
+
type: RuntimeEventTypes.TextMessageStart,
|
|
1433
|
+
messageId: eventWithState.messageId
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
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;
|
|
1438
|
+
const content = (_j = (_i = (_h = eventWithState.event.data) == null ? void 0 : _h.chunk) == null ? void 0 : _i.kwargs) == null ? void 0 : _j.content;
|
|
1439
|
+
if (args) {
|
|
1440
|
+
if (shouldEmitToolCalls) {
|
|
1441
|
+
events.push({
|
|
1442
|
+
type: RuntimeEventTypes.ActionExecutionArgs,
|
|
1443
|
+
args
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1446
|
+
} else if (eventWithState.messageId !== null && content) {
|
|
1447
|
+
if (shouldEmitMessages) {
|
|
1448
|
+
events.push({
|
|
1449
|
+
type: RuntimeEventTypes.TextMessageContent,
|
|
1450
|
+
content
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
break;
|
|
1455
|
+
}
|
|
1456
|
+
return events;
|
|
1457
|
+
}));
|
|
1458
|
+
}
|
|
1459
|
+
};
|
|
1460
|
+
__name(RemoteLangGraphEventSource, "RemoteLangGraphEventSource");
|
|
1461
|
+
|
|
1462
|
+
// src/lib/runtime/remote-actions.ts
|
|
1463
|
+
function isLangGraphAgentAction(action) {
|
|
1464
|
+
if (!action) {
|
|
1465
|
+
return false;
|
|
1466
|
+
}
|
|
1467
|
+
return typeof action.langGraphAgentHandler === "function";
|
|
1468
|
+
}
|
|
1469
|
+
__name(isLangGraphAgentAction, "isLangGraphAgentAction");
|
|
1470
|
+
function createHeaders(onBeforeRequest, graphqlContext) {
|
|
1471
|
+
const headers = {
|
|
1472
|
+
"Content-Type": "application/json"
|
|
1473
|
+
};
|
|
1474
|
+
if (onBeforeRequest) {
|
|
1475
|
+
const { headers: additionalHeaders } = onBeforeRequest({
|
|
1476
|
+
ctx: graphqlContext
|
|
1477
|
+
});
|
|
1478
|
+
if (additionalHeaders) {
|
|
1479
|
+
Object.assign(headers, additionalHeaders);
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
return headers;
|
|
1483
|
+
}
|
|
1484
|
+
__name(createHeaders, "createHeaders");
|
|
1485
|
+
async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: logger2 }) {
|
|
1486
|
+
logger2.debug({
|
|
1487
|
+
url
|
|
1488
|
+
}, "Fetching actions from url");
|
|
1489
|
+
const headers = createHeaders(onBeforeRequest, graphqlContext);
|
|
1490
|
+
const response = await fetch(`${url}/info`, {
|
|
1491
|
+
method: "POST",
|
|
1492
|
+
headers,
|
|
1493
|
+
body: JSON.stringify({
|
|
1494
|
+
properties: graphqlContext.properties
|
|
1495
|
+
})
|
|
1496
|
+
});
|
|
1497
|
+
if (!response.ok) {
|
|
1498
|
+
logger2.error({
|
|
1499
|
+
url,
|
|
1500
|
+
status: response.status,
|
|
1501
|
+
body: await response.text()
|
|
1502
|
+
}, "Failed to fetch actions from url");
|
|
1503
|
+
return [];
|
|
1504
|
+
}
|
|
1505
|
+
const json = await response.json();
|
|
1506
|
+
logger2.debug({
|
|
1507
|
+
json
|
|
1508
|
+
}, "Fetched actions from url");
|
|
1509
|
+
return json;
|
|
1510
|
+
}
|
|
1511
|
+
__name(fetchRemoteInfo, "fetchRemoteInfo");
|
|
1512
|
+
function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, logger: logger2, messages, agentStates }) {
|
|
1513
|
+
const actions = json["actions"].map((action) => ({
|
|
1514
|
+
name: action.name,
|
|
1515
|
+
description: action.description,
|
|
1516
|
+
parameters: action.parameters,
|
|
1517
|
+
handler: async (args) => {
|
|
1518
|
+
logger2.debug({
|
|
1519
|
+
actionName: action.name,
|
|
1520
|
+
args
|
|
1521
|
+
}, "Executing remote action");
|
|
1522
|
+
const headers = createHeaders(onBeforeRequest, graphqlContext);
|
|
1523
|
+
telemetry_client_default.capture("oss.runtime.remote_action_executed", {});
|
|
1524
|
+
const response = await fetch(`${url}/actions/execute`, {
|
|
1525
|
+
method: "POST",
|
|
1526
|
+
headers,
|
|
1527
|
+
body: JSON.stringify({
|
|
1528
|
+
name: action.name,
|
|
1529
|
+
arguments: args,
|
|
1530
|
+
properties: graphqlContext.properties
|
|
1531
|
+
})
|
|
1532
|
+
});
|
|
1533
|
+
if (!response.ok) {
|
|
1534
|
+
logger2.error({
|
|
1535
|
+
url,
|
|
1536
|
+
status: response.status,
|
|
1537
|
+
body: await response.text()
|
|
1538
|
+
}, "Failed to execute remote action");
|
|
1539
|
+
return "Failed to execute remote action";
|
|
1540
|
+
}
|
|
1541
|
+
const requestResult = await response.json();
|
|
1542
|
+
const result = requestResult["result"];
|
|
1543
|
+
logger2.debug({
|
|
1544
|
+
actionName: action.name,
|
|
1545
|
+
result
|
|
1546
|
+
}, "Executed remote action");
|
|
1547
|
+
return result;
|
|
1548
|
+
}
|
|
1549
|
+
}));
|
|
1550
|
+
const agents = json["agents"].map((agent) => ({
|
|
1551
|
+
name: agent.name,
|
|
1552
|
+
description: agent.description,
|
|
1553
|
+
parameters: [],
|
|
1554
|
+
handler: async (_args) => {
|
|
1555
|
+
},
|
|
1556
|
+
langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName }) => {
|
|
1557
|
+
var _a;
|
|
1558
|
+
logger2.debug({
|
|
1559
|
+
actionName: agent.name
|
|
1560
|
+
}, "Executing remote agent");
|
|
1561
|
+
const headers = createHeaders(onBeforeRequest, graphqlContext);
|
|
1562
|
+
telemetry_client_default.capture("oss.runtime.remote_action_executed", {});
|
|
1563
|
+
let state = {};
|
|
1564
|
+
if (agentStates) {
|
|
1565
|
+
const jsonState = (_a = agentStates.find((state2) => state2.agentName === name)) == null ? void 0 : _a.state;
|
|
1566
|
+
if (jsonState) {
|
|
1567
|
+
state = JSON.parse(jsonState);
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
const response = await fetch(`${url}/agents/execute`, {
|
|
1571
|
+
method: "POST",
|
|
1572
|
+
headers,
|
|
1573
|
+
body: JSON.stringify({
|
|
1574
|
+
name,
|
|
1575
|
+
threadId,
|
|
1576
|
+
nodeName,
|
|
1577
|
+
messages,
|
|
1578
|
+
state,
|
|
1579
|
+
properties: graphqlContext.properties,
|
|
1580
|
+
actions: actionInputsWithoutAgents.map((action) => ({
|
|
1581
|
+
name: action.name,
|
|
1582
|
+
description: action.description,
|
|
1583
|
+
parameters: JSON.parse(action.jsonSchema)
|
|
1584
|
+
}))
|
|
1585
|
+
})
|
|
1586
|
+
});
|
|
1587
|
+
if (!response.ok) {
|
|
1588
|
+
logger2.error({
|
|
1589
|
+
url,
|
|
1590
|
+
status: response.status,
|
|
1591
|
+
body: await response.text()
|
|
1592
|
+
}, "Failed to execute remote agent");
|
|
1593
|
+
throw new Error("Failed to execute remote agent");
|
|
1594
|
+
}
|
|
1595
|
+
const eventSource = new RemoteLangGraphEventSource();
|
|
1596
|
+
eventSource.streamResponse(response);
|
|
1597
|
+
return eventSource.processLangGraphEvents();
|
|
1598
|
+
}
|
|
1599
|
+
}));
|
|
1600
|
+
return [
|
|
1601
|
+
...actions,
|
|
1602
|
+
...agents
|
|
1603
|
+
];
|
|
1604
|
+
}
|
|
1605
|
+
__name(constructRemoteActions, "constructRemoteActions");
|
|
1606
|
+
async function setupRemoteActions({ remoteActionDefinitions, graphqlContext, messages, agentStates }) {
|
|
1607
|
+
const logger2 = graphqlContext.logger.child({
|
|
1608
|
+
component: "remote-actions.fetchRemoteActions"
|
|
1609
|
+
});
|
|
1610
|
+
logger2.debug({
|
|
1611
|
+
remoteActionDefinitions
|
|
1612
|
+
}, "Fetching remote actions");
|
|
1613
|
+
const filtered = remoteActionDefinitions.filter((value, index, self) => index === self.findIndex((t) => t.url === value.url));
|
|
1614
|
+
const result = await Promise.all(filtered.map(async (actionDefinition) => {
|
|
1615
|
+
const json = await fetchRemoteInfo({
|
|
1616
|
+
url: actionDefinition.url,
|
|
1617
|
+
onBeforeRequest: actionDefinition.onBeforeRequest,
|
|
1618
|
+
graphqlContext,
|
|
1619
|
+
logger: logger2.child({
|
|
1620
|
+
component: "remote-actions.fetchActionsFromUrl",
|
|
1621
|
+
actionDefinition
|
|
1622
|
+
})
|
|
1623
|
+
});
|
|
1624
|
+
return constructRemoteActions({
|
|
1625
|
+
json,
|
|
1626
|
+
messages,
|
|
1627
|
+
url: actionDefinition.url,
|
|
1628
|
+
onBeforeRequest: actionDefinition.onBeforeRequest,
|
|
1629
|
+
graphqlContext,
|
|
1630
|
+
logger: logger2.child({
|
|
1631
|
+
component: "remote-actions.constructActions",
|
|
1632
|
+
actionDefinition
|
|
1633
|
+
}),
|
|
1634
|
+
agentStates
|
|
1635
|
+
});
|
|
1636
|
+
}));
|
|
1637
|
+
return result.flat();
|
|
1638
|
+
}
|
|
1639
|
+
__name(setupRemoteActions, "setupRemoteActions");
|
|
1640
|
+
|
|
1641
|
+
// src/service-adapters/events.ts
|
|
1252
1642
|
var RuntimeEventTypes;
|
|
1253
1643
|
(function(RuntimeEventTypes2) {
|
|
1254
1644
|
RuntimeEventTypes2["TextMessageStart"] = "TextMessageStart";
|
|
@@ -1258,8 +1648,9 @@ var RuntimeEventTypes;
|
|
|
1258
1648
|
RuntimeEventTypes2["ActionExecutionArgs"] = "ActionExecutionArgs";
|
|
1259
1649
|
RuntimeEventTypes2["ActionExecutionEnd"] = "ActionExecutionEnd";
|
|
1260
1650
|
RuntimeEventTypes2["ActionExecutionResult"] = "ActionExecutionResult";
|
|
1651
|
+
RuntimeEventTypes2["AgentStateMessage"] = "AgentStateMessage";
|
|
1261
1652
|
})(RuntimeEventTypes || (RuntimeEventTypes = {}));
|
|
1262
|
-
var RuntimeEventSubject = class extends
|
|
1653
|
+
var RuntimeEventSubject = class extends import_rxjs2.ReplaySubject {
|
|
1263
1654
|
constructor() {
|
|
1264
1655
|
super();
|
|
1265
1656
|
}
|
|
@@ -1316,6 +1707,19 @@ var RuntimeEventSubject = class extends import_rxjs.ReplaySubject {
|
|
|
1316
1707
|
result
|
|
1317
1708
|
});
|
|
1318
1709
|
}
|
|
1710
|
+
sendAgentStateMessage(threadId, agentName, nodeName, runId, active, role, state, running) {
|
|
1711
|
+
this.next({
|
|
1712
|
+
type: "AgentStateMessage",
|
|
1713
|
+
threadId,
|
|
1714
|
+
agentName,
|
|
1715
|
+
nodeName,
|
|
1716
|
+
runId,
|
|
1717
|
+
active,
|
|
1718
|
+
role,
|
|
1719
|
+
state,
|
|
1720
|
+
running
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1319
1723
|
};
|
|
1320
1724
|
__name(RuntimeEventSubject, "RuntimeEventSubject");
|
|
1321
1725
|
var RuntimeEventSource = class {
|
|
@@ -1324,26 +1728,31 @@ var RuntimeEventSource = class {
|
|
|
1324
1728
|
async stream(callback) {
|
|
1325
1729
|
this.callback = callback;
|
|
1326
1730
|
}
|
|
1327
|
-
|
|
1731
|
+
processRuntimeEvents({ serverSideActions, guardrailsResult$, actionInputsWithoutAgents }) {
|
|
1328
1732
|
this.callback(this.eventStream$).catch((error) => {
|
|
1329
1733
|
console.error("Error in event source callback", error);
|
|
1330
1734
|
});
|
|
1331
1735
|
return this.eventStream$.pipe(
|
|
1332
1736
|
// mark tools for server side execution
|
|
1333
|
-
(0,
|
|
1737
|
+
(0, import_rxjs2.map)((event) => {
|
|
1334
1738
|
if (event.type === "ActionExecutionStart") {
|
|
1335
|
-
|
|
1739
|
+
if (event.scope !== "passThrough") {
|
|
1740
|
+
event.scope = serverSideActions.find((action) => action.name === event.actionName) ? "server" : "client";
|
|
1741
|
+
}
|
|
1336
1742
|
}
|
|
1337
1743
|
return event;
|
|
1338
1744
|
}),
|
|
1339
1745
|
// track state
|
|
1340
|
-
(0,
|
|
1746
|
+
(0, import_rxjs2.scan)((acc, event) => {
|
|
1747
|
+
acc = {
|
|
1748
|
+
...acc
|
|
1749
|
+
};
|
|
1341
1750
|
if (event.type === "ActionExecutionStart") {
|
|
1342
1751
|
acc.callActionServerSide = event.scope === "server";
|
|
1343
1752
|
acc.args = "";
|
|
1344
1753
|
acc.actionExecutionId = event.actionExecutionId;
|
|
1345
1754
|
if (acc.callActionServerSide) {
|
|
1346
|
-
acc.action =
|
|
1755
|
+
acc.action = serverSideActions.find((action) => action.name === event.actionName);
|
|
1347
1756
|
}
|
|
1348
1757
|
} else if (event.type === "ActionExecutionArgs") {
|
|
1349
1758
|
acc.args += event.args;
|
|
@@ -1357,24 +1766,26 @@ var RuntimeEventSource = class {
|
|
|
1357
1766
|
actionExecutionId: null,
|
|
1358
1767
|
action: null
|
|
1359
1768
|
}),
|
|
1360
|
-
(0,
|
|
1769
|
+
(0, import_rxjs2.concatMap)((eventWithState) => {
|
|
1361
1770
|
if (eventWithState.event.type === "ActionExecutionEnd" && eventWithState.callActionServerSide) {
|
|
1362
1771
|
const toolCallEventStream$ = new RuntimeEventSubject();
|
|
1363
|
-
executeAction(toolCallEventStream$, guardrailsResult$ ? guardrailsResult$ : null, eventWithState.action, eventWithState.args, eventWithState.actionExecutionId).catch((error) => {
|
|
1772
|
+
executeAction(toolCallEventStream$, guardrailsResult$ ? guardrailsResult$ : null, eventWithState.action, eventWithState.args, eventWithState.actionExecutionId, actionInputsWithoutAgents).catch((error) => {
|
|
1364
1773
|
console.error(error);
|
|
1365
1774
|
});
|
|
1366
|
-
|
|
1775
|
+
telemetry_client_default.capture("oss.runtime.server_action_executed", {});
|
|
1776
|
+
return (0, import_rxjs2.concat)((0, import_rxjs2.of)(eventWithState.event), toolCallEventStream$);
|
|
1367
1777
|
} else {
|
|
1368
|
-
return (0,
|
|
1778
|
+
return (0, import_rxjs2.of)(eventWithState.event);
|
|
1369
1779
|
}
|
|
1370
1780
|
})
|
|
1371
1781
|
);
|
|
1372
1782
|
}
|
|
1373
1783
|
};
|
|
1374
1784
|
__name(RuntimeEventSource, "RuntimeEventSource");
|
|
1375
|
-
async function executeAction(eventStream$, guardrailsResult$, action, actionArguments, actionExecutionId) {
|
|
1785
|
+
async function executeAction(eventStream$, guardrailsResult$, action, actionArguments, actionExecutionId, actionInputsWithoutAgents) {
|
|
1786
|
+
var _a;
|
|
1376
1787
|
if (guardrailsResult$) {
|
|
1377
|
-
const { status } = await (0,
|
|
1788
|
+
const { status } = await (0, import_rxjs2.firstValueFrom)(guardrailsResult$);
|
|
1378
1789
|
if (status === "denied") {
|
|
1379
1790
|
eventStream$.complete();
|
|
1380
1791
|
return;
|
|
@@ -1384,15 +1795,28 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
|
|
|
1384
1795
|
if (actionArguments) {
|
|
1385
1796
|
args = JSON.parse(actionArguments);
|
|
1386
1797
|
}
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
eventStream$,
|
|
1391
|
-
actionExecution: {
|
|
1798
|
+
if (isLangGraphAgentAction(action)) {
|
|
1799
|
+
eventStream$.sendActionExecutionResult(actionExecutionId, action.name, `${action.name} agent started`);
|
|
1800
|
+
const stream = await action.langGraphAgentHandler({
|
|
1392
1801
|
name: action.name,
|
|
1393
|
-
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1802
|
+
actionInputsWithoutAgents
|
|
1803
|
+
});
|
|
1804
|
+
(0, import_rxjs2.from)(stream).subscribe({
|
|
1805
|
+
next: (event) => eventStream$.next(event),
|
|
1806
|
+
error: (err) => console.error("Error in stream", err),
|
|
1807
|
+
complete: () => eventStream$.complete()
|
|
1808
|
+
});
|
|
1809
|
+
} else {
|
|
1810
|
+
const result = await ((_a = action.handler) == null ? void 0 : _a.call(action, args));
|
|
1811
|
+
await streamLangChainResponse({
|
|
1812
|
+
result,
|
|
1813
|
+
eventStream$,
|
|
1814
|
+
actionExecution: {
|
|
1815
|
+
name: action.name,
|
|
1816
|
+
id: actionExecutionId
|
|
1817
|
+
}
|
|
1818
|
+
});
|
|
1819
|
+
}
|
|
1396
1820
|
}
|
|
1397
1821
|
__name(executeAction, "executeAction");
|
|
1398
1822
|
|
|
@@ -1424,15 +1848,30 @@ function convertGqlInputToMessages(inputMessages) {
|
|
|
1424
1848
|
actionName: message.resultMessage.actionName,
|
|
1425
1849
|
result: message.resultMessage.result
|
|
1426
1850
|
}));
|
|
1851
|
+
} else if (message.agentStateMessage) {
|
|
1852
|
+
messages.push((0, import_class_transformer.plainToInstance)(AgentStateMessage, {
|
|
1853
|
+
id: message.id,
|
|
1854
|
+
threadId: message.agentStateMessage.threadId,
|
|
1855
|
+
createdAt: message.createdAt,
|
|
1856
|
+
agentName: message.agentStateMessage.agentName,
|
|
1857
|
+
nodeName: message.agentStateMessage.nodeName,
|
|
1858
|
+
runId: message.agentStateMessage.runId,
|
|
1859
|
+
active: message.agentStateMessage.active,
|
|
1860
|
+
role: message.agentStateMessage.role,
|
|
1861
|
+
state: JSON.parse(message.agentStateMessage.state),
|
|
1862
|
+
running: message.agentStateMessage.running
|
|
1863
|
+
}));
|
|
1427
1864
|
}
|
|
1428
1865
|
}
|
|
1429
1866
|
return messages;
|
|
1430
1867
|
}
|
|
1431
1868
|
__name(convertGqlInputToMessages, "convertGqlInputToMessages");
|
|
1432
1869
|
|
|
1433
|
-
// src/lib/copilot-runtime.ts
|
|
1870
|
+
// src/lib/runtime/copilot-runtime.ts
|
|
1871
|
+
var import_rxjs3 = require("rxjs");
|
|
1434
1872
|
var CopilotRuntime = class {
|
|
1435
1873
|
actions;
|
|
1874
|
+
remoteActionDefinitions;
|
|
1436
1875
|
langserve = [];
|
|
1437
1876
|
onBeforeRequest;
|
|
1438
1877
|
onAfterRequest;
|
|
@@ -1443,43 +1882,34 @@ var CopilotRuntime = class {
|
|
|
1443
1882
|
const remoteChain = new RemoteChain(chain);
|
|
1444
1883
|
this.langserve.push(remoteChain.toAction());
|
|
1445
1884
|
}
|
|
1885
|
+
this.remoteActionDefinitions = (params == null ? void 0 : params.remoteActions) || [];
|
|
1446
1886
|
this.onBeforeRequest = (_a = params == null ? void 0 : params.middleware) == null ? void 0 : _a.onBeforeRequest;
|
|
1447
1887
|
this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
|
|
1448
1888
|
}
|
|
1449
|
-
async
|
|
1889
|
+
async processRuntimeRequest(request) {
|
|
1450
1890
|
var _a;
|
|
1451
|
-
const { serviceAdapter, messages, actions: clientSideActionsInput, threadId, runId,
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
try {
|
|
1455
|
-
const chain = await chainPromise;
|
|
1456
|
-
langserveFunctions.push(chain);
|
|
1457
|
-
} catch (error) {
|
|
1458
|
-
console.error("Error loading langserve chain:", error);
|
|
1459
|
-
}
|
|
1891
|
+
const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, agentSession, url } = request;
|
|
1892
|
+
if (agentSession) {
|
|
1893
|
+
return this.processAgentRequest(request);
|
|
1460
1894
|
}
|
|
1461
|
-
const
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
const
|
|
1465
|
-
...configuredActions,
|
|
1466
|
-
...langserveFunctions
|
|
1467
|
-
];
|
|
1468
|
-
const serverSideActionsInput = actions.map((action) => ({
|
|
1895
|
+
const messages = rawMessages.filter((message) => !message.agentStateMessage);
|
|
1896
|
+
const inputMessages = convertGqlInputToMessages(messages);
|
|
1897
|
+
const serverSideActions = await this.getServerSideActions(request);
|
|
1898
|
+
const serverSideActionsInput = serverSideActions.map((action) => ({
|
|
1469
1899
|
name: action.name,
|
|
1470
1900
|
description: action.description,
|
|
1471
|
-
jsonSchema: JSON.stringify((0,
|
|
1901
|
+
jsonSchema: JSON.stringify((0, import_shared8.actionParametersToJsonSchema)(action.parameters))
|
|
1472
1902
|
}));
|
|
1473
1903
|
const actionInputs = flattenToolCallsNoDuplicates([
|
|
1474
1904
|
...serverSideActionsInput,
|
|
1475
1905
|
...clientSideActionsInput
|
|
1476
1906
|
]);
|
|
1477
|
-
const inputMessages = convertGqlInputToMessages(messages);
|
|
1478
1907
|
await ((_a = this.onBeforeRequest) == null ? void 0 : _a.call(this, {
|
|
1479
1908
|
threadId,
|
|
1480
1909
|
runId,
|
|
1481
1910
|
inputMessages,
|
|
1482
|
-
properties
|
|
1911
|
+
properties: graphqlContext.properties,
|
|
1912
|
+
url
|
|
1483
1913
|
}));
|
|
1484
1914
|
try {
|
|
1485
1915
|
const eventSource = new RuntimeEventSource();
|
|
@@ -1498,7 +1928,8 @@ var CopilotRuntime = class {
|
|
|
1498
1928
|
runId: result.runId,
|
|
1499
1929
|
inputMessages,
|
|
1500
1930
|
outputMessages,
|
|
1501
|
-
properties
|
|
1931
|
+
properties: graphqlContext.properties,
|
|
1932
|
+
url
|
|
1502
1933
|
});
|
|
1503
1934
|
}).catch((_error) => {
|
|
1504
1935
|
});
|
|
@@ -1506,13 +1937,108 @@ var CopilotRuntime = class {
|
|
|
1506
1937
|
threadId: result.threadId,
|
|
1507
1938
|
runId: result.runId,
|
|
1508
1939
|
eventSource,
|
|
1509
|
-
|
|
1940
|
+
serverSideActions,
|
|
1941
|
+
actionInputsWithoutAgents: actionInputs.filter((action) => (
|
|
1942
|
+
// TODO-AGENTS: do not exclude ALL server side actions
|
|
1943
|
+
!serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
|
|
1944
|
+
))
|
|
1945
|
+
};
|
|
1946
|
+
} catch (error) {
|
|
1947
|
+
console.error("Error getting response:", error);
|
|
1948
|
+
throw error;
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
async processAgentRequest(request) {
|
|
1952
|
+
var _a;
|
|
1953
|
+
const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession } = request;
|
|
1954
|
+
const { threadId = (0, import_shared8.randomId)(), agentName, nodeName } = agentSession;
|
|
1955
|
+
const serverSideActions = await this.getServerSideActions(request);
|
|
1956
|
+
const messages = convertGqlInputToMessages(rawMessages);
|
|
1957
|
+
const agent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
|
|
1958
|
+
if (!agent) {
|
|
1959
|
+
throw new Error(`Agent ${agentName} not found`);
|
|
1960
|
+
}
|
|
1961
|
+
const serverSideActionsInput = serverSideActions.filter((action) => !isLangGraphAgentAction(action)).map((action) => ({
|
|
1962
|
+
name: action.name,
|
|
1963
|
+
description: action.description,
|
|
1964
|
+
jsonSchema: JSON.stringify((0, import_shared8.actionParametersToJsonSchema)(action.parameters))
|
|
1965
|
+
}));
|
|
1966
|
+
const actionInputsWithoutAgents = flattenToolCallsNoDuplicates([
|
|
1967
|
+
...serverSideActionsInput,
|
|
1968
|
+
...request.actions
|
|
1969
|
+
]);
|
|
1970
|
+
await ((_a = this.onBeforeRequest) == null ? void 0 : _a.call(this, {
|
|
1971
|
+
threadId,
|
|
1972
|
+
runId: void 0,
|
|
1973
|
+
inputMessages: messages,
|
|
1974
|
+
properties: graphqlContext.properties
|
|
1975
|
+
}));
|
|
1976
|
+
try {
|
|
1977
|
+
const eventSource = new RuntimeEventSource();
|
|
1978
|
+
const stream = await agent.langGraphAgentHandler({
|
|
1979
|
+
name: agentName,
|
|
1980
|
+
threadId,
|
|
1981
|
+
nodeName,
|
|
1982
|
+
actionInputsWithoutAgents
|
|
1983
|
+
});
|
|
1984
|
+
eventSource.stream(async (eventStream$) => {
|
|
1985
|
+
(0, import_rxjs3.from)(stream).subscribe({
|
|
1986
|
+
next: (event) => eventStream$.next(event),
|
|
1987
|
+
error: (err) => console.error("Error in stream", err),
|
|
1988
|
+
complete: () => eventStream$.complete()
|
|
1989
|
+
});
|
|
1990
|
+
});
|
|
1991
|
+
outputMessagesPromise.then((outputMessages) => {
|
|
1992
|
+
var _a2;
|
|
1993
|
+
(_a2 = this.onAfterRequest) == null ? void 0 : _a2.call(this, {
|
|
1994
|
+
threadId,
|
|
1995
|
+
runId: void 0,
|
|
1996
|
+
inputMessages: messages,
|
|
1997
|
+
outputMessages,
|
|
1998
|
+
properties: graphqlContext.properties
|
|
1999
|
+
});
|
|
2000
|
+
}).catch((_error) => {
|
|
2001
|
+
});
|
|
2002
|
+
return {
|
|
2003
|
+
threadId,
|
|
2004
|
+
runId: void 0,
|
|
2005
|
+
eventSource,
|
|
2006
|
+
serverSideActions: [],
|
|
2007
|
+
actionInputsWithoutAgents
|
|
1510
2008
|
};
|
|
1511
2009
|
} catch (error) {
|
|
1512
2010
|
console.error("Error getting response:", error);
|
|
1513
2011
|
throw error;
|
|
1514
2012
|
}
|
|
1515
2013
|
}
|
|
2014
|
+
async getServerSideActions(request) {
|
|
2015
|
+
const { messages: rawMessages, graphqlContext, agentStates, url } = request;
|
|
2016
|
+
const inputMessages = convertGqlInputToMessages(rawMessages);
|
|
2017
|
+
const langserveFunctions = [];
|
|
2018
|
+
for (const chainPromise of this.langserve) {
|
|
2019
|
+
try {
|
|
2020
|
+
const chain = await chainPromise;
|
|
2021
|
+
langserveFunctions.push(chain);
|
|
2022
|
+
} catch (error) {
|
|
2023
|
+
console.error("Error loading langserve chain:", error);
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
const remoteActions = await setupRemoteActions({
|
|
2027
|
+
remoteActionDefinitions: this.remoteActionDefinitions,
|
|
2028
|
+
graphqlContext,
|
|
2029
|
+
messages: inputMessages,
|
|
2030
|
+
agentStates
|
|
2031
|
+
});
|
|
2032
|
+
const configuredActions = typeof this.actions === "function" ? this.actions({
|
|
2033
|
+
properties: graphqlContext.properties,
|
|
2034
|
+
url
|
|
2035
|
+
}) : this.actions;
|
|
2036
|
+
return [
|
|
2037
|
+
...configuredActions,
|
|
2038
|
+
...langserveFunctions,
|
|
2039
|
+
...remoteActions
|
|
2040
|
+
];
|
|
2041
|
+
}
|
|
1516
2042
|
};
|
|
1517
2043
|
__name(CopilotRuntime, "CopilotRuntime");
|
|
1518
2044
|
function flattenToolCallsNoDuplicates(toolsByPriority) {
|
|
@@ -1529,14 +2055,14 @@ function flattenToolCallsNoDuplicates(toolsByPriority) {
|
|
|
1529
2055
|
__name(flattenToolCallsNoDuplicates, "flattenToolCallsNoDuplicates");
|
|
1530
2056
|
|
|
1531
2057
|
// src/lib/integrations/shared.ts
|
|
1532
|
-
var
|
|
2058
|
+
var import_type_graphql16 = require("type-graphql");
|
|
1533
2059
|
|
|
1534
2060
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
1535
|
-
var
|
|
1536
|
-
var
|
|
2061
|
+
var import_type_graphql15 = require("type-graphql");
|
|
2062
|
+
var import_rxjs4 = require("rxjs");
|
|
1537
2063
|
|
|
1538
2064
|
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
1539
|
-
var
|
|
2065
|
+
var import_type_graphql11 = require("type-graphql");
|
|
1540
2066
|
|
|
1541
2067
|
// src/graphql/inputs/message.input.ts
|
|
1542
2068
|
var import_type_graphql3 = require("type-graphql");
|
|
@@ -1553,6 +2079,7 @@ var ActionExecutionScope;
|
|
|
1553
2079
|
(function(ActionExecutionScope2) {
|
|
1554
2080
|
ActionExecutionScope2["server"] = "server";
|
|
1555
2081
|
ActionExecutionScope2["client"] = "client";
|
|
2082
|
+
ActionExecutionScope2["passThrough"] = "passThrough";
|
|
1556
2083
|
})(ActionExecutionScope || (ActionExecutionScope = {}));
|
|
1557
2084
|
var CopilotRequestType;
|
|
1558
2085
|
(function(CopilotRequestType2) {
|
|
@@ -1596,6 +2123,7 @@ var MessageInput = class extends BaseMessage {
|
|
|
1596
2123
|
textMessage;
|
|
1597
2124
|
actionExecutionMessage;
|
|
1598
2125
|
resultMessage;
|
|
2126
|
+
agentStateMessage;
|
|
1599
2127
|
};
|
|
1600
2128
|
__name(MessageInput, "MessageInput");
|
|
1601
2129
|
_ts_decorate2([
|
|
@@ -1616,6 +2144,12 @@ _ts_decorate2([
|
|
|
1616
2144
|
}),
|
|
1617
2145
|
_ts_metadata2("design:type", typeof ResultMessageInput === "undefined" ? Object : ResultMessageInput)
|
|
1618
2146
|
], MessageInput.prototype, "resultMessage", void 0);
|
|
2147
|
+
_ts_decorate2([
|
|
2148
|
+
(0, import_type_graphql3.Field)(() => AgentStateMessageInput, {
|
|
2149
|
+
nullable: true
|
|
2150
|
+
}),
|
|
2151
|
+
_ts_metadata2("design:type", typeof AgentStateMessageInput === "undefined" ? Object : AgentStateMessageInput)
|
|
2152
|
+
], MessageInput.prototype, "agentStateMessage", void 0);
|
|
1619
2153
|
MessageInput = _ts_decorate2([
|
|
1620
2154
|
(0, import_type_graphql3.InputType)()
|
|
1621
2155
|
], MessageInput);
|
|
@@ -1677,6 +2211,52 @@ _ts_decorate2([
|
|
|
1677
2211
|
ResultMessageInput = _ts_decorate2([
|
|
1678
2212
|
(0, import_type_graphql3.InputType)()
|
|
1679
2213
|
], ResultMessageInput);
|
|
2214
|
+
var AgentStateMessageInput = class {
|
|
2215
|
+
threadId;
|
|
2216
|
+
agentName;
|
|
2217
|
+
role;
|
|
2218
|
+
state;
|
|
2219
|
+
running;
|
|
2220
|
+
nodeName;
|
|
2221
|
+
runId;
|
|
2222
|
+
active;
|
|
2223
|
+
};
|
|
2224
|
+
__name(AgentStateMessageInput, "AgentStateMessageInput");
|
|
2225
|
+
_ts_decorate2([
|
|
2226
|
+
(0, import_type_graphql3.Field)(() => String),
|
|
2227
|
+
_ts_metadata2("design:type", String)
|
|
2228
|
+
], AgentStateMessageInput.prototype, "threadId", void 0);
|
|
2229
|
+
_ts_decorate2([
|
|
2230
|
+
(0, import_type_graphql3.Field)(() => String),
|
|
2231
|
+
_ts_metadata2("design:type", String)
|
|
2232
|
+
], AgentStateMessageInput.prototype, "agentName", void 0);
|
|
2233
|
+
_ts_decorate2([
|
|
2234
|
+
(0, import_type_graphql3.Field)(() => MessageRole),
|
|
2235
|
+
_ts_metadata2("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
|
|
2236
|
+
], AgentStateMessageInput.prototype, "role", void 0);
|
|
2237
|
+
_ts_decorate2([
|
|
2238
|
+
(0, import_type_graphql3.Field)(() => String),
|
|
2239
|
+
_ts_metadata2("design:type", String)
|
|
2240
|
+
], AgentStateMessageInput.prototype, "state", void 0);
|
|
2241
|
+
_ts_decorate2([
|
|
2242
|
+
(0, import_type_graphql3.Field)(() => Boolean),
|
|
2243
|
+
_ts_metadata2("design:type", Boolean)
|
|
2244
|
+
], AgentStateMessageInput.prototype, "running", void 0);
|
|
2245
|
+
_ts_decorate2([
|
|
2246
|
+
(0, import_type_graphql3.Field)(() => String),
|
|
2247
|
+
_ts_metadata2("design:type", String)
|
|
2248
|
+
], AgentStateMessageInput.prototype, "nodeName", void 0);
|
|
2249
|
+
_ts_decorate2([
|
|
2250
|
+
(0, import_type_graphql3.Field)(() => String),
|
|
2251
|
+
_ts_metadata2("design:type", String)
|
|
2252
|
+
], AgentStateMessageInput.prototype, "runId", void 0);
|
|
2253
|
+
_ts_decorate2([
|
|
2254
|
+
(0, import_type_graphql3.Field)(() => Boolean),
|
|
2255
|
+
_ts_metadata2("design:type", Boolean)
|
|
2256
|
+
], AgentStateMessageInput.prototype, "active", void 0);
|
|
2257
|
+
AgentStateMessageInput = _ts_decorate2([
|
|
2258
|
+
(0, import_type_graphql3.InputType)()
|
|
2259
|
+
], AgentStateMessageInput);
|
|
1680
2260
|
|
|
1681
2261
|
// src/graphql/inputs/frontend.input.ts
|
|
1682
2262
|
var import_type_graphql5 = require("type-graphql");
|
|
@@ -1741,6 +2321,7 @@ __name(_ts_metadata4, "_ts_metadata");
|
|
|
1741
2321
|
var FrontendInput = class {
|
|
1742
2322
|
toDeprecate_fullContext;
|
|
1743
2323
|
actions;
|
|
2324
|
+
url;
|
|
1744
2325
|
};
|
|
1745
2326
|
__name(FrontendInput, "FrontendInput");
|
|
1746
2327
|
_ts_decorate4([
|
|
@@ -1755,6 +2336,12 @@ _ts_decorate4([
|
|
|
1755
2336
|
]),
|
|
1756
2337
|
_ts_metadata4("design:type", Array)
|
|
1757
2338
|
], FrontendInput.prototype, "actions", void 0);
|
|
2339
|
+
_ts_decorate4([
|
|
2340
|
+
(0, import_type_graphql5.Field)(() => String, {
|
|
2341
|
+
nullable: true
|
|
2342
|
+
}),
|
|
2343
|
+
_ts_metadata4("design:type", String)
|
|
2344
|
+
], FrontendInput.prototype, "url", void 0);
|
|
1758
2345
|
FrontendInput = _ts_decorate4([
|
|
1759
2346
|
(0, import_type_graphql5.InputType)()
|
|
1760
2347
|
], FrontendInput);
|
|
@@ -1911,7 +2498,8 @@ ForwardedParametersInput = _ts_decorate7([
|
|
|
1911
2498
|
(0, import_type_graphql8.InputType)()
|
|
1912
2499
|
], ForwardedParametersInput);
|
|
1913
2500
|
|
|
1914
|
-
// src/graphql/inputs/
|
|
2501
|
+
// src/graphql/inputs/agent-session.input.ts
|
|
2502
|
+
var import_type_graphql9 = require("type-graphql");
|
|
1915
2503
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
1916
2504
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1917
2505
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1928,18 +2516,96 @@ function _ts_metadata8(k, v) {
|
|
|
1928
2516
|
return Reflect.metadata(k, v);
|
|
1929
2517
|
}
|
|
1930
2518
|
__name(_ts_metadata8, "_ts_metadata");
|
|
2519
|
+
var AgentSessionInput = class {
|
|
2520
|
+
agentName;
|
|
2521
|
+
threadId;
|
|
2522
|
+
nodeName;
|
|
2523
|
+
};
|
|
2524
|
+
__name(AgentSessionInput, "AgentSessionInput");
|
|
2525
|
+
_ts_decorate8([
|
|
2526
|
+
(0, import_type_graphql9.Field)(() => String),
|
|
2527
|
+
_ts_metadata8("design:type", String)
|
|
2528
|
+
], AgentSessionInput.prototype, "agentName", void 0);
|
|
2529
|
+
_ts_decorate8([
|
|
2530
|
+
(0, import_type_graphql9.Field)(() => String, {
|
|
2531
|
+
nullable: true
|
|
2532
|
+
}),
|
|
2533
|
+
_ts_metadata8("design:type", String)
|
|
2534
|
+
], AgentSessionInput.prototype, "threadId", void 0);
|
|
2535
|
+
_ts_decorate8([
|
|
2536
|
+
(0, import_type_graphql9.Field)(() => String, {
|
|
2537
|
+
nullable: true
|
|
2538
|
+
}),
|
|
2539
|
+
_ts_metadata8("design:type", String)
|
|
2540
|
+
], AgentSessionInput.prototype, "nodeName", void 0);
|
|
2541
|
+
AgentSessionInput = _ts_decorate8([
|
|
2542
|
+
(0, import_type_graphql9.InputType)()
|
|
2543
|
+
], AgentSessionInput);
|
|
2544
|
+
|
|
2545
|
+
// src/graphql/inputs/agent-state.input.ts
|
|
2546
|
+
var import_type_graphql10 = require("type-graphql");
|
|
2547
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
2548
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2549
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2550
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
2551
|
+
else
|
|
2552
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
2553
|
+
if (d = decorators[i])
|
|
2554
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2555
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2556
|
+
}
|
|
2557
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
2558
|
+
function _ts_metadata9(k, v) {
|
|
2559
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2560
|
+
return Reflect.metadata(k, v);
|
|
2561
|
+
}
|
|
2562
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
2563
|
+
var AgentStateInput = class {
|
|
2564
|
+
agentName;
|
|
2565
|
+
state;
|
|
2566
|
+
};
|
|
2567
|
+
__name(AgentStateInput, "AgentStateInput");
|
|
2568
|
+
_ts_decorate9([
|
|
2569
|
+
(0, import_type_graphql10.Field)(() => String),
|
|
2570
|
+
_ts_metadata9("design:type", String)
|
|
2571
|
+
], AgentStateInput.prototype, "agentName", void 0);
|
|
2572
|
+
_ts_decorate9([
|
|
2573
|
+
(0, import_type_graphql10.Field)(() => String),
|
|
2574
|
+
_ts_metadata9("design:type", String)
|
|
2575
|
+
], AgentStateInput.prototype, "state", void 0);
|
|
2576
|
+
AgentStateInput = _ts_decorate9([
|
|
2577
|
+
(0, import_type_graphql10.InputType)()
|
|
2578
|
+
], AgentStateInput);
|
|
2579
|
+
|
|
2580
|
+
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
2581
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
2582
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2583
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2584
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
2585
|
+
else
|
|
2586
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
2587
|
+
if (d = decorators[i])
|
|
2588
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2589
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2590
|
+
}
|
|
2591
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
2592
|
+
function _ts_metadata10(k, v) {
|
|
2593
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2594
|
+
return Reflect.metadata(k, v);
|
|
2595
|
+
}
|
|
2596
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
1931
2597
|
var GenerateCopilotResponseMetadataInput = class {
|
|
1932
2598
|
requestType;
|
|
1933
2599
|
};
|
|
1934
2600
|
__name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
|
|
1935
|
-
|
|
1936
|
-
(0,
|
|
2601
|
+
_ts_decorate10([
|
|
2602
|
+
(0, import_type_graphql11.Field)(() => CopilotRequestType, {
|
|
1937
2603
|
nullable: true
|
|
1938
2604
|
}),
|
|
1939
|
-
|
|
2605
|
+
_ts_metadata10("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
|
|
1940
2606
|
], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
|
|
1941
|
-
GenerateCopilotResponseMetadataInput =
|
|
1942
|
-
(0,
|
|
2607
|
+
GenerateCopilotResponseMetadataInput = _ts_decorate10([
|
|
2608
|
+
(0, import_type_graphql11.InputType)()
|
|
1943
2609
|
], GenerateCopilotResponseMetadataInput);
|
|
1944
2610
|
var GenerateCopilotResponseInput = class {
|
|
1945
2611
|
metadata;
|
|
@@ -1949,58 +2615,81 @@ var GenerateCopilotResponseInput = class {
|
|
|
1949
2615
|
frontend;
|
|
1950
2616
|
cloud;
|
|
1951
2617
|
forwardedParameters;
|
|
2618
|
+
agentSession;
|
|
2619
|
+
agentState;
|
|
2620
|
+
agentStates;
|
|
1952
2621
|
};
|
|
1953
2622
|
__name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
|
|
1954
|
-
|
|
1955
|
-
(0,
|
|
2623
|
+
_ts_decorate10([
|
|
2624
|
+
(0, import_type_graphql11.Field)(() => GenerateCopilotResponseMetadataInput, {
|
|
1956
2625
|
nullable: false
|
|
1957
2626
|
}),
|
|
1958
|
-
|
|
2627
|
+
_ts_metadata10("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
|
|
1959
2628
|
], GenerateCopilotResponseInput.prototype, "metadata", void 0);
|
|
1960
|
-
|
|
1961
|
-
(0,
|
|
2629
|
+
_ts_decorate10([
|
|
2630
|
+
(0, import_type_graphql11.Field)(() => String, {
|
|
1962
2631
|
nullable: true
|
|
1963
2632
|
}),
|
|
1964
|
-
|
|
2633
|
+
_ts_metadata10("design:type", String)
|
|
1965
2634
|
], GenerateCopilotResponseInput.prototype, "threadId", void 0);
|
|
1966
|
-
|
|
1967
|
-
(0,
|
|
2635
|
+
_ts_decorate10([
|
|
2636
|
+
(0, import_type_graphql11.Field)(() => String, {
|
|
1968
2637
|
nullable: true
|
|
1969
2638
|
}),
|
|
1970
|
-
|
|
2639
|
+
_ts_metadata10("design:type", String)
|
|
1971
2640
|
], GenerateCopilotResponseInput.prototype, "runId", void 0);
|
|
1972
|
-
|
|
1973
|
-
(0,
|
|
2641
|
+
_ts_decorate10([
|
|
2642
|
+
(0, import_type_graphql11.Field)(() => [
|
|
1974
2643
|
MessageInput
|
|
1975
2644
|
]),
|
|
1976
|
-
|
|
2645
|
+
_ts_metadata10("design:type", Array)
|
|
1977
2646
|
], GenerateCopilotResponseInput.prototype, "messages", void 0);
|
|
1978
|
-
|
|
1979
|
-
(0,
|
|
1980
|
-
|
|
2647
|
+
_ts_decorate10([
|
|
2648
|
+
(0, import_type_graphql11.Field)(() => FrontendInput),
|
|
2649
|
+
_ts_metadata10("design:type", typeof FrontendInput === "undefined" ? Object : FrontendInput)
|
|
1981
2650
|
], GenerateCopilotResponseInput.prototype, "frontend", void 0);
|
|
1982
|
-
|
|
1983
|
-
(0,
|
|
2651
|
+
_ts_decorate10([
|
|
2652
|
+
(0, import_type_graphql11.Field)(() => CloudInput, {
|
|
1984
2653
|
nullable: true
|
|
1985
2654
|
}),
|
|
1986
|
-
|
|
2655
|
+
_ts_metadata10("design:type", typeof CloudInput === "undefined" ? Object : CloudInput)
|
|
1987
2656
|
], GenerateCopilotResponseInput.prototype, "cloud", void 0);
|
|
1988
|
-
|
|
1989
|
-
(0,
|
|
2657
|
+
_ts_decorate10([
|
|
2658
|
+
(0, import_type_graphql11.Field)(() => ForwardedParametersInput, {
|
|
1990
2659
|
nullable: true
|
|
1991
2660
|
}),
|
|
1992
|
-
|
|
2661
|
+
_ts_metadata10("design:type", typeof ForwardedParametersInput === "undefined" ? Object : ForwardedParametersInput)
|
|
1993
2662
|
], GenerateCopilotResponseInput.prototype, "forwardedParameters", void 0);
|
|
1994
|
-
|
|
1995
|
-
(0,
|
|
2663
|
+
_ts_decorate10([
|
|
2664
|
+
(0, import_type_graphql11.Field)(() => AgentSessionInput, {
|
|
2665
|
+
nullable: true
|
|
2666
|
+
}),
|
|
2667
|
+
_ts_metadata10("design:type", typeof AgentSessionInput === "undefined" ? Object : AgentSessionInput)
|
|
2668
|
+
], GenerateCopilotResponseInput.prototype, "agentSession", void 0);
|
|
2669
|
+
_ts_decorate10([
|
|
2670
|
+
(0, import_type_graphql11.Field)(() => AgentStateInput, {
|
|
2671
|
+
nullable: true
|
|
2672
|
+
}),
|
|
2673
|
+
_ts_metadata10("design:type", typeof AgentStateInput === "undefined" ? Object : AgentStateInput)
|
|
2674
|
+
], GenerateCopilotResponseInput.prototype, "agentState", void 0);
|
|
2675
|
+
_ts_decorate10([
|
|
2676
|
+
(0, import_type_graphql11.Field)(() => [
|
|
2677
|
+
AgentStateInput
|
|
2678
|
+
], {
|
|
2679
|
+
nullable: true
|
|
2680
|
+
}),
|
|
2681
|
+
_ts_metadata10("design:type", Array)
|
|
2682
|
+
], GenerateCopilotResponseInput.prototype, "agentStates", void 0);
|
|
2683
|
+
GenerateCopilotResponseInput = _ts_decorate10([
|
|
2684
|
+
(0, import_type_graphql11.InputType)()
|
|
1996
2685
|
], GenerateCopilotResponseInput);
|
|
1997
2686
|
|
|
1998
2687
|
// src/graphql/types/copilot-response.type.ts
|
|
1999
|
-
var
|
|
2688
|
+
var import_type_graphql14 = require("type-graphql");
|
|
2000
2689
|
|
|
2001
2690
|
// src/graphql/types/message-status.type.ts
|
|
2002
|
-
var
|
|
2003
|
-
function
|
|
2691
|
+
var import_type_graphql12 = require("type-graphql");
|
|
2692
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
2004
2693
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2005
2694
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2006
2695
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2010,58 +2699,58 @@ function _ts_decorate9(decorators, target, key, desc) {
|
|
|
2010
2699
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2011
2700
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2012
2701
|
}
|
|
2013
|
-
__name(
|
|
2014
|
-
function
|
|
2702
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
2703
|
+
function _ts_metadata11(k, v) {
|
|
2015
2704
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2016
2705
|
return Reflect.metadata(k, v);
|
|
2017
2706
|
}
|
|
2018
|
-
__name(
|
|
2707
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
2019
2708
|
var MessageStatusCode;
|
|
2020
2709
|
(function(MessageStatusCode2) {
|
|
2021
2710
|
MessageStatusCode2["Pending"] = "pending";
|
|
2022
2711
|
MessageStatusCode2["Success"] = "success";
|
|
2023
2712
|
MessageStatusCode2["Failed"] = "failed";
|
|
2024
2713
|
})(MessageStatusCode || (MessageStatusCode = {}));
|
|
2025
|
-
(0,
|
|
2714
|
+
(0, import_type_graphql12.registerEnumType)(MessageStatusCode, {
|
|
2026
2715
|
name: "MessageStatusCode"
|
|
2027
2716
|
});
|
|
2028
2717
|
var BaseMessageStatus = /* @__PURE__ */ __name(class BaseMessageStatus2 {
|
|
2029
2718
|
code;
|
|
2030
2719
|
}, "BaseMessageStatus");
|
|
2031
|
-
|
|
2032
|
-
(0,
|
|
2033
|
-
|
|
2720
|
+
_ts_decorate11([
|
|
2721
|
+
(0, import_type_graphql12.Field)(() => MessageStatusCode),
|
|
2722
|
+
_ts_metadata11("design:type", String)
|
|
2034
2723
|
], BaseMessageStatus.prototype, "code", void 0);
|
|
2035
|
-
BaseMessageStatus =
|
|
2036
|
-
(0,
|
|
2724
|
+
BaseMessageStatus = _ts_decorate11([
|
|
2725
|
+
(0, import_type_graphql12.ObjectType)()
|
|
2037
2726
|
], BaseMessageStatus);
|
|
2038
2727
|
var PendingMessageStatus = class extends BaseMessageStatus {
|
|
2039
2728
|
code = "pending";
|
|
2040
2729
|
};
|
|
2041
2730
|
__name(PendingMessageStatus, "PendingMessageStatus");
|
|
2042
|
-
PendingMessageStatus =
|
|
2043
|
-
(0,
|
|
2731
|
+
PendingMessageStatus = _ts_decorate11([
|
|
2732
|
+
(0, import_type_graphql12.ObjectType)()
|
|
2044
2733
|
], PendingMessageStatus);
|
|
2045
2734
|
var SuccessMessageStatus = class extends BaseMessageStatus {
|
|
2046
2735
|
code = "success";
|
|
2047
2736
|
};
|
|
2048
2737
|
__name(SuccessMessageStatus, "SuccessMessageStatus");
|
|
2049
|
-
SuccessMessageStatus =
|
|
2050
|
-
(0,
|
|
2738
|
+
SuccessMessageStatus = _ts_decorate11([
|
|
2739
|
+
(0, import_type_graphql12.ObjectType)()
|
|
2051
2740
|
], SuccessMessageStatus);
|
|
2052
2741
|
var FailedMessageStatus = class extends BaseMessageStatus {
|
|
2053
2742
|
code = "failed";
|
|
2054
2743
|
reason;
|
|
2055
2744
|
};
|
|
2056
2745
|
__name(FailedMessageStatus, "FailedMessageStatus");
|
|
2057
|
-
|
|
2058
|
-
(0,
|
|
2059
|
-
|
|
2746
|
+
_ts_decorate11([
|
|
2747
|
+
(0, import_type_graphql12.Field)(() => String),
|
|
2748
|
+
_ts_metadata11("design:type", String)
|
|
2060
2749
|
], FailedMessageStatus.prototype, "reason", void 0);
|
|
2061
|
-
FailedMessageStatus =
|
|
2062
|
-
(0,
|
|
2750
|
+
FailedMessageStatus = _ts_decorate11([
|
|
2751
|
+
(0, import_type_graphql12.ObjectType)()
|
|
2063
2752
|
], FailedMessageStatus);
|
|
2064
|
-
var MessageStatusUnion = (0,
|
|
2753
|
+
var MessageStatusUnion = (0, import_type_graphql12.createUnionType)({
|
|
2065
2754
|
name: "MessageStatus",
|
|
2066
2755
|
types: () => [
|
|
2067
2756
|
PendingMessageStatus,
|
|
@@ -2072,8 +2761,8 @@ var MessageStatusUnion = (0, import_type_graphql10.createUnionType)({
|
|
|
2072
2761
|
|
|
2073
2762
|
// src/graphql/types/response-status.type.ts
|
|
2074
2763
|
var import_graphql_scalars = require("graphql-scalars");
|
|
2075
|
-
var
|
|
2076
|
-
function
|
|
2764
|
+
var import_type_graphql13 = require("type-graphql");
|
|
2765
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
2077
2766
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2078
2767
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2079
2768
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2083,30 +2772,30 @@ function _ts_decorate10(decorators, target, key, desc) {
|
|
|
2083
2772
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2084
2773
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2085
2774
|
}
|
|
2086
|
-
__name(
|
|
2087
|
-
function
|
|
2775
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
2776
|
+
function _ts_metadata12(k, v) {
|
|
2088
2777
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2089
2778
|
return Reflect.metadata(k, v);
|
|
2090
2779
|
}
|
|
2091
|
-
__name(
|
|
2780
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
2092
2781
|
var ResponseStatusCode;
|
|
2093
2782
|
(function(ResponseStatusCode2) {
|
|
2094
2783
|
ResponseStatusCode2["Pending"] = "pending";
|
|
2095
2784
|
ResponseStatusCode2["Success"] = "success";
|
|
2096
2785
|
ResponseStatusCode2["Failed"] = "failed";
|
|
2097
2786
|
})(ResponseStatusCode || (ResponseStatusCode = {}));
|
|
2098
|
-
(0,
|
|
2787
|
+
(0, import_type_graphql13.registerEnumType)(ResponseStatusCode, {
|
|
2099
2788
|
name: "ResponseStatusCode"
|
|
2100
2789
|
});
|
|
2101
2790
|
var BaseResponseStatus = /* @__PURE__ */ __name(class BaseResponseStatus2 {
|
|
2102
2791
|
code;
|
|
2103
2792
|
}, "BaseResponseStatus");
|
|
2104
|
-
|
|
2105
|
-
(0,
|
|
2106
|
-
|
|
2793
|
+
_ts_decorate12([
|
|
2794
|
+
(0, import_type_graphql13.Field)(() => ResponseStatusCode),
|
|
2795
|
+
_ts_metadata12("design:type", String)
|
|
2107
2796
|
], BaseResponseStatus.prototype, "code", void 0);
|
|
2108
|
-
BaseResponseStatus =
|
|
2109
|
-
(0,
|
|
2797
|
+
BaseResponseStatus = _ts_decorate12([
|
|
2798
|
+
(0, import_type_graphql13.InterfaceType)({
|
|
2110
2799
|
resolveType(value) {
|
|
2111
2800
|
if (value.code === "success") {
|
|
2112
2801
|
return SuccessResponseStatus;
|
|
@@ -2118,14 +2807,14 @@ BaseResponseStatus = _ts_decorate10([
|
|
|
2118
2807
|
return void 0;
|
|
2119
2808
|
}
|
|
2120
2809
|
}),
|
|
2121
|
-
(0,
|
|
2810
|
+
(0, import_type_graphql13.ObjectType)()
|
|
2122
2811
|
], BaseResponseStatus);
|
|
2123
2812
|
var PendingResponseStatus = class extends BaseResponseStatus {
|
|
2124
2813
|
code = "pending";
|
|
2125
2814
|
};
|
|
2126
2815
|
__name(PendingResponseStatus, "PendingResponseStatus");
|
|
2127
|
-
PendingResponseStatus =
|
|
2128
|
-
(0,
|
|
2816
|
+
PendingResponseStatus = _ts_decorate12([
|
|
2817
|
+
(0, import_type_graphql13.ObjectType)({
|
|
2129
2818
|
implements: BaseResponseStatus
|
|
2130
2819
|
})
|
|
2131
2820
|
], PendingResponseStatus);
|
|
@@ -2133,8 +2822,8 @@ var SuccessResponseStatus = class extends BaseResponseStatus {
|
|
|
2133
2822
|
code = "success";
|
|
2134
2823
|
};
|
|
2135
2824
|
__name(SuccessResponseStatus, "SuccessResponseStatus");
|
|
2136
|
-
SuccessResponseStatus =
|
|
2137
|
-
(0,
|
|
2825
|
+
SuccessResponseStatus = _ts_decorate12([
|
|
2826
|
+
(0, import_type_graphql13.ObjectType)({
|
|
2138
2827
|
implements: BaseResponseStatus
|
|
2139
2828
|
})
|
|
2140
2829
|
], SuccessResponseStatus);
|
|
@@ -2144,7 +2833,7 @@ var FailedResponseStatusReason;
|
|
|
2144
2833
|
FailedResponseStatusReason2["MESSAGE_STREAM_INTERRUPTED"] = "MESSAGE_STREAM_INTERRUPTED";
|
|
2145
2834
|
FailedResponseStatusReason2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
2146
2835
|
})(FailedResponseStatusReason || (FailedResponseStatusReason = {}));
|
|
2147
|
-
(0,
|
|
2836
|
+
(0, import_type_graphql13.registerEnumType)(FailedResponseStatusReason, {
|
|
2148
2837
|
name: "FailedResponseStatusReason"
|
|
2149
2838
|
});
|
|
2150
2839
|
var FailedResponseStatus = class extends BaseResponseStatus {
|
|
@@ -2153,22 +2842,22 @@ var FailedResponseStatus = class extends BaseResponseStatus {
|
|
|
2153
2842
|
details = null;
|
|
2154
2843
|
};
|
|
2155
2844
|
__name(FailedResponseStatus, "FailedResponseStatus");
|
|
2156
|
-
|
|
2157
|
-
(0,
|
|
2158
|
-
|
|
2845
|
+
_ts_decorate12([
|
|
2846
|
+
(0, import_type_graphql13.Field)(() => FailedResponseStatusReason),
|
|
2847
|
+
_ts_metadata12("design:type", String)
|
|
2159
2848
|
], FailedResponseStatus.prototype, "reason", void 0);
|
|
2160
|
-
|
|
2161
|
-
(0,
|
|
2849
|
+
_ts_decorate12([
|
|
2850
|
+
(0, import_type_graphql13.Field)(() => import_graphql_scalars.GraphQLJSON, {
|
|
2162
2851
|
nullable: true
|
|
2163
2852
|
}),
|
|
2164
|
-
|
|
2853
|
+
_ts_metadata12("design:type", typeof Record === "undefined" ? Object : Record)
|
|
2165
2854
|
], FailedResponseStatus.prototype, "details", void 0);
|
|
2166
|
-
FailedResponseStatus =
|
|
2167
|
-
(0,
|
|
2855
|
+
FailedResponseStatus = _ts_decorate12([
|
|
2856
|
+
(0, import_type_graphql13.ObjectType)({
|
|
2168
2857
|
implements: BaseResponseStatus
|
|
2169
2858
|
})
|
|
2170
2859
|
], FailedResponseStatus);
|
|
2171
|
-
var ResponseStatusUnion = (0,
|
|
2860
|
+
var ResponseStatusUnion = (0, import_type_graphql13.createUnionType)({
|
|
2172
2861
|
name: "ResponseStatus",
|
|
2173
2862
|
types: () => [
|
|
2174
2863
|
PendingResponseStatus,
|
|
@@ -2178,7 +2867,7 @@ var ResponseStatusUnion = (0, import_type_graphql11.createUnionType)({
|
|
|
2178
2867
|
});
|
|
2179
2868
|
|
|
2180
2869
|
// src/graphql/types/copilot-response.type.ts
|
|
2181
|
-
function
|
|
2870
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
2182
2871
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2183
2872
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2184
2873
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2188,31 +2877,31 @@ function _ts_decorate11(decorators, target, key, desc) {
|
|
|
2188
2877
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2189
2878
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2190
2879
|
}
|
|
2191
|
-
__name(
|
|
2192
|
-
function
|
|
2880
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
2881
|
+
function _ts_metadata13(k, v) {
|
|
2193
2882
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2194
2883
|
return Reflect.metadata(k, v);
|
|
2195
2884
|
}
|
|
2196
|
-
__name(
|
|
2885
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
2197
2886
|
var BaseMessageOutput = /* @__PURE__ */ __name(class BaseMessageOutput2 {
|
|
2198
2887
|
id;
|
|
2199
2888
|
createdAt;
|
|
2200
2889
|
status;
|
|
2201
2890
|
}, "BaseMessageOutput");
|
|
2202
|
-
|
|
2203
|
-
(0,
|
|
2204
|
-
|
|
2891
|
+
_ts_decorate13([
|
|
2892
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
2893
|
+
_ts_metadata13("design:type", String)
|
|
2205
2894
|
], BaseMessageOutput.prototype, "id", void 0);
|
|
2206
|
-
|
|
2207
|
-
(0,
|
|
2208
|
-
|
|
2895
|
+
_ts_decorate13([
|
|
2896
|
+
(0, import_type_graphql14.Field)(() => Date),
|
|
2897
|
+
_ts_metadata13("design:type", typeof Date === "undefined" ? Object : Date)
|
|
2209
2898
|
], BaseMessageOutput.prototype, "createdAt", void 0);
|
|
2210
|
-
|
|
2211
|
-
(0,
|
|
2212
|
-
|
|
2899
|
+
_ts_decorate13([
|
|
2900
|
+
(0, import_type_graphql14.Field)(() => MessageStatusUnion),
|
|
2901
|
+
_ts_metadata13("design:type", Object)
|
|
2213
2902
|
], BaseMessageOutput.prototype, "status", void 0);
|
|
2214
|
-
BaseMessageOutput =
|
|
2215
|
-
(0,
|
|
2903
|
+
BaseMessageOutput = _ts_decorate13([
|
|
2904
|
+
(0, import_type_graphql14.InterfaceType)({
|
|
2216
2905
|
resolveType(value) {
|
|
2217
2906
|
if (value.hasOwnProperty("content")) {
|
|
2218
2907
|
return TextMessageOutput;
|
|
@@ -2220,6 +2909,8 @@ BaseMessageOutput = _ts_decorate11([
|
|
|
2220
2909
|
return ActionExecutionMessageOutput;
|
|
2221
2910
|
} else if (value.hasOwnProperty("result")) {
|
|
2222
2911
|
return ResultMessageOutput;
|
|
2912
|
+
} else if (value.hasOwnProperty("state")) {
|
|
2913
|
+
return AgentStateMessageOutput;
|
|
2223
2914
|
}
|
|
2224
2915
|
return void 0;
|
|
2225
2916
|
}
|
|
@@ -2230,18 +2921,18 @@ var TextMessageOutput = class {
|
|
|
2230
2921
|
content;
|
|
2231
2922
|
};
|
|
2232
2923
|
__name(TextMessageOutput, "TextMessageOutput");
|
|
2233
|
-
|
|
2234
|
-
(0,
|
|
2235
|
-
|
|
2924
|
+
_ts_decorate13([
|
|
2925
|
+
(0, import_type_graphql14.Field)(() => MessageRole),
|
|
2926
|
+
_ts_metadata13("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
|
|
2236
2927
|
], TextMessageOutput.prototype, "role", void 0);
|
|
2237
|
-
|
|
2238
|
-
(0,
|
|
2928
|
+
_ts_decorate13([
|
|
2929
|
+
(0, import_type_graphql14.Field)(() => [
|
|
2239
2930
|
String
|
|
2240
2931
|
]),
|
|
2241
|
-
|
|
2932
|
+
_ts_metadata13("design:type", Array)
|
|
2242
2933
|
], TextMessageOutput.prototype, "content", void 0);
|
|
2243
|
-
TextMessageOutput =
|
|
2244
|
-
(0,
|
|
2934
|
+
TextMessageOutput = _ts_decorate13([
|
|
2935
|
+
(0, import_type_graphql14.ObjectType)({
|
|
2245
2936
|
implements: BaseMessageOutput
|
|
2246
2937
|
})
|
|
2247
2938
|
], TextMessageOutput);
|
|
@@ -2251,22 +2942,22 @@ var ActionExecutionMessageOutput = class {
|
|
|
2251
2942
|
arguments;
|
|
2252
2943
|
};
|
|
2253
2944
|
__name(ActionExecutionMessageOutput, "ActionExecutionMessageOutput");
|
|
2254
|
-
|
|
2255
|
-
(0,
|
|
2256
|
-
|
|
2945
|
+
_ts_decorate13([
|
|
2946
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
2947
|
+
_ts_metadata13("design:type", String)
|
|
2257
2948
|
], ActionExecutionMessageOutput.prototype, "name", void 0);
|
|
2258
|
-
|
|
2259
|
-
(0,
|
|
2260
|
-
|
|
2949
|
+
_ts_decorate13([
|
|
2950
|
+
(0, import_type_graphql14.Field)(() => ActionExecutionScope),
|
|
2951
|
+
_ts_metadata13("design:type", typeof ActionExecutionScope === "undefined" ? Object : ActionExecutionScope)
|
|
2261
2952
|
], ActionExecutionMessageOutput.prototype, "scope", void 0);
|
|
2262
|
-
|
|
2263
|
-
(0,
|
|
2953
|
+
_ts_decorate13([
|
|
2954
|
+
(0, import_type_graphql14.Field)(() => [
|
|
2264
2955
|
String
|
|
2265
2956
|
]),
|
|
2266
|
-
|
|
2957
|
+
_ts_metadata13("design:type", Array)
|
|
2267
2958
|
], ActionExecutionMessageOutput.prototype, "arguments", void 0);
|
|
2268
|
-
ActionExecutionMessageOutput =
|
|
2269
|
-
(0,
|
|
2959
|
+
ActionExecutionMessageOutput = _ts_decorate13([
|
|
2960
|
+
(0, import_type_graphql14.ObjectType)({
|
|
2270
2961
|
implements: BaseMessageOutput
|
|
2271
2962
|
})
|
|
2272
2963
|
], ActionExecutionMessageOutput);
|
|
@@ -2276,23 +2967,71 @@ var ResultMessageOutput = class {
|
|
|
2276
2967
|
result;
|
|
2277
2968
|
};
|
|
2278
2969
|
__name(ResultMessageOutput, "ResultMessageOutput");
|
|
2279
|
-
|
|
2280
|
-
(0,
|
|
2281
|
-
|
|
2970
|
+
_ts_decorate13([
|
|
2971
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
2972
|
+
_ts_metadata13("design:type", String)
|
|
2282
2973
|
], ResultMessageOutput.prototype, "actionExecutionId", void 0);
|
|
2283
|
-
|
|
2284
|
-
(0,
|
|
2285
|
-
|
|
2974
|
+
_ts_decorate13([
|
|
2975
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
2976
|
+
_ts_metadata13("design:type", String)
|
|
2286
2977
|
], ResultMessageOutput.prototype, "actionName", 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, "result", void 0);
|
|
2291
|
-
ResultMessageOutput =
|
|
2292
|
-
(0,
|
|
2982
|
+
ResultMessageOutput = _ts_decorate13([
|
|
2983
|
+
(0, import_type_graphql14.ObjectType)({
|
|
2293
2984
|
implements: BaseMessageOutput
|
|
2294
2985
|
})
|
|
2295
2986
|
], ResultMessageOutput);
|
|
2987
|
+
var AgentStateMessageOutput = class {
|
|
2988
|
+
threadId;
|
|
2989
|
+
agentName;
|
|
2990
|
+
nodeName;
|
|
2991
|
+
runId;
|
|
2992
|
+
active;
|
|
2993
|
+
role;
|
|
2994
|
+
state;
|
|
2995
|
+
running;
|
|
2996
|
+
};
|
|
2997
|
+
__name(AgentStateMessageOutput, "AgentStateMessageOutput");
|
|
2998
|
+
_ts_decorate13([
|
|
2999
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
3000
|
+
_ts_metadata13("design:type", String)
|
|
3001
|
+
], AgentStateMessageOutput.prototype, "threadId", void 0);
|
|
3002
|
+
_ts_decorate13([
|
|
3003
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
3004
|
+
_ts_metadata13("design:type", String)
|
|
3005
|
+
], AgentStateMessageOutput.prototype, "agentName", void 0);
|
|
3006
|
+
_ts_decorate13([
|
|
3007
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
3008
|
+
_ts_metadata13("design:type", String)
|
|
3009
|
+
], AgentStateMessageOutput.prototype, "nodeName", void 0);
|
|
3010
|
+
_ts_decorate13([
|
|
3011
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
3012
|
+
_ts_metadata13("design:type", String)
|
|
3013
|
+
], AgentStateMessageOutput.prototype, "runId", void 0);
|
|
3014
|
+
_ts_decorate13([
|
|
3015
|
+
(0, import_type_graphql14.Field)(() => Boolean),
|
|
3016
|
+
_ts_metadata13("design:type", Boolean)
|
|
3017
|
+
], AgentStateMessageOutput.prototype, "active", void 0);
|
|
3018
|
+
_ts_decorate13([
|
|
3019
|
+
(0, import_type_graphql14.Field)(() => MessageRole),
|
|
3020
|
+
_ts_metadata13("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
|
|
3021
|
+
], AgentStateMessageOutput.prototype, "role", void 0);
|
|
3022
|
+
_ts_decorate13([
|
|
3023
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
3024
|
+
_ts_metadata13("design:type", String)
|
|
3025
|
+
], AgentStateMessageOutput.prototype, "state", void 0);
|
|
3026
|
+
_ts_decorate13([
|
|
3027
|
+
(0, import_type_graphql14.Field)(() => Boolean),
|
|
3028
|
+
_ts_metadata13("design:type", Boolean)
|
|
3029
|
+
], AgentStateMessageOutput.prototype, "running", void 0);
|
|
3030
|
+
AgentStateMessageOutput = _ts_decorate13([
|
|
3031
|
+
(0, import_type_graphql14.ObjectType)({
|
|
3032
|
+
implements: BaseMessageOutput
|
|
3033
|
+
})
|
|
3034
|
+
], AgentStateMessageOutput);
|
|
2296
3035
|
var CopilotResponse = class {
|
|
2297
3036
|
threadId;
|
|
2298
3037
|
status;
|
|
@@ -2300,28 +3039,28 @@ var CopilotResponse = class {
|
|
|
2300
3039
|
messages;
|
|
2301
3040
|
};
|
|
2302
3041
|
__name(CopilotResponse, "CopilotResponse");
|
|
2303
|
-
|
|
2304
|
-
(0,
|
|
2305
|
-
|
|
3042
|
+
_ts_decorate13([
|
|
3043
|
+
(0, import_type_graphql14.Field)(() => String),
|
|
3044
|
+
_ts_metadata13("design:type", String)
|
|
2306
3045
|
], CopilotResponse.prototype, "threadId", void 0);
|
|
2307
|
-
|
|
2308
|
-
(0,
|
|
2309
|
-
|
|
3046
|
+
_ts_decorate13([
|
|
3047
|
+
(0, import_type_graphql14.Field)(() => ResponseStatusUnion),
|
|
3048
|
+
_ts_metadata13("design:type", Object)
|
|
2310
3049
|
], CopilotResponse.prototype, "status", void 0);
|
|
2311
|
-
|
|
2312
|
-
(0,
|
|
3050
|
+
_ts_decorate13([
|
|
3051
|
+
(0, import_type_graphql14.Field)({
|
|
2313
3052
|
nullable: true
|
|
2314
3053
|
}),
|
|
2315
|
-
|
|
3054
|
+
_ts_metadata13("design:type", String)
|
|
2316
3055
|
], CopilotResponse.prototype, "runId", void 0);
|
|
2317
|
-
|
|
2318
|
-
(0,
|
|
3056
|
+
_ts_decorate13([
|
|
3057
|
+
(0, import_type_graphql14.Field)(() => [
|
|
2319
3058
|
BaseMessageOutput
|
|
2320
3059
|
]),
|
|
2321
|
-
|
|
3060
|
+
_ts_metadata13("design:type", Array)
|
|
2322
3061
|
], CopilotResponse.prototype, "messages", void 0);
|
|
2323
|
-
CopilotResponse =
|
|
2324
|
-
(0,
|
|
3062
|
+
CopilotResponse = _ts_decorate13([
|
|
3063
|
+
(0, import_type_graphql14.ObjectType)()
|
|
2325
3064
|
], CopilotResponse);
|
|
2326
3065
|
|
|
2327
3066
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
@@ -2363,18 +3102,9 @@ var UnknownErrorResponse = class extends FailedResponseStatus {
|
|
|
2363
3102
|
};
|
|
2364
3103
|
__name(UnknownErrorResponse, "UnknownErrorResponse");
|
|
2365
3104
|
|
|
2366
|
-
// src/lib/telemetry-client.ts
|
|
2367
|
-
var import_shared8 = require("@copilotkit/shared");
|
|
2368
|
-
var packageJson = require_package();
|
|
2369
|
-
var telemetryClient = new import_shared8.TelemetryClient({
|
|
2370
|
-
packageName: packageJson.name,
|
|
2371
|
-
packageVersion: packageJson.version
|
|
2372
|
-
});
|
|
2373
|
-
var telemetry_client_default = telemetryClient;
|
|
2374
|
-
|
|
2375
3105
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
2376
3106
|
var import_shared9 = require("@copilotkit/shared");
|
|
2377
|
-
function
|
|
3107
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
2378
3108
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2379
3109
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2380
3110
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2384,12 +3114,12 @@ function _ts_decorate12(decorators, target, key, desc) {
|
|
|
2384
3114
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2385
3115
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2386
3116
|
}
|
|
2387
|
-
__name(
|
|
2388
|
-
function
|
|
3117
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
3118
|
+
function _ts_metadata14(k, v) {
|
|
2389
3119
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2390
3120
|
return Reflect.metadata(k, v);
|
|
2391
3121
|
}
|
|
2392
|
-
__name(
|
|
3122
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
2393
3123
|
function _ts_param(paramIndex, decorator) {
|
|
2394
3124
|
return function(target, key) {
|
|
2395
3125
|
decorator(target, key, paramIndex);
|
|
@@ -2398,7 +3128,6 @@ function _ts_param(paramIndex, decorator) {
|
|
|
2398
3128
|
__name(_ts_param, "_ts_param");
|
|
2399
3129
|
var invokeGuardrails = /* @__PURE__ */ __name(async ({ baseUrl, copilotCloudPublicApiKey, data, onResult, onError }) => {
|
|
2400
3130
|
var _a;
|
|
2401
|
-
console.log("invokeGuardrails.baseUrl", baseUrl);
|
|
2402
3131
|
if (data.messages.length && ((_a = data.messages[data.messages.length - 1].textMessage) == null ? void 0 : _a.role) === MessageRole.user) {
|
|
2403
3132
|
const messages = data.messages.filter((m) => m.textMessage !== void 0 && (m.textMessage.role === MessageRole.user || m.textMessage.role === MessageRole.assistant)).map((m) => ({
|
|
2404
3133
|
role: m.textMessage.role,
|
|
@@ -2444,8 +3173,6 @@ var CopilotResolver = class {
|
|
|
2444
3173
|
logger2.debug({
|
|
2445
3174
|
data
|
|
2446
3175
|
}, "Generating Copilot response");
|
|
2447
|
-
const copilotRuntime = ctx._copilotkit.runtime;
|
|
2448
|
-
const serviceAdapter = ctx._copilotkit.serviceAdapter;
|
|
2449
3176
|
if (properties) {
|
|
2450
3177
|
logger2.debug("Properties provided, merging with context properties");
|
|
2451
3178
|
ctx.properties = {
|
|
@@ -2453,6 +3180,8 @@ var CopilotResolver = class {
|
|
|
2453
3180
|
...properties
|
|
2454
3181
|
};
|
|
2455
3182
|
}
|
|
3183
|
+
const copilotRuntime = ctx._copilotkit.runtime;
|
|
3184
|
+
const serviceAdapter = ctx._copilotkit.serviceAdapter;
|
|
2456
3185
|
let copilotCloudPublicApiKey = null;
|
|
2457
3186
|
let copilotCloudBaseUrl;
|
|
2458
3187
|
if (data.cloud) {
|
|
@@ -2480,9 +3209,9 @@ var CopilotResolver = class {
|
|
|
2480
3209
|
});
|
|
2481
3210
|
}
|
|
2482
3211
|
logger2.debug("Setting up subjects");
|
|
2483
|
-
const responseStatus$ = new
|
|
2484
|
-
const interruptStreaming$ = new
|
|
2485
|
-
const guardrailsResult$ = new
|
|
3212
|
+
const responseStatus$ = new import_rxjs4.ReplaySubject();
|
|
3213
|
+
const interruptStreaming$ = new import_rxjs4.ReplaySubject();
|
|
3214
|
+
const guardrailsResult$ = new import_rxjs4.ReplaySubject();
|
|
2486
3215
|
let outputMessages = [];
|
|
2487
3216
|
let resolveOutputMessagesPromise;
|
|
2488
3217
|
let rejectOutputMessagesPromise;
|
|
@@ -2491,22 +3220,25 @@ var CopilotResolver = class {
|
|
|
2491
3220
|
rejectOutputMessagesPromise = reject;
|
|
2492
3221
|
});
|
|
2493
3222
|
logger2.debug("Processing");
|
|
2494
|
-
const { eventSource, threadId = (0, import_shared9.randomId)(), runId,
|
|
3223
|
+
const { eventSource, threadId = (0, import_shared9.randomId)(), runId, serverSideActions, actionInputsWithoutAgents } = await copilotRuntime.processRuntimeRequest({
|
|
2495
3224
|
serviceAdapter,
|
|
2496
3225
|
messages: data.messages,
|
|
2497
3226
|
actions: data.frontend.actions,
|
|
2498
3227
|
threadId: data.threadId,
|
|
2499
3228
|
runId: data.runId,
|
|
2500
3229
|
publicApiKey: void 0,
|
|
2501
|
-
properties: ctx.properties || {},
|
|
2502
3230
|
outputMessagesPromise,
|
|
2503
|
-
|
|
3231
|
+
graphqlContext: ctx,
|
|
3232
|
+
forwardedParameters: data.forwardedParameters,
|
|
3233
|
+
agentSession: data.agentSession,
|
|
3234
|
+
agentStates: data.agentStates,
|
|
3235
|
+
url: data.frontend.url
|
|
2504
3236
|
});
|
|
2505
3237
|
logger2.debug("Event source created, creating response");
|
|
2506
3238
|
const response = {
|
|
2507
3239
|
threadId,
|
|
2508
3240
|
runId,
|
|
2509
|
-
status: (0,
|
|
3241
|
+
status: (0, import_rxjs4.firstValueFrom)(responseStatus$),
|
|
2510
3242
|
messages: new import_graphql_yoga.Repeater(async (pushMessage, stopStreamingMessages) => {
|
|
2511
3243
|
var _a2, _b2;
|
|
2512
3244
|
logger2.debug("Messages repeater created");
|
|
@@ -2557,14 +3289,18 @@ var CopilotResolver = class {
|
|
|
2557
3289
|
});
|
|
2558
3290
|
}
|
|
2559
3291
|
let eventStreamSubscription;
|
|
2560
|
-
const eventStream = eventSource.
|
|
2561
|
-
|
|
2562
|
-
guardrailsResult$: ((_b2 = data.cloud) == null ? void 0 : _b2.guardrails) ? guardrailsResult$ : null
|
|
3292
|
+
const eventStream = eventSource.processRuntimeEvents({
|
|
3293
|
+
serverSideActions,
|
|
3294
|
+
guardrailsResult$: ((_b2 = data.cloud) == null ? void 0 : _b2.guardrails) ? guardrailsResult$ : null,
|
|
3295
|
+
actionInputsWithoutAgents: actionInputsWithoutAgents.filter(
|
|
3296
|
+
// TODO-AGENTS: do not exclude ALL server side actions
|
|
3297
|
+
(action) => !serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
|
|
3298
|
+
)
|
|
2563
3299
|
}).pipe(
|
|
2564
3300
|
// shareReplay() ensures that later subscribers will see the whole stream instead of
|
|
2565
3301
|
// just the events that were emitted after the subscriber was added.
|
|
2566
|
-
(0,
|
|
2567
|
-
(0,
|
|
3302
|
+
(0, import_rxjs4.shareReplay)(),
|
|
3303
|
+
(0, import_rxjs4.finalize)(() => {
|
|
2568
3304
|
logger2.debug("Event stream finalized");
|
|
2569
3305
|
})
|
|
2570
3306
|
);
|
|
@@ -2575,22 +3311,22 @@ var CopilotResolver = class {
|
|
|
2575
3311
|
case RuntimeEventTypes.TextMessageStart:
|
|
2576
3312
|
const textMessageContentStream = eventStream.pipe(
|
|
2577
3313
|
// skip until this message start event
|
|
2578
|
-
(0,
|
|
3314
|
+
(0, import_rxjs4.skipWhile)((e) => e !== event),
|
|
2579
3315
|
// take until the message end event
|
|
2580
|
-
(0,
|
|
3316
|
+
(0, import_rxjs4.takeWhile)((e) => e.type != RuntimeEventTypes.TextMessageEnd)
|
|
2581
3317
|
);
|
|
2582
|
-
const streamingTextStatus = new
|
|
3318
|
+
const streamingTextStatus = new import_rxjs4.Subject();
|
|
2583
3319
|
const messageId = (0, import_shared9.randomId)();
|
|
2584
3320
|
pushMessage({
|
|
2585
3321
|
id: messageId,
|
|
2586
|
-
status: (0,
|
|
3322
|
+
status: (0, import_rxjs4.firstValueFrom)(streamingTextStatus),
|
|
2587
3323
|
createdAt: /* @__PURE__ */ new Date(),
|
|
2588
3324
|
role: MessageRole.assistant,
|
|
2589
3325
|
content: new import_graphql_yoga.Repeater(async (pushTextChunk, stopStreamingText) => {
|
|
2590
3326
|
logger2.debug("Text message content repeater created");
|
|
2591
3327
|
const textChunks = [];
|
|
2592
3328
|
let textSubscription;
|
|
2593
|
-
interruptStreaming$.pipe((0,
|
|
3329
|
+
interruptStreaming$.pipe((0, import_rxjs4.shareReplay)(), (0, import_rxjs4.take)(1), (0, import_rxjs4.tap)(({ reason, messageId: messageId2 }) => {
|
|
2594
3330
|
logger2.debug({
|
|
2595
3331
|
reason,
|
|
2596
3332
|
messageId: messageId2
|
|
@@ -2641,11 +3377,11 @@ var CopilotResolver = class {
|
|
|
2641
3377
|
break;
|
|
2642
3378
|
case RuntimeEventTypes.ActionExecutionStart:
|
|
2643
3379
|
logger2.debug("Action execution start event received");
|
|
2644
|
-
const actionExecutionArgumentStream = eventStream.pipe((0,
|
|
2645
|
-
const streamingArgumentsStatus = new
|
|
3380
|
+
const actionExecutionArgumentStream = eventStream.pipe((0, import_rxjs4.skipWhile)((e) => e !== event), (0, import_rxjs4.takeWhile)((e) => e.type != RuntimeEventTypes.ActionExecutionEnd));
|
|
3381
|
+
const streamingArgumentsStatus = new import_rxjs4.Subject();
|
|
2646
3382
|
pushMessage({
|
|
2647
3383
|
id: event.actionExecutionId,
|
|
2648
|
-
status: (0,
|
|
3384
|
+
status: (0, import_rxjs4.firstValueFrom)(streamingArgumentsStatus),
|
|
2649
3385
|
createdAt: /* @__PURE__ */ new Date(),
|
|
2650
3386
|
name: event.actionName,
|
|
2651
3387
|
scope: event.scope,
|
|
@@ -2707,6 +3443,36 @@ var CopilotResolver = class {
|
|
|
2707
3443
|
result: event.result
|
|
2708
3444
|
}));
|
|
2709
3445
|
break;
|
|
3446
|
+
case RuntimeEventTypes.AgentStateMessage:
|
|
3447
|
+
logger2.debug({
|
|
3448
|
+
event
|
|
3449
|
+
}, "Agent message event received");
|
|
3450
|
+
pushMessage({
|
|
3451
|
+
id: (0, import_shared9.randomId)(),
|
|
3452
|
+
status: new SuccessMessageStatus(),
|
|
3453
|
+
threadId: event.threadId,
|
|
3454
|
+
agentName: event.agentName,
|
|
3455
|
+
nodeName: event.nodeName,
|
|
3456
|
+
runId: event.runId,
|
|
3457
|
+
active: event.active,
|
|
3458
|
+
state: event.state,
|
|
3459
|
+
running: event.running,
|
|
3460
|
+
role: MessageRole.assistant,
|
|
3461
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
3462
|
+
});
|
|
3463
|
+
outputMessages.push((0, import_class_transformer2.plainToInstance)(AgentStateMessage, {
|
|
3464
|
+
id: (0, import_shared9.randomId)(),
|
|
3465
|
+
threadId: event.threadId,
|
|
3466
|
+
agentName: event.agentName,
|
|
3467
|
+
nodeName: event.nodeName,
|
|
3468
|
+
runId: event.runId,
|
|
3469
|
+
active: event.active,
|
|
3470
|
+
state: event.state,
|
|
3471
|
+
running: event.running,
|
|
3472
|
+
role: MessageRole.assistant,
|
|
3473
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
3474
|
+
}));
|
|
3475
|
+
break;
|
|
2710
3476
|
}
|
|
2711
3477
|
},
|
|
2712
3478
|
error: (err) => {
|
|
@@ -2725,7 +3491,7 @@ var CopilotResolver = class {
|
|
|
2725
3491
|
logger2.debug("Event stream completed");
|
|
2726
3492
|
if ((_a3 = data.cloud) == null ? void 0 : _a3.guardrails) {
|
|
2727
3493
|
logger2.debug("Guardrails is enabled, waiting for guardrails result");
|
|
2728
|
-
await (0,
|
|
3494
|
+
await (0, import_rxjs4.firstValueFrom)(guardrailsResult$);
|
|
2729
3495
|
}
|
|
2730
3496
|
responseStatus$.next(new SuccessResponseStatus());
|
|
2731
3497
|
eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
|
|
@@ -2739,29 +3505,29 @@ var CopilotResolver = class {
|
|
|
2739
3505
|
}
|
|
2740
3506
|
};
|
|
2741
3507
|
__name(CopilotResolver, "CopilotResolver");
|
|
2742
|
-
|
|
2743
|
-
(0,
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
3508
|
+
_ts_decorate14([
|
|
3509
|
+
(0, import_type_graphql15.Query)(() => String),
|
|
3510
|
+
_ts_metadata14("design:type", Function),
|
|
3511
|
+
_ts_metadata14("design:paramtypes", []),
|
|
3512
|
+
_ts_metadata14("design:returntype", Promise)
|
|
2747
3513
|
], CopilotResolver.prototype, "hello", null);
|
|
2748
|
-
|
|
2749
|
-
(0,
|
|
2750
|
-
_ts_param(0, (0,
|
|
2751
|
-
_ts_param(1, (0,
|
|
2752
|
-
_ts_param(2, (0,
|
|
3514
|
+
_ts_decorate14([
|
|
3515
|
+
(0, import_type_graphql15.Mutation)(() => CopilotResponse),
|
|
3516
|
+
_ts_param(0, (0, import_type_graphql15.Ctx)()),
|
|
3517
|
+
_ts_param(1, (0, import_type_graphql15.Arg)("data")),
|
|
3518
|
+
_ts_param(2, (0, import_type_graphql15.Arg)("properties", () => import_graphql_scalars2.GraphQLJSONObject, {
|
|
2753
3519
|
nullable: true
|
|
2754
3520
|
})),
|
|
2755
|
-
|
|
2756
|
-
|
|
3521
|
+
_ts_metadata14("design:type", Function),
|
|
3522
|
+
_ts_metadata14("design:paramtypes", [
|
|
2757
3523
|
typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
|
|
2758
3524
|
typeof GenerateCopilotResponseInput === "undefined" ? Object : GenerateCopilotResponseInput,
|
|
2759
3525
|
typeof CopilotRequestContextProperties === "undefined" ? Object : CopilotRequestContextProperties
|
|
2760
3526
|
]),
|
|
2761
|
-
|
|
3527
|
+
_ts_metadata14("design:returntype", Promise)
|
|
2762
3528
|
], CopilotResolver.prototype, "generateCopilotResponse", null);
|
|
2763
|
-
CopilotResolver =
|
|
2764
|
-
(0,
|
|
3529
|
+
CopilotResolver = _ts_decorate14([
|
|
3530
|
+
(0, import_type_graphql15.Resolver)(() => CopilotResponse)
|
|
2765
3531
|
], CopilotResolver);
|
|
2766
3532
|
|
|
2767
3533
|
// src/lib/integrations/shared.ts
|
|
@@ -2816,7 +3582,7 @@ async function createContext(initialContext, copilotKitContext, contextLogger, p
|
|
|
2816
3582
|
__name(createContext, "createContext");
|
|
2817
3583
|
function buildSchema(options = {}) {
|
|
2818
3584
|
logger.debug("Building GraphQL schema...");
|
|
2819
|
-
const schema = (0,
|
|
3585
|
+
const schema = (0, import_type_graphql16.buildSchemaSync)({
|
|
2820
3586
|
resolvers: [
|
|
2821
3587
|
CopilotResolver
|
|
2822
3588
|
],
|