@copilotkit/runtime-client-gql 1.10.7-next.0 → 1.50.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +0 -6
  2. package/dist/{chunk-TDZBGVZB.mjs → chunk-AMFKR5ST.mjs} +2 -2
  3. package/dist/{chunk-O7JH6IWQ.mjs → chunk-EIPAWDCN.mjs} +2 -2
  4. package/dist/{chunk-VVFJT2PN.mjs → chunk-NHOKFX55.mjs} +2 -1
  5. package/dist/chunk-NHOKFX55.mjs.map +1 -0
  6. package/dist/{chunk-TNC2H2EO.mjs → chunk-RNENVFJ3.mjs} +2 -2
  7. package/dist/chunk-RNENVFJ3.mjs.map +1 -0
  8. package/dist/{chunk-2R7M2FWR.mjs → chunk-SVJN2STA.mjs} +6 -6
  9. package/dist/chunk-SVJN2STA.mjs.map +1 -0
  10. package/dist/{chunk-UNOAOYT4.mjs → chunk-ZBNRBXIW.mjs} +2 -2
  11. package/dist/{chunk-UNOAOYT4.mjs.map → chunk-ZBNRBXIW.mjs.map} +1 -1
  12. package/dist/client/CopilotRuntimeClient.js +1 -1
  13. package/dist/client/CopilotRuntimeClient.js.map +1 -1
  14. package/dist/client/CopilotRuntimeClient.mjs +1 -1
  15. package/dist/client/conversion.js +1 -0
  16. package/dist/client/conversion.js.map +1 -1
  17. package/dist/client/conversion.mjs +2 -2
  18. package/dist/client/index.js +2 -1
  19. package/dist/client/index.js.map +1 -1
  20. package/dist/client/index.mjs +3 -3
  21. package/dist/client/types.d.ts +2 -1
  22. package/dist/client/types.js +1 -0
  23. package/dist/client/types.js.map +1 -1
  24. package/dist/client/types.mjs +1 -1
  25. package/dist/index.js +2 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +5 -5
  28. package/dist/message-conversion/agui-to-gql.js +1 -0
  29. package/dist/message-conversion/agui-to-gql.js.map +1 -1
  30. package/dist/message-conversion/agui-to-gql.mjs +4 -4
  31. package/dist/message-conversion/agui-to-gql.test.js +6 -5
  32. package/dist/message-conversion/agui-to-gql.test.js.map +1 -1
  33. package/dist/message-conversion/agui-to-gql.test.mjs +5 -5
  34. package/dist/message-conversion/gql-to-agui.js.map +1 -1
  35. package/dist/message-conversion/gql-to-agui.mjs +4 -4
  36. package/dist/message-conversion/gql-to-agui.test.js +6 -5
  37. package/dist/message-conversion/gql-to-agui.test.js.map +1 -1
  38. package/dist/message-conversion/gql-to-agui.test.mjs +5 -5
  39. package/dist/message-conversion/index.js +1 -0
  40. package/dist/message-conversion/index.js.map +1 -1
  41. package/dist/message-conversion/index.mjs +5 -5
  42. package/dist/message-conversion/roundtrip-conversion.test.js +6 -5
  43. package/dist/message-conversion/roundtrip-conversion.test.js.map +1 -1
  44. package/dist/message-conversion/roundtrip-conversion.test.mjs +6 -6
  45. package/package.json +19 -19
  46. package/src/client/types.ts +2 -1
  47. package/src/message-conversion/agui-to-gql.ts +1 -1
  48. package/dist/chunk-2R7M2FWR.mjs.map +0 -1
  49. package/dist/chunk-TNC2H2EO.mjs.map +0 -1
  50. package/dist/chunk-VVFJT2PN.mjs.map +0 -1
  51. /package/dist/{chunk-TDZBGVZB.mjs.map → chunk-AMFKR5ST.mjs.map} +0 -0
  52. /package/dist/{chunk-O7JH6IWQ.mjs.map → chunk-EIPAWDCN.mjs.map} +0 -0
@@ -4,19 +4,19 @@ import {
4
4
  gqlResultMessageToAGUIMessage,
5
5
  gqlTextMessageToAGUIMessage,
6
6
  gqlToAGUI
7
- } from "../chunk-O7JH6IWQ.mjs";
7
+ } from "../chunk-EIPAWDCN.mjs";
8
8
  import {
9
9
  describe,
10
10
  globalExpect,
11
11
  test,
12
12
  vi
13
- } from "../chunk-2R7M2FWR.mjs";
13
+ } from "../chunk-SVJN2STA.mjs";
14
14
  import "../chunk-7ECCT6PK.mjs";
15
- import "../chunk-UNOAOYT4.mjs";
15
+ import "../chunk-ZBNRBXIW.mjs";
16
16
  import "../chunk-WUF3XSW5.mjs";
17
17
  import "../chunk-EWRHYLZE.mjs";
18
18
  import "../chunk-AQ2Y6PF5.mjs";
19
- import "../chunk-TDZBGVZB.mjs";
19
+ import "../chunk-AMFKR5ST.mjs";
20
20
  import {
21
21
  ActionExecutionMessage,
22
22
  AgentStateMessage,
@@ -24,7 +24,7 @@ import {
24
24
  ResultMessage,
25
25
  Role,
26
26
  TextMessage
27
- } from "../chunk-VVFJT2PN.mjs";
27
+ } from "../chunk-NHOKFX55.mjs";
28
28
  import "../chunk-OBDQ5BWD.mjs";
29
29
  import "../chunk-DELDZXUX.mjs";
30
30
 
@@ -75,6 +75,7 @@ var TextMessage = class extends Message {
75
75
  constructor(props) {
76
76
  super(props);
77
77
  this.type = "TextMessage";
78
+ this.type = "TextMessage";
78
79
  }
79
80
  };
80
81
  var ActionExecutionMessage = class extends Message {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/message-conversion/index.ts","../../src/graphql/@generated/graphql.ts","../../src/client/types.ts","../../src/message-conversion/agui-to-gql.ts","../../src/message-conversion/gql-to-agui.ts"],"sourcesContent":["export * from \"./agui-to-gql\";\nexport * from \"./gql-to-agui\";\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 config?: InputMaybe<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 BaseMetaEvent = {\n name: MetaEventName;\n type: Scalars['String']['output'];\n};\n\nexport type BaseResponseStatus = {\n code: ResponseStatusCode;\n};\n\nexport type CloudInput = {\n guardrails?: InputMaybe<GuardrailsInput>;\n};\n\nexport type CopilotContextInput = {\n description: Scalars['String']['input'];\n value: Scalars['String']['input'];\n};\n\nexport type CopilotKitLangGraphInterruptEvent = BaseMetaEvent & {\n __typename?: 'CopilotKitLangGraphInterruptEvent';\n data: CopilotKitLangGraphInterruptEventData;\n name: MetaEventName;\n response?: Maybe<Scalars['String']['output']>;\n type: Scalars['String']['output'];\n};\n\nexport type CopilotKitLangGraphInterruptEventData = {\n __typename?: 'CopilotKitLangGraphInterruptEventData';\n messages: Array<BaseMessageOutput>;\n value: Scalars['String']['output'];\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 metaEvents?: Maybe<Array<BaseMetaEvent>>;\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 context?: InputMaybe<Array<CopilotContextInput>>;\n extensions?: InputMaybe<ExtensionsInput>;\n forwardedParameters?: InputMaybe<ForwardedParametersInput>;\n frontend: FrontendInput;\n messages: Array<MessageInput>;\n metaEvents?: InputMaybe<Array<MetaEventInput>>;\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 ImageMessageInput = {\n bytes: Scalars['String']['input'];\n format: Scalars['String']['input'];\n parentMessageId?: InputMaybe<Scalars['String']['input']>;\n role: MessageRole;\n};\n\nexport type ImageMessageOutput = BaseMessageOutput & {\n __typename?: 'ImageMessageOutput';\n bytes: Scalars['String']['output'];\n createdAt: Scalars['DateTimeISO']['output'];\n format: Scalars['String']['output'];\n id: Scalars['String']['output'];\n parentMessageId?: Maybe<Scalars['String']['output']>;\n role: MessageRole;\n status: MessageStatus;\n};\n\nexport type LangGraphInterruptEvent = BaseMetaEvent & {\n __typename?: 'LangGraphInterruptEvent';\n name: MetaEventName;\n response?: Maybe<Scalars['String']['output']>;\n type: Scalars['String']['output'];\n value: Scalars['String']['output'];\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 imageMessage?: InputMaybe<ImageMessageInput>;\n resultMessage?: InputMaybe<ResultMessageInput>;\n textMessage?: InputMaybe<TextMessageInput>;\n};\n\n/** The role of the message */\nexport enum MessageRole {\n Assistant = 'assistant',\n Developer = 'developer',\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 MetaEventInput = {\n messages?: InputMaybe<Array<MessageInput>>;\n name: MetaEventName;\n response?: InputMaybe<Scalars['String']['input']>;\n value: Scalars['String']['input'];\n};\n\n/** Meta event types */\nexport enum MetaEventName {\n CopilotKitLangGraphInterruptEvent = 'CopilotKitLangGraphInterruptEvent',\n LangGraphInterruptEvent = 'LangGraphInterruptEvent'\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: 'ImageMessageOutput', id: string, createdAt: any, format: string, bytes: string, role: MessageRole, parentMessageId?: string | null, 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 } }>, metaEvents?: Array<{ __typename?: 'CopilotKitLangGraphInterruptEvent', type: string, name: MetaEventName, data: { __typename?: 'CopilotKitLangGraphInterruptEventData', value: string, 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, status: { __typename?: 'FailedMessageStatus', code: MessageStatusCode, reason: string } | { __typename?: 'PendingMessageStatus', code: MessageStatusCode } | { __typename?: 'SuccessMessageStatus', code: MessageStatusCode } } | { __typename: 'ImageMessageOutput', id: string, createdAt: any, 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?: 'LangGraphInterruptEvent', type: string, name: MetaEventName, value: string }> | null } & ({ __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\":\"ImageMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"format\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"bytes\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"role\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"parentMessageId\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"ActionExecutionMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"name\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"arguments\"},\"directives\":[{\"kind\":\"Directive\",\"name\":{\"kind\":\"Name\",\"value\":\"stream\"}}]},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"parentMessageId\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"ResultMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"result\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"actionExecutionId\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"actionName\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"AgentStateMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"threadId\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"state\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"running\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"agentName\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"nodeName\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"runId\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"active\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"role\"}}]}}]}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"metaEvents\"},\"directives\":[{\"kind\":\"Directive\",\"name\":{\"kind\":\"Name\",\"value\":\"stream\"}}],\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"LangGraphInterruptEvent\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"type\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"name\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"value\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"CopilotKitLangGraphInterruptEvent\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"type\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"name\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"data\"},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"messages\"},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"__typename\"}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"BaseMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"id\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"createdAt\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"BaseMessageOutput\"}},\"directives\":[{\"kind\":\"Directive\",\"name\":{\"kind\":\"Name\",\"value\":\"defer\"}}],\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"status\"},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"SuccessMessageStatus\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"code\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"FailedMessageStatus\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"code\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"reason\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"PendingMessageStatus\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"code\"}}]}}]}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"TextMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"content\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"role\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"parentMessageId\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"ActionExecutionMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"name\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"arguments\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"parentMessageId\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"ResultMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"result\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"actionExecutionId\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"actionName\"}}]}}]}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"value\"}}]}}]}}]}}]}}]}}]} 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>;","import { randomId } from \"@copilotkit/shared\";\nimport {\n ActionExecutionMessageInput,\n MessageRole,\n MessageStatus,\n ResultMessageInput,\n TextMessageInput,\n BaseMessageOutput,\n AgentStateMessageInput,\n MessageStatusCode,\n LangGraphInterruptEvent as GqlLangGraphInterruptEvent,\n MetaEventName,\n CopilotKitLangGraphInterruptEvent as GqlCopilotKitLangGraphInterruptEvent,\n ImageMessageInput,\n} from \"../graphql/@generated/graphql\";\nimport { parseJson } from \"@copilotkit/shared\";\n\ntype MessageType =\n | \"TextMessage\"\n | \"ActionExecutionMessage\"\n | \"ResultMessage\"\n | \"AgentStateMessage\"\n | \"ImageMessage\";\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 isImageMessage(): this is ImageMessage {\n return this.type === \"ImageMessage\";\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 return parseJson(result, result);\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\ntype ImageMessageConstructorOptions = MessageConstructorOptions & ImageMessageInput;\n\nexport class ImageMessage extends Message implements ImageMessageConstructorOptions {\n format: ImageMessageInput[\"format\"];\n bytes: ImageMessageInput[\"bytes\"];\n role: ImageMessageInput[\"role\"];\n parentMessageId: ImageMessageInput[\"parentMessageId\"];\n\n constructor(props: ImageMessageConstructorOptions) {\n super(props);\n this.type = \"ImageMessage\";\n }\n}\n\nexport function langGraphInterruptEvent(\n eventProps: Omit<LangGraphInterruptEvent, \"name\" | \"type\" | \"__typename\">,\n): LangGraphInterruptEvent {\n return { ...eventProps, name: MetaEventName.LangGraphInterruptEvent, type: \"MetaEvent\" };\n}\n\nexport type LangGraphInterruptEvent<TValue extends any = any> = GqlLangGraphInterruptEvent & {\n value: TValue;\n};\n\ntype CopilotKitLangGraphInterruptEvent<TValue extends any = any> =\n GqlCopilotKitLangGraphInterruptEvent & {\n data: GqlCopilotKitLangGraphInterruptEvent[\"data\"] & { value: TValue };\n };\n\nexport type MetaEvent = LangGraphInterruptEvent | CopilotKitLangGraphInterruptEvent;\n","import * as gql from \"../client\";\nimport { MessageRole } from \"../graphql/@generated/graphql\";\nimport agui from \"@copilotkit/shared\"; // named agui for clarity, but this only includes agui message types\n\n// Helper function to extract agent name from message\nfunction extractAgentName(message: agui.Message): string {\n if (message.role !== \"assistant\") {\n throw new Error(`Cannot extract agent name from message with role ${message.role}`);\n }\n\n return message.agentName || \"unknown\";\n}\n\n// Type guard for agent state message\nfunction isAgentStateMessage(message: agui.Message): boolean {\n return message.role === \"assistant\" && \"agentName\" in message && \"state\" in message;\n}\n\n// Type guard for messages with image property\nfunction hasImageProperty(message: agui.Message): boolean {\n const canContainImage = message.role === \"assistant\" || message.role === \"user\";\n if (!canContainImage || message.image === undefined) {\n return false;\n }\n\n const isMalformed = message.image.format === undefined || message.image.bytes === undefined;\n if (isMalformed) {\n return false;\n }\n\n return true;\n}\n\n/*\n ----------------------------\n AGUI Message -> GQL Message\n ----------------------------\n*/\nexport function aguiToGQL(\n messages: agui.Message[] | agui.Message,\n actions?: Record<string, any>,\n coAgentStateRenders?: Record<string, any>,\n): gql.Message[] {\n const gqlMessages: gql.Message[] = [];\n messages = Array.isArray(messages) ? messages : [messages];\n\n // Track tool call names by their IDs for use in result messages\n const toolCallNames: Record<string, string> = {};\n\n for (const message of messages) {\n // Agent state message support\n if (isAgentStateMessage(message)) {\n const agentName = extractAgentName(message);\n const state = \"state\" in message && message.state ? message.state : {};\n gqlMessages.push(\n new gql.AgentStateMessage({\n id: message.id,\n agentName,\n state,\n role: gql.Role.Assistant,\n }),\n );\n // Optionally preserve render function\n if (\"generativeUI\" in message && message.generativeUI && coAgentStateRenders) {\n coAgentStateRenders[agentName] = {\n name: agentName,\n render: message.generativeUI,\n };\n }\n continue;\n }\n\n if (hasImageProperty(message)) {\n gqlMessages.push(aguiMessageWithImageToGQLMessage(message));\n continue;\n }\n\n // Action execution message support\n if (message.role === \"assistant\" && message.toolCalls) {\n gqlMessages.push(aguiTextMessageToGQLMessage(message));\n for (const toolCall of message.toolCalls) {\n // Track the tool call name by its ID\n toolCallNames[toolCall.id] = toolCall.function.name;\n\n const actionExecMsg = aguiToolCallToGQLActionExecution(toolCall, message.id);\n // Preserve render function in actions context\n if (\"generativeUI\" in message && message.generativeUI && actions) {\n const actionName = toolCall.function.name;\n // Check for specific action first, then wild card action\n const specificAction = Object.values(actions).find(\n (action: any) => action.name === actionName,\n );\n const wildcardAction = Object.values(actions).find((action: any) => action.name === \"*\");\n\n // Assign render function to the matching action (specific takes priority)\n if (specificAction) {\n specificAction.render = message.generativeUI;\n } else if (wildcardAction) {\n wildcardAction.render = message.generativeUI;\n }\n }\n gqlMessages.push(actionExecMsg);\n }\n continue;\n }\n // Regular text messages\n if (\n message.role === \"developer\" ||\n message.role === \"system\" ||\n message.role === \"assistant\" ||\n message.role === \"user\"\n ) {\n gqlMessages.push(aguiTextMessageToGQLMessage(message));\n continue;\n }\n // Tool result message\n if (message.role === \"tool\") {\n gqlMessages.push(aguiToolMessageToGQLResultMessage(message, toolCallNames));\n continue;\n }\n throw new Error(\n `Unknown message role: \"${(message as any).role}\" in message with id: ${(message as any).id}`,\n );\n }\n\n return gqlMessages;\n}\n\nexport function aguiTextMessageToGQLMessage(message: agui.Message): gql.TextMessage {\n if (\n message.role !== \"developer\" &&\n message.role !== \"system\" &&\n message.role !== \"assistant\" &&\n message.role !== \"user\"\n ) {\n throw new Error(`Cannot convert message with role ${message.role} to TextMessage`);\n }\n\n let roleValue: MessageRole;\n\n if (message.role === \"developer\") {\n roleValue = gql.Role.Developer;\n } else if (message.role === \"system\") {\n roleValue = gql.Role.System;\n } else if (message.role === \"assistant\") {\n roleValue = gql.Role.Assistant;\n } else {\n roleValue = gql.Role.User;\n }\n\n return new gql.TextMessage({\n id: message.id,\n content: message.content || \"\",\n role: roleValue,\n });\n}\n\nexport function aguiToolCallToGQLActionExecution(\n toolCall: agui.ToolCall,\n parentMessageId: string,\n): gql.ActionExecutionMessage {\n if (toolCall.type !== \"function\") {\n throw new Error(`Unsupported tool call type: ${toolCall.type}`);\n }\n\n // Handle arguments - they should be a JSON string in AGUI format,\n // but we need to convert them to an object for GQL format\n let argumentsObj: any;\n\n if (typeof toolCall.function.arguments === \"string\") {\n // Expected case: arguments is a JSON string\n try {\n argumentsObj = JSON.parse(toolCall.function.arguments);\n } catch (error) {\n console.warn(`Failed to parse tool call arguments for ${toolCall.function.name}:`, error);\n // Provide fallback empty object to prevent application crash\n argumentsObj = {};\n }\n } else if (\n typeof toolCall.function.arguments === \"object\" &&\n toolCall.function.arguments !== null\n ) {\n // Backward compatibility: arguments is already an object\n argumentsObj = toolCall.function.arguments;\n } else {\n // Fallback for undefined, null, or other types\n console.warn(\n `Invalid tool call arguments type for ${toolCall.function.name}:`,\n typeof toolCall.function.arguments,\n );\n argumentsObj = {};\n }\n\n // Always include name and arguments\n return new gql.ActionExecutionMessage({\n id: toolCall.id,\n name: toolCall.function.name,\n arguments: argumentsObj,\n parentMessageId: parentMessageId,\n });\n}\n\nexport function aguiToolMessageToGQLResultMessage(\n message: agui.Message,\n toolCallNames: Record<string, string>,\n): gql.ResultMessage {\n if (message.role !== \"tool\") {\n throw new Error(`Cannot convert message with role ${message.role} to ResultMessage`);\n }\n\n if (!message.toolCallId) {\n throw new Error(\"Tool message must have a toolCallId\");\n }\n\n const actionName = toolCallNames[message.toolCallId] || \"unknown\";\n\n // Handle result content - it could be a string or an object that needs serialization\n let resultContent: string;\n const messageContent = message.content || \"\";\n\n if (typeof messageContent === \"string\") {\n // Expected case: content is already a string\n resultContent = messageContent;\n } else if (typeof messageContent === \"object\" && messageContent !== null) {\n // Handle case where content is an object that needs to be serialized\n try {\n resultContent = JSON.stringify(messageContent);\n } catch (error) {\n console.warn(`Failed to stringify tool result for ${actionName}:`, error);\n resultContent = String(messageContent);\n }\n } else {\n // Handle other types (number, boolean, etc.)\n resultContent = String(messageContent);\n }\n\n return new gql.ResultMessage({\n id: message.id,\n result: resultContent,\n actionExecutionId: message.toolCallId,\n actionName: message.toolName || actionName,\n });\n}\n\n// New function to handle AGUI messages with render functions\nexport function aguiMessageWithRenderToGQL(\n message: agui.Message,\n actions?: Record<string, any>,\n coAgentStateRenders?: Record<string, any>,\n): gql.Message[] {\n // Handle the special case: assistant messages with render function but no tool calls\n if (\n message.role === \"assistant\" &&\n \"generativeUI\" in message &&\n message.generativeUI &&\n !message.toolCalls\n ) {\n const gqlMessages: gql.Message[] = [];\n gqlMessages.push(\n new gql.AgentStateMessage({\n id: message.id,\n agentName: \"unknown\",\n state: {},\n role: gql.Role.Assistant,\n }),\n );\n if (coAgentStateRenders) {\n coAgentStateRenders.unknown = {\n name: \"unknown\",\n render: message.generativeUI,\n };\n }\n return gqlMessages;\n }\n\n // For all other cases, delegate to aguiToGQL\n return aguiToGQL([message], actions, coAgentStateRenders);\n}\n\nexport function aguiMessageWithImageToGQLMessage(message: agui.Message): gql.ImageMessage {\n if (!hasImageProperty(message)) {\n throw new Error(`Cannot convert message to ImageMessage: missing format or bytes`);\n }\n\n let roleValue: MessageRole;\n if (message.role === \"assistant\") {\n roleValue = gql.Role.Assistant;\n } else {\n roleValue = gql.Role.User;\n }\n\n if (message.role !== \"assistant\" && message.role !== \"user\") {\n throw new Error(`Cannot convert message with role ${message.role} to ImageMessage`);\n }\n\n return new gql.ImageMessage({\n id: message.id,\n format: message.image!.format,\n bytes: message.image!.bytes,\n role: roleValue,\n });\n}\n","import * as gql from \"../client\";\nimport agui from \"@copilotkit/shared\";\nimport { MessageStatusCode } from \"../graphql/@generated/graphql\";\n\n// Define valid image formats based on the supported formats in the codebase\nconst VALID_IMAGE_FORMATS = [\"jpeg\", \"png\", \"webp\", \"gif\"] as const;\ntype ValidImageFormat = (typeof VALID_IMAGE_FORMATS)[number];\n\n// Validation function for image format\nfunction validateImageFormat(format: string): format is ValidImageFormat {\n return VALID_IMAGE_FORMATS.includes(format as ValidImageFormat);\n}\n\n/*\n ----------------------------\n GQL Message -> AGUI Message\n ----------------------------\n*/\nexport function gqlToAGUI(\n messages: gql.Message[] | gql.Message,\n actions?: Record<string, any>,\n coAgentStateRenders?: Record<string, any>,\n): agui.Message[] {\n let aguiMessages: agui.Message[] = [];\n messages = Array.isArray(messages) ? messages : [messages];\n\n // Create a map of action execution ID to result for completed actions\n const actionResults = new Map<string, string>();\n for (const message of messages) {\n if (message.isResultMessage()) {\n actionResults.set(message.actionExecutionId, message.result);\n }\n }\n\n for (const message of messages) {\n if (message.isTextMessage()) {\n aguiMessages.push(gqlTextMessageToAGUIMessage(message));\n } else if (message.isResultMessage()) {\n aguiMessages.push(gqlResultMessageToAGUIMessage(message));\n } else if (message.isActionExecutionMessage()) {\n aguiMessages.push(gqlActionExecutionMessageToAGUIMessage(message, actions, actionResults));\n } else if (message.isAgentStateMessage()) {\n aguiMessages.push(gqlAgentStateMessageToAGUIMessage(message, coAgentStateRenders));\n } else if (message.isImageMessage()) {\n aguiMessages.push(gqlImageMessageToAGUIMessage(message));\n } else {\n throw new Error(\"Unknown message type\");\n }\n }\n\n return aguiMessages;\n}\n\nexport function gqlActionExecutionMessageToAGUIMessage(\n message: gql.ActionExecutionMessage,\n actions?: Record<string, any>,\n actionResults?: Map<string, string>,\n): agui.Message {\n // Check if we have actions and if there's a specific action or wild card action\n const hasSpecificAction =\n actions && Object.values(actions).some((action: any) => action.name === message.name);\n const hasWildcardAction =\n actions && Object.values(actions).some((action: any) => action.name === \"*\");\n\n if (!actions || (!hasSpecificAction && !hasWildcardAction)) {\n return {\n id: message.id,\n role: \"assistant\",\n toolCalls: [actionExecutionMessageToAGUIMessage(message)],\n name: message.name,\n };\n }\n\n // Find the specific action first, then fall back to wild card action\n const action =\n Object.values(actions).find((action: any) => action.name === message.name) ||\n Object.values(actions).find((action: any) => action.name === \"*\");\n\n // Create render function wrapper that provides proper props\n const createRenderWrapper = (originalRender: any) => {\n if (!originalRender) return undefined;\n\n return (props?: any) => {\n // Determine the correct status based on the same logic as RenderActionExecutionMessage\n let actionResult: any = actionResults?.get(message.id);\n let status: \"inProgress\" | \"executing\" | \"complete\" = \"inProgress\";\n\n if (actionResult !== undefined) {\n status = \"complete\";\n } else if (message.status?.code !== MessageStatusCode.Pending) {\n status = \"executing\";\n }\n\n // if props.result is a string, parse it as JSON but don't throw an error if it's not valid JSON\n if (typeof props?.result === \"string\") {\n try {\n props.result = JSON.parse(props.result);\n } catch (e) {\n /* do nothing */\n }\n }\n\n // if actionResult is a string, parse it as JSON but don't throw an error if it's not valid JSON\n if (typeof actionResult === \"string\") {\n try {\n actionResult = JSON.parse(actionResult);\n } catch (e) {\n /* do nothing */\n }\n }\n\n // Base props that all actions receive\n const baseProps = {\n status: props?.status || status,\n args: message.arguments || {},\n result: props?.result || actionResult || undefined,\n messageId: message.id,\n };\n\n // Add properties based on action type\n if (action.name === \"*\") {\n // Wildcard actions get the tool name; ensure it cannot be overridden by incoming props\n return originalRender({\n ...baseProps,\n ...props,\n name: message.name,\n });\n } else {\n // Regular actions get respond (defaulting to a no-op if not provided)\n const respond = props?.respond ?? (() => {});\n return originalRender({\n ...baseProps,\n ...props,\n respond,\n });\n }\n };\n };\n\n return {\n id: message.id,\n role: \"assistant\",\n content: \"\",\n toolCalls: [actionExecutionMessageToAGUIMessage(message)],\n generativeUI: createRenderWrapper(action.render),\n name: message.name,\n } as agui.AIMessage;\n}\n\nfunction gqlAgentStateMessageToAGUIMessage(\n message: gql.AgentStateMessage,\n coAgentStateRenders?: Record<string, any>,\n): agui.Message {\n if (\n coAgentStateRenders &&\n Object.values(coAgentStateRenders).some((render: any) => render.name === message.agentName)\n ) {\n const render = Object.values(coAgentStateRenders).find(\n (render: any) => render.name === message.agentName,\n );\n\n // Create render function wrapper that provides proper props\n const createRenderWrapper = (originalRender: any) => {\n if (!originalRender) return undefined;\n\n return (props?: any) => {\n // Determine the correct status based on the same logic as RenderActionExecutionMessage\n const state = message.state;\n\n // Provide the full props structure that the render function expects\n const renderProps = {\n state: state,\n };\n\n return originalRender(renderProps);\n };\n };\n\n return {\n id: message.id,\n role: \"assistant\",\n generativeUI: createRenderWrapper(render.render),\n agentName: message.agentName,\n state: message.state,\n };\n }\n\n return {\n id: message.id,\n role: \"assistant\",\n agentName: message.agentName,\n state: message.state,\n };\n}\n\nfunction actionExecutionMessageToAGUIMessage(\n actionExecutionMessage: gql.ActionExecutionMessage,\n): agui.ToolCall {\n return {\n id: actionExecutionMessage.id,\n function: {\n name: actionExecutionMessage.name,\n arguments: JSON.stringify(actionExecutionMessage.arguments),\n },\n type: \"function\",\n };\n}\n\nexport function gqlTextMessageToAGUIMessage(message: gql.TextMessage): agui.Message {\n switch (message.role) {\n case gql.Role.Developer:\n return {\n id: message.id,\n role: \"developer\",\n content: message.content,\n };\n case gql.Role.System:\n return {\n id: message.id,\n role: \"system\",\n content: message.content,\n };\n case gql.Role.Assistant:\n return {\n id: message.id,\n role: \"assistant\",\n content: message.content,\n };\n case gql.Role.User:\n return {\n id: message.id,\n role: \"user\",\n content: message.content,\n };\n default:\n throw new Error(\"Unknown message role\");\n }\n}\n\nexport function gqlResultMessageToAGUIMessage(message: gql.ResultMessage): agui.Message {\n return {\n id: message.id,\n role: \"tool\",\n content: message.result,\n toolCallId: message.actionExecutionId,\n toolName: message.actionName,\n };\n}\n\nexport function gqlImageMessageToAGUIMessage(message: gql.ImageMessage): agui.Message {\n // Validate image format\n if (!validateImageFormat(message.format)) {\n throw new Error(\n `Invalid image format: ${message.format}. Supported formats are: ${VALID_IMAGE_FORMATS.join(\", \")}`,\n );\n }\n\n // Validate that bytes is a non-empty string\n if (!message.bytes || typeof message.bytes !== \"string\" || message.bytes.trim() === \"\") {\n throw new Error(\"Image bytes must be a non-empty string\");\n }\n\n // Determine the role based on the message role\n const role = message.role === gql.Role.Assistant ? \"assistant\" : \"user\";\n\n // Create the image message with proper typing\n const imageMessage: agui.Message = {\n id: message.id,\n role,\n content: \"\",\n image: {\n format: message.format,\n bytes: message.bytes,\n },\n };\n\n return imageMessage;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC+RO,IAAK,cAAL,kBAAKA,iBAAL;AACL,EAAAA,aAAA,eAAY;AACZ,EAAAA,aAAA,eAAY;AACZ,EAAAA,aAAA,YAAS;AACT,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,UAAO;AALG,SAAAA;AAAA,GAAA;;;AC/RZ,oBAAyB;AAezB,IAAAC,iBAA0B;AASnB,IAAM,UAAN,MAAc;AAAA,EAMnB,YAAY,OAAY;AACtB,UAAM,OAAN,MAAM,SAAO,wBAAS;AACtB,UAAM,WAAN,MAAM,SAAW,EAAE,8BAAgC;AACnD,UAAM,cAAN,MAAM,YAAc,oBAAI,KAAK;AAC7B,WAAO,OAAO,MAAM,KAAK;AAAA,EAC3B;AAAA,EAEA,gBAAqC;AACnC,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,2BAA2D;AACzD,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,kBAAyC;AACvC,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,sBAAiD;AAC/C,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,iBAAuC;AACrC,WAAO,KAAK,SAAS;AAAA,EACvB;AACF;AAGO,IAAM,OAAO;AAOb,IAAM,cAAN,cAA0B,QAAi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,QACL,IAAI,QAAQ;AAAA,QACZ,MAAM;AAAA,QACN,SAAS,QAAQ;AAAA,MACnB;AAAA,IACF,KAAS,KAAK;AACZ,aAAO;AAAA,QACL,IAAI,QAAQ;AAAA,QACZ,MAAM;AAAA,QACN,SAAS,QAAQ;AAAA,MACnB;AAAA,IACF;AACE,YAAM,IAAI,MAAM,sBAAsB;AAAA,EAC1C;AACF;AAEO,SAAS,8BAA8B,SAA0C;AACtF,SAAO;AAAA,IACL,IAAI,QAAQ;AAAA,IACZ,MAAM;AAAA,IACN,SAAS,QAAQ;AAAA,IACjB,YAAY,QAAQ;AAAA,IACpB,UAAU,QAAQ;AAAA,EACpB;AACF;AAEO,SAAS,6BAA6B,SAAyC;AAEpF,MAAI,CAAC,oBAAoB,QAAQ,MAAM,GAAG;AACxC,UAAM,IAAI;AAAA,MACR,yBAAyB,QAAQ,kCAAkC,oBAAoB,KAAK,IAAI;AAAA,IAClG;AAAA,EACF;AAGA,MAAI,CAAC,QAAQ,SAAS,OAAO,QAAQ,UAAU,YAAY,QAAQ,MAAM,KAAK,MAAM,IAAI;AACtF,UAAM,IAAI,MAAM,wCAAwC;AAAA,EAC1D;AAGA,QAAM,OAAO,QAAQ,SAAa,KAAK,YAAY,cAAc;AAGjE,QAAM,eAA6B;AAAA,IACjC,IAAI,QAAQ;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,IACT,OAAO;AAAA,MACL,QAAQ,QAAQ;AAAA,MAChB,OAAO,QAAQ;AAAA,IACjB;AAAA,EACF;AAEA,SAAO;AACT;","names":["MessageRole","import_shared","action","render"]}
1
+ {"version":3,"sources":["../../src/message-conversion/index.ts","../../src/graphql/@generated/graphql.ts","../../src/client/types.ts","../../src/message-conversion/agui-to-gql.ts","../../src/message-conversion/gql-to-agui.ts"],"sourcesContent":["export * from \"./agui-to-gql\";\nexport * from \"./gql-to-agui\";\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 config?: InputMaybe<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 BaseMetaEvent = {\n name: MetaEventName;\n type: Scalars['String']['output'];\n};\n\nexport type BaseResponseStatus = {\n code: ResponseStatusCode;\n};\n\nexport type CloudInput = {\n guardrails?: InputMaybe<GuardrailsInput>;\n};\n\nexport type CopilotContextInput = {\n description: Scalars['String']['input'];\n value: Scalars['String']['input'];\n};\n\nexport type CopilotKitLangGraphInterruptEvent = BaseMetaEvent & {\n __typename?: 'CopilotKitLangGraphInterruptEvent';\n data: CopilotKitLangGraphInterruptEventData;\n name: MetaEventName;\n response?: Maybe<Scalars['String']['output']>;\n type: Scalars['String']['output'];\n};\n\nexport type CopilotKitLangGraphInterruptEventData = {\n __typename?: 'CopilotKitLangGraphInterruptEventData';\n messages: Array<BaseMessageOutput>;\n value: Scalars['String']['output'];\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 metaEvents?: Maybe<Array<BaseMetaEvent>>;\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 context?: InputMaybe<Array<CopilotContextInput>>;\n extensions?: InputMaybe<ExtensionsInput>;\n forwardedParameters?: InputMaybe<ForwardedParametersInput>;\n frontend: FrontendInput;\n messages: Array<MessageInput>;\n metaEvents?: InputMaybe<Array<MetaEventInput>>;\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 ImageMessageInput = {\n bytes: Scalars['String']['input'];\n format: Scalars['String']['input'];\n parentMessageId?: InputMaybe<Scalars['String']['input']>;\n role: MessageRole;\n};\n\nexport type ImageMessageOutput = BaseMessageOutput & {\n __typename?: 'ImageMessageOutput';\n bytes: Scalars['String']['output'];\n createdAt: Scalars['DateTimeISO']['output'];\n format: Scalars['String']['output'];\n id: Scalars['String']['output'];\n parentMessageId?: Maybe<Scalars['String']['output']>;\n role: MessageRole;\n status: MessageStatus;\n};\n\nexport type LangGraphInterruptEvent = BaseMetaEvent & {\n __typename?: 'LangGraphInterruptEvent';\n name: MetaEventName;\n response?: Maybe<Scalars['String']['output']>;\n type: Scalars['String']['output'];\n value: Scalars['String']['output'];\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 imageMessage?: InputMaybe<ImageMessageInput>;\n resultMessage?: InputMaybe<ResultMessageInput>;\n textMessage?: InputMaybe<TextMessageInput>;\n};\n\n/** The role of the message */\nexport enum MessageRole {\n Assistant = 'assistant',\n Developer = 'developer',\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 MetaEventInput = {\n messages?: InputMaybe<Array<MessageInput>>;\n name: MetaEventName;\n response?: InputMaybe<Scalars['String']['input']>;\n value: Scalars['String']['input'];\n};\n\n/** Meta event types */\nexport enum MetaEventName {\n CopilotKitLangGraphInterruptEvent = 'CopilotKitLangGraphInterruptEvent',\n LangGraphInterruptEvent = 'LangGraphInterruptEvent'\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: 'ImageMessageOutput', id: string, createdAt: any, format: string, bytes: string, role: MessageRole, parentMessageId?: string | null, 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 } }>, metaEvents?: Array<{ __typename?: 'CopilotKitLangGraphInterruptEvent', type: string, name: MetaEventName, data: { __typename?: 'CopilotKitLangGraphInterruptEventData', value: string, 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, status: { __typename?: 'FailedMessageStatus', code: MessageStatusCode, reason: string } | { __typename?: 'PendingMessageStatus', code: MessageStatusCode } | { __typename?: 'SuccessMessageStatus', code: MessageStatusCode } } | { __typename: 'ImageMessageOutput', id: string, createdAt: any, 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?: 'LangGraphInterruptEvent', type: string, name: MetaEventName, value: string }> | null } & ({ __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\":\"ImageMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"format\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"bytes\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"role\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"parentMessageId\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"ActionExecutionMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"name\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"arguments\"},\"directives\":[{\"kind\":\"Directive\",\"name\":{\"kind\":\"Name\",\"value\":\"stream\"}}]},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"parentMessageId\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"ResultMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"result\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"actionExecutionId\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"actionName\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"AgentStateMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"threadId\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"state\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"running\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"agentName\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"nodeName\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"runId\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"active\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"role\"}}]}}]}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"metaEvents\"},\"directives\":[{\"kind\":\"Directive\",\"name\":{\"kind\":\"Name\",\"value\":\"stream\"}}],\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"LangGraphInterruptEvent\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"type\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"name\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"value\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"CopilotKitLangGraphInterruptEvent\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"type\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"name\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"data\"},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"messages\"},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"__typename\"}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"BaseMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"id\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"createdAt\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"BaseMessageOutput\"}},\"directives\":[{\"kind\":\"Directive\",\"name\":{\"kind\":\"Name\",\"value\":\"defer\"}}],\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"status\"},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"SuccessMessageStatus\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"code\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"FailedMessageStatus\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"code\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"reason\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"PendingMessageStatus\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"code\"}}]}}]}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"TextMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"content\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"role\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"parentMessageId\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"ActionExecutionMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"name\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"arguments\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"parentMessageId\"}}]}},{\"kind\":\"InlineFragment\",\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"ResultMessageOutput\"}},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"result\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"actionExecutionId\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"actionName\"}}]}}]}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"value\"}}]}}]}}]}}]}}]}}]} 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>;","import { randomId } from \"@copilotkit/shared\";\nimport {\n ActionExecutionMessageInput,\n MessageRole,\n MessageStatus,\n ResultMessageInput,\n TextMessageInput,\n BaseMessageOutput,\n AgentStateMessageInput,\n MessageStatusCode,\n LangGraphInterruptEvent as GqlLangGraphInterruptEvent,\n MetaEventName,\n CopilotKitLangGraphInterruptEvent as GqlCopilotKitLangGraphInterruptEvent,\n ImageMessageInput,\n} from \"../graphql/@generated/graphql\";\nimport { parseJson } from \"@copilotkit/shared\";\n\ntype MessageType =\n | \"TextMessage\"\n | \"ActionExecutionMessage\"\n | \"ResultMessage\"\n | \"AgentStateMessage\"\n | \"ImageMessage\";\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 isImageMessage(): this is ImageMessage {\n return this.type === \"ImageMessage\";\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 content: TextMessageInput[\"content\"];\n parentMessageId: TextMessageInput[\"parentMessageId\"];\n role: TextMessageInput[\"role\"];\n type = \"TextMessage\" as const;\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 return parseJson(result, result);\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\ntype ImageMessageConstructorOptions = MessageConstructorOptions & ImageMessageInput;\n\nexport class ImageMessage extends Message implements ImageMessageConstructorOptions {\n format: ImageMessageInput[\"format\"];\n bytes: ImageMessageInput[\"bytes\"];\n role: ImageMessageInput[\"role\"];\n parentMessageId: ImageMessageInput[\"parentMessageId\"];\n\n constructor(props: ImageMessageConstructorOptions) {\n super(props);\n this.type = \"ImageMessage\";\n }\n}\n\nexport function langGraphInterruptEvent(\n eventProps: Omit<LangGraphInterruptEvent, \"name\" | \"type\" | \"__typename\">,\n): LangGraphInterruptEvent {\n return { ...eventProps, name: MetaEventName.LangGraphInterruptEvent, type: \"MetaEvent\" };\n}\n\nexport type LangGraphInterruptEvent<TValue extends any = any> = GqlLangGraphInterruptEvent & {\n value: TValue;\n};\n\ntype CopilotKitLangGraphInterruptEvent<TValue extends any = any> =\n GqlCopilotKitLangGraphInterruptEvent & {\n data: GqlCopilotKitLangGraphInterruptEvent[\"data\"] & { value: TValue };\n };\n\nexport type MetaEvent = LangGraphInterruptEvent | CopilotKitLangGraphInterruptEvent;\n","import * as gql from \"../client\";\nimport { MessageRole } from \"../graphql/@generated/graphql\";\nimport agui from \"@copilotkit/shared\"; // named agui for clarity, but this only includes agui message types\n\n// Helper function to extract agent name from message\nfunction extractAgentName(message: agui.Message): string {\n if (message.role !== \"assistant\") {\n throw new Error(`Cannot extract agent name from message with role ${message.role}`);\n }\n\n return message.agentName || \"unknown\";\n}\n\n// Type guard for agent state message\nfunction isAgentStateMessage(message: agui.Message): boolean {\n return message.role === \"assistant\" && \"agentName\" in message && \"state\" in message;\n}\n\n// Type guard for messages with image property\nfunction hasImageProperty(message: agui.Message): boolean {\n const canContainImage = message.role === \"assistant\" || message.role === \"user\";\n if (!canContainImage || message.image === undefined) {\n return false;\n }\n\n const isMalformed = message.image.format === undefined || message.image.bytes === undefined;\n if (isMalformed) {\n return false;\n }\n\n return true;\n}\n\n/*\n ----------------------------\n AGUI Message -> GQL Message\n ----------------------------\n*/\nexport function aguiToGQL(\n messages: agui.Message[] | agui.Message,\n actions?: Record<string, any>,\n coAgentStateRenders?: Record<string, any>,\n): gql.Message[] {\n const gqlMessages: gql.Message[] = [];\n messages = Array.isArray(messages) ? messages : [messages];\n\n // Track tool call names by their IDs for use in result messages\n const toolCallNames: Record<string, string> = {};\n\n for (const message of messages) {\n // Agent state message support\n if (isAgentStateMessage(message)) {\n const agentName = extractAgentName(message);\n const state = \"state\" in message && message.state ? message.state : {};\n gqlMessages.push(\n new gql.AgentStateMessage({\n id: message.id,\n agentName,\n state,\n role: gql.Role.Assistant,\n }),\n );\n // Optionally preserve render function\n if (\"generativeUI\" in message && message.generativeUI && coAgentStateRenders) {\n coAgentStateRenders[agentName] = {\n name: agentName,\n render: message.generativeUI,\n };\n }\n continue;\n }\n\n if (hasImageProperty(message)) {\n gqlMessages.push(aguiMessageWithImageToGQLMessage(message));\n continue;\n }\n\n // Action execution message support\n if (message.role === \"assistant\" && message.toolCalls) {\n gqlMessages.push(aguiTextMessageToGQLMessage(message));\n for (const toolCall of message.toolCalls) {\n // Track the tool call name by its ID\n toolCallNames[toolCall.id] = toolCall.function.name;\n\n const actionExecMsg = aguiToolCallToGQLActionExecution(toolCall, message.id);\n // Preserve render function in actions context\n if (\"generativeUI\" in message && message.generativeUI && actions) {\n const actionName = toolCall.function.name;\n // Check for specific action first, then wild card action\n const specificAction = Object.values(actions).find(\n (action: any) => action.name === actionName,\n );\n const wildcardAction = Object.values(actions).find((action: any) => action.name === \"*\");\n\n // Assign render function to the matching action (specific takes priority)\n if (specificAction) {\n specificAction.render = message.generativeUI;\n } else if (wildcardAction) {\n wildcardAction.render = message.generativeUI;\n }\n }\n gqlMessages.push(actionExecMsg);\n }\n continue;\n }\n // Regular text messages\n if (\n message.role === \"developer\" ||\n message.role === \"system\" ||\n message.role === \"assistant\" ||\n message.role === \"user\"\n ) {\n gqlMessages.push(aguiTextMessageToGQLMessage(message));\n continue;\n }\n // Tool result message\n if (message.role === \"tool\") {\n gqlMessages.push(aguiToolMessageToGQLResultMessage(message, toolCallNames));\n continue;\n }\n throw new Error(\n `Unknown message role: \"${(message as any).role}\" in message with id: ${(message as any).id}`,\n );\n }\n\n return gqlMessages;\n}\n\nexport function aguiTextMessageToGQLMessage(message: agui.Message): gql.TextMessage {\n if (\n message.role !== \"developer\" &&\n message.role !== \"system\" &&\n message.role !== \"assistant\" &&\n message.role !== \"user\"\n ) {\n throw new Error(`Cannot convert message with role ${message.role} to TextMessage`);\n }\n\n let roleValue: MessageRole;\n\n if (message.role === \"developer\") {\n roleValue = gql.Role.Developer;\n } else if (message.role === \"system\") {\n roleValue = gql.Role.System;\n } else if (message.role === \"assistant\") {\n roleValue = gql.Role.Assistant;\n } else {\n roleValue = gql.Role.User;\n }\n\n return new gql.TextMessage({\n id: message.id,\n content: (message.content as any) || \"\",\n role: roleValue,\n });\n}\n\nexport function aguiToolCallToGQLActionExecution(\n toolCall: agui.ToolCall,\n parentMessageId: string,\n): gql.ActionExecutionMessage {\n if (toolCall.type !== \"function\") {\n throw new Error(`Unsupported tool call type: ${toolCall.type}`);\n }\n\n // Handle arguments - they should be a JSON string in AGUI format,\n // but we need to convert them to an object for GQL format\n let argumentsObj: any;\n\n if (typeof toolCall.function.arguments === \"string\") {\n // Expected case: arguments is a JSON string\n try {\n argumentsObj = JSON.parse(toolCall.function.arguments);\n } catch (error) {\n console.warn(`Failed to parse tool call arguments for ${toolCall.function.name}:`, error);\n // Provide fallback empty object to prevent application crash\n argumentsObj = {};\n }\n } else if (\n typeof toolCall.function.arguments === \"object\" &&\n toolCall.function.arguments !== null\n ) {\n // Backward compatibility: arguments is already an object\n argumentsObj = toolCall.function.arguments;\n } else {\n // Fallback for undefined, null, or other types\n console.warn(\n `Invalid tool call arguments type for ${toolCall.function.name}:`,\n typeof toolCall.function.arguments,\n );\n argumentsObj = {};\n }\n\n // Always include name and arguments\n return new gql.ActionExecutionMessage({\n id: toolCall.id,\n name: toolCall.function.name,\n arguments: argumentsObj,\n parentMessageId: parentMessageId,\n });\n}\n\nexport function aguiToolMessageToGQLResultMessage(\n message: agui.Message,\n toolCallNames: Record<string, string>,\n): gql.ResultMessage {\n if (message.role !== \"tool\") {\n throw new Error(`Cannot convert message with role ${message.role} to ResultMessage`);\n }\n\n if (!message.toolCallId) {\n throw new Error(\"Tool message must have a toolCallId\");\n }\n\n const actionName = toolCallNames[message.toolCallId] || \"unknown\";\n\n // Handle result content - it could be a string or an object that needs serialization\n let resultContent: string;\n const messageContent = message.content || \"\";\n\n if (typeof messageContent === \"string\") {\n // Expected case: content is already a string\n resultContent = messageContent;\n } else if (typeof messageContent === \"object\" && messageContent !== null) {\n // Handle case where content is an object that needs to be serialized\n try {\n resultContent = JSON.stringify(messageContent);\n } catch (error) {\n console.warn(`Failed to stringify tool result for ${actionName}:`, error);\n resultContent = String(messageContent);\n }\n } else {\n // Handle other types (number, boolean, etc.)\n resultContent = String(messageContent);\n }\n\n return new gql.ResultMessage({\n id: message.id,\n result: resultContent,\n actionExecutionId: message.toolCallId,\n actionName: message.toolName || actionName,\n });\n}\n\n// New function to handle AGUI messages with render functions\nexport function aguiMessageWithRenderToGQL(\n message: agui.Message,\n actions?: Record<string, any>,\n coAgentStateRenders?: Record<string, any>,\n): gql.Message[] {\n // Handle the special case: assistant messages with render function but no tool calls\n if (\n message.role === \"assistant\" &&\n \"generativeUI\" in message &&\n message.generativeUI &&\n !message.toolCalls\n ) {\n const gqlMessages: gql.Message[] = [];\n gqlMessages.push(\n new gql.AgentStateMessage({\n id: message.id,\n agentName: \"unknown\",\n state: {},\n role: gql.Role.Assistant,\n }),\n );\n if (coAgentStateRenders) {\n coAgentStateRenders.unknown = {\n name: \"unknown\",\n render: message.generativeUI,\n };\n }\n return gqlMessages;\n }\n\n // For all other cases, delegate to aguiToGQL\n return aguiToGQL([message], actions, coAgentStateRenders);\n}\n\nexport function aguiMessageWithImageToGQLMessage(message: agui.Message): gql.ImageMessage {\n if (!hasImageProperty(message)) {\n throw new Error(`Cannot convert message to ImageMessage: missing format or bytes`);\n }\n\n let roleValue: MessageRole;\n if (message.role === \"assistant\") {\n roleValue = gql.Role.Assistant;\n } else {\n roleValue = gql.Role.User;\n }\n\n if (message.role !== \"assistant\" && message.role !== \"user\") {\n throw new Error(`Cannot convert message with role ${message.role} to ImageMessage`);\n }\n\n return new gql.ImageMessage({\n id: message.id,\n format: message.image!.format,\n bytes: message.image!.bytes,\n role: roleValue,\n });\n}\n","import * as gql from \"../client\";\nimport agui from \"@copilotkit/shared\";\nimport { MessageStatusCode } from \"../graphql/@generated/graphql\";\n\n// Define valid image formats based on the supported formats in the codebase\nconst VALID_IMAGE_FORMATS = [\"jpeg\", \"png\", \"webp\", \"gif\"] as const;\ntype ValidImageFormat = (typeof VALID_IMAGE_FORMATS)[number];\n\n// Validation function for image format\nfunction validateImageFormat(format: string): format is ValidImageFormat {\n return VALID_IMAGE_FORMATS.includes(format as ValidImageFormat);\n}\n\n/*\n ----------------------------\n GQL Message -> AGUI Message\n ----------------------------\n*/\nexport function gqlToAGUI(\n messages: gql.Message[] | gql.Message,\n actions?: Record<string, any>,\n coAgentStateRenders?: Record<string, any>,\n): agui.Message[] {\n let aguiMessages: agui.Message[] = [];\n messages = Array.isArray(messages) ? messages : [messages];\n\n // Create a map of action execution ID to result for completed actions\n const actionResults = new Map<string, string>();\n for (const message of messages) {\n if (message.isResultMessage()) {\n actionResults.set(message.actionExecutionId, message.result);\n }\n }\n\n for (const message of messages) {\n if (message.isTextMessage()) {\n aguiMessages.push(gqlTextMessageToAGUIMessage(message));\n } else if (message.isResultMessage()) {\n aguiMessages.push(gqlResultMessageToAGUIMessage(message));\n } else if (message.isActionExecutionMessage()) {\n aguiMessages.push(gqlActionExecutionMessageToAGUIMessage(message, actions, actionResults));\n } else if (message.isAgentStateMessage()) {\n aguiMessages.push(gqlAgentStateMessageToAGUIMessage(message, coAgentStateRenders));\n } else if (message.isImageMessage()) {\n aguiMessages.push(gqlImageMessageToAGUIMessage(message));\n } else {\n throw new Error(\"Unknown message type\");\n }\n }\n\n return aguiMessages;\n}\n\nexport function gqlActionExecutionMessageToAGUIMessage(\n message: gql.ActionExecutionMessage,\n actions?: Record<string, any>,\n actionResults?: Map<string, string>,\n): agui.Message {\n // Check if we have actions and if there's a specific action or wild card action\n const hasSpecificAction =\n actions && Object.values(actions).some((action: any) => action.name === message.name);\n const hasWildcardAction =\n actions && Object.values(actions).some((action: any) => action.name === \"*\");\n\n if (!actions || (!hasSpecificAction && !hasWildcardAction)) {\n return {\n id: message.id,\n role: \"assistant\",\n toolCalls: [actionExecutionMessageToAGUIMessage(message)],\n name: message.name,\n };\n }\n\n // Find the specific action first, then fall back to wild card action\n const action =\n Object.values(actions).find((action: any) => action.name === message.name) ||\n Object.values(actions).find((action: any) => action.name === \"*\");\n\n // Create render function wrapper that provides proper props\n const createRenderWrapper = (originalRender: any) => {\n if (!originalRender) return undefined;\n\n return (props?: any) => {\n // Determine the correct status based on the same logic as RenderActionExecutionMessage\n let actionResult: any = actionResults?.get(message.id);\n let status: \"inProgress\" | \"executing\" | \"complete\" = \"inProgress\";\n\n if (actionResult !== undefined) {\n status = \"complete\";\n } else if (message.status?.code !== MessageStatusCode.Pending) {\n status = \"executing\";\n }\n\n // if props.result is a string, parse it as JSON but don't throw an error if it's not valid JSON\n if (typeof props?.result === \"string\") {\n try {\n props.result = JSON.parse(props.result);\n } catch (e) {\n /* do nothing */\n }\n }\n\n // if actionResult is a string, parse it as JSON but don't throw an error if it's not valid JSON\n if (typeof actionResult === \"string\") {\n try {\n actionResult = JSON.parse(actionResult);\n } catch (e) {\n /* do nothing */\n }\n }\n\n // Base props that all actions receive\n const baseProps = {\n status: props?.status || status,\n args: message.arguments || {},\n result: props?.result || actionResult || undefined,\n messageId: message.id,\n };\n\n // Add properties based on action type\n if (action.name === \"*\") {\n // Wildcard actions get the tool name; ensure it cannot be overridden by incoming props\n return originalRender({\n ...baseProps,\n ...props,\n name: message.name,\n });\n } else {\n // Regular actions get respond (defaulting to a no-op if not provided)\n const respond = props?.respond ?? (() => {});\n return originalRender({\n ...baseProps,\n ...props,\n respond,\n });\n }\n };\n };\n\n return {\n id: message.id,\n role: \"assistant\",\n content: \"\",\n toolCalls: [actionExecutionMessageToAGUIMessage(message)],\n generativeUI: createRenderWrapper(action.render),\n name: message.name,\n } as agui.AIMessage;\n}\n\nfunction gqlAgentStateMessageToAGUIMessage(\n message: gql.AgentStateMessage,\n coAgentStateRenders?: Record<string, any>,\n): agui.Message {\n if (\n coAgentStateRenders &&\n Object.values(coAgentStateRenders).some((render: any) => render.name === message.agentName)\n ) {\n const render = Object.values(coAgentStateRenders).find(\n (render: any) => render.name === message.agentName,\n );\n\n // Create render function wrapper that provides proper props\n const createRenderWrapper = (originalRender: any) => {\n if (!originalRender) return undefined;\n\n return (props?: any) => {\n // Determine the correct status based on the same logic as RenderActionExecutionMessage\n const state = message.state;\n\n // Provide the full props structure that the render function expects\n const renderProps = {\n state: state,\n };\n\n return originalRender(renderProps);\n };\n };\n\n return {\n id: message.id,\n role: \"assistant\",\n generativeUI: createRenderWrapper(render.render),\n agentName: message.agentName,\n state: message.state,\n };\n }\n\n return {\n id: message.id,\n role: \"assistant\",\n agentName: message.agentName,\n state: message.state,\n };\n}\n\nfunction actionExecutionMessageToAGUIMessage(\n actionExecutionMessage: gql.ActionExecutionMessage,\n): agui.ToolCall {\n return {\n id: actionExecutionMessage.id,\n function: {\n name: actionExecutionMessage.name,\n arguments: JSON.stringify(actionExecutionMessage.arguments),\n },\n type: \"function\",\n };\n}\n\nexport function gqlTextMessageToAGUIMessage(message: gql.TextMessage): agui.Message {\n switch (message.role) {\n case gql.Role.Developer:\n return {\n id: message.id,\n role: \"developer\",\n content: message.content,\n };\n case gql.Role.System:\n return {\n id: message.id,\n role: \"system\",\n content: message.content,\n };\n case gql.Role.Assistant:\n return {\n id: message.id,\n role: \"assistant\",\n content: message.content,\n };\n case gql.Role.User:\n return {\n id: message.id,\n role: \"user\",\n content: message.content,\n };\n default:\n throw new Error(\"Unknown message role\");\n }\n}\n\nexport function gqlResultMessageToAGUIMessage(message: gql.ResultMessage): agui.Message {\n return {\n id: message.id,\n role: \"tool\",\n content: message.result,\n toolCallId: message.actionExecutionId,\n toolName: message.actionName,\n };\n}\n\nexport function gqlImageMessageToAGUIMessage(message: gql.ImageMessage): agui.Message {\n // Validate image format\n if (!validateImageFormat(message.format)) {\n throw new Error(\n `Invalid image format: ${message.format}. Supported formats are: ${VALID_IMAGE_FORMATS.join(\", \")}`,\n );\n }\n\n // Validate that bytes is a non-empty string\n if (!message.bytes || typeof message.bytes !== \"string\" || message.bytes.trim() === \"\") {\n throw new Error(\"Image bytes must be a non-empty string\");\n }\n\n // Determine the role based on the message role\n const role = message.role === gql.Role.Assistant ? \"assistant\" : \"user\";\n\n // Create the image message with proper typing\n const imageMessage: agui.Message = {\n id: message.id,\n role,\n content: \"\",\n image: {\n format: message.format,\n bytes: message.bytes,\n },\n };\n\n return imageMessage;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC+RO,IAAK,cAAL,kBAAKA,iBAAL;AACL,EAAAA,aAAA,eAAY;AACZ,EAAAA,aAAA,eAAY;AACZ,EAAAA,aAAA,YAAS;AACT,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,UAAO;AALG,SAAAA;AAAA,GAAA;;;AC/RZ,oBAAyB;AAezB,IAAAC,iBAA0B;AASnB,IAAM,UAAN,MAAc;AAAA,EAMnB,YAAY,OAAY;AACtB,UAAM,OAAN,MAAM,SAAO,wBAAS;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SAAa,KAAK,YAAY,cAAc;AAGjE,QAAM,eAA6B;AAAA,IACjC,IAAI,QAAQ;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,IACT,OAAO;AAAA,MACL,QAAQ,QAAQ;AAAA,MAChB,OAAO,QAAQ;AAAA,IACjB;AAAA,EACF;AAEA,SAAO;AACT;","names":["MessageRole","import_shared","action","render"]}
@@ -6,21 +6,21 @@ import {
6
6
  aguiToGQL,
7
7
  aguiToolCallToGQLActionExecution,
8
8
  aguiToolMessageToGQLResultMessage
9
- } from "../chunk-TNC2H2EO.mjs";
9
+ } from "../chunk-RNENVFJ3.mjs";
10
10
  import {
11
11
  gqlActionExecutionMessageToAGUIMessage,
12
12
  gqlImageMessageToAGUIMessage,
13
13
  gqlResultMessageToAGUIMessage,
14
14
  gqlTextMessageToAGUIMessage,
15
15
  gqlToAGUI
16
- } from "../chunk-O7JH6IWQ.mjs";
16
+ } from "../chunk-EIPAWDCN.mjs";
17
17
  import "../chunk-7ECCT6PK.mjs";
18
- import "../chunk-UNOAOYT4.mjs";
18
+ import "../chunk-ZBNRBXIW.mjs";
19
19
  import "../chunk-WUF3XSW5.mjs";
20
20
  import "../chunk-EWRHYLZE.mjs";
21
21
  import "../chunk-AQ2Y6PF5.mjs";
22
- import "../chunk-TDZBGVZB.mjs";
23
- import "../chunk-VVFJT2PN.mjs";
22
+ import "../chunk-AMFKR5ST.mjs";
23
+ import "../chunk-NHOKFX55.mjs";
24
24
  import "../chunk-OBDQ5BWD.mjs";
25
25
  import "../chunk-DELDZXUX.mjs";
26
26
  export {
@@ -13948,7 +13948,7 @@ function createTestHook(name, handler) {
13948
13948
  };
13949
13949
  }
13950
13950
 
13951
- // ../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.14.12_jiti@1.21.6_jsdom@26.1.0_yaml@2.5.0/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js
13951
+ // ../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.14.12_jsdom@26.1.0/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js
13952
13952
  var NAME_WORKER_STATE = "__vitest_worker__";
13953
13953
  function getWorkerState() {
13954
13954
  const workerState = globalThis[NAME_WORKER_STATE];
@@ -14000,7 +14000,7 @@ async function waitForImportsToResolve() {
14000
14000
  await waitForImportsToResolve();
14001
14001
  }
14002
14002
 
14003
- // ../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.14.12_jiti@1.21.6_jsdom@26.1.0_yaml@2.5.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js
14003
+ // ../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.14.12_jsdom@26.1.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js
14004
14004
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
14005
14005
  function getDefaultExportFromCjs3(x) {
14006
14006
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -16033,7 +16033,7 @@ var SnapshotClient = class {
16033
16033
  }
16034
16034
  };
16035
16035
 
16036
- // ../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.14.12_jiti@1.21.6_jsdom@26.1.0_yaml@2.5.0/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js
16036
+ // ../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.14.12_jsdom@26.1.0/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js
16037
16037
  var RealDate = Date;
16038
16038
  var now2 = null;
16039
16039
  var MockDate = class extends RealDate {
@@ -16084,7 +16084,7 @@ function resetDate() {
16084
16084
  globalThis.Date = RealDate;
16085
16085
  }
16086
16086
 
16087
- // ../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.14.12_jiti@1.21.6_jsdom@26.1.0_yaml@2.5.0/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js
16087
+ // ../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.14.12_jsdom@26.1.0/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js
16088
16088
  var unsupported = [
16089
16089
  "matchSnapshot",
16090
16090
  "toMatchSnapshot",
@@ -18874,7 +18874,7 @@ function getImporter(name) {
18874
18874
  return (stack == null ? void 0 : stack.file) || "";
18875
18875
  }
18876
18876
 
18877
- // ../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.14.12_jiti@1.21.6_jsdom@26.1.0_yaml@2.5.0/node_modules/vitest/dist/index.js
18877
+ // ../../node_modules/.pnpm/vitest@3.2.4_@types+debug@4.1.12_@types+node@20.14.12_jsdom@26.1.0/node_modules/vitest/dist/index.js
18878
18878
  var import_expect_type = __toESM(require_dist(), 1);
18879
18879
 
18880
18880
  // src/graphql/@generated/graphql.ts
@@ -18918,6 +18918,7 @@ var TextMessage = class extends Message {
18918
18918
  constructor(props) {
18919
18919
  super(props);
18920
18920
  this.type = "TextMessage";
18921
+ this.type = "TextMessage";
18921
18922
  }
18922
18923
  };
18923
18924
  var ActionExecutionMessage = class extends Message {