@copilotkit/runtime 1.1.3-feat-runtime-remote-actions.2 → 1.2.1
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 +17 -13
- package/__snapshots__/schema/schema.graphql +0 -41
- package/dist/{chunk-BJ2LVHWA.mjs → chunk-736EEICU.mjs} +3 -3
- package/dist/{chunk-W7RRKPE2.mjs → chunk-DMO6FA25.mjs} +2 -2
- package/dist/{chunk-JYLUCJP7.mjs → chunk-DYF5MUAH.mjs} +2 -2
- package/dist/{chunk-TBZGOJJX.mjs → chunk-GEIBJJQ4.mjs} +2 -14
- package/dist/chunk-GEIBJJQ4.mjs.map +1 -0
- package/dist/chunk-PB24CCIJ.mjs +158 -0
- package/dist/chunk-PB24CCIJ.mjs.map +1 -0
- package/dist/{chunk-7FSNQXPE.mjs → chunk-Q5ZTE7WH.mjs} +158 -786
- package/dist/chunk-Q5ZTE7WH.mjs.map +1 -0
- package/dist/{chunk-73NMP3DI.mjs → chunk-URMISMK2.mjs} +2 -2
- package/dist/{chunk-WRPRFRSL.mjs → chunk-YMUS43FR.mjs} +2 -2
- package/dist/graphql/types/converted/index.d.ts +1 -1
- package/dist/graphql/types/converted/index.js +0 -13
- package/dist/graphql/types/converted/index.js.map +1 -1
- package/dist/graphql/types/converted/index.mjs +1 -3
- package/dist/{index-079752b9.d.ts → index-13aa818e.d.ts} +1 -1
- package/dist/{index-0476e4f7.d.ts → index-aa091e3c.d.ts} +2 -24
- package/dist/index.d.ts +7 -7
- package/dist/index.js +245 -982
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/{langserve-d6073a3b.d.ts → langserve-a54438c6.d.ts} +11 -24
- package/dist/lib/index.d.ts +7 -7
- package/dist/lib/index.js +245 -982
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +8 -8
- package/dist/lib/integrations/index.d.ts +6 -6
- package/dist/lib/integrations/index.js +182 -437
- 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 +182 -437
- 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 +182 -437
- 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 +182 -437
- 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.map +1 -1
- package/dist/service-adapters/index.mjs +3 -3
- package/dist/{copilot-runtime-d427e991.d.ts → shared-c5362338.d.ts} +38 -65
- package/package.json +5 -7
- package/src/graphql/inputs/generate-copilot-response.input.ts +0 -11
- package/src/graphql/inputs/message.input.ts +0 -30
- package/src/graphql/resolvers/copilot.resolver.ts +12 -56
- package/src/graphql/types/converted/index.ts +0 -15
- package/src/graphql/types/copilot-response.type.ts +0 -29
- package/src/graphql/types/enums.ts +0 -1
- package/src/lib/copilot-runtime.ts +231 -0
- package/src/lib/index.ts +1 -1
- package/src/lib/integrations/shared.ts +1 -1
- package/src/service-adapters/conversion.ts +0 -16
- package/src/service-adapters/events.ts +19 -101
- package/dist/chunk-5TYP4A3G.mjs +0 -260
- package/dist/chunk-5TYP4A3G.mjs.map +0 -1
- package/dist/chunk-7FSNQXPE.mjs.map +0 -1
- package/dist/chunk-TBZGOJJX.mjs.map +0 -1
- package/src/agents/langgraph/event-source.ts +0 -222
- package/src/agents/langgraph/events.ts +0 -309
- package/src/graphql/inputs/agent-session.input.ts +0 -13
- package/src/graphql/inputs/agent-state.input.ts +0 -10
- package/src/lib/runtime/copilot-runtime.ts +0 -360
- package/src/lib/runtime/remote-actions.ts +0 -241
- /package/dist/{chunk-BJ2LVHWA.mjs.map → chunk-736EEICU.mjs.map} +0 -0
- /package/dist/{chunk-W7RRKPE2.mjs.map → chunk-DMO6FA25.mjs.map} +0 -0
- /package/dist/{chunk-JYLUCJP7.mjs.map → chunk-DYF5MUAH.mjs.map} +0 -0
- /package/dist/{chunk-73NMP3DI.mjs.map → chunk-URMISMK2.mjs.map} +0 -0
- /package/dist/{chunk-WRPRFRSL.mjs.map → chunk-YMUS43FR.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, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
18
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () =>
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, 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.2.1",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -59,9 +59,7 @@ 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"
|
|
63
|
-
"link:global": "pnpm link --global",
|
|
64
|
-
"unlink:global": "pnpm unlink --global"
|
|
62
|
+
"generate-graphql-schema": "rm -rf __snapshots__ && ts-node ./scripts/generate-gql-schema.ts"
|
|
65
63
|
},
|
|
66
64
|
devDependencies: {
|
|
67
65
|
"@swc/core": "1.5.28",
|
|
@@ -140,8 +138,8 @@ __export(lib_exports, {
|
|
|
140
138
|
});
|
|
141
139
|
module.exports = __toCommonJS(lib_exports);
|
|
142
140
|
|
|
143
|
-
// src/lib/
|
|
144
|
-
var
|
|
141
|
+
// src/lib/copilot-runtime.ts
|
|
142
|
+
var import_shared7 = require("@copilotkit/shared");
|
|
145
143
|
|
|
146
144
|
// src/service-adapters/openai/openai-adapter.ts
|
|
147
145
|
var import_openai = __toESM(require("openai"));
|
|
@@ -199,17 +197,6 @@ var ResultMessage = class extends BaseMessage {
|
|
|
199
197
|
result;
|
|
200
198
|
};
|
|
201
199
|
__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");
|
|
213
200
|
|
|
214
201
|
// src/service-adapters/openai/utils.ts
|
|
215
202
|
function limitMessagesToTokenCount(messages, tools, model, maxTokens) {
|
|
@@ -1279,366 +1266,7 @@ var GroqAdapter = class {
|
|
|
1279
1266
|
__name(GroqAdapter, "GroqAdapter");
|
|
1280
1267
|
|
|
1281
1268
|
// 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
|
|
1294
1269
|
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
|
|
1642
1270
|
var RuntimeEventTypes;
|
|
1643
1271
|
(function(RuntimeEventTypes2) {
|
|
1644
1272
|
RuntimeEventTypes2["TextMessageStart"] = "TextMessageStart";
|
|
@@ -1648,9 +1276,8 @@ var RuntimeEventTypes;
|
|
|
1648
1276
|
RuntimeEventTypes2["ActionExecutionArgs"] = "ActionExecutionArgs";
|
|
1649
1277
|
RuntimeEventTypes2["ActionExecutionEnd"] = "ActionExecutionEnd";
|
|
1650
1278
|
RuntimeEventTypes2["ActionExecutionResult"] = "ActionExecutionResult";
|
|
1651
|
-
RuntimeEventTypes2["AgentStateMessage"] = "AgentStateMessage";
|
|
1652
1279
|
})(RuntimeEventTypes || (RuntimeEventTypes = {}));
|
|
1653
|
-
var RuntimeEventSubject = class extends
|
|
1280
|
+
var RuntimeEventSubject = class extends import_rxjs.ReplaySubject {
|
|
1654
1281
|
constructor() {
|
|
1655
1282
|
super();
|
|
1656
1283
|
}
|
|
@@ -1707,19 +1334,6 @@ var RuntimeEventSubject = class extends import_rxjs2.ReplaySubject {
|
|
|
1707
1334
|
result
|
|
1708
1335
|
});
|
|
1709
1336
|
}
|
|
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
|
-
}
|
|
1723
1337
|
};
|
|
1724
1338
|
__name(RuntimeEventSubject, "RuntimeEventSubject");
|
|
1725
1339
|
var RuntimeEventSource = class {
|
|
@@ -1728,31 +1342,26 @@ var RuntimeEventSource = class {
|
|
|
1728
1342
|
async stream(callback) {
|
|
1729
1343
|
this.callback = callback;
|
|
1730
1344
|
}
|
|
1731
|
-
|
|
1345
|
+
process({ serversideActions, guardrailsResult$ }) {
|
|
1732
1346
|
this.callback(this.eventStream$).catch((error) => {
|
|
1733
1347
|
console.error("Error in event source callback", error);
|
|
1734
1348
|
});
|
|
1735
1349
|
return this.eventStream$.pipe(
|
|
1736
1350
|
// mark tools for server side execution
|
|
1737
|
-
(0,
|
|
1351
|
+
(0, import_rxjs.map)((event) => {
|
|
1738
1352
|
if (event.type === "ActionExecutionStart") {
|
|
1739
|
-
|
|
1740
|
-
event.scope = serverSideActions.find((action) => action.name === event.actionName) ? "server" : "client";
|
|
1741
|
-
}
|
|
1353
|
+
event.scope = serversideActions.find((action) => action.name === event.actionName) ? "server" : "client";
|
|
1742
1354
|
}
|
|
1743
1355
|
return event;
|
|
1744
1356
|
}),
|
|
1745
1357
|
// track state
|
|
1746
|
-
(0,
|
|
1747
|
-
acc = {
|
|
1748
|
-
...acc
|
|
1749
|
-
};
|
|
1358
|
+
(0, import_rxjs.scan)((acc, event) => {
|
|
1750
1359
|
if (event.type === "ActionExecutionStart") {
|
|
1751
1360
|
acc.callActionServerSide = event.scope === "server";
|
|
1752
1361
|
acc.args = "";
|
|
1753
1362
|
acc.actionExecutionId = event.actionExecutionId;
|
|
1754
1363
|
if (acc.callActionServerSide) {
|
|
1755
|
-
acc.action =
|
|
1364
|
+
acc.action = serversideActions.find((action) => action.name === event.actionName);
|
|
1756
1365
|
}
|
|
1757
1366
|
} else if (event.type === "ActionExecutionArgs") {
|
|
1758
1367
|
acc.args += event.args;
|
|
@@ -1766,26 +1375,24 @@ var RuntimeEventSource = class {
|
|
|
1766
1375
|
actionExecutionId: null,
|
|
1767
1376
|
action: null
|
|
1768
1377
|
}),
|
|
1769
|
-
(0,
|
|
1378
|
+
(0, import_rxjs.concatMap)((eventWithState) => {
|
|
1770
1379
|
if (eventWithState.event.type === "ActionExecutionEnd" && eventWithState.callActionServerSide) {
|
|
1771
1380
|
const toolCallEventStream$ = new RuntimeEventSubject();
|
|
1772
|
-
executeAction(toolCallEventStream$, guardrailsResult$ ? guardrailsResult$ : null, eventWithState.action, eventWithState.args, eventWithState.actionExecutionId
|
|
1381
|
+
executeAction(toolCallEventStream$, guardrailsResult$ ? guardrailsResult$ : null, eventWithState.action, eventWithState.args, eventWithState.actionExecutionId).catch((error) => {
|
|
1773
1382
|
console.error(error);
|
|
1774
1383
|
});
|
|
1775
|
-
|
|
1776
|
-
return (0, import_rxjs2.concat)((0, import_rxjs2.of)(eventWithState.event), toolCallEventStream$);
|
|
1384
|
+
return (0, import_rxjs.concat)((0, import_rxjs.of)(eventWithState.event), toolCallEventStream$);
|
|
1777
1385
|
} else {
|
|
1778
|
-
return (0,
|
|
1386
|
+
return (0, import_rxjs.of)(eventWithState.event);
|
|
1779
1387
|
}
|
|
1780
1388
|
})
|
|
1781
1389
|
);
|
|
1782
1390
|
}
|
|
1783
1391
|
};
|
|
1784
1392
|
__name(RuntimeEventSource, "RuntimeEventSource");
|
|
1785
|
-
async function executeAction(eventStream$, guardrailsResult$, action, actionArguments, actionExecutionId
|
|
1786
|
-
var _a;
|
|
1393
|
+
async function executeAction(eventStream$, guardrailsResult$, action, actionArguments, actionExecutionId) {
|
|
1787
1394
|
if (guardrailsResult$) {
|
|
1788
|
-
const { status } = await (0,
|
|
1395
|
+
const { status } = await (0, import_rxjs.firstValueFrom)(guardrailsResult$);
|
|
1789
1396
|
if (status === "denied") {
|
|
1790
1397
|
eventStream$.complete();
|
|
1791
1398
|
return;
|
|
@@ -1795,28 +1402,15 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
|
|
|
1795
1402
|
if (actionArguments) {
|
|
1796
1403
|
args = JSON.parse(actionArguments);
|
|
1797
1404
|
}
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1405
|
+
const result = await action.handler(args);
|
|
1406
|
+
await streamLangChainResponse({
|
|
1407
|
+
result,
|
|
1408
|
+
eventStream$,
|
|
1409
|
+
actionExecution: {
|
|
1801
1410
|
name: action.name,
|
|
1802
|
-
|
|
1803
|
-
}
|
|
1804
|
-
|
|
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
|
-
}
|
|
1411
|
+
id: actionExecutionId
|
|
1412
|
+
}
|
|
1413
|
+
});
|
|
1820
1414
|
}
|
|
1821
1415
|
__name(executeAction, "executeAction");
|
|
1822
1416
|
|
|
@@ -1848,30 +1442,15 @@ function convertGqlInputToMessages(inputMessages) {
|
|
|
1848
1442
|
actionName: message.resultMessage.actionName,
|
|
1849
1443
|
result: message.resultMessage.result
|
|
1850
1444
|
}));
|
|
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
|
-
}));
|
|
1864
1445
|
}
|
|
1865
1446
|
}
|
|
1866
1447
|
return messages;
|
|
1867
1448
|
}
|
|
1868
1449
|
__name(convertGqlInputToMessages, "convertGqlInputToMessages");
|
|
1869
1450
|
|
|
1870
|
-
// src/lib/
|
|
1871
|
-
var import_rxjs3 = require("rxjs");
|
|
1451
|
+
// src/lib/copilot-runtime.ts
|
|
1872
1452
|
var CopilotRuntime = class {
|
|
1873
1453
|
actions;
|
|
1874
|
-
remoteActionDefinitions;
|
|
1875
1454
|
langserve = [];
|
|
1876
1455
|
onBeforeRequest;
|
|
1877
1456
|
onAfterRequest;
|
|
@@ -1882,33 +1461,44 @@ var CopilotRuntime = class {
|
|
|
1882
1461
|
const remoteChain = new RemoteChain(chain);
|
|
1883
1462
|
this.langserve.push(remoteChain.toAction());
|
|
1884
1463
|
}
|
|
1885
|
-
this.remoteActionDefinitions = (params == null ? void 0 : params.remoteActions) || [];
|
|
1886
1464
|
this.onBeforeRequest = (_a = params == null ? void 0 : params.middleware) == null ? void 0 : _a.onBeforeRequest;
|
|
1887
1465
|
this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
|
|
1888
1466
|
}
|
|
1889
|
-
async
|
|
1467
|
+
async process(request) {
|
|
1890
1468
|
var _a;
|
|
1891
|
-
const { serviceAdapter, messages
|
|
1892
|
-
|
|
1893
|
-
|
|
1469
|
+
const { serviceAdapter, messages, actions: clientSideActionsInput, threadId, runId, properties, outputMessagesPromise, forwardedParameters, url } = request;
|
|
1470
|
+
const langserveFunctions = [];
|
|
1471
|
+
for (const chainPromise of this.langserve) {
|
|
1472
|
+
try {
|
|
1473
|
+
const chain = await chainPromise;
|
|
1474
|
+
langserveFunctions.push(chain);
|
|
1475
|
+
} catch (error) {
|
|
1476
|
+
console.error("Error loading langserve chain:", error);
|
|
1477
|
+
}
|
|
1894
1478
|
}
|
|
1895
|
-
const
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1479
|
+
const configuredActions = typeof this.actions === "function" ? this.actions({
|
|
1480
|
+
properties,
|
|
1481
|
+
url
|
|
1482
|
+
}) : this.actions;
|
|
1483
|
+
const actions = [
|
|
1484
|
+
...configuredActions,
|
|
1485
|
+
...langserveFunctions
|
|
1486
|
+
];
|
|
1487
|
+
const serverSideActionsInput = actions.map((action) => ({
|
|
1899
1488
|
name: action.name,
|
|
1900
1489
|
description: action.description,
|
|
1901
|
-
jsonSchema: JSON.stringify((0,
|
|
1490
|
+
jsonSchema: JSON.stringify((0, import_shared7.actionParametersToJsonSchema)(action.parameters))
|
|
1902
1491
|
}));
|
|
1903
1492
|
const actionInputs = flattenToolCallsNoDuplicates([
|
|
1904
1493
|
...serverSideActionsInput,
|
|
1905
1494
|
...clientSideActionsInput
|
|
1906
1495
|
]);
|
|
1496
|
+
const inputMessages = convertGqlInputToMessages(messages);
|
|
1907
1497
|
await ((_a = this.onBeforeRequest) == null ? void 0 : _a.call(this, {
|
|
1908
1498
|
threadId,
|
|
1909
1499
|
runId,
|
|
1910
1500
|
inputMessages,
|
|
1911
|
-
properties
|
|
1501
|
+
properties,
|
|
1912
1502
|
url
|
|
1913
1503
|
}));
|
|
1914
1504
|
try {
|
|
@@ -1928,7 +1518,7 @@ var CopilotRuntime = class {
|
|
|
1928
1518
|
runId: result.runId,
|
|
1929
1519
|
inputMessages,
|
|
1930
1520
|
outputMessages,
|
|
1931
|
-
properties
|
|
1521
|
+
properties,
|
|
1932
1522
|
url
|
|
1933
1523
|
});
|
|
1934
1524
|
}).catch((_error) => {
|
|
@@ -1937,108 +1527,13 @@ var CopilotRuntime = class {
|
|
|
1937
1527
|
threadId: result.threadId,
|
|
1938
1528
|
runId: result.runId,
|
|
1939
1529
|
eventSource,
|
|
1940
|
-
|
|
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
|
|
1530
|
+
actions
|
|
2008
1531
|
};
|
|
2009
1532
|
} catch (error) {
|
|
2010
1533
|
console.error("Error getting response:", error);
|
|
2011
1534
|
throw error;
|
|
2012
1535
|
}
|
|
2013
1536
|
}
|
|
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
|
-
}
|
|
2042
1537
|
};
|
|
2043
1538
|
__name(CopilotRuntime, "CopilotRuntime");
|
|
2044
1539
|
function flattenToolCallsNoDuplicates(toolsByPriority) {
|
|
@@ -2055,14 +1550,14 @@ function flattenToolCallsNoDuplicates(toolsByPriority) {
|
|
|
2055
1550
|
__name(flattenToolCallsNoDuplicates, "flattenToolCallsNoDuplicates");
|
|
2056
1551
|
|
|
2057
1552
|
// src/lib/integrations/shared.ts
|
|
2058
|
-
var
|
|
1553
|
+
var import_type_graphql14 = require("type-graphql");
|
|
2059
1554
|
|
|
2060
1555
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
2061
|
-
var
|
|
2062
|
-
var
|
|
1556
|
+
var import_type_graphql13 = require("type-graphql");
|
|
1557
|
+
var import_rxjs2 = require("rxjs");
|
|
2063
1558
|
|
|
2064
1559
|
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
2065
|
-
var
|
|
1560
|
+
var import_type_graphql9 = require("type-graphql");
|
|
2066
1561
|
|
|
2067
1562
|
// src/graphql/inputs/message.input.ts
|
|
2068
1563
|
var import_type_graphql3 = require("type-graphql");
|
|
@@ -2079,7 +1574,6 @@ var ActionExecutionScope;
|
|
|
2079
1574
|
(function(ActionExecutionScope2) {
|
|
2080
1575
|
ActionExecutionScope2["server"] = "server";
|
|
2081
1576
|
ActionExecutionScope2["client"] = "client";
|
|
2082
|
-
ActionExecutionScope2["passThrough"] = "passThrough";
|
|
2083
1577
|
})(ActionExecutionScope || (ActionExecutionScope = {}));
|
|
2084
1578
|
var CopilotRequestType;
|
|
2085
1579
|
(function(CopilotRequestType2) {
|
|
@@ -2123,7 +1617,6 @@ var MessageInput = class extends BaseMessage {
|
|
|
2123
1617
|
textMessage;
|
|
2124
1618
|
actionExecutionMessage;
|
|
2125
1619
|
resultMessage;
|
|
2126
|
-
agentStateMessage;
|
|
2127
1620
|
};
|
|
2128
1621
|
__name(MessageInput, "MessageInput");
|
|
2129
1622
|
_ts_decorate2([
|
|
@@ -2144,12 +1637,6 @@ _ts_decorate2([
|
|
|
2144
1637
|
}),
|
|
2145
1638
|
_ts_metadata2("design:type", typeof ResultMessageInput === "undefined" ? Object : ResultMessageInput)
|
|
2146
1639
|
], 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);
|
|
2153
1640
|
MessageInput = _ts_decorate2([
|
|
2154
1641
|
(0, import_type_graphql3.InputType)()
|
|
2155
1642
|
], MessageInput);
|
|
@@ -2211,52 +1698,6 @@ _ts_decorate2([
|
|
|
2211
1698
|
ResultMessageInput = _ts_decorate2([
|
|
2212
1699
|
(0, import_type_graphql3.InputType)()
|
|
2213
1700
|
], 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);
|
|
2260
1701
|
|
|
2261
1702
|
// src/graphql/inputs/frontend.input.ts
|
|
2262
1703
|
var import_type_graphql5 = require("type-graphql");
|
|
@@ -2498,8 +1939,7 @@ ForwardedParametersInput = _ts_decorate7([
|
|
|
2498
1939
|
(0, import_type_graphql8.InputType)()
|
|
2499
1940
|
], ForwardedParametersInput);
|
|
2500
1941
|
|
|
2501
|
-
// src/graphql/inputs/
|
|
2502
|
-
var import_type_graphql9 = require("type-graphql");
|
|
1942
|
+
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
2503
1943
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
2504
1944
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2505
1945
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -2516,96 +1956,18 @@ function _ts_metadata8(k, v) {
|
|
|
2516
1956
|
return Reflect.metadata(k, v);
|
|
2517
1957
|
}
|
|
2518
1958
|
__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");
|
|
2597
1959
|
var GenerateCopilotResponseMetadataInput = class {
|
|
2598
1960
|
requestType;
|
|
2599
1961
|
};
|
|
2600
1962
|
__name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
|
|
2601
|
-
|
|
2602
|
-
(0,
|
|
1963
|
+
_ts_decorate8([
|
|
1964
|
+
(0, import_type_graphql9.Field)(() => CopilotRequestType, {
|
|
2603
1965
|
nullable: true
|
|
2604
1966
|
}),
|
|
2605
|
-
|
|
1967
|
+
_ts_metadata8("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
|
|
2606
1968
|
], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
|
|
2607
|
-
GenerateCopilotResponseMetadataInput =
|
|
2608
|
-
(0,
|
|
1969
|
+
GenerateCopilotResponseMetadataInput = _ts_decorate8([
|
|
1970
|
+
(0, import_type_graphql9.InputType)()
|
|
2609
1971
|
], GenerateCopilotResponseMetadataInput);
|
|
2610
1972
|
var GenerateCopilotResponseInput = class {
|
|
2611
1973
|
metadata;
|
|
@@ -2615,81 +1977,58 @@ var GenerateCopilotResponseInput = class {
|
|
|
2615
1977
|
frontend;
|
|
2616
1978
|
cloud;
|
|
2617
1979
|
forwardedParameters;
|
|
2618
|
-
agentSession;
|
|
2619
|
-
agentState;
|
|
2620
|
-
agentStates;
|
|
2621
1980
|
};
|
|
2622
1981
|
__name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
|
|
2623
|
-
|
|
2624
|
-
(0,
|
|
1982
|
+
_ts_decorate8([
|
|
1983
|
+
(0, import_type_graphql9.Field)(() => GenerateCopilotResponseMetadataInput, {
|
|
2625
1984
|
nullable: false
|
|
2626
1985
|
}),
|
|
2627
|
-
|
|
1986
|
+
_ts_metadata8("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
|
|
2628
1987
|
], GenerateCopilotResponseInput.prototype, "metadata", void 0);
|
|
2629
|
-
|
|
2630
|
-
(0,
|
|
1988
|
+
_ts_decorate8([
|
|
1989
|
+
(0, import_type_graphql9.Field)(() => String, {
|
|
2631
1990
|
nullable: true
|
|
2632
1991
|
}),
|
|
2633
|
-
|
|
1992
|
+
_ts_metadata8("design:type", String)
|
|
2634
1993
|
], GenerateCopilotResponseInput.prototype, "threadId", void 0);
|
|
2635
|
-
|
|
2636
|
-
(0,
|
|
1994
|
+
_ts_decorate8([
|
|
1995
|
+
(0, import_type_graphql9.Field)(() => String, {
|
|
2637
1996
|
nullable: true
|
|
2638
1997
|
}),
|
|
2639
|
-
|
|
1998
|
+
_ts_metadata8("design:type", String)
|
|
2640
1999
|
], GenerateCopilotResponseInput.prototype, "runId", void 0);
|
|
2641
|
-
|
|
2642
|
-
(0,
|
|
2000
|
+
_ts_decorate8([
|
|
2001
|
+
(0, import_type_graphql9.Field)(() => [
|
|
2643
2002
|
MessageInput
|
|
2644
2003
|
]),
|
|
2645
|
-
|
|
2004
|
+
_ts_metadata8("design:type", Array)
|
|
2646
2005
|
], GenerateCopilotResponseInput.prototype, "messages", void 0);
|
|
2647
|
-
|
|
2648
|
-
(0,
|
|
2649
|
-
|
|
2006
|
+
_ts_decorate8([
|
|
2007
|
+
(0, import_type_graphql9.Field)(() => FrontendInput),
|
|
2008
|
+
_ts_metadata8("design:type", typeof FrontendInput === "undefined" ? Object : FrontendInput)
|
|
2650
2009
|
], GenerateCopilotResponseInput.prototype, "frontend", void 0);
|
|
2651
|
-
|
|
2652
|
-
(0,
|
|
2010
|
+
_ts_decorate8([
|
|
2011
|
+
(0, import_type_graphql9.Field)(() => CloudInput, {
|
|
2653
2012
|
nullable: true
|
|
2654
2013
|
}),
|
|
2655
|
-
|
|
2014
|
+
_ts_metadata8("design:type", typeof CloudInput === "undefined" ? Object : CloudInput)
|
|
2656
2015
|
], GenerateCopilotResponseInput.prototype, "cloud", void 0);
|
|
2657
|
-
|
|
2658
|
-
(0,
|
|
2016
|
+
_ts_decorate8([
|
|
2017
|
+
(0, import_type_graphql9.Field)(() => ForwardedParametersInput, {
|
|
2659
2018
|
nullable: true
|
|
2660
2019
|
}),
|
|
2661
|
-
|
|
2020
|
+
_ts_metadata8("design:type", typeof ForwardedParametersInput === "undefined" ? Object : ForwardedParametersInput)
|
|
2662
2021
|
], GenerateCopilotResponseInput.prototype, "forwardedParameters", void 0);
|
|
2663
|
-
|
|
2664
|
-
(0,
|
|
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)()
|
|
2022
|
+
GenerateCopilotResponseInput = _ts_decorate8([
|
|
2023
|
+
(0, import_type_graphql9.InputType)()
|
|
2685
2024
|
], GenerateCopilotResponseInput);
|
|
2686
2025
|
|
|
2687
2026
|
// src/graphql/types/copilot-response.type.ts
|
|
2688
|
-
var
|
|
2027
|
+
var import_type_graphql12 = require("type-graphql");
|
|
2689
2028
|
|
|
2690
2029
|
// src/graphql/types/message-status.type.ts
|
|
2691
|
-
var
|
|
2692
|
-
function
|
|
2030
|
+
var import_type_graphql10 = require("type-graphql");
|
|
2031
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
2693
2032
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2694
2033
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2695
2034
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2699,58 +2038,58 @@ function _ts_decorate11(decorators, target, key, desc) {
|
|
|
2699
2038
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2700
2039
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2701
2040
|
}
|
|
2702
|
-
__name(
|
|
2703
|
-
function
|
|
2041
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
2042
|
+
function _ts_metadata9(k, v) {
|
|
2704
2043
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2705
2044
|
return Reflect.metadata(k, v);
|
|
2706
2045
|
}
|
|
2707
|
-
__name(
|
|
2046
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
2708
2047
|
var MessageStatusCode;
|
|
2709
2048
|
(function(MessageStatusCode2) {
|
|
2710
2049
|
MessageStatusCode2["Pending"] = "pending";
|
|
2711
2050
|
MessageStatusCode2["Success"] = "success";
|
|
2712
2051
|
MessageStatusCode2["Failed"] = "failed";
|
|
2713
2052
|
})(MessageStatusCode || (MessageStatusCode = {}));
|
|
2714
|
-
(0,
|
|
2053
|
+
(0, import_type_graphql10.registerEnumType)(MessageStatusCode, {
|
|
2715
2054
|
name: "MessageStatusCode"
|
|
2716
2055
|
});
|
|
2717
2056
|
var BaseMessageStatus = /* @__PURE__ */ __name(class BaseMessageStatus2 {
|
|
2718
2057
|
code;
|
|
2719
2058
|
}, "BaseMessageStatus");
|
|
2720
|
-
|
|
2721
|
-
(0,
|
|
2722
|
-
|
|
2059
|
+
_ts_decorate9([
|
|
2060
|
+
(0, import_type_graphql10.Field)(() => MessageStatusCode),
|
|
2061
|
+
_ts_metadata9("design:type", String)
|
|
2723
2062
|
], BaseMessageStatus.prototype, "code", void 0);
|
|
2724
|
-
BaseMessageStatus =
|
|
2725
|
-
(0,
|
|
2063
|
+
BaseMessageStatus = _ts_decorate9([
|
|
2064
|
+
(0, import_type_graphql10.ObjectType)()
|
|
2726
2065
|
], BaseMessageStatus);
|
|
2727
2066
|
var PendingMessageStatus = class extends BaseMessageStatus {
|
|
2728
2067
|
code = "pending";
|
|
2729
2068
|
};
|
|
2730
2069
|
__name(PendingMessageStatus, "PendingMessageStatus");
|
|
2731
|
-
PendingMessageStatus =
|
|
2732
|
-
(0,
|
|
2070
|
+
PendingMessageStatus = _ts_decorate9([
|
|
2071
|
+
(0, import_type_graphql10.ObjectType)()
|
|
2733
2072
|
], PendingMessageStatus);
|
|
2734
2073
|
var SuccessMessageStatus = class extends BaseMessageStatus {
|
|
2735
2074
|
code = "success";
|
|
2736
2075
|
};
|
|
2737
2076
|
__name(SuccessMessageStatus, "SuccessMessageStatus");
|
|
2738
|
-
SuccessMessageStatus =
|
|
2739
|
-
(0,
|
|
2077
|
+
SuccessMessageStatus = _ts_decorate9([
|
|
2078
|
+
(0, import_type_graphql10.ObjectType)()
|
|
2740
2079
|
], SuccessMessageStatus);
|
|
2741
2080
|
var FailedMessageStatus = class extends BaseMessageStatus {
|
|
2742
2081
|
code = "failed";
|
|
2743
2082
|
reason;
|
|
2744
2083
|
};
|
|
2745
2084
|
__name(FailedMessageStatus, "FailedMessageStatus");
|
|
2746
|
-
|
|
2747
|
-
(0,
|
|
2748
|
-
|
|
2085
|
+
_ts_decorate9([
|
|
2086
|
+
(0, import_type_graphql10.Field)(() => String),
|
|
2087
|
+
_ts_metadata9("design:type", String)
|
|
2749
2088
|
], FailedMessageStatus.prototype, "reason", void 0);
|
|
2750
|
-
FailedMessageStatus =
|
|
2751
|
-
(0,
|
|
2089
|
+
FailedMessageStatus = _ts_decorate9([
|
|
2090
|
+
(0, import_type_graphql10.ObjectType)()
|
|
2752
2091
|
], FailedMessageStatus);
|
|
2753
|
-
var MessageStatusUnion = (0,
|
|
2092
|
+
var MessageStatusUnion = (0, import_type_graphql10.createUnionType)({
|
|
2754
2093
|
name: "MessageStatus",
|
|
2755
2094
|
types: () => [
|
|
2756
2095
|
PendingMessageStatus,
|
|
@@ -2761,8 +2100,8 @@ var MessageStatusUnion = (0, import_type_graphql12.createUnionType)({
|
|
|
2761
2100
|
|
|
2762
2101
|
// src/graphql/types/response-status.type.ts
|
|
2763
2102
|
var import_graphql_scalars = require("graphql-scalars");
|
|
2764
|
-
var
|
|
2765
|
-
function
|
|
2103
|
+
var import_type_graphql11 = require("type-graphql");
|
|
2104
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
2766
2105
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2767
2106
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2768
2107
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2772,30 +2111,30 @@ function _ts_decorate12(decorators, target, key, desc) {
|
|
|
2772
2111
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2773
2112
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2774
2113
|
}
|
|
2775
|
-
__name(
|
|
2776
|
-
function
|
|
2114
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
2115
|
+
function _ts_metadata10(k, v) {
|
|
2777
2116
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2778
2117
|
return Reflect.metadata(k, v);
|
|
2779
2118
|
}
|
|
2780
|
-
__name(
|
|
2119
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
2781
2120
|
var ResponseStatusCode;
|
|
2782
2121
|
(function(ResponseStatusCode2) {
|
|
2783
2122
|
ResponseStatusCode2["Pending"] = "pending";
|
|
2784
2123
|
ResponseStatusCode2["Success"] = "success";
|
|
2785
2124
|
ResponseStatusCode2["Failed"] = "failed";
|
|
2786
2125
|
})(ResponseStatusCode || (ResponseStatusCode = {}));
|
|
2787
|
-
(0,
|
|
2126
|
+
(0, import_type_graphql11.registerEnumType)(ResponseStatusCode, {
|
|
2788
2127
|
name: "ResponseStatusCode"
|
|
2789
2128
|
});
|
|
2790
2129
|
var BaseResponseStatus = /* @__PURE__ */ __name(class BaseResponseStatus2 {
|
|
2791
2130
|
code;
|
|
2792
2131
|
}, "BaseResponseStatus");
|
|
2793
|
-
|
|
2794
|
-
(0,
|
|
2795
|
-
|
|
2132
|
+
_ts_decorate10([
|
|
2133
|
+
(0, import_type_graphql11.Field)(() => ResponseStatusCode),
|
|
2134
|
+
_ts_metadata10("design:type", String)
|
|
2796
2135
|
], BaseResponseStatus.prototype, "code", void 0);
|
|
2797
|
-
BaseResponseStatus =
|
|
2798
|
-
(0,
|
|
2136
|
+
BaseResponseStatus = _ts_decorate10([
|
|
2137
|
+
(0, import_type_graphql11.InterfaceType)({
|
|
2799
2138
|
resolveType(value) {
|
|
2800
2139
|
if (value.code === "success") {
|
|
2801
2140
|
return SuccessResponseStatus;
|
|
@@ -2807,14 +2146,14 @@ BaseResponseStatus = _ts_decorate12([
|
|
|
2807
2146
|
return void 0;
|
|
2808
2147
|
}
|
|
2809
2148
|
}),
|
|
2810
|
-
(0,
|
|
2149
|
+
(0, import_type_graphql11.ObjectType)()
|
|
2811
2150
|
], BaseResponseStatus);
|
|
2812
2151
|
var PendingResponseStatus = class extends BaseResponseStatus {
|
|
2813
2152
|
code = "pending";
|
|
2814
2153
|
};
|
|
2815
2154
|
__name(PendingResponseStatus, "PendingResponseStatus");
|
|
2816
|
-
PendingResponseStatus =
|
|
2817
|
-
(0,
|
|
2155
|
+
PendingResponseStatus = _ts_decorate10([
|
|
2156
|
+
(0, import_type_graphql11.ObjectType)({
|
|
2818
2157
|
implements: BaseResponseStatus
|
|
2819
2158
|
})
|
|
2820
2159
|
], PendingResponseStatus);
|
|
@@ -2822,8 +2161,8 @@ var SuccessResponseStatus = class extends BaseResponseStatus {
|
|
|
2822
2161
|
code = "success";
|
|
2823
2162
|
};
|
|
2824
2163
|
__name(SuccessResponseStatus, "SuccessResponseStatus");
|
|
2825
|
-
SuccessResponseStatus =
|
|
2826
|
-
(0,
|
|
2164
|
+
SuccessResponseStatus = _ts_decorate10([
|
|
2165
|
+
(0, import_type_graphql11.ObjectType)({
|
|
2827
2166
|
implements: BaseResponseStatus
|
|
2828
2167
|
})
|
|
2829
2168
|
], SuccessResponseStatus);
|
|
@@ -2833,7 +2172,7 @@ var FailedResponseStatusReason;
|
|
|
2833
2172
|
FailedResponseStatusReason2["MESSAGE_STREAM_INTERRUPTED"] = "MESSAGE_STREAM_INTERRUPTED";
|
|
2834
2173
|
FailedResponseStatusReason2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
2835
2174
|
})(FailedResponseStatusReason || (FailedResponseStatusReason = {}));
|
|
2836
|
-
(0,
|
|
2175
|
+
(0, import_type_graphql11.registerEnumType)(FailedResponseStatusReason, {
|
|
2837
2176
|
name: "FailedResponseStatusReason"
|
|
2838
2177
|
});
|
|
2839
2178
|
var FailedResponseStatus = class extends BaseResponseStatus {
|
|
@@ -2842,22 +2181,22 @@ var FailedResponseStatus = class extends BaseResponseStatus {
|
|
|
2842
2181
|
details = null;
|
|
2843
2182
|
};
|
|
2844
2183
|
__name(FailedResponseStatus, "FailedResponseStatus");
|
|
2845
|
-
|
|
2846
|
-
(0,
|
|
2847
|
-
|
|
2184
|
+
_ts_decorate10([
|
|
2185
|
+
(0, import_type_graphql11.Field)(() => FailedResponseStatusReason),
|
|
2186
|
+
_ts_metadata10("design:type", String)
|
|
2848
2187
|
], FailedResponseStatus.prototype, "reason", void 0);
|
|
2849
|
-
|
|
2850
|
-
(0,
|
|
2188
|
+
_ts_decorate10([
|
|
2189
|
+
(0, import_type_graphql11.Field)(() => import_graphql_scalars.GraphQLJSON, {
|
|
2851
2190
|
nullable: true
|
|
2852
2191
|
}),
|
|
2853
|
-
|
|
2192
|
+
_ts_metadata10("design:type", typeof Record === "undefined" ? Object : Record)
|
|
2854
2193
|
], FailedResponseStatus.prototype, "details", void 0);
|
|
2855
|
-
FailedResponseStatus =
|
|
2856
|
-
(0,
|
|
2194
|
+
FailedResponseStatus = _ts_decorate10([
|
|
2195
|
+
(0, import_type_graphql11.ObjectType)({
|
|
2857
2196
|
implements: BaseResponseStatus
|
|
2858
2197
|
})
|
|
2859
2198
|
], FailedResponseStatus);
|
|
2860
|
-
var ResponseStatusUnion = (0,
|
|
2199
|
+
var ResponseStatusUnion = (0, import_type_graphql11.createUnionType)({
|
|
2861
2200
|
name: "ResponseStatus",
|
|
2862
2201
|
types: () => [
|
|
2863
2202
|
PendingResponseStatus,
|
|
@@ -2867,7 +2206,7 @@ var ResponseStatusUnion = (0, import_type_graphql13.createUnionType)({
|
|
|
2867
2206
|
});
|
|
2868
2207
|
|
|
2869
2208
|
// src/graphql/types/copilot-response.type.ts
|
|
2870
|
-
function
|
|
2209
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
2871
2210
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2872
2211
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2873
2212
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2877,31 +2216,31 @@ function _ts_decorate13(decorators, target, key, desc) {
|
|
|
2877
2216
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2878
2217
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2879
2218
|
}
|
|
2880
|
-
__name(
|
|
2881
|
-
function
|
|
2219
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
2220
|
+
function _ts_metadata11(k, v) {
|
|
2882
2221
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2883
2222
|
return Reflect.metadata(k, v);
|
|
2884
2223
|
}
|
|
2885
|
-
__name(
|
|
2224
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
2886
2225
|
var BaseMessageOutput = /* @__PURE__ */ __name(class BaseMessageOutput2 {
|
|
2887
2226
|
id;
|
|
2888
2227
|
createdAt;
|
|
2889
2228
|
status;
|
|
2890
2229
|
}, "BaseMessageOutput");
|
|
2891
|
-
|
|
2892
|
-
(0,
|
|
2893
|
-
|
|
2230
|
+
_ts_decorate11([
|
|
2231
|
+
(0, import_type_graphql12.Field)(() => String),
|
|
2232
|
+
_ts_metadata11("design:type", String)
|
|
2894
2233
|
], BaseMessageOutput.prototype, "id", void 0);
|
|
2895
|
-
|
|
2896
|
-
(0,
|
|
2897
|
-
|
|
2234
|
+
_ts_decorate11([
|
|
2235
|
+
(0, import_type_graphql12.Field)(() => Date),
|
|
2236
|
+
_ts_metadata11("design:type", typeof Date === "undefined" ? Object : Date)
|
|
2898
2237
|
], BaseMessageOutput.prototype, "createdAt", void 0);
|
|
2899
|
-
|
|
2900
|
-
(0,
|
|
2901
|
-
|
|
2238
|
+
_ts_decorate11([
|
|
2239
|
+
(0, import_type_graphql12.Field)(() => MessageStatusUnion),
|
|
2240
|
+
_ts_metadata11("design:type", Object)
|
|
2902
2241
|
], BaseMessageOutput.prototype, "status", void 0);
|
|
2903
|
-
BaseMessageOutput =
|
|
2904
|
-
(0,
|
|
2242
|
+
BaseMessageOutput = _ts_decorate11([
|
|
2243
|
+
(0, import_type_graphql12.InterfaceType)({
|
|
2905
2244
|
resolveType(value) {
|
|
2906
2245
|
if (value.hasOwnProperty("content")) {
|
|
2907
2246
|
return TextMessageOutput;
|
|
@@ -2909,8 +2248,6 @@ BaseMessageOutput = _ts_decorate13([
|
|
|
2909
2248
|
return ActionExecutionMessageOutput;
|
|
2910
2249
|
} else if (value.hasOwnProperty("result")) {
|
|
2911
2250
|
return ResultMessageOutput;
|
|
2912
|
-
} else if (value.hasOwnProperty("state")) {
|
|
2913
|
-
return AgentStateMessageOutput;
|
|
2914
2251
|
}
|
|
2915
2252
|
return void 0;
|
|
2916
2253
|
}
|
|
@@ -2921,18 +2258,18 @@ var TextMessageOutput = class {
|
|
|
2921
2258
|
content;
|
|
2922
2259
|
};
|
|
2923
2260
|
__name(TextMessageOutput, "TextMessageOutput");
|
|
2924
|
-
|
|
2925
|
-
(0,
|
|
2926
|
-
|
|
2261
|
+
_ts_decorate11([
|
|
2262
|
+
(0, import_type_graphql12.Field)(() => MessageRole),
|
|
2263
|
+
_ts_metadata11("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
|
|
2927
2264
|
], TextMessageOutput.prototype, "role", void 0);
|
|
2928
|
-
|
|
2929
|
-
(0,
|
|
2265
|
+
_ts_decorate11([
|
|
2266
|
+
(0, import_type_graphql12.Field)(() => [
|
|
2930
2267
|
String
|
|
2931
2268
|
]),
|
|
2932
|
-
|
|
2269
|
+
_ts_metadata11("design:type", Array)
|
|
2933
2270
|
], TextMessageOutput.prototype, "content", void 0);
|
|
2934
|
-
TextMessageOutput =
|
|
2935
|
-
(0,
|
|
2271
|
+
TextMessageOutput = _ts_decorate11([
|
|
2272
|
+
(0, import_type_graphql12.ObjectType)({
|
|
2936
2273
|
implements: BaseMessageOutput
|
|
2937
2274
|
})
|
|
2938
2275
|
], TextMessageOutput);
|
|
@@ -2942,22 +2279,22 @@ var ActionExecutionMessageOutput = class {
|
|
|
2942
2279
|
arguments;
|
|
2943
2280
|
};
|
|
2944
2281
|
__name(ActionExecutionMessageOutput, "ActionExecutionMessageOutput");
|
|
2945
|
-
|
|
2946
|
-
(0,
|
|
2947
|
-
|
|
2282
|
+
_ts_decorate11([
|
|
2283
|
+
(0, import_type_graphql12.Field)(() => String),
|
|
2284
|
+
_ts_metadata11("design:type", String)
|
|
2948
2285
|
], ActionExecutionMessageOutput.prototype, "name", void 0);
|
|
2949
|
-
|
|
2950
|
-
(0,
|
|
2951
|
-
|
|
2286
|
+
_ts_decorate11([
|
|
2287
|
+
(0, import_type_graphql12.Field)(() => ActionExecutionScope),
|
|
2288
|
+
_ts_metadata11("design:type", typeof ActionExecutionScope === "undefined" ? Object : ActionExecutionScope)
|
|
2952
2289
|
], ActionExecutionMessageOutput.prototype, "scope", void 0);
|
|
2953
|
-
|
|
2954
|
-
(0,
|
|
2290
|
+
_ts_decorate11([
|
|
2291
|
+
(0, import_type_graphql12.Field)(() => [
|
|
2955
2292
|
String
|
|
2956
2293
|
]),
|
|
2957
|
-
|
|
2294
|
+
_ts_metadata11("design:type", Array)
|
|
2958
2295
|
], ActionExecutionMessageOutput.prototype, "arguments", void 0);
|
|
2959
|
-
ActionExecutionMessageOutput =
|
|
2960
|
-
(0,
|
|
2296
|
+
ActionExecutionMessageOutput = _ts_decorate11([
|
|
2297
|
+
(0, import_type_graphql12.ObjectType)({
|
|
2961
2298
|
implements: BaseMessageOutput
|
|
2962
2299
|
})
|
|
2963
2300
|
], ActionExecutionMessageOutput);
|
|
@@ -2967,71 +2304,23 @@ var ResultMessageOutput = class {
|
|
|
2967
2304
|
result;
|
|
2968
2305
|
};
|
|
2969
2306
|
__name(ResultMessageOutput, "ResultMessageOutput");
|
|
2970
|
-
|
|
2971
|
-
(0,
|
|
2972
|
-
|
|
2307
|
+
_ts_decorate11([
|
|
2308
|
+
(0, import_type_graphql12.Field)(() => String),
|
|
2309
|
+
_ts_metadata11("design:type", String)
|
|
2973
2310
|
], ResultMessageOutput.prototype, "actionExecutionId", void 0);
|
|
2974
|
-
|
|
2975
|
-
(0,
|
|
2976
|
-
|
|
2311
|
+
_ts_decorate11([
|
|
2312
|
+
(0, import_type_graphql12.Field)(() => String),
|
|
2313
|
+
_ts_metadata11("design:type", String)
|
|
2977
2314
|
], ResultMessageOutput.prototype, "actionName", void 0);
|
|
2978
|
-
|
|
2979
|
-
(0,
|
|
2980
|
-
|
|
2315
|
+
_ts_decorate11([
|
|
2316
|
+
(0, import_type_graphql12.Field)(() => String),
|
|
2317
|
+
_ts_metadata11("design:type", String)
|
|
2981
2318
|
], ResultMessageOutput.prototype, "result", void 0);
|
|
2982
|
-
ResultMessageOutput =
|
|
2983
|
-
(0,
|
|
2319
|
+
ResultMessageOutput = _ts_decorate11([
|
|
2320
|
+
(0, import_type_graphql12.ObjectType)({
|
|
2984
2321
|
implements: BaseMessageOutput
|
|
2985
2322
|
})
|
|
2986
2323
|
], 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);
|
|
3035
2324
|
var CopilotResponse = class {
|
|
3036
2325
|
threadId;
|
|
3037
2326
|
status;
|
|
@@ -3039,28 +2328,28 @@ var CopilotResponse = class {
|
|
|
3039
2328
|
messages;
|
|
3040
2329
|
};
|
|
3041
2330
|
__name(CopilotResponse, "CopilotResponse");
|
|
3042
|
-
|
|
3043
|
-
(0,
|
|
3044
|
-
|
|
2331
|
+
_ts_decorate11([
|
|
2332
|
+
(0, import_type_graphql12.Field)(() => String),
|
|
2333
|
+
_ts_metadata11("design:type", String)
|
|
3045
2334
|
], CopilotResponse.prototype, "threadId", void 0);
|
|
3046
|
-
|
|
3047
|
-
(0,
|
|
3048
|
-
|
|
2335
|
+
_ts_decorate11([
|
|
2336
|
+
(0, import_type_graphql12.Field)(() => ResponseStatusUnion),
|
|
2337
|
+
_ts_metadata11("design:type", Object)
|
|
3049
2338
|
], CopilotResponse.prototype, "status", void 0);
|
|
3050
|
-
|
|
3051
|
-
(0,
|
|
2339
|
+
_ts_decorate11([
|
|
2340
|
+
(0, import_type_graphql12.Field)({
|
|
3052
2341
|
nullable: true
|
|
3053
2342
|
}),
|
|
3054
|
-
|
|
2343
|
+
_ts_metadata11("design:type", String)
|
|
3055
2344
|
], CopilotResponse.prototype, "runId", void 0);
|
|
3056
|
-
|
|
3057
|
-
(0,
|
|
2345
|
+
_ts_decorate11([
|
|
2346
|
+
(0, import_type_graphql12.Field)(() => [
|
|
3058
2347
|
BaseMessageOutput
|
|
3059
2348
|
]),
|
|
3060
|
-
|
|
2349
|
+
_ts_metadata11("design:type", Array)
|
|
3061
2350
|
], CopilotResponse.prototype, "messages", void 0);
|
|
3062
|
-
CopilotResponse =
|
|
3063
|
-
(0,
|
|
2351
|
+
CopilotResponse = _ts_decorate11([
|
|
2352
|
+
(0, import_type_graphql12.ObjectType)()
|
|
3064
2353
|
], CopilotResponse);
|
|
3065
2354
|
|
|
3066
2355
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
@@ -3102,9 +2391,18 @@ var UnknownErrorResponse = class extends FailedResponseStatus {
|
|
|
3102
2391
|
};
|
|
3103
2392
|
__name(UnknownErrorResponse, "UnknownErrorResponse");
|
|
3104
2393
|
|
|
2394
|
+
// src/lib/telemetry-client.ts
|
|
2395
|
+
var import_shared8 = require("@copilotkit/shared");
|
|
2396
|
+
var packageJson = require_package();
|
|
2397
|
+
var telemetryClient = new import_shared8.TelemetryClient({
|
|
2398
|
+
packageName: packageJson.name,
|
|
2399
|
+
packageVersion: packageJson.version
|
|
2400
|
+
});
|
|
2401
|
+
var telemetry_client_default = telemetryClient;
|
|
2402
|
+
|
|
3105
2403
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
3106
2404
|
var import_shared9 = require("@copilotkit/shared");
|
|
3107
|
-
function
|
|
2405
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
3108
2406
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3109
2407
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3110
2408
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3114,12 +2412,12 @@ function _ts_decorate14(decorators, target, key, desc) {
|
|
|
3114
2412
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3115
2413
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3116
2414
|
}
|
|
3117
|
-
__name(
|
|
3118
|
-
function
|
|
2415
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
2416
|
+
function _ts_metadata12(k, v) {
|
|
3119
2417
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3120
2418
|
return Reflect.metadata(k, v);
|
|
3121
2419
|
}
|
|
3122
|
-
__name(
|
|
2420
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
3123
2421
|
function _ts_param(paramIndex, decorator) {
|
|
3124
2422
|
return function(target, key) {
|
|
3125
2423
|
decorator(target, key, paramIndex);
|
|
@@ -3128,6 +2426,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
3128
2426
|
__name(_ts_param, "_ts_param");
|
|
3129
2427
|
var invokeGuardrails = /* @__PURE__ */ __name(async ({ baseUrl, copilotCloudPublicApiKey, data, onResult, onError }) => {
|
|
3130
2428
|
var _a;
|
|
2429
|
+
console.log("invokeGuardrails.baseUrl", baseUrl);
|
|
3131
2430
|
if (data.messages.length && ((_a = data.messages[data.messages.length - 1].textMessage) == null ? void 0 : _a.role) === MessageRole.user) {
|
|
3132
2431
|
const messages = data.messages.filter((m) => m.textMessage !== void 0 && (m.textMessage.role === MessageRole.user || m.textMessage.role === MessageRole.assistant)).map((m) => ({
|
|
3133
2432
|
role: m.textMessage.role,
|
|
@@ -3173,6 +2472,8 @@ var CopilotResolver = class {
|
|
|
3173
2472
|
logger2.debug({
|
|
3174
2473
|
data
|
|
3175
2474
|
}, "Generating Copilot response");
|
|
2475
|
+
const copilotRuntime = ctx._copilotkit.runtime;
|
|
2476
|
+
const serviceAdapter = ctx._copilotkit.serviceAdapter;
|
|
3176
2477
|
if (properties) {
|
|
3177
2478
|
logger2.debug("Properties provided, merging with context properties");
|
|
3178
2479
|
ctx.properties = {
|
|
@@ -3180,8 +2481,6 @@ var CopilotResolver = class {
|
|
|
3180
2481
|
...properties
|
|
3181
2482
|
};
|
|
3182
2483
|
}
|
|
3183
|
-
const copilotRuntime = ctx._copilotkit.runtime;
|
|
3184
|
-
const serviceAdapter = ctx._copilotkit.serviceAdapter;
|
|
3185
2484
|
let copilotCloudPublicApiKey = null;
|
|
3186
2485
|
let copilotCloudBaseUrl;
|
|
3187
2486
|
if (data.cloud) {
|
|
@@ -3209,9 +2508,9 @@ var CopilotResolver = class {
|
|
|
3209
2508
|
});
|
|
3210
2509
|
}
|
|
3211
2510
|
logger2.debug("Setting up subjects");
|
|
3212
|
-
const responseStatus$ = new
|
|
3213
|
-
const interruptStreaming$ = new
|
|
3214
|
-
const guardrailsResult$ = new
|
|
2511
|
+
const responseStatus$ = new import_rxjs2.ReplaySubject();
|
|
2512
|
+
const interruptStreaming$ = new import_rxjs2.ReplaySubject();
|
|
2513
|
+
const guardrailsResult$ = new import_rxjs2.ReplaySubject();
|
|
3215
2514
|
let outputMessages = [];
|
|
3216
2515
|
let resolveOutputMessagesPromise;
|
|
3217
2516
|
let rejectOutputMessagesPromise;
|
|
@@ -3220,25 +2519,23 @@ var CopilotResolver = class {
|
|
|
3220
2519
|
rejectOutputMessagesPromise = reject;
|
|
3221
2520
|
});
|
|
3222
2521
|
logger2.debug("Processing");
|
|
3223
|
-
const { eventSource, threadId = (0, import_shared9.randomId)(), runId,
|
|
2522
|
+
const { eventSource, threadId = (0, import_shared9.randomId)(), runId, actions } = await copilotRuntime.process({
|
|
3224
2523
|
serviceAdapter,
|
|
3225
2524
|
messages: data.messages,
|
|
3226
2525
|
actions: data.frontend.actions,
|
|
3227
2526
|
threadId: data.threadId,
|
|
3228
2527
|
runId: data.runId,
|
|
3229
2528
|
publicApiKey: void 0,
|
|
2529
|
+
properties: ctx.properties || {},
|
|
3230
2530
|
outputMessagesPromise,
|
|
3231
|
-
graphqlContext: ctx,
|
|
3232
2531
|
forwardedParameters: data.forwardedParameters,
|
|
3233
|
-
agentSession: data.agentSession,
|
|
3234
|
-
agentStates: data.agentStates,
|
|
3235
2532
|
url: data.frontend.url
|
|
3236
2533
|
});
|
|
3237
2534
|
logger2.debug("Event source created, creating response");
|
|
3238
2535
|
const response = {
|
|
3239
2536
|
threadId,
|
|
3240
2537
|
runId,
|
|
3241
|
-
status: (0,
|
|
2538
|
+
status: (0, import_rxjs2.firstValueFrom)(responseStatus$),
|
|
3242
2539
|
messages: new import_graphql_yoga.Repeater(async (pushMessage, stopStreamingMessages) => {
|
|
3243
2540
|
var _a2, _b2;
|
|
3244
2541
|
logger2.debug("Messages repeater created");
|
|
@@ -3289,18 +2586,14 @@ var CopilotResolver = class {
|
|
|
3289
2586
|
});
|
|
3290
2587
|
}
|
|
3291
2588
|
let eventStreamSubscription;
|
|
3292
|
-
const eventStream = eventSource.
|
|
3293
|
-
|
|
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
|
-
)
|
|
2589
|
+
const eventStream = eventSource.process({
|
|
2590
|
+
serversideActions: actions,
|
|
2591
|
+
guardrailsResult$: ((_b2 = data.cloud) == null ? void 0 : _b2.guardrails) ? guardrailsResult$ : null
|
|
3299
2592
|
}).pipe(
|
|
3300
2593
|
// shareReplay() ensures that later subscribers will see the whole stream instead of
|
|
3301
2594
|
// just the events that were emitted after the subscriber was added.
|
|
3302
|
-
(0,
|
|
3303
|
-
(0,
|
|
2595
|
+
(0, import_rxjs2.shareReplay)(),
|
|
2596
|
+
(0, import_rxjs2.finalize)(() => {
|
|
3304
2597
|
logger2.debug("Event stream finalized");
|
|
3305
2598
|
})
|
|
3306
2599
|
);
|
|
@@ -3311,22 +2604,22 @@ var CopilotResolver = class {
|
|
|
3311
2604
|
case RuntimeEventTypes.TextMessageStart:
|
|
3312
2605
|
const textMessageContentStream = eventStream.pipe(
|
|
3313
2606
|
// skip until this message start event
|
|
3314
|
-
(0,
|
|
2607
|
+
(0, import_rxjs2.skipWhile)((e) => e !== event),
|
|
3315
2608
|
// take until the message end event
|
|
3316
|
-
(0,
|
|
2609
|
+
(0, import_rxjs2.takeWhile)((e) => e.type != RuntimeEventTypes.TextMessageEnd)
|
|
3317
2610
|
);
|
|
3318
|
-
const streamingTextStatus = new
|
|
2611
|
+
const streamingTextStatus = new import_rxjs2.Subject();
|
|
3319
2612
|
const messageId = (0, import_shared9.randomId)();
|
|
3320
2613
|
pushMessage({
|
|
3321
2614
|
id: messageId,
|
|
3322
|
-
status: (0,
|
|
2615
|
+
status: (0, import_rxjs2.firstValueFrom)(streamingTextStatus),
|
|
3323
2616
|
createdAt: /* @__PURE__ */ new Date(),
|
|
3324
2617
|
role: MessageRole.assistant,
|
|
3325
2618
|
content: new import_graphql_yoga.Repeater(async (pushTextChunk, stopStreamingText) => {
|
|
3326
2619
|
logger2.debug("Text message content repeater created");
|
|
3327
2620
|
const textChunks = [];
|
|
3328
2621
|
let textSubscription;
|
|
3329
|
-
interruptStreaming$.pipe((0,
|
|
2622
|
+
interruptStreaming$.pipe((0, import_rxjs2.shareReplay)(), (0, import_rxjs2.take)(1), (0, import_rxjs2.tap)(({ reason, messageId: messageId2 }) => {
|
|
3330
2623
|
logger2.debug({
|
|
3331
2624
|
reason,
|
|
3332
2625
|
messageId: messageId2
|
|
@@ -3377,11 +2670,11 @@ var CopilotResolver = class {
|
|
|
3377
2670
|
break;
|
|
3378
2671
|
case RuntimeEventTypes.ActionExecutionStart:
|
|
3379
2672
|
logger2.debug("Action execution start event received");
|
|
3380
|
-
const actionExecutionArgumentStream = eventStream.pipe((0,
|
|
3381
|
-
const streamingArgumentsStatus = new
|
|
2673
|
+
const actionExecutionArgumentStream = eventStream.pipe((0, import_rxjs2.skipWhile)((e) => e !== event), (0, import_rxjs2.takeWhile)((e) => e.type != RuntimeEventTypes.ActionExecutionEnd));
|
|
2674
|
+
const streamingArgumentsStatus = new import_rxjs2.Subject();
|
|
3382
2675
|
pushMessage({
|
|
3383
2676
|
id: event.actionExecutionId,
|
|
3384
|
-
status: (0,
|
|
2677
|
+
status: (0, import_rxjs2.firstValueFrom)(streamingArgumentsStatus),
|
|
3385
2678
|
createdAt: /* @__PURE__ */ new Date(),
|
|
3386
2679
|
name: event.actionName,
|
|
3387
2680
|
scope: event.scope,
|
|
@@ -3443,36 +2736,6 @@ var CopilotResolver = class {
|
|
|
3443
2736
|
result: event.result
|
|
3444
2737
|
}));
|
|
3445
2738
|
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;
|
|
3476
2739
|
}
|
|
3477
2740
|
},
|
|
3478
2741
|
error: (err) => {
|
|
@@ -3491,7 +2754,7 @@ var CopilotResolver = class {
|
|
|
3491
2754
|
logger2.debug("Event stream completed");
|
|
3492
2755
|
if ((_a3 = data.cloud) == null ? void 0 : _a3.guardrails) {
|
|
3493
2756
|
logger2.debug("Guardrails is enabled, waiting for guardrails result");
|
|
3494
|
-
await (0,
|
|
2757
|
+
await (0, import_rxjs2.firstValueFrom)(guardrailsResult$);
|
|
3495
2758
|
}
|
|
3496
2759
|
responseStatus$.next(new SuccessResponseStatus());
|
|
3497
2760
|
eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
|
|
@@ -3505,29 +2768,29 @@ var CopilotResolver = class {
|
|
|
3505
2768
|
}
|
|
3506
2769
|
};
|
|
3507
2770
|
__name(CopilotResolver, "CopilotResolver");
|
|
3508
|
-
|
|
3509
|
-
(0,
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
2771
|
+
_ts_decorate12([
|
|
2772
|
+
(0, import_type_graphql13.Query)(() => String),
|
|
2773
|
+
_ts_metadata12("design:type", Function),
|
|
2774
|
+
_ts_metadata12("design:paramtypes", []),
|
|
2775
|
+
_ts_metadata12("design:returntype", Promise)
|
|
3513
2776
|
], CopilotResolver.prototype, "hello", null);
|
|
3514
|
-
|
|
3515
|
-
(0,
|
|
3516
|
-
_ts_param(0, (0,
|
|
3517
|
-
_ts_param(1, (0,
|
|
3518
|
-
_ts_param(2, (0,
|
|
2777
|
+
_ts_decorate12([
|
|
2778
|
+
(0, import_type_graphql13.Mutation)(() => CopilotResponse),
|
|
2779
|
+
_ts_param(0, (0, import_type_graphql13.Ctx)()),
|
|
2780
|
+
_ts_param(1, (0, import_type_graphql13.Arg)("data")),
|
|
2781
|
+
_ts_param(2, (0, import_type_graphql13.Arg)("properties", () => import_graphql_scalars2.GraphQLJSONObject, {
|
|
3519
2782
|
nullable: true
|
|
3520
2783
|
})),
|
|
3521
|
-
|
|
3522
|
-
|
|
2784
|
+
_ts_metadata12("design:type", Function),
|
|
2785
|
+
_ts_metadata12("design:paramtypes", [
|
|
3523
2786
|
typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
|
|
3524
2787
|
typeof GenerateCopilotResponseInput === "undefined" ? Object : GenerateCopilotResponseInput,
|
|
3525
2788
|
typeof CopilotRequestContextProperties === "undefined" ? Object : CopilotRequestContextProperties
|
|
3526
2789
|
]),
|
|
3527
|
-
|
|
2790
|
+
_ts_metadata12("design:returntype", Promise)
|
|
3528
2791
|
], CopilotResolver.prototype, "generateCopilotResponse", null);
|
|
3529
|
-
CopilotResolver =
|
|
3530
|
-
(0,
|
|
2792
|
+
CopilotResolver = _ts_decorate12([
|
|
2793
|
+
(0, import_type_graphql13.Resolver)(() => CopilotResponse)
|
|
3531
2794
|
], CopilotResolver);
|
|
3532
2795
|
|
|
3533
2796
|
// src/lib/integrations/shared.ts
|
|
@@ -3582,7 +2845,7 @@ async function createContext(initialContext, copilotKitContext, contextLogger, p
|
|
|
3582
2845
|
__name(createContext, "createContext");
|
|
3583
2846
|
function buildSchema(options = {}) {
|
|
3584
2847
|
logger.debug("Building GraphQL schema...");
|
|
3585
|
-
const schema = (0,
|
|
2848
|
+
const schema = (0, import_type_graphql14.buildSchemaSync)({
|
|
3586
2849
|
resolvers: [
|
|
3587
2850
|
CopilotResolver
|
|
3588
2851
|
],
|