@copilotkit/runtime-client-gql 1.51.4 → 1.51.5-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  3. package/dist/client/CopilotRuntimeClient.cjs +119 -0
  4. package/dist/client/CopilotRuntimeClient.cjs.map +1 -0
  5. package/dist/client/CopilotRuntimeClient.d.cts +44 -0
  6. package/dist/client/CopilotRuntimeClient.d.cts.map +1 -0
  7. package/dist/client/CopilotRuntimeClient.d.mts +44 -0
  8. package/dist/client/CopilotRuntimeClient.d.mts.map +1 -0
  9. package/dist/client/CopilotRuntimeClient.mjs +116 -10
  10. package/dist/client/CopilotRuntimeClient.mjs.map +1 -1
  11. package/dist/client/conversion.cjs +194 -0
  12. package/dist/client/conversion.cjs.map +1 -0
  13. package/dist/client/{conversion.d.ts → conversion.d.cts} +5 -4
  14. package/dist/client/conversion.d.cts.map +1 -0
  15. package/dist/client/conversion.d.mts +12 -0
  16. package/dist/client/conversion.d.mts.map +1 -0
  17. package/dist/client/conversion.mjs +187 -17
  18. package/dist/client/conversion.mjs.map +1 -1
  19. package/dist/client/index.d.cts +5 -0
  20. package/dist/client/index.d.mts +5 -0
  21. package/dist/client/types.cjs +86 -0
  22. package/dist/client/types.cjs.map +1 -0
  23. package/dist/client/types.d.cts +76 -0
  24. package/dist/client/types.d.cts.map +1 -0
  25. package/dist/client/types.d.mts +76 -0
  26. package/dist/client/types.d.mts.map +1 -0
  27. package/dist/client/types.mjs +76 -21
  28. package/dist/client/types.mjs.map +1 -1
  29. package/dist/graphql/@generated/gql.cjs +15 -0
  30. package/dist/graphql/@generated/gql.cjs.map +1 -0
  31. package/dist/graphql/@generated/gql.mjs +13 -7
  32. package/dist/graphql/@generated/gql.mjs.map +1 -1
  33. package/dist/graphql/@generated/graphql.cjs +1154 -0
  34. package/dist/graphql/@generated/graphql.cjs.map +1 -0
  35. package/dist/graphql/@generated/graphql.d.cts +642 -0
  36. package/dist/graphql/@generated/graphql.d.cts.map +1 -0
  37. package/dist/graphql/@generated/graphql.d.mts +642 -0
  38. package/dist/graphql/@generated/graphql.d.mts.map +1 -0
  39. package/dist/graphql/@generated/graphql.mjs +1142 -24
  40. package/dist/graphql/@generated/graphql.mjs.map +1 -1
  41. package/dist/{chunk-E5FOLXLN.mjs → graphql/definitions/mutations.cjs} +8 -11
  42. package/dist/graphql/definitions/mutations.cjs.map +1 -0
  43. package/dist/graphql/definitions/mutations.mjs +140 -9
  44. package/dist/graphql/definitions/mutations.mjs.map +1 -1
  45. package/dist/graphql/definitions/queries.cjs +35 -0
  46. package/dist/graphql/definitions/queries.cjs.map +1 -0
  47. package/dist/graphql/definitions/queries.mjs +33 -11
  48. package/dist/graphql/definitions/queries.mjs.map +1 -1
  49. package/dist/index.cjs +43 -0
  50. package/dist/index.d.cts +9 -0
  51. package/dist/index.d.mts +9 -0
  52. package/dist/index.mjs +8 -91
  53. package/dist/index.umd.js +2080 -2
  54. package/dist/index.umd.js.map +1 -1
  55. package/dist/message-conversion/agui-to-gql.cjs +162 -0
  56. package/dist/message-conversion/agui-to-gql.cjs.map +1 -0
  57. package/dist/message-conversion/{agui-to-gql.d.ts → agui-to-gql.d.cts} +6 -5
  58. package/dist/message-conversion/agui-to-gql.d.cts.map +1 -0
  59. package/dist/message-conversion/agui-to-gql.d.mts +14 -0
  60. package/dist/message-conversion/agui-to-gql.d.mts.map +1 -0
  61. package/dist/message-conversion/agui-to-gql.mjs +156 -25
  62. package/dist/message-conversion/agui-to-gql.mjs.map +1 -1
  63. package/dist/message-conversion/gql-to-agui.cjs +169 -0
  64. package/dist/message-conversion/gql-to-agui.cjs.map +1 -0
  65. package/dist/message-conversion/{gql-to-agui.d.ts → gql-to-agui.d.cts} +6 -5
  66. package/dist/message-conversion/gql-to-agui.d.cts.map +1 -0
  67. package/dist/message-conversion/gql-to-agui.d.mts +13 -0
  68. package/dist/message-conversion/gql-to-agui.d.mts.map +1 -0
  69. package/dist/message-conversion/gql-to-agui.mjs +164 -23
  70. package/dist/message-conversion/gql-to-agui.mjs.map +1 -1
  71. package/dist/message-conversion/index.d.cts +2 -0
  72. package/dist/message-conversion/index.d.mts +2 -0
  73. package/dist/package.cjs +12 -0
  74. package/dist/package.cjs.map +1 -0
  75. package/dist/package.mjs +6 -0
  76. package/dist/package.mjs.map +1 -0
  77. package/package.json +15 -15
  78. package/src/message-conversion/agui-to-gql.test.ts +70 -0
  79. package/src/message-conversion/agui-to-gql.ts +4 -0
  80. package/tsdown.config.ts +49 -0
  81. package/vitest.config.mjs +11 -0
  82. package/dist/chunk-2XWNDVTL.mjs +0 -176
  83. package/dist/chunk-2XWNDVTL.mjs.map +0 -1
  84. package/dist/chunk-7ECCT6PK.mjs +0 -1
  85. package/dist/chunk-7ECCT6PK.mjs.map +0 -1
  86. package/dist/chunk-A4INSSNE.mjs +0 -17722
  87. package/dist/chunk-A4INSSNE.mjs.map +0 -1
  88. package/dist/chunk-CA4VMP2C.mjs +0 -1
  89. package/dist/chunk-CA4VMP2C.mjs.map +0 -1
  90. package/dist/chunk-DELDZXUX.mjs +0 -31
  91. package/dist/chunk-DELDZXUX.mjs.map +0 -1
  92. package/dist/chunk-E5FOLXLN.mjs.map +0 -1
  93. package/dist/chunk-LTVE64IE.mjs +0 -241
  94. package/dist/chunk-LTVE64IE.mjs.map +0 -1
  95. package/dist/chunk-M4CK5HDR.mjs +0 -237
  96. package/dist/chunk-M4CK5HDR.mjs.map +0 -1
  97. package/dist/chunk-OBDQ5BWD.mjs +0 -63
  98. package/dist/chunk-OBDQ5BWD.mjs.map +0 -1
  99. package/dist/chunk-QUH7QWUA.mjs +0 -38
  100. package/dist/chunk-QUH7QWUA.mjs.map +0 -1
  101. package/dist/chunk-SDQPJXLL.mjs +0 -20
  102. package/dist/chunk-SDQPJXLL.mjs.map +0 -1
  103. package/dist/chunk-UOAPP5IN.mjs +0 -93
  104. package/dist/chunk-UOAPP5IN.mjs.map +0 -1
  105. package/dist/chunk-VIHKTLUA.mjs +0 -221
  106. package/dist/chunk-VIHKTLUA.mjs.map +0 -1
  107. package/dist/chunk-XZPL6QVK.mjs +0 -24
  108. package/dist/chunk-XZPL6QVK.mjs.map +0 -1
  109. package/dist/client/CopilotRuntimeClient.d.ts +0 -39
  110. package/dist/client/CopilotRuntimeClient.js +0 -366
  111. package/dist/client/CopilotRuntimeClient.js.map +0 -1
  112. package/dist/client/conversion.js +0 -339
  113. package/dist/client/conversion.js.map +0 -1
  114. package/dist/client/index.d.ts +0 -8
  115. package/dist/client/index.js +0 -711
  116. package/dist/client/index.js.map +0 -1
  117. package/dist/client/index.mjs +0 -43
  118. package/dist/client/index.mjs.map +0 -1
  119. package/dist/client/types.d.ts +0 -75
  120. package/dist/client/types.js +0 -132
  121. package/dist/client/types.js.map +0 -1
  122. package/dist/graphql/@generated/fragment-masking.d.ts +0 -22
  123. package/dist/graphql/@generated/fragment-masking.js +0 -50
  124. package/dist/graphql/@generated/fragment-masking.js.map +0 -1
  125. package/dist/graphql/@generated/fragment-masking.mjs +0 -12
  126. package/dist/graphql/@generated/fragment-masking.mjs.map +0 -1
  127. package/dist/graphql/@generated/gql.d.ts +0 -48
  128. package/dist/graphql/@generated/gql.js +0 -45
  129. package/dist/graphql/@generated/gql.js.map +0 -1
  130. package/dist/graphql/@generated/graphql.d.ts +0 -655
  131. package/dist/graphql/@generated/graphql.js +0 -96
  132. package/dist/graphql/@generated/graphql.js.map +0 -1
  133. package/dist/graphql/@generated/index.d.ts +0 -4
  134. package/dist/graphql/@generated/index.js +0 -69
  135. package/dist/graphql/@generated/index.js.map +0 -1
  136. package/dist/graphql/@generated/index.mjs +0 -17
  137. package/dist/graphql/@generated/index.mjs.map +0 -1
  138. package/dist/graphql/definitions/mutations.d.ts +0 -9
  139. package/dist/graphql/definitions/mutations.js +0 -181
  140. package/dist/graphql/definitions/mutations.js.map +0 -1
  141. package/dist/graphql/definitions/queries.d.ts +0 -11
  142. package/dist/graphql/definitions/queries.js +0 -76
  143. package/dist/graphql/definitions/queries.js.map +0 -1
  144. package/dist/index.d.ts +0 -11
  145. package/dist/index.js +0 -1222
  146. package/dist/index.js.map +0 -1
  147. package/dist/index.mjs.map +0 -1
  148. package/dist/magic-string.es-XBKSJO3K.mjs +0 -1389
  149. package/dist/magic-string.es-XBKSJO3K.mjs.map +0 -1
  150. package/dist/message-conversion/agui-to-gql.js +0 -344
  151. package/dist/message-conversion/agui-to-gql.js.map +0 -1
  152. package/dist/message-conversion/agui-to-gql.test.d.ts +0 -2
  153. package/dist/message-conversion/agui-to-gql.test.js +0 -20553
  154. package/dist/message-conversion/agui-to-gql.test.js.map +0 -1
  155. package/dist/message-conversion/agui-to-gql.test.mjs +0 -1137
  156. package/dist/message-conversion/agui-to-gql.test.mjs.map +0 -1
  157. package/dist/message-conversion/gql-to-agui.js +0 -262
  158. package/dist/message-conversion/gql-to-agui.js.map +0 -1
  159. package/dist/message-conversion/gql-to-agui.test.d.ts +0 -2
  160. package/dist/message-conversion/gql-to-agui.test.js +0 -20850
  161. package/dist/message-conversion/gql-to-agui.test.js.map +0 -1
  162. package/dist/message-conversion/gql-to-agui.test.mjs +0 -1447
  163. package/dist/message-conversion/gql-to-agui.test.mjs.map +0 -1
  164. package/dist/message-conversion/index.d.ts +0 -6
  165. package/dist/message-conversion/index.js +0 -563
  166. package/dist/message-conversion/index.js.map +0 -1
  167. package/dist/message-conversion/index.mjs +0 -39
  168. package/dist/message-conversion/index.mjs.map +0 -1
  169. package/dist/message-conversion/roundtrip-conversion.test.d.ts +0 -2
  170. package/dist/message-conversion/roundtrip-conversion.test.js +0 -20095
  171. package/dist/message-conversion/roundtrip-conversion.test.js.map +0 -1
  172. package/dist/message-conversion/roundtrip-conversion.test.mjs +0 -489
  173. package/dist/message-conversion/roundtrip-conversion.test.mjs.map +0 -1
  174. package/jest.config.js +0 -5
  175. package/rollup.config.mjs +0 -62
  176. package/tsup.config.ts +0 -12
@@ -1,711 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/client/index.ts
31
- var client_exports = {};
32
- __export(client_exports, {
33
- ActionExecutionMessage: () => ActionExecutionMessage,
34
- AgentStateMessage: () => AgentStateMessage,
35
- CopilotRuntimeClient: () => CopilotRuntimeClient,
36
- ImageMessage: () => ImageMessage,
37
- Message: () => Message,
38
- ResultMessage: () => ResultMessage,
39
- Role: () => Role,
40
- TextMessage: () => TextMessage,
41
- convertGqlOutputToMessages: () => convertGqlOutputToMessages,
42
- convertMessagesToGqlInput: () => convertMessagesToGqlInput,
43
- filterAdjacentAgentStateMessages: () => filterAdjacentAgentStateMessages,
44
- filterAgentStateMessages: () => filterAgentStateMessages,
45
- langGraphInterruptEvent: () => langGraphInterruptEvent,
46
- loadMessagesFromJsonRepresentation: () => loadMessagesFromJsonRepresentation
47
- });
48
- module.exports = __toCommonJS(client_exports);
49
-
50
- // src/client/CopilotRuntimeClient.ts
51
- var import_core = require("@urql/core");
52
-
53
- // package.json
54
- var version = "1.51.4";
55
-
56
- // src/graphql/@generated/graphql.ts
57
- var MessageRole = /* @__PURE__ */ ((MessageRole2) => {
58
- MessageRole2["Assistant"] = "assistant";
59
- MessageRole2["Developer"] = "developer";
60
- MessageRole2["System"] = "system";
61
- MessageRole2["Tool"] = "tool";
62
- MessageRole2["User"] = "user";
63
- return MessageRole2;
64
- })(MessageRole || {});
65
- var GenerateCopilotResponseDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "generateCopilotResponse" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "data" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "GenerateCopilotResponseInput" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "properties" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "JSONObject" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "generateCopilotResponse" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "data" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "data" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "properties" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "properties" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "runId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "extensions" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "openaiAssistantAPI" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "runId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }] } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "CopilotResponse" } }, "directives": [{ "kind": "Directive", "name": { "kind": "Name", "value": "defer" } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "status" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "BaseResponseStatus" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "code" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "FailedResponseStatus" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "reason" } }, { "kind": "Field", "name": { "kind": "Name", "value": "details" } }] } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "messages" }, "directives": [{ "kind": "Directive", "name": { "kind": "Name", "value": "stream" } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "__typename" } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "BaseMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "BaseMessageOutput" } }, "directives": [{ "kind": "Directive", "name": { "kind": "Name", "value": "defer" } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "status" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "SuccessMessageStatus" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "code" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "FailedMessageStatus" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "code" } }, { "kind": "Field", "name": { "kind": "Name", "value": "reason" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "PendingMessageStatus" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "code" } }] } }] } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "TextMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "content" }, "directives": [{ "kind": "Directive", "name": { "kind": "Name", "value": "stream" } }] }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }, { "kind": "Field", "name": { "kind": "Name", "value": "parentMessageId" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "ImageMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "format" } }, { "kind": "Field", "name": { "kind": "Name", "value": "bytes" } }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }, { "kind": "Field", "name": { "kind": "Name", "value": "parentMessageId" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "ActionExecutionMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "arguments" }, "directives": [{ "kind": "Directive", "name": { "kind": "Name", "value": "stream" } }] }, { "kind": "Field", "name": { "kind": "Name", "value": "parentMessageId" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "ResultMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "result" } }, { "kind": "Field", "name": { "kind": "Name", "value": "actionExecutionId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "actionName" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "AgentStateMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "state" } }, { "kind": "Field", "name": { "kind": "Name", "value": "running" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "nodeName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "runId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "active" } }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "metaEvents" }, "directives": [{ "kind": "Directive", "name": { "kind": "Name", "value": "stream" } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "LangGraphInterruptEvent" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "type" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "CopilotKitLangGraphInterruptEvent" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "type" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "data" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "messages" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "__typename" } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "BaseMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "BaseMessageOutput" } }, "directives": [{ "kind": "Directive", "name": { "kind": "Name", "value": "defer" } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "status" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "SuccessMessageStatus" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "code" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "FailedMessageStatus" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "code" } }, { "kind": "Field", "name": { "kind": "Name", "value": "reason" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "PendingMessageStatus" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "code" } }] } }] } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "TextMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "content" } }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }, { "kind": "Field", "name": { "kind": "Name", "value": "parentMessageId" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "ActionExecutionMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "arguments" } }, { "kind": "Field", "name": { "kind": "Name", "value": "parentMessageId" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "ResultMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "result" } }, { "kind": "Field", "name": { "kind": "Name", "value": "actionExecutionId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "actionName" } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }] } }] } }] } }] } }] } }] };
66
- var AvailableAgentsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "availableAgents" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "availableAgents" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "agents" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "description" } }] } }] } }] } }] };
67
- var LoadAgentStateDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "loadAgentState" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "data" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "LoadAgentStateInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "loadAgentState" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "data" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "data" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "threadExists" } }, { "kind": "Field", "name": { "kind": "Name", "value": "state" } }, { "kind": "Field", "name": { "kind": "Name", "value": "messages" } }] } }] } }] };
68
-
69
- // src/graphql/@generated/gql.ts
70
- var documents = {
71
- "\n mutation generateCopilotResponse(\n $data: GenerateCopilotResponseInput!\n $properties: JSONObject\n ) {\n generateCopilotResponse(data: $data, properties: $properties) {\n threadId\n runId\n extensions {\n openaiAssistantAPI {\n runId\n threadId\n }\n }\n ... on CopilotResponse @defer {\n status {\n ... on BaseResponseStatus {\n code\n }\n ... on FailedResponseStatus {\n reason\n details\n }\n }\n }\n messages @stream {\n __typename\n ... on BaseMessageOutput {\n id\n createdAt\n }\n ... on BaseMessageOutput @defer {\n status {\n ... on SuccessMessageStatus {\n code\n }\n ... on FailedMessageStatus {\n code\n reason\n }\n ... on PendingMessageStatus {\n code\n }\n }\n }\n ... on TextMessageOutput {\n content @stream\n role\n parentMessageId\n }\n ... on ImageMessageOutput {\n format\n bytes\n role\n parentMessageId\n }\n ... on ActionExecutionMessageOutput {\n name\n arguments @stream\n parentMessageId\n }\n ... on ResultMessageOutput {\n result\n actionExecutionId\n actionName\n }\n ... on AgentStateMessageOutput {\n threadId\n state\n running\n agentName\n nodeName\n runId\n active\n role\n }\n }\n metaEvents @stream {\n ... on LangGraphInterruptEvent {\n type\n name\n value\n }\n\n ... on CopilotKitLangGraphInterruptEvent {\n type\n name\n data {\n messages {\n __typename\n ... on BaseMessageOutput {\n id\n createdAt\n }\n ... on BaseMessageOutput @defer {\n status {\n ... on SuccessMessageStatus {\n code\n }\n ... on FailedMessageStatus {\n code\n reason\n }\n ... on PendingMessageStatus {\n code\n }\n }\n }\n ... on TextMessageOutput {\n content\n role\n parentMessageId\n }\n ... on ActionExecutionMessageOutput {\n name\n arguments\n parentMessageId\n }\n ... on ResultMessageOutput {\n result\n actionExecutionId\n actionName\n }\n }\n value\n }\n }\n }\n }\n }\n": GenerateCopilotResponseDocument,
72
- "\n query availableAgents {\n availableAgents {\n agents {\n name\n id\n description\n }\n }\n }\n": AvailableAgentsDocument,
73
- "\n query loadAgentState($data: LoadAgentStateInput!) {\n loadAgentState(data: $data) {\n threadId\n threadExists\n state\n messages\n }\n }\n": LoadAgentStateDocument
74
- };
75
- function graphql(source) {
76
- return documents[source] ?? {};
77
- }
78
-
79
- // src/graphql/definitions/mutations.ts
80
- var generateCopilotResponseMutation = graphql(
81
- /** GraphQL **/
82
- `
83
- mutation generateCopilotResponse(
84
- $data: GenerateCopilotResponseInput!
85
- $properties: JSONObject
86
- ) {
87
- generateCopilotResponse(data: $data, properties: $properties) {
88
- threadId
89
- runId
90
- extensions {
91
- openaiAssistantAPI {
92
- runId
93
- threadId
94
- }
95
- }
96
- ... on CopilotResponse @defer {
97
- status {
98
- ... on BaseResponseStatus {
99
- code
100
- }
101
- ... on FailedResponseStatus {
102
- reason
103
- details
104
- }
105
- }
106
- }
107
- messages @stream {
108
- __typename
109
- ... on BaseMessageOutput {
110
- id
111
- createdAt
112
- }
113
- ... on BaseMessageOutput @defer {
114
- status {
115
- ... on SuccessMessageStatus {
116
- code
117
- }
118
- ... on FailedMessageStatus {
119
- code
120
- reason
121
- }
122
- ... on PendingMessageStatus {
123
- code
124
- }
125
- }
126
- }
127
- ... on TextMessageOutput {
128
- content @stream
129
- role
130
- parentMessageId
131
- }
132
- ... on ImageMessageOutput {
133
- format
134
- bytes
135
- role
136
- parentMessageId
137
- }
138
- ... on ActionExecutionMessageOutput {
139
- name
140
- arguments @stream
141
- parentMessageId
142
- }
143
- ... on ResultMessageOutput {
144
- result
145
- actionExecutionId
146
- actionName
147
- }
148
- ... on AgentStateMessageOutput {
149
- threadId
150
- state
151
- running
152
- agentName
153
- nodeName
154
- runId
155
- active
156
- role
157
- }
158
- }
159
- metaEvents @stream {
160
- ... on LangGraphInterruptEvent {
161
- type
162
- name
163
- value
164
- }
165
-
166
- ... on CopilotKitLangGraphInterruptEvent {
167
- type
168
- name
169
- data {
170
- messages {
171
- __typename
172
- ... on BaseMessageOutput {
173
- id
174
- createdAt
175
- }
176
- ... on BaseMessageOutput @defer {
177
- status {
178
- ... on SuccessMessageStatus {
179
- code
180
- }
181
- ... on FailedMessageStatus {
182
- code
183
- reason
184
- }
185
- ... on PendingMessageStatus {
186
- code
187
- }
188
- }
189
- }
190
- ... on TextMessageOutput {
191
- content
192
- role
193
- parentMessageId
194
- }
195
- ... on ActionExecutionMessageOutput {
196
- name
197
- arguments
198
- parentMessageId
199
- }
200
- ... on ResultMessageOutput {
201
- result
202
- actionExecutionId
203
- actionName
204
- }
205
- }
206
- value
207
- }
208
- }
209
- }
210
- }
211
- }
212
- `
213
- );
214
-
215
- // src/graphql/definitions/queries.ts
216
- var getAvailableAgentsQuery = graphql(
217
- /** GraphQL **/
218
- `
219
- query availableAgents {
220
- availableAgents {
221
- agents {
222
- name
223
- id
224
- description
225
- }
226
- }
227
- }
228
- `
229
- );
230
- var loadAgentStateQuery = graphql(
231
- /** GraphQL **/
232
- `
233
- query loadAgentState($data: LoadAgentStateInput!) {
234
- loadAgentState(data: $data) {
235
- threadId
236
- threadExists
237
- state
238
- messages
239
- }
240
- }
241
- `
242
- );
243
-
244
- // src/client/CopilotRuntimeClient.ts
245
- var import_shared = require("@copilotkit/shared");
246
- var createFetchFn = (signal, handleGQLWarning) => async (...args) => {
247
- var _a, _b;
248
- const publicApiKey = (_b = (_a = args[1]) == null ? void 0 : _a.headers) == null ? void 0 : _b["x-copilotcloud-public-api-key"];
249
- try {
250
- const result = await fetch(args[0], { ...args[1] ?? {}, signal });
251
- const mismatch = publicApiKey ? null : await (0, import_shared.getPossibleVersionMismatch)({
252
- runtimeVersion: result.headers.get("X-CopilotKit-Runtime-Version"),
253
- runtimeClientGqlVersion: version
254
- });
255
- if (result.status !== 200) {
256
- if (result.status >= 400 && result.status <= 500) {
257
- if (mismatch) {
258
- throw new import_shared.CopilotKitVersionMismatchError(mismatch);
259
- }
260
- throw new import_shared.ResolvedCopilotKitError({ status: result.status });
261
- }
262
- }
263
- if (mismatch && handleGQLWarning) {
264
- handleGQLWarning(mismatch.message);
265
- }
266
- return result;
267
- } catch (error) {
268
- if (error.message.includes("BodyStreamBuffer was aborted") || error.message.includes("signal is aborted without reason")) {
269
- throw error;
270
- }
271
- if (error instanceof import_shared.CopilotKitError) {
272
- throw error;
273
- }
274
- throw new import_shared.CopilotKitLowLevelError({
275
- error,
276
- url: args[0]
277
- });
278
- }
279
- };
280
- var CopilotRuntimeClient = class {
281
- constructor(options) {
282
- const headers = {};
283
- this.handleGQLErrors = options.handleGQLErrors;
284
- this.handleGQLWarning = options.handleGQLWarning;
285
- if (options.headers) {
286
- Object.assign(headers, options.headers);
287
- }
288
- if (options.publicApiKey) {
289
- headers["x-copilotcloud-public-api-key"] = options.publicApiKey;
290
- }
291
- this.client = new import_core.Client({
292
- url: options.url,
293
- exchanges: [import_core.cacheExchange, import_core.fetchExchange],
294
- fetchOptions: {
295
- headers: {
296
- ...headers,
297
- "X-CopilotKit-Runtime-Client-GQL-Version": version
298
- },
299
- ...options.credentials ? { credentials: options.credentials } : {}
300
- }
301
- });
302
- }
303
- generateCopilotResponse({
304
- data,
305
- properties,
306
- signal
307
- }) {
308
- const fetchFn = createFetchFn(signal, this.handleGQLWarning);
309
- const result = this.client.mutation(
310
- generateCopilotResponseMutation,
311
- { data, properties },
312
- { fetch: fetchFn }
313
- );
314
- return result;
315
- }
316
- asStream(source) {
317
- const handleGQLErrors = this.handleGQLErrors;
318
- return new ReadableStream({
319
- start(controller) {
320
- source.subscribe(({ data, hasNext, error }) => {
321
- var _a;
322
- if (error) {
323
- if (error.message.includes("BodyStreamBuffer was aborted") || error.message.includes("signal is aborted without reason")) {
324
- if (!hasNext)
325
- controller.close();
326
- console.warn("Abort error suppressed");
327
- return;
328
- }
329
- if ((_a = error.extensions) == null ? void 0 : _a.visibility) {
330
- const syntheticError = {
331
- ...error,
332
- graphQLErrors: [
333
- {
334
- message: error.message,
335
- extensions: error.extensions
336
- }
337
- ]
338
- };
339
- if (handleGQLErrors) {
340
- handleGQLErrors(syntheticError);
341
- }
342
- return;
343
- }
344
- controller.error(error);
345
- if (handleGQLErrors) {
346
- handleGQLErrors(error);
347
- }
348
- } else {
349
- controller.enqueue(data);
350
- if (!hasNext) {
351
- controller.close();
352
- }
353
- }
354
- });
355
- }
356
- });
357
- }
358
- availableAgents() {
359
- const fetchFn = createFetchFn();
360
- return this.client.query(
361
- getAvailableAgentsQuery,
362
- {},
363
- { fetch: fetchFn }
364
- );
365
- }
366
- loadAgentState(data) {
367
- const fetchFn = createFetchFn();
368
- const result = this.client.query(
369
- loadAgentStateQuery,
370
- { data },
371
- { fetch: fetchFn }
372
- );
373
- result.toPromise().then(({ error }) => {
374
- if (error && this.handleGQLErrors) {
375
- this.handleGQLErrors(error);
376
- }
377
- }).catch(() => {
378
- });
379
- return result;
380
- }
381
- static removeGraphQLTypename(data) {
382
- if (Array.isArray(data)) {
383
- data.forEach((item) => CopilotRuntimeClient.removeGraphQLTypename(item));
384
- } else if (typeof data === "object" && data !== null) {
385
- delete data.__typename;
386
- Object.keys(data).forEach((key) => {
387
- if (typeof data[key] === "object" && data[key] !== null) {
388
- CopilotRuntimeClient.removeGraphQLTypename(data[key]);
389
- }
390
- });
391
- }
392
- return data;
393
- }
394
- };
395
-
396
- // src/client/types.ts
397
- var import_shared2 = require("@copilotkit/shared");
398
- var import_shared3 = require("@copilotkit/shared");
399
- var Message = class {
400
- constructor(props) {
401
- props.id ?? (props.id = (0, import_shared2.randomId)());
402
- props.status ?? (props.status = { code: "Success" /* Success */ });
403
- props.createdAt ?? (props.createdAt = /* @__PURE__ */ new Date());
404
- Object.assign(this, props);
405
- }
406
- isTextMessage() {
407
- return this.type === "TextMessage";
408
- }
409
- isActionExecutionMessage() {
410
- return this.type === "ActionExecutionMessage";
411
- }
412
- isResultMessage() {
413
- return this.type === "ResultMessage";
414
- }
415
- isAgentStateMessage() {
416
- return this.type === "AgentStateMessage";
417
- }
418
- isImageMessage() {
419
- return this.type === "ImageMessage";
420
- }
421
- };
422
- var Role = MessageRole;
423
- var TextMessage = class extends Message {
424
- constructor(props) {
425
- super(props);
426
- this.type = "TextMessage";
427
- this.type = "TextMessage";
428
- }
429
- };
430
- var ActionExecutionMessage = class extends Message {
431
- constructor(props) {
432
- super(props);
433
- this.type = "ActionExecutionMessage";
434
- }
435
- };
436
- var ResultMessage = class extends Message {
437
- constructor(props) {
438
- super(props);
439
- this.type = "ResultMessage";
440
- }
441
- static decodeResult(result) {
442
- return (0, import_shared3.parseJson)(result, result);
443
- }
444
- static encodeResult(result) {
445
- if (result === void 0) {
446
- return "";
447
- } else if (typeof result === "string") {
448
- return result;
449
- } else {
450
- return JSON.stringify(result);
451
- }
452
- }
453
- };
454
- var AgentStateMessage = class extends Message {
455
- constructor(props) {
456
- super(props);
457
- this.type = "AgentStateMessage";
458
- }
459
- };
460
- var ImageMessage = class extends Message {
461
- constructor(props) {
462
- super(props);
463
- this.type = "ImageMessage";
464
- }
465
- };
466
- function langGraphInterruptEvent(eventProps) {
467
- return {
468
- ...eventProps,
469
- name: "LangGraphInterruptEvent" /* LangGraphInterruptEvent */,
470
- type: "MetaEvent"
471
- };
472
- }
473
-
474
- // src/client/conversion.ts
475
- var import_untruncate_json = __toESM(require("untruncate-json"));
476
- var import_shared4 = require("@copilotkit/shared");
477
- function filterAgentStateMessages(messages) {
478
- return messages.filter((message) => !message.isAgentStateMessage());
479
- }
480
- function convertMessagesToGqlInput(messages) {
481
- return messages.map((message) => {
482
- if (message.isTextMessage()) {
483
- return {
484
- id: message.id,
485
- createdAt: message.createdAt,
486
- textMessage: {
487
- content: message.content,
488
- role: message.role,
489
- parentMessageId: message.parentMessageId
490
- }
491
- };
492
- } else if (message.isActionExecutionMessage()) {
493
- return {
494
- id: message.id,
495
- createdAt: message.createdAt,
496
- actionExecutionMessage: {
497
- name: message.name,
498
- arguments: JSON.stringify(message.arguments),
499
- parentMessageId: message.parentMessageId
500
- }
501
- };
502
- } else if (message.isResultMessage()) {
503
- return {
504
- id: message.id,
505
- createdAt: message.createdAt,
506
- resultMessage: {
507
- result: message.result,
508
- actionExecutionId: message.actionExecutionId,
509
- actionName: message.actionName
510
- }
511
- };
512
- } else if (message.isAgentStateMessage()) {
513
- return {
514
- id: message.id,
515
- createdAt: message.createdAt,
516
- agentStateMessage: {
517
- threadId: message.threadId,
518
- role: message.role,
519
- agentName: message.agentName,
520
- nodeName: message.nodeName,
521
- runId: message.runId,
522
- active: message.active,
523
- running: message.running,
524
- state: JSON.stringify(message.state)
525
- }
526
- };
527
- } else if (message.isImageMessage()) {
528
- return {
529
- id: message.id,
530
- createdAt: message.createdAt,
531
- imageMessage: {
532
- format: message.format,
533
- bytes: message.bytes,
534
- role: message.role,
535
- parentMessageId: message.parentMessageId
536
- }
537
- };
538
- } else {
539
- throw new Error("Unknown message type");
540
- }
541
- });
542
- }
543
- function filterAdjacentAgentStateMessages(messages) {
544
- const filteredMessages = [];
545
- messages.forEach((message, i) => {
546
- if (message.__typename !== "AgentStateMessageOutput") {
547
- filteredMessages.push(message);
548
- } else {
549
- const prevAgentStateMessageIndex = filteredMessages.findIndex(
550
- // TODO: also check runId
551
- (m) => m.__typename === "AgentStateMessageOutput" && m.agentName === message.agentName
552
- );
553
- if (prevAgentStateMessageIndex === -1) {
554
- filteredMessages.push(message);
555
- } else {
556
- filteredMessages[prevAgentStateMessageIndex] = message;
557
- }
558
- }
559
- });
560
- return filteredMessages;
561
- }
562
- function convertGqlOutputToMessages(messages) {
563
- return messages.map((message) => {
564
- if (message.__typename === "TextMessageOutput") {
565
- return new TextMessage({
566
- id: message.id,
567
- role: message.role,
568
- content: message.content.join(""),
569
- parentMessageId: message.parentMessageId,
570
- createdAt: /* @__PURE__ */ new Date(),
571
- status: message.status || { code: "Pending" /* Pending */ }
572
- });
573
- } else if (message.__typename === "ActionExecutionMessageOutput") {
574
- return new ActionExecutionMessage({
575
- id: message.id,
576
- name: message.name,
577
- arguments: getPartialArguments(message.arguments),
578
- parentMessageId: message.parentMessageId,
579
- createdAt: /* @__PURE__ */ new Date(),
580
- status: message.status || { code: "Pending" /* Pending */ }
581
- });
582
- } else if (message.__typename === "ResultMessageOutput") {
583
- return new ResultMessage({
584
- id: message.id,
585
- result: message.result,
586
- actionExecutionId: message.actionExecutionId,
587
- actionName: message.actionName,
588
- createdAt: /* @__PURE__ */ new Date(),
589
- status: message.status || { code: "Pending" /* Pending */ }
590
- });
591
- } else if (message.__typename === "AgentStateMessageOutput") {
592
- return new AgentStateMessage({
593
- id: message.id,
594
- threadId: message.threadId,
595
- role: message.role,
596
- agentName: message.agentName,
597
- nodeName: message.nodeName,
598
- runId: message.runId,
599
- active: message.active,
600
- running: message.running,
601
- state: (0, import_shared4.parseJson)(message.state, {}),
602
- createdAt: /* @__PURE__ */ new Date()
603
- });
604
- } else if (message.__typename === "ImageMessageOutput") {
605
- return new ImageMessage({
606
- id: message.id,
607
- format: message.format,
608
- bytes: message.bytes,
609
- role: message.role,
610
- parentMessageId: message.parentMessageId,
611
- createdAt: /* @__PURE__ */ new Date(),
612
- status: message.status || { code: "Pending" /* Pending */ }
613
- });
614
- }
615
- throw new Error("Unknown message type");
616
- });
617
- }
618
- function loadMessagesFromJsonRepresentation(json) {
619
- const result = [];
620
- for (const item of json) {
621
- if ("content" in item) {
622
- result.push(
623
- new TextMessage({
624
- id: item.id,
625
- role: item.role,
626
- content: item.content,
627
- parentMessageId: item.parentMessageId,
628
- createdAt: item.createdAt || /* @__PURE__ */ new Date(),
629
- status: item.status || { code: "Success" /* Success */ }
630
- })
631
- );
632
- } else if ("arguments" in item) {
633
- result.push(
634
- new ActionExecutionMessage({
635
- id: item.id,
636
- name: item.name,
637
- arguments: item.arguments,
638
- parentMessageId: item.parentMessageId,
639
- createdAt: item.createdAt || /* @__PURE__ */ new Date(),
640
- status: item.status || { code: "Success" /* Success */ }
641
- })
642
- );
643
- } else if ("result" in item) {
644
- result.push(
645
- new ResultMessage({
646
- id: item.id,
647
- result: item.result,
648
- actionExecutionId: item.actionExecutionId,
649
- actionName: item.actionName,
650
- createdAt: item.createdAt || /* @__PURE__ */ new Date(),
651
- status: item.status || { code: "Success" /* Success */ }
652
- })
653
- );
654
- } else if ("state" in item) {
655
- result.push(
656
- new AgentStateMessage({
657
- id: item.id,
658
- threadId: item.threadId,
659
- role: item.role,
660
- agentName: item.agentName,
661
- nodeName: item.nodeName,
662
- runId: item.runId,
663
- active: item.active,
664
- running: item.running,
665
- state: item.state,
666
- createdAt: item.createdAt || /* @__PURE__ */ new Date()
667
- })
668
- );
669
- } else if ("format" in item && "bytes" in item) {
670
- result.push(
671
- new ImageMessage({
672
- id: item.id,
673
- format: item.format,
674
- bytes: item.bytes,
675
- role: item.role,
676
- parentMessageId: item.parentMessageId,
677
- createdAt: item.createdAt || /* @__PURE__ */ new Date(),
678
- status: item.status || { code: "Success" /* Success */ }
679
- })
680
- );
681
- }
682
- }
683
- return result;
684
- }
685
- function getPartialArguments(args) {
686
- try {
687
- if (!args.length)
688
- return {};
689
- return JSON.parse((0, import_untruncate_json.default)(args.join("")));
690
- } catch (e) {
691
- return {};
692
- }
693
- }
694
- // Annotate the CommonJS export names for ESM import in node:
695
- 0 && (module.exports = {
696
- ActionExecutionMessage,
697
- AgentStateMessage,
698
- CopilotRuntimeClient,
699
- ImageMessage,
700
- Message,
701
- ResultMessage,
702
- Role,
703
- TextMessage,
704
- convertGqlOutputToMessages,
705
- convertMessagesToGqlInput,
706
- filterAdjacentAgentStateMessages,
707
- filterAgentStateMessages,
708
- langGraphInterruptEvent,
709
- loadMessagesFromJsonRepresentation
710
- });
711
- //# sourceMappingURL=index.js.map