@copilotkit/runtime-client-gql 1.5.12-next.5 → 1.5.12-next.7

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 (57) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/chunk-2ELGSDSD.mjs +56 -0
  3. package/dist/chunk-2ELGSDSD.mjs.map +1 -0
  4. package/dist/chunk-4MIKTV2N.mjs +38 -0
  5. package/dist/chunk-4MIKTV2N.mjs.map +1 -0
  6. package/dist/{chunk-AXHVBZ73.mjs → chunk-F7V6U3R3.mjs} +2 -2
  7. package/dist/{chunk-IZDC2R6Y.mjs → chunk-LK6RTPT6.mjs} +2 -2
  8. package/dist/{chunk-3BOGJG6W.mjs → chunk-NXTNLFRB.mjs} +8 -2
  9. package/dist/chunk-NXTNLFRB.mjs.map +1 -0
  10. package/dist/chunk-PS3E6BAR.mjs +20 -0
  11. package/dist/chunk-PS3E6BAR.mjs.map +1 -0
  12. package/dist/{chunk-YM67LRWL.mjs → chunk-YFTCY2SE.mjs} +35 -15
  13. package/dist/chunk-YFTCY2SE.mjs.map +1 -0
  14. package/dist/client/CopilotRuntimeClient.d.ts +6 -1
  15. package/dist/client/CopilotRuntimeClient.js +54 -14
  16. package/dist/client/CopilotRuntimeClient.js.map +1 -1
  17. package/dist/client/CopilotRuntimeClient.mjs +5 -5
  18. package/dist/client/conversion.d.ts +1 -1
  19. package/dist/client/conversion.mjs +3 -3
  20. package/dist/client/index.d.ts +1 -1
  21. package/dist/client/index.js +56 -16
  22. package/dist/client/index.js.map +1 -1
  23. package/dist/client/index.mjs +7 -7
  24. package/dist/client/types.d.ts +1 -1
  25. package/dist/client/types.js.map +1 -1
  26. package/dist/client/types.mjs +2 -2
  27. package/dist/graphql/definitions/mutations.d.ts +1 -1
  28. package/dist/graphql/definitions/mutations.js +11 -3
  29. package/dist/graphql/definitions/mutations.js.map +1 -1
  30. package/dist/graphql/definitions/mutations.mjs +3 -3
  31. package/dist/graphql/definitions/queries.d.ts +5 -2
  32. package/dist/graphql/definitions/queries.js +22 -5
  33. package/dist/graphql/definitions/queries.js.map +1 -1
  34. package/dist/graphql/definitions/queries.mjs +7 -5
  35. package/dist/{graphql-21970cc1.d.ts → graphql-7b124e21.d.ts} +56 -1
  36. package/dist/index.d.ts +1 -1
  37. package/dist/index.js +58 -16
  38. package/dist/index.js.map +1 -1
  39. package/dist/index.mjs +9 -7
  40. package/package.json +3 -3
  41. package/src/client/CopilotRuntimeClient.ts +33 -11
  42. package/src/graphql/@generated/gql.ts +7 -2
  43. package/src/graphql/@generated/graphql.ts +52 -3
  44. package/src/graphql/definitions/mutations.ts +6 -0
  45. package/src/graphql/definitions/queries.ts +11 -0
  46. package/dist/chunk-256E264G.mjs +0 -24
  47. package/dist/chunk-256E264G.mjs.map +0 -1
  48. package/dist/chunk-3BOGJG6W.mjs.map +0 -1
  49. package/dist/chunk-AOS57GRG.mjs +0 -54
  50. package/dist/chunk-AOS57GRG.mjs.map +0 -1
  51. package/dist/chunk-WK75ISB2.mjs +0 -18
  52. package/dist/chunk-WK75ISB2.mjs.map +0 -1
  53. package/dist/chunk-YM67LRWL.mjs.map +0 -1
  54. package/tsup.config.bundled_0x2kmnt4uwn.mjs +0 -59
  55. package/tsup.config.bundled_qpx2b969p4.mjs +0 -59
  56. /package/dist/{chunk-AXHVBZ73.mjs.map → chunk-F7V6U3R3.mjs.map} +0 -0
  57. /package/dist/{chunk-IZDC2R6Y.mjs.map → chunk-LK6RTPT6.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -38,6 +38,7 @@ __export(src_exports, {
38
38
  CopilotRuntimeClient: () => CopilotRuntimeClient,
39
39
  FailedResponseStatusReason: () => FailedResponseStatusReason,
40
40
  GenerateCopilotResponseDocument: () => GenerateCopilotResponseDocument,
41
+ LoadAgentStateDocument: () => LoadAgentStateDocument,
41
42
  Message: () => Message,
42
43
  MessageRole: () => MessageRole,
43
44
  MessageStatusCode: () => MessageStatusCode,
@@ -57,7 +58,7 @@ module.exports = __toCommonJS(src_exports);
57
58
  var import_core = require("@urql/core");
58
59
 
59
60
  // package.json
60
- var version = "1.5.12-next.5";
61
+ var version = "1.5.12-next.7";
61
62
 
62
63
  // src/graphql/@generated/graphql.ts
63
64
  var ActionInputAvailability = /* @__PURE__ */ ((ActionInputAvailability2) => {
@@ -99,13 +100,15 @@ var ResponseStatusCode = /* @__PURE__ */ ((ResponseStatusCode2) => {
99
100
  ResponseStatusCode2["Success"] = "Success";
100
101
  return ResponseStatusCode2;
101
102
  })(ResponseStatusCode || {});
102
- 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": "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": "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" } }] } }] } }] } }] } }] };
103
+ 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": "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" } }] } }] } }] } }] } }] };
103
104
  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" } }] } }] } }] } }] };
105
+ 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" } }] } }] } }] };
104
106
 
105
107
  // src/graphql/@generated/gql.ts
106
108
  var documents = {
107
- "\n mutation generateCopilotResponse($data: GenerateCopilotResponseInput!, $properties: JSONObject) {\n generateCopilotResponse(data: $data, properties: $properties) {\n threadId\n runId\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 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 }\n }\n": GenerateCopilotResponseDocument,
108
- "\n query availableAgents {\n availableAgents {\n agents {\n name\n id\n description\n }\n }\n }\n": AvailableAgentsDocument
109
+ "\n mutation generateCopilotResponse($data: GenerateCopilotResponseInput!, $properties: JSONObject) {\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 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 }\n }\n": GenerateCopilotResponseDocument,
110
+ "\n query availableAgents {\n availableAgents {\n agents {\n name\n id\n description\n }\n }\n }\n": AvailableAgentsDocument,
111
+ "\n query loadAgentState($data: LoadAgentStateInput!) {\n loadAgentState(data: $data) {\n threadId\n threadExists\n state\n messages\n }\n }\n": LoadAgentStateDocument
109
112
  };
110
113
  function graphql(source) {
111
114
  return documents[source] ?? {};
@@ -119,6 +122,12 @@ var generateCopilotResponseMutation = graphql(
119
122
  generateCopilotResponse(data: $data, properties: $properties) {
120
123
  threadId
121
124
  runId
125
+ extensions {
126
+ openaiAssistantAPI {
127
+ runId
128
+ threadId
129
+ }
130
+ }
122
131
  ... on CopilotResponse @defer {
123
132
  status {
124
133
  ... on BaseResponseStatus {
@@ -196,21 +205,32 @@ var getAvailableAgentsQuery = graphql(
196
205
  }
197
206
  `
198
207
  );
208
+ var loadAgentStateQuery = graphql(
209
+ /** GraphQL **/
210
+ `
211
+ query loadAgentState($data: LoadAgentStateInput!) {
212
+ loadAgentState(data: $data) {
213
+ threadId
214
+ threadExists
215
+ state
216
+ messages
217
+ }
218
+ }
219
+ `
220
+ );
199
221
 
200
222
  // src/client/CopilotRuntimeClient.ts
223
+ var import_shared = require("@copilotkit/shared");
201
224
  var createFetchFn = (signal) => async (...args) => {
202
- const result = await fetch(args[0], { ...args[1] ?? {}, signal });
203
- if (result.status !== 200) {
204
- switch (result.status) {
205
- case 404:
206
- throw new Error(
207
- "Runtime URL seems to be invalid - got 404 response. Please check the runtimeUrl passed to CopilotKit"
208
- );
209
- default:
210
- throw new Error("Could not fetch copilot response");
225
+ try {
226
+ const result = await fetch(args[0], { ...args[1] ?? {}, signal });
227
+ if (result.status !== 200) {
228
+ throw new import_shared.ResolvedCopilotKitError({ status: result.status });
211
229
  }
230
+ return result;
231
+ } catch (error) {
232
+ throw new import_shared.CopilotKitLowLevelError({ error, url: args[0] });
212
233
  }
213
- return result;
214
234
  };
215
235
  var CopilotRuntimeClient = class {
216
236
  constructor(options) {
@@ -271,13 +291,34 @@ var CopilotRuntimeClient = class {
271
291
  const fetchFn = createFetchFn();
272
292
  return this.client.query(getAvailableAgentsQuery, {}, { fetch: fetchFn });
273
293
  }
294
+ loadAgentState(data) {
295
+ const fetchFn = createFetchFn();
296
+ return this.client.query(
297
+ loadAgentStateQuery,
298
+ { data },
299
+ { fetch: fetchFn }
300
+ );
301
+ }
302
+ static removeGraphQLTypename(data) {
303
+ if (Array.isArray(data)) {
304
+ data.forEach((item) => CopilotRuntimeClient.removeGraphQLTypename(item));
305
+ } else if (typeof data === "object" && data !== null) {
306
+ delete data.__typename;
307
+ Object.keys(data).forEach((key) => {
308
+ if (typeof data[key] === "object" && data[key] !== null) {
309
+ CopilotRuntimeClient.removeGraphQLTypename(data[key]);
310
+ }
311
+ });
312
+ }
313
+ return data;
314
+ }
274
315
  };
275
316
 
276
317
  // src/client/types.ts
277
- var import_shared = require("@copilotkit/shared");
318
+ var import_shared2 = require("@copilotkit/shared");
278
319
  var Message = class {
279
320
  constructor(props) {
280
- props.id ?? (props.id = (0, import_shared.randomId)());
321
+ props.id ?? (props.id = (0, import_shared2.randomId)());
281
322
  props.status ?? (props.status = { code: "Success" /* Success */ });
282
323
  props.createdAt ?? (props.createdAt = /* @__PURE__ */ new Date());
283
324
  Object.assign(this, props);
@@ -531,6 +572,7 @@ function getPartialArguments(args) {
531
572
  CopilotRuntimeClient,
532
573
  FailedResponseStatusReason,
533
574
  GenerateCopilotResponseDocument,
575
+ LoadAgentStateDocument,
534
576
  Message,
535
577
  MessageRole,
536
578
  MessageStatusCode,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/client/CopilotRuntimeClient.ts","../package.json","../src/graphql/@generated/graphql.ts","../src/graphql/@generated/gql.ts","../src/graphql/definitions/mutations.ts","../src/graphql/definitions/queries.ts","../src/client/types.ts","../src/client/conversion.ts"],"sourcesContent":["export * from \"./client\";\nexport * from \"./graphql/@generated/graphql\";\n","import {\n Client,\n cacheExchange,\n fetchExchange,\n mapExchange,\n CombinedError,\n Operation,\n} from \"@urql/core\";\nimport * as packageJson from \"../../package.json\";\n\nimport {\n AvailableAgentsQuery,\n GenerateCopilotResponseMutation,\n GenerateCopilotResponseMutationVariables,\n} from \"../graphql/@generated/graphql\";\nimport { generateCopilotResponseMutation } from \"../graphql/definitions/mutations\";\nimport { getAvailableAgentsQuery } from \"../graphql/definitions/queries\";\nimport { OperationResultSource, OperationResult } from \"urql\";\n\nconst createFetchFn =\n (signal?: AbortSignal) =>\n async (...args: Parameters<typeof fetch>) => {\n const result = await fetch(args[0], { ...(args[1] ?? {}), signal });\n if (result.status !== 200) {\n switch (result.status) {\n case 404:\n throw new Error(\n \"Runtime URL seems to be invalid - got 404 response. Please check the runtimeUrl passed to CopilotKit\",\n );\n default:\n throw new Error(\"Could not fetch copilot response\");\n }\n }\n return result;\n };\n\nexport interface CopilotRuntimeClientOptions {\n url: string;\n publicApiKey?: string;\n headers?: Record<string, string>;\n credentials?: RequestCredentials;\n handleGQLErrors?: (error: Error) => void;\n}\n\nexport class CopilotRuntimeClient {\n client: Client;\n public handleGQLErrors?: (error: Error) => void;\n\n constructor(options: CopilotRuntimeClientOptions) {\n const headers: Record<string, string> = {};\n\n this.handleGQLErrors = options.handleGQLErrors;\n\n if (options.headers) {\n Object.assign(headers, options.headers);\n }\n\n if (options.publicApiKey) {\n headers[\"x-copilotcloud-public-api-key\"] = options.publicApiKey;\n }\n\n this.client = new Client({\n url: options.url,\n exchanges: [cacheExchange, fetchExchange],\n fetchOptions: {\n headers: {\n ...headers,\n \"X-CopilotKit-Runtime-Client-GQL-Version\": packageJson.version,\n },\n ...(options.credentials ? { credentials: options.credentials } : {}),\n },\n });\n }\n\n generateCopilotResponse({\n data,\n properties,\n signal,\n }: {\n data: GenerateCopilotResponseMutationVariables[\"data\"];\n properties?: GenerateCopilotResponseMutationVariables[\"properties\"];\n signal?: AbortSignal;\n }) {\n const fetchFn = createFetchFn(signal);\n const result = this.client.mutation<\n GenerateCopilotResponseMutation,\n GenerateCopilotResponseMutationVariables\n >(generateCopilotResponseMutation, { data, properties }, { fetch: fetchFn });\n\n return result;\n }\n\n public asStream<S, T>(source: OperationResultSource<OperationResult<S, { data: T }>>) {\n const handleGQLErrors = this.handleGQLErrors;\n return new ReadableStream<S>({\n start(controller) {\n source.subscribe(({ data, hasNext, error }) => {\n if (error) {\n if (\n error.message.includes(\"BodyStreamBuffer was aborted\") ||\n error.message.includes(\"signal is aborted without reason\")\n ) {\n // Suppress this specific error\n console.warn(\"Abort error suppressed\");\n return;\n }\n controller.error(error);\n if (handleGQLErrors) {\n handleGQLErrors(error);\n }\n } else {\n controller.enqueue(data);\n if (!hasNext) {\n controller.close();\n }\n }\n });\n },\n });\n }\n\n availableAgents() {\n const fetchFn = createFetchFn();\n return this.client.query<AvailableAgentsQuery>(getAvailableAgentsQuery, {}, { fetch: fetchFn });\n }\n}\n","{\n \"name\": \"@copilotkit/runtime-client-gql\",\n \"private\": false,\n \"homepage\": \"https://github.com/CopilotKit/CopilotKit\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/CopilotKit/CopilotKit.git\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"version\": \"1.5.12-next.5\",\n \"sideEffects\": false,\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"types\": \"./dist/index.d.ts\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"tsup --clean\",\n \"dev\": \"tsup --watch --no-splitting\",\n \"test\": \"jest --passWithNoTests\",\n \"check-types\": \"tsc --noEmit\",\n \"clean\": \"rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next\",\n \"graphql-codegen\": \"graphql-codegen\",\n \"graphql-codegen:watch\": \"graphql-codegen --watch\",\n \"link:global\": \"pnpm link --global\",\n \"unlink:global\": \"pnpm unlink --global\"\n },\n \"peerDependencies\": {\n \"react\": \"^18 || ^19 || ^19.0.0-rc\"\n },\n \"devDependencies\": {\n \"@graphql-codegen/cli\": \"^5.0.2\",\n \"@graphql-codegen/client-preset\": \"^4.2.6\",\n \"@graphql-codegen/introspection\": \"^4.0.3\",\n \"@graphql-codegen/typescript\": \"^4.0.7\",\n \"@graphql-codegen/typescript-operations\": \"^4.2.1\",\n \"@graphql-codegen/typescript-urql\": \"^4.0.0\",\n \"@graphql-codegen/urql-introspection\": \"^3.0.0\",\n \"@graphql-typed-document-node/core\": \"^3.2.0\",\n \"@parcel/watcher\": \"^2.4.1\",\n \"@types/node\": \"^20.12.12\",\n \"esbuild\": \"^0.23.0\",\n \"jest\": \"^29.6.4\",\n \"ts-jest\": \"^29.1.1\",\n \"ts-node\": \"^10.9.2\",\n \"tsup\": \"^6.7.0\",\n \"typescript\": \"^5.4.5\",\n \"@copilotkit/runtime\": \"workspace:*\",\n \"graphql\": \"^16.8.1\"\n },\n \"dependencies\": {\n \"@copilotkit/shared\": \"workspace:*\",\n \"@urql/core\": \"^5.0.3\",\n \"untruncate-json\": \"^0.0.1\",\n \"urql\": \"^4.1.0\"\n },\n \"keywords\": [\n \"copilotkit\",\n \"copilot\",\n \"react\",\n \"nextjs\",\n \"nodejs\",\n \"ai\",\n \"assistant\",\n \"javascript\",\n \"automation\",\n \"textarea\"\n ]\n}\n","/* eslint-disable */\nimport type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\nexport type Maybe<T> = T | null;\nexport type InputMaybe<T> = Maybe<T>;\nexport type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };\nexport type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };\nexport type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };\nexport type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };\nexport type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };\n/** All built-in and custom scalars, mapped to their actual values */\nexport type Scalars = {\n ID: { input: string; output: string; }\n String: { input: string; output: string; }\n Boolean: { input: boolean; output: boolean; }\n Int: { input: number; output: number; }\n Float: { input: number; output: number; }\n /** A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.This scalar is serialized to a string in ISO 8601 format and parsed from a string in ISO 8601 format. */\n DateTimeISO: { input: any; output: any; }\n /** The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */\n JSON: { input: any; output: any; }\n /** The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */\n JSONObject: { input: any; output: any; }\n};\n\nexport type ActionExecutionMessageInput = {\n arguments: Scalars['String']['input'];\n name: Scalars['String']['input'];\n parentMessageId?: InputMaybe<Scalars['String']['input']>;\n /** @deprecated This field will be removed in a future version */\n scope?: InputMaybe<Scalars['String']['input']>;\n};\n\nexport type ActionExecutionMessageOutput = BaseMessageOutput & {\n __typename?: 'ActionExecutionMessageOutput';\n arguments: Array<Scalars['String']['output']>;\n createdAt: Scalars['DateTimeISO']['output'];\n id: Scalars['String']['output'];\n name: Scalars['String']['output'];\n parentMessageId?: Maybe<Scalars['String']['output']>;\n /** @deprecated This field will be removed in a future version */\n scope?: Maybe<Scalars['String']['output']>;\n status: MessageStatus;\n};\n\nexport type ActionInput = {\n available?: InputMaybe<ActionInputAvailability>;\n description: Scalars['String']['input'];\n jsonSchema: Scalars['String']['input'];\n name: Scalars['String']['input'];\n};\n\n/** The availability of the frontend action */\nexport enum ActionInputAvailability {\n Disabled = 'disabled',\n Enabled = 'enabled',\n Remote = 'remote'\n}\n\nexport type Agent = {\n __typename?: 'Agent';\n description: Scalars['String']['output'];\n id: Scalars['String']['output'];\n name: Scalars['String']['output'];\n};\n\nexport type AgentSessionInput = {\n agentName: Scalars['String']['input'];\n nodeName?: InputMaybe<Scalars['String']['input']>;\n threadId?: InputMaybe<Scalars['String']['input']>;\n};\n\nexport type AgentStateInput = {\n agentName: Scalars['String']['input'];\n state: Scalars['String']['input'];\n};\n\nexport type AgentStateMessageInput = {\n active: Scalars['Boolean']['input'];\n agentName: Scalars['String']['input'];\n nodeName: Scalars['String']['input'];\n role: MessageRole;\n runId: Scalars['String']['input'];\n running: Scalars['Boolean']['input'];\n state: Scalars['String']['input'];\n threadId: Scalars['String']['input'];\n};\n\nexport type AgentStateMessageOutput = BaseMessageOutput & {\n __typename?: 'AgentStateMessageOutput';\n active: Scalars['Boolean']['output'];\n agentName: Scalars['String']['output'];\n createdAt: Scalars['DateTimeISO']['output'];\n id: Scalars['String']['output'];\n nodeName: Scalars['String']['output'];\n role: MessageRole;\n runId: Scalars['String']['output'];\n running: Scalars['Boolean']['output'];\n state: Scalars['String']['output'];\n status: MessageStatus;\n threadId: Scalars['String']['output'];\n};\n\nexport type AgentsResponse = {\n __typename?: 'AgentsResponse';\n agents: Array<Agent>;\n};\n\nexport type BaseMessageOutput = {\n createdAt: Scalars['DateTimeISO']['output'];\n id: Scalars['String']['output'];\n status: MessageStatus;\n};\n\nexport type BaseResponseStatus = {\n code: ResponseStatusCode;\n};\n\nexport type CloudInput = {\n guardrails?: InputMaybe<GuardrailsInput>;\n};\n\n/** The type of Copilot request */\nexport enum CopilotRequestType {\n Chat = 'Chat',\n Suggestion = 'Suggestion',\n Task = 'Task',\n TextareaCompletion = 'TextareaCompletion',\n TextareaPopover = 'TextareaPopover'\n}\n\nexport type CopilotResponse = {\n __typename?: 'CopilotResponse';\n messages: Array<BaseMessageOutput>;\n runId?: Maybe<Scalars['String']['output']>;\n status: ResponseStatus;\n threadId: Scalars['String']['output'];\n};\n\nexport type FailedMessageStatus = {\n __typename?: 'FailedMessageStatus';\n code: MessageStatusCode;\n reason: Scalars['String']['output'];\n};\n\nexport type FailedResponseStatus = BaseResponseStatus & {\n __typename?: 'FailedResponseStatus';\n code: ResponseStatusCode;\n details?: Maybe<Scalars['JSON']['output']>;\n reason: FailedResponseStatusReason;\n};\n\nexport enum FailedResponseStatusReason {\n GuardrailsValidationFailed = 'GUARDRAILS_VALIDATION_FAILED',\n MessageStreamInterrupted = 'MESSAGE_STREAM_INTERRUPTED',\n UnknownError = 'UNKNOWN_ERROR'\n}\n\nexport type ForwardedParametersInput = {\n maxTokens?: InputMaybe<Scalars['Float']['input']>;\n model?: InputMaybe<Scalars['String']['input']>;\n stop?: InputMaybe<Array<Scalars['String']['input']>>;\n temperature?: InputMaybe<Scalars['Float']['input']>;\n toolChoice?: InputMaybe<Scalars['String']['input']>;\n toolChoiceFunctionName?: InputMaybe<Scalars['String']['input']>;\n};\n\nexport type FrontendInput = {\n actions: Array<ActionInput>;\n toDeprecate_fullContext?: InputMaybe<Scalars['String']['input']>;\n url?: InputMaybe<Scalars['String']['input']>;\n};\n\nexport type GenerateCopilotResponseInput = {\n agentSession?: InputMaybe<AgentSessionInput>;\n agentState?: InputMaybe<AgentStateInput>;\n agentStates?: InputMaybe<Array<AgentStateInput>>;\n cloud?: InputMaybe<CloudInput>;\n forwardedParameters?: InputMaybe<ForwardedParametersInput>;\n frontend: FrontendInput;\n messages: Array<MessageInput>;\n metadata: GenerateCopilotResponseMetadataInput;\n runId?: InputMaybe<Scalars['String']['input']>;\n threadId?: InputMaybe<Scalars['String']['input']>;\n};\n\nexport type GenerateCopilotResponseMetadataInput = {\n requestType?: InputMaybe<CopilotRequestType>;\n};\n\nexport type GuardrailsInput = {\n inputValidationRules: GuardrailsRuleInput;\n};\n\nexport type GuardrailsRuleInput = {\n allowList?: InputMaybe<Array<Scalars['String']['input']>>;\n denyList?: InputMaybe<Array<Scalars['String']['input']>>;\n};\n\nexport type MessageInput = {\n actionExecutionMessage?: InputMaybe<ActionExecutionMessageInput>;\n agentStateMessage?: InputMaybe<AgentStateMessageInput>;\n createdAt: Scalars['DateTimeISO']['input'];\n id: Scalars['String']['input'];\n resultMessage?: InputMaybe<ResultMessageInput>;\n textMessage?: InputMaybe<TextMessageInput>;\n};\n\n/** The role of the message */\nexport enum MessageRole {\n Assistant = 'assistant',\n System = 'system',\n Tool = 'tool',\n User = 'user'\n}\n\nexport type MessageStatus = FailedMessageStatus | PendingMessageStatus | SuccessMessageStatus;\n\nexport enum MessageStatusCode {\n Failed = 'Failed',\n Pending = 'Pending',\n Success = 'Success'\n}\n\nexport type Mutation = {\n __typename?: 'Mutation';\n generateCopilotResponse: CopilotResponse;\n};\n\n\nexport type MutationGenerateCopilotResponseArgs = {\n data: GenerateCopilotResponseInput;\n properties?: InputMaybe<Scalars['JSONObject']['input']>;\n};\n\nexport type PendingMessageStatus = {\n __typename?: 'PendingMessageStatus';\n code: MessageStatusCode;\n};\n\nexport type PendingResponseStatus = BaseResponseStatus & {\n __typename?: 'PendingResponseStatus';\n code: ResponseStatusCode;\n};\n\nexport type Query = {\n __typename?: 'Query';\n availableAgents: AgentsResponse;\n hello: Scalars['String']['output'];\n};\n\nexport type ResponseStatus = FailedResponseStatus | PendingResponseStatus | SuccessResponseStatus;\n\nexport enum ResponseStatusCode {\n Failed = 'Failed',\n Pending = 'Pending',\n Success = 'Success'\n}\n\nexport type ResultMessageInput = {\n actionExecutionId: Scalars['String']['input'];\n actionName: Scalars['String']['input'];\n parentMessageId?: InputMaybe<Scalars['String']['input']>;\n result: Scalars['String']['input'];\n};\n\nexport type ResultMessageOutput = BaseMessageOutput & {\n __typename?: 'ResultMessageOutput';\n actionExecutionId: Scalars['String']['output'];\n actionName: Scalars['String']['output'];\n createdAt: Scalars['DateTimeISO']['output'];\n id: Scalars['String']['output'];\n result: Scalars['String']['output'];\n status: MessageStatus;\n};\n\nexport type SuccessMessageStatus = {\n __typename?: 'SuccessMessageStatus';\n code: MessageStatusCode;\n};\n\nexport type SuccessResponseStatus = BaseResponseStatus & {\n __typename?: 'SuccessResponseStatus';\n code: ResponseStatusCode;\n};\n\nexport type TextMessageInput = {\n content: Scalars['String']['input'];\n parentMessageId?: InputMaybe<Scalars['String']['input']>;\n role: MessageRole;\n};\n\nexport type TextMessageOutput = BaseMessageOutput & {\n __typename?: 'TextMessageOutput';\n content: Array<Scalars['String']['output']>;\n createdAt: Scalars['DateTimeISO']['output'];\n id: Scalars['String']['output'];\n parentMessageId?: Maybe<Scalars['String']['output']>;\n role: MessageRole;\n status: MessageStatus;\n};\n\nexport type GenerateCopilotResponseMutationVariables = Exact<{\n data: GenerateCopilotResponseInput;\n properties?: InputMaybe<Scalars['JSONObject']['input']>;\n}>;\n\n\nexport type GenerateCopilotResponseMutation = { __typename?: 'Mutation', generateCopilotResponse: { __typename?: 'CopilotResponse', threadId: string, runId?: string | null, messages: Array<{ __typename: 'ActionExecutionMessageOutput', id: string, createdAt: any, name: string, arguments: Array<string>, parentMessageId?: string | null, status: { __typename?: 'FailedMessageStatus', code: MessageStatusCode, reason: string } | { __typename?: 'PendingMessageStatus', code: MessageStatusCode } | { __typename?: 'SuccessMessageStatus', code: MessageStatusCode } } | { __typename: 'AgentStateMessageOutput', id: string, createdAt: any, threadId: string, state: string, running: boolean, agentName: string, nodeName: string, runId: string, active: boolean, role: MessageRole, status: { __typename?: 'FailedMessageStatus', code: MessageStatusCode, reason: string } | { __typename?: 'PendingMessageStatus', code: MessageStatusCode } | { __typename?: 'SuccessMessageStatus', code: MessageStatusCode } } | { __typename: 'ResultMessageOutput', id: string, createdAt: any, result: string, actionExecutionId: string, actionName: string, status: { __typename?: 'FailedMessageStatus', code: MessageStatusCode, reason: string } | { __typename?: 'PendingMessageStatus', code: MessageStatusCode } | { __typename?: 'SuccessMessageStatus', code: MessageStatusCode } } | { __typename: 'TextMessageOutput', id: string, createdAt: any, content: Array<string>, role: MessageRole, parentMessageId?: string | null, status: { __typename?: 'FailedMessageStatus', code: MessageStatusCode, reason: string } | { __typename?: 'PendingMessageStatus', code: MessageStatusCode } | { __typename?: 'SuccessMessageStatus', code: MessageStatusCode } }> } & ({ __typename?: 'CopilotResponse', status: { __typename?: 'FailedResponseStatus', code: ResponseStatusCode, reason: FailedResponseStatusReason, details?: any | null } | { __typename?: 'PendingResponseStatus', code: ResponseStatusCode } | { __typename?: 'SuccessResponseStatus', code: ResponseStatusCode } } | { __typename?: 'CopilotResponse', status?: never }) };\n\nexport type AvailableAgentsQueryVariables = Exact<{ [key: string]: never; }>;\n\n\nexport type AvailableAgentsQuery = { __typename?: 'Query', availableAgents: { __typename?: 'AgentsResponse', agents: Array<{ __typename?: 'Agent', name: string, id: string, description: string }> } };\n\n\nexport const 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\":\"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\":\"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\"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GenerateCopilotResponseMutation, GenerateCopilotResponseMutationVariables>;\nexport const 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\"}}]}}]}}]}}]} as unknown as DocumentNode<AvailableAgentsQuery, AvailableAgentsQueryVariables>;","/* eslint-disable */\nimport * as types from './graphql';\nimport type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\n\n/**\n * Map of all GraphQL operations in the project.\n *\n * This map has several performance disadvantages:\n * 1. It is not tree-shakeable, so it will include all operations in the project.\n * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n * 3. It does not support dead code elimination, so it will add unused operations.\n *\n * Therefore it is highly recommended to use the babel or swc plugin for production.\n */\nconst documents = {\n \"\\n mutation generateCopilotResponse($data: GenerateCopilotResponseInput!, $properties: JSONObject) {\\n generateCopilotResponse(data: $data, properties: $properties) {\\n threadId\\n runId\\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 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 }\\n }\\n\": types.GenerateCopilotResponseDocument,\n \"\\n query availableAgents {\\n availableAgents {\\n agents {\\n name\\n id\\n description\\n }\\n }\\n }\\n\": types.AvailableAgentsDocument,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n mutation generateCopilotResponse($data: GenerateCopilotResponseInput!, $properties: JSONObject) {\\n generateCopilotResponse(data: $data, properties: $properties) {\\n threadId\\n runId\\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 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 }\\n }\\n\"): (typeof documents)[\"\\n mutation generateCopilotResponse($data: GenerateCopilotResponseInput!, $properties: JSONObject) {\\n generateCopilotResponse(data: $data, properties: $properties) {\\n threadId\\n runId\\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 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 }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query availableAgents {\\n availableAgents {\\n agents {\\n name\\n id\\n description\\n }\\n }\\n }\\n\"): (typeof documents)[\"\\n query availableAgents {\\n availableAgents {\\n agents {\\n name\\n id\\n description\\n }\\n }\\n }\\n\"];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;","import { graphql } from \"../@generated/gql\";\n\nexport const generateCopilotResponseMutation = graphql(/** GraphQL **/ `\n mutation generateCopilotResponse($data: GenerateCopilotResponseInput!, $properties: JSONObject) {\n generateCopilotResponse(data: $data, properties: $properties) {\n threadId\n runId\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 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 }\n }\n`);\n","import { graphql } from \"../@generated/gql\";\n\nexport const getAvailableAgentsQuery = graphql(/** GraphQL **/ `\n query availableAgents {\n availableAgents {\n agents {\n name\n id\n description\n }\n }\n }\n`);\n","import { randomId } from \"@copilotkit/shared\";\nimport {\n ActionExecutionMessageInput,\n MessageRole,\n MessageStatus,\n ResultMessageInput,\n TextMessageInput,\n BaseMessageOutput,\n AgentStateMessageInput,\n MessageStatusCode,\n} from \"../graphql/@generated/graphql\";\n\ntype MessageType = \"TextMessage\" | \"ActionExecutionMessage\" | \"ResultMessage\" | \"AgentStateMessage\";\n\nexport class Message {\n type: MessageType;\n id: BaseMessageOutput[\"id\"];\n createdAt: BaseMessageOutput[\"createdAt\"];\n status: MessageStatus;\n\n constructor(props: any) {\n props.id ??= randomId();\n props.status ??= { code: MessageStatusCode.Success };\n props.createdAt ??= new Date();\n Object.assign(this, props);\n }\n\n isTextMessage(): this is TextMessage {\n return this.type === \"TextMessage\";\n }\n\n isActionExecutionMessage(): this is ActionExecutionMessage {\n return this.type === \"ActionExecutionMessage\";\n }\n\n isResultMessage(): this is ResultMessage {\n return this.type === \"ResultMessage\";\n }\n\n isAgentStateMessage(): this is AgentStateMessage {\n return this.type === \"AgentStateMessage\";\n }\n}\n\n// alias Role to MessageRole\nexport const Role = MessageRole;\n\n// when constructing any message, the base fields are optional\ntype MessageConstructorOptions = Partial<Message>;\n\ntype TextMessageConstructorOptions = MessageConstructorOptions & TextMessageInput;\n\nexport class TextMessage extends Message implements TextMessageConstructorOptions {\n role: TextMessageInput[\"role\"];\n content: TextMessageInput[\"content\"];\n parentMessageId: TextMessageInput[\"parentMessageId\"];\n\n constructor(props: TextMessageConstructorOptions) {\n super(props);\n this.type = \"TextMessage\";\n }\n}\n\ntype ActionExecutionMessageConstructorOptions = MessageConstructorOptions &\n Omit<ActionExecutionMessageInput, \"arguments\"> & {\n arguments: Record<string, any>;\n };\n\nexport class ActionExecutionMessage\n extends Message\n implements Omit<ActionExecutionMessageInput, \"arguments\" | \"scope\">\n{\n name: ActionExecutionMessageInput[\"name\"];\n arguments: Record<string, any>;\n parentMessageId: ActionExecutionMessageInput[\"parentMessageId\"];\n constructor(props: ActionExecutionMessageConstructorOptions) {\n super(props);\n this.type = \"ActionExecutionMessage\";\n }\n}\n\ntype ResultMessageConstructorOptions = MessageConstructorOptions & ResultMessageInput;\n\nexport class ResultMessage extends Message implements ResultMessageConstructorOptions {\n actionExecutionId: ResultMessageInput[\"actionExecutionId\"];\n actionName: ResultMessageInput[\"actionName\"];\n result: ResultMessageInput[\"result\"];\n\n constructor(props: ResultMessageConstructorOptions) {\n super(props);\n this.type = \"ResultMessage\";\n }\n\n static decodeResult(result: string): any {\n try {\n return JSON.parse(result);\n } catch (e) {\n return result;\n }\n }\n\n static encodeResult(result: any): string {\n if (result === undefined) {\n return \"\";\n } else if (typeof result === \"string\") {\n return result;\n } else {\n return JSON.stringify(result);\n }\n }\n}\n\nexport class AgentStateMessage extends Message implements Omit<AgentStateMessageInput, \"state\"> {\n agentName: AgentStateMessageInput[\"agentName\"];\n state: any;\n running: AgentStateMessageInput[\"running\"];\n threadId: AgentStateMessageInput[\"threadId\"];\n role: AgentStateMessageInput[\"role\"];\n nodeName: AgentStateMessageInput[\"nodeName\"];\n runId: AgentStateMessageInput[\"runId\"];\n active: AgentStateMessageInput[\"active\"];\n\n constructor(props: any) {\n super(props);\n this.type = \"AgentStateMessage\";\n }\n}\n","import {\n GenerateCopilotResponseMutation,\n MessageInput,\n MessageStatusCode,\n} from \"../graphql/@generated/graphql\";\nimport {\n ActionExecutionMessage,\n AgentStateMessage,\n Message,\n ResultMessage,\n TextMessage,\n} from \"./types\";\n\nimport untruncateJson from \"untruncate-json\";\n\nexport function filterAgentStateMessages(messages: Message[]): Message[] {\n return messages.filter((message) => !message.isAgentStateMessage());\n}\n\nexport function convertMessagesToGqlInput(messages: Message[]): MessageInput[] {\n return messages.map((message) => {\n if (message.isTextMessage()) {\n return {\n id: message.id,\n createdAt: message.createdAt,\n textMessage: {\n content: message.content,\n role: message.role as any,\n parentMessageId: message.parentMessageId,\n },\n };\n } else if (message.isActionExecutionMessage()) {\n return {\n id: message.id,\n createdAt: message.createdAt,\n actionExecutionMessage: {\n name: message.name,\n arguments: JSON.stringify(message.arguments),\n parentMessageId: message.parentMessageId,\n },\n };\n } else if (message.isResultMessage()) {\n return {\n id: message.id,\n createdAt: message.createdAt,\n resultMessage: {\n result: message.result,\n actionExecutionId: message.actionExecutionId,\n actionName: message.actionName,\n },\n };\n } else if (message.isAgentStateMessage()) {\n return {\n id: message.id,\n createdAt: message.createdAt,\n agentStateMessage: {\n threadId: message.threadId,\n role: message.role,\n agentName: message.agentName,\n nodeName: message.nodeName,\n runId: message.runId,\n active: message.active,\n running: message.running,\n state: JSON.stringify(message.state),\n },\n };\n } else {\n throw new Error(\"Unknown message type\");\n }\n });\n}\n\nexport function filterAdjacentAgentStateMessages(\n messages: GenerateCopilotResponseMutation[\"generateCopilotResponse\"][\"messages\"],\n): GenerateCopilotResponseMutation[\"generateCopilotResponse\"][\"messages\"] {\n const filteredMessages: GenerateCopilotResponseMutation[\"generateCopilotResponse\"][\"messages\"] =\n [];\n\n messages.forEach((message, i) => {\n // keep all other message types\n if (message.__typename !== \"AgentStateMessageOutput\") {\n filteredMessages.push(message);\n } else {\n const prevAgentStateMessageIndex = filteredMessages.findIndex(\n // TODO: also check runId\n (m) => m.__typename === \"AgentStateMessageOutput\" && m.agentName === message.agentName,\n );\n if (prevAgentStateMessageIndex === -1) {\n filteredMessages.push(message);\n } else {\n filteredMessages[prevAgentStateMessageIndex] = message;\n }\n }\n });\n\n return filteredMessages;\n}\n\nexport function convertGqlOutputToMessages(\n messages: GenerateCopilotResponseMutation[\"generateCopilotResponse\"][\"messages\"],\n): Message[] {\n return messages.map((message) => {\n if (message.__typename === \"TextMessageOutput\") {\n return new TextMessage({\n id: message.id,\n role: message.role,\n content: message.content.join(\"\"),\n parentMessageId: message.parentMessageId,\n createdAt: new Date(),\n status: message.status || { code: MessageStatusCode.Pending },\n });\n } else if (message.__typename === \"ActionExecutionMessageOutput\") {\n return new ActionExecutionMessage({\n id: message.id,\n name: message.name,\n arguments: getPartialArguments(message.arguments),\n parentMessageId: message.parentMessageId,\n createdAt: new Date(),\n status: message.status || { code: MessageStatusCode.Pending },\n });\n } else if (message.__typename === \"ResultMessageOutput\") {\n return new ResultMessage({\n id: message.id,\n result: message.result,\n actionExecutionId: message.actionExecutionId,\n actionName: message.actionName,\n createdAt: new Date(),\n status: message.status || { code: MessageStatusCode.Pending },\n });\n } else if (message.__typename === \"AgentStateMessageOutput\") {\n return new AgentStateMessage({\n id: message.id,\n threadId: message.threadId,\n role: message.role,\n agentName: message.agentName,\n nodeName: message.nodeName,\n runId: message.runId,\n active: message.active,\n running: message.running,\n state: JSON.parse(message.state),\n createdAt: new Date(),\n });\n }\n\n throw new Error(\"Unknown message type\");\n });\n}\n\nexport function loadMessagesFromJsonRepresentation(json: any[]): Message[] {\n const result: Message[] = [];\n for (const item of json) {\n if (\"content\" in item) {\n result.push(\n new TextMessage({\n id: item.id,\n role: item.role,\n content: item.content,\n parentMessageId: item.parentMessageId,\n createdAt: item.createdAt || new Date(),\n status: item.status || { code: MessageStatusCode.Success },\n }),\n );\n } else if (\"arguments\" in item) {\n result.push(\n new ActionExecutionMessage({\n id: item.id,\n name: item.name,\n arguments: item.arguments,\n parentMessageId: item.parentMessageId,\n createdAt: item.createdAt || new Date(),\n status: item.status || { code: MessageStatusCode.Success },\n }),\n );\n } else if (\"result\" in item) {\n result.push(\n new ResultMessage({\n id: item.id,\n result: item.result,\n actionExecutionId: item.actionExecutionId,\n actionName: item.actionName,\n createdAt: item.createdAt || new Date(),\n status: item.status || { code: MessageStatusCode.Success },\n }),\n );\n } else if (\"state\" in item) {\n result.push(\n new AgentStateMessage({\n id: item.id,\n threadId: item.threadId,\n role: item.role,\n agentName: item.agentName,\n nodeName: item.nodeName,\n runId: item.runId,\n active: item.active,\n running: item.running,\n state: item.state,\n createdAt: item.createdAt || new Date(),\n }),\n );\n }\n }\n return result;\n}\n\nfunction getPartialArguments(args: string[]) {\n try {\n return JSON.parse(untruncateJson(args.join(\"\")));\n } catch (e) {\n return {};\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAOO;;;ACIL,cAAW;;;ACyCN,IAAK,0BAAL,kBAAKA,6BAAL;AACL,EAAAA,yBAAA,cAAW;AACX,EAAAA,yBAAA,aAAU;AACV,EAAAA,yBAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;AAsEL,IAAK,qBAAL,kBAAKC,wBAAL;AACL,EAAAA,oBAAA,UAAO;AACP,EAAAA,oBAAA,gBAAa;AACb,EAAAA,oBAAA,UAAO;AACP,EAAAA,oBAAA,wBAAqB;AACrB,EAAAA,oBAAA,qBAAkB;AALR,SAAAA;AAAA,GAAA;AA6BL,IAAK,6BAAL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ACb,SAAS,KAAK;AAAA,UACd,OAAO,KAAK;AAAA,UACZ,WAAW,KAAK,aAAa,oBAAI,KAAK;AAAA,QACxC,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,oBAAoB,MAAgB;AAC3C,MAAI;AACF,WAAO,KAAK,UAAM,uBAAAC,SAAe,KAAK,KAAK,EAAE,CAAC,CAAC;AAAA,EACjD,SAAS,GAAP;AACA,WAAO,CAAC;AAAA,EACV;AACF;","names":["ActionInputAvailability","CopilotRequestType","FailedResponseStatusReason","MessageRole","MessageStatusCode","ResponseStatusCode","untruncateJson"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/client/CopilotRuntimeClient.ts","../package.json","../src/graphql/@generated/graphql.ts","../src/graphql/@generated/gql.ts","../src/graphql/definitions/mutations.ts","../src/graphql/definitions/queries.ts","../src/client/types.ts","../src/client/conversion.ts"],"sourcesContent":["export * from \"./client\";\nexport * from \"./graphql/@generated/graphql\";\n","import {\n Client,\n cacheExchange,\n fetchExchange,\n mapExchange,\n CombinedError,\n Operation,\n} from \"@urql/core\";\nimport * as packageJson from \"../../package.json\";\n\nimport {\n AvailableAgentsQuery,\n GenerateCopilotResponseMutation,\n GenerateCopilotResponseMutationVariables,\n LoadAgentStateQuery,\n} from \"../graphql/@generated/graphql\";\nimport { generateCopilotResponseMutation } from \"../graphql/definitions/mutations\";\nimport { getAvailableAgentsQuery, loadAgentStateQuery } from \"../graphql/definitions/queries\";\nimport { OperationResultSource, OperationResult } from \"urql\";\nimport { CopilotKitLowLevelError, ResolvedCopilotKitError } from \"@copilotkit/shared\";\n\nconst createFetchFn =\n (signal?: AbortSignal) =>\n async (...args: Parameters<typeof fetch>) => {\n try {\n const result = await fetch(args[0], { ...(args[1] ?? {}), signal });\n if (result.status !== 200) {\n throw new ResolvedCopilotKitError({ status: result.status });\n }\n return result;\n } catch (error) {\n throw new CopilotKitLowLevelError({ error: error as Error, url: args[0] as string });\n }\n };\n\nexport interface CopilotRuntimeClientOptions {\n url: string;\n publicApiKey?: string;\n headers?: Record<string, string>;\n credentials?: RequestCredentials;\n handleGQLErrors?: (error: Error) => void;\n}\n\nexport class CopilotRuntimeClient {\n client: Client;\n public handleGQLErrors?: (error: Error) => void;\n\n constructor(options: CopilotRuntimeClientOptions) {\n const headers: Record<string, string> = {};\n\n this.handleGQLErrors = options.handleGQLErrors;\n\n if (options.headers) {\n Object.assign(headers, options.headers);\n }\n\n if (options.publicApiKey) {\n headers[\"x-copilotcloud-public-api-key\"] = options.publicApiKey;\n }\n\n this.client = new Client({\n url: options.url,\n exchanges: [cacheExchange, fetchExchange],\n fetchOptions: {\n headers: {\n ...headers,\n \"X-CopilotKit-Runtime-Client-GQL-Version\": packageJson.version,\n },\n ...(options.credentials ? { credentials: options.credentials } : {}),\n },\n });\n }\n\n generateCopilotResponse({\n data,\n properties,\n signal,\n }: {\n data: GenerateCopilotResponseMutationVariables[\"data\"];\n properties?: GenerateCopilotResponseMutationVariables[\"properties\"];\n signal?: AbortSignal;\n }) {\n const fetchFn = createFetchFn(signal);\n const result = this.client.mutation<\n GenerateCopilotResponseMutation,\n GenerateCopilotResponseMutationVariables\n >(generateCopilotResponseMutation, { data, properties }, { fetch: fetchFn });\n\n return result;\n }\n\n public asStream<S, T>(source: OperationResultSource<OperationResult<S, { data: T }>>) {\n const handleGQLErrors = this.handleGQLErrors;\n return new ReadableStream<S>({\n start(controller) {\n source.subscribe(({ data, hasNext, error }) => {\n if (error) {\n if (\n error.message.includes(\"BodyStreamBuffer was aborted\") ||\n error.message.includes(\"signal is aborted without reason\")\n ) {\n // Suppress this specific error\n console.warn(\"Abort error suppressed\");\n return;\n }\n controller.error(error);\n if (handleGQLErrors) {\n handleGQLErrors(error);\n }\n } else {\n controller.enqueue(data);\n if (!hasNext) {\n controller.close();\n }\n }\n });\n },\n });\n }\n\n availableAgents() {\n const fetchFn = createFetchFn();\n return this.client.query<AvailableAgentsQuery>(getAvailableAgentsQuery, {}, { fetch: fetchFn });\n }\n\n loadAgentState(data: { threadId: string; agentName: string }) {\n const fetchFn = createFetchFn();\n return this.client.query<LoadAgentStateQuery>(\n loadAgentStateQuery,\n { data },\n { fetch: fetchFn },\n );\n }\n\n static removeGraphQLTypename(data: any) {\n if (Array.isArray(data)) {\n data.forEach((item) => CopilotRuntimeClient.removeGraphQLTypename(item));\n } else if (typeof data === \"object\" && data !== null) {\n delete data.__typename;\n Object.keys(data).forEach((key) => {\n if (typeof data[key] === \"object\" && data[key] !== null) {\n CopilotRuntimeClient.removeGraphQLTypename(data[key]);\n }\n });\n }\n return data;\n }\n}\n","{\n \"name\": \"@copilotkit/runtime-client-gql\",\n \"private\": false,\n \"homepage\": \"https://github.com/CopilotKit/CopilotKit\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/CopilotKit/CopilotKit.git\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"version\": \"1.5.12-next.7\",\n \"sideEffects\": false,\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"types\": \"./dist/index.d.ts\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"tsup --clean\",\n \"dev\": \"tsup --watch --no-splitting\",\n \"test\": \"jest --passWithNoTests\",\n \"check-types\": \"tsc --noEmit\",\n \"clean\": \"rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next\",\n \"graphql-codegen\": \"graphql-codegen\",\n \"graphql-codegen:watch\": \"graphql-codegen --watch\",\n \"link:global\": \"pnpm link --global\",\n \"unlink:global\": \"pnpm unlink --global\"\n },\n \"peerDependencies\": {\n \"react\": \"^18 || ^19 || ^19.0.0-rc\"\n },\n \"devDependencies\": {\n \"@graphql-codegen/cli\": \"^5.0.2\",\n \"@graphql-codegen/client-preset\": \"^4.2.6\",\n \"@graphql-codegen/introspection\": \"^4.0.3\",\n \"@graphql-codegen/typescript\": \"^4.0.7\",\n \"@graphql-codegen/typescript-operations\": \"^4.2.1\",\n \"@graphql-codegen/typescript-urql\": \"^4.0.0\",\n \"@graphql-codegen/urql-introspection\": \"^3.0.0\",\n \"@graphql-typed-document-node/core\": \"^3.2.0\",\n \"@parcel/watcher\": \"^2.4.1\",\n \"@types/node\": \"^20.12.12\",\n \"esbuild\": \"^0.23.0\",\n \"jest\": \"^29.6.4\",\n \"ts-jest\": \"^29.1.1\",\n \"ts-node\": \"^10.9.2\",\n \"tsup\": \"^6.7.0\",\n \"typescript\": \"^5.4.5\",\n \"@copilotkit/runtime\": \"workspace:*\",\n \"graphql\": \"^16.8.1\"\n },\n \"dependencies\": {\n \"@copilotkit/shared\": \"workspace:*\",\n \"@urql/core\": \"^5.0.3\",\n \"untruncate-json\": \"^0.0.1\",\n \"urql\": \"^4.1.0\"\n },\n \"keywords\": [\n \"copilotkit\",\n \"copilot\",\n \"react\",\n \"nextjs\",\n \"nodejs\",\n \"ai\",\n \"assistant\",\n \"javascript\",\n \"automation\",\n \"textarea\"\n ]\n}\n","/* eslint-disable */\nimport type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\nexport type Maybe<T> = T | null;\nexport type InputMaybe<T> = Maybe<T>;\nexport type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };\nexport type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };\nexport type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };\nexport type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };\nexport type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };\n/** All built-in and custom scalars, mapped to their actual values */\nexport type Scalars = {\n ID: { input: string; output: string; }\n String: { input: string; output: string; }\n Boolean: { input: boolean; output: boolean; }\n Int: { input: number; output: number; }\n Float: { input: number; output: number; }\n /** A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.This scalar is serialized to a string in ISO 8601 format and parsed from a string in ISO 8601 format. */\n DateTimeISO: { input: any; output: any; }\n /** The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */\n JSON: { input: any; output: any; }\n /** The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */\n JSONObject: { input: any; output: any; }\n};\n\nexport type ActionExecutionMessageInput = {\n arguments: Scalars['String']['input'];\n name: Scalars['String']['input'];\n parentMessageId?: InputMaybe<Scalars['String']['input']>;\n /** @deprecated This field will be removed in a future version */\n scope?: InputMaybe<Scalars['String']['input']>;\n};\n\nexport type ActionExecutionMessageOutput = BaseMessageOutput & {\n __typename?: 'ActionExecutionMessageOutput';\n arguments: Array<Scalars['String']['output']>;\n createdAt: Scalars['DateTimeISO']['output'];\n id: Scalars['String']['output'];\n name: Scalars['String']['output'];\n parentMessageId?: Maybe<Scalars['String']['output']>;\n /** @deprecated This field will be removed in a future version */\n scope?: Maybe<Scalars['String']['output']>;\n status: MessageStatus;\n};\n\nexport type ActionInput = {\n available?: InputMaybe<ActionInputAvailability>;\n description: Scalars['String']['input'];\n jsonSchema: Scalars['String']['input'];\n name: Scalars['String']['input'];\n};\n\n/** The availability of the frontend action */\nexport enum ActionInputAvailability {\n Disabled = 'disabled',\n Enabled = 'enabled',\n Remote = 'remote'\n}\n\nexport type Agent = {\n __typename?: 'Agent';\n description: Scalars['String']['output'];\n id: Scalars['String']['output'];\n name: Scalars['String']['output'];\n};\n\nexport type AgentSessionInput = {\n agentName: Scalars['String']['input'];\n nodeName?: InputMaybe<Scalars['String']['input']>;\n threadId?: InputMaybe<Scalars['String']['input']>;\n};\n\nexport type AgentStateInput = {\n agentName: Scalars['String']['input'];\n state: Scalars['String']['input'];\n};\n\nexport type AgentStateMessageInput = {\n active: Scalars['Boolean']['input'];\n agentName: Scalars['String']['input'];\n nodeName: Scalars['String']['input'];\n role: MessageRole;\n runId: Scalars['String']['input'];\n running: Scalars['Boolean']['input'];\n state: Scalars['String']['input'];\n threadId: Scalars['String']['input'];\n};\n\nexport type AgentStateMessageOutput = BaseMessageOutput & {\n __typename?: 'AgentStateMessageOutput';\n active: Scalars['Boolean']['output'];\n agentName: Scalars['String']['output'];\n createdAt: Scalars['DateTimeISO']['output'];\n id: Scalars['String']['output'];\n nodeName: Scalars['String']['output'];\n role: MessageRole;\n runId: Scalars['String']['output'];\n running: Scalars['Boolean']['output'];\n state: Scalars['String']['output'];\n status: MessageStatus;\n threadId: Scalars['String']['output'];\n};\n\nexport type AgentsResponse = {\n __typename?: 'AgentsResponse';\n agents: Array<Agent>;\n};\n\nexport type BaseMessageOutput = {\n createdAt: Scalars['DateTimeISO']['output'];\n id: Scalars['String']['output'];\n status: MessageStatus;\n};\n\nexport type BaseResponseStatus = {\n code: ResponseStatusCode;\n};\n\nexport type CloudInput = {\n guardrails?: InputMaybe<GuardrailsInput>;\n};\n\n/** The type of Copilot request */\nexport enum CopilotRequestType {\n Chat = 'Chat',\n Suggestion = 'Suggestion',\n Task = 'Task',\n TextareaCompletion = 'TextareaCompletion',\n TextareaPopover = 'TextareaPopover'\n}\n\nexport type CopilotResponse = {\n __typename?: 'CopilotResponse';\n extensions?: Maybe<ExtensionsResponse>;\n messages: Array<BaseMessageOutput>;\n runId?: Maybe<Scalars['String']['output']>;\n status: ResponseStatus;\n threadId: Scalars['String']['output'];\n};\n\nexport type ExtensionsInput = {\n openaiAssistantAPI?: InputMaybe<OpenAiApiAssistantApiInput>;\n};\n\nexport type ExtensionsResponse = {\n __typename?: 'ExtensionsResponse';\n openaiAssistantAPI?: Maybe<OpenAiApiAssistantApiResponse>;\n};\n\nexport type FailedMessageStatus = {\n __typename?: 'FailedMessageStatus';\n code: MessageStatusCode;\n reason: Scalars['String']['output'];\n};\n\nexport type FailedResponseStatus = BaseResponseStatus & {\n __typename?: 'FailedResponseStatus';\n code: ResponseStatusCode;\n details?: Maybe<Scalars['JSON']['output']>;\n reason: FailedResponseStatusReason;\n};\n\nexport enum FailedResponseStatusReason {\n GuardrailsValidationFailed = 'GUARDRAILS_VALIDATION_FAILED',\n MessageStreamInterrupted = 'MESSAGE_STREAM_INTERRUPTED',\n UnknownError = 'UNKNOWN_ERROR'\n}\n\nexport type ForwardedParametersInput = {\n maxTokens?: InputMaybe<Scalars['Float']['input']>;\n model?: InputMaybe<Scalars['String']['input']>;\n stop?: InputMaybe<Array<Scalars['String']['input']>>;\n temperature?: InputMaybe<Scalars['Float']['input']>;\n toolChoice?: InputMaybe<Scalars['String']['input']>;\n toolChoiceFunctionName?: InputMaybe<Scalars['String']['input']>;\n};\n\nexport type FrontendInput = {\n actions: Array<ActionInput>;\n toDeprecate_fullContext?: InputMaybe<Scalars['String']['input']>;\n url?: InputMaybe<Scalars['String']['input']>;\n};\n\nexport type GenerateCopilotResponseInput = {\n agentSession?: InputMaybe<AgentSessionInput>;\n agentState?: InputMaybe<AgentStateInput>;\n agentStates?: InputMaybe<Array<AgentStateInput>>;\n cloud?: InputMaybe<CloudInput>;\n extensions?: InputMaybe<ExtensionsInput>;\n forwardedParameters?: InputMaybe<ForwardedParametersInput>;\n frontend: FrontendInput;\n messages: Array<MessageInput>;\n metadata: GenerateCopilotResponseMetadataInput;\n runId?: InputMaybe<Scalars['String']['input']>;\n threadId?: InputMaybe<Scalars['String']['input']>;\n};\n\nexport type GenerateCopilotResponseMetadataInput = {\n requestType?: InputMaybe<CopilotRequestType>;\n};\n\nexport type GuardrailsInput = {\n inputValidationRules: GuardrailsRuleInput;\n};\n\nexport type GuardrailsRuleInput = {\n allowList?: InputMaybe<Array<Scalars['String']['input']>>;\n denyList?: InputMaybe<Array<Scalars['String']['input']>>;\n};\n\nexport type LoadAgentStateInput = {\n agentName: Scalars['String']['input'];\n threadId: Scalars['String']['input'];\n};\n\nexport type LoadAgentStateResponse = {\n __typename?: 'LoadAgentStateResponse';\n messages: Scalars['String']['output'];\n state: Scalars['String']['output'];\n threadExists: Scalars['Boolean']['output'];\n threadId: Scalars['String']['output'];\n};\n\nexport type MessageInput = {\n actionExecutionMessage?: InputMaybe<ActionExecutionMessageInput>;\n agentStateMessage?: InputMaybe<AgentStateMessageInput>;\n createdAt: Scalars['DateTimeISO']['input'];\n id: Scalars['String']['input'];\n resultMessage?: InputMaybe<ResultMessageInput>;\n textMessage?: InputMaybe<TextMessageInput>;\n};\n\n/** The role of the message */\nexport enum MessageRole {\n Assistant = 'assistant',\n System = 'system',\n Tool = 'tool',\n User = 'user'\n}\n\nexport type MessageStatus = FailedMessageStatus | PendingMessageStatus | SuccessMessageStatus;\n\nexport enum MessageStatusCode {\n Failed = 'Failed',\n Pending = 'Pending',\n Success = 'Success'\n}\n\nexport type Mutation = {\n __typename?: 'Mutation';\n generateCopilotResponse: CopilotResponse;\n};\n\n\nexport type MutationGenerateCopilotResponseArgs = {\n data: GenerateCopilotResponseInput;\n properties?: InputMaybe<Scalars['JSONObject']['input']>;\n};\n\nexport type OpenAiApiAssistantApiInput = {\n runId?: InputMaybe<Scalars['String']['input']>;\n threadId?: InputMaybe<Scalars['String']['input']>;\n};\n\nexport type OpenAiApiAssistantApiResponse = {\n __typename?: 'OpenAIApiAssistantAPIResponse';\n runId?: Maybe<Scalars['String']['output']>;\n threadId?: Maybe<Scalars['String']['output']>;\n};\n\nexport type PendingMessageStatus = {\n __typename?: 'PendingMessageStatus';\n code: MessageStatusCode;\n};\n\nexport type PendingResponseStatus = BaseResponseStatus & {\n __typename?: 'PendingResponseStatus';\n code: ResponseStatusCode;\n};\n\nexport type Query = {\n __typename?: 'Query';\n availableAgents: AgentsResponse;\n hello: Scalars['String']['output'];\n loadAgentState: LoadAgentStateResponse;\n};\n\n\nexport type QueryLoadAgentStateArgs = {\n data: LoadAgentStateInput;\n};\n\nexport type ResponseStatus = FailedResponseStatus | PendingResponseStatus | SuccessResponseStatus;\n\nexport enum ResponseStatusCode {\n Failed = 'Failed',\n Pending = 'Pending',\n Success = 'Success'\n}\n\nexport type ResultMessageInput = {\n actionExecutionId: Scalars['String']['input'];\n actionName: Scalars['String']['input'];\n parentMessageId?: InputMaybe<Scalars['String']['input']>;\n result: Scalars['String']['input'];\n};\n\nexport type ResultMessageOutput = BaseMessageOutput & {\n __typename?: 'ResultMessageOutput';\n actionExecutionId: Scalars['String']['output'];\n actionName: Scalars['String']['output'];\n createdAt: Scalars['DateTimeISO']['output'];\n id: Scalars['String']['output'];\n result: Scalars['String']['output'];\n status: MessageStatus;\n};\n\nexport type SuccessMessageStatus = {\n __typename?: 'SuccessMessageStatus';\n code: MessageStatusCode;\n};\n\nexport type SuccessResponseStatus = BaseResponseStatus & {\n __typename?: 'SuccessResponseStatus';\n code: ResponseStatusCode;\n};\n\nexport type TextMessageInput = {\n content: Scalars['String']['input'];\n parentMessageId?: InputMaybe<Scalars['String']['input']>;\n role: MessageRole;\n};\n\nexport type TextMessageOutput = BaseMessageOutput & {\n __typename?: 'TextMessageOutput';\n content: Array<Scalars['String']['output']>;\n createdAt: Scalars['DateTimeISO']['output'];\n id: Scalars['String']['output'];\n parentMessageId?: Maybe<Scalars['String']['output']>;\n role: MessageRole;\n status: MessageStatus;\n};\n\nexport type GenerateCopilotResponseMutationVariables = Exact<{\n data: GenerateCopilotResponseInput;\n properties?: InputMaybe<Scalars['JSONObject']['input']>;\n}>;\n\n\nexport type GenerateCopilotResponseMutation = { __typename?: 'Mutation', generateCopilotResponse: { __typename?: 'CopilotResponse', threadId: string, runId?: string | null, extensions?: { __typename?: 'ExtensionsResponse', openaiAssistantAPI?: { __typename?: 'OpenAIApiAssistantAPIResponse', runId?: string | null, threadId?: string | null } | null } | null, messages: Array<{ __typename: 'ActionExecutionMessageOutput', id: string, createdAt: any, name: string, arguments: Array<string>, parentMessageId?: string | null, status: { __typename?: 'FailedMessageStatus', code: MessageStatusCode, reason: string } | { __typename?: 'PendingMessageStatus', code: MessageStatusCode } | { __typename?: 'SuccessMessageStatus', code: MessageStatusCode } } | { __typename: 'AgentStateMessageOutput', id: string, createdAt: any, threadId: string, state: string, running: boolean, agentName: string, nodeName: string, runId: string, active: boolean, role: MessageRole, status: { __typename?: 'FailedMessageStatus', code: MessageStatusCode, reason: string } | { __typename?: 'PendingMessageStatus', code: MessageStatusCode } | { __typename?: 'SuccessMessageStatus', code: MessageStatusCode } } | { __typename: 'ResultMessageOutput', id: string, createdAt: any, result: string, actionExecutionId: string, actionName: string, status: { __typename?: 'FailedMessageStatus', code: MessageStatusCode, reason: string } | { __typename?: 'PendingMessageStatus', code: MessageStatusCode } | { __typename?: 'SuccessMessageStatus', code: MessageStatusCode } } | { __typename: 'TextMessageOutput', id: string, createdAt: any, content: Array<string>, role: MessageRole, parentMessageId?: string | null, status: { __typename?: 'FailedMessageStatus', code: MessageStatusCode, reason: string } | { __typename?: 'PendingMessageStatus', code: MessageStatusCode } | { __typename?: 'SuccessMessageStatus', code: MessageStatusCode } }> } & ({ __typename?: 'CopilotResponse', status: { __typename?: 'FailedResponseStatus', code: ResponseStatusCode, reason: FailedResponseStatusReason, details?: any | null } | { __typename?: 'PendingResponseStatus', code: ResponseStatusCode } | { __typename?: 'SuccessResponseStatus', code: ResponseStatusCode } } | { __typename?: 'CopilotResponse', status?: never }) };\n\nexport type AvailableAgentsQueryVariables = Exact<{ [key: string]: never; }>;\n\n\nexport type AvailableAgentsQuery = { __typename?: 'Query', availableAgents: { __typename?: 'AgentsResponse', agents: Array<{ __typename?: 'Agent', name: string, id: string, description: string }> } };\n\nexport type LoadAgentStateQueryVariables = Exact<{\n data: LoadAgentStateInput;\n}>;\n\n\nexport type LoadAgentStateQuery = { __typename?: 'Query', loadAgentState: { __typename?: 'LoadAgentStateResponse', threadId: string, threadExists: boolean, state: string, messages: string } };\n\n\nexport const 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\":\"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\"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GenerateCopilotResponseMutation, GenerateCopilotResponseMutationVariables>;\nexport const 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\"}}]}}]}}]}}]} as unknown as DocumentNode<AvailableAgentsQuery, AvailableAgentsQueryVariables>;\nexport const 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\"}}]}}]}}]} as unknown as DocumentNode<LoadAgentStateQuery, LoadAgentStateQueryVariables>;","/* eslint-disable */\nimport * as types from './graphql';\nimport type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\n\n/**\n * Map of all GraphQL operations in the project.\n *\n * This map has several performance disadvantages:\n * 1. It is not tree-shakeable, so it will include all operations in the project.\n * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n * 3. It does not support dead code elimination, so it will add unused operations.\n *\n * Therefore it is highly recommended to use the babel or swc plugin for production.\n */\nconst documents = {\n \"\\n mutation generateCopilotResponse($data: GenerateCopilotResponseInput!, $properties: JSONObject) {\\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 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 }\\n }\\n\": types.GenerateCopilotResponseDocument,\n \"\\n query availableAgents {\\n availableAgents {\\n agents {\\n name\\n id\\n description\\n }\\n }\\n }\\n\": types.AvailableAgentsDocument,\n \"\\n query loadAgentState($data: LoadAgentStateInput!) {\\n loadAgentState(data: $data) {\\n threadId\\n threadExists\\n state\\n messages\\n }\\n }\\n\": types.LoadAgentStateDocument,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n mutation generateCopilotResponse($data: GenerateCopilotResponseInput!, $properties: JSONObject) {\\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 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 }\\n }\\n\"): (typeof documents)[\"\\n mutation generateCopilotResponse($data: GenerateCopilotResponseInput!, $properties: JSONObject) {\\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 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 }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query availableAgents {\\n availableAgents {\\n agents {\\n name\\n id\\n description\\n }\\n }\\n }\\n\"): (typeof documents)[\"\\n query availableAgents {\\n availableAgents {\\n agents {\\n name\\n id\\n description\\n }\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query loadAgentState($data: LoadAgentStateInput!) {\\n loadAgentState(data: $data) {\\n threadId\\n threadExists\\n state\\n messages\\n }\\n }\\n\"): (typeof documents)[\"\\n query loadAgentState($data: LoadAgentStateInput!) {\\n loadAgentState(data: $data) {\\n threadId\\n threadExists\\n state\\n messages\\n }\\n }\\n\"];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;","import { graphql } from \"../@generated/gql\";\n\nexport const generateCopilotResponseMutation = graphql(/** GraphQL **/ `\n mutation generateCopilotResponse($data: GenerateCopilotResponseInput!, $properties: JSONObject) {\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 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 }\n }\n`);\n","import { graphql } from \"../@generated/gql\";\n\nexport const getAvailableAgentsQuery = graphql(/** GraphQL **/ `\n query availableAgents {\n availableAgents {\n agents {\n name\n id\n description\n }\n }\n }\n`);\n\nexport const loadAgentStateQuery = graphql(/** GraphQL **/ `\n query loadAgentState($data: LoadAgentStateInput!) {\n loadAgentState(data: $data) {\n threadId\n threadExists\n state\n messages\n }\n }\n`);\n","import { randomId } from \"@copilotkit/shared\";\nimport {\n ActionExecutionMessageInput,\n MessageRole,\n MessageStatus,\n ResultMessageInput,\n TextMessageInput,\n BaseMessageOutput,\n AgentStateMessageInput,\n MessageStatusCode,\n} from \"../graphql/@generated/graphql\";\n\ntype MessageType = \"TextMessage\" | \"ActionExecutionMessage\" | \"ResultMessage\" | \"AgentStateMessage\";\n\nexport class Message {\n type: MessageType;\n id: BaseMessageOutput[\"id\"];\n createdAt: BaseMessageOutput[\"createdAt\"];\n status: MessageStatus;\n\n constructor(props: any) {\n props.id ??= randomId();\n props.status ??= { code: MessageStatusCode.Success };\n props.createdAt ??= new Date();\n Object.assign(this, props);\n }\n\n isTextMessage(): this is TextMessage {\n return this.type === \"TextMessage\";\n }\n\n isActionExecutionMessage(): this is ActionExecutionMessage {\n return this.type === \"ActionExecutionMessage\";\n }\n\n isResultMessage(): this is ResultMessage {\n return this.type === \"ResultMessage\";\n }\n\n isAgentStateMessage(): this is AgentStateMessage {\n return this.type === \"AgentStateMessage\";\n }\n}\n\n// alias Role to MessageRole\nexport const Role = MessageRole;\n\n// when constructing any message, the base fields are optional\ntype MessageConstructorOptions = Partial<Message>;\n\ntype TextMessageConstructorOptions = MessageConstructorOptions & TextMessageInput;\n\nexport class TextMessage extends Message implements TextMessageConstructorOptions {\n role: TextMessageInput[\"role\"];\n content: TextMessageInput[\"content\"];\n parentMessageId: TextMessageInput[\"parentMessageId\"];\n\n constructor(props: TextMessageConstructorOptions) {\n super(props);\n this.type = \"TextMessage\";\n }\n}\n\ntype ActionExecutionMessageConstructorOptions = MessageConstructorOptions &\n Omit<ActionExecutionMessageInput, \"arguments\"> & {\n arguments: Record<string, any>;\n };\n\nexport class ActionExecutionMessage\n extends Message\n implements Omit<ActionExecutionMessageInput, \"arguments\" | \"scope\">\n{\n name: ActionExecutionMessageInput[\"name\"];\n arguments: Record<string, any>;\n parentMessageId: ActionExecutionMessageInput[\"parentMessageId\"];\n constructor(props: ActionExecutionMessageConstructorOptions) {\n super(props);\n this.type = \"ActionExecutionMessage\";\n }\n}\n\ntype ResultMessageConstructorOptions = MessageConstructorOptions & ResultMessageInput;\n\nexport class ResultMessage extends Message implements ResultMessageConstructorOptions {\n actionExecutionId: ResultMessageInput[\"actionExecutionId\"];\n actionName: ResultMessageInput[\"actionName\"];\n result: ResultMessageInput[\"result\"];\n\n constructor(props: ResultMessageConstructorOptions) {\n super(props);\n this.type = \"ResultMessage\";\n }\n\n static decodeResult(result: string): any {\n try {\n return JSON.parse(result);\n } catch (e) {\n return result;\n }\n }\n\n static encodeResult(result: any): string {\n if (result === undefined) {\n return \"\";\n } else if (typeof result === \"string\") {\n return result;\n } else {\n return JSON.stringify(result);\n }\n }\n}\n\nexport class AgentStateMessage extends Message implements Omit<AgentStateMessageInput, \"state\"> {\n agentName: AgentStateMessageInput[\"agentName\"];\n state: any;\n running: AgentStateMessageInput[\"running\"];\n threadId: AgentStateMessageInput[\"threadId\"];\n role: AgentStateMessageInput[\"role\"];\n nodeName: AgentStateMessageInput[\"nodeName\"];\n runId: AgentStateMessageInput[\"runId\"];\n active: AgentStateMessageInput[\"active\"];\n\n constructor(props: any) {\n super(props);\n this.type = \"AgentStateMessage\";\n }\n}\n","import {\n GenerateCopilotResponseMutation,\n MessageInput,\n MessageStatusCode,\n} from \"../graphql/@generated/graphql\";\nimport {\n ActionExecutionMessage,\n AgentStateMessage,\n Message,\n ResultMessage,\n TextMessage,\n} from \"./types\";\n\nimport untruncateJson from \"untruncate-json\";\n\nexport function filterAgentStateMessages(messages: Message[]): Message[] {\n return messages.filter((message) => !message.isAgentStateMessage());\n}\n\nexport function convertMessagesToGqlInput(messages: Message[]): MessageInput[] {\n return messages.map((message) => {\n if (message.isTextMessage()) {\n return {\n id: message.id,\n createdAt: message.createdAt,\n textMessage: {\n content: message.content,\n role: message.role as any,\n parentMessageId: message.parentMessageId,\n },\n };\n } else if (message.isActionExecutionMessage()) {\n return {\n id: message.id,\n createdAt: message.createdAt,\n actionExecutionMessage: {\n name: message.name,\n arguments: JSON.stringify(message.arguments),\n parentMessageId: message.parentMessageId,\n },\n };\n } else if (message.isResultMessage()) {\n return {\n id: message.id,\n createdAt: message.createdAt,\n resultMessage: {\n result: message.result,\n actionExecutionId: message.actionExecutionId,\n actionName: message.actionName,\n },\n };\n } else if (message.isAgentStateMessage()) {\n return {\n id: message.id,\n createdAt: message.createdAt,\n agentStateMessage: {\n threadId: message.threadId,\n role: message.role,\n agentName: message.agentName,\n nodeName: message.nodeName,\n runId: message.runId,\n active: message.active,\n running: message.running,\n state: JSON.stringify(message.state),\n },\n };\n } else {\n throw new Error(\"Unknown message type\");\n }\n });\n}\n\nexport function filterAdjacentAgentStateMessages(\n messages: GenerateCopilotResponseMutation[\"generateCopilotResponse\"][\"messages\"],\n): GenerateCopilotResponseMutation[\"generateCopilotResponse\"][\"messages\"] {\n const filteredMessages: GenerateCopilotResponseMutation[\"generateCopilotResponse\"][\"messages\"] =\n [];\n\n messages.forEach((message, i) => {\n // keep all other message types\n if (message.__typename !== \"AgentStateMessageOutput\") {\n filteredMessages.push(message);\n } else {\n const prevAgentStateMessageIndex = filteredMessages.findIndex(\n // TODO: also check runId\n (m) => m.__typename === \"AgentStateMessageOutput\" && m.agentName === message.agentName,\n );\n if (prevAgentStateMessageIndex === -1) {\n filteredMessages.push(message);\n } else {\n filteredMessages[prevAgentStateMessageIndex] = message;\n }\n }\n });\n\n return filteredMessages;\n}\n\nexport function convertGqlOutputToMessages(\n messages: GenerateCopilotResponseMutation[\"generateCopilotResponse\"][\"messages\"],\n): Message[] {\n return messages.map((message) => {\n if (message.__typename === \"TextMessageOutput\") {\n return new TextMessage({\n id: message.id,\n role: message.role,\n content: message.content.join(\"\"),\n parentMessageId: message.parentMessageId,\n createdAt: new Date(),\n status: message.status || { code: MessageStatusCode.Pending },\n });\n } else if (message.__typename === \"ActionExecutionMessageOutput\") {\n return new ActionExecutionMessage({\n id: message.id,\n name: message.name,\n arguments: getPartialArguments(message.arguments),\n parentMessageId: message.parentMessageId,\n createdAt: new Date(),\n status: message.status || { code: MessageStatusCode.Pending },\n });\n } else if (message.__typename === \"ResultMessageOutput\") {\n return new ResultMessage({\n id: message.id,\n result: message.result,\n actionExecutionId: message.actionExecutionId,\n actionName: message.actionName,\n createdAt: new Date(),\n status: message.status || { code: MessageStatusCode.Pending },\n });\n } else if (message.__typename === \"AgentStateMessageOutput\") {\n return new AgentStateMessage({\n id: message.id,\n threadId: message.threadId,\n role: message.role,\n agentName: message.agentName,\n nodeName: message.nodeName,\n runId: message.runId,\n active: message.active,\n running: message.running,\n state: JSON.parse(message.state),\n createdAt: new Date(),\n });\n }\n\n throw new Error(\"Unknown message type\");\n });\n}\n\nexport function loadMessagesFromJsonRepresentation(json: any[]): Message[] {\n const result: Message[] = [];\n for (const item of json) {\n if (\"content\" in item) {\n result.push(\n new TextMessage({\n id: item.id,\n role: item.role,\n content: item.content,\n parentMessageId: item.parentMessageId,\n createdAt: item.createdAt || new Date(),\n status: item.status || { code: MessageStatusCode.Success },\n }),\n );\n } else if (\"arguments\" in item) {\n result.push(\n new ActionExecutionMessage({\n id: item.id,\n name: item.name,\n arguments: item.arguments,\n parentMessageId: item.parentMessageId,\n createdAt: item.createdAt || new Date(),\n status: item.status || { code: MessageStatusCode.Success },\n }),\n );\n } else if (\"result\" in item) {\n result.push(\n new ResultMessage({\n id: item.id,\n result: item.result,\n actionExecutionId: item.actionExecutionId,\n actionName: item.actionName,\n createdAt: item.createdAt || new Date(),\n status: item.status || { code: MessageStatusCode.Success },\n }),\n );\n } else if (\"state\" in item) {\n result.push(\n new AgentStateMessage({\n id: item.id,\n threadId: item.threadId,\n role: item.role,\n agentName: item.agentName,\n nodeName: item.nodeName,\n runId: item.runId,\n active: item.active,\n running: item.running,\n state: item.state,\n createdAt: item.createdAt || new Date(),\n }),\n );\n }\n }\n return result;\n}\n\nfunction getPartialArguments(args: string[]) {\n try {\n return JSON.parse(untruncateJson(args.join(\"\")));\n } catch (e) {\n return {};\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAOO;;;ACIL,cAAW;;;ACyCN,IAAK,0BAAL,kBAAKA,6BAAL;AACL,EAAAA,yBAAA,cAAW;AACX,EAAAA,yBAAA,aAAU;AACV,EAAAA,yBAAA,YAA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AAI,KAAK;AAAA,QACxC,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,oBAAoB,MAAgB;AAC3C,MAAI;AACF,WAAO,KAAK,UAAM,uBAAAC,SAAe,KAAK,KAAK,EAAE,CAAC,CAAC;AAAA,EACjD,SAAS,GAAP;AACA,WAAO,CAAC;AAAA,EACV;AACF;","names":["ActionInputAvailability","CopilotRequestType","FailedResponseStatusReason","MessageRole","MessageStatusCode","ResponseStatusCode","import_shared","untruncateJson"]}
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import "./chunk-7ECCT6PK.mjs";
2
2
  import {
3
3
  CopilotRuntimeClient
4
- } from "./chunk-YM67LRWL.mjs";
4
+ } from "./chunk-YFTCY2SE.mjs";
5
5
  import {
6
6
  convertGqlOutputToMessages,
7
7
  convertMessagesToGqlInput,
8
8
  filterAdjacentAgentStateMessages,
9
9
  filterAgentStateMessages,
10
10
  loadMessagesFromJsonRepresentation
11
- } from "./chunk-AXHVBZ73.mjs";
11
+ } from "./chunk-F7V6U3R3.mjs";
12
12
  import {
13
13
  ActionExecutionMessage,
14
14
  AgentStateMessage,
@@ -16,20 +16,21 @@ import {
16
16
  ResultMessage,
17
17
  Role,
18
18
  TextMessage
19
- } from "./chunk-IZDC2R6Y.mjs";
20
- import "./chunk-3BOGJG6W.mjs";
21
- import "./chunk-256E264G.mjs";
22
- import "./chunk-WK75ISB2.mjs";
19
+ } from "./chunk-LK6RTPT6.mjs";
20
+ import "./chunk-NXTNLFRB.mjs";
21
+ import "./chunk-4MIKTV2N.mjs";
22
+ import "./chunk-PS3E6BAR.mjs";
23
23
  import {
24
24
  ActionInputAvailability,
25
25
  AvailableAgentsDocument,
26
26
  CopilotRequestType,
27
27
  FailedResponseStatusReason,
28
28
  GenerateCopilotResponseDocument,
29
+ LoadAgentStateDocument,
29
30
  MessageRole,
30
31
  MessageStatusCode,
31
32
  ResponseStatusCode
32
- } from "./chunk-AOS57GRG.mjs";
33
+ } from "./chunk-2ELGSDSD.mjs";
33
34
  export {
34
35
  ActionExecutionMessage,
35
36
  ActionInputAvailability,
@@ -39,6 +40,7 @@ export {
39
40
  CopilotRuntimeClient,
40
41
  FailedResponseStatusReason,
41
42
  GenerateCopilotResponseDocument,
43
+ LoadAgentStateDocument,
42
44
  Message,
43
45
  MessageRole,
44
46
  MessageStatusCode,