@copilotkit/runtime 1.9.2-next.8 → 1.9.2

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 (86) hide show
  1. package/CHANGELOG.md +177 -0
  2. package/dist/{chunk-4TLMVLU4.mjs → chunk-56ZNYBXV.mjs} +2 -2
  3. package/dist/chunk-AMUJQ6IR.mjs +50 -0
  4. package/dist/chunk-AMUJQ6IR.mjs.map +1 -0
  5. package/dist/{chunk-5SG4WWXH.mjs → chunk-GB4M7WUE.mjs} +2 -2
  6. package/dist/{chunk-JWPSIGSA.mjs → chunk-HJYWUUFY.mjs} +2 -2
  7. package/dist/{chunk-KYCDL2KX.mjs → chunk-M35WOOEP.mjs} +2 -2
  8. package/dist/{chunk-IIXJVVTV.mjs → chunk-QLLV2QVK.mjs} +132 -78
  9. package/dist/chunk-QLLV2QVK.mjs.map +1 -0
  10. package/dist/{chunk-WIXS6EG7.mjs → chunk-TE5QWP4H.mjs} +2401 -2055
  11. package/dist/chunk-TE5QWP4H.mjs.map +1 -0
  12. package/dist/{chunk-5BIEM2UU.mjs → chunk-XWBDEXDA.mjs} +4 -3
  13. package/dist/{chunk-5BIEM2UU.mjs.map → chunk-XWBDEXDA.mjs.map} +1 -1
  14. package/dist/{groq-adapter-25a2bd35.d.ts → groq-adapter-742818f2.d.ts} +5 -1
  15. package/dist/index.d.ts +4 -3
  16. package/dist/index.js +3747 -3303
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +12 -8
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/{langserve-4a5c9217.d.ts → langserve-3e8d0e06.d.ts} +13 -7
  21. package/dist/lib/index.d.ts +155 -5
  22. package/dist/lib/index.js +2808 -2407
  23. package/dist/lib/index.js.map +1 -1
  24. package/dist/lib/index.mjs +9 -8
  25. package/dist/lib/integrations/index.d.ts +3 -3
  26. package/dist/lib/integrations/index.js +151 -96
  27. package/dist/lib/integrations/index.js.map +1 -1
  28. package/dist/lib/integrations/index.mjs +7 -6
  29. package/dist/lib/integrations/nest/index.d.ts +2 -2
  30. package/dist/lib/integrations/nest/index.js +151 -96
  31. package/dist/lib/integrations/nest/index.js.map +1 -1
  32. package/dist/lib/integrations/nest/index.mjs +5 -4
  33. package/dist/lib/integrations/node-express/index.d.ts +2 -2
  34. package/dist/lib/integrations/node-express/index.js +151 -96
  35. package/dist/lib/integrations/node-express/index.js.map +1 -1
  36. package/dist/lib/integrations/node-express/index.mjs +5 -4
  37. package/dist/lib/integrations/node-http/index.d.ts +2 -2
  38. package/dist/lib/integrations/node-http/index.js +151 -96
  39. package/dist/lib/integrations/node-http/index.js.map +1 -1
  40. package/dist/lib/integrations/node-http/index.mjs +4 -3
  41. package/dist/service-adapters/index.d.ts +6 -4
  42. package/dist/service-adapters/index.js +202 -107
  43. package/dist/service-adapters/index.js.map +1 -1
  44. package/dist/service-adapters/index.mjs +6 -2
  45. package/dist/service-adapters/shared/index.d.ts +9 -0
  46. package/dist/service-adapters/shared/index.js +72 -0
  47. package/dist/service-adapters/shared/index.js.map +1 -0
  48. package/dist/service-adapters/shared/index.mjs +8 -0
  49. package/dist/service-adapters/shared/index.mjs.map +1 -0
  50. package/dist/{shared-941d59dc.d.ts → shared-96b46379.d.ts} +23 -21
  51. package/dist/utils/index.d.ts +17 -1
  52. package/dist/utils/index.js +3 -2
  53. package/dist/utils/index.js.map +1 -1
  54. package/dist/utils/index.mjs +1 -1
  55. package/package.json +11 -11
  56. package/src/agents/langgraph/event-source.ts +36 -38
  57. package/src/agents/langgraph/events.ts +19 -1
  58. package/src/graphql/resolvers/copilot.resolver.ts +85 -42
  59. package/src/lib/error-messages.ts +200 -0
  60. package/src/lib/integrations/shared.ts +43 -0
  61. package/src/lib/runtime/__tests__/{copilot-runtime-trace.test.ts → copilot-runtime-error.test.ts} +27 -27
  62. package/src/lib/runtime/__tests__/mcp-tools-utils.test.ts +464 -0
  63. package/src/lib/runtime/agui-action.ts +9 -3
  64. package/src/lib/runtime/copilot-runtime.ts +156 -160
  65. package/src/lib/runtime/mcp-tools-utils.ts +84 -18
  66. package/src/lib/runtime/remote-action-constructors.ts +28 -3
  67. package/src/lib/runtime/remote-actions.ts +6 -0
  68. package/src/lib/runtime/remote-lg-action.ts +85 -3
  69. package/src/lib/streaming.ts +125 -36
  70. package/src/service-adapters/anthropic/anthropic-adapter.ts +67 -8
  71. package/src/service-adapters/anthropic/utils.ts +3 -8
  72. package/src/service-adapters/events.ts +75 -80
  73. package/src/service-adapters/google/google-genai-adapter.ts +5 -0
  74. package/src/service-adapters/groq/groq-adapter.ts +66 -56
  75. package/src/service-adapters/index.ts +1 -0
  76. package/src/service-adapters/openai/openai-adapter.ts +4 -3
  77. package/src/service-adapters/shared/error-utils.ts +61 -0
  78. package/src/service-adapters/shared/index.ts +1 -0
  79. package/src/utils/failed-response-status-reasons.ts +23 -1
  80. package/tests/service-adapters/anthropic/anthropic-adapter.test.ts +172 -387
  81. package/dist/chunk-IIXJVVTV.mjs.map +0 -1
  82. package/dist/chunk-WIXS6EG7.mjs.map +0 -1
  83. /package/dist/{chunk-4TLMVLU4.mjs.map → chunk-56ZNYBXV.mjs.map} +0 -0
  84. /package/dist/{chunk-5SG4WWXH.mjs.map → chunk-GB4M7WUE.mjs.map} +0 -0
  85. /package/dist/{chunk-JWPSIGSA.mjs.map → chunk-HJYWUUFY.mjs.map} +0 -0
  86. /package/dist/{chunk-KYCDL2KX.mjs.map → chunk-M35WOOEP.mjs.map} +0 -0
@@ -11,7 +11,10 @@ import {
11
11
  OpenAIAssistantAdapter,
12
12
  RemoteChain,
13
13
  UnifyAdapter
14
- } from "../chunk-IIXJVVTV.mjs";
14
+ } from "../chunk-QLLV2QVK.mjs";
15
+ import {
16
+ convertServiceAdapterError
17
+ } from "../chunk-AMUJQ6IR.mjs";
15
18
  import "../chunk-FHD4JECV.mjs";
16
19
  export {
17
20
  AnthropicAdapter,
@@ -25,6 +28,7 @@ export {
25
28
  OpenAIAdapter,
26
29
  OpenAIAssistantAdapter,
27
30
  RemoteChain,
28
- UnifyAdapter
31
+ UnifyAdapter,
32
+ convertServiceAdapterError
29
33
  };
30
34
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,9 @@
1
+ import { CopilotKitLowLevelError } from '@copilotkit/shared';
2
+
3
+ /**
4
+ * Converts service adapter errors to structured CopilotKitError format using HTTP status codes.
5
+ * This provides consistent error classification across all service adapters.
6
+ */
7
+ declare function convertServiceAdapterError(error: any, adapterName: string): CopilotKitLowLevelError;
8
+
9
+ export { convertServiceAdapterError };
@@ -0,0 +1,72 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/service-adapters/shared/index.ts
21
+ var shared_exports = {};
22
+ __export(shared_exports, {
23
+ convertServiceAdapterError: () => convertServiceAdapterError
24
+ });
25
+ module.exports = __toCommonJS(shared_exports);
26
+
27
+ // src/service-adapters/shared/error-utils.ts
28
+ var import_shared = require("@copilotkit/shared");
29
+ function convertServiceAdapterError(error, adapterName) {
30
+ var _a, _b, _c;
31
+ const errorName = ((_a = error == null ? void 0 : error.constructor) == null ? void 0 : _a.name) || error.name;
32
+ const errorMessage = (error == null ? void 0 : error.message) || String(error);
33
+ const statusCode = error.status || error.statusCode || ((_b = error.response) == null ? void 0 : _b.status);
34
+ const responseData = error.error || ((_c = error.response) == null ? void 0 : _c.data) || error.data;
35
+ const structuredError = new import_shared.CopilotKitLowLevelError({
36
+ error: error instanceof Error ? error : new Error(errorMessage),
37
+ url: `${adapterName} service adapter`,
38
+ message: `${adapterName} API error: ${errorMessage}`
39
+ });
40
+ if (statusCode) {
41
+ structuredError.statusCode = statusCode;
42
+ }
43
+ if (responseData) {
44
+ structuredError.responseData = responseData;
45
+ }
46
+ if (errorName) {
47
+ structuredError.originalErrorType = errorName;
48
+ }
49
+ let newCode;
50
+ if (statusCode === 401) {
51
+ newCode = import_shared.CopilotKitErrorCode.AUTHENTICATION_ERROR;
52
+ } else if (statusCode >= 400 && statusCode < 500) {
53
+ newCode = import_shared.CopilotKitErrorCode.CONFIGURATION_ERROR;
54
+ } else if (statusCode >= 500) {
55
+ newCode = import_shared.CopilotKitErrorCode.NETWORK_ERROR;
56
+ } else if (statusCode) {
57
+ newCode = import_shared.CopilotKitErrorCode.CONFIGURATION_ERROR;
58
+ } else {
59
+ newCode = import_shared.CopilotKitErrorCode.NETWORK_ERROR;
60
+ }
61
+ structuredError.code = newCode;
62
+ if (structuredError.extensions) {
63
+ structuredError.extensions.code = newCode;
64
+ }
65
+ return structuredError;
66
+ }
67
+ __name(convertServiceAdapterError, "convertServiceAdapterError");
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ convertServiceAdapterError
71
+ });
72
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/service-adapters/shared/index.ts","../../../src/service-adapters/shared/error-utils.ts"],"sourcesContent":["export * from \"./error-utils\";\n","import { CopilotKitLowLevelError, CopilotKitErrorCode } from \"@copilotkit/shared\";\n\n/**\n * Converts service adapter errors to structured CopilotKitError format using HTTP status codes.\n * This provides consistent error classification across all service adapters.\n */\nexport function convertServiceAdapterError(\n error: any,\n adapterName: string,\n): CopilotKitLowLevelError {\n const errorName = error?.constructor?.name || error.name;\n const errorMessage = error?.message || String(error);\n const statusCode = error.status || error.statusCode || error.response?.status;\n const responseData = error.error || error.response?.data || error.data;\n\n // Create the base error with the constructor signature\n const structuredError = new CopilotKitLowLevelError({\n error: error instanceof Error ? error : new Error(errorMessage),\n url: `${adapterName} service adapter`,\n message: `${adapterName} API error: ${errorMessage}`,\n });\n\n // Add additional properties after construction\n if (statusCode) {\n (structuredError as any).statusCode = statusCode;\n }\n if (responseData) {\n (structuredError as any).responseData = responseData;\n }\n if (errorName) {\n (structuredError as any).originalErrorType = errorName;\n }\n\n // Classify error based on HTTP status codes (reliable and provider-agnostic)\n let newCode: CopilotKitErrorCode;\n\n if (statusCode === 401) {\n // 401 = Authentication/API key issues\n newCode = CopilotKitErrorCode.AUTHENTICATION_ERROR;\n } else if (statusCode >= 400 && statusCode < 500) {\n // 4xx = Client errors (bad request, invalid params, etc.) - these are configuration issues\n newCode = CopilotKitErrorCode.CONFIGURATION_ERROR;\n } else if (statusCode >= 500) {\n // 5xx = Server errors - keep as NETWORK_ERROR since it's infrastructure related\n newCode = CopilotKitErrorCode.NETWORK_ERROR;\n } else if (statusCode) {\n // Any other HTTP status with an error - likely configuration\n newCode = CopilotKitErrorCode.CONFIGURATION_ERROR;\n } else {\n // No status code - likely a genuine network/connection error\n newCode = CopilotKitErrorCode.NETWORK_ERROR;\n }\n\n // Update both the instance property and the extensions\n (structuredError as any).code = newCode;\n if ((structuredError as any).extensions) {\n (structuredError as any).extensions.code = newCode;\n }\n\n return structuredError;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,oBAA6D;AAMtD,SAASA,2BACdC,OACAC,aAAmB;AARrB;AAUE,QAAMC,cAAYF,oCAAOG,gBAAPH,mBAAoBI,SAAQJ,MAAMI;AACpD,QAAMC,gBAAeL,+BAAOM,YAAWC,OAAOP,KAAAA;AAC9C,QAAMQ,aAAaR,MAAMS,UAAUT,MAAMQ,gBAAcR,WAAMU,aAANV,mBAAgBS;AACvE,QAAME,eAAeX,MAAMA,WAASA,WAAMU,aAANV,mBAAgBY,SAAQZ,MAAMY;AAGlE,QAAMC,kBAAkB,IAAIC,sCAAwB;IAClDd,OAAOA,iBAAiBe,QAAQf,QAAQ,IAAIe,MAAMV,YAAAA;IAClDW,KAAK,GAAGf;IACRK,SAAS,GAAGL,0BAA0BI;EACxC,CAAA;AAGA,MAAIG,YAAY;AACbK,oBAAwBL,aAAaA;EACxC;AACA,MAAIG,cAAc;AACfE,oBAAwBF,eAAeA;EAC1C;AACA,MAAIT,WAAW;AACZW,oBAAwBI,oBAAoBf;EAC/C;AAGA,MAAIgB;AAEJ,MAAIV,eAAe,KAAK;AAEtBU,cAAUC,kCAAoBC;EAChC,WAAWZ,cAAc,OAAOA,aAAa,KAAK;AAEhDU,cAAUC,kCAAoBE;EAChC,WAAWb,cAAc,KAAK;AAE5BU,cAAUC,kCAAoBG;EAChC,WAAWd,YAAY;AAErBU,cAAUC,kCAAoBE;EAChC,OAAO;AAELH,cAAUC,kCAAoBG;EAChC;AAGCT,kBAAwBU,OAAOL;AAChC,MAAKL,gBAAwBW,YAAY;AACtCX,oBAAwBW,WAAWD,OAAOL;EAC7C;AAEA,SAAOL;AACT;AAtDgBd;","names":["convertServiceAdapterError","error","adapterName","errorName","constructor","name","errorMessage","message","String","statusCode","status","response","responseData","data","structuredError","CopilotKitLowLevelError","Error","url","originalErrorType","newCode","CopilotKitErrorCode","AUTHENTICATION_ERROR","CONFIGURATION_ERROR","NETWORK_ERROR","code","extensions"]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ convertServiceAdapterError
3
+ } from "../../chunk-AMUJQ6IR.mjs";
4
+ import "../../chunk-FHD4JECV.mjs";
5
+ export {
6
+ convertServiceAdapterError
7
+ };
8
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,8 +1,9 @@
1
1
  import * as graphql from 'graphql';
2
- import * as pino from 'pino';
2
+ import * as createPinoLogger from 'pino';
3
+ import createPinoLogger__default from 'pino';
3
4
  import { YogaInitialContext, createYoga } from 'graphql-yoga';
4
- import { Parameter, Action, CopilotTraceHandler } from '@copilotkit/shared';
5
- import { b as CopilotServiceAdapter, A as ActionInput, d as AgentSessionInput, e as AgentStateInput, F as ForwardedParametersInput, E as ExtensionsInput, R as RemoteChainParameters, f as RuntimeEventSource, g as ExtensionsResponse } from './langserve-4a5c9217.js';
5
+ import { Parameter, Action, CopilotErrorHandler } from '@copilotkit/shared';
6
+ import { b as CopilotServiceAdapter, A as ActionInput, d as AgentSessionInput, e as AgentStateInput, F as ForwardedParametersInput, E as ExtensionsInput, R as RemoteChainParameters, f as RuntimeEventSource, g as ExtensionsResponse } from './langserve-3e8d0e06.js';
6
7
  import { M as MessageInput, a as Message } from './index-d4614f9b.js';
7
8
  import { CopilotCloudOptions } from './lib/cloud/index.js';
8
9
  import { AbstractAgent } from '@ag-ui/client';
@@ -141,9 +142,7 @@ interface MCPTool {
141
142
  };
142
143
  };
143
144
  /** The function to call to execute the tool on the MCP server. */
144
- execute(options: {
145
- params: any;
146
- }): Promise<any>;
145
+ execute(params: any): Promise<any>;
147
146
  }
148
147
  /**
149
148
  * Defines the contract for *any* MCP client implementation the user might provide.
@@ -339,23 +338,23 @@ interface CopilotRuntimeConstructorParams<T extends Parameter[] | [] = []> {
339
338
  */
340
339
  createMCPClient?: CreateMCPClientFunction;
341
340
  /**
342
- * Optional trace handler for comprehensive debugging and observability.
341
+ * Optional error handler for comprehensive debugging and observability.
343
342
  *
344
- * **Requires publicApiKey**: Tracing only works when requests include a valid publicApiKey.
343
+ * **Requires publicApiKey**: Error handling only works when requests include a valid publicApiKey.
345
344
  * This is a premium CopilotKit Cloud feature.
346
345
  *
347
- * @param traceEvent - Structured trace event with rich debugging context
346
+ * @param errorEvent - Structured error event with rich debugging context
348
347
  *
349
348
  * @example
350
349
  * ```typescript
351
350
  * const runtime = new CopilotRuntime({
352
- * onTrace: (traceEvent) => {
353
- * debugDashboard.capture(traceEvent);
351
+ * onError: (errorEvent) => {
352
+ * debugDashboard.capture(errorEvent);
354
353
  * }
355
354
  * });
356
355
  * ```
357
356
  */
358
- onTrace?: CopilotTraceHandler;
357
+ onError?: CopilotErrorHandler;
359
358
  }
360
359
  declare class CopilotRuntime<const T extends Parameter[] | [] = []> {
361
360
  actions: ActionsConfiguration<T>;
@@ -367,8 +366,8 @@ declare class CopilotRuntime<const T extends Parameter[] | [] = []> {
367
366
  private delegateAgentProcessingToServiceAdapter;
368
367
  private observability?;
369
368
  private availableAgents;
370
- private onTrace?;
371
- private hasWarnedAboutTracing;
369
+ private onError?;
370
+ private hasWarnedAboutError;
372
371
  private readonly mcpServersConfig?;
373
372
  private mcpActionCache;
374
373
  private readonly createMCPClientImpl?;
@@ -377,18 +376,18 @@ declare class CopilotRuntime<const T extends Parameter[] | [] = []> {
377
376
  processRuntimeRequest(request: CopilotRuntimeRequest): Promise<CopilotRuntimeResponse>;
378
377
  getAllAgents(graphqlContext: GraphQLContext): Promise<(AgentWithEndpoint | Agent)[]>;
379
378
  discoverAgentsFromEndpoints(graphqlContext: GraphQLContext): Promise<AgentWithEndpoint[]>;
380
- discoverAgentsFromAgui(): Promise<AgentWithEndpoint[]>;
379
+ discoverAgentsFromAgui(): Agent[];
381
380
  loadAgentState(graphqlContext: GraphQLContext, threadId: string, agentName: string): Promise<LoadAgentStateResponse>;
382
381
  private processAgentRequest;
383
382
  private getServerSideActions;
384
383
  private detectProvider;
385
384
  private convertStreamingErrorToStructured;
386
- private trace;
385
+ private error;
387
386
  /**
388
- * Public method to trace GraphQL validation errors
389
- * This allows the GraphQL resolver to send validation errors through the trace system
387
+ * Public method to handle GraphQL validation errors
388
+ * This allows the GraphQL resolver to send validation errors through the error system
390
389
  */
391
- traceGraphQLError(error: {
390
+ errorGraphQLError(error: {
392
391
  message: string;
393
392
  code: string;
394
393
  type: string;
@@ -408,9 +407,9 @@ type CopilotRuntimeLogger = ReturnType<typeof createLogger>;
408
407
  declare function createLogger(options?: {
409
408
  level?: LogLevel;
410
409
  component?: string;
411
- }): pino.Logger<never>;
410
+ }): createPinoLogger__default.Logger<never>;
412
411
 
413
- declare const logger: pino.Logger<never>;
412
+ declare const logger: createPinoLogger.default.Logger<never>;
414
413
  declare const addCustomHeaderPlugin: {
415
414
  onResponse({ response }: {
416
415
  response: any;
@@ -441,6 +440,9 @@ type CommonConfig = {
441
440
  schema: ReturnType<typeof buildSchema>;
442
441
  plugins: Parameters<typeof createYoga>[0]["plugins"];
443
442
  context: (ctx: YogaInitialContext) => Promise<Partial<GraphQLContext>>;
443
+ maskedErrors: {
444
+ maskError: (error: any, message: string, isDev?: boolean) => any;
445
+ };
444
446
  };
445
447
  declare function getCommonConfig(options: CreateCopilotRuntimeServerOptions): CommonConfig;
446
448
 
@@ -40,9 +40,25 @@ declare class UnknownErrorResponse extends FailedResponseStatus {
40
40
  reason: FailedResponseStatusReason;
41
41
  details: {
42
42
  description?: string;
43
+ originalError?: {
44
+ code?: string;
45
+ statusCode?: number;
46
+ severity?: string;
47
+ visibility?: string;
48
+ originalErrorType?: string;
49
+ extensions?: any;
50
+ };
43
51
  };
44
- constructor({ description }: {
52
+ constructor({ description, originalError, }: {
45
53
  description?: string;
54
+ originalError?: {
55
+ code?: string;
56
+ statusCode?: number;
57
+ severity?: string;
58
+ visibility?: string;
59
+ originalErrorType?: string;
60
+ extensions?: any;
61
+ };
46
62
  });
47
63
  }
48
64
 
@@ -157,10 +157,11 @@ var MessageStreamInterruptedResponse = class extends FailedResponseStatus {
157
157
  __name(MessageStreamInterruptedResponse, "MessageStreamInterruptedResponse");
158
158
  var UnknownErrorResponse = class extends FailedResponseStatus {
159
159
  reason = FailedResponseStatusReason.UNKNOWN_ERROR;
160
- constructor({ description }) {
160
+ constructor({ description, originalError }) {
161
161
  super();
162
162
  this.details = {
163
- description
163
+ description,
164
+ originalError
164
165
  };
165
166
  }
166
167
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts","../../src/graphql/types/response-status.type.ts","../../src/utils/failed-response-status-reasons.ts"],"sourcesContent":["export * from \"./failed-response-status-reasons\";\n","import { GraphQLJSON } from \"graphql-scalars\";\nimport { Field, InterfaceType, ObjectType, createUnionType, registerEnumType } from \"type-graphql\";\n\nexport enum ResponseStatusCode {\n Pending = \"pending\",\n Success = \"success\",\n Failed = \"failed\",\n}\n\nregisterEnumType(ResponseStatusCode, {\n name: \"ResponseStatusCode\",\n});\n\n@InterfaceType({\n resolveType(value) {\n if (value.code === ResponseStatusCode.Success) {\n return SuccessResponseStatus;\n } else if (value.code === ResponseStatusCode.Failed) {\n return FailedResponseStatus;\n } else if (value.code === ResponseStatusCode.Pending) {\n return PendingResponseStatus;\n }\n return undefined;\n },\n})\n@ObjectType()\nabstract class BaseResponseStatus {\n @Field(() => ResponseStatusCode)\n code: ResponseStatusCode;\n}\n\n@ObjectType({ implements: BaseResponseStatus })\nexport class PendingResponseStatus extends BaseResponseStatus {\n code: ResponseStatusCode = ResponseStatusCode.Pending;\n}\n\n@ObjectType({ implements: BaseResponseStatus })\nexport class SuccessResponseStatus extends BaseResponseStatus {\n code: ResponseStatusCode = ResponseStatusCode.Success;\n}\n\nexport enum FailedResponseStatusReason {\n GUARDRAILS_VALIDATION_FAILED = \"GUARDRAILS_VALIDATION_FAILED\",\n MESSAGE_STREAM_INTERRUPTED = \"MESSAGE_STREAM_INTERRUPTED\",\n UNKNOWN_ERROR = \"UNKNOWN_ERROR\",\n}\n\nregisterEnumType(FailedResponseStatusReason, {\n name: \"FailedResponseStatusReason\",\n});\n\n@ObjectType({ implements: BaseResponseStatus })\nexport class FailedResponseStatus extends BaseResponseStatus {\n code: ResponseStatusCode = ResponseStatusCode.Failed;\n\n @Field(() => FailedResponseStatusReason)\n reason: FailedResponseStatusReason;\n\n @Field(() => GraphQLJSON, { nullable: true })\n details?: Record<string, any> = null;\n}\n\nexport const ResponseStatusUnion = createUnionType({\n name: \"ResponseStatus\",\n types: () => [PendingResponseStatus, SuccessResponseStatus, FailedResponseStatus] as const,\n});\n","import {\n FailedResponseStatus,\n FailedResponseStatusReason,\n} from \"../graphql/types/response-status.type\";\n\nexport class GuardrailsValidationFailureResponse extends FailedResponseStatus {\n reason = FailedResponseStatusReason.GUARDRAILS_VALIDATION_FAILED;\n declare details: {\n guardrailsReason: string;\n };\n\n constructor({ guardrailsReason }) {\n super();\n this.details = {\n guardrailsReason,\n };\n }\n}\n\nexport class MessageStreamInterruptedResponse extends FailedResponseStatus {\n reason = FailedResponseStatusReason.MESSAGE_STREAM_INTERRUPTED;\n declare details: {\n messageId: string;\n description: string;\n };\n\n constructor({ messageId }: { messageId: string }) {\n super();\n this.details = {\n messageId,\n description: \"Check the message for mode details\",\n };\n }\n}\n\nexport class UnknownErrorResponse extends FailedResponseStatus {\n reason = FailedResponseStatusReason.UNKNOWN_ERROR;\n declare details: {\n description?: string;\n };\n\n constructor({ description }: { description?: string }) {\n super();\n this.details = {\n description,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;ACAA,6BAA4B;AAC5B,0BAAoF;;;;;;;;;;;;;;;;;;UAExEA,qBAAAA;;;;GAAAA,uBAAAA,qBAAAA,CAAAA,EAAAA;IAMZC,sCAAiBD,oBAAoB;EACnCE,MAAM;AACR,CAAA;AAeA,IAAeC,qBAAf,6BAAeA,oBAAAA;EAEbC;AACF,GAHA;;MACGC,2BAAM,MAAML,kBAAAA;;GADAG,mBAAAA,WAAAA,QAAAA,MAAAA;AAAAA,qBAAAA,aAAAA;MAbdG,mCAAc;IACbC,YAAYC,OAAK;AACf,UAAIA,MAAMJ,SAAI,WAAiC;AAC7C,eAAOK;MACT,WAAWD,MAAMJ,SAAI,UAAgC;AACnD,eAAOM;MACT,WAAWF,MAAMJ,SAAI,WAAiC;AACpD,eAAOO;MACT;AACA,aAAOC;IACT;EACF,CAAA;MACCC,gCAAAA;GACcV,kBAAAA;AAMR,IAAMQ,wBAAN,cAAoCR,mBAAAA;EACzCC,OAAAA;AACF;AAFaO;AAAAA,wBAAAA,aAAAA;MADZE,gCAAW;IAAEC,YAAYX;EAAmB,CAAA;GAChCQ,qBAAAA;AAKN,IAAMF,wBAAN,cAAoCN,mBAAAA;EACzCC,OAAAA;AACF;AAFaK;AAAAA,wBAAAA,aAAAA;MADZI,gCAAW;IAAEC,YAAYX;EAAmB,CAAA;GAChCM,qBAAAA;;UAIDM,6BAAAA;;;;GAAAA,+BAAAA,6BAAAA,CAAAA,EAAAA;IAMZd,sCAAiBc,4BAA4B;EAC3Cb,MAAM;AACR,CAAA;AAGO,IAAMQ,uBAAN,cAAmCP,mBAAAA;EACxCC,OAAAA;EAGAY;EAGAC,UAAgC;AAClC;AARaP;;MAGVL,2BAAM,MAAMU,0BAAAA;;GAHFL,qBAAAA,WAAAA,UAAAA,MAAAA;;MAMVL,2BAAM,MAAMa,oCAAa;IAAEC,UAAU;EAAK,CAAA;qCACjC,WAAA,cAAA,SAAA,MAAA;GAPCT,qBAAAA,WAAAA,WAAAA,MAAAA;AAAAA,uBAAAA,aAAAA;MADZG,gCAAW;IAAEC,YAAYX;EAAmB,CAAA;GAChCO,oBAAAA;AAUN,IAAMU,0BAAsBC,qCAAgB;EACjDnB,MAAM;EACNoB,OAAO,MAAM;IAACX;IAAuBF;IAAuBC;;AAC9D,CAAA;;;AC5DO,IAAMa,sCAAN,cAAkDC,qBAAAA;EACvDC,SAASC,2BAA2BC;EAKpCC,YAAY,EAAEC,iBAAgB,GAAI;AAChC,UAAK;AACL,SAAKC,UAAU;MACbD;IACF;EACF;AACF;AAZaN;AAcN,IAAMQ,mCAAN,cAA+CP,qBAAAA;EACpDC,SAASC,2BAA2BM;EAMpCJ,YAAY,EAAEK,UAAS,GAA2B;AAChD,UAAK;AACL,SAAKH,UAAU;MACbG;MACAC,aAAa;IACf;EACF;AACF;AAdaH;AAgBN,IAAMI,uBAAN,cAAmCX,qBAAAA;EACxCC,SAASC,2BAA2BU;EAKpCR,YAAY,EAAEM,YAAW,GAA8B;AACrD,UAAK;AACL,SAAKJ,UAAU;MACbI;IACF;EACF;AACF;AAZaC;","names":["ResponseStatusCode","registerEnumType","name","BaseResponseStatus","code","Field","InterfaceType","resolveType","value","SuccessResponseStatus","FailedResponseStatus","PendingResponseStatus","undefined","ObjectType","implements","FailedResponseStatusReason","reason","details","GraphQLJSON","nullable","ResponseStatusUnion","createUnionType","types","GuardrailsValidationFailureResponse","FailedResponseStatus","reason","FailedResponseStatusReason","GUARDRAILS_VALIDATION_FAILED","constructor","guardrailsReason","details","MessageStreamInterruptedResponse","MESSAGE_STREAM_INTERRUPTED","messageId","description","UnknownErrorResponse","UNKNOWN_ERROR"]}
1
+ {"version":3,"sources":["../../src/utils/index.ts","../../src/graphql/types/response-status.type.ts","../../src/utils/failed-response-status-reasons.ts"],"sourcesContent":["export * from \"./failed-response-status-reasons\";\n","import { GraphQLJSON } from \"graphql-scalars\";\nimport { Field, InterfaceType, ObjectType, createUnionType, registerEnumType } from \"type-graphql\";\n\nexport enum ResponseStatusCode {\n Pending = \"pending\",\n Success = \"success\",\n Failed = \"failed\",\n}\n\nregisterEnumType(ResponseStatusCode, {\n name: \"ResponseStatusCode\",\n});\n\n@InterfaceType({\n resolveType(value) {\n if (value.code === ResponseStatusCode.Success) {\n return SuccessResponseStatus;\n } else if (value.code === ResponseStatusCode.Failed) {\n return FailedResponseStatus;\n } else if (value.code === ResponseStatusCode.Pending) {\n return PendingResponseStatus;\n }\n return undefined;\n },\n})\n@ObjectType()\nabstract class BaseResponseStatus {\n @Field(() => ResponseStatusCode)\n code: ResponseStatusCode;\n}\n\n@ObjectType({ implements: BaseResponseStatus })\nexport class PendingResponseStatus extends BaseResponseStatus {\n code: ResponseStatusCode = ResponseStatusCode.Pending;\n}\n\n@ObjectType({ implements: BaseResponseStatus })\nexport class SuccessResponseStatus extends BaseResponseStatus {\n code: ResponseStatusCode = ResponseStatusCode.Success;\n}\n\nexport enum FailedResponseStatusReason {\n GUARDRAILS_VALIDATION_FAILED = \"GUARDRAILS_VALIDATION_FAILED\",\n MESSAGE_STREAM_INTERRUPTED = \"MESSAGE_STREAM_INTERRUPTED\",\n UNKNOWN_ERROR = \"UNKNOWN_ERROR\",\n}\n\nregisterEnumType(FailedResponseStatusReason, {\n name: \"FailedResponseStatusReason\",\n});\n\n@ObjectType({ implements: BaseResponseStatus })\nexport class FailedResponseStatus extends BaseResponseStatus {\n code: ResponseStatusCode = ResponseStatusCode.Failed;\n\n @Field(() => FailedResponseStatusReason)\n reason: FailedResponseStatusReason;\n\n @Field(() => GraphQLJSON, { nullable: true })\n details?: Record<string, any> = null;\n}\n\nexport const ResponseStatusUnion = createUnionType({\n name: \"ResponseStatus\",\n types: () => [PendingResponseStatus, SuccessResponseStatus, FailedResponseStatus] as const,\n});\n","import {\n FailedResponseStatus,\n FailedResponseStatusReason,\n} from \"../graphql/types/response-status.type\";\n\nexport class GuardrailsValidationFailureResponse extends FailedResponseStatus {\n reason = FailedResponseStatusReason.GUARDRAILS_VALIDATION_FAILED;\n declare details: {\n guardrailsReason: string;\n };\n\n constructor({ guardrailsReason }) {\n super();\n this.details = {\n guardrailsReason,\n };\n }\n}\n\nexport class MessageStreamInterruptedResponse extends FailedResponseStatus {\n reason = FailedResponseStatusReason.MESSAGE_STREAM_INTERRUPTED;\n declare details: {\n messageId: string;\n description: string;\n };\n\n constructor({ messageId }: { messageId: string }) {\n super();\n this.details = {\n messageId,\n description: \"Check the message for mode details\",\n };\n }\n}\n\nexport class UnknownErrorResponse extends FailedResponseStatus {\n reason = FailedResponseStatusReason.UNKNOWN_ERROR;\n declare details: {\n description?: string;\n originalError?: {\n code?: string;\n statusCode?: number;\n severity?: string;\n visibility?: string;\n originalErrorType?: string;\n extensions?: any;\n };\n };\n\n constructor({\n description,\n originalError,\n }: {\n description?: string;\n originalError?: {\n code?: string;\n statusCode?: number;\n severity?: string;\n visibility?: string;\n originalErrorType?: string;\n extensions?: any;\n };\n }) {\n super();\n this.details = {\n description,\n originalError,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;ACAA,6BAA4B;AAC5B,0BAAoF;;;;;;;;;;;;;;;;;;UAExEA,qBAAAA;;;;GAAAA,uBAAAA,qBAAAA,CAAAA,EAAAA;IAMZC,sCAAiBD,oBAAoB;EACnCE,MAAM;AACR,CAAA;AAeA,IAAeC,qBAAf,6BAAeA,oBAAAA;EAEbC;AACF,GAHA;;MACGC,2BAAM,MAAML,kBAAAA;;GADAG,mBAAAA,WAAAA,QAAAA,MAAAA;AAAAA,qBAAAA,aAAAA;MAbdG,mCAAc;IACbC,YAAYC,OAAK;AACf,UAAIA,MAAMJ,SAAI,WAAiC;AAC7C,eAAOK;MACT,WAAWD,MAAMJ,SAAI,UAAgC;AACnD,eAAOM;MACT,WAAWF,MAAMJ,SAAI,WAAiC;AACpD,eAAOO;MACT;AACA,aAAOC;IACT;EACF,CAAA;MACCC,gCAAAA;GACcV,kBAAAA;AAMR,IAAMQ,wBAAN,cAAoCR,mBAAAA;EACzCC,OAAAA;AACF;AAFaO;AAAAA,wBAAAA,aAAAA;MADZE,gCAAW;IAAEC,YAAYX;EAAmB,CAAA;GAChCQ,qBAAAA;AAKN,IAAMF,wBAAN,cAAoCN,mBAAAA;EACzCC,OAAAA;AACF;AAFaK;AAAAA,wBAAAA,aAAAA;MADZI,gCAAW;IAAEC,YAAYX;EAAmB,CAAA;GAChCM,qBAAAA;;UAIDM,6BAAAA;;;;GAAAA,+BAAAA,6BAAAA,CAAAA,EAAAA;IAMZd,sCAAiBc,4BAA4B;EAC3Cb,MAAM;AACR,CAAA;AAGO,IAAMQ,uBAAN,cAAmCP,mBAAAA;EACxCC,OAAAA;EAGAY;EAGAC,UAAgC;AAClC;AARaP;;MAGVL,2BAAM,MAAMU,0BAAAA;;GAHFL,qBAAAA,WAAAA,UAAAA,MAAAA;;MAMVL,2BAAM,MAAMa,oCAAa;IAAEC,UAAU;EAAK,CAAA;qCACjC,WAAA,cAAA,SAAA,MAAA;GAPCT,qBAAAA,WAAAA,WAAAA,MAAAA;AAAAA,uBAAAA,aAAAA;MADZG,gCAAW;IAAEC,YAAYX;EAAmB,CAAA;GAChCO,oBAAAA;AAUN,IAAMU,0BAAsBC,qCAAgB;EACjDnB,MAAM;EACNoB,OAAO,MAAM;IAACX;IAAuBF;IAAuBC;;AAC9D,CAAA;;;AC5DO,IAAMa,sCAAN,cAAkDC,qBAAAA;EACvDC,SAASC,2BAA2BC;EAKpCC,YAAY,EAAEC,iBAAgB,GAAI;AAChC,UAAK;AACL,SAAKC,UAAU;MACbD;IACF;EACF;AACF;AAZaN;AAcN,IAAMQ,mCAAN,cAA+CP,qBAAAA;EACpDC,SAASC,2BAA2BM;EAMpCJ,YAAY,EAAEK,UAAS,GAA2B;AAChD,UAAK;AACL,SAAKH,UAAU;MACbG;MACAC,aAAa;IACf;EACF;AACF;AAdaH;AAgBN,IAAMI,uBAAN,cAAmCX,qBAAAA;EACxCC,SAASC,2BAA2BU;EAapCR,YAAY,EACVM,aACAG,cAAa,GAWZ;AACD,UAAK;AACL,SAAKP,UAAU;MACbI;MACAG;IACF;EACF;AACF;AAlCaF;","names":["ResponseStatusCode","registerEnumType","name","BaseResponseStatus","code","Field","InterfaceType","resolveType","value","SuccessResponseStatus","FailedResponseStatus","PendingResponseStatus","undefined","ObjectType","implements","FailedResponseStatusReason","reason","details","GraphQLJSON","nullable","ResponseStatusUnion","createUnionType","types","GuardrailsValidationFailureResponse","FailedResponseStatus","reason","FailedResponseStatusReason","GUARDRAILS_VALIDATION_FAILED","constructor","guardrailsReason","details","MessageStreamInterruptedResponse","MESSAGE_STREAM_INTERRUPTED","messageId","description","UnknownErrorResponse","UNKNOWN_ERROR","originalError"]}
@@ -2,7 +2,7 @@ import {
2
2
  GuardrailsValidationFailureResponse,
3
3
  MessageStreamInterruptedResponse,
4
4
  UnknownErrorResponse
5
- } from "../chunk-5BIEM2UU.mjs";
5
+ } from "../chunk-XWBDEXDA.mjs";
6
6
  import "../chunk-FHD4JECV.mjs";
7
7
  export {
8
8
  GuardrailsValidationFailureResponse,
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.9.2-next.8",
12
+ "version": "1.9.2",
13
13
  "sideEffects": false,
14
14
  "main": "./dist/index.js",
15
15
  "module": "./dist/index.mjs",
@@ -37,11 +37,11 @@
37
37
  "tsconfig": "1.4.6"
38
38
  },
39
39
  "dependencies": {
40
- "@ag-ui/client": "0.0.28",
41
- "@ag-ui/core": "0.0.28",
42
- "@ag-ui/encoder": "0.0.28",
43
- "@ag-ui/langgraph": "0.0.4",
44
- "@ag-ui/proto": "0.0.28",
40
+ "@ag-ui/client": "0.0.34",
41
+ "@ag-ui/core": "0.0.34",
42
+ "@ag-ui/encoder": "0.0.34",
43
+ "@ag-ui/langgraph": "0.0.6",
44
+ "@ag-ui/proto": "0.0.34",
45
45
  "@anthropic-ai/sdk": "^0.27.3",
46
46
  "@graphql-yoga/plugin-defer-stream": "^3.3.1",
47
47
  "@langchain/aws": "^0.1.9",
@@ -66,13 +66,13 @@
66
66
  "rxjs": "7.8.1",
67
67
  "type-graphql": "2.0.0-rc.1",
68
68
  "zod": "^3.23.3",
69
- "@copilotkit/shared": "1.9.2-next.8"
69
+ "@copilotkit/shared": "1.9.2"
70
70
  },
71
71
  "peerDependencies": {
72
- "@ag-ui/client": ">=0.0.28",
73
- "@ag-ui/core": ">=0.0.28",
74
- "@ag-ui/encoder": ">=0.0.28",
75
- "@ag-ui/proto": ">=0.0.28"
72
+ "@ag-ui/client": ">=0.0.34",
73
+ "@ag-ui/core": ">=0.0.34",
74
+ "@ag-ui/encoder": ">=0.0.34",
75
+ "@ag-ui/proto": ">=0.0.34"
76
76
  },
77
77
  "keywords": [
78
78
  "copilotkit",
@@ -1,11 +1,12 @@
1
+ import { CopilotKitLowLevelError, isStructuredCopilotKitError } from "@copilotkit/shared";
1
2
  import { catchError, mergeMap, ReplaySubject, scan } from "rxjs";
2
- import { CustomEventNames, LangGraphEvent, LangGraphEventTypes } from "./events";
3
+ import { generateHelpfulErrorMessage } from "../../lib/streaming";
3
4
  import {
4
5
  RuntimeEvent,
5
6
  RuntimeEventTypes,
6
7
  RuntimeMetaEventName,
7
8
  } from "../../service-adapters/events";
8
- import { randomId, CopilotKitError } from "@copilotkit/shared";
9
+ import { CustomEventNames, LangGraphEvent, LangGraphEventTypes } from "./events";
9
10
 
10
11
  interface LangGraphEventWithState {
11
12
  event: LangGraphEvent | null;
@@ -155,6 +156,31 @@ export class RemoteLangGraphEventSource {
155
156
  });
156
157
  }
157
158
 
159
+ // Handle CopilotKit error events with preserved semantic information
160
+ if (acc.event.event === LangGraphEventTypes.OnCopilotKitError) {
161
+ const errorData = acc.event.data.error;
162
+
163
+ // Create a structured error with the original semantic information
164
+ const preservedError = new CopilotKitLowLevelError({
165
+ error: new Error(errorData.message),
166
+ url: "langgraph agent",
167
+ message: `${errorData.type}: ${errorData.message}`,
168
+ });
169
+
170
+ // Add additional error context to the error object
171
+ if (errorData.status_code) {
172
+ (preservedError as any).statusCode = errorData.status_code;
173
+ }
174
+ if (errorData.response_data) {
175
+ (preservedError as any).responseData = errorData.response_data;
176
+ }
177
+ (preservedError as any).agentName = errorData.agent_name;
178
+ (preservedError as any).originalErrorType = errorData.type;
179
+
180
+ // Throw the structured error to be handled by the catchError operator
181
+ throw preservedError;
182
+ }
183
+
158
184
  const responseMetadata = this.getResponseMetadata(acc.event);
159
185
 
160
186
  // Tool call ended: emit ActionExecutionEnd
@@ -283,48 +309,20 @@ export class RemoteLangGraphEventSource {
283
309
  return events;
284
310
  }),
285
311
  catchError((error) => {
286
- console.error(error);
287
-
288
312
  // If it's a structured CopilotKitError, re-throw it to be handled by the frontend error system
289
- if (
290
- error instanceof CopilotKitError ||
291
- (error?.name && error.name.includes("CopilotKit"))
292
- ) {
313
+ if (isStructuredCopilotKitError(error)) {
293
314
  throw error;
294
315
  }
295
316
 
296
- const events: RuntimeEvent[] = [];
297
-
298
- if (lastEventWithState?.lastMessageId && !lastEventWithState.isToolCall) {
299
- events.push({
300
- type: RuntimeEventTypes.TextMessageEnd,
301
- messageId: lastEventWithState.lastMessageId,
302
- });
303
- }
304
- if (lastEventWithState?.lastToolCallId) {
305
- events.push({
306
- type: RuntimeEventTypes.ActionExecutionEnd,
307
- actionExecutionId: lastEventWithState.lastToolCallId,
308
- });
309
- }
310
-
311
- const messageId = randomId();
317
+ // Determine a more helpful error message based on context
318
+ let helpfulMessage = generateHelpfulErrorMessage(error, "LangGraph agent connection");
312
319
 
313
- events.push({
314
- type: RuntimeEventTypes.TextMessageStart,
315
- messageId: messageId,
316
- });
317
- events.push({
318
- type: RuntimeEventTypes.TextMessageContent,
319
- messageId: messageId,
320
- content: "❌ An error occurred. Please try again.",
320
+ // For all other errors, preserve the raw error information in a structured format
321
+ throw new CopilotKitLowLevelError({
322
+ error: error instanceof Error ? error : new Error(String(error)),
323
+ url: "langgraph event stream",
324
+ message: helpfulMessage,
321
325
  });
322
- events.push({
323
- type: RuntimeEventTypes.TextMessageEnd,
324
- messageId: messageId,
325
- });
326
-
327
- return events;
328
326
  }),
329
327
  );
330
328
  }
@@ -15,6 +15,7 @@ export enum LangGraphEventTypes {
15
15
  OnCustomEvent = "on_custom_event",
16
16
  OnInterrupt = "on_interrupt",
17
17
  OnCopilotKitInterrupt = "on_copilotkit_interrupt",
18
+ OnCopilotKitError = "on_copilotkit_error",
18
19
  }
19
20
 
20
21
  export enum MetaEventNames {
@@ -344,6 +345,22 @@ interface CopilotKitLangGraphInterruptEvent {
344
345
  data: { value: string; messages: (TextMessage | ActionExecutionMessage | ResultMessage)[] };
345
346
  }
346
347
 
348
+ interface CopilotKitLangGraphErrorEvent {
349
+ event: LangGraphEventTypes.OnCopilotKitError;
350
+ data: {
351
+ error: {
352
+ message: string;
353
+ type: string;
354
+ agent_name: string;
355
+ status_code?: number;
356
+ response_data?: any;
357
+ };
358
+ thread_id: string;
359
+ agent_name: string;
360
+ node_name: string;
361
+ };
362
+ }
363
+
347
364
  export type LangGraphEvent =
348
365
  | LangGraphOnChainStartEvent
349
366
  | LangGraphOnChainStreamEvent
@@ -356,4 +373,5 @@ export type LangGraphEvent =
356
373
  | LangGraphOnCopilotKitStateSyncEvent
357
374
  | LangGraphOnCustomEvent
358
375
  | LangGraphInterruptEvent
359
- | CopilotKitLangGraphInterruptEvent;
376
+ | CopilotKitLangGraphInterruptEvent
377
+ | CopilotKitLangGraphErrorEvent;