@copilotkit/runtime 1.10.5-next.0 → 1.10.5-next.10
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 +68 -0
- package/__snapshots__/schema/schema.graphql +6 -0
- package/dist/{chunk-2JRX6LGW.mjs → chunk-COGFQ4V4.mjs} +2 -2
- package/dist/{chunk-WGOBL6DV.mjs → chunk-M65Z27MR.mjs} +2 -2
- package/dist/{chunk-HZWVUP7K.mjs → chunk-NFB4H6NT.mjs} +211 -144
- package/dist/chunk-NFB4H6NT.mjs.map +1 -0
- package/dist/{chunk-4GRKJVD6.mjs → chunk-NNBTOZO3.mjs} +2 -2
- package/dist/{chunk-TPMK44TE.mjs → chunk-Y5BKTUH2.mjs} +20 -6
- package/dist/chunk-Y5BKTUH2.mjs.map +1 -0
- package/dist/graphql/types/converted/index.d.ts +1 -1
- package/dist/{groq-adapter-4ba7b2f0.d.ts → groq-adapter-c8aec5c5.d.ts} +1 -1
- package/dist/{index-d4614f9b.d.ts → index-96b330da.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +247 -166
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/{langserve-3f99bf2e.d.ts → langserve-0c6100e3.d.ts} +1 -1
- package/dist/lib/index.d.ts +12 -6
- package/dist/lib/index.js +247 -166
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +5 -5
- package/dist/lib/integrations/index.d.ts +4 -4
- package/dist/lib/integrations/index.js +196 -151
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +4 -4
- package/dist/lib/integrations/nest/index.d.ts +3 -3
- package/dist/lib/integrations/nest/index.js +196 -151
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +2 -2
- package/dist/lib/integrations/node-express/index.d.ts +3 -3
- package/dist/lib/integrations/node-express/index.js +196 -151
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +2 -2
- package/dist/lib/integrations/node-http/index.d.ts +3 -3
- package/dist/lib/integrations/node-http/index.js +196 -151
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/dist/service-adapters/index.d.ts +5 -5
- package/dist/{shared-26958730.d.ts → shared-0a7346ce.d.ts} +19 -2
- package/package.json +11 -11
- package/src/graphql/inputs/copilot-context.input.ts +10 -0
- package/src/graphql/inputs/generate-copilot-response.input.ts +4 -0
- package/src/graphql/resolvers/copilot.resolver.ts +1 -0
- package/src/lib/runtime/agui-action.ts +11 -0
- package/src/lib/runtime/copilot-runtime.ts +30 -0
- package/src/lib/runtime/langgraph/langgraph-agent.ts +28 -7
- package/src/lib/runtime/remote-actions.ts +4 -0
- package/dist/chunk-HZWVUP7K.mjs.map +0 -1
- package/dist/chunk-TPMK44TE.mjs.map +0 -1
- /package/dist/{chunk-2JRX6LGW.mjs.map → chunk-COGFQ4V4.mjs.map} +0 -0
- /package/dist/{chunk-WGOBL6DV.mjs.map → chunk-M65Z27MR.mjs.map} +0 -0
- /package/dist/{chunk-4GRKJVD6.mjs.map → chunk-NNBTOZO3.mjs.map} +0 -0
|
@@ -40,7 +40,7 @@ var require_package = __commonJS({
|
|
|
40
40
|
publishConfig: {
|
|
41
41
|
access: "public"
|
|
42
42
|
},
|
|
43
|
-
version: "1.10.5-next.
|
|
43
|
+
version: "1.10.5-next.10",
|
|
44
44
|
sideEffects: false,
|
|
45
45
|
main: "./dist/index.js",
|
|
46
46
|
module: "./dist/index.mjs",
|
|
@@ -78,11 +78,11 @@ var require_package = __commonJS({
|
|
|
78
78
|
"zod-to-json-schema": "^3.23.5"
|
|
79
79
|
},
|
|
80
80
|
dependencies: {
|
|
81
|
-
"@ag-ui/client": "^0.0.
|
|
82
|
-
"@ag-ui/core": "^0.0.
|
|
83
|
-
"@ag-ui/encoder": "^0.0.
|
|
84
|
-
"@ag-ui/langgraph": "^0.0.
|
|
85
|
-
"@ag-ui/proto": "^0.0.
|
|
81
|
+
"@ag-ui/client": "^0.0.39",
|
|
82
|
+
"@ag-ui/core": "^0.0.39",
|
|
83
|
+
"@ag-ui/encoder": "^0.0.39",
|
|
84
|
+
"@ag-ui/langgraph": "^0.0.17",
|
|
85
|
+
"@ag-ui/proto": "^0.0.39",
|
|
86
86
|
"@anthropic-ai/sdk": "^0.57.0",
|
|
87
87
|
"@copilotkit/shared": "workspace:*",
|
|
88
88
|
"@graphql-yoga/plugin-defer-stream": "^3.3.1",
|
|
@@ -111,10 +111,10 @@ var require_package = __commonJS({
|
|
|
111
111
|
zod: "^3.23.3"
|
|
112
112
|
},
|
|
113
113
|
peerDependencies: {
|
|
114
|
-
"@ag-ui/client": ">=0.0.
|
|
115
|
-
"@ag-ui/core": ">=0.0.
|
|
116
|
-
"@ag-ui/encoder": ">=0.0.
|
|
117
|
-
"@ag-ui/proto": ">=0.0.
|
|
114
|
+
"@ag-ui/client": ">=0.0.39",
|
|
115
|
+
"@ag-ui/core": ">=0.0.39",
|
|
116
|
+
"@ag-ui/encoder": ">=0.0.39",
|
|
117
|
+
"@ag-ui/proto": ">=0.0.39"
|
|
118
118
|
},
|
|
119
119
|
keywords: [
|
|
120
120
|
"copilotkit",
|
|
@@ -143,7 +143,7 @@ import { Arg, Ctx, Mutation, Query, Resolver } from "type-graphql";
|
|
|
143
143
|
import { ReplaySubject as ReplaySubject3, Subject, filter, finalize, firstValueFrom as firstValueFrom2, shareReplay, skipWhile, take, takeWhile, tap } from "rxjs";
|
|
144
144
|
|
|
145
145
|
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
146
|
-
import { Field as
|
|
146
|
+
import { Field as Field16, InputType as InputType12 } from "type-graphql";
|
|
147
147
|
|
|
148
148
|
// src/graphql/inputs/message.input.ts
|
|
149
149
|
import { Field, InputType } from "type-graphql";
|
|
@@ -1359,7 +1359,8 @@ MetaEventInput = _ts_decorate14([
|
|
|
1359
1359
|
InputType10()
|
|
1360
1360
|
], MetaEventInput);
|
|
1361
1361
|
|
|
1362
|
-
// src/graphql/inputs/
|
|
1362
|
+
// src/graphql/inputs/copilot-context.input.ts
|
|
1363
|
+
import { Field as Field15, InputType as InputType11 } from "type-graphql";
|
|
1363
1364
|
function _ts_decorate15(decorators, target, key, desc) {
|
|
1364
1365
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1365
1366
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1376,18 +1377,52 @@ function _ts_metadata15(k, v) {
|
|
|
1376
1377
|
return Reflect.metadata(k, v);
|
|
1377
1378
|
}
|
|
1378
1379
|
__name(_ts_metadata15, "_ts_metadata");
|
|
1380
|
+
var CopilotContextInput = class {
|
|
1381
|
+
description;
|
|
1382
|
+
value;
|
|
1383
|
+
};
|
|
1384
|
+
__name(CopilotContextInput, "CopilotContextInput");
|
|
1385
|
+
_ts_decorate15([
|
|
1386
|
+
Field15(() => String),
|
|
1387
|
+
_ts_metadata15("design:type", String)
|
|
1388
|
+
], CopilotContextInput.prototype, "description", void 0);
|
|
1389
|
+
_ts_decorate15([
|
|
1390
|
+
Field15(() => String),
|
|
1391
|
+
_ts_metadata15("design:type", String)
|
|
1392
|
+
], CopilotContextInput.prototype, "value", void 0);
|
|
1393
|
+
CopilotContextInput = _ts_decorate15([
|
|
1394
|
+
InputType11()
|
|
1395
|
+
], CopilotContextInput);
|
|
1396
|
+
|
|
1397
|
+
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
1398
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
1399
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1400
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1401
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1402
|
+
else
|
|
1403
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1404
|
+
if (d = decorators[i])
|
|
1405
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1406
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1407
|
+
}
|
|
1408
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
1409
|
+
function _ts_metadata16(k, v) {
|
|
1410
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1411
|
+
return Reflect.metadata(k, v);
|
|
1412
|
+
}
|
|
1413
|
+
__name(_ts_metadata16, "_ts_metadata");
|
|
1379
1414
|
var GenerateCopilotResponseMetadataInput = class {
|
|
1380
1415
|
requestType;
|
|
1381
1416
|
};
|
|
1382
1417
|
__name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
|
|
1383
|
-
|
|
1384
|
-
|
|
1418
|
+
_ts_decorate16([
|
|
1419
|
+
Field16(() => CopilotRequestType, {
|
|
1385
1420
|
nullable: true
|
|
1386
1421
|
}),
|
|
1387
|
-
|
|
1422
|
+
_ts_metadata16("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
|
|
1388
1423
|
], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
|
|
1389
|
-
GenerateCopilotResponseMetadataInput =
|
|
1390
|
-
|
|
1424
|
+
GenerateCopilotResponseMetadataInput = _ts_decorate16([
|
|
1425
|
+
InputType12()
|
|
1391
1426
|
], GenerateCopilotResponseMetadataInput);
|
|
1392
1427
|
var GenerateCopilotResponseInput = class {
|
|
1393
1428
|
metadata;
|
|
@@ -1402,84 +1437,93 @@ var GenerateCopilotResponseInput = class {
|
|
|
1402
1437
|
agentStates;
|
|
1403
1438
|
extensions;
|
|
1404
1439
|
metaEvents;
|
|
1440
|
+
context;
|
|
1405
1441
|
};
|
|
1406
1442
|
__name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
|
|
1407
|
-
|
|
1408
|
-
|
|
1443
|
+
_ts_decorate16([
|
|
1444
|
+
Field16(() => GenerateCopilotResponseMetadataInput, {
|
|
1409
1445
|
nullable: false
|
|
1410
1446
|
}),
|
|
1411
|
-
|
|
1447
|
+
_ts_metadata16("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
|
|
1412
1448
|
], GenerateCopilotResponseInput.prototype, "metadata", void 0);
|
|
1413
|
-
|
|
1414
|
-
|
|
1449
|
+
_ts_decorate16([
|
|
1450
|
+
Field16(() => String, {
|
|
1415
1451
|
nullable: true
|
|
1416
1452
|
}),
|
|
1417
|
-
|
|
1453
|
+
_ts_metadata16("design:type", String)
|
|
1418
1454
|
], GenerateCopilotResponseInput.prototype, "threadId", void 0);
|
|
1419
|
-
|
|
1420
|
-
|
|
1455
|
+
_ts_decorate16([
|
|
1456
|
+
Field16(() => String, {
|
|
1421
1457
|
nullable: true
|
|
1422
1458
|
}),
|
|
1423
|
-
|
|
1459
|
+
_ts_metadata16("design:type", String)
|
|
1424
1460
|
], GenerateCopilotResponseInput.prototype, "runId", void 0);
|
|
1425
|
-
|
|
1426
|
-
|
|
1461
|
+
_ts_decorate16([
|
|
1462
|
+
Field16(() => [
|
|
1427
1463
|
MessageInput
|
|
1428
1464
|
]),
|
|
1429
|
-
|
|
1465
|
+
_ts_metadata16("design:type", Array)
|
|
1430
1466
|
], GenerateCopilotResponseInput.prototype, "messages", void 0);
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1467
|
+
_ts_decorate16([
|
|
1468
|
+
Field16(() => FrontendInput),
|
|
1469
|
+
_ts_metadata16("design:type", typeof FrontendInput === "undefined" ? Object : FrontendInput)
|
|
1434
1470
|
], GenerateCopilotResponseInput.prototype, "frontend", void 0);
|
|
1435
|
-
|
|
1436
|
-
|
|
1471
|
+
_ts_decorate16([
|
|
1472
|
+
Field16(() => CloudInput, {
|
|
1437
1473
|
nullable: true
|
|
1438
1474
|
}),
|
|
1439
|
-
|
|
1475
|
+
_ts_metadata16("design:type", typeof CloudInput === "undefined" ? Object : CloudInput)
|
|
1440
1476
|
], GenerateCopilotResponseInput.prototype, "cloud", void 0);
|
|
1441
|
-
|
|
1442
|
-
|
|
1477
|
+
_ts_decorate16([
|
|
1478
|
+
Field16(() => ForwardedParametersInput, {
|
|
1443
1479
|
nullable: true
|
|
1444
1480
|
}),
|
|
1445
|
-
|
|
1481
|
+
_ts_metadata16("design:type", typeof ForwardedParametersInput === "undefined" ? Object : ForwardedParametersInput)
|
|
1446
1482
|
], GenerateCopilotResponseInput.prototype, "forwardedParameters", void 0);
|
|
1447
|
-
|
|
1448
|
-
|
|
1483
|
+
_ts_decorate16([
|
|
1484
|
+
Field16(() => AgentSessionInput, {
|
|
1449
1485
|
nullable: true
|
|
1450
1486
|
}),
|
|
1451
|
-
|
|
1487
|
+
_ts_metadata16("design:type", typeof AgentSessionInput === "undefined" ? Object : AgentSessionInput)
|
|
1452
1488
|
], GenerateCopilotResponseInput.prototype, "agentSession", void 0);
|
|
1453
|
-
|
|
1454
|
-
|
|
1489
|
+
_ts_decorate16([
|
|
1490
|
+
Field16(() => AgentStateInput, {
|
|
1455
1491
|
nullable: true
|
|
1456
1492
|
}),
|
|
1457
|
-
|
|
1493
|
+
_ts_metadata16("design:type", typeof AgentStateInput === "undefined" ? Object : AgentStateInput)
|
|
1458
1494
|
], GenerateCopilotResponseInput.prototype, "agentState", void 0);
|
|
1459
|
-
|
|
1460
|
-
|
|
1495
|
+
_ts_decorate16([
|
|
1496
|
+
Field16(() => [
|
|
1461
1497
|
AgentStateInput
|
|
1462
1498
|
], {
|
|
1463
1499
|
nullable: true
|
|
1464
1500
|
}),
|
|
1465
|
-
|
|
1501
|
+
_ts_metadata16("design:type", Array)
|
|
1466
1502
|
], GenerateCopilotResponseInput.prototype, "agentStates", void 0);
|
|
1467
|
-
|
|
1468
|
-
|
|
1503
|
+
_ts_decorate16([
|
|
1504
|
+
Field16(() => ExtensionsInput, {
|
|
1469
1505
|
nullable: true
|
|
1470
1506
|
}),
|
|
1471
|
-
|
|
1507
|
+
_ts_metadata16("design:type", typeof ExtensionsInput === "undefined" ? Object : ExtensionsInput)
|
|
1472
1508
|
], GenerateCopilotResponseInput.prototype, "extensions", void 0);
|
|
1473
|
-
|
|
1474
|
-
|
|
1509
|
+
_ts_decorate16([
|
|
1510
|
+
Field16(() => [
|
|
1475
1511
|
MetaEventInput
|
|
1476
1512
|
], {
|
|
1477
1513
|
nullable: true
|
|
1478
1514
|
}),
|
|
1479
|
-
|
|
1515
|
+
_ts_metadata16("design:type", Array)
|
|
1480
1516
|
], GenerateCopilotResponseInput.prototype, "metaEvents", void 0);
|
|
1481
|
-
|
|
1482
|
-
|
|
1517
|
+
_ts_decorate16([
|
|
1518
|
+
Field16(() => [
|
|
1519
|
+
CopilotContextInput
|
|
1520
|
+
], {
|
|
1521
|
+
nullable: true
|
|
1522
|
+
}),
|
|
1523
|
+
_ts_metadata16("design:type", Array)
|
|
1524
|
+
], GenerateCopilotResponseInput.prototype, "context", void 0);
|
|
1525
|
+
GenerateCopilotResponseInput = _ts_decorate16([
|
|
1526
|
+
InputType12()
|
|
1483
1527
|
], GenerateCopilotResponseInput);
|
|
1484
1528
|
|
|
1485
1529
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
@@ -2777,6 +2821,7 @@ var CopilotRuntime = class {
|
|
|
2777
2821
|
langserve = [];
|
|
2778
2822
|
onBeforeRequest;
|
|
2779
2823
|
onAfterRequest;
|
|
2824
|
+
onStopGeneration;
|
|
2780
2825
|
delegateAgentProcessingToServiceAdapter;
|
|
2781
2826
|
observability;
|
|
2782
2827
|
availableAgents;
|
|
@@ -2804,6 +2849,7 @@ var CopilotRuntime = class {
|
|
|
2804
2849
|
this.remoteEndpointDefinitions = (params == null ? void 0 : params.remoteEndpoints) ?? (params == null ? void 0 : params.remoteActions) ?? [];
|
|
2805
2850
|
this.onBeforeRequest = (_a = params == null ? void 0 : params.middleware) == null ? void 0 : _a.onBeforeRequest;
|
|
2806
2851
|
this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
|
|
2852
|
+
this.onStopGeneration = params == null ? void 0 : params.onStopGeneration;
|
|
2807
2853
|
this.delegateAgentProcessingToServiceAdapter = (params == null ? void 0 : params.delegateAgentProcessingToServiceAdapter) || false;
|
|
2808
2854
|
this.observability = params == null ? void 0 : params.observability_c;
|
|
2809
2855
|
this.agents = (params == null ? void 0 : params.agents) ?? {};
|
|
@@ -2882,10 +2928,22 @@ var CopilotRuntime = class {
|
|
|
2882
2928
|
}
|
|
2883
2929
|
async processRuntimeRequest(request) {
|
|
2884
2930
|
var _a, _b, _c, _d, _e;
|
|
2885
|
-
const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, url, extensions, agentSession, agentStates, publicApiKey } = request;
|
|
2931
|
+
const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, url, extensions, agentSession, agentStates, publicApiKey, context } = request;
|
|
2932
|
+
graphqlContext.request.signal.addEventListener("abort", () => {
|
|
2933
|
+
var _a2;
|
|
2934
|
+
return (_a2 = this.onStopGeneration) == null ? void 0 : _a2.call(this, {
|
|
2935
|
+
threadId,
|
|
2936
|
+
runId,
|
|
2937
|
+
url,
|
|
2938
|
+
agentName: agentSession == null ? void 0 : agentSession.agentName,
|
|
2939
|
+
lastMessage: rawMessages[rawMessages.length - 1]
|
|
2940
|
+
});
|
|
2941
|
+
}, {
|
|
2942
|
+
once: true
|
|
2943
|
+
});
|
|
2886
2944
|
const eventSource = new RuntimeEventSource({
|
|
2887
|
-
errorHandler: async (error,
|
|
2888
|
-
await this.error("error",
|
|
2945
|
+
errorHandler: async (error, context2) => {
|
|
2946
|
+
await this.error("error", context2, error, publicApiKey);
|
|
2889
2947
|
},
|
|
2890
2948
|
errorContext: {
|
|
2891
2949
|
threadId,
|
|
@@ -3331,7 +3389,7 @@ please use an LLM adapter instead.`
|
|
|
3331
3389
|
}
|
|
3332
3390
|
async processAgentRequest(request) {
|
|
3333
3391
|
var _a, _b, _c, _d, _e;
|
|
3334
|
-
const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession, threadId: threadIdFromRequest, metaEvents, publicApiKey, forwardedParameters } = request;
|
|
3392
|
+
const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession, threadId: threadIdFromRequest, metaEvents, publicApiKey, forwardedParameters, context } = request;
|
|
3335
3393
|
const { agentName, nodeName } = agentSession;
|
|
3336
3394
|
const requestStartTime = Date.now();
|
|
3337
3395
|
const streamedChunks = [];
|
|
@@ -3405,8 +3463,8 @@ please use an LLM adapter instead.`
|
|
|
3405
3463
|
}));
|
|
3406
3464
|
try {
|
|
3407
3465
|
const eventSource = new RuntimeEventSource({
|
|
3408
|
-
errorHandler: async (error,
|
|
3409
|
-
await this.error("error",
|
|
3466
|
+
errorHandler: async (error, context2) => {
|
|
3467
|
+
await this.error("error", context2, error, publicApiKey);
|
|
3410
3468
|
},
|
|
3411
3469
|
errorContext: {
|
|
3412
3470
|
threadId,
|
|
@@ -3631,7 +3689,8 @@ please use an LLM adapter instead.`
|
|
|
3631
3689
|
frontendUrl: url,
|
|
3632
3690
|
agents: this.agents,
|
|
3633
3691
|
metaEvents: request.metaEvents,
|
|
3634
|
-
nodeName: (_a = request.agentSession) == null ? void 0 : _a.nodeName
|
|
3692
|
+
nodeName: (_a = request.agentSession) == null ? void 0 : _a.nodeName,
|
|
3693
|
+
context: request.context
|
|
3635
3694
|
});
|
|
3636
3695
|
const configuredActions = typeof this.actions === "function" ? this.actions({
|
|
3637
3696
|
properties: graphqlContext.properties,
|
|
@@ -4375,7 +4434,7 @@ import { CopilotKitLowLevelError as CopilotKitLowLevelError6, ResolvedCopilotKit
|
|
|
4375
4434
|
// src/lib/runtime/agui-action.ts
|
|
4376
4435
|
import { catchError as catchError2, mergeMap as mergeMap2, of, throwError } from "rxjs";
|
|
4377
4436
|
import { CopilotKitError as CopilotKitError5, CopilotKitErrorCode as CopilotKitErrorCode3, parseJson as parseJson3 } from "@copilotkit/shared";
|
|
4378
|
-
function constructAGUIRemoteAction({ logger: logger2, messages, agentStates, agent, metaEvents, threadMetadata, nodeName, graphqlContext }) {
|
|
4437
|
+
function constructAGUIRemoteAction({ logger: logger2, messages, agentStates, agent, metaEvents, threadMetadata, nodeName, context, graphqlContext }) {
|
|
4379
4438
|
const action = {
|
|
4380
4439
|
name: agent.agentId,
|
|
4381
4440
|
description: agent.description,
|
|
@@ -4384,6 +4443,11 @@ function constructAGUIRemoteAction({ logger: logger2, messages, agentStates, age
|
|
|
4384
4443
|
},
|
|
4385
4444
|
remoteAgentHandler: async ({ actionInputsWithoutAgents, threadId }) => {
|
|
4386
4445
|
var _a;
|
|
4446
|
+
graphqlContext.request.signal.addEventListener("abort", () => {
|
|
4447
|
+
agent.abortRun();
|
|
4448
|
+
}, {
|
|
4449
|
+
once: true
|
|
4450
|
+
});
|
|
4387
4451
|
logger2.debug({
|
|
4388
4452
|
actionName: agent.agentId
|
|
4389
4453
|
}, "Executing remote agent");
|
|
@@ -4434,7 +4498,8 @@ function constructAGUIRemoteAction({ logger: logger2, messages, agentStates, age
|
|
|
4434
4498
|
};
|
|
4435
4499
|
return agent.legacy_to_be_removed_runAgentBridged({
|
|
4436
4500
|
tools,
|
|
4437
|
-
forwardedProps
|
|
4501
|
+
forwardedProps,
|
|
4502
|
+
context
|
|
4438
4503
|
}).pipe(mergeMap2((event) => {
|
|
4439
4504
|
if (event.type === RuntimeEventTypes.RunError) {
|
|
4440
4505
|
const { message } = event;
|
|
@@ -4559,7 +4624,7 @@ async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: l
|
|
|
4559
4624
|
}
|
|
4560
4625
|
}
|
|
4561
4626
|
__name(fetchRemoteInfo, "fetchRemoteInfo");
|
|
4562
|
-
async function setupRemoteActions({ remoteEndpointDefinitions, graphqlContext, messages, agentStates, frontendUrl, agents, metaEvents, nodeName }) {
|
|
4627
|
+
async function setupRemoteActions({ remoteEndpointDefinitions, graphqlContext, messages, agentStates, frontendUrl, agents, metaEvents, nodeName, context }) {
|
|
4563
4628
|
var _a;
|
|
4564
4629
|
const logger2 = graphqlContext.logger.child({
|
|
4565
4630
|
component: "remote-actions.fetchRemoteActions"
|
|
@@ -4627,7 +4692,8 @@ async function setupRemoteActions({ remoteEndpointDefinitions, graphqlContext, m
|
|
|
4627
4692
|
metaEvents,
|
|
4628
4693
|
threadMetadata,
|
|
4629
4694
|
nodeName,
|
|
4630
|
-
graphqlContext
|
|
4695
|
+
graphqlContext,
|
|
4696
|
+
context
|
|
4631
4697
|
}));
|
|
4632
4698
|
}
|
|
4633
4699
|
return result.flat();
|
|
@@ -4974,8 +5040,8 @@ import { GraphQLError } from "graphql";
|
|
|
4974
5040
|
import { randomId as randomId3 } from "@copilotkit/shared";
|
|
4975
5041
|
|
|
4976
5042
|
// src/graphql/types/agents-response.type.ts
|
|
4977
|
-
import { Field as
|
|
4978
|
-
function
|
|
5043
|
+
import { Field as Field17, ObjectType as ObjectType5 } from "type-graphql";
|
|
5044
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
4979
5045
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4980
5046
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4981
5047
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4985,50 +5051,50 @@ function _ts_decorate16(decorators, target, key, desc) {
|
|
|
4985
5051
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4986
5052
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4987
5053
|
}
|
|
4988
|
-
__name(
|
|
4989
|
-
function
|
|
5054
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
5055
|
+
function _ts_metadata17(k, v) {
|
|
4990
5056
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4991
5057
|
return Reflect.metadata(k, v);
|
|
4992
5058
|
}
|
|
4993
|
-
__name(
|
|
5059
|
+
__name(_ts_metadata17, "_ts_metadata");
|
|
4994
5060
|
var Agent = class {
|
|
4995
5061
|
id;
|
|
4996
5062
|
name;
|
|
4997
5063
|
description;
|
|
4998
5064
|
};
|
|
4999
5065
|
__name(Agent, "Agent");
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5066
|
+
_ts_decorate17([
|
|
5067
|
+
Field17(() => String),
|
|
5068
|
+
_ts_metadata17("design:type", String)
|
|
5003
5069
|
], Agent.prototype, "id", void 0);
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5070
|
+
_ts_decorate17([
|
|
5071
|
+
Field17(() => String),
|
|
5072
|
+
_ts_metadata17("design:type", String)
|
|
5007
5073
|
], Agent.prototype, "name", void 0);
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5074
|
+
_ts_decorate17([
|
|
5075
|
+
Field17(() => String),
|
|
5076
|
+
_ts_metadata17("design:type", String)
|
|
5011
5077
|
], Agent.prototype, "description", void 0);
|
|
5012
|
-
Agent =
|
|
5078
|
+
Agent = _ts_decorate17([
|
|
5013
5079
|
ObjectType5()
|
|
5014
5080
|
], Agent);
|
|
5015
5081
|
var AgentsResponse = class {
|
|
5016
5082
|
agents;
|
|
5017
5083
|
};
|
|
5018
5084
|
__name(AgentsResponse, "AgentsResponse");
|
|
5019
|
-
|
|
5020
|
-
|
|
5085
|
+
_ts_decorate17([
|
|
5086
|
+
Field17(() => [
|
|
5021
5087
|
Agent
|
|
5022
5088
|
]),
|
|
5023
|
-
|
|
5089
|
+
_ts_metadata17("design:type", Array)
|
|
5024
5090
|
], AgentsResponse.prototype, "agents", void 0);
|
|
5025
|
-
AgentsResponse =
|
|
5091
|
+
AgentsResponse = _ts_decorate17([
|
|
5026
5092
|
ObjectType5()
|
|
5027
5093
|
], AgentsResponse);
|
|
5028
5094
|
|
|
5029
5095
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
5030
5096
|
import { CopilotKitError as CopilotKitError8, CopilotKitLowLevelError as CopilotKitLowLevelError8, isStructuredCopilotKitError as isStructuredCopilotKitError2 } from "@copilotkit/shared";
|
|
5031
|
-
function
|
|
5097
|
+
function _ts_decorate18(decorators, target, key, desc) {
|
|
5032
5098
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5033
5099
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5034
5100
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -5038,12 +5104,12 @@ function _ts_decorate17(decorators, target, key, desc) {
|
|
|
5038
5104
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5039
5105
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5040
5106
|
}
|
|
5041
|
-
__name(
|
|
5042
|
-
function
|
|
5107
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
5108
|
+
function _ts_metadata18(k, v) {
|
|
5043
5109
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5044
5110
|
return Reflect.metadata(k, v);
|
|
5045
5111
|
}
|
|
5046
|
-
__name(
|
|
5112
|
+
__name(_ts_metadata18, "_ts_metadata");
|
|
5047
5113
|
function _ts_param(paramIndex, decorator) {
|
|
5048
5114
|
return function(target, key) {
|
|
5049
5115
|
decorator(target, key, paramIndex);
|
|
@@ -5192,7 +5258,8 @@ var CopilotResolver = class {
|
|
|
5192
5258
|
agentStates: data.agentStates,
|
|
5193
5259
|
url: data.frontend.url,
|
|
5194
5260
|
extensions: data.extensions,
|
|
5195
|
-
metaEvents: data.metaEvents
|
|
5261
|
+
metaEvents: data.metaEvents,
|
|
5262
|
+
context: data.context
|
|
5196
5263
|
});
|
|
5197
5264
|
} catch (error) {
|
|
5198
5265
|
if (isStructuredCopilotKitError2(error) || ((_e = error == null ? void 0 : error.extensions) == null ? void 0 : _e.visibility)) {
|
|
@@ -5589,37 +5656,37 @@ var CopilotResolver = class {
|
|
|
5589
5656
|
}
|
|
5590
5657
|
};
|
|
5591
5658
|
__name(CopilotResolver, "CopilotResolver");
|
|
5592
|
-
|
|
5659
|
+
_ts_decorate18([
|
|
5593
5660
|
Query(() => String),
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5661
|
+
_ts_metadata18("design:type", Function),
|
|
5662
|
+
_ts_metadata18("design:paramtypes", []),
|
|
5663
|
+
_ts_metadata18("design:returntype", Promise)
|
|
5597
5664
|
], CopilotResolver.prototype, "hello", null);
|
|
5598
|
-
|
|
5665
|
+
_ts_decorate18([
|
|
5599
5666
|
Query(() => AgentsResponse),
|
|
5600
5667
|
_ts_param(0, Ctx()),
|
|
5601
|
-
|
|
5602
|
-
|
|
5668
|
+
_ts_metadata18("design:type", Function),
|
|
5669
|
+
_ts_metadata18("design:paramtypes", [
|
|
5603
5670
|
typeof GraphQLContext === "undefined" ? Object : GraphQLContext
|
|
5604
5671
|
]),
|
|
5605
|
-
|
|
5672
|
+
_ts_metadata18("design:returntype", Promise)
|
|
5606
5673
|
], CopilotResolver.prototype, "availableAgents", null);
|
|
5607
|
-
|
|
5674
|
+
_ts_decorate18([
|
|
5608
5675
|
Mutation(() => CopilotResponse),
|
|
5609
5676
|
_ts_param(0, Ctx()),
|
|
5610
5677
|
_ts_param(1, Arg("data")),
|
|
5611
5678
|
_ts_param(2, Arg("properties", () => GraphQLJSONObject, {
|
|
5612
5679
|
nullable: true
|
|
5613
5680
|
})),
|
|
5614
|
-
|
|
5615
|
-
|
|
5681
|
+
_ts_metadata18("design:type", Function),
|
|
5682
|
+
_ts_metadata18("design:paramtypes", [
|
|
5616
5683
|
typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
|
|
5617
5684
|
typeof GenerateCopilotResponseInput === "undefined" ? Object : GenerateCopilotResponseInput,
|
|
5618
5685
|
typeof CopilotRequestContextProperties === "undefined" ? Object : CopilotRequestContextProperties
|
|
5619
5686
|
]),
|
|
5620
|
-
|
|
5687
|
+
_ts_metadata18("design:returntype", Promise)
|
|
5621
5688
|
], CopilotResolver.prototype, "generateCopilotResponse", null);
|
|
5622
|
-
CopilotResolver =
|
|
5689
|
+
CopilotResolver = _ts_decorate18([
|
|
5623
5690
|
Resolver(() => CopilotResponse)
|
|
5624
5691
|
], CopilotResolver);
|
|
5625
5692
|
|
|
@@ -5660,8 +5727,8 @@ import { Ctx as Ctx2 } from "type-graphql";
|
|
|
5660
5727
|
import { Query as Query2 } from "type-graphql";
|
|
5661
5728
|
|
|
5662
5729
|
// src/graphql/types/load-agent-state-response.type.ts
|
|
5663
|
-
import { Field as
|
|
5664
|
-
function
|
|
5730
|
+
import { Field as Field18, ObjectType as ObjectType6 } from "type-graphql";
|
|
5731
|
+
function _ts_decorate19(decorators, target, key, desc) {
|
|
5665
5732
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5666
5733
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5667
5734
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -5671,12 +5738,12 @@ function _ts_decorate18(decorators, target, key, desc) {
|
|
|
5671
5738
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5672
5739
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5673
5740
|
}
|
|
5674
|
-
__name(
|
|
5675
|
-
function
|
|
5741
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
5742
|
+
function _ts_metadata19(k, v) {
|
|
5676
5743
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5677
5744
|
return Reflect.metadata(k, v);
|
|
5678
5745
|
}
|
|
5679
|
-
__name(
|
|
5746
|
+
__name(_ts_metadata19, "_ts_metadata");
|
|
5680
5747
|
var LoadAgentStateResponse = class {
|
|
5681
5748
|
threadId;
|
|
5682
5749
|
threadExists;
|
|
@@ -5684,29 +5751,29 @@ var LoadAgentStateResponse = class {
|
|
|
5684
5751
|
messages;
|
|
5685
5752
|
};
|
|
5686
5753
|
__name(LoadAgentStateResponse, "LoadAgentStateResponse");
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5754
|
+
_ts_decorate19([
|
|
5755
|
+
Field18(() => String),
|
|
5756
|
+
_ts_metadata19("design:type", String)
|
|
5690
5757
|
], LoadAgentStateResponse.prototype, "threadId", void 0);
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5758
|
+
_ts_decorate19([
|
|
5759
|
+
Field18(() => Boolean),
|
|
5760
|
+
_ts_metadata19("design:type", Boolean)
|
|
5694
5761
|
], LoadAgentStateResponse.prototype, "threadExists", void 0);
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5762
|
+
_ts_decorate19([
|
|
5763
|
+
Field18(() => String),
|
|
5764
|
+
_ts_metadata19("design:type", String)
|
|
5698
5765
|
], LoadAgentStateResponse.prototype, "state", void 0);
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5766
|
+
_ts_decorate19([
|
|
5767
|
+
Field18(() => String),
|
|
5768
|
+
_ts_metadata19("design:type", String)
|
|
5702
5769
|
], LoadAgentStateResponse.prototype, "messages", void 0);
|
|
5703
|
-
LoadAgentStateResponse =
|
|
5770
|
+
LoadAgentStateResponse = _ts_decorate19([
|
|
5704
5771
|
ObjectType6()
|
|
5705
5772
|
], LoadAgentStateResponse);
|
|
5706
5773
|
|
|
5707
5774
|
// src/graphql/inputs/load-agent-state.input.ts
|
|
5708
|
-
import { Field as
|
|
5709
|
-
function
|
|
5775
|
+
import { Field as Field19, InputType as InputType13 } from "type-graphql";
|
|
5776
|
+
function _ts_decorate20(decorators, target, key, desc) {
|
|
5710
5777
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5711
5778
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5712
5779
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -5716,32 +5783,32 @@ function _ts_decorate19(decorators, target, key, desc) {
|
|
|
5716
5783
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5717
5784
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5718
5785
|
}
|
|
5719
|
-
__name(
|
|
5720
|
-
function
|
|
5786
|
+
__name(_ts_decorate20, "_ts_decorate");
|
|
5787
|
+
function _ts_metadata20(k, v) {
|
|
5721
5788
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5722
5789
|
return Reflect.metadata(k, v);
|
|
5723
5790
|
}
|
|
5724
|
-
__name(
|
|
5791
|
+
__name(_ts_metadata20, "_ts_metadata");
|
|
5725
5792
|
var LoadAgentStateInput = class {
|
|
5726
5793
|
threadId;
|
|
5727
5794
|
agentName;
|
|
5728
5795
|
};
|
|
5729
5796
|
__name(LoadAgentStateInput, "LoadAgentStateInput");
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5797
|
+
_ts_decorate20([
|
|
5798
|
+
Field19(() => String),
|
|
5799
|
+
_ts_metadata20("design:type", String)
|
|
5733
5800
|
], LoadAgentStateInput.prototype, "threadId", void 0);
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5801
|
+
_ts_decorate20([
|
|
5802
|
+
Field19(() => String),
|
|
5803
|
+
_ts_metadata20("design:type", String)
|
|
5737
5804
|
], LoadAgentStateInput.prototype, "agentName", void 0);
|
|
5738
|
-
LoadAgentStateInput =
|
|
5739
|
-
|
|
5805
|
+
LoadAgentStateInput = _ts_decorate20([
|
|
5806
|
+
InputType13()
|
|
5740
5807
|
], LoadAgentStateInput);
|
|
5741
5808
|
|
|
5742
5809
|
// src/graphql/resolvers/state.resolver.ts
|
|
5743
5810
|
import { CopilotKitAgentDiscoveryError as CopilotKitAgentDiscoveryError2 } from "@copilotkit/shared";
|
|
5744
|
-
function
|
|
5811
|
+
function _ts_decorate21(decorators, target, key, desc) {
|
|
5745
5812
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5746
5813
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5747
5814
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -5751,12 +5818,12 @@ function _ts_decorate20(decorators, target, key, desc) {
|
|
|
5751
5818
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5752
5819
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5753
5820
|
}
|
|
5754
|
-
__name(
|
|
5755
|
-
function
|
|
5821
|
+
__name(_ts_decorate21, "_ts_decorate");
|
|
5822
|
+
function _ts_metadata21(k, v) {
|
|
5756
5823
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5757
5824
|
return Reflect.metadata(k, v);
|
|
5758
5825
|
}
|
|
5759
|
-
__name(
|
|
5826
|
+
__name(_ts_metadata21, "_ts_metadata");
|
|
5760
5827
|
function _ts_param2(paramIndex, decorator) {
|
|
5761
5828
|
return function(target, key) {
|
|
5762
5829
|
decorator(target, key, paramIndex);
|
|
@@ -5781,18 +5848,18 @@ var StateResolver = class {
|
|
|
5781
5848
|
}
|
|
5782
5849
|
};
|
|
5783
5850
|
__name(StateResolver, "StateResolver");
|
|
5784
|
-
|
|
5851
|
+
_ts_decorate21([
|
|
5785
5852
|
Query2(() => LoadAgentStateResponse),
|
|
5786
5853
|
_ts_param2(0, Ctx2()),
|
|
5787
5854
|
_ts_param2(1, Arg2("data")),
|
|
5788
|
-
|
|
5789
|
-
|
|
5855
|
+
_ts_metadata21("design:type", Function),
|
|
5856
|
+
_ts_metadata21("design:paramtypes", [
|
|
5790
5857
|
typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
|
|
5791
5858
|
typeof LoadAgentStateInput === "undefined" ? Object : LoadAgentStateInput
|
|
5792
5859
|
]),
|
|
5793
|
-
|
|
5860
|
+
_ts_metadata21("design:returntype", Promise)
|
|
5794
5861
|
], StateResolver.prototype, "loadAgentState", null);
|
|
5795
|
-
StateResolver =
|
|
5862
|
+
StateResolver = _ts_decorate21([
|
|
5796
5863
|
Resolver2(() => LoadAgentStateResponse)
|
|
5797
5864
|
], StateResolver);
|
|
5798
5865
|
|
|
@@ -5947,4 +6014,4 @@ export {
|
|
|
5947
6014
|
getCommonConfig,
|
|
5948
6015
|
copilotRuntimeNodeHttpEndpoint
|
|
5949
6016
|
};
|
|
5950
|
-
//# sourceMappingURL=chunk-
|
|
6017
|
+
//# sourceMappingURL=chunk-NFB4H6NT.mjs.map
|