@copilotkit/runtime-client-gql 1.51.4 → 1.51.5-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.
- package/CHANGELOG.md +8 -0
- package/dist/{chunk-2XWNDVTL.mjs → chunk-L77VMYMI.mjs} +2 -2
- package/dist/{chunk-2XWNDVTL.mjs.map → chunk-L77VMYMI.mjs.map} +1 -1
- package/dist/{chunk-LTVE64IE.mjs → chunk-OZU5URXW.mjs} +4 -1
- package/dist/chunk-OZU5URXW.mjs.map +1 -0
- package/dist/client/CopilotRuntimeClient.js +1 -1
- package/dist/client/CopilotRuntimeClient.js.map +1 -1
- package/dist/client/CopilotRuntimeClient.mjs +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/message-conversion/agui-to-gql.js +3 -0
- package/dist/message-conversion/agui-to-gql.js.map +1 -1
- package/dist/message-conversion/agui-to-gql.mjs +2 -2
- package/dist/message-conversion/agui-to-gql.test.js +62 -0
- package/dist/message-conversion/agui-to-gql.test.js.map +1 -1
- package/dist/message-conversion/agui-to-gql.test.mjs +61 -2
- package/dist/message-conversion/agui-to-gql.test.mjs.map +1 -1
- package/dist/message-conversion/gql-to-agui.mjs +1 -1
- package/dist/message-conversion/gql-to-agui.test.mjs +1 -1
- package/dist/message-conversion/index.js +3 -0
- package/dist/message-conversion/index.js.map +1 -1
- package/dist/message-conversion/index.mjs +2 -2
- package/dist/message-conversion/roundtrip-conversion.test.js +3 -0
- package/dist/message-conversion/roundtrip-conversion.test.js.map +1 -1
- package/dist/message-conversion/roundtrip-conversion.test.mjs +2 -2
- package/package.json +3 -3
- package/src/message-conversion/agui-to-gql.test.ts +70 -0
- package/src/message-conversion/agui-to-gql.ts +4 -0
- package/dist/chunk-LTVE64IE.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { Client, cacheExchange, fetchExchange } from "@urql/core";
|
|
11
11
|
|
|
12
12
|
// package.json
|
|
13
|
-
var version = "1.51.
|
|
13
|
+
var version = "1.51.5-next.0";
|
|
14
14
|
|
|
15
15
|
// src/client/CopilotRuntimeClient.ts
|
|
16
16
|
import {
|
|
@@ -173,4 +173,4 @@ var CopilotRuntimeClient = class {
|
|
|
173
173
|
export {
|
|
174
174
|
CopilotRuntimeClient
|
|
175
175
|
};
|
|
176
|
-
//# sourceMappingURL=chunk-
|
|
176
|
+
//# sourceMappingURL=chunk-L77VMYMI.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 {\n getAvailableAgentsQuery,\n loadAgentStateQuery,\n} 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({\n error: error as Error,\n url: args[0] as string,\n });\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 >(\n generateCopilotResponseMutation,\n { data, properties },\n { fetch: fetchFn },\n );\n\n return result;\n }\n\n public asStream<S, T>(\n source: OperationResultSource<OperationResult<S, { data: T }>>,\n ) {\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\n // Handle structured errors specially - check if it's a CopilotKitError with visibility\n if ((error as any).extensions?.visibility) {\n // Create a synthetic GraphQL error with the structured error info\n const syntheticError = {\n ...error,\n graphQLErrors: [\n {\n message: error.message,\n extensions: (error as any).extensions,\n },\n ],\n };\n\n if (handleGQLErrors) {\n handleGQLErrors(syntheticError);\n }\n return; // Don't close the stream for structured errors, let the error handler decide\n }\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>(\n getAvailableAgentsQuery,\n {},\n { fetch: fetchFn },\n );\n }\n\n loadAgentState(data: { threadId: string; agentName: string }) {\n const fetchFn = createFetchFn();\n const result = this.client.query<LoadAgentStateQuery>(\n loadAgentStateQuery,\n { data },\n { fetch: fetchFn },\n );\n\n // Add error handling for GraphQL errors - similar to generateCopilotResponse\n result\n .toPromise()\n .then(({ error }) => {\n if (error && this.handleGQLErrors) {\n this.handleGQLErrors(error);\n }\n })\n .catch(() => {}); // Suppress promise rejection warnings\n\n return result;\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.51.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 \"unpkg\": \"./dist/index.umd.js\",\n \"jsdelivr\": \"./dist/index.umd.js\",\n \"types\": \"./dist/index.d.ts\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"pnpm run graphql-codegen && tsup --clean && rollup -c rollup.config.mjs\",\n \"dev\": \"concurrently \\\"pnpm run graphql-codegen:watch\\\" \\\"tsup --watch --no-splitting\\\"\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"check-types\": \"tsc --noEmit\",\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 \"graphql\": \"^16.8.1\",\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 \"vitest\": \"^3.1.3\"\n },\n \"dependencies\": {\n \"@copilotkit/runtime\": \"workspace:*\",\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;;;ADGb;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,IAAM,gBACJ,CAAC,QAAsB,qBACvB,UAAU,SAAmC;AAxB/C;AA0BI,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;AAAA,IACvC,CAAC;AACL,QAAI,OAAO,WAAW,KAAK;AACzB,UAAI,OAAO,UAAU,OAAO,OAAO,UAAU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AE,OAAO,QAAQ;AAAA,IACnB;AAGA,WACG,UAAU,EACV,KAAK,CAAC,EAAE,MAAM,MAAM;AACnB,UAAI,SAAS,KAAK,iBAAiB;AACjC,aAAK,gBAAgB,KAAK;AAAA,MAC5B;AAAA,IACF,CAAC,EACA,MAAM,MAAM;AAAA,IAAC,CAAC;AAEjB,WAAO;AAAA,EACT;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":[]}
|
|
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 {\n getAvailableAgentsQuery,\n loadAgentStateQuery,\n} 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({\n error: error as Error,\n url: args[0] as string,\n });\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 >(\n generateCopilotResponseMutation,\n { data, properties },\n { fetch: fetchFn },\n );\n\n return result;\n }\n\n public asStream<S, T>(\n source: OperationResultSource<OperationResult<S, { data: T }>>,\n ) {\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\n // Handle structured errors specially - check if it's a CopilotKitError with visibility\n if ((error as any).extensions?.visibility) {\n // Create a synthetic GraphQL error with the structured error info\n const syntheticError = {\n ...error,\n graphQLErrors: [\n {\n message: error.message,\n extensions: (error as any).extensions,\n },\n ],\n };\n\n if (handleGQLErrors) {\n handleGQLErrors(syntheticError);\n }\n return; // Don't close the stream for structured errors, let the error handler decide\n }\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>(\n getAvailableAgentsQuery,\n {},\n { fetch: fetchFn },\n );\n }\n\n loadAgentState(data: { threadId: string; agentName: string }) {\n const fetchFn = createFetchFn();\n const result = this.client.query<LoadAgentStateQuery>(\n loadAgentStateQuery,\n { data },\n { fetch: fetchFn },\n );\n\n // Add error handling for GraphQL errors - similar to generateCopilotResponse\n result\n .toPromise()\n .then(({ error }) => {\n if (error && this.handleGQLErrors) {\n this.handleGQLErrors(error);\n }\n })\n .catch(() => {}); // Suppress promise rejection warnings\n\n return result;\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.51.5-next.0\",\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 \"unpkg\": \"./dist/index.umd.js\",\n \"jsdelivr\": \"./dist/index.umd.js\",\n \"types\": \"./dist/index.d.ts\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"pnpm run graphql-codegen && tsup --clean && rollup -c rollup.config.mjs\",\n \"dev\": \"concurrently \\\"pnpm run graphql-codegen:watch\\\" \\\"tsup --watch --no-splitting\\\"\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"check-types\": \"tsc --noEmit\",\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 \"graphql\": \"^16.8.1\",\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 \"vitest\": \"^3.1.3\"\n },\n \"dependencies\": {\n \"@copilotkit/runtime\": \"workspace:*\",\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;;;ADGb;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,IAAM,gBACJ,CAAC,QAAsB,qBACvB,UAAU,SAAmC;AAxB/C;AA0BI,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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CAAC;AAAA,MACD,EAAE,OAAO,QAAQ;AAAA,IACnB;AAAA,EACF;AAAA,EAEA,eAAe,MAA+C;AAC5D,UAAM,UAAU,cAAc;AAC9B,UAAM,SAAS,KAAK,OAAO;AAAA,MACzB;AAAA,MACA,EAAE,KAAK;AAAA,MACP,EAAE,OAAO,QAAQ;AAAA,IACnB;AAGA,WACG,UAAU,EACV,KAAK,CAAC,EAAE,MAAM,MAAM;AACnB,UAAI,SAAS,KAAK,iBAAiB;AACjC,aAAK,gBAAgB,KAAK;AAAA,MAC5B;AAAA,IACF,CAAC,EACA,MAAM,MAAM;AAAA,IAAC,CAAC;AAEjB,WAAO;AAAA,EACT;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":[]}
|
|
@@ -84,6 +84,9 @@ function aguiToGQL(messages, actions, coAgentStateRenders) {
|
|
|
84
84
|
}
|
|
85
85
|
continue;
|
|
86
86
|
}
|
|
87
|
+
if (message.role === "reasoning") {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
87
90
|
if (message.role === "developer" || message.role === "system" || message.role === "assistant" || message.role === "user") {
|
|
88
91
|
gqlMessages.push(aguiTextMessageToGQLMessage(message));
|
|
89
92
|
continue;
|
|
@@ -238,4 +241,4 @@ export {
|
|
|
238
241
|
aguiMessageWithRenderToGQL,
|
|
239
242
|
aguiMessageWithImageToGQLMessage
|
|
240
243
|
};
|
|
241
|
-
//# sourceMappingURL=chunk-
|
|
244
|
+
//# sourceMappingURL=chunk-OZU5URXW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/message-conversion/agui-to-gql.ts"],"sourcesContent":["import * as gql from \"../client\";\nimport { MessageRole } from \"../graphql/@generated/graphql\";\nimport agui from \"@copilotkit/shared\"; // named agui for clarity, but this only includes agui message types\n\n// Helper function to extract agent name from message\nfunction extractAgentName(message: agui.Message): string {\n if (message.role !== \"assistant\") {\n throw new Error(\n `Cannot extract agent name from message with role ${message.role}`,\n );\n }\n\n return message.agentName || \"unknown\";\n}\n\n// Type guard for agent state message\nfunction isAgentStateMessage(message: agui.Message): boolean {\n return (\n message.role === \"assistant\" && \"agentName\" in message && \"state\" in message\n );\n}\n\n// Type guard for messages with image property\nfunction hasImageProperty(message: agui.Message): boolean {\n const canContainImage =\n message.role === \"assistant\" || message.role === \"user\";\n if (!canContainImage || message.image === undefined) {\n return false;\n }\n\n const isMalformed =\n message.image.format === undefined || message.image.bytes === undefined;\n if (isMalformed) {\n return false;\n }\n\n return true;\n}\n\n/*\n ----------------------------\n AGUI Message -> GQL Message\n ----------------------------\n*/\nexport function aguiToGQL(\n messages: agui.Message[] | agui.Message,\n actions?: Record<string, any>,\n coAgentStateRenders?: Record<string, any>,\n): gql.Message[] {\n const gqlMessages: gql.Message[] = [];\n messages = Array.isArray(messages) ? messages : [messages];\n\n // Track tool call names by their IDs for use in result messages\n const toolCallNames: Record<string, string> = {};\n\n for (const message of messages) {\n // Agent state message support\n if (isAgentStateMessage(message)) {\n const agentName = extractAgentName(message);\n const state = \"state\" in message && message.state ? message.state : {};\n gqlMessages.push(\n new gql.AgentStateMessage({\n id: message.id,\n agentName,\n state,\n role: gql.Role.Assistant,\n }),\n );\n // Optionally preserve render function\n if (\n \"generativeUI\" in message &&\n message.generativeUI &&\n coAgentStateRenders\n ) {\n coAgentStateRenders[agentName] = {\n name: agentName,\n render: message.generativeUI,\n };\n }\n continue;\n }\n\n if (hasImageProperty(message)) {\n gqlMessages.push(aguiMessageWithImageToGQLMessage(message));\n continue;\n }\n\n // Action execution message support\n if (message.role === \"assistant\" && message.toolCalls) {\n gqlMessages.push(aguiTextMessageToGQLMessage(message));\n for (const toolCall of message.toolCalls) {\n // Track the tool call name by its ID\n toolCallNames[toolCall.id] = toolCall.function.name;\n\n const actionExecMsg = aguiToolCallToGQLActionExecution(\n toolCall,\n message.id,\n );\n // Preserve render function in actions context\n if (\"generativeUI\" in message && message.generativeUI && actions) {\n const actionName = toolCall.function.name;\n // Check for specific action first, then wild card action\n const specificAction = Object.values(actions).find(\n (action: any) => action.name === actionName,\n );\n const wildcardAction = Object.values(actions).find(\n (action: any) => action.name === \"*\",\n );\n\n // Assign render function to the matching action (specific takes priority)\n if (specificAction) {\n specificAction.render = message.generativeUI;\n } else if (wildcardAction) {\n wildcardAction.render = message.generativeUI;\n }\n }\n gqlMessages.push(actionExecMsg);\n }\n continue;\n }\n // Reasoning messages are ephemeral display-only content with no GQL equivalent — skip them\n if (message.role === \"reasoning\") {\n continue;\n }\n // Regular text messages\n if (\n message.role === \"developer\" ||\n message.role === \"system\" ||\n message.role === \"assistant\" ||\n message.role === \"user\"\n ) {\n gqlMessages.push(aguiTextMessageToGQLMessage(message));\n continue;\n }\n // Tool result message\n if (message.role === \"tool\") {\n gqlMessages.push(\n aguiToolMessageToGQLResultMessage(message, toolCallNames),\n );\n continue;\n }\n throw new Error(\n `Unknown message role: \"${(message as any).role}\" in message with id: ${(message as any).id}`,\n );\n }\n\n return gqlMessages;\n}\n\nexport function aguiTextMessageToGQLMessage(\n message: agui.Message,\n): gql.TextMessage {\n if (\n message.role !== \"developer\" &&\n message.role !== \"system\" &&\n message.role !== \"assistant\" &&\n message.role !== \"user\"\n ) {\n throw new Error(\n `Cannot convert message with role ${message.role} to TextMessage`,\n );\n }\n\n let roleValue: MessageRole;\n\n if (message.role === \"developer\") {\n roleValue = gql.Role.Developer;\n } else if (message.role === \"system\") {\n roleValue = gql.Role.System;\n } else if (message.role === \"assistant\") {\n roleValue = gql.Role.Assistant;\n } else {\n roleValue = gql.Role.User;\n }\n\n return new gql.TextMessage({\n id: message.id,\n content: (message.content as any) || \"\",\n role: roleValue,\n });\n}\n\nexport function aguiToolCallToGQLActionExecution(\n toolCall: agui.ToolCall,\n parentMessageId: string,\n): gql.ActionExecutionMessage {\n if (toolCall.type !== \"function\") {\n throw new Error(`Unsupported tool call type: ${toolCall.type}`);\n }\n\n // Handle arguments - they should be a JSON string in AGUI format,\n // but we need to convert them to an object for GQL format\n let argumentsObj: any;\n\n if (typeof toolCall.function.arguments === \"string\") {\n // Expected case: arguments is a JSON string\n try {\n argumentsObj = JSON.parse(toolCall.function.arguments);\n } catch (error) {\n console.warn(\n `Failed to parse tool call arguments for ${toolCall.function.name}:`,\n error,\n );\n // Provide fallback empty object to prevent application crash\n argumentsObj = {};\n }\n } else if (\n typeof toolCall.function.arguments === \"object\" &&\n toolCall.function.arguments !== null\n ) {\n // Backward compatibility: arguments is already an object\n argumentsObj = toolCall.function.arguments;\n } else {\n // Fallback for undefined, null, or other types\n console.warn(\n `Invalid tool call arguments type for ${toolCall.function.name}:`,\n typeof toolCall.function.arguments,\n );\n argumentsObj = {};\n }\n\n // Always include name and arguments\n return new gql.ActionExecutionMessage({\n id: toolCall.id,\n name: toolCall.function.name,\n arguments: argumentsObj,\n parentMessageId: parentMessageId,\n });\n}\n\nexport function aguiToolMessageToGQLResultMessage(\n message: agui.Message,\n toolCallNames: Record<string, string>,\n): gql.ResultMessage {\n if (message.role !== \"tool\") {\n throw new Error(\n `Cannot convert message with role ${message.role} to ResultMessage`,\n );\n }\n\n if (!message.toolCallId) {\n throw new Error(\"Tool message must have a toolCallId\");\n }\n\n const actionName = toolCallNames[message.toolCallId] || \"unknown\";\n\n // Handle result content - it could be a string or an object that needs serialization\n let resultContent: string;\n const messageContent = message.content || \"\";\n\n if (typeof messageContent === \"string\") {\n // Expected case: content is already a string\n resultContent = messageContent;\n } else if (typeof messageContent === \"object\" && messageContent !== null) {\n // Handle case where content is an object that needs to be serialized\n try {\n resultContent = JSON.stringify(messageContent);\n } catch (error) {\n console.warn(`Failed to stringify tool result for ${actionName}:`, error);\n resultContent = String(messageContent);\n }\n } else {\n // Handle other types (number, boolean, etc.)\n resultContent = String(messageContent);\n }\n\n return new gql.ResultMessage({\n id: message.id,\n result: resultContent,\n actionExecutionId: message.toolCallId,\n actionName: message.toolName || actionName,\n });\n}\n\n// New function to handle AGUI messages with render functions\nexport function aguiMessageWithRenderToGQL(\n message: agui.Message,\n actions?: Record<string, any>,\n coAgentStateRenders?: Record<string, any>,\n): gql.Message[] {\n // Handle the special case: assistant messages with render function but no tool calls\n if (\n message.role === \"assistant\" &&\n \"generativeUI\" in message &&\n message.generativeUI &&\n !message.toolCalls\n ) {\n const gqlMessages: gql.Message[] = [];\n gqlMessages.push(\n new gql.AgentStateMessage({\n id: message.id,\n agentName: \"unknown\",\n state: {},\n role: gql.Role.Assistant,\n }),\n );\n if (coAgentStateRenders) {\n coAgentStateRenders.unknown = {\n name: \"unknown\",\n render: message.generativeUI,\n };\n }\n return gqlMessages;\n }\n\n // For all other cases, delegate to aguiToGQL\n return aguiToGQL([message], actions, coAgentStateRenders);\n}\n\nexport function aguiMessageWithImageToGQLMessage(\n message: agui.Message,\n): gql.ImageMessage {\n if (!hasImageProperty(message)) {\n throw new Error(\n `Cannot convert message to ImageMessage: missing format or bytes`,\n );\n }\n\n let roleValue: MessageRole;\n if (message.role === \"assistant\") {\n roleValue = gql.Role.Assistant;\n } else {\n roleValue = gql.Role.User;\n }\n\n if (message.role !== \"assistant\" && message.role !== \"user\") {\n throw new Error(\n `Cannot convert message with role ${message.role} to ImageMessage`,\n );\n }\n\n return new gql.ImageMessage({\n id: message.id,\n format: message.image!.format,\n bytes: message.image!.bytes,\n role: roleValue,\n });\n}\n"],"mappings":";;;;;;;;;;AAKA,SAAS,iBAAiB,SAA+B;AACvD,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EACvB;AAEA,MAAI,QAAQ,SAAS,eAAe,QAAQ,SAAS,QAAQ;AAC3D,UAAM,IAAI;AAAA,MACR,oCAAoC,QAAQ;AAAA,IAC9C;AAAA,EACF;AAEA,SAAO,IAAQ,aAAa;AAAA,IAC1B,IAAI,QAAQ;AAAA,IACZ,QAAQ,QAAQ,MAAO;AAAA,IACvB,OAAO,QAAQ,MAAO;AAAA,IACtB,MAAM;AAAA,EACR,CAAC;AACH;","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.51.
|
|
29
|
+
var version = "1.51.5-next.0";
|
|
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": "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" } }] } }] } }] } }] } }] } }] };
|