@copilotkit/runtime-client-gql 1.6.0-next.3 → 1.6.0-next.4

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @copilotkit/runtime-client-gql
2
2
 
3
+ ## 1.6.0-next.4
4
+
5
+ ### Patch Changes
6
+
7
+ - @copilotkit/shared@1.6.0-next.4
8
+
3
9
  ## 1.6.0-next.3
4
10
 
5
11
  ### Patch Changes
@@ -3,10 +3,11 @@ import {
3
3
  AgentStateMessage,
4
4
  ResultMessage,
5
5
  TextMessage
6
- } from "./chunk-NFSC2RBZ.mjs";
6
+ } from "./chunk-ENJNEFIR.mjs";
7
7
 
8
8
  // src/client/conversion.ts
9
9
  import untruncateJson from "untruncate-json";
10
+ import { parseJson } from "@copilotkit/shared";
10
11
  function filterAgentStateMessages(messages) {
11
12
  return messages.filter((message) => !message.isAgentStateMessage());
12
13
  }
@@ -120,7 +121,7 @@ function convertGqlOutputToMessages(messages) {
120
121
  runId: message.runId,
121
122
  active: message.active,
122
123
  running: message.running,
123
- state: JSON.parse(message.state),
124
+ state: parseJson(message.state, {}),
124
125
  createdAt: /* @__PURE__ */ new Date()
125
126
  });
126
127
  }
@@ -200,4 +201,4 @@ export {
200
201
  convertGqlOutputToMessages,
201
202
  loadMessagesFromJsonRepresentation
202
203
  };
203
- //# sourceMappingURL=chunk-RCOK2WMA.mjs.map
204
+ //# sourceMappingURL=chunk-3CTAHX4E.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client/conversion.ts"],"sourcesContent":["import {\n GenerateCopilotResponseMutation,\n MessageInput,\n MessageStatusCode,\n} from \"../graphql/@generated/graphql\";\nimport {\n ActionExecutionMessage,\n AgentStateMessage,\n Message,\n ResultMessage,\n TextMessage,\n} from \"./types\";\n\nimport untruncateJson from \"untruncate-json\";\nimport { parseJson } from \"@copilotkit/shared\";\n\nexport function filterAgentStateMessages(messages: Message[]): Message[] {\n return messages.filter((message) => !message.isAgentStateMessage());\n}\n\nexport function convertMessagesToGqlInput(messages: Message[]): MessageInput[] {\n return messages.map((message) => {\n if (message.isTextMessage()) {\n return {\n id: message.id,\n createdAt: message.createdAt,\n textMessage: {\n content: message.content,\n role: message.role as any,\n parentMessageId: message.parentMessageId,\n },\n };\n } else if (message.isActionExecutionMessage()) {\n return {\n id: message.id,\n createdAt: message.createdAt,\n actionExecutionMessage: {\n name: message.name,\n arguments: JSON.stringify(message.arguments),\n parentMessageId: message.parentMessageId,\n },\n };\n } else if (message.isResultMessage()) {\n return {\n id: message.id,\n createdAt: message.createdAt,\n resultMessage: {\n result: message.result,\n actionExecutionId: message.actionExecutionId,\n actionName: message.actionName,\n },\n };\n } else if (message.isAgentStateMessage()) {\n return {\n id: message.id,\n createdAt: message.createdAt,\n agentStateMessage: {\n threadId: message.threadId,\n role: message.role,\n agentName: message.agentName,\n nodeName: message.nodeName,\n runId: message.runId,\n active: message.active,\n running: message.running,\n state: JSON.stringify(message.state),\n },\n };\n } else {\n throw new Error(\"Unknown message type\");\n }\n });\n}\n\nexport function filterAdjacentAgentStateMessages(\n messages: GenerateCopilotResponseMutation[\"generateCopilotResponse\"][\"messages\"],\n): GenerateCopilotResponseMutation[\"generateCopilotResponse\"][\"messages\"] {\n const filteredMessages: GenerateCopilotResponseMutation[\"generateCopilotResponse\"][\"messages\"] =\n [];\n\n messages.forEach((message, i) => {\n // keep all other message types\n if (message.__typename !== \"AgentStateMessageOutput\") {\n filteredMessages.push(message);\n } else {\n const prevAgentStateMessageIndex = filteredMessages.findIndex(\n // TODO: also check runId\n (m) => m.__typename === \"AgentStateMessageOutput\" && m.agentName === message.agentName,\n );\n if (prevAgentStateMessageIndex === -1) {\n filteredMessages.push(message);\n } else {\n filteredMessages[prevAgentStateMessageIndex] = message;\n }\n }\n });\n\n return filteredMessages;\n}\n\nexport function convertGqlOutputToMessages(\n messages: GenerateCopilotResponseMutation[\"generateCopilotResponse\"][\"messages\"],\n): Message[] {\n return messages.map((message) => {\n if (message.__typename === \"TextMessageOutput\") {\n return new TextMessage({\n id: message.id,\n role: message.role,\n content: message.content.join(\"\"),\n parentMessageId: message.parentMessageId,\n createdAt: new Date(),\n status: message.status || { code: MessageStatusCode.Pending },\n });\n } else if (message.__typename === \"ActionExecutionMessageOutput\") {\n return new ActionExecutionMessage({\n id: message.id,\n name: message.name,\n arguments: getPartialArguments(message.arguments),\n parentMessageId: message.parentMessageId,\n createdAt: new Date(),\n status: message.status || { code: MessageStatusCode.Pending },\n });\n } else if (message.__typename === \"ResultMessageOutput\") {\n return new ResultMessage({\n id: message.id,\n result: message.result,\n actionExecutionId: message.actionExecutionId,\n actionName: message.actionName,\n createdAt: new Date(),\n status: message.status || { code: MessageStatusCode.Pending },\n });\n } else if (message.__typename === \"AgentStateMessageOutput\") {\n return new AgentStateMessage({\n id: message.id,\n threadId: message.threadId,\n role: message.role,\n agentName: message.agentName,\n nodeName: message.nodeName,\n runId: message.runId,\n active: message.active,\n running: message.running,\n state: parseJson(message.state, {}),\n createdAt: new Date(),\n });\n }\n\n throw new Error(\"Unknown message type\");\n });\n}\n\nexport function loadMessagesFromJsonRepresentation(json: any[]): Message[] {\n const result: Message[] = [];\n for (const item of json) {\n if (\"content\" in item) {\n result.push(\n new TextMessage({\n id: item.id,\n role: item.role,\n content: item.content,\n parentMessageId: item.parentMessageId,\n createdAt: item.createdAt || new Date(),\n status: item.status || { code: MessageStatusCode.Success },\n }),\n );\n } else if (\"arguments\" in item) {\n result.push(\n new ActionExecutionMessage({\n id: item.id,\n name: item.name,\n arguments: item.arguments,\n parentMessageId: item.parentMessageId,\n createdAt: item.createdAt || new Date(),\n status: item.status || { code: MessageStatusCode.Success },\n }),\n );\n } else if (\"result\" in item) {\n result.push(\n new ResultMessage({\n id: item.id,\n result: item.result,\n actionExecutionId: item.actionExecutionId,\n actionName: item.actionName,\n createdAt: item.createdAt || new Date(),\n status: item.status || { code: MessageStatusCode.Success },\n }),\n );\n } else if (\"state\" in item) {\n result.push(\n new AgentStateMessage({\n id: item.id,\n threadId: item.threadId,\n role: item.role,\n agentName: item.agentName,\n nodeName: item.nodeName,\n runId: item.runId,\n active: item.active,\n running: item.running,\n state: item.state,\n createdAt: item.createdAt || new Date(),\n }),\n );\n }\n }\n return result;\n}\n\nfunction getPartialArguments(args: string[]) {\n try {\n if (!args.length) return {};\n\n return JSON.parse(untruncateJson(args.join(\"\")));\n } catch (e) {\n console.error(e);\n return {};\n }\n}\n"],"mappings":";;;;;;;;AAaA,OAAO,oBAAoB;AAC3B,SAAS,iBAAiB;AAEnB,SAAS,yBAAyB,UAAgC;AACvE,SAAO,SAAS,OAAO,CAAC,YAAY,CAAC,QAAQ,oBAAoB,CAAC;AACpE;AAEO,SAAS,0BAA0B,UAAqC;AAC7E,SAAO,SAAS,IAAI,CAAC,YAAY;AAC/B,QAAI,QAAQ,cAAc,GAAG;AAC3B,aAAO;AAAA,QACL,IAAI,QAAQ;AAAA,QACZ,WAAW,QAAQ;AAAA,QACnB,aAAa;AAAA,UACX,SAAS,QAAQ;AAAA,UACjB,MAAM,QAAQ;AAAA,UACd,iBAAiB,QAAQ;AAAA,QAC3B;AAAA,MACF;AAAA,IACF,WAAW,QAAQ,yBAAyB,GAAG;AAC7C,aAAO;AAAA,QACL,IAAI,QAAQ;AAAA,QACZ,WAAW,QAAQ;AAAA,QACnB,wBAAwB;AAAA,UACtB,MAAM,QAAQ;AAAA,UACd,WAAW,KAAK,UAAU,QAAQ,SAAS;AAAA,UAC3C,iBAAiB,QAAQ;AAAA,QAC3B;AAAA,MACF;AAAA,IACF,WAAW,QAAQ,gBAAgB,GAAG;AACpC,aAAO;AAAA,QACL,IAAI,QAAQ;AAAA,QACZ,WAAW,QAAQ;AAAA,QACnB,eAAe;AAAA,UACb,QAAQ,QAAQ;AAAA,UAChB,mBAAmB,QAAQ;AAAA,UAC3B,YAAY,QAAQ;AAAA,QACtB;AAAA,MACF;AAAA,IACF,WA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EACV;AACF;","names":[]}
@@ -4,6 +4,7 @@ import {
4
4
 
5
5
  // src/client/types.ts
6
6
  import { randomId } from "@copilotkit/shared";
7
+ import { parseJson } from "@copilotkit/shared";
7
8
  var Message = class {
8
9
  constructor(props) {
9
10
  props.id ?? (props.id = randomId());
@@ -43,11 +44,7 @@ var ResultMessage = class extends Message {
43
44
  this.type = "ResultMessage";
44
45
  }
45
46
  static decodeResult(result) {
46
- try {
47
- return JSON.parse(result);
48
- } catch (e) {
49
- return result;
50
- }
47
+ return parseJson(result, result);
51
48
  }
52
49
  static encodeResult(result) {
53
50
  if (result === void 0) {
@@ -78,4 +75,4 @@ export {
78
75
  AgentStateMessage,
79
76
  langGraphInterruptEvent
80
77
  };
81
- //# sourceMappingURL=chunk-NFSC2RBZ.mjs.map
78
+ //# sourceMappingURL=chunk-ENJNEFIR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client/types.ts"],"sourcesContent":["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} from \"../graphql/@generated/graphql\";\nimport { parseJson } from \"@copilotkit/shared\";\n\ntype MessageType = \"TextMessage\" | \"ActionExecutionMessage\" | \"ResultMessage\" | \"AgentStateMessage\";\n\nexport class Message {\n type: MessageType;\n id: BaseMessageOutput[\"id\"];\n createdAt: BaseMessageOutput[\"createdAt\"];\n status: MessageStatus;\n\n constructor(props: any) {\n props.id ??= randomId();\n props.status ??= { code: MessageStatusCode.Success };\n props.createdAt ??= new Date();\n Object.assign(this, props);\n }\n\n isTextMessage(): this is TextMessage {\n return this.type === \"TextMessage\";\n }\n\n isActionExecutionMessage(): this is ActionExecutionMessage {\n return this.type === \"ActionExecutionMessage\";\n }\n\n isResultMessage(): this is ResultMessage {\n return this.type === \"ResultMessage\";\n }\n\n isAgentStateMessage(): this is AgentStateMessage {\n return this.type === \"AgentStateMessage\";\n }\n}\n\n// alias Role to MessageRole\nexport const Role = MessageRole;\n\n// when constructing any message, the base fields are optional\ntype MessageConstructorOptions = Partial<Message>;\n\ntype TextMessageConstructorOptions = MessageConstructorOptions & TextMessageInput;\n\nexport class TextMessage extends Message implements TextMessageConstructorOptions {\n role: TextMessageInput[\"role\"];\n content: TextMessageInput[\"content\"];\n parentMessageId: TextMessageInput[\"parentMessageId\"];\n\n constructor(props: TextMessageConstructorOptions) {\n super(props);\n this.type = \"TextMessage\";\n }\n}\n\ntype ActionExecutionMessageConstructorOptions = MessageConstructorOptions &\n Omit<ActionExecutionMessageInput, \"arguments\"> & {\n arguments: Record<string, any>;\n };\n\nexport class ActionExecutionMessage\n extends Message\n implements Omit<ActionExecutionMessageInput, \"arguments\" | \"scope\">\n{\n name: ActionExecutionMessageInput[\"name\"];\n arguments: Record<string, any>;\n parentMessageId: ActionExecutionMessageInput[\"parentMessageId\"];\n constructor(props: ActionExecutionMessageConstructorOptions) {\n super(props);\n this.type = \"ActionExecutionMessage\";\n }\n}\n\ntype ResultMessageConstructorOptions = MessageConstructorOptions & ResultMessageInput;\n\nexport class ResultMessage extends Message implements ResultMessageConstructorOptions {\n actionExecutionId: ResultMessageInput[\"actionExecutionId\"];\n actionName: ResultMessageInput[\"actionName\"];\n result: ResultMessageInput[\"result\"];\n\n constructor(props: ResultMessageConstructorOptions) {\n super(props);\n this.type = \"ResultMessage\";\n }\n\n static decodeResult(result: string): any {\n 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\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,SAAS,gBAAgB;AAczB,SAAS,iBAAiB;AAInB,IAAM,UAAN,MAAc;AAAA,EAMnB,YAAY,OAAY;AACtB,UAAM,OAAN,MAAM,KAAO,SAAS;AACtB,UAAM,WAAN,MAAM,SAAW,EAAE,8BAAgC;AACnD,UAAM,cAAN,MAAM,YAAc,oBAAI,KAAK;AAC7B,WAAO,OAAO,MAAM,KAAK;AAAA,EAC3B;AAAA,EAEA,gBAAqC;AACnC,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,2BAA2D;AACzD,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,kBAAyC;AACvC,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,sBAAiD;AAC/C,WAAO,KAAK,SAAS;AAAA,EACvB;AACF;AAGO,IAAM,OAAO;AAOb,IAAM,cAAN,cAA0B,QAAiD;AAAA,EAKhF,YAAY,OAAsC;AAChD,UAAM,KAAK;AACX,SAAK,OAAO;AAAA,EACd;AACF;AAOO,IAAM,yBAAN,cACG,QAEV;AAAA,EAIE,YAAY,OAAiD;AAC3D,UAAM,KAAK;AACX,SAAK,OAAO;AAAA,EACd;AACF;AAIO,IAAM,gBAAN,cAA4B,QAAmD;AAAA,EAKpF,YAAY,OAAwC;AAClD,UAAM,KAAK;AACX,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,OAAO,aAAa,QAAqB;AACvC,WAAO,UAAU,QAAQ,MAAM;AAAA,EACjC;AAAA,EAEA,OAAO,aAAa,QAAqB;AACvC,QAAI,WAAW,QAAW;AACxB,aAAO;AAAA,IACT,WAAW,OAAO,WAAW,UAAU;AACrC,aAAO;AAAA,IACT,OAAO;AACL,aAAO,KAAK,UAAU,MAAM;AAAA,IAC9B;AAAA,EACF;AACF;AAEO,IAAM,oBAAN,cAAgC,QAAyD;AAAA,EAU9F,YAAY,OAAY;AACtB,UAAM,KAAK;AACX,SAAK,OAAO;AAAA,EACd;AACF;AAEO,SAAS,wBACd,YACyB;AACzB,SAAO,EAAE,GAAG,YAAY,+DAA6C,MAAM,YAAY;AACzF;","names":[]}
@@ -10,7 +10,7 @@ import {
10
10
  import { Client, cacheExchange, fetchExchange } from "@urql/core";
11
11
 
12
12
  // package.json
13
- var version = "1.6.0-next.3";
13
+ var version = "1.6.0-next.4";
14
14
 
15
15
  // src/client/CopilotRuntimeClient.ts
16
16
  import {
@@ -139,4 +139,4 @@ var CopilotRuntimeClient = class {
139
139
  export {
140
140
  CopilotRuntimeClient
141
141
  };
142
- //# sourceMappingURL=chunk-J7C6OSZI.mjs.map
142
+ //# sourceMappingURL=chunk-LBGNNJTN.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/client/CopilotRuntimeClient.ts","../package.json"],"sourcesContent":["import { Client, cacheExchange, fetchExchange } from \"@urql/core\";\nimport * as packageJson from \"../../package.json\";\nimport {\n AvailableAgentsQuery,\n GenerateCopilotResponseMutation,\n GenerateCopilotResponseMutationVariables,\n LoadAgentStateQuery,\n} from \"../graphql/@generated/graphql\";\nimport { generateCopilotResponseMutation } from \"../graphql/definitions/mutations\";\nimport { getAvailableAgentsQuery, loadAgentStateQuery } from \"../graphql/definitions/queries\";\nimport { OperationResultSource, OperationResult } from \"urql\";\nimport {\n ResolvedCopilotKitError,\n CopilotKitLowLevelError,\n CopilotKitError,\n CopilotKitVersionMismatchError,\n getPossibleVersionMismatch,\n} from \"@copilotkit/shared\";\n\nconst createFetchFn =\n (signal?: AbortSignal, handleGQLWarning?: (warning: string) => void) =>\n async (...args: Parameters<typeof fetch>) => {\n // @ts-expect-error -- since this is our own header, TS will not recognize\n const publicApiKey = args[1]?.headers?.[\"x-copilotcloud-public-api-key\"];\n try {\n const result = await fetch(args[0], { ...(args[1] ?? {}), signal });\n\n // No mismatch checking if cloud is being used\n const mismatch = publicApiKey\n ? null\n : await getPossibleVersionMismatch({\n runtimeVersion: result.headers.get(\"X-CopilotKit-Runtime-Version\")!,\n runtimeClientGqlVersion: packageJson.version,\n });\n if (result.status !== 200) {\n if (result.status >= 400 && result.status <= 500) {\n if (mismatch) {\n throw new CopilotKitVersionMismatchError(mismatch);\n }\n\n throw new ResolvedCopilotKitError({ status: result.status });\n }\n }\n\n if (mismatch && handleGQLWarning) {\n handleGQLWarning(mismatch.message);\n }\n\n return result;\n } catch (error) {\n // Let abort error pass through. It will be suppressed later\n if (\n (error as Error).message.includes(\"BodyStreamBuffer was aborted\") ||\n (error as Error).message.includes(\"signal is aborted without reason\")\n ) {\n throw error;\n }\n if (error instanceof CopilotKitError) {\n throw error;\n }\n throw new CopilotKitLowLevelError({ error: error as Error, url: args[0] as string });\n }\n };\n\nexport interface CopilotRuntimeClientOptions {\n url: string;\n publicApiKey?: string;\n headers?: Record<string, string>;\n credentials?: RequestCredentials;\n handleGQLErrors?: (error: Error) => void;\n handleGQLWarning?: (warning: string) => void;\n}\n\nexport class CopilotRuntimeClient {\n client: Client;\n public handleGQLErrors?: (error: Error) => void;\n public handleGQLWarning?: (warning: string) => void;\n\n constructor(options: CopilotRuntimeClientOptions) {\n const headers: Record<string, string> = {};\n\n this.handleGQLErrors = options.handleGQLErrors;\n this.handleGQLWarning = options.handleGQLWarning;\n\n if (options.headers) {\n Object.assign(headers, options.headers);\n }\n\n if (options.publicApiKey) {\n headers[\"x-copilotcloud-public-api-key\"] = options.publicApiKey;\n }\n\n this.client = new Client({\n url: options.url,\n exchanges: [cacheExchange, fetchExchange],\n fetchOptions: {\n headers: {\n ...headers,\n \"X-CopilotKit-Runtime-Client-GQL-Version\": packageJson.version,\n },\n ...(options.credentials ? { credentials: options.credentials } : {}),\n },\n });\n }\n\n generateCopilotResponse({\n data,\n properties,\n signal,\n }: {\n data: GenerateCopilotResponseMutationVariables[\"data\"];\n properties?: GenerateCopilotResponseMutationVariables[\"properties\"];\n signal?: AbortSignal;\n }) {\n const fetchFn = createFetchFn(signal, this.handleGQLWarning);\n const result = this.client.mutation<\n GenerateCopilotResponseMutation,\n GenerateCopilotResponseMutationVariables\n >(generateCopilotResponseMutation, { data, properties }, { fetch: fetchFn });\n\n return result;\n }\n\n public asStream<S, T>(source: OperationResultSource<OperationResult<S, { data: T }>>) {\n const handleGQLErrors = this.handleGQLErrors;\n return new ReadableStream<S>({\n start(controller) {\n source.subscribe(({ data, hasNext, error }) => {\n if (error) {\n if (\n error.message.includes(\"BodyStreamBuffer was aborted\") ||\n error.message.includes(\"signal is aborted without reason\")\n ) {\n // close the stream if there is no next item\n if (!hasNext) controller.close();\n\n //suppress this specific error\n console.warn(\"Abort error suppressed\");\n return;\n }\n controller.error(error);\n if (handleGQLErrors) {\n handleGQLErrors(error);\n }\n } else {\n controller.enqueue(data);\n if (!hasNext) {\n controller.close();\n }\n }\n });\n },\n });\n }\n\n availableAgents() {\n const fetchFn = createFetchFn();\n return this.client.query<AvailableAgentsQuery>(getAvailableAgentsQuery, {}, { fetch: fetchFn });\n }\n\n loadAgentState(data: { threadId: string; agentName: string }) {\n const fetchFn = createFetchFn();\n return this.client.query<LoadAgentStateQuery>(\n loadAgentStateQuery,\n { data },\n { fetch: fetchFn },\n );\n }\n\n static removeGraphQLTypename(data: any) {\n if (Array.isArray(data)) {\n data.forEach((item) => CopilotRuntimeClient.removeGraphQLTypename(item));\n } else if (typeof data === \"object\" && data !== null) {\n delete data.__typename;\n Object.keys(data).forEach((key) => {\n if (typeof data[key] === \"object\" && data[key] !== null) {\n CopilotRuntimeClient.removeGraphQLTypename(data[key]);\n }\n });\n }\n return data;\n }\n}\n","{\n \"name\": \"@copilotkit/runtime-client-gql\",\n \"private\": false,\n \"homepage\": \"https://github.com/CopilotKit/CopilotKit\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/CopilotKit/CopilotKit.git\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"version\": \"1.6.0-next.3\",\n \"sideEffects\": false,\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"types\": \"./dist/index.d.ts\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"pnpm run graphql-codegen && tsup --clean\",\n \"dev\": \"concurrently \\\"pnpm run graphql-codegen:watch\\\" \\\"tsup --watch --no-splitting\\\"\",\n \"test\": \"jest --passWithNoTests\",\n \"check-types\": \"tsc --noEmit\",\n \"clean\": \"rm -rf .turbo && rm -rf node_modules && rm -rf ./src/graphql/@generated && rm -rf dist && rm -rf .next\",\n \"graphql-codegen\": \"graphql-codegen -c codegen.ts\",\n \"graphql-codegen:watch\": \"graphql-codegen -c codegen.ts --watch\",\n \"link:global\": \"pnpm link --global\",\n \"unlink:global\": \"pnpm unlink --global\"\n },\n \"peerDependencies\": {\n \"react\": \"^18 || ^19 || ^19.0.0-rc\"\n },\n \"devDependencies\": {\n \"@graphql-codegen/cli\": \"^5.0.2\",\n \"@graphql-codegen/client-preset\": \"^4.2.6\",\n \"@graphql-codegen/introspection\": \"^4.0.3\",\n \"@graphql-codegen/typescript\": \"^4.0.7\",\n \"@graphql-codegen/typescript-operations\": \"^4.2.1\",\n \"@graphql-codegen/typescript-urql\": \"^4.0.0\",\n \"@graphql-codegen/urql-introspection\": \"^3.0.0\",\n \"@graphql-typed-document-node/core\": \"^3.2.0\",\n \"@parcel/watcher\": \"^2.4.1\",\n \"@types/node\": \"^20.12.12\",\n \"concurrently\": \"^8.2.2\",\n \"esbuild\": \"^0.23.0\",\n \"jest\": \"^29.6.4\",\n \"ts-jest\": \"^29.1.1\",\n \"ts-node\": \"^10.9.2\",\n \"tsup\": \"^6.7.0\",\n \"typescript\": \"^5.4.5\",\n \"@copilotkit/runtime\": \"workspace:*\",\n \"graphql\": \"^16.8.1\"\n },\n \"dependencies\": {\n \"@copilotkit/shared\": \"workspace:*\",\n \"@urql/core\": \"^5.0.3\",\n \"untruncate-json\": \"^0.0.1\",\n \"urql\": \"^4.1.0\"\n },\n \"keywords\": [\n \"copilotkit\",\n \"copilot\",\n \"react\",\n \"nextjs\",\n \"nodejs\",\n \"ai\",\n \"assistant\",\n \"javascript\",\n \"automation\",\n \"textarea\"\n ]\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,QAAQ,eAAe,qBAAqB;;;ACWnD,cAAW;;;ADAb;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,IAAM,gBACJ,CAAC,QAAsB,qBACvB,UAAU,SAAmC;AArB/C;AAuBI,QAAM,gBAAe,gBAAK,CAAC,MAAN,mBAAS,YAAT,mBAAmB;AACxC,MAAI;AACF,UAAM,SAAS,MAAM,MAAM,KAAK,CAAC,GAAG,EAAE,GAAI,KAAK,CAAC,KAAK,CAAC,GAAI,OAAO,CAAC;AAGlE,UAAM,WAAW,eACb,OACA,MAAM,2BAA2B;AAAA,MAC/B,gBAAgB,OAAO,QAAQ,IAAI,8BAA8B;AAAA,MACjE,yBAAqC;A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,aAAO,KAAK,IAAI,EAAE,QAAQ,CAAC,QAAQ;AACjC,YAAI,OAAO,KAAK,GAAG,MAAM,YAAY,KAAK,GAAG,MAAM,MAAM;AACvD,+BAAqB,sBAAsB,KAAK,GAAG,CAAC;AAAA,QACtD;AAAA,MACF,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/client/CopilotRuntimeClient.ts","../package.json"],"sourcesContent":["import { Client, cacheExchange, fetchExchange } from \"@urql/core\";\nimport * as packageJson from \"../../package.json\";\nimport {\n AvailableAgentsQuery,\n GenerateCopilotResponseMutation,\n GenerateCopilotResponseMutationVariables,\n LoadAgentStateQuery,\n} from \"../graphql/@generated/graphql\";\nimport { generateCopilotResponseMutation } from \"../graphql/definitions/mutations\";\nimport { getAvailableAgentsQuery, loadAgentStateQuery } from \"../graphql/definitions/queries\";\nimport { OperationResultSource, OperationResult } from \"urql\";\nimport {\n ResolvedCopilotKitError,\n CopilotKitLowLevelError,\n CopilotKitError,\n CopilotKitVersionMismatchError,\n getPossibleVersionMismatch,\n} from \"@copilotkit/shared\";\n\nconst createFetchFn =\n (signal?: AbortSignal, handleGQLWarning?: (warning: string) => void) =>\n async (...args: Parameters<typeof fetch>) => {\n // @ts-expect-error -- since this is our own header, TS will not recognize\n const publicApiKey = args[1]?.headers?.[\"x-copilotcloud-public-api-key\"];\n try {\n const result = await fetch(args[0], { ...(args[1] ?? {}), signal });\n\n // No mismatch checking if cloud is being used\n const mismatch = publicApiKey\n ? null\n : await getPossibleVersionMismatch({\n runtimeVersion: result.headers.get(\"X-CopilotKit-Runtime-Version\")!,\n runtimeClientGqlVersion: packageJson.version,\n });\n if (result.status !== 200) {\n if (result.status >= 400 && result.status <= 500) {\n if (mismatch) {\n throw new CopilotKitVersionMismatchError(mismatch);\n }\n\n throw new ResolvedCopilotKitError({ status: result.status });\n }\n }\n\n if (mismatch && handleGQLWarning) {\n handleGQLWarning(mismatch.message);\n }\n\n return result;\n } catch (error) {\n // Let abort error pass through. It will be suppressed later\n if (\n (error as Error).message.includes(\"BodyStreamBuffer was aborted\") ||\n (error as Error).message.includes(\"signal is aborted without reason\")\n ) {\n throw error;\n }\n if (error instanceof CopilotKitError) {\n throw error;\n }\n throw new CopilotKitLowLevelError({ error: error as Error, url: args[0] as string });\n }\n };\n\nexport interface CopilotRuntimeClientOptions {\n url: string;\n publicApiKey?: string;\n headers?: Record<string, string>;\n credentials?: RequestCredentials;\n handleGQLErrors?: (error: Error) => void;\n handleGQLWarning?: (warning: string) => void;\n}\n\nexport class CopilotRuntimeClient {\n client: Client;\n public handleGQLErrors?: (error: Error) => void;\n public handleGQLWarning?: (warning: string) => void;\n\n constructor(options: CopilotRuntimeClientOptions) {\n const headers: Record<string, string> = {};\n\n this.handleGQLErrors = options.handleGQLErrors;\n this.handleGQLWarning = options.handleGQLWarning;\n\n if (options.headers) {\n Object.assign(headers, options.headers);\n }\n\n if (options.publicApiKey) {\n headers[\"x-copilotcloud-public-api-key\"] = options.publicApiKey;\n }\n\n this.client = new Client({\n url: options.url,\n exchanges: [cacheExchange, fetchExchange],\n fetchOptions: {\n headers: {\n ...headers,\n \"X-CopilotKit-Runtime-Client-GQL-Version\": packageJson.version,\n },\n ...(options.credentials ? { credentials: options.credentials } : {}),\n },\n });\n }\n\n generateCopilotResponse({\n data,\n properties,\n signal,\n }: {\n data: GenerateCopilotResponseMutationVariables[\"data\"];\n properties?: GenerateCopilotResponseMutationVariables[\"properties\"];\n signal?: AbortSignal;\n }) {\n const fetchFn = createFetchFn(signal, this.handleGQLWarning);\n const result = this.client.mutation<\n GenerateCopilotResponseMutation,\n GenerateCopilotResponseMutationVariables\n >(generateCopilotResponseMutation, { data, properties }, { fetch: fetchFn });\n\n return result;\n }\n\n public asStream<S, T>(source: OperationResultSource<OperationResult<S, { data: T }>>) {\n const handleGQLErrors = this.handleGQLErrors;\n return new ReadableStream<S>({\n start(controller) {\n source.subscribe(({ data, hasNext, error }) => {\n if (error) {\n if (\n error.message.includes(\"BodyStreamBuffer was aborted\") ||\n error.message.includes(\"signal is aborted without reason\")\n ) {\n // close the stream if there is no next item\n if (!hasNext) controller.close();\n\n //suppress this specific error\n console.warn(\"Abort error suppressed\");\n return;\n }\n controller.error(error);\n if (handleGQLErrors) {\n handleGQLErrors(error);\n }\n } else {\n controller.enqueue(data);\n if (!hasNext) {\n controller.close();\n }\n }\n });\n },\n });\n }\n\n availableAgents() {\n const fetchFn = createFetchFn();\n return this.client.query<AvailableAgentsQuery>(getAvailableAgentsQuery, {}, { fetch: fetchFn });\n }\n\n loadAgentState(data: { threadId: string; agentName: string }) {\n const fetchFn = createFetchFn();\n return this.client.query<LoadAgentStateQuery>(\n loadAgentStateQuery,\n { data },\n { fetch: fetchFn },\n );\n }\n\n static removeGraphQLTypename(data: any) {\n if (Array.isArray(data)) {\n data.forEach((item) => CopilotRuntimeClient.removeGraphQLTypename(item));\n } else if (typeof data === \"object\" && data !== null) {\n delete data.__typename;\n Object.keys(data).forEach((key) => {\n if (typeof data[key] === \"object\" && data[key] !== null) {\n CopilotRuntimeClient.removeGraphQLTypename(data[key]);\n }\n });\n }\n return data;\n }\n}\n","{\n \"name\": \"@copilotkit/runtime-client-gql\",\n \"private\": false,\n \"homepage\": \"https://github.com/CopilotKit/CopilotKit\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/CopilotKit/CopilotKit.git\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"version\": \"1.6.0-next.4\",\n \"sideEffects\": false,\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"types\": \"./dist/index.d.ts\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"pnpm run graphql-codegen && tsup --clean\",\n \"dev\": \"concurrently \\\"pnpm run graphql-codegen:watch\\\" \\\"tsup --watch --no-splitting\\\"\",\n \"test\": \"jest --passWithNoTests\",\n \"check-types\": \"tsc --noEmit\",\n \"clean\": \"rm -rf .turbo && rm -rf node_modules && rm -rf ./src/graphql/@generated && rm -rf dist && rm -rf .next\",\n \"graphql-codegen\": \"graphql-codegen -c codegen.ts\",\n \"graphql-codegen:watch\": \"graphql-codegen -c codegen.ts --watch\",\n \"link:global\": \"pnpm link --global\",\n \"unlink:global\": \"pnpm unlink --global\"\n },\n \"peerDependencies\": {\n \"react\": \"^18 || ^19 || ^19.0.0-rc\"\n },\n \"devDependencies\": {\n \"@graphql-codegen/cli\": \"^5.0.2\",\n \"@graphql-codegen/client-preset\": \"^4.2.6\",\n \"@graphql-codegen/introspection\": \"^4.0.3\",\n \"@graphql-codegen/typescript\": \"^4.0.7\",\n \"@graphql-codegen/typescript-operations\": \"^4.2.1\",\n \"@graphql-codegen/typescript-urql\": \"^4.0.0\",\n \"@graphql-codegen/urql-introspection\": \"^3.0.0\",\n \"@graphql-typed-document-node/core\": \"^3.2.0\",\n \"@parcel/watcher\": \"^2.4.1\",\n \"@types/node\": \"^20.12.12\",\n \"concurrently\": \"^8.2.2\",\n \"esbuild\": \"^0.23.0\",\n \"jest\": \"^29.6.4\",\n \"ts-jest\": \"^29.1.1\",\n \"ts-node\": \"^10.9.2\",\n \"tsup\": \"^6.7.0\",\n \"typescript\": \"^5.4.5\",\n \"@copilotkit/runtime\": \"workspace:*\",\n \"graphql\": \"^16.8.1\"\n },\n \"dependencies\": {\n \"@copilotkit/shared\": \"workspace:*\",\n \"@urql/core\": \"^5.0.3\",\n \"untruncate-json\": \"^0.0.1\",\n \"urql\": \"^4.1.0\"\n },\n \"keywords\": [\n \"copilotkit\",\n \"copilot\",\n \"react\",\n \"nextjs\",\n \"nodejs\",\n \"ai\",\n \"assistant\",\n \"javascript\",\n \"automation\",\n \"textarea\"\n ]\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,QAAQ,eAAe,qBAAqB;;;ACWnD,cAAW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,yBAAyB,CAAC,GAAG,EAAE,OAAO,QAAQ,CAAC;AAAA,EAChG;AAAA,EAEA,eAAe,MAA+C;AAC5D,UAAM,UAAU,cAAc;AAC9B,WAAO,KAAK,OAAO;AAAA,MACjB;AAAA,MACA,EAAE,KAAK;AAAA,MACP,EAAE,OAAO,QAAQ;AAAA,IACnB;AAAA,EACF;AAAA,EAEA,OAAO,sBAAsB,MAAW;AACtC,QAAI,MAAM,QAAQ,IAAI,GAAG;AACvB,WAAK,QAAQ,CAAC,SAAS,qBAAqB,sBAAsB,IAAI,CAAC;AAAA,IACzE,WAAW,OAAO,SAAS,YAAY,SAAS,MAAM;AACpD,aAAO,KAAK;AACZ,aAAO,KAAK,IAAI,EAAE,QAAQ,CAAC,QAAQ;AACjC,YAAI,OAAO,KAAK,GAAG,MAAM,YAAY,KAAK,GAAG,MAAM,MAAM;AACvD,+BAAqB,sBAAsB,KAAK,GAAG,CAAC;AAAA,QACtD;AAAA,MACF,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -26,7 +26,7 @@ module.exports = __toCommonJS(CopilotRuntimeClient_exports);
26
26
  var import_core = require("@urql/core");
27
27
 
28
28
  // package.json
29
- var version = "1.6.0-next.3";
29
+ var version = "1.6.0-next.4";
30
30
 
31
31
  // src/graphql/@generated/graphql.ts
32
32
  var GenerateCopilotResponseDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "generateCopilotResponse" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "data" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "GenerateCopilotResponseInput" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "properties" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "JSONObject" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "generateCopilotResponse" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "data" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "data" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "properties" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "properties" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "runId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "extensions" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "openaiAssistantAPI" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "runId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }] } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "CopilotResponse" } }, "directives": [{ "kind": "Directive", "name": { "kind": "Name", "value": "defer" } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "status" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "BaseResponseStatus" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "code" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "FailedResponseStatus" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "reason" } }, { "kind": "Field", "name": { "kind": "Name", "value": "details" } }] } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "messages" }, "directives": [{ "kind": "Directive", "name": { "kind": "Name", "value": "stream" } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "__typename" } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "BaseMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "BaseMessageOutput" } }, "directives": [{ "kind": "Directive", "name": { "kind": "Name", "value": "defer" } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "status" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "SuccessMessageStatus" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "code" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "FailedMessageStatus" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "code" } }, { "kind": "Field", "name": { "kind": "Name", "value": "reason" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "PendingMessageStatus" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "code" } }] } }] } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "TextMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "content" }, "directives": [{ "kind": "Directive", "name": { "kind": "Name", "value": "stream" } }] }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }, { "kind": "Field", "name": { "kind": "Name", "value": "parentMessageId" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "ActionExecutionMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "arguments" }, "directives": [{ "kind": "Directive", "name": { "kind": "Name", "value": "stream" } }] }, { "kind": "Field", "name": { "kind": "Name", "value": "parentMessageId" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "ResultMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "result" } }, { "kind": "Field", "name": { "kind": "Name", "value": "actionExecutionId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "actionName" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "AgentStateMessageOutput" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "threadId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "state" } }, { "kind": "Field", "name": { "kind": "Name", "value": "running" } }, { "kind": "Field", "name": { "kind": "Name", "value": "agentName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "nodeName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "runId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "active" } }, { "kind": "Field", "name": { "kind": "Name", "value": "role" } }] } }] } }, { "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" } }] } }] } }] } }] } }] } }] };