@copilotkit/runtime 1.5.1-next.2 → 1.5.1-next.3

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/__snapshots__/schema/schema.graphql +9 -19
  3. package/dist/{chunk-RFF5IIZJ.mjs → chunk-B74M7FXG.mjs} +2 -3
  4. package/dist/chunk-B74M7FXG.mjs.map +1 -0
  5. package/dist/{chunk-2FY7EQEE.mjs → chunk-M4QD67S3.mjs} +2 -2
  6. package/dist/{chunk-CLGKEUOA.mjs → chunk-OKQVDDJ2.mjs} +63 -298
  7. package/dist/chunk-OKQVDDJ2.mjs.map +1 -0
  8. package/dist/{chunk-2ZPE55QG.mjs → chunk-U3AYI5XZ.mjs} +2 -2
  9. package/dist/{chunk-W6E7AVR7.mjs → chunk-U75F2RAQ.mjs} +2 -2
  10. package/dist/{chunk-2V7BHSFE.mjs → chunk-ZSWCEADS.mjs} +331 -579
  11. package/dist/chunk-ZSWCEADS.mjs.map +1 -0
  12. package/dist/{copilot-runtime-36700e00.d.ts → copilot-runtime-12e7ac40.d.ts} +2 -9
  13. package/dist/graphql/types/converted/index.d.ts +1 -1
  14. package/dist/graphql/types/converted/index.js +1 -2
  15. package/dist/graphql/types/converted/index.js.map +1 -1
  16. package/dist/graphql/types/converted/index.mjs +1 -1
  17. package/dist/{groq-adapter-696b5d29.d.ts → groq-adapter-24abe931.d.ts} +1 -1
  18. package/dist/{index-cc2b17be.d.ts → index-10b1c870.d.ts} +9 -8
  19. package/dist/index.d.ts +5 -5
  20. package/dist/index.js +498 -984
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +11 -15
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/{langserve-9125a12e.d.ts → langserve-f021ab9c.d.ts} +14 -54
  25. package/dist/lib/index.d.ts +4 -4
  26. package/dist/lib/index.js +477 -886
  27. package/dist/lib/index.js.map +1 -1
  28. package/dist/lib/index.mjs +7 -7
  29. package/dist/lib/integrations/index.d.ts +4 -4
  30. package/dist/lib/integrations/index.js +48 -171
  31. package/dist/lib/integrations/index.js.map +1 -1
  32. package/dist/lib/integrations/index.mjs +6 -6
  33. package/dist/lib/integrations/nest/index.d.ts +3 -3
  34. package/dist/lib/integrations/nest/index.js +48 -171
  35. package/dist/lib/integrations/nest/index.js.map +1 -1
  36. package/dist/lib/integrations/nest/index.mjs +4 -4
  37. package/dist/lib/integrations/node-express/index.d.ts +3 -3
  38. package/dist/lib/integrations/node-express/index.js +48 -171
  39. package/dist/lib/integrations/node-express/index.js.map +1 -1
  40. package/dist/lib/integrations/node-express/index.mjs +4 -4
  41. package/dist/lib/integrations/node-http/index.d.ts +3 -3
  42. package/dist/lib/integrations/node-http/index.js +48 -171
  43. package/dist/lib/integrations/node-http/index.js.map +1 -1
  44. package/dist/lib/integrations/node-http/index.mjs +3 -3
  45. package/dist/service-adapters/index.d.ts +5 -36
  46. package/dist/service-adapters/index.js +61 -298
  47. package/dist/service-adapters/index.js.map +1 -1
  48. package/dist/service-adapters/index.mjs +1 -5
  49. package/package.json +2 -2
  50. package/dist/chunk-2V7BHSFE.mjs.map +0 -1
  51. package/dist/chunk-CLGKEUOA.mjs.map +0 -1
  52. package/dist/chunk-RFF5IIZJ.mjs.map +0 -1
  53. /package/dist/{chunk-2FY7EQEE.mjs.map → chunk-M4QD67S3.mjs.map} +0 -0
  54. /package/dist/{chunk-2ZPE55QG.mjs.map → chunk-U3AYI5XZ.mjs.map} +0 -0
  55. /package/dist/{chunk-W6E7AVR7.mjs.map → chunk-U75F2RAQ.mjs.map} +0 -0
@@ -3,13 +3,13 @@ import {
3
3
  config,
4
4
  copilotRuntimeNextJSAppRouterEndpoint,
5
5
  copilotRuntimeNextJSPagesRouterEndpoint
6
- } from "../chunk-2FY7EQEE.mjs";
6
+ } from "../chunk-M4QD67S3.mjs";
7
7
  import {
8
8
  copilotRuntimeNestEndpoint
9
- } from "../chunk-2ZPE55QG.mjs";
9
+ } from "../chunk-U3AYI5XZ.mjs";
10
10
  import {
11
11
  copilotRuntimeNodeExpressEndpoint
12
- } from "../chunk-W6E7AVR7.mjs";
12
+ } from "../chunk-U75F2RAQ.mjs";
13
13
  import {
14
14
  CopilotRuntime,
15
15
  buildSchema,
@@ -20,7 +20,8 @@ import {
20
20
  getCommonConfig,
21
21
  langGraphPlatformEndpoint,
22
22
  resolveEndpointType
23
- } from "../chunk-2V7BHSFE.mjs";
23
+ } from "../chunk-ZSWCEADS.mjs";
24
+ import "../chunk-U3V2BCGI.mjs";
24
25
  import {
25
26
  GoogleGenerativeAIAdapter,
26
27
  GroqAdapter,
@@ -28,9 +29,8 @@ import {
28
29
  OpenAIAdapter,
29
30
  OpenAIAssistantAdapter,
30
31
  UnifyAdapter
31
- } from "../chunk-CLGKEUOA.mjs";
32
- import "../chunk-U3V2BCGI.mjs";
33
- import "../chunk-RFF5IIZJ.mjs";
32
+ } from "../chunk-OKQVDDJ2.mjs";
33
+ import "../chunk-B74M7FXG.mjs";
34
34
  import "../chunk-D2WLFQS6.mjs";
35
35
  import "../chunk-44O2JGUY.mjs";
36
36
  export {
@@ -1,13 +1,13 @@
1
- import { d as CreateCopilotRuntimeServerOptions, G as GraphQLContext } from '../../copilot-runtime-36700e00.js';
2
- export { h as CommonConfig, b as CopilotRequestContextProperties, g as buildSchema, e as createContext, i as getCommonConfig } from '../../copilot-runtime-36700e00.js';
1
+ import { d as CreateCopilotRuntimeServerOptions, G as GraphQLContext } from '../../copilot-runtime-12e7ac40.js';
2
+ export { h as CommonConfig, b as CopilotRequestContextProperties, g as buildSchema, e as createContext, i as getCommonConfig } from '../../copilot-runtime-12e7ac40.js';
3
3
  import * as graphql_yoga from 'graphql-yoga';
4
4
  import { YogaServerInstance } from 'graphql-yoga';
5
5
  export { copilotRuntimeNodeHttpEndpoint } from './node-http/index.js';
6
6
  export { copilotRuntimeNodeExpressEndpoint } from './node-express/index.js';
7
7
  export { copilotRuntimeNestEndpoint } from './nest/index.js';
8
8
  import '@copilotkit/shared';
9
- import '../../langserve-9125a12e.js';
10
- import '../../index-cc2b17be.js';
9
+ import '../../langserve-f021ab9c.js';
10
+ import '../../index-10b1c870.js';
11
11
  import '../../graphql/types/base/index.js';
12
12
  import 'rxjs';
13
13
  import 'graphql';
@@ -44,7 +44,7 @@ var require_package = __commonJS({
44
44
  publishConfig: {
45
45
  access: "public"
46
46
  },
47
- version: "1.5.1-next.2",
47
+ version: "1.4.1-pre.6",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -137,10 +137,10 @@ __export(integrations_exports, {
137
137
  module.exports = __toCommonJS(integrations_exports);
138
138
 
139
139
  // src/lib/integrations/shared.ts
140
- var import_type_graphql17 = require("type-graphql");
140
+ var import_type_graphql16 = require("type-graphql");
141
141
 
142
142
  // src/graphql/resolvers/copilot.resolver.ts
143
- var import_type_graphql16 = require("type-graphql");
143
+ var import_type_graphql15 = require("type-graphql");
144
144
  var import_rxjs3 = require("rxjs");
145
145
 
146
146
  // src/graphql/inputs/generate-copilot-response.input.ts
@@ -158,6 +158,12 @@ var MessageRole;
158
158
  MessageRole2["system"] = "system";
159
159
  MessageRole2["tool"] = "tool";
160
160
  })(MessageRole || (MessageRole = {}));
161
+ var ActionExecutionScope;
162
+ (function(ActionExecutionScope2) {
163
+ ActionExecutionScope2["server"] = "server";
164
+ ActionExecutionScope2["client"] = "client";
165
+ ActionExecutionScope2["passThrough"] = "passThrough";
166
+ })(ActionExecutionScope || (ActionExecutionScope = {}));
161
167
  var CopilotRequestType;
162
168
  (function(CopilotRequestType2) {
163
169
  CopilotRequestType2["Chat"] = "Chat";
@@ -176,6 +182,10 @@ var ActionInputAvailability;
176
182
  name: "MessageRole",
177
183
  description: "The role of the message"
178
184
  });
185
+ (0, import_type_graphql.registerEnumType)(ActionExecutionScope, {
186
+ name: "ActionExecutionScope",
187
+ description: "The scope of the action"
188
+ });
179
189
  (0, import_type_graphql.registerEnumType)(CopilotRequestType, {
180
190
  name: "CopilotRequestType",
181
191
  description: "The type of Copilot request"
@@ -273,7 +283,6 @@ MessageInput = _ts_decorate2([
273
283
  ], MessageInput);
274
284
  var TextMessageInput = class {
275
285
  content;
276
- parentMessageId;
277
286
  role;
278
287
  };
279
288
  __name(TextMessageInput, "TextMessageInput");
@@ -281,12 +290,6 @@ _ts_decorate2([
281
290
  (0, import_type_graphql3.Field)(() => String),
282
291
  _ts_metadata2("design:type", String)
283
292
  ], TextMessageInput.prototype, "content", void 0);
284
- _ts_decorate2([
285
- (0, import_type_graphql3.Field)(() => String, {
286
- nullable: true
287
- }),
288
- _ts_metadata2("design:type", String)
289
- ], TextMessageInput.prototype, "parentMessageId", void 0);
290
293
  _ts_decorate2([
291
294
  (0, import_type_graphql3.Field)(() => MessageRole),
292
295
  _ts_metadata2("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
@@ -297,7 +300,6 @@ TextMessageInput = _ts_decorate2([
297
300
  var ActionExecutionMessageInput = class {
298
301
  name;
299
302
  arguments;
300
- parentMessageId;
301
303
  scope;
302
304
  };
303
305
  __name(ActionExecutionMessageInput, "ActionExecutionMessageInput");
@@ -310,17 +312,8 @@ _ts_decorate2([
310
312
  _ts_metadata2("design:type", String)
311
313
  ], ActionExecutionMessageInput.prototype, "arguments", void 0);
312
314
  _ts_decorate2([
313
- (0, import_type_graphql3.Field)(() => String, {
314
- nullable: true
315
- }),
316
- _ts_metadata2("design:type", String)
317
- ], ActionExecutionMessageInput.prototype, "parentMessageId", void 0);
318
- _ts_decorate2([
319
- (0, import_type_graphql3.Field)(() => String, {
320
- nullable: true,
321
- deprecationReason: "This field will be removed in a future version"
322
- }),
323
- _ts_metadata2("design:type", typeof String === "undefined" ? Object : String)
315
+ (0, import_type_graphql3.Field)(() => ActionExecutionScope),
316
+ _ts_metadata2("design:type", typeof ActionExecutionScope === "undefined" ? Object : ActionExecutionScope)
324
317
  ], ActionExecutionMessageInput.prototype, "scope", void 0);
325
318
  ActionExecutionMessageInput = _ts_decorate2([
326
319
  (0, import_type_graphql3.InputType)()
@@ -328,7 +321,6 @@ ActionExecutionMessageInput = _ts_decorate2([
328
321
  var ResultMessageInput = class {
329
322
  actionExecutionId;
330
323
  actionName;
331
- parentMessageId;
332
324
  result;
333
325
  };
334
326
  __name(ResultMessageInput, "ResultMessageInput");
@@ -340,12 +332,6 @@ _ts_decorate2([
340
332
  (0, import_type_graphql3.Field)(() => String),
341
333
  _ts_metadata2("design:type", String)
342
334
  ], ResultMessageInput.prototype, "actionName", void 0);
343
- _ts_decorate2([
344
- (0, import_type_graphql3.Field)(() => String, {
345
- nullable: true
346
- }),
347
- _ts_metadata2("design:type", String)
348
- ], ResultMessageInput.prototype, "parentMessageId", void 0);
349
335
  _ts_decorate2([
350
336
  (0, import_type_graphql3.Field)(() => String),
351
337
  _ts_metadata2("design:type", String)
@@ -609,7 +595,6 @@ var ForwardedParametersInput = class {
609
595
  stop;
610
596
  toolChoice;
611
597
  toolChoiceFunctionName;
612
- temperature;
613
598
  };
614
599
  __name(ForwardedParametersInput, "ForwardedParametersInput");
615
600
  _ts_decorate7([
@@ -644,12 +629,6 @@ _ts_decorate7([
644
629
  }),
645
630
  _ts_metadata7("design:type", String)
646
631
  ], ForwardedParametersInput.prototype, "toolChoiceFunctionName", void 0);
647
- _ts_decorate7([
648
- (0, import_type_graphql8.Field)(() => Number, {
649
- nullable: true
650
- }),
651
- _ts_metadata7("design:type", Number)
652
- ], ForwardedParametersInput.prototype, "temperature", void 0);
653
632
  ForwardedParametersInput = _ts_decorate7([
654
633
  (0, import_type_graphql8.InputType)()
655
634
  ], ForwardedParametersInput);
@@ -1075,7 +1054,6 @@ BaseMessageOutput = _ts_decorate13([
1075
1054
  var TextMessageOutput = class {
1076
1055
  role;
1077
1056
  content;
1078
- parentMessageId;
1079
1057
  };
1080
1058
  __name(TextMessageOutput, "TextMessageOutput");
1081
1059
  _ts_decorate13([
@@ -1088,12 +1066,6 @@ _ts_decorate13([
1088
1066
  ]),
1089
1067
  _ts_metadata13("design:type", Array)
1090
1068
  ], TextMessageOutput.prototype, "content", void 0);
1091
- _ts_decorate13([
1092
- (0, import_type_graphql14.Field)(() => String, {
1093
- nullable: true
1094
- }),
1095
- _ts_metadata13("design:type", String)
1096
- ], TextMessageOutput.prototype, "parentMessageId", void 0);
1097
1069
  TextMessageOutput = _ts_decorate13([
1098
1070
  (0, import_type_graphql14.ObjectType)({
1099
1071
  implements: BaseMessageOutput
@@ -1103,7 +1075,6 @@ var ActionExecutionMessageOutput = class {
1103
1075
  name;
1104
1076
  scope;
1105
1077
  arguments;
1106
- parentMessageId;
1107
1078
  };
1108
1079
  __name(ActionExecutionMessageOutput, "ActionExecutionMessageOutput");
1109
1080
  _ts_decorate13([
@@ -1111,11 +1082,8 @@ _ts_decorate13([
1111
1082
  _ts_metadata13("design:type", String)
1112
1083
  ], ActionExecutionMessageOutput.prototype, "name", void 0);
1113
1084
  _ts_decorate13([
1114
- (0, import_type_graphql14.Field)(() => String, {
1115
- nullable: true,
1116
- deprecationReason: "This field will be removed in a future version"
1117
- }),
1118
- _ts_metadata13("design:type", String)
1085
+ (0, import_type_graphql14.Field)(() => ActionExecutionScope),
1086
+ _ts_metadata13("design:type", typeof ActionExecutionScope === "undefined" ? Object : ActionExecutionScope)
1119
1087
  ], ActionExecutionMessageOutput.prototype, "scope", void 0);
1120
1088
  _ts_decorate13([
1121
1089
  (0, import_type_graphql14.Field)(() => [
@@ -1123,12 +1091,6 @@ _ts_decorate13([
1123
1091
  ]),
1124
1092
  _ts_metadata13("design:type", Array)
1125
1093
  ], ActionExecutionMessageOutput.prototype, "arguments", void 0);
1126
- _ts_decorate13([
1127
- (0, import_type_graphql14.Field)(() => String, {
1128
- nullable: true
1129
- }),
1130
- _ts_metadata13("design:type", String)
1131
- ], ActionExecutionMessageOutput.prototype, "parentMessageId", void 0);
1132
1094
  ActionExecutionMessageOutput = _ts_decorate13([
1133
1095
  (0, import_type_graphql14.ObjectType)({
1134
1096
  implements: BaseMessageOutput
@@ -1280,14 +1242,13 @@ var TextMessage = class extends Message {
1280
1242
  type = "TextMessage";
1281
1243
  content;
1282
1244
  role;
1283
- parentMessageId;
1284
1245
  };
1285
1246
  __name(TextMessage, "TextMessage");
1286
1247
  var ActionExecutionMessage = class extends Message {
1287
1248
  type = "ActionExecutionMessage";
1288
1249
  name;
1289
1250
  arguments;
1290
- parentMessageId;
1251
+ scope;
1291
1252
  };
1292
1253
  __name(ActionExecutionMessage, "ActionExecutionMessage");
1293
1254
  var ResultMessage = class extends Message {
@@ -1371,7 +1332,6 @@ __name(getRuntimeInstanceTelemetryInfo, "getRuntimeInstanceTelemetryInfo");
1371
1332
  var telemetry_client_default = telemetryClient;
1372
1333
 
1373
1334
  // src/service-adapters/events.ts
1374
- var import_class_transformer = require("class-transformer");
1375
1335
  var RuntimeEventTypes;
1376
1336
  (function(RuntimeEventTypes2) {
1377
1337
  RuntimeEventTypes2["TextMessageStart"] = "TextMessageStart";
@@ -1386,7 +1346,7 @@ var RuntimeEventTypes;
1386
1346
 
1387
1347
  // src/graphql/resolvers/copilot.resolver.ts
1388
1348
  var import_graphql_scalars2 = require("graphql-scalars");
1389
- var import_class_transformer2 = require("class-transformer");
1349
+ var import_class_transformer = require("class-transformer");
1390
1350
  var import_graphql = require("graphql");
1391
1351
 
1392
1352
  // src/utils/failed-response-status-reasons.ts
@@ -1424,9 +1384,6 @@ __name(UnknownErrorResponse, "UnknownErrorResponse");
1424
1384
 
1425
1385
  // src/graphql/resolvers/copilot.resolver.ts
1426
1386
  var import_shared4 = require("@copilotkit/shared");
1427
-
1428
- // src/graphql/types/agents-response.type.ts
1429
- var import_type_graphql15 = require("type-graphql");
1430
1387
  function _ts_decorate14(decorators, target, key, desc) {
1431
1388
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1432
1389
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -1443,58 +1400,6 @@ function _ts_metadata14(k, v) {
1443
1400
  return Reflect.metadata(k, v);
1444
1401
  }
1445
1402
  __name(_ts_metadata14, "_ts_metadata");
1446
- var Agent = class {
1447
- id;
1448
- name;
1449
- description;
1450
- };
1451
- __name(Agent, "Agent");
1452
- _ts_decorate14([
1453
- (0, import_type_graphql15.Field)(() => String),
1454
- _ts_metadata14("design:type", String)
1455
- ], Agent.prototype, "id", void 0);
1456
- _ts_decorate14([
1457
- (0, import_type_graphql15.Field)(() => String),
1458
- _ts_metadata14("design:type", String)
1459
- ], Agent.prototype, "name", void 0);
1460
- _ts_decorate14([
1461
- (0, import_type_graphql15.Field)(() => String),
1462
- _ts_metadata14("design:type", String)
1463
- ], Agent.prototype, "description", void 0);
1464
- Agent = _ts_decorate14([
1465
- (0, import_type_graphql15.ObjectType)()
1466
- ], Agent);
1467
- var AgentsResponse = class {
1468
- agents;
1469
- };
1470
- __name(AgentsResponse, "AgentsResponse");
1471
- _ts_decorate14([
1472
- (0, import_type_graphql15.Field)(() => [
1473
- Agent
1474
- ]),
1475
- _ts_metadata14("design:type", Array)
1476
- ], AgentsResponse.prototype, "agents", void 0);
1477
- AgentsResponse = _ts_decorate14([
1478
- (0, import_type_graphql15.ObjectType)()
1479
- ], AgentsResponse);
1480
-
1481
- // src/graphql/resolvers/copilot.resolver.ts
1482
- function _ts_decorate15(decorators, target, key, desc) {
1483
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1484
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1485
- r = Reflect.decorate(decorators, target, key, desc);
1486
- else
1487
- for (var i = decorators.length - 1; i >= 0; i--)
1488
- if (d = decorators[i])
1489
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1490
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1491
- }
1492
- __name(_ts_decorate15, "_ts_decorate");
1493
- function _ts_metadata15(k, v) {
1494
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1495
- return Reflect.metadata(k, v);
1496
- }
1497
- __name(_ts_metadata15, "_ts_metadata");
1498
1403
  function _ts_param(paramIndex, decorator) {
1499
1404
  return function(target, key) {
1500
1405
  decorator(target, key, paramIndex);
@@ -1536,17 +1441,6 @@ var CopilotResolver = class {
1536
1441
  async hello() {
1537
1442
  return "Hello World";
1538
1443
  }
1539
- async availableAgents(ctx) {
1540
- let logger2 = ctx.logger.child({
1541
- component: "CopilotResolver.availableAgents"
1542
- });
1543
- logger2.debug("Processing");
1544
- const agents = await ctx._copilotkit.runtime.discoverAgentsFromEndpoints(ctx);
1545
- logger2.debug("Event source created, creating response");
1546
- return {
1547
- agents
1548
- };
1549
- }
1550
1444
  async generateCopilotResponse(ctx, data, properties) {
1551
1445
  var _a, _b, _c;
1552
1446
  telemetry_client_default.capture("oss.runtime.copilot_request_created", {
@@ -1650,7 +1544,7 @@ var CopilotResolver = class {
1650
1544
  reason: `Interrupted due to Guardrails validation failure. Reason: ${result.reason}`
1651
1545
  });
1652
1546
  outputMessages = [
1653
- (0, import_class_transformer2.plainToInstance)(TextMessage, {
1547
+ (0, import_class_transformer.plainToInstance)(TextMessage, {
1654
1548
  id: (0, import_shared4.randomId)(),
1655
1549
  createdAt: /* @__PURE__ */ new Date(),
1656
1550
  content: result.reason,
@@ -1699,15 +1593,12 @@ var CopilotResolver = class {
1699
1593
  // skip until this message start event
1700
1594
  (0, import_rxjs3.skipWhile)((e) => e !== event),
1701
1595
  // take until the message end event
1702
- (0, import_rxjs3.takeWhile)((e) => !(e.type === RuntimeEventTypes.TextMessageEnd && e.messageId == event.messageId)),
1703
- // filter out any other message events or message ids
1704
- (0, import_rxjs3.filter)((e) => e.type == RuntimeEventTypes.TextMessageContent && e.messageId == event.messageId)
1596
+ (0, import_rxjs3.takeWhile)((e) => e.type != RuntimeEventTypes.TextMessageEnd)
1705
1597
  );
1706
1598
  const streamingTextStatus = new import_rxjs3.Subject();
1707
1599
  const messageId = event.messageId;
1708
1600
  pushMessage({
1709
1601
  id: messageId,
1710
- parentMessageId: event.parentMessageId,
1711
1602
  status: (0, import_rxjs3.firstValueFrom)(streamingTextStatus),
1712
1603
  createdAt: /* @__PURE__ */ new Date(),
1713
1604
  role: MessageRole.assistant,
@@ -1720,7 +1611,7 @@ var CopilotResolver = class {
1720
1611
  reason,
1721
1612
  messageId: messageId2
1722
1613
  }, "Text streaming interrupted");
1723
- streamingTextStatus.next((0, import_class_transformer2.plainToInstance)(FailedMessageStatus, {
1614
+ streamingTextStatus.next((0, import_class_transformer.plainToInstance)(FailedMessageStatus, {
1724
1615
  reason
1725
1616
  }));
1726
1617
  responseStatus$.next(new MessageStreamInterruptedResponse({
@@ -1753,7 +1644,7 @@ var CopilotResolver = class {
1753
1644
  streamingTextStatus.next(new SuccessMessageStatus());
1754
1645
  stopStreamingText();
1755
1646
  textSubscription == null ? void 0 : textSubscription.unsubscribe();
1756
- outputMessages.push((0, import_class_transformer2.plainToInstance)(TextMessage, {
1647
+ outputMessages.push((0, import_class_transformer.plainToInstance)(TextMessage, {
1757
1648
  id: messageId,
1758
1649
  createdAt: /* @__PURE__ */ new Date(),
1759
1650
  content: textChunks.join(""),
@@ -1766,20 +1657,14 @@ var CopilotResolver = class {
1766
1657
  break;
1767
1658
  case RuntimeEventTypes.ActionExecutionStart:
1768
1659
  logger2.debug("Action execution start event received");
1769
- const actionExecutionArgumentStream = eventStream.pipe(
1770
- (0, import_rxjs3.skipWhile)((e) => e !== event),
1771
- // take until the action execution end event
1772
- (0, import_rxjs3.takeWhile)((e) => !(e.type === RuntimeEventTypes.ActionExecutionEnd && e.actionExecutionId == event.actionExecutionId)),
1773
- // filter out any other action execution events or action execution ids
1774
- (0, import_rxjs3.filter)((e) => e.type == RuntimeEventTypes.ActionExecutionArgs && e.actionExecutionId == event.actionExecutionId)
1775
- );
1660
+ const actionExecutionArgumentStream = eventStream.pipe((0, import_rxjs3.skipWhile)((e) => e !== event), (0, import_rxjs3.takeWhile)((e) => e.type != RuntimeEventTypes.ActionExecutionEnd));
1776
1661
  const streamingArgumentsStatus = new import_rxjs3.Subject();
1777
1662
  pushMessage({
1778
1663
  id: event.actionExecutionId,
1779
- parentMessageId: event.parentMessageId,
1780
1664
  status: (0, import_rxjs3.firstValueFrom)(streamingArgumentsStatus),
1781
1665
  createdAt: /* @__PURE__ */ new Date(),
1782
1666
  name: event.actionName,
1667
+ scope: event.scope,
1783
1668
  arguments: new import_graphql_yoga.Repeater(async (pushArgumentsChunk, stopStreamingArguments) => {
1784
1669
  logger2.debug("Action execution argument stream created");
1785
1670
  const argumentChunks = [];
@@ -1795,7 +1680,7 @@ var CopilotResolver = class {
1795
1680
  logger2.error({
1796
1681
  err
1797
1682
  }, "Error in action execution argument stream");
1798
- streamingArgumentsStatus.next((0, import_class_transformer2.plainToInstance)(FailedMessageStatus, {
1683
+ streamingArgumentsStatus.next((0, import_class_transformer.plainToInstance)(FailedMessageStatus, {
1799
1684
  reason: "An unknown error has occurred in the action execution argument stream"
1800
1685
  }));
1801
1686
  stopStreamingArguments();
@@ -1806,10 +1691,11 @@ var CopilotResolver = class {
1806
1691
  streamingArgumentsStatus.next(new SuccessMessageStatus());
1807
1692
  stopStreamingArguments();
1808
1693
  actionExecutionArgumentSubscription == null ? void 0 : actionExecutionArgumentSubscription.unsubscribe();
1809
- outputMessages.push((0, import_class_transformer2.plainToInstance)(ActionExecutionMessage, {
1694
+ outputMessages.push((0, import_class_transformer.plainToInstance)(ActionExecutionMessage, {
1810
1695
  id: event.actionExecutionId,
1811
1696
  createdAt: /* @__PURE__ */ new Date(),
1812
1697
  name: event.actionName,
1698
+ scope: event.scope,
1813
1699
  arguments: argumentChunks.join("")
1814
1700
  }));
1815
1701
  }
@@ -1822,15 +1708,15 @@ var CopilotResolver = class {
1822
1708
  result: event.result
1823
1709
  }, "Action execution result event received");
1824
1710
  pushMessage({
1825
- id: "result-" + event.actionExecutionId,
1711
+ id: (0, import_shared4.randomId)(),
1826
1712
  status: new SuccessMessageStatus(),
1827
1713
  createdAt: /* @__PURE__ */ new Date(),
1828
1714
  actionExecutionId: event.actionExecutionId,
1829
1715
  actionName: event.actionName,
1830
1716
  result: event.result
1831
1717
  });
1832
- outputMessages.push((0, import_class_transformer2.plainToInstance)(ResultMessage, {
1833
- id: "result-" + event.actionExecutionId,
1718
+ outputMessages.push((0, import_class_transformer.plainToInstance)(ResultMessage, {
1719
+ id: (0, import_shared4.randomId)(),
1834
1720
  createdAt: /* @__PURE__ */ new Date(),
1835
1721
  actionExecutionId: event.actionExecutionId,
1836
1722
  actionName: event.actionName,
@@ -1854,7 +1740,7 @@ var CopilotResolver = class {
1854
1740
  role: MessageRole.assistant,
1855
1741
  createdAt: /* @__PURE__ */ new Date()
1856
1742
  });
1857
- outputMessages.push((0, import_class_transformer2.plainToInstance)(AgentStateMessage, {
1743
+ outputMessages.push((0, import_class_transformer.plainToInstance)(AgentStateMessage, {
1858
1744
  id: (0, import_shared4.randomId)(),
1859
1745
  threadId: event.threadId,
1860
1746
  agentName: event.agentName,
@@ -1899,38 +1785,29 @@ var CopilotResolver = class {
1899
1785
  }
1900
1786
  };
1901
1787
  __name(CopilotResolver, "CopilotResolver");
1902
- _ts_decorate15([
1903
- (0, import_type_graphql16.Query)(() => String),
1904
- _ts_metadata15("design:type", Function),
1905
- _ts_metadata15("design:paramtypes", []),
1906
- _ts_metadata15("design:returntype", Promise)
1788
+ _ts_decorate14([
1789
+ (0, import_type_graphql15.Query)(() => String),
1790
+ _ts_metadata14("design:type", Function),
1791
+ _ts_metadata14("design:paramtypes", []),
1792
+ _ts_metadata14("design:returntype", Promise)
1907
1793
  ], CopilotResolver.prototype, "hello", null);
1908
- _ts_decorate15([
1909
- (0, import_type_graphql16.Query)(() => AgentsResponse),
1910
- _ts_param(0, (0, import_type_graphql16.Ctx)()),
1911
- _ts_metadata15("design:type", Function),
1912
- _ts_metadata15("design:paramtypes", [
1913
- typeof GraphQLContext === "undefined" ? Object : GraphQLContext
1914
- ]),
1915
- _ts_metadata15("design:returntype", Promise)
1916
- ], CopilotResolver.prototype, "availableAgents", null);
1917
- _ts_decorate15([
1918
- (0, import_type_graphql16.Mutation)(() => CopilotResponse),
1919
- _ts_param(0, (0, import_type_graphql16.Ctx)()),
1920
- _ts_param(1, (0, import_type_graphql16.Arg)("data")),
1921
- _ts_param(2, (0, import_type_graphql16.Arg)("properties", () => import_graphql_scalars2.GraphQLJSONObject, {
1794
+ _ts_decorate14([
1795
+ (0, import_type_graphql15.Mutation)(() => CopilotResponse),
1796
+ _ts_param(0, (0, import_type_graphql15.Ctx)()),
1797
+ _ts_param(1, (0, import_type_graphql15.Arg)("data")),
1798
+ _ts_param(2, (0, import_type_graphql15.Arg)("properties", () => import_graphql_scalars2.GraphQLJSONObject, {
1922
1799
  nullable: true
1923
1800
  })),
1924
- _ts_metadata15("design:type", Function),
1925
- _ts_metadata15("design:paramtypes", [
1801
+ _ts_metadata14("design:type", Function),
1802
+ _ts_metadata14("design:paramtypes", [
1926
1803
  typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
1927
1804
  typeof GenerateCopilotResponseInput === "undefined" ? Object : GenerateCopilotResponseInput,
1928
1805
  typeof CopilotRequestContextProperties === "undefined" ? Object : CopilotRequestContextProperties
1929
1806
  ]),
1930
- _ts_metadata15("design:returntype", Promise)
1807
+ _ts_metadata14("design:returntype", Promise)
1931
1808
  ], CopilotResolver.prototype, "generateCopilotResponse", null);
1932
- CopilotResolver = _ts_decorate15([
1933
- (0, import_type_graphql16.Resolver)(() => CopilotResponse)
1809
+ CopilotResolver = _ts_decorate14([
1810
+ (0, import_type_graphql15.Resolver)(() => CopilotResponse)
1934
1811
  ], CopilotResolver);
1935
1812
 
1936
1813
  // src/lib/integrations/shared.ts
@@ -1985,7 +1862,7 @@ async function createContext(initialContext, copilotKitContext, contextLogger, p
1985
1862
  __name(createContext, "createContext");
1986
1863
  function buildSchema(options = {}) {
1987
1864
  logger.debug("Building GraphQL schema...");
1988
- const schema = (0, import_type_graphql17.buildSchemaSync)({
1865
+ const schema = (0, import_type_graphql16.buildSchemaSync)({
1989
1866
  resolvers: [
1990
1867
  CopilotResolver
1991
1868
  ],