@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/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",
@@ -137,7 +136,6 @@ __export(src_exports, {
137
136
  UnknownErrorResponse: () => UnknownErrorResponse,
138
137
  buildSchema: () => buildSchema,
139
138
  config: () => config,
140
- copilotKitEndpoint: () => copilotKitEndpoint,
141
139
  copilotRuntimeNestEndpoint: () => copilotRuntimeNestEndpoint,
142
140
  copilotRuntimeNextJSAppRouterEndpoint: () => copilotRuntimeNextJSAppRouterEndpoint,
143
141
  copilotRuntimeNextJSPagesRouterEndpoint: () => copilotRuntimeNextJSPagesRouterEndpoint,
@@ -145,8 +143,7 @@ __export(src_exports, {
145
143
  copilotRuntimeNodeHttpEndpoint: () => copilotRuntimeNodeHttpEndpoint,
146
144
  createContext: () => createContext,
147
145
  flattenToolCallsNoDuplicates: () => flattenToolCallsNoDuplicates,
148
- getCommonConfig: () => getCommonConfig,
149
- langGraphCloudEndpoint: () => langGraphCloudEndpoint
146
+ getCommonConfig: () => getCommonConfig
150
147
  });
151
148
  module.exports = __toCommonJS(src_exports);
152
149
  var import_reflect_metadata = require("reflect-metadata");
@@ -503,24 +500,27 @@ __name(convertMessageToLangChainMessage, "convertMessageToLangChainMessage");
503
500
  function convertJsonSchemaToZodSchema(jsonSchema, required) {
504
501
  if (jsonSchema.type === "object") {
505
502
  const spec = {};
503
+ if (!jsonSchema.properties || !Object.keys(jsonSchema.properties).length) {
504
+ return !required ? import_zod.z.object(spec).optional() : import_zod.z.object(spec);
505
+ }
506
506
  for (const [key, value] of Object.entries(jsonSchema.properties)) {
507
507
  spec[key] = convertJsonSchemaToZodSchema(value, jsonSchema.required ? jsonSchema.required.includes(key) : false);
508
508
  }
509
509
  let schema = import_zod.z.object(spec);
510
- return !required ? schema.optional() : schema;
510
+ return required ? schema : schema.optional();
511
511
  } else if (jsonSchema.type === "string") {
512
512
  let schema = import_zod.z.string().describe(jsonSchema.description);
513
- return !required ? schema.optional() : schema;
513
+ return required ? schema : schema.optional();
514
514
  } else if (jsonSchema.type === "number") {
515
515
  let schema = import_zod.z.number().describe(jsonSchema.description);
516
- return !required ? schema.optional() : schema;
516
+ return required ? schema : schema.optional();
517
517
  } else if (jsonSchema.type === "boolean") {
518
518
  let schema = import_zod.z.boolean().describe(jsonSchema.description);
519
- return !required ? schema.optional() : schema;
519
+ return required ? schema : schema.optional();
520
520
  } else if (jsonSchema.type === "array") {
521
521
  let itemSchema = convertJsonSchemaToZodSchema(jsonSchema.items, true);
522
522
  let schema = import_zod.z.array(itemSchema);
523
- return !required ? schema.optional() : schema;
523
+ return required ? schema : schema.optional();
524
524
  }
525
525
  }
526
526
  __name(convertJsonSchemaToZodSchema, "convertJsonSchemaToZodSchema");
@@ -1338,6 +1338,50 @@ var LangGraphEventTypes;
1338
1338
  var import_shared8 = require("@copilotkit/shared");
1339
1339
  var RemoteLangGraphEventSource = class {
1340
1340
  eventStream$ = new import_rxjs.ReplaySubject();
1341
+ async streamResponse(response) {
1342
+ const reader = response.body.getReader();
1343
+ const decoder = new TextDecoder();
1344
+ let buffer = [];
1345
+ const eventStream$ = this.eventStream$;
1346
+ function flushBuffer() {
1347
+ const currentBuffer = buffer.join("");
1348
+ if (currentBuffer.trim().length === 0) {
1349
+ return;
1350
+ }
1351
+ const parts = currentBuffer.split("\n");
1352
+ if (parts.length === 0) {
1353
+ return;
1354
+ }
1355
+ const lastPartIsComplete = currentBuffer.endsWith("\n");
1356
+ buffer = [];
1357
+ if (!lastPartIsComplete) {
1358
+ buffer.push(parts.pop());
1359
+ }
1360
+ parts.map((part) => part.trim()).filter((part) => part != "").forEach((part) => {
1361
+ eventStream$.next(JSON.parse(part));
1362
+ });
1363
+ }
1364
+ __name(flushBuffer, "flushBuffer");
1365
+ try {
1366
+ while (true) {
1367
+ const { done, value } = await reader.read();
1368
+ if (!done) {
1369
+ buffer.push(decoder.decode(value, {
1370
+ stream: true
1371
+ }));
1372
+ }
1373
+ flushBuffer();
1374
+ if (done) {
1375
+ break;
1376
+ }
1377
+ }
1378
+ } catch (error) {
1379
+ console.error("Error in stream", error);
1380
+ eventStream$.error(error);
1381
+ return;
1382
+ }
1383
+ eventStream$.complete();
1384
+ }
1341
1385
  shouldEmitToolCall(shouldEmitToolCalls, toolCallName) {
1342
1386
  if (typeof shouldEmitToolCalls === "boolean") {
1343
1387
  return shouldEmitToolCalls;
@@ -1360,25 +1404,20 @@ var RemoteLangGraphEventSource = class {
1360
1404
  } else {
1361
1405
  acc.content = null;
1362
1406
  }
1363
- const toolCallChunks = (
1364
- // @ts-expect-error -- LangGraph Cloud implementation stores data outside of kwargs
1365
- ((_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)
1366
- );
1367
- 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);
1368
- if (toolCallChunks && toolCallChunks.length > 0) {
1407
+ if ((_h = (_g = (_f = event.data) == null ? void 0 : _f.chunk) == null ? void 0 : _g.kwargs) == null ? void 0 : _h.tool_call_chunks) {
1369
1408
  acc.prevToolCallMessageId = acc.toolCallMessageId;
1370
- acc.toolCallMessageId = toolCallMessageId;
1371
- if ((_p = toolCallChunks[0]) == null ? void 0 : _p.name) {
1372
- acc.toolCallName = toolCallChunks[0].name;
1409
+ acc.toolCallMessageId = (_i = event.data.chunk.kwargs) == null ? void 0 : _i.id;
1410
+ if ((_j = event.data.chunk.kwargs.tool_call_chunks[0]) == null ? void 0 : _j.name) {
1411
+ acc.toolCallName = event.data.chunk.kwargs.tool_call_chunks[0].name;
1373
1412
  }
1374
- if ((_q = toolCallChunks[0]) == null ? void 0 : _q.id) {
1375
- acc.toolCallId = toolCallChunks[0].id;
1413
+ if ((_k = event.data.chunk.kwargs.tool_call_chunks[0]) == null ? void 0 : _k.id) {
1414
+ acc.toolCallId = event.data.chunk.kwargs.tool_call_chunks[0].id;
1376
1415
  }
1377
1416
  acc.prevMessageId = acc.messageId;
1378
- acc.messageId = toolCallMessageId;
1417
+ acc.messageId = (_n = (_m = (_l = event.data) == null ? void 0 : _l.chunk) == null ? void 0 : _m.kwargs) == null ? void 0 : _n.id;
1379
1418
  } else if (acc.content && acc.content != "") {
1380
1419
  acc.prevMessageId = acc.messageId;
1381
- acc.messageId = toolCallMessageId;
1420
+ acc.messageId = (_q = (_p = (_o = event.data) == null ? void 0 : _o.chunk) == null ? void 0 : _p.kwargs) == null ? void 0 : _q.id;
1382
1421
  } else {
1383
1422
  acc.prevToolCallMessageId = acc.toolCallMessageId;
1384
1423
  acc.prevMessageId = acc.messageId;
@@ -1403,7 +1442,7 @@ var RemoteLangGraphEventSource = class {
1403
1442
  prevMessageId: null,
1404
1443
  content: null
1405
1444
  }), (0, import_rxjs.mergeMap)((eventWithState) => {
1406
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1445
+ var _a, _b, _c, _d, _e;
1407
1446
  const events = [];
1408
1447
  let shouldEmitMessages = true;
1409
1448
  let shouldEmitToolCalls = false;
@@ -1486,8 +1525,7 @@ var RemoteLangGraphEventSource = class {
1486
1525
  });
1487
1526
  }
1488
1527
  }
1489
- 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
1490
- ((_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);
1528
+ 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;
1491
1529
  const content = eventWithState.content;
1492
1530
  if (args) {
1493
1531
  if (this.shouldEmitToolCall(shouldEmitToolCalls, eventWithState.toolCallName)) {
@@ -1538,441 +1576,70 @@ var RemoteLangGraphEventSource = class {
1538
1576
  };
1539
1577
  __name(RemoteLangGraphEventSource, "RemoteLangGraphEventSource");
1540
1578
 
1541
- // src/lib/runtime/remote-lg-cloud-action.ts
1542
- var import_langgraph_sdk = require("@langchain/langgraph-sdk");
1543
- var import_node_crypto = require("crypto");
1544
- var import_partial_json = require("partial-json");
1545
-
1546
- // src/graphql/types/enums.ts
1547
- var import_type_graphql = require("type-graphql");
1548
- var MessageRole;
1549
- (function(MessageRole2) {
1550
- MessageRole2["user"] = "user";
1551
- MessageRole2["assistant"] = "assistant";
1552
- MessageRole2["system"] = "system";
1553
- })(MessageRole || (MessageRole = {}));
1554
- var ActionExecutionScope;
1555
- (function(ActionExecutionScope2) {
1556
- ActionExecutionScope2["server"] = "server";
1557
- ActionExecutionScope2["client"] = "client";
1558
- ActionExecutionScope2["passThrough"] = "passThrough";
1559
- })(ActionExecutionScope || (ActionExecutionScope = {}));
1560
- var CopilotRequestType;
1561
- (function(CopilotRequestType2) {
1562
- CopilotRequestType2["Chat"] = "Chat";
1563
- CopilotRequestType2["Task"] = "Task";
1564
- CopilotRequestType2["TextareaCompletion"] = "TextareaCompletion";
1565
- CopilotRequestType2["TextareaPopover"] = "TextareaPopover";
1566
- CopilotRequestType2["Suggestion"] = "Suggestion";
1567
- })(CopilotRequestType || (CopilotRequestType = {}));
1568
- (0, import_type_graphql.registerEnumType)(MessageRole, {
1569
- name: "MessageRole",
1570
- description: "The role of the message"
1571
- });
1572
- (0, import_type_graphql.registerEnumType)(ActionExecutionScope, {
1573
- name: "ActionExecutionScope",
1574
- description: "The scope of the action"
1575
- });
1576
- (0, import_type_graphql.registerEnumType)(CopilotRequestType, {
1577
- name: "CopilotRequestType",
1578
- description: "The type of Copilot request"
1579
- });
1580
-
1581
- // src/lib/runtime/remote-lg-cloud-action.ts
1582
- async function execute(args) {
1583
- return new ReadableStream({
1584
- async start(controller) {
1585
- try {
1586
- await streamEvents(controller, args);
1587
- controller.close();
1588
- } catch (err) {
1589
- }
1590
- }
1591
- });
1592
- }
1593
- __name(execute, "execute");
1594
- async function streamEvents(controller, args) {
1595
- const { threadId: agrsInitialThreadId, agent, nodeName: initialNodeName, state: initialState, messages, actions } = args;
1596
- let nodeName = initialNodeName;
1597
- let state = initialState;
1598
- const { name, assistantId: initialAssistantId } = agent;
1599
- const client = new import_langgraph_sdk.Client();
1600
- let initialThreadId = agrsInitialThreadId;
1601
- const wasInitiatedWithExistingThread = !!initialThreadId;
1602
- if (initialThreadId && initialThreadId.startsWith("ck-")) {
1603
- initialThreadId = initialThreadId.substring(3);
1604
- }
1605
- const assistants = await client.assistants.search();
1606
- const retrievedAssistant = assistants.find((a) => a.name === name);
1607
- const threadId = initialThreadId ?? (0, import_node_crypto.randomUUID)();
1608
- if (initialThreadId === threadId) {
1609
- await client.threads.get(threadId);
1610
- } else {
1611
- await client.threads.create({
1612
- threadId
1613
- });
1614
- }
1615
- let agentState = {
1616
- values: {}
1617
- };
1618
- if (wasInitiatedWithExistingThread) {
1619
- agentState = await client.threads.getState(threadId);
1620
- }
1621
- const agentStateValues = agentState.values;
1622
- state.messages = agentStateValues.messages;
1623
- const mode = wasInitiatedWithExistingThread && nodeName != "__end__" ? "continue" : "start";
1624
- state = langGraphDefaultMergeState(state, formatMessages(messages), actions);
1625
- if (mode === "continue") {
1626
- await client.threads.updateState(threadId, {
1627
- values: state,
1628
- asNode: nodeName
1629
- });
1630
- }
1631
- const assistantId = initialAssistantId ?? retrievedAssistant.assistant_id;
1632
- const graphInfo = await client.assistants.getGraph(assistantId);
1633
- const streamInput = mode === "start" ? state : null;
1634
- let streamingStateExtractor = new StreamingStateExtractor([]);
1635
- let prevNodeName = null;
1636
- let emitIntermediateStateUntilEnd = null;
1637
- let shouldExit = null;
1638
- let externalRunId = null;
1639
- const streamResponse2 = client.runs.stream(threadId, assistantId, {
1640
- input: streamInput,
1641
- streamMode: [
1642
- "events",
1643
- "values"
1644
- ]
1645
- });
1646
- const emit = /* @__PURE__ */ __name((message) => controller.enqueue(new TextEncoder().encode(message)), "emit");
1647
- let latestStateValues = {};
1648
- for await (const chunk of streamResponse2) {
1649
- if (![
1650
- "events",
1651
- "values"
1652
- ].includes(chunk.event))
1653
- continue;
1654
- if (chunk.event === "values") {
1655
- latestStateValues = chunk.data;
1656
- continue;
1657
- }
1658
- const event = chunk.data;
1659
- const currentNodeName = event.name;
1660
- const eventType = event.event;
1661
- const runId = event.metadata.run_id;
1662
- externalRunId = runId;
1663
- const metadata = event.metadata;
1664
- shouldExit = shouldExit != null ? shouldExit : metadata["copilotkit:exit"];
1665
- const emitIntermediateState = metadata["copilotkit:emit-intermediate-state"];
1666
- const forceEmitIntermediateState = metadata["copilotkit:force-emit-intermediate-state"];
1667
- const manuallyEmitMessage = metadata["copilotkit:manually-emit-messages"];
1668
- const manuallyEmitToolCall = metadata["copilotkit:manually-emit-tool-calls"];
1669
- if (graphInfo["nodes"].some((node) => node.id === currentNodeName)) {
1670
- nodeName = currentNodeName;
1671
- }
1672
- if (!nodeName) {
1673
- continue;
1674
- }
1675
- if (forceEmitIntermediateState) {
1676
- if (eventType === "on_chain_end") {
1677
- state = event.data.output;
1678
- emit(getStateSyncEvent({
1679
- threadId,
1680
- runId,
1681
- agentName: agent.name,
1682
- nodeName,
1683
- state: event.data.output,
1684
- running: true,
1685
- active: true
1686
- }));
1687
- }
1688
- continue;
1689
- }
1690
- if (manuallyEmitMessage) {
1691
- if (eventType === "on_chain_end") {
1692
- state = event.data.output;
1693
- emit(JSON.stringify({
1694
- event: "on_copilotkit_emit_message",
1695
- message: event.data.output,
1696
- messageId: (0, import_node_crypto.randomUUID)(),
1697
- role: MessageRole.assistant
1698
- }) + "\n");
1699
- }
1700
- continue;
1701
- }
1702
- if (manuallyEmitToolCall) {
1703
- if (eventType === "on_chain_end") {
1704
- state = event.data.output;
1705
- emit(JSON.stringify({
1706
- event: "on_copilotkit_emit_tool_call",
1707
- name: event.data.output.name,
1708
- args: event.data.output.args,
1709
- id: event.data.output.id
1710
- }) + "\n");
1711
- }
1712
- continue;
1713
- }
1714
- if (emitIntermediateState && emitIntermediateStateUntilEnd == null) {
1715
- emitIntermediateStateUntilEnd = nodeName;
1716
- }
1717
- if (emitIntermediateState && eventType === "on_chat_model_start") {
1718
- streamingStateExtractor = new StreamingStateExtractor(emitIntermediateState);
1719
- }
1720
- let updatedState = latestStateValues;
1721
- if (emitIntermediateState && eventType === "on_chat_model_stream") {
1722
- streamingStateExtractor.bufferToolCalls(event);
1723
- }
1724
- if (emitIntermediateStateUntilEnd !== null) {
1725
- updatedState = {
1726
- ...updatedState,
1727
- ...streamingStateExtractor.extractState()
1728
- };
1729
- }
1730
- if (!emitIntermediateState && currentNodeName === emitIntermediateStateUntilEnd && eventType === "on_chain_end") {
1731
- emitIntermediateStateUntilEnd = null;
1732
- }
1733
- const exitingNode = nodeName === currentNodeName && eventType === "on_chain_end";
1734
- if (JSON.stringify(updatedState) !== JSON.stringify(state) || prevNodeName != nodeName || exitingNode) {
1735
- state = updatedState;
1736
- prevNodeName = nodeName;
1737
- emit(getStateSyncEvent({
1738
- threadId,
1739
- runId,
1740
- agentName: agent.name,
1741
- nodeName,
1742
- state,
1743
- running: true,
1744
- active: !exitingNode
1745
- }));
1746
- }
1747
- emit(JSON.stringify(event) + "\n");
1748
- }
1749
- state = await client.threads.getState(threadId);
1750
- const isEndNode = state.next.length === 0;
1751
- nodeName = Object.keys(state.metadata.writes)[0];
1752
- emit(getStateSyncEvent({
1753
- threadId,
1754
- runId: externalRunId,
1755
- agentName: agent.name,
1756
- nodeName: isEndNode ? "__end__" : nodeName,
1757
- state: state.values,
1758
- running: !shouldExit,
1759
- active: false
1760
- }));
1761
- return Promise.resolve();
1762
- }
1763
- __name(streamEvents, "streamEvents");
1764
- function getStateSyncEvent({ threadId, runId, agentName, nodeName, state, running, active }) {
1765
- const stateWithoutMessages = Object.keys(state).reduce((acc, key) => {
1766
- if (key !== "messages") {
1767
- acc[key] = state[key];
1768
- }
1769
- return acc;
1770
- }, {});
1771
- return JSON.stringify({
1772
- event: "on_copilotkit_state_sync",
1773
- thread_id: threadId,
1774
- run_id: runId,
1775
- agent_name: agentName,
1776
- node_name: nodeName,
1777
- active,
1778
- state: stateWithoutMessages,
1779
- running,
1780
- role: "assistant"
1781
- }) + "\n";
1782
- }
1783
- __name(getStateSyncEvent, "getStateSyncEvent");
1784
- var StreamingStateExtractor = /* @__PURE__ */ __name(class StreamingStateExtractor2 {
1785
- emitIntermediateState;
1786
- toolCallBuffer;
1787
- currentToolCall;
1788
- previouslyParsableState;
1789
- constructor(emitIntermediateState) {
1790
- this.emitIntermediateState = emitIntermediateState;
1791
- this.toolCallBuffer = {};
1792
- this.currentToolCall = null;
1793
- this.previouslyParsableState = {};
1794
- }
1795
- bufferToolCalls(event) {
1796
- if (event.data.chunk.tool_call_chunks.length > 0) {
1797
- const chunk = event.data.chunk.tool_call_chunks[0];
1798
- if (chunk.name !== null) {
1799
- this.currentToolCall = chunk.name;
1800
- this.toolCallBuffer[this.currentToolCall] = chunk.args;
1801
- } else if (this.currentToolCall !== null) {
1802
- this.toolCallBuffer[this.currentToolCall] += chunk.args;
1803
- }
1804
- }
1805
- }
1806
- getEmitStateConfig(currentToolName) {
1807
- for (const config2 of this.emitIntermediateState) {
1808
- const stateKey = config2["state_key"];
1809
- const tool = config2["tool"];
1810
- const toolArgument = config2["tool_argument"];
1811
- if (currentToolName === tool) {
1812
- return [
1813
- toolArgument,
1814
- stateKey
1815
- ];
1816
- }
1817
- }
1818
- return [
1819
- null,
1820
- null
1821
- ];
1822
- }
1823
- extractState() {
1824
- const state = {};
1825
- for (const [key, value] of Object.entries(this.toolCallBuffer)) {
1826
- const [argumentName, stateKey] = this.getEmitStateConfig(key);
1827
- if (stateKey === null) {
1828
- continue;
1829
- }
1830
- let parsedValue;
1831
- try {
1832
- parsedValue = (0, import_partial_json.parse)(value);
1833
- } catch (error) {
1834
- if (key in this.previouslyParsableState) {
1835
- parsedValue = this.previouslyParsableState[key];
1836
- } else {
1837
- continue;
1838
- }
1839
- }
1840
- this.previouslyParsableState[key] = parsedValue;
1841
- if (!argumentName) {
1842
- state[stateKey] = parsedValue;
1843
- } else {
1844
- state[stateKey] = parsedValue[argumentName];
1845
- }
1846
- }
1847
- return state;
1848
- }
1849
- }, "StreamingStateExtractor");
1850
- function langGraphDefaultMergeState(state, messages, actions) {
1851
- if (messages.length > 0 && "role" in messages[0] && messages[0].role === "system") {
1852
- messages = messages.slice(1);
1853
- }
1854
- const mergedMessages = state.messages || [];
1855
- const existingMessageIds = new Set(mergedMessages.map((message) => message.id));
1856
- for (const message of messages) {
1857
- if (!existingMessageIds.has(message.id)) {
1858
- mergedMessages.push(message);
1859
- }
1579
+ // src/lib/runtime/remote-actions.ts
1580
+ function isLangGraphAgentAction(action) {
1581
+ if (!action) {
1582
+ return false;
1860
1583
  }
1861
- return deepMerge(state, {
1862
- messages: mergedMessages,
1863
- copilotkit: {
1864
- actions
1865
- }
1866
- });
1584
+ return typeof action.langGraphAgentHandler === "function";
1867
1585
  }
1868
- __name(langGraphDefaultMergeState, "langGraphDefaultMergeState");
1869
- function deepMerge(obj1, obj2) {
1870
- let result = {
1871
- ...obj1
1586
+ __name(isLangGraphAgentAction, "isLangGraphAgentAction");
1587
+ function createHeaders(onBeforeRequest, graphqlContext) {
1588
+ const headers = {
1589
+ "Content-Type": "application/json"
1872
1590
  };
1873
- for (let key in obj2) {
1874
- if (typeof obj2[key] === "object" && !Array.isArray(obj2[key])) {
1875
- if (obj1[key]) {
1876
- result[key] = deepMerge(obj1[key], obj2[key]);
1877
- } else {
1878
- result[key] = {
1879
- ...obj2[key]
1880
- };
1881
- }
1882
- } else {
1883
- result[key] = obj2[key];
1591
+ if (onBeforeRequest) {
1592
+ const { headers: additionalHeaders } = onBeforeRequest({
1593
+ ctx: graphqlContext
1594
+ });
1595
+ if (additionalHeaders) {
1596
+ Object.assign(headers, additionalHeaders);
1884
1597
  }
1885
1598
  }
1886
- return result;
1599
+ return headers;
1887
1600
  }
1888
- __name(deepMerge, "deepMerge");
1889
- function formatMessages(messages) {
1890
- return messages.map((message) => {
1891
- if ("content" in message) {
1892
- return message;
1893
- }
1894
- if ("arguments" in message) {
1895
- const toolCall = {
1896
- name: message["name"],
1897
- args: message["arguments"],
1898
- id: message["id"]
1899
- };
1900
- return {
1901
- ...message,
1902
- content: "",
1903
- tool_calls: [
1904
- toolCall
1905
- ],
1906
- role: message["role"] ?? MessageRole.assistant
1907
- };
1908
- }
1909
- if ("actionExecutionId" in message) {
1601
+ __name(createHeaders, "createHeaders");
1602
+ async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: logger2, frontendUrl }) {
1603
+ logger2.debug({
1604
+ url
1605
+ }, "Fetching actions from url");
1606
+ const headers = createHeaders(onBeforeRequest, graphqlContext);
1607
+ try {
1608
+ const response = await fetch(`${url}/info`, {
1609
+ method: "POST",
1610
+ headers,
1611
+ body: JSON.stringify({
1612
+ properties: graphqlContext.properties,
1613
+ frontendUrl
1614
+ })
1615
+ });
1616
+ if (!response.ok) {
1617
+ logger2.error({
1618
+ url,
1619
+ status: response.status,
1620
+ body: await response.text()
1621
+ }, "Failed to fetch actions from url");
1910
1622
  return {
1911
- ...message,
1912
- content: message["result"],
1913
- name: message["actionName"],
1914
- tool_call_id: message["actionExecutionId"],
1915
- role: message["role"] ?? MessageRole.user
1623
+ actions: [],
1624
+ agents: []
1916
1625
  };
1917
1626
  }
1918
- return message;
1919
- });
1920
- }
1921
- __name(formatMessages, "formatMessages");
1922
-
1923
- // src/lib/runtime/remote-action-constructors.ts
1924
- function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, messages, agentStates }) {
1925
- const agents = endpoint.agents.map((agent) => ({
1926
- name: agent.name,
1927
- description: agent.description,
1928
- parameters: [],
1929
- handler: async (_args) => {
1930
- },
1931
- langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName }) => {
1932
- var _a;
1933
- logger2.debug({
1934
- actionName: agent.name
1935
- }, "Executing LangGraph Cloud agent");
1936
- telemetry_client_default.capture("oss.runtime.remote_action_executed", {});
1937
- let state = {};
1938
- if (agentStates) {
1939
- const jsonState = (_a = agentStates.find((state2) => state2.agentName === name)) == null ? void 0 : _a.state;
1940
- if (jsonState) {
1941
- state = JSON.parse(jsonState);
1942
- }
1943
- }
1944
- try {
1945
- const response = await execute({
1946
- agent,
1947
- threadId,
1948
- nodeName,
1949
- messages,
1950
- state,
1951
- properties: graphqlContext.properties,
1952
- actions: actionInputsWithoutAgents.map((action) => ({
1953
- name: action.name,
1954
- description: action.description,
1955
- parameters: JSON.parse(action.jsonSchema)
1956
- }))
1957
- });
1958
- const eventSource = new RemoteLangGraphEventSource();
1959
- streamResponse(response, eventSource.eventStream$);
1960
- return eventSource.processLangGraphEvents();
1961
- } catch (error) {
1962
- logger2.error({
1963
- url: endpoint.deploymentUrl,
1964
- status: 500,
1965
- body: error.message
1966
- }, "Failed to execute LangGraph Cloud agent");
1967
- throw new Error("Failed to execute LangGraph Cloud agent");
1968
- }
1969
- }
1970
- }));
1971
- return [
1972
- ...agents
1973
- ];
1627
+ const json = await response.json();
1628
+ logger2.debug({
1629
+ json
1630
+ }, "Fetched actions from url");
1631
+ return json;
1632
+ } catch (error) {
1633
+ logger2.error({
1634
+ error: error.message ? error.message : error + ""
1635
+ }, "Failed to fetch actions from url");
1636
+ return {
1637
+ actions: [],
1638
+ agents: []
1639
+ };
1640
+ }
1974
1641
  }
1975
- __name(constructLGCRemoteAction, "constructLGCRemoteAction");
1642
+ __name(fetchRemoteInfo, "fetchRemoteInfo");
1976
1643
  function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, logger: logger2, messages, agentStates }) {
1977
1644
  const actions = json["actions"].map((action) => ({
1978
1645
  name: action.name,
@@ -2064,7 +1731,7 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
2064
1731
  throw new Error("Failed to execute remote agent");
2065
1732
  }
2066
1733
  const eventSource = new RemoteLangGraphEventSource();
2067
- streamResponse(response.body, eventSource.eventStream$);
1734
+ eventSource.streamResponse(response);
2068
1735
  return eventSource.processLangGraphEvents();
2069
1736
  }
2070
1737
  }));
@@ -2074,165 +1741,34 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
2074
1741
  ];
2075
1742
  }
2076
1743
  __name(constructRemoteActions, "constructRemoteActions");
2077
- async function streamResponse(response, eventStream$) {
2078
- const reader = response.getReader();
2079
- const decoder = new TextDecoder();
2080
- let buffer = [];
2081
- function flushBuffer() {
2082
- const currentBuffer = buffer.join("");
2083
- if (currentBuffer.trim().length === 0) {
2084
- return;
2085
- }
2086
- const parts = currentBuffer.split("\n");
2087
- if (parts.length === 0) {
2088
- return;
2089
- }
2090
- const lastPartIsComplete = currentBuffer.endsWith("\n");
2091
- buffer = [];
2092
- if (!lastPartIsComplete) {
2093
- buffer.push(parts.pop());
2094
- }
2095
- parts.map((part) => part.trim()).filter((part) => part != "").forEach((part) => {
2096
- eventStream$.next(JSON.parse(part));
2097
- });
2098
- }
2099
- __name(flushBuffer, "flushBuffer");
2100
- try {
2101
- while (true) {
2102
- const { done, value } = await reader.read();
2103
- if (!done) {
2104
- buffer.push(decoder.decode(value, {
2105
- stream: true
2106
- }));
2107
- }
2108
- flushBuffer();
2109
- if (done) {
2110
- break;
2111
- }
2112
- }
2113
- } catch (error) {
2114
- console.error("Error in stream", error);
2115
- eventStream$.error(error);
2116
- return;
2117
- }
2118
- eventStream$.complete();
2119
- }
2120
- __name(streamResponse, "streamResponse");
2121
- function createHeaders(onBeforeRequest, graphqlContext) {
2122
- const headers = {
2123
- "Content-Type": "application/json"
2124
- };
2125
- if (onBeforeRequest) {
2126
- const { headers: additionalHeaders } = onBeforeRequest({
2127
- ctx: graphqlContext
2128
- });
2129
- if (additionalHeaders) {
2130
- Object.assign(headers, additionalHeaders);
2131
- }
2132
- }
2133
- return headers;
2134
- }
2135
- __name(createHeaders, "createHeaders");
2136
-
2137
- // src/lib/runtime/remote-actions.ts
2138
- var EndpointType;
2139
- (function(EndpointType2) {
2140
- EndpointType2["CopilotKit"] = "copilotKit";
2141
- EndpointType2["LangGraphCloud"] = "langgraph-cloud";
2142
- })(EndpointType || (EndpointType = {}));
2143
- function isLangGraphAgentAction(action) {
2144
- if (!action) {
2145
- return false;
2146
- }
2147
- return typeof action.langGraphAgentHandler === "function";
2148
- }
2149
- __name(isLangGraphAgentAction, "isLangGraphAgentAction");
2150
- async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: logger2, frontendUrl }) {
2151
- logger2.debug({
2152
- url
2153
- }, "Fetching actions from url");
2154
- const headers = createHeaders(onBeforeRequest, graphqlContext);
2155
- try {
2156
- const response = await fetch(`${url}/info`, {
2157
- method: "POST",
2158
- headers,
2159
- body: JSON.stringify({
2160
- properties: graphqlContext.properties,
2161
- frontendUrl
2162
- })
2163
- });
2164
- if (!response.ok) {
2165
- logger2.error({
2166
- url,
2167
- status: response.status,
2168
- body: await response.text()
2169
- }, "Failed to fetch actions from url");
2170
- return {
2171
- actions: [],
2172
- agents: []
2173
- };
2174
- }
2175
- const json = await response.json();
2176
- logger2.debug({
2177
- json
2178
- }, "Fetched actions from url");
2179
- return json;
2180
- } catch (error) {
2181
- logger2.error({
2182
- error: error.message ? error.message : error + ""
2183
- }, "Failed to fetch actions from url");
2184
- return {
2185
- actions: [],
2186
- agents: []
2187
- };
2188
- }
2189
- }
2190
- __name(fetchRemoteInfo, "fetchRemoteInfo");
2191
- async function setupRemoteActions({ remoteEndpointDefinitions, graphqlContext, messages, agentStates, frontendUrl }) {
1744
+ async function setupRemoteActions({ remoteActionDefinitions, graphqlContext, messages, agentStates, frontendUrl }) {
2192
1745
  const logger2 = graphqlContext.logger.child({
2193
1746
  component: "remote-actions.fetchRemoteActions"
2194
1747
  });
2195
1748
  logger2.debug({
2196
- remoteEndpointDefinitions
2197
- }, "Fetching from remote endpoints");
2198
- const filtered = remoteEndpointDefinitions.filter((value, index, self) => {
2199
- if (value.type === "langgraph-cloud") {
2200
- return value;
2201
- }
2202
- return index === self.findIndex((t) => t.url === value.url);
2203
- });
2204
- const result = await Promise.all(filtered.map(async (endpoint) => {
2205
- if (endpoint.type === "langgraph-cloud") {
2206
- return constructLGCRemoteAction({
2207
- endpoint,
2208
- messages,
2209
- graphqlContext,
2210
- logger: logger2.child({
2211
- component: "remote-actions.constructLGCRemoteAction",
2212
- endpoint
2213
- }),
2214
- agentStates
2215
- });
2216
- }
1749
+ remoteActionDefinitions
1750
+ }, "Fetching remote actions");
1751
+ const filtered = remoteActionDefinitions.filter((value, index, self) => index === self.findIndex((t) => t.url === value.url));
1752
+ const result = await Promise.all(filtered.map(async (actionDefinition) => {
2217
1753
  const json = await fetchRemoteInfo({
2218
- url: endpoint.url,
2219
- onBeforeRequest: endpoint.onBeforeRequest,
1754
+ url: actionDefinition.url,
1755
+ onBeforeRequest: actionDefinition.onBeforeRequest,
2220
1756
  graphqlContext,
2221
1757
  logger: logger2.child({
2222
1758
  component: "remote-actions.fetchActionsFromUrl",
2223
- endpoint
1759
+ actionDefinition
2224
1760
  }),
2225
1761
  frontendUrl
2226
1762
  });
2227
1763
  return constructRemoteActions({
2228
1764
  json,
2229
1765
  messages,
2230
- url: endpoint.url,
2231
- onBeforeRequest: endpoint.onBeforeRequest,
1766
+ url: actionDefinition.url,
1767
+ onBeforeRequest: actionDefinition.onBeforeRequest,
2232
1768
  graphqlContext,
2233
1769
  logger: logger2.child({
2234
1770
  component: "remote-actions.constructActions",
2235
- endpoint
1771
+ actionDefinition
2236
1772
  }),
2237
1773
  agentStates
2238
1774
  });
@@ -2396,7 +1932,13 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
2396
1932
  }
2397
1933
  let args = [];
2398
1934
  if (actionArguments) {
2399
- args = JSON.parse(actionArguments);
1935
+ try {
1936
+ args = JSON.parse(actionArguments);
1937
+ } catch (e) {
1938
+ console.warn("Action argument unparsable", {
1939
+ actionArguments
1940
+ });
1941
+ }
2400
1942
  }
2401
1943
  if (isLangGraphAgentAction(action)) {
2402
1944
  eventStream$.sendActionExecutionResult(actionExecutionId, action.name, `${action.name} agent started`);
@@ -2424,7 +1966,7 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
2424
1966
  __name(executeAction, "executeAction");
2425
1967
 
2426
1968
  // src/graphql/types/base/index.ts
2427
- var import_type_graphql2 = require("type-graphql");
1969
+ var import_type_graphql = require("type-graphql");
2428
1970
  function _ts_decorate(decorators, target, key, desc) {
2429
1971
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2430
1972
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -2447,15 +1989,15 @@ var BaseMessageInput = class {
2447
1989
  };
2448
1990
  __name(BaseMessageInput, "BaseMessageInput");
2449
1991
  _ts_decorate([
2450
- (0, import_type_graphql2.Field)(() => String),
1992
+ (0, import_type_graphql.Field)(() => String),
2451
1993
  _ts_metadata("design:type", String)
2452
1994
  ], BaseMessageInput.prototype, "id", void 0);
2453
1995
  _ts_decorate([
2454
- (0, import_type_graphql2.Field)(() => Date),
1996
+ (0, import_type_graphql.Field)(() => Date),
2455
1997
  _ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
2456
1998
  ], BaseMessageInput.prototype, "createdAt", void 0);
2457
1999
  BaseMessageInput = _ts_decorate([
2458
- (0, import_type_graphql2.InputType)()
2000
+ (0, import_type_graphql.InputType)()
2459
2001
  ], BaseMessageInput);
2460
2002
 
2461
2003
  // src/graphql/types/converted/index.ts
@@ -2559,7 +2101,7 @@ __name(convertGqlInputToMessages, "convertGqlInputToMessages");
2559
2101
  var import_rxjs3 = require("rxjs");
2560
2102
  var CopilotRuntime = class {
2561
2103
  actions;
2562
- remoteEndpointDefinitions;
2104
+ remoteActionDefinitions;
2563
2105
  langserve = [];
2564
2106
  onBeforeRequest;
2565
2107
  onAfterRequest;
@@ -2570,7 +2112,7 @@ var CopilotRuntime = class {
2570
2112
  const remoteChain = new RemoteChain(chain);
2571
2113
  this.langserve.push(remoteChain.toAction());
2572
2114
  }
2573
- this.remoteEndpointDefinitions = (params == null ? void 0 : params.remoteEndpoints) || [];
2115
+ this.remoteActionDefinitions = (params == null ? void 0 : params.remoteActions) || [];
2574
2116
  this.onBeforeRequest = (_a = params == null ? void 0 : params.middleware) == null ? void 0 : _a.onBeforeRequest;
2575
2117
  this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
2576
2118
  }
@@ -2639,7 +2181,7 @@ var CopilotRuntime = class {
2639
2181
  async processAgentRequest(request) {
2640
2182
  var _a;
2641
2183
  const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession } = request;
2642
- const { threadId, agentName, nodeName } = agentSession;
2184
+ const { threadId = (0, import_shared9.randomId)(), agentName, nodeName } = agentSession;
2643
2185
  const serverSideActions = await this.getServerSideActions(request);
2644
2186
  const messages = convertGqlInputToMessages(rawMessages);
2645
2187
  const agent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
@@ -2711,12 +2253,8 @@ var CopilotRuntime = class {
2711
2253
  console.error("Error loading langserve chain:", error);
2712
2254
  }
2713
2255
  }
2714
- const remoteEndpointDefinitions = this.remoteEndpointDefinitions.map((endpoint) => ({
2715
- ...endpoint,
2716
- type: this.resolveEndpointType(endpoint)
2717
- }));
2718
2256
  const remoteActions = await setupRemoteActions({
2719
- remoteEndpointDefinitions,
2257
+ remoteActionDefinitions: this.remoteActionDefinitions,
2720
2258
  graphqlContext,
2721
2259
  messages: inputMessages,
2722
2260
  agentStates,
@@ -2732,12 +2270,6 @@ var CopilotRuntime = class {
2732
2270
  ...remoteActions
2733
2271
  ];
2734
2272
  }
2735
- resolveEndpointType(endpoint) {
2736
- if (!endpoint.type && "langsmithApiKey" in endpoint && "deploymentUrl" in endpoint && "agents" in endpoint) {
2737
- return EndpointType.LangGraphCloud;
2738
- }
2739
- return endpoint.type;
2740
- }
2741
2273
  };
2742
2274
  __name(CopilotRuntime, "CopilotRuntime");
2743
2275
  function flattenToolCallsNoDuplicates(toolsByPriority) {
@@ -2752,20 +2284,6 @@ function flattenToolCallsNoDuplicates(toolsByPriority) {
2752
2284
  return allTools;
2753
2285
  }
2754
2286
  __name(flattenToolCallsNoDuplicates, "flattenToolCallsNoDuplicates");
2755
- function copilotKitEndpoint(config2) {
2756
- return {
2757
- ...config2,
2758
- type: EndpointType.CopilotKit
2759
- };
2760
- }
2761
- __name(copilotKitEndpoint, "copilotKitEndpoint");
2762
- function langGraphCloudEndpoint(config2) {
2763
- return {
2764
- ...config2,
2765
- type: EndpointType.LangGraphCloud
2766
- };
2767
- }
2768
- __name(langGraphCloudEndpoint, "langGraphCloudEndpoint");
2769
2287
 
2770
2288
  // src/lib/integrations/shared.ts
2771
2289
  var import_type_graphql16 = require("type-graphql");
@@ -2779,6 +2297,43 @@ var import_type_graphql11 = require("type-graphql");
2779
2297
 
2780
2298
  // src/graphql/inputs/message.input.ts
2781
2299
  var import_type_graphql3 = require("type-graphql");
2300
+
2301
+ // src/graphql/types/enums.ts
2302
+ var import_type_graphql2 = require("type-graphql");
2303
+ var MessageRole;
2304
+ (function(MessageRole2) {
2305
+ MessageRole2["user"] = "user";
2306
+ MessageRole2["assistant"] = "assistant";
2307
+ MessageRole2["system"] = "system";
2308
+ })(MessageRole || (MessageRole = {}));
2309
+ var ActionExecutionScope;
2310
+ (function(ActionExecutionScope2) {
2311
+ ActionExecutionScope2["server"] = "server";
2312
+ ActionExecutionScope2["client"] = "client";
2313
+ ActionExecutionScope2["passThrough"] = "passThrough";
2314
+ })(ActionExecutionScope || (ActionExecutionScope = {}));
2315
+ var CopilotRequestType;
2316
+ (function(CopilotRequestType2) {
2317
+ CopilotRequestType2["Chat"] = "Chat";
2318
+ CopilotRequestType2["Task"] = "Task";
2319
+ CopilotRequestType2["TextareaCompletion"] = "TextareaCompletion";
2320
+ CopilotRequestType2["TextareaPopover"] = "TextareaPopover";
2321
+ CopilotRequestType2["Suggestion"] = "Suggestion";
2322
+ })(CopilotRequestType || (CopilotRequestType = {}));
2323
+ (0, import_type_graphql2.registerEnumType)(MessageRole, {
2324
+ name: "MessageRole",
2325
+ description: "The role of the message"
2326
+ });
2327
+ (0, import_type_graphql2.registerEnumType)(ActionExecutionScope, {
2328
+ name: "ActionExecutionScope",
2329
+ description: "The scope of the action"
2330
+ });
2331
+ (0, import_type_graphql2.registerEnumType)(CopilotRequestType, {
2332
+ name: "CopilotRequestType",
2333
+ description: "The type of Copilot request"
2334
+ });
2335
+
2336
+ // src/graphql/inputs/message.input.ts
2782
2337
  function _ts_decorate2(decorators, target, key, desc) {
2783
2338
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2784
2339
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -4440,7 +3995,6 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
4440
3995
  UnknownErrorResponse,
4441
3996
  buildSchema,
4442
3997
  config,
4443
- copilotKitEndpoint,
4444
3998
  copilotRuntimeNestEndpoint,
4445
3999
  copilotRuntimeNextJSAppRouterEndpoint,
4446
4000
  copilotRuntimeNextJSPagesRouterEndpoint,
@@ -4448,7 +4002,6 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
4448
4002
  copilotRuntimeNodeHttpEndpoint,
4449
4003
  createContext,
4450
4004
  flattenToolCallsNoDuplicates,
4451
- getCommonConfig,
4452
- langGraphCloudEndpoint
4005
+ getCommonConfig
4453
4006
  });
4454
4007
  //# sourceMappingURL=index.js.map