@copilotkit/runtime 1.3.12-feat-langgraph-cloud-release-alpha.0 → 1.3.12-fix-tool-call-dynamic-parameters.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +4 -3
  2. package/dist/{chunk-7MQDBRXJ.mjs → chunk-24WEOOFX.mjs} +2 -2
  3. package/dist/{chunk-RKGJG3QX.mjs → chunk-AOYYOKTP.mjs} +133 -556
  4. package/dist/chunk-AOYYOKTP.mjs.map +1 -0
  5. package/dist/{chunk-6A7HQSQE.mjs → chunk-HKLL7TTP.mjs} +2 -2
  6. package/dist/{chunk-Z5LICW7Z.mjs → chunk-OSJXQNII.mjs} +9 -36
  7. package/dist/chunk-OSJXQNII.mjs.map +1 -0
  8. package/dist/{chunk-BPLF4QB2.mjs → chunk-SIMJ6TZU.mjs} +2 -2
  9. package/dist/{chunk-IPCABAGS.mjs → chunk-UYORVPCQ.mjs} +2 -2
  10. package/dist/{chunk-V7SK6QZN.mjs → chunk-ZEHCLFJ2.mjs} +9 -6
  11. package/dist/chunk-ZEHCLFJ2.mjs.map +1 -0
  12. package/dist/{copilot-runtime-aba7d4b4.d.ts → copilot-runtime-df3527ad.d.ts} +5 -27
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +186 -633
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +9 -13
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/lib/index.d.ts +1 -1
  19. package/dist/lib/index.js +186 -633
  20. package/dist/lib/index.js.map +1 -1
  21. package/dist/lib/index.mjs +9 -13
  22. package/dist/lib/integrations/index.d.ts +2 -2
  23. package/dist/lib/integrations/index.js +4 -5
  24. package/dist/lib/integrations/index.js.map +1 -1
  25. package/dist/lib/integrations/index.mjs +5 -5
  26. package/dist/lib/integrations/nest/index.d.ts +1 -1
  27. package/dist/lib/integrations/nest/index.js +4 -5
  28. package/dist/lib/integrations/nest/index.js.map +1 -1
  29. package/dist/lib/integrations/nest/index.mjs +3 -3
  30. package/dist/lib/integrations/node-express/index.d.ts +1 -1
  31. package/dist/lib/integrations/node-express/index.js +4 -5
  32. package/dist/lib/integrations/node-express/index.js.map +1 -1
  33. package/dist/lib/integrations/node-express/index.mjs +3 -3
  34. package/dist/lib/integrations/node-http/index.d.ts +1 -1
  35. package/dist/lib/integrations/node-http/index.js +4 -5
  36. package/dist/lib/integrations/node-http/index.js.map +1 -1
  37. package/dist/lib/integrations/node-http/index.mjs +2 -2
  38. package/dist/service-adapters/index.js +8 -5
  39. package/dist/service-adapters/index.js.map +1 -1
  40. package/dist/service-adapters/index.mjs +2 -2
  41. package/package.json +6 -7
  42. package/src/agents/langgraph/event-source.ts +67 -22
  43. package/src/lib/runtime/copilot-runtime.ts +11 -58
  44. package/src/lib/runtime/remote-actions.ts +159 -65
  45. package/src/service-adapters/events.ts +5 -1
  46. package/src/service-adapters/langchain/utils.test.ts +169 -0
  47. package/src/service-adapters/langchain/utils.ts +10 -5
  48. package/dist/chunk-RKGJG3QX.mjs.map +0 -1
  49. package/dist/chunk-V7SK6QZN.mjs.map +0 -1
  50. package/dist/chunk-Z5LICW7Z.mjs.map +0 -1
  51. package/src/lib/runtime/remote-action-constructors.ts +0 -281
  52. package/src/lib/runtime/remote-lg-cloud-action.ts +0 -438
  53. /package/dist/{chunk-7MQDBRXJ.mjs.map → chunk-24WEOOFX.mjs.map} +0 -0
  54. /package/dist/{chunk-6A7HQSQE.mjs.map → chunk-HKLL7TTP.mjs.map} +0 -0
  55. /package/dist/{chunk-BPLF4QB2.mjs.map → chunk-SIMJ6TZU.mjs.map} +0 -0
  56. /package/dist/{chunk-IPCABAGS.mjs.map → chunk-UYORVPCQ.mjs.map} +0 -0
package/dist/lib/index.js CHANGED
@@ -44,7 +44,7 @@ var require_package = __commonJS({
44
44
  publishConfig: {
45
45
  access: "public"
46
46
  },
47
- version: "1.3.12-feat-langgraph-cloud-release-alpha.0",
47
+ version: "1.3.12-fix-tool-call-dynamic-parameters.0",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -77,16 +77,16 @@ var require_package = __commonJS({
77
77
  "ts-node": "^10.9.2",
78
78
  tsconfig: "workspace:*",
79
79
  tsup: "^6.7.0",
80
- typescript: "^5.2.3"
80
+ typescript: "^5.2.3",
81
+ "zod-to-json-schema": "^3.23.5"
81
82
  },
82
83
  dependencies: {
83
84
  "@anthropic-ai/sdk": "^0.27.3",
84
85
  "@copilotkit/shared": "workspace:*",
85
- "@langchain/google-gauth": "^0.1.0",
86
86
  "@graphql-yoga/plugin-defer-stream": "^3.3.1",
87
87
  "@langchain/community": "^0.0.53",
88
88
  "@langchain/core": "^0.3.13",
89
- "@langchain/langgraph-sdk": "^0.0.16",
89
+ "@langchain/google-gauth": "^0.1.0",
90
90
  "@langchain/openai": "^0.0.28",
91
91
  "class-transformer": "^0.5.1",
92
92
  express: "^4.19.2",
@@ -96,7 +96,6 @@ var require_package = __commonJS({
96
96
  "groq-sdk": "^0.5.0",
97
97
  langchain: "^0.3.3",
98
98
  openai: "^4.50.0",
99
- "partial-json": "^0.1.7",
100
99
  pino: "^9.2.0",
101
100
  "pino-pretty": "^11.2.1",
102
101
  "reflect-metadata": "^0.2.2",
@@ -132,7 +131,6 @@ __export(lib_exports, {
132
131
  UnifyAdapter: () => UnifyAdapter,
133
132
  buildSchema: () => buildSchema,
134
133
  config: () => config,
135
- copilotKitEndpoint: () => copilotKitEndpoint,
136
134
  copilotRuntimeNestEndpoint: () => copilotRuntimeNestEndpoint,
137
135
  copilotRuntimeNextJSAppRouterEndpoint: () => copilotRuntimeNextJSAppRouterEndpoint,
138
136
  copilotRuntimeNextJSPagesRouterEndpoint: () => copilotRuntimeNextJSPagesRouterEndpoint,
@@ -140,8 +138,7 @@ __export(lib_exports, {
140
138
  copilotRuntimeNodeHttpEndpoint: () => copilotRuntimeNodeHttpEndpoint,
141
139
  createContext: () => createContext,
142
140
  flattenToolCallsNoDuplicates: () => flattenToolCallsNoDuplicates,
143
- getCommonConfig: () => getCommonConfig,
144
- langGraphCloudEndpoint: () => langGraphCloudEndpoint
141
+ getCommonConfig: () => getCommonConfig
145
142
  });
146
143
  module.exports = __toCommonJS(lib_exports);
147
144
 
@@ -497,24 +494,27 @@ __name(convertMessageToLangChainMessage, "convertMessageToLangChainMessage");
497
494
  function convertJsonSchemaToZodSchema(jsonSchema, required) {
498
495
  if (jsonSchema.type === "object") {
499
496
  const spec = {};
497
+ if (!jsonSchema.properties || !Object.keys(jsonSchema.properties).length) {
498
+ return !required ? import_zod.z.object(spec).optional() : import_zod.z.object(spec);
499
+ }
500
500
  for (const [key, value] of Object.entries(jsonSchema.properties)) {
501
501
  spec[key] = convertJsonSchemaToZodSchema(value, jsonSchema.required ? jsonSchema.required.includes(key) : false);
502
502
  }
503
503
  let schema = import_zod.z.object(spec);
504
- return !required ? schema.optional() : schema;
504
+ return required ? schema : schema.optional();
505
505
  } else if (jsonSchema.type === "string") {
506
506
  let schema = import_zod.z.string().describe(jsonSchema.description);
507
- return !required ? schema.optional() : schema;
507
+ return required ? schema : schema.optional();
508
508
  } else if (jsonSchema.type === "number") {
509
509
  let schema = import_zod.z.number().describe(jsonSchema.description);
510
- return !required ? schema.optional() : schema;
510
+ return required ? schema : schema.optional();
511
511
  } else if (jsonSchema.type === "boolean") {
512
512
  let schema = import_zod.z.boolean().describe(jsonSchema.description);
513
- return !required ? schema.optional() : schema;
513
+ return required ? schema : schema.optional();
514
514
  } else if (jsonSchema.type === "array") {
515
515
  let itemSchema = convertJsonSchemaToZodSchema(jsonSchema.items, true);
516
516
  let schema = import_zod.z.array(itemSchema);
517
- return !required ? schema.optional() : schema;
517
+ return required ? schema : schema.optional();
518
518
  }
519
519
  }
520
520
  __name(convertJsonSchemaToZodSchema, "convertJsonSchemaToZodSchema");
@@ -1068,6 +1068,50 @@ var LangGraphEventTypes;
1068
1068
  var import_shared7 = require("@copilotkit/shared");
1069
1069
  var RemoteLangGraphEventSource = class {
1070
1070
  eventStream$ = new import_rxjs.ReplaySubject();
1071
+ async streamResponse(response) {
1072
+ const reader = response.body.getReader();
1073
+ const decoder = new TextDecoder();
1074
+ let buffer = [];
1075
+ const eventStream$ = this.eventStream$;
1076
+ function flushBuffer() {
1077
+ const currentBuffer = buffer.join("");
1078
+ if (currentBuffer.trim().length === 0) {
1079
+ return;
1080
+ }
1081
+ const parts = currentBuffer.split("\n");
1082
+ if (parts.length === 0) {
1083
+ return;
1084
+ }
1085
+ const lastPartIsComplete = currentBuffer.endsWith("\n");
1086
+ buffer = [];
1087
+ if (!lastPartIsComplete) {
1088
+ buffer.push(parts.pop());
1089
+ }
1090
+ parts.map((part) => part.trim()).filter((part) => part != "").forEach((part) => {
1091
+ eventStream$.next(JSON.parse(part));
1092
+ });
1093
+ }
1094
+ __name(flushBuffer, "flushBuffer");
1095
+ try {
1096
+ while (true) {
1097
+ const { done, value } = await reader.read();
1098
+ if (!done) {
1099
+ buffer.push(decoder.decode(value, {
1100
+ stream: true
1101
+ }));
1102
+ }
1103
+ flushBuffer();
1104
+ if (done) {
1105
+ break;
1106
+ }
1107
+ }
1108
+ } catch (error) {
1109
+ console.error("Error in stream", error);
1110
+ eventStream$.error(error);
1111
+ return;
1112
+ }
1113
+ eventStream$.complete();
1114
+ }
1071
1115
  shouldEmitToolCall(shouldEmitToolCalls, toolCallName) {
1072
1116
  if (typeof shouldEmitToolCalls === "boolean") {
1073
1117
  return shouldEmitToolCalls;
@@ -1090,25 +1134,20 @@ var RemoteLangGraphEventSource = class {
1090
1134
  } else {
1091
1135
  acc.content = null;
1092
1136
  }
1093
- const toolCallChunks = (
1094
- // @ts-expect-error -- LangGraph Cloud implementation stores data outside of kwargs
1095
- ((_h = (_g = (_f = event.data) == null ? void 0 : _f.chunk) == null ? void 0 : _g.kwargs) == null ? void 0 : _h.tool_call_chunks) ?? ((_j = (_i = event.data) == null ? void 0 : _i.chunk) == null ? void 0 : _j.tool_call_chunks)
1096
- );
1097
- const toolCallMessageId = ((_m = (_l = (_k = event.data) == null ? void 0 : _k.chunk) == null ? void 0 : _l.kwargs) == null ? void 0 : _m.id) ?? ((_o = (_n = event.data) == null ? void 0 : _n.chunk) == null ? void 0 : _o.id);
1098
- if (toolCallChunks && toolCallChunks.length > 0) {
1137
+ if ((_h = (_g = (_f = event.data) == null ? void 0 : _f.chunk) == null ? void 0 : _g.kwargs) == null ? void 0 : _h.tool_call_chunks) {
1099
1138
  acc.prevToolCallMessageId = acc.toolCallMessageId;
1100
- acc.toolCallMessageId = toolCallMessageId;
1101
- if ((_p = toolCallChunks[0]) == null ? void 0 : _p.name) {
1102
- acc.toolCallName = toolCallChunks[0].name;
1139
+ acc.toolCallMessageId = (_i = event.data.chunk.kwargs) == null ? void 0 : _i.id;
1140
+ if ((_j = event.data.chunk.kwargs.tool_call_chunks[0]) == null ? void 0 : _j.name) {
1141
+ acc.toolCallName = event.data.chunk.kwargs.tool_call_chunks[0].name;
1103
1142
  }
1104
- if ((_q = toolCallChunks[0]) == null ? void 0 : _q.id) {
1105
- acc.toolCallId = toolCallChunks[0].id;
1143
+ if ((_k = event.data.chunk.kwargs.tool_call_chunks[0]) == null ? void 0 : _k.id) {
1144
+ acc.toolCallId = event.data.chunk.kwargs.tool_call_chunks[0].id;
1106
1145
  }
1107
1146
  acc.prevMessageId = acc.messageId;
1108
- acc.messageId = toolCallMessageId;
1147
+ acc.messageId = (_n = (_m = (_l = event.data) == null ? void 0 : _l.chunk) == null ? void 0 : _m.kwargs) == null ? void 0 : _n.id;
1109
1148
  } else if (acc.content && acc.content != "") {
1110
1149
  acc.prevMessageId = acc.messageId;
1111
- acc.messageId = toolCallMessageId;
1150
+ acc.messageId = (_q = (_p = (_o = event.data) == null ? void 0 : _o.chunk) == null ? void 0 : _p.kwargs) == null ? void 0 : _q.id;
1112
1151
  } else {
1113
1152
  acc.prevToolCallMessageId = acc.toolCallMessageId;
1114
1153
  acc.prevMessageId = acc.messageId;
@@ -1133,7 +1172,7 @@ var RemoteLangGraphEventSource = class {
1133
1172
  prevMessageId: null,
1134
1173
  content: null
1135
1174
  }), (0, import_rxjs.mergeMap)((eventWithState) => {
1136
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1175
+ var _a, _b, _c, _d, _e;
1137
1176
  const events = [];
1138
1177
  let shouldEmitMessages = true;
1139
1178
  let shouldEmitToolCalls = false;
@@ -1216,8 +1255,7 @@ var RemoteLangGraphEventSource = class {
1216
1255
  });
1217
1256
  }
1218
1257
  }
1219
- const args = ((_e = (_d = (_c = (_b = (_a = eventWithState.event.data) == null ? void 0 : _a.chunk) == null ? void 0 : _b.kwargs) == null ? void 0 : _c.tool_call_chunks) == null ? void 0 : _d[0]) == null ? void 0 : _e.args) ?? // @ts-expect-error -- sdf
1220
- ((_i = (_h = (_g = (_f = eventWithState.event.data) == null ? void 0 : _f.chunk) == null ? void 0 : _g.tool_call_chunks) == null ? void 0 : _h[0]) == null ? void 0 : _i.args);
1258
+ const args = (_e = (_d = (_c = (_b = (_a = eventWithState.event.data) == null ? void 0 : _a.chunk) == null ? void 0 : _b.kwargs) == null ? void 0 : _c.tool_call_chunks) == null ? void 0 : _d[0]) == null ? void 0 : _e.args;
1221
1259
  const content = eventWithState.content;
1222
1260
  if (args) {
1223
1261
  if (this.shouldEmitToolCall(shouldEmitToolCalls, eventWithState.toolCallName)) {
@@ -1268,441 +1306,70 @@ var RemoteLangGraphEventSource = class {
1268
1306
  };
1269
1307
  __name(RemoteLangGraphEventSource, "RemoteLangGraphEventSource");
1270
1308
 
1271
- // src/lib/runtime/remote-lg-cloud-action.ts
1272
- var import_langgraph_sdk = require("@langchain/langgraph-sdk");
1273
- var import_node_crypto = require("crypto");
1274
- var import_partial_json = require("partial-json");
1275
-
1276
- // src/graphql/types/enums.ts
1277
- var import_type_graphql = require("type-graphql");
1278
- var MessageRole;
1279
- (function(MessageRole2) {
1280
- MessageRole2["user"] = "user";
1281
- MessageRole2["assistant"] = "assistant";
1282
- MessageRole2["system"] = "system";
1283
- })(MessageRole || (MessageRole = {}));
1284
- var ActionExecutionScope;
1285
- (function(ActionExecutionScope2) {
1286
- ActionExecutionScope2["server"] = "server";
1287
- ActionExecutionScope2["client"] = "client";
1288
- ActionExecutionScope2["passThrough"] = "passThrough";
1289
- })(ActionExecutionScope || (ActionExecutionScope = {}));
1290
- var CopilotRequestType;
1291
- (function(CopilotRequestType2) {
1292
- CopilotRequestType2["Chat"] = "Chat";
1293
- CopilotRequestType2["Task"] = "Task";
1294
- CopilotRequestType2["TextareaCompletion"] = "TextareaCompletion";
1295
- CopilotRequestType2["TextareaPopover"] = "TextareaPopover";
1296
- CopilotRequestType2["Suggestion"] = "Suggestion";
1297
- })(CopilotRequestType || (CopilotRequestType = {}));
1298
- (0, import_type_graphql.registerEnumType)(MessageRole, {
1299
- name: "MessageRole",
1300
- description: "The role of the message"
1301
- });
1302
- (0, import_type_graphql.registerEnumType)(ActionExecutionScope, {
1303
- name: "ActionExecutionScope",
1304
- description: "The scope of the action"
1305
- });
1306
- (0, import_type_graphql.registerEnumType)(CopilotRequestType, {
1307
- name: "CopilotRequestType",
1308
- description: "The type of Copilot request"
1309
- });
1310
-
1311
- // src/lib/runtime/remote-lg-cloud-action.ts
1312
- async function execute(args) {
1313
- return new ReadableStream({
1314
- async start(controller) {
1315
- try {
1316
- await streamEvents(controller, args);
1317
- controller.close();
1318
- } catch (err) {
1319
- }
1320
- }
1321
- });
1322
- }
1323
- __name(execute, "execute");
1324
- async function streamEvents(controller, args) {
1325
- const { threadId: agrsInitialThreadId, agent, nodeName: initialNodeName, state: initialState, messages, actions } = args;
1326
- let nodeName = initialNodeName;
1327
- let state = initialState;
1328
- const { name, assistantId: initialAssistantId } = agent;
1329
- const client = new import_langgraph_sdk.Client();
1330
- let initialThreadId = agrsInitialThreadId;
1331
- const wasInitiatedWithExistingThread = !!initialThreadId;
1332
- if (initialThreadId && initialThreadId.startsWith("ck-")) {
1333
- initialThreadId = initialThreadId.substring(3);
1334
- }
1335
- const assistants = await client.assistants.search();
1336
- const retrievedAssistant = assistants.find((a) => a.name === name);
1337
- const threadId = initialThreadId ?? (0, import_node_crypto.randomUUID)();
1338
- if (initialThreadId === threadId) {
1339
- await client.threads.get(threadId);
1340
- } else {
1341
- await client.threads.create({
1342
- threadId
1343
- });
1344
- }
1345
- let agentState = {
1346
- values: {}
1347
- };
1348
- if (wasInitiatedWithExistingThread) {
1349
- agentState = await client.threads.getState(threadId);
1350
- }
1351
- const agentStateValues = agentState.values;
1352
- state.messages = agentStateValues.messages;
1353
- const mode = wasInitiatedWithExistingThread && nodeName != "__end__" ? "continue" : "start";
1354
- state = langGraphDefaultMergeState(state, formatMessages(messages), actions);
1355
- if (mode === "continue") {
1356
- await client.threads.updateState(threadId, {
1357
- values: state,
1358
- asNode: nodeName
1359
- });
1360
- }
1361
- const assistantId = initialAssistantId ?? retrievedAssistant.assistant_id;
1362
- const graphInfo = await client.assistants.getGraph(assistantId);
1363
- const streamInput = mode === "start" ? state : null;
1364
- let streamingStateExtractor = new StreamingStateExtractor([]);
1365
- let prevNodeName = null;
1366
- let emitIntermediateStateUntilEnd = null;
1367
- let shouldExit = null;
1368
- let externalRunId = null;
1369
- const streamResponse2 = client.runs.stream(threadId, assistantId, {
1370
- input: streamInput,
1371
- streamMode: [
1372
- "events",
1373
- "values"
1374
- ]
1375
- });
1376
- const emit = /* @__PURE__ */ __name((message) => controller.enqueue(new TextEncoder().encode(message)), "emit");
1377
- let latestStateValues = {};
1378
- for await (const chunk of streamResponse2) {
1379
- if (![
1380
- "events",
1381
- "values"
1382
- ].includes(chunk.event))
1383
- continue;
1384
- if (chunk.event === "values") {
1385
- latestStateValues = chunk.data;
1386
- continue;
1387
- }
1388
- const event = chunk.data;
1389
- const currentNodeName = event.name;
1390
- const eventType = event.event;
1391
- const runId = event.metadata.run_id;
1392
- externalRunId = runId;
1393
- const metadata = event.metadata;
1394
- shouldExit = shouldExit != null ? shouldExit : metadata["copilotkit:exit"];
1395
- const emitIntermediateState = metadata["copilotkit:emit-intermediate-state"];
1396
- const forceEmitIntermediateState = metadata["copilotkit:force-emit-intermediate-state"];
1397
- const manuallyEmitMessage = metadata["copilotkit:manually-emit-messages"];
1398
- const manuallyEmitToolCall = metadata["copilotkit:manually-emit-tool-calls"];
1399
- if (graphInfo["nodes"].some((node) => node.id === currentNodeName)) {
1400
- nodeName = currentNodeName;
1401
- }
1402
- if (!nodeName) {
1403
- continue;
1404
- }
1405
- if (forceEmitIntermediateState) {
1406
- if (eventType === "on_chain_end") {
1407
- state = event.data.output;
1408
- emit(getStateSyncEvent({
1409
- threadId,
1410
- runId,
1411
- agentName: agent.name,
1412
- nodeName,
1413
- state: event.data.output,
1414
- running: true,
1415
- active: true
1416
- }));
1417
- }
1418
- continue;
1419
- }
1420
- if (manuallyEmitMessage) {
1421
- if (eventType === "on_chain_end") {
1422
- state = event.data.output;
1423
- emit(JSON.stringify({
1424
- event: "on_copilotkit_emit_message",
1425
- message: event.data.output,
1426
- messageId: (0, import_node_crypto.randomUUID)(),
1427
- role: MessageRole.assistant
1428
- }) + "\n");
1429
- }
1430
- continue;
1431
- }
1432
- if (manuallyEmitToolCall) {
1433
- if (eventType === "on_chain_end") {
1434
- state = event.data.output;
1435
- emit(JSON.stringify({
1436
- event: "on_copilotkit_emit_tool_call",
1437
- name: event.data.output.name,
1438
- args: event.data.output.args,
1439
- id: event.data.output.id
1440
- }) + "\n");
1441
- }
1442
- continue;
1443
- }
1444
- if (emitIntermediateState && emitIntermediateStateUntilEnd == null) {
1445
- emitIntermediateStateUntilEnd = nodeName;
1446
- }
1447
- if (emitIntermediateState && eventType === "on_chat_model_start") {
1448
- streamingStateExtractor = new StreamingStateExtractor(emitIntermediateState);
1449
- }
1450
- let updatedState = latestStateValues;
1451
- if (emitIntermediateState && eventType === "on_chat_model_stream") {
1452
- streamingStateExtractor.bufferToolCalls(event);
1453
- }
1454
- if (emitIntermediateStateUntilEnd !== null) {
1455
- updatedState = {
1456
- ...updatedState,
1457
- ...streamingStateExtractor.extractState()
1458
- };
1459
- }
1460
- if (!emitIntermediateState && currentNodeName === emitIntermediateStateUntilEnd && eventType === "on_chain_end") {
1461
- emitIntermediateStateUntilEnd = null;
1462
- }
1463
- const exitingNode = nodeName === currentNodeName && eventType === "on_chain_end";
1464
- if (JSON.stringify(updatedState) !== JSON.stringify(state) || prevNodeName != nodeName || exitingNode) {
1465
- state = updatedState;
1466
- prevNodeName = nodeName;
1467
- emit(getStateSyncEvent({
1468
- threadId,
1469
- runId,
1470
- agentName: agent.name,
1471
- nodeName,
1472
- state,
1473
- running: true,
1474
- active: !exitingNode
1475
- }));
1476
- }
1477
- emit(JSON.stringify(event) + "\n");
1478
- }
1479
- state = await client.threads.getState(threadId);
1480
- const isEndNode = state.next.length === 0;
1481
- nodeName = Object.keys(state.metadata.writes)[0];
1482
- emit(getStateSyncEvent({
1483
- threadId,
1484
- runId: externalRunId,
1485
- agentName: agent.name,
1486
- nodeName: isEndNode ? "__end__" : nodeName,
1487
- state: state.values,
1488
- running: !shouldExit,
1489
- active: false
1490
- }));
1491
- return Promise.resolve();
1492
- }
1493
- __name(streamEvents, "streamEvents");
1494
- function getStateSyncEvent({ threadId, runId, agentName, nodeName, state, running, active }) {
1495
- const stateWithoutMessages = Object.keys(state).reduce((acc, key) => {
1496
- if (key !== "messages") {
1497
- acc[key] = state[key];
1498
- }
1499
- return acc;
1500
- }, {});
1501
- return JSON.stringify({
1502
- event: "on_copilotkit_state_sync",
1503
- thread_id: threadId,
1504
- run_id: runId,
1505
- agent_name: agentName,
1506
- node_name: nodeName,
1507
- active,
1508
- state: stateWithoutMessages,
1509
- running,
1510
- role: "assistant"
1511
- }) + "\n";
1512
- }
1513
- __name(getStateSyncEvent, "getStateSyncEvent");
1514
- var StreamingStateExtractor = /* @__PURE__ */ __name(class StreamingStateExtractor2 {
1515
- emitIntermediateState;
1516
- toolCallBuffer;
1517
- currentToolCall;
1518
- previouslyParsableState;
1519
- constructor(emitIntermediateState) {
1520
- this.emitIntermediateState = emitIntermediateState;
1521
- this.toolCallBuffer = {};
1522
- this.currentToolCall = null;
1523
- this.previouslyParsableState = {};
1524
- }
1525
- bufferToolCalls(event) {
1526
- if (event.data.chunk.tool_call_chunks.length > 0) {
1527
- const chunk = event.data.chunk.tool_call_chunks[0];
1528
- if (chunk.name !== null) {
1529
- this.currentToolCall = chunk.name;
1530
- this.toolCallBuffer[this.currentToolCall] = chunk.args;
1531
- } else if (this.currentToolCall !== null) {
1532
- this.toolCallBuffer[this.currentToolCall] += chunk.args;
1533
- }
1534
- }
1535
- }
1536
- getEmitStateConfig(currentToolName) {
1537
- for (const config2 of this.emitIntermediateState) {
1538
- const stateKey = config2["state_key"];
1539
- const tool = config2["tool"];
1540
- const toolArgument = config2["tool_argument"];
1541
- if (currentToolName === tool) {
1542
- return [
1543
- toolArgument,
1544
- stateKey
1545
- ];
1546
- }
1547
- }
1548
- return [
1549
- null,
1550
- null
1551
- ];
1552
- }
1553
- extractState() {
1554
- const state = {};
1555
- for (const [key, value] of Object.entries(this.toolCallBuffer)) {
1556
- const [argumentName, stateKey] = this.getEmitStateConfig(key);
1557
- if (stateKey === null) {
1558
- continue;
1559
- }
1560
- let parsedValue;
1561
- try {
1562
- parsedValue = (0, import_partial_json.parse)(value);
1563
- } catch (error) {
1564
- if (key in this.previouslyParsableState) {
1565
- parsedValue = this.previouslyParsableState[key];
1566
- } else {
1567
- continue;
1568
- }
1569
- }
1570
- this.previouslyParsableState[key] = parsedValue;
1571
- if (!argumentName) {
1572
- state[stateKey] = parsedValue;
1573
- } else {
1574
- state[stateKey] = parsedValue[argumentName];
1575
- }
1576
- }
1577
- return state;
1578
- }
1579
- }, "StreamingStateExtractor");
1580
- function langGraphDefaultMergeState(state, messages, actions) {
1581
- if (messages.length > 0 && "role" in messages[0] && messages[0].role === "system") {
1582
- messages = messages.slice(1);
1583
- }
1584
- const mergedMessages = state.messages || [];
1585
- const existingMessageIds = new Set(mergedMessages.map((message) => message.id));
1586
- for (const message of messages) {
1587
- if (!existingMessageIds.has(message.id)) {
1588
- mergedMessages.push(message);
1589
- }
1309
+ // src/lib/runtime/remote-actions.ts
1310
+ function isLangGraphAgentAction(action) {
1311
+ if (!action) {
1312
+ return false;
1590
1313
  }
1591
- return deepMerge(state, {
1592
- messages: mergedMessages,
1593
- copilotkit: {
1594
- actions
1595
- }
1596
- });
1314
+ return typeof action.langGraphAgentHandler === "function";
1597
1315
  }
1598
- __name(langGraphDefaultMergeState, "langGraphDefaultMergeState");
1599
- function deepMerge(obj1, obj2) {
1600
- let result = {
1601
- ...obj1
1316
+ __name(isLangGraphAgentAction, "isLangGraphAgentAction");
1317
+ function createHeaders(onBeforeRequest, graphqlContext) {
1318
+ const headers = {
1319
+ "Content-Type": "application/json"
1602
1320
  };
1603
- for (let key in obj2) {
1604
- if (typeof obj2[key] === "object" && !Array.isArray(obj2[key])) {
1605
- if (obj1[key]) {
1606
- result[key] = deepMerge(obj1[key], obj2[key]);
1607
- } else {
1608
- result[key] = {
1609
- ...obj2[key]
1610
- };
1611
- }
1612
- } else {
1613
- result[key] = obj2[key];
1321
+ if (onBeforeRequest) {
1322
+ const { headers: additionalHeaders } = onBeforeRequest({
1323
+ ctx: graphqlContext
1324
+ });
1325
+ if (additionalHeaders) {
1326
+ Object.assign(headers, additionalHeaders);
1614
1327
  }
1615
1328
  }
1616
- return result;
1329
+ return headers;
1617
1330
  }
1618
- __name(deepMerge, "deepMerge");
1619
- function formatMessages(messages) {
1620
- return messages.map((message) => {
1621
- if ("content" in message) {
1622
- return message;
1623
- }
1624
- if ("arguments" in message) {
1625
- const toolCall = {
1626
- name: message["name"],
1627
- args: message["arguments"],
1628
- id: message["id"]
1629
- };
1630
- return {
1631
- ...message,
1632
- content: "",
1633
- tool_calls: [
1634
- toolCall
1635
- ],
1636
- role: message["role"] ?? MessageRole.assistant
1637
- };
1638
- }
1639
- if ("actionExecutionId" in message) {
1331
+ __name(createHeaders, "createHeaders");
1332
+ async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: logger2, frontendUrl }) {
1333
+ logger2.debug({
1334
+ url
1335
+ }, "Fetching actions from url");
1336
+ const headers = createHeaders(onBeforeRequest, graphqlContext);
1337
+ try {
1338
+ const response = await fetch(`${url}/info`, {
1339
+ method: "POST",
1340
+ headers,
1341
+ body: JSON.stringify({
1342
+ properties: graphqlContext.properties,
1343
+ frontendUrl
1344
+ })
1345
+ });
1346
+ if (!response.ok) {
1347
+ logger2.error({
1348
+ url,
1349
+ status: response.status,
1350
+ body: await response.text()
1351
+ }, "Failed to fetch actions from url");
1640
1352
  return {
1641
- ...message,
1642
- content: message["result"],
1643
- name: message["actionName"],
1644
- tool_call_id: message["actionExecutionId"],
1645
- role: message["role"] ?? MessageRole.user
1353
+ actions: [],
1354
+ agents: []
1646
1355
  };
1647
1356
  }
1648
- return message;
1649
- });
1650
- }
1651
- __name(formatMessages, "formatMessages");
1652
-
1653
- // src/lib/runtime/remote-action-constructors.ts
1654
- function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, messages, agentStates }) {
1655
- const agents = endpoint.agents.map((agent) => ({
1656
- name: agent.name,
1657
- description: agent.description,
1658
- parameters: [],
1659
- handler: async (_args) => {
1660
- },
1661
- langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName }) => {
1662
- var _a;
1663
- logger2.debug({
1664
- actionName: agent.name
1665
- }, "Executing LangGraph Cloud agent");
1666
- telemetry_client_default.capture("oss.runtime.remote_action_executed", {});
1667
- let state = {};
1668
- if (agentStates) {
1669
- const jsonState = (_a = agentStates.find((state2) => state2.agentName === name)) == null ? void 0 : _a.state;
1670
- if (jsonState) {
1671
- state = JSON.parse(jsonState);
1672
- }
1673
- }
1674
- try {
1675
- const response = await execute({
1676
- agent,
1677
- threadId,
1678
- nodeName,
1679
- messages,
1680
- state,
1681
- properties: graphqlContext.properties,
1682
- actions: actionInputsWithoutAgents.map((action) => ({
1683
- name: action.name,
1684
- description: action.description,
1685
- parameters: JSON.parse(action.jsonSchema)
1686
- }))
1687
- });
1688
- const eventSource = new RemoteLangGraphEventSource();
1689
- streamResponse(response, eventSource.eventStream$);
1690
- return eventSource.processLangGraphEvents();
1691
- } catch (error) {
1692
- logger2.error({
1693
- url: endpoint.deploymentUrl,
1694
- status: 500,
1695
- body: error.message
1696
- }, "Failed to execute LangGraph Cloud agent");
1697
- throw new Error("Failed to execute LangGraph Cloud agent");
1698
- }
1699
- }
1700
- }));
1701
- return [
1702
- ...agents
1703
- ];
1357
+ const json = await response.json();
1358
+ logger2.debug({
1359
+ json
1360
+ }, "Fetched actions from url");
1361
+ return json;
1362
+ } catch (error) {
1363
+ logger2.error({
1364
+ error: error.message ? error.message : error + ""
1365
+ }, "Failed to fetch actions from url");
1366
+ return {
1367
+ actions: [],
1368
+ agents: []
1369
+ };
1370
+ }
1704
1371
  }
1705
- __name(constructLGCRemoteAction, "constructLGCRemoteAction");
1372
+ __name(fetchRemoteInfo, "fetchRemoteInfo");
1706
1373
  function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, logger: logger2, messages, agentStates }) {
1707
1374
  const actions = json["actions"].map((action) => ({
1708
1375
  name: action.name,
@@ -1794,7 +1461,7 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
1794
1461
  throw new Error("Failed to execute remote agent");
1795
1462
  }
1796
1463
  const eventSource = new RemoteLangGraphEventSource();
1797
- streamResponse(response.body, eventSource.eventStream$);
1464
+ eventSource.streamResponse(response);
1798
1465
  return eventSource.processLangGraphEvents();
1799
1466
  }
1800
1467
  }));
@@ -1804,165 +1471,34 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
1804
1471
  ];
1805
1472
  }
1806
1473
  __name(constructRemoteActions, "constructRemoteActions");
1807
- async function streamResponse(response, eventStream$) {
1808
- const reader = response.getReader();
1809
- const decoder = new TextDecoder();
1810
- let buffer = [];
1811
- function flushBuffer() {
1812
- const currentBuffer = buffer.join("");
1813
- if (currentBuffer.trim().length === 0) {
1814
- return;
1815
- }
1816
- const parts = currentBuffer.split("\n");
1817
- if (parts.length === 0) {
1818
- return;
1819
- }
1820
- const lastPartIsComplete = currentBuffer.endsWith("\n");
1821
- buffer = [];
1822
- if (!lastPartIsComplete) {
1823
- buffer.push(parts.pop());
1824
- }
1825
- parts.map((part) => part.trim()).filter((part) => part != "").forEach((part) => {
1826
- eventStream$.next(JSON.parse(part));
1827
- });
1828
- }
1829
- __name(flushBuffer, "flushBuffer");
1830
- try {
1831
- while (true) {
1832
- const { done, value } = await reader.read();
1833
- if (!done) {
1834
- buffer.push(decoder.decode(value, {
1835
- stream: true
1836
- }));
1837
- }
1838
- flushBuffer();
1839
- if (done) {
1840
- break;
1841
- }
1842
- }
1843
- } catch (error) {
1844
- console.error("Error in stream", error);
1845
- eventStream$.error(error);
1846
- return;
1847
- }
1848
- eventStream$.complete();
1849
- }
1850
- __name(streamResponse, "streamResponse");
1851
- function createHeaders(onBeforeRequest, graphqlContext) {
1852
- const headers = {
1853
- "Content-Type": "application/json"
1854
- };
1855
- if (onBeforeRequest) {
1856
- const { headers: additionalHeaders } = onBeforeRequest({
1857
- ctx: graphqlContext
1858
- });
1859
- if (additionalHeaders) {
1860
- Object.assign(headers, additionalHeaders);
1861
- }
1862
- }
1863
- return headers;
1864
- }
1865
- __name(createHeaders, "createHeaders");
1866
-
1867
- // src/lib/runtime/remote-actions.ts
1868
- var EndpointType;
1869
- (function(EndpointType2) {
1870
- EndpointType2["CopilotKit"] = "copilotKit";
1871
- EndpointType2["LangGraphCloud"] = "langgraph-cloud";
1872
- })(EndpointType || (EndpointType = {}));
1873
- function isLangGraphAgentAction(action) {
1874
- if (!action) {
1875
- return false;
1876
- }
1877
- return typeof action.langGraphAgentHandler === "function";
1878
- }
1879
- __name(isLangGraphAgentAction, "isLangGraphAgentAction");
1880
- async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: logger2, frontendUrl }) {
1881
- logger2.debug({
1882
- url
1883
- }, "Fetching actions from url");
1884
- const headers = createHeaders(onBeforeRequest, graphqlContext);
1885
- try {
1886
- const response = await fetch(`${url}/info`, {
1887
- method: "POST",
1888
- headers,
1889
- body: JSON.stringify({
1890
- properties: graphqlContext.properties,
1891
- frontendUrl
1892
- })
1893
- });
1894
- if (!response.ok) {
1895
- logger2.error({
1896
- url,
1897
- status: response.status,
1898
- body: await response.text()
1899
- }, "Failed to fetch actions from url");
1900
- return {
1901
- actions: [],
1902
- agents: []
1903
- };
1904
- }
1905
- const json = await response.json();
1906
- logger2.debug({
1907
- json
1908
- }, "Fetched actions from url");
1909
- return json;
1910
- } catch (error) {
1911
- logger2.error({
1912
- error: error.message ? error.message : error + ""
1913
- }, "Failed to fetch actions from url");
1914
- return {
1915
- actions: [],
1916
- agents: []
1917
- };
1918
- }
1919
- }
1920
- __name(fetchRemoteInfo, "fetchRemoteInfo");
1921
- async function setupRemoteActions({ remoteEndpointDefinitions, graphqlContext, messages, agentStates, frontendUrl }) {
1474
+ async function setupRemoteActions({ remoteActionDefinitions, graphqlContext, messages, agentStates, frontendUrl }) {
1922
1475
  const logger2 = graphqlContext.logger.child({
1923
1476
  component: "remote-actions.fetchRemoteActions"
1924
1477
  });
1925
1478
  logger2.debug({
1926
- remoteEndpointDefinitions
1927
- }, "Fetching from remote endpoints");
1928
- const filtered = remoteEndpointDefinitions.filter((value, index, self) => {
1929
- if (value.type === "langgraph-cloud") {
1930
- return value;
1931
- }
1932
- return index === self.findIndex((t) => t.url === value.url);
1933
- });
1934
- const result = await Promise.all(filtered.map(async (endpoint) => {
1935
- if (endpoint.type === "langgraph-cloud") {
1936
- return constructLGCRemoteAction({
1937
- endpoint,
1938
- messages,
1939
- graphqlContext,
1940
- logger: logger2.child({
1941
- component: "remote-actions.constructLGCRemoteAction",
1942
- endpoint
1943
- }),
1944
- agentStates
1945
- });
1946
- }
1479
+ remoteActionDefinitions
1480
+ }, "Fetching remote actions");
1481
+ const filtered = remoteActionDefinitions.filter((value, index, self) => index === self.findIndex((t) => t.url === value.url));
1482
+ const result = await Promise.all(filtered.map(async (actionDefinition) => {
1947
1483
  const json = await fetchRemoteInfo({
1948
- url: endpoint.url,
1949
- onBeforeRequest: endpoint.onBeforeRequest,
1484
+ url: actionDefinition.url,
1485
+ onBeforeRequest: actionDefinition.onBeforeRequest,
1950
1486
  graphqlContext,
1951
1487
  logger: logger2.child({
1952
1488
  component: "remote-actions.fetchActionsFromUrl",
1953
- endpoint
1489
+ actionDefinition
1954
1490
  }),
1955
1491
  frontendUrl
1956
1492
  });
1957
1493
  return constructRemoteActions({
1958
1494
  json,
1959
1495
  messages,
1960
- url: endpoint.url,
1961
- onBeforeRequest: endpoint.onBeforeRequest,
1496
+ url: actionDefinition.url,
1497
+ onBeforeRequest: actionDefinition.onBeforeRequest,
1962
1498
  graphqlContext,
1963
1499
  logger: logger2.child({
1964
1500
  component: "remote-actions.constructActions",
1965
- endpoint
1501
+ actionDefinition
1966
1502
  }),
1967
1503
  agentStates
1968
1504
  });
@@ -2126,7 +1662,13 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
2126
1662
  }
2127
1663
  let args = [];
2128
1664
  if (actionArguments) {
2129
- args = JSON.parse(actionArguments);
1665
+ try {
1666
+ args = JSON.parse(actionArguments);
1667
+ } catch (e) {
1668
+ console.warn("Action argument unparsable", {
1669
+ actionArguments
1670
+ });
1671
+ }
2130
1672
  }
2131
1673
  if (isLangGraphAgentAction(action)) {
2132
1674
  eventStream$.sendActionExecutionResult(actionExecutionId, action.name, `${action.name} agent started`);
@@ -2154,7 +1696,7 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
2154
1696
  __name(executeAction, "executeAction");
2155
1697
 
2156
1698
  // src/graphql/types/base/index.ts
2157
- var import_type_graphql2 = require("type-graphql");
1699
+ var import_type_graphql = require("type-graphql");
2158
1700
  function _ts_decorate(decorators, target, key, desc) {
2159
1701
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2160
1702
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -2177,15 +1719,15 @@ var BaseMessageInput = class {
2177
1719
  };
2178
1720
  __name(BaseMessageInput, "BaseMessageInput");
2179
1721
  _ts_decorate([
2180
- (0, import_type_graphql2.Field)(() => String),
1722
+ (0, import_type_graphql.Field)(() => String),
2181
1723
  _ts_metadata("design:type", String)
2182
1724
  ], BaseMessageInput.prototype, "id", void 0);
2183
1725
  _ts_decorate([
2184
- (0, import_type_graphql2.Field)(() => Date),
1726
+ (0, import_type_graphql.Field)(() => Date),
2185
1727
  _ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
2186
1728
  ], BaseMessageInput.prototype, "createdAt", void 0);
2187
1729
  BaseMessageInput = _ts_decorate([
2188
- (0, import_type_graphql2.InputType)()
1730
+ (0, import_type_graphql.InputType)()
2189
1731
  ], BaseMessageInput);
2190
1732
 
2191
1733
  // src/graphql/types/converted/index.ts
@@ -2289,7 +1831,7 @@ __name(convertGqlInputToMessages, "convertGqlInputToMessages");
2289
1831
  var import_rxjs3 = require("rxjs");
2290
1832
  var CopilotRuntime = class {
2291
1833
  actions;
2292
- remoteEndpointDefinitions;
1834
+ remoteActionDefinitions;
2293
1835
  langserve = [];
2294
1836
  onBeforeRequest;
2295
1837
  onAfterRequest;
@@ -2300,7 +1842,7 @@ var CopilotRuntime = class {
2300
1842
  const remoteChain = new RemoteChain(chain);
2301
1843
  this.langserve.push(remoteChain.toAction());
2302
1844
  }
2303
- this.remoteEndpointDefinitions = (params == null ? void 0 : params.remoteEndpoints) || [];
1845
+ this.remoteActionDefinitions = (params == null ? void 0 : params.remoteActions) || [];
2304
1846
  this.onBeforeRequest = (_a = params == null ? void 0 : params.middleware) == null ? void 0 : _a.onBeforeRequest;
2305
1847
  this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
2306
1848
  }
@@ -2369,7 +1911,7 @@ var CopilotRuntime = class {
2369
1911
  async processAgentRequest(request) {
2370
1912
  var _a;
2371
1913
  const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession } = request;
2372
- const { threadId, agentName, nodeName } = agentSession;
1914
+ const { threadId = (0, import_shared8.randomId)(), agentName, nodeName } = agentSession;
2373
1915
  const serverSideActions = await this.getServerSideActions(request);
2374
1916
  const messages = convertGqlInputToMessages(rawMessages);
2375
1917
  const agent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
@@ -2441,12 +1983,8 @@ var CopilotRuntime = class {
2441
1983
  console.error("Error loading langserve chain:", error);
2442
1984
  }
2443
1985
  }
2444
- const remoteEndpointDefinitions = this.remoteEndpointDefinitions.map((endpoint) => ({
2445
- ...endpoint,
2446
- type: this.resolveEndpointType(endpoint)
2447
- }));
2448
1986
  const remoteActions = await setupRemoteActions({
2449
- remoteEndpointDefinitions,
1987
+ remoteActionDefinitions: this.remoteActionDefinitions,
2450
1988
  graphqlContext,
2451
1989
  messages: inputMessages,
2452
1990
  agentStates,
@@ -2462,12 +2000,6 @@ var CopilotRuntime = class {
2462
2000
  ...remoteActions
2463
2001
  ];
2464
2002
  }
2465
- resolveEndpointType(endpoint) {
2466
- if (!endpoint.type && "langsmithApiKey" in endpoint && "deploymentUrl" in endpoint && "agents" in endpoint) {
2467
- return EndpointType.LangGraphCloud;
2468
- }
2469
- return endpoint.type;
2470
- }
2471
2003
  };
2472
2004
  __name(CopilotRuntime, "CopilotRuntime");
2473
2005
  function flattenToolCallsNoDuplicates(toolsByPriority) {
@@ -2482,20 +2014,6 @@ function flattenToolCallsNoDuplicates(toolsByPriority) {
2482
2014
  return allTools;
2483
2015
  }
2484
2016
  __name(flattenToolCallsNoDuplicates, "flattenToolCallsNoDuplicates");
2485
- function copilotKitEndpoint(config2) {
2486
- return {
2487
- ...config2,
2488
- type: EndpointType.CopilotKit
2489
- };
2490
- }
2491
- __name(copilotKitEndpoint, "copilotKitEndpoint");
2492
- function langGraphCloudEndpoint(config2) {
2493
- return {
2494
- ...config2,
2495
- type: EndpointType.LangGraphCloud
2496
- };
2497
- }
2498
- __name(langGraphCloudEndpoint, "langGraphCloudEndpoint");
2499
2017
 
2500
2018
  // src/lib/integrations/shared.ts
2501
2019
  var import_type_graphql16 = require("type-graphql");
@@ -2509,6 +2027,43 @@ var import_type_graphql11 = require("type-graphql");
2509
2027
 
2510
2028
  // src/graphql/inputs/message.input.ts
2511
2029
  var import_type_graphql3 = require("type-graphql");
2030
+
2031
+ // src/graphql/types/enums.ts
2032
+ var import_type_graphql2 = require("type-graphql");
2033
+ var MessageRole;
2034
+ (function(MessageRole2) {
2035
+ MessageRole2["user"] = "user";
2036
+ MessageRole2["assistant"] = "assistant";
2037
+ MessageRole2["system"] = "system";
2038
+ })(MessageRole || (MessageRole = {}));
2039
+ var ActionExecutionScope;
2040
+ (function(ActionExecutionScope2) {
2041
+ ActionExecutionScope2["server"] = "server";
2042
+ ActionExecutionScope2["client"] = "client";
2043
+ ActionExecutionScope2["passThrough"] = "passThrough";
2044
+ })(ActionExecutionScope || (ActionExecutionScope = {}));
2045
+ var CopilotRequestType;
2046
+ (function(CopilotRequestType2) {
2047
+ CopilotRequestType2["Chat"] = "Chat";
2048
+ CopilotRequestType2["Task"] = "Task";
2049
+ CopilotRequestType2["TextareaCompletion"] = "TextareaCompletion";
2050
+ CopilotRequestType2["TextareaPopover"] = "TextareaPopover";
2051
+ CopilotRequestType2["Suggestion"] = "Suggestion";
2052
+ })(CopilotRequestType || (CopilotRequestType = {}));
2053
+ (0, import_type_graphql2.registerEnumType)(MessageRole, {
2054
+ name: "MessageRole",
2055
+ description: "The role of the message"
2056
+ });
2057
+ (0, import_type_graphql2.registerEnumType)(ActionExecutionScope, {
2058
+ name: "ActionExecutionScope",
2059
+ description: "The scope of the action"
2060
+ });
2061
+ (0, import_type_graphql2.registerEnumType)(CopilotRequestType, {
2062
+ name: "CopilotRequestType",
2063
+ description: "The type of Copilot request"
2064
+ });
2065
+
2066
+ // src/graphql/inputs/message.input.ts
2512
2067
  function _ts_decorate2(decorators, target, key, desc) {
2513
2068
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2514
2069
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -4165,7 +3720,6 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
4165
3720
  UnifyAdapter,
4166
3721
  buildSchema,
4167
3722
  config,
4168
- copilotKitEndpoint,
4169
3723
  copilotRuntimeNestEndpoint,
4170
3724
  copilotRuntimeNextJSAppRouterEndpoint,
4171
3725
  copilotRuntimeNextJSPagesRouterEndpoint,
@@ -4173,7 +3727,6 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
4173
3727
  copilotRuntimeNodeHttpEndpoint,
4174
3728
  createContext,
4175
3729
  flattenToolCallsNoDuplicates,
4176
- getCommonConfig,
4177
- langGraphCloudEndpoint
3730
+ getCommonConfig
4178
3731
  });
4179
3732
  //# sourceMappingURL=index.js.map