@copilotkit/runtime-client-gql 1.10.2-next.0 → 1.10.3-next.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 (39) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/{chunk-6L3FIIJR.mjs → chunk-E6RQJ2Q7.mjs} +2 -2
  3. package/dist/{chunk-6L3FIIJR.mjs.map → chunk-E6RQJ2Q7.mjs.map} +1 -1
  4. package/dist/{chunk-ZYA32QXZ.mjs → chunk-WXA3UP7I.mjs} +18 -7
  5. package/dist/chunk-WXA3UP7I.mjs.map +1 -0
  6. package/dist/client/CopilotRuntimeClient.js +1 -1
  7. package/dist/client/CopilotRuntimeClient.js.map +1 -1
  8. package/dist/client/CopilotRuntimeClient.mjs +1 -1
  9. package/dist/client/index.js +1 -1
  10. package/dist/client/index.js.map +1 -1
  11. package/dist/client/index.mjs +1 -1
  12. package/dist/index.js +18 -7
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.mjs +2 -2
  15. package/dist/message-conversion/agui-to-gql.mjs +1 -1
  16. package/dist/message-conversion/agui-to-gql.test.js +48 -0
  17. package/dist/message-conversion/agui-to-gql.test.js.map +1 -1
  18. package/dist/message-conversion/agui-to-gql.test.mjs +51 -2
  19. package/dist/message-conversion/agui-to-gql.test.mjs.map +1 -1
  20. package/dist/message-conversion/gql-to-agui.js +17 -6
  21. package/dist/message-conversion/gql-to-agui.js.map +1 -1
  22. package/dist/message-conversion/gql-to-agui.mjs +2 -2
  23. package/dist/message-conversion/gql-to-agui.test.js +73 -6
  24. package/dist/message-conversion/gql-to-agui.test.js.map +1 -1
  25. package/dist/message-conversion/gql-to-agui.test.mjs +58 -2
  26. package/dist/message-conversion/gql-to-agui.test.mjs.map +1 -1
  27. package/dist/message-conversion/index.js +17 -6
  28. package/dist/message-conversion/index.js.map +1 -1
  29. package/dist/message-conversion/index.mjs +2 -2
  30. package/dist/message-conversion/roundtrip-conversion.test.js +82 -6
  31. package/dist/message-conversion/roundtrip-conversion.test.js.map +1 -1
  32. package/dist/message-conversion/roundtrip-conversion.test.mjs +67 -2
  33. package/dist/message-conversion/roundtrip-conversion.test.mjs.map +1 -1
  34. package/package.json +3 -3
  35. package/src/message-conversion/agui-to-gql.test.ts +58 -1
  36. package/src/message-conversion/gql-to-agui.test.ts +71 -0
  37. package/src/message-conversion/gql-to-agui.ts +19 -5
  38. package/src/message-conversion/roundtrip-conversion.test.ts +86 -0
  39. package/dist/chunk-ZYA32QXZ.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/message-conversion/gql-to-agui.ts","../../src/graphql/@generated/graphql.ts","../../src/client/types.ts"],"sourcesContent":["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 // Provide the full props structure that the render function expects\n const renderProps = {\n status: props?.status || status,\n args: message.arguments || {},\n result: props?.result || actionResult || undefined,\n respond: props?.respond || (() => {}),\n messageId: message.id,\n ...props,\n };\n\n return originalRender(renderProps);\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","/* 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 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 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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACyRO,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;;;ACzRZ,oBAAyB;AAezB,IAAAC,iBAA0B;AA4CnB,IAAM,OAAO;;;AFtDpB,IAAM,sBAAsB,CAAC,QAAQ,OAAO,QAAQ,KAAK;AAIzD,SAAS,oBAAoB,QAA4C;AACvE,SAAO,oBAAoB,SAAS,MAA0B;AAChE;AAOO,SAAS,UACd,UACA,SACA,qBACgB;AAChB,MAAI,eAA+B,CAAC;AACpC,aAAW,MAAM,QAAQ,QAAQ,IAAI,WAAW,CAAC,QAAQ;AAGzD,QAAM,gBAAgB,oBAAI,IAAoB;AAC9C,aAAW,WAAW,UAAU;AAC9B,QAAI,QAAQ,gBAAgB,GAAG;AAC7B,oBAAc,IAAI,QAAQ,mBAAmB,QAAQ,MAAM;AAAA,IAC7D;AAAA,EACF;AAEA,aAAW,WAAW,UAAU;AAC9B,QAAI,QAAQ,cAAc,GAAG;AAC3B,mBAAa,KAAK,4BAA4B,OAAO,CAAC;AAAA,IACxD,WAAW,QAAQ,gBAAgB,GAAG;AACpC,mBAAa,KAAK,8BAA8B,OAAO,CAAC;AAAA,IAC1D,WAAW,QAAQ,yBAAyB,GAAG;AAC7C,mBAAa,KAAK,uCAAuC,SAAS,SAAS,aAAa,CAAC;AAAA,IAC3F,WAAW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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/gql-to-agui.ts","../../src/graphql/@generated/graphql.ts","../../src/client/types.ts"],"sourcesContent":["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","/* 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 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 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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACyRO,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;;;ACzRZ,oBAAyB;AAezB,IAAAC,iBAA0B;AA4CnB,IAAM,OAAO;;;AFtDpB,IAAM,sBAAsB,CAAC,QAAQ,OAAO,QAAQ,KAAK;AAIzD,SAAS,oBAAoB,QAA4C;AACvE,SAAO,oBAAoB,SAAS,MAA0B;AAChE;AAOO,SAAS,UACd,UACA,SACA,qBACgB;AAChB,MAAI,eAA+B,CAAC;AACpC,aAAW,MAAM,QAAQ,QAAQ,IAAI,WAAW,CAAC,QAAQ;AAGzD,QAAM,gBAAgB,oBAAI,IAAoB;AAC9C,aAAW,WAAW,UAAU;AAC9B,QAAI,QAAQ,gBAAgB,GAAG;AAC7B,oBAAc,IAAI,QAAQ,mBAAmB,QAAQ,MAAM;AAAA,IAC7D;AAAA,EACF;AAEA,aAAW,WAAW,UAAU;AAC9B,QAAI,QAAQ,cAAc,GAAG;AAC3B,mBAAa,KAAK,4BAA4B,OAAO,CAAC;AAAA,IACxD,WAAW,QAAQ,gBAAgB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AO;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"]}
@@ -4,9 +4,9 @@ import {
4
4
  gqlResultMessageToAGUIMessage,
5
5
  gqlTextMessageToAGUIMessage,
6
6
  gqlToAGUI
7
- } from "../chunk-ZYA32QXZ.mjs";
7
+ } from "../chunk-WXA3UP7I.mjs";
8
8
  import "../chunk-7ECCT6PK.mjs";
9
- import "../chunk-6L3FIIJR.mjs";
9
+ import "../chunk-E6RQJ2Q7.mjs";
10
10
  import "../chunk-X2UAP3QY.mjs";
11
11
  import "../chunk-HEODM5TW.mjs";
12
12
  import "../chunk-4KTMZMM2.mjs";
@@ -19024,16 +19024,27 @@ function gqlActionExecutionMessageToAGUIMessage(message, actions, actionResults)
19024
19024
  } catch (e) {
19025
19025
  }
19026
19026
  }
19027
- const renderProps = {
19027
+ const baseProps = {
19028
19028
  status: (props == null ? void 0 : props.status) || status,
19029
19029
  args: message.arguments || {},
19030
19030
  result: (props == null ? void 0 : props.result) || actionResult || void 0,
19031
- respond: (props == null ? void 0 : props.respond) || (() => {
19032
- }),
19033
- messageId: message.id,
19034
- ...props
19031
+ messageId: message.id
19035
19032
  };
19036
- return originalRender(renderProps);
19033
+ if (action.name === "*") {
19034
+ return originalRender({
19035
+ ...baseProps,
19036
+ ...props,
19037
+ name: message.name
19038
+ });
19039
+ } else {
19040
+ const respond = (props == null ? void 0 : props.respond) ?? (() => {
19041
+ });
19042
+ return originalRender({
19043
+ ...baseProps,
19044
+ ...props,
19045
+ respond
19046
+ });
19047
+ }
19037
19048
  };
19038
19049
  };
19039
19050
  return {
@@ -19504,6 +19515,7 @@ describe("message-conversion", () => {
19504
19515
  result: void 0,
19505
19516
  respond: globalExpect.any(Function),
19506
19517
  messageId: "action-1"
19518
+ // Regular actions should NOT have the name property
19507
19519
  });
19508
19520
  });
19509
19521
  test3("should provide executing status when not pending", () => {
@@ -19529,6 +19541,7 @@ describe("message-conversion", () => {
19529
19541
  result: void 0,
19530
19542
  respond: globalExpect.any(Function),
19531
19543
  messageId: "action-1"
19544
+ // Regular actions should NOT have the name property
19532
19545
  });
19533
19546
  });
19534
19547
  test3("should provide complete status when result is available", () => {
@@ -19561,6 +19574,7 @@ describe("message-conversion", () => {
19561
19574
  result: "Action completed successfully",
19562
19575
  respond: globalExpect.any(Function),
19563
19576
  messageId: "action-1"
19577
+ // Regular actions should NOT have the name property
19564
19578
  });
19565
19579
  });
19566
19580
  test3("should handle generativeUI function props override", () => {
@@ -19591,6 +19605,7 @@ describe("message-conversion", () => {
19591
19605
  respond: globalExpect.any(Function),
19592
19606
  customProp: "test",
19593
19607
  messageId: "action-1"
19608
+ // Regular actions should NOT have the name property
19594
19609
  });
19595
19610
  });
19596
19611
  test3("should handle missing render functions gracefully", () => {
@@ -19918,6 +19933,58 @@ describe("message-conversion", () => {
19918
19933
  name: "unknownAction"
19919
19934
  });
19920
19935
  });
19936
+ test3("should pass tool name to wildcard action render function", () => {
19937
+ var _a3;
19938
+ const mockRender = vi.fn(
19939
+ (props) => `Wildcard rendered: ${props.name} with args: ${JSON.stringify(props.args)}`
19940
+ );
19941
+ const actions = {
19942
+ "*": {
19943
+ name: "*",
19944
+ render: mockRender
19945
+ }
19946
+ };
19947
+ const actionExecMsg = new ActionExecutionMessage({
19948
+ id: "action-wildcard-name",
19949
+ name: "testTool",
19950
+ arguments: { param: "value" },
19951
+ parentMessageId: "parent-wildcard-name"
19952
+ });
19953
+ const result = gqlActionExecutionMessageToAGUIMessage(actionExecMsg, actions);
19954
+ (_a3 = result.generativeUI) == null ? void 0 : _a3.call(result);
19955
+ globalExpect(mockRender).toHaveBeenCalledWith(
19956
+ globalExpect.objectContaining({
19957
+ name: "testTool",
19958
+ args: { param: "value" }
19959
+ })
19960
+ );
19961
+ });
19962
+ test3("should pass tool name to regular action render function", () => {
19963
+ var _a3;
19964
+ const mockRender = vi.fn((props) => `Regular action rendered: ${JSON.stringify(props.args)}`);
19965
+ const actions = {
19966
+ testAction: {
19967
+ name: "testAction",
19968
+ render: mockRender
19969
+ }
19970
+ };
19971
+ const actionExecMsg = new ActionExecutionMessage({
19972
+ id: "action-regular-name",
19973
+ name: "testAction",
19974
+ arguments: { param: "value" },
19975
+ parentMessageId: "parent-regular-name"
19976
+ });
19977
+ const result = gqlActionExecutionMessageToAGUIMessage(actionExecMsg, actions);
19978
+ (_a3 = result.generativeUI) == null ? void 0 : _a3.call(result);
19979
+ globalExpect(mockRender).toHaveBeenCalledWith(
19980
+ globalExpect.objectContaining({
19981
+ args: { param: "value" }
19982
+ // name property should NOT be present for regular actions
19983
+ })
19984
+ );
19985
+ const callArgs = mockRender.mock.calls[0][0];
19986
+ globalExpect(callArgs).not.toHaveProperty("name");
19987
+ });
19921
19988
  test3("should prioritize specific action over wild card action", () => {
19922
19989
  const actions = {
19923
19990
  specificAction: {