@copilotkit/runtime 0.0.0-fix-debug-infosys-20251107151227 → 0.0.0-fix-restore-handle-method-node-http-20251222114321

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 (142) hide show
  1. package/CHANGELOG.md +259 -3
  2. package/dist/index.d.ts +1493 -28
  3. package/dist/index.js +2568 -5467
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +5429 -99
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/{lib/index.d.ts → langgraph.d.ts} +104 -32
  8. package/dist/langgraph.js +211 -0
  9. package/dist/langgraph.js.map +1 -0
  10. package/dist/{chunk-XPALJ76U.mjs → langgraph.mjs} +57 -26
  11. package/dist/langgraph.mjs.map +1 -0
  12. package/dist/v2/index.d.ts +2 -0
  13. package/dist/v2/index.js +22 -0
  14. package/dist/v2/index.js.map +1 -0
  15. package/dist/v2/index.mjs +5 -0
  16. package/dist/v2/index.mjs.map +1 -0
  17. package/package.json +64 -20
  18. package/src/graphql/message-conversion/agui-to-gql.test.ts +1263 -0
  19. package/src/graphql/message-conversion/agui-to-gql.ts +333 -0
  20. package/src/graphql/message-conversion/gql-to-agui.test.ts +1580 -0
  21. package/src/graphql/message-conversion/gql-to-agui.ts +278 -0
  22. package/src/graphql/message-conversion/index.ts +2 -0
  23. package/src/graphql/message-conversion/roundtrip-conversion.test.ts +526 -0
  24. package/src/graphql/resolvers/copilot.resolver.ts +3 -51
  25. package/src/graphql/resolvers/state.resolver.ts +3 -2
  26. package/src/graphql/types/converted/index.ts +32 -6
  27. package/src/graphql/types/enums.ts +2 -2
  28. package/src/graphql/types/message-status.type.ts +3 -1
  29. package/src/langgraph.ts +1 -0
  30. package/src/lib/index.ts +42 -1
  31. package/src/lib/integrations/nextjs/app-router.ts +12 -11
  32. package/src/lib/integrations/nextjs/pages-router.ts +4 -11
  33. package/src/lib/integrations/node-http/index.ts +10 -5
  34. package/src/lib/integrations/shared.ts +1 -1
  35. package/src/lib/observability.ts +87 -0
  36. package/src/lib/runtime/{langgraph/langgraph-agent.ts → agent-integrations/langgraph/agent.ts} +10 -30
  37. package/src/lib/runtime/agent-integrations/langgraph/consts.ts +34 -0
  38. package/src/lib/runtime/agent-integrations/langgraph/index.ts +2 -0
  39. package/src/lib/runtime/copilot-runtime.ts +387 -1360
  40. package/src/lib/runtime/telemetry-agent-runner.ts +139 -0
  41. package/src/lib/runtime/types.ts +49 -0
  42. package/src/lib/runtime/utils.ts +87 -0
  43. package/src/lib/telemetry-client.ts +6 -5
  44. package/src/service-adapters/anthropic/anthropic-adapter.ts +21 -4
  45. package/src/service-adapters/bedrock/bedrock-adapter.ts +10 -2
  46. package/src/service-adapters/empty/empty-adapter.ts +3 -0
  47. package/src/service-adapters/events.ts +0 -254
  48. package/src/service-adapters/experimental/ollama/ollama-adapter.ts +7 -2
  49. package/src/service-adapters/google/google-genai-adapter.ts +33 -7
  50. package/src/service-adapters/groq/groq-adapter.ts +21 -4
  51. package/src/service-adapters/langchain/langchain-adapter.ts +8 -3
  52. package/src/service-adapters/langchain/langserve.ts +2 -1
  53. package/src/service-adapters/openai/openai-adapter.ts +22 -4
  54. package/src/service-adapters/openai/openai-assistant-adapter.ts +30 -11
  55. package/src/service-adapters/service-adapter.ts +3 -0
  56. package/src/service-adapters/unify/unify-adapter.ts +9 -2
  57. package/src/v2/index.ts +3 -0
  58. package/tsup.config.ts +6 -2
  59. package/dist/chunk-27JKTS6P.mjs +0 -1704
  60. package/dist/chunk-27JKTS6P.mjs.map +0 -1
  61. package/dist/chunk-2DHC2YFK.mjs +0 -6026
  62. package/dist/chunk-2DHC2YFK.mjs.map +0 -1
  63. package/dist/chunk-2OZAGFV3.mjs +0 -43
  64. package/dist/chunk-2OZAGFV3.mjs.map +0 -1
  65. package/dist/chunk-5HHH4SZ3.mjs +0 -25
  66. package/dist/chunk-5HHH4SZ3.mjs.map +0 -1
  67. package/dist/chunk-AMUJQ6IR.mjs +0 -50
  68. package/dist/chunk-AMUJQ6IR.mjs.map +0 -1
  69. package/dist/chunk-FHD4JECV.mjs +0 -33
  70. package/dist/chunk-FHD4JECV.mjs.map +0 -1
  71. package/dist/chunk-FVG3IQG7.mjs +0 -25
  72. package/dist/chunk-FVG3IQG7.mjs.map +0 -1
  73. package/dist/chunk-QU2FLIQB.mjs +0 -80
  74. package/dist/chunk-QU2FLIQB.mjs.map +0 -1
  75. package/dist/chunk-SHBDMA63.mjs +0 -141
  76. package/dist/chunk-SHBDMA63.mjs.map +0 -1
  77. package/dist/chunk-XPALJ76U.mjs.map +0 -1
  78. package/dist/chunk-XWBDEXDA.mjs +0 -153
  79. package/dist/chunk-XWBDEXDA.mjs.map +0 -1
  80. package/dist/graphql/types/base/index.d.ts +0 -6
  81. package/dist/graphql/types/base/index.js +0 -63
  82. package/dist/graphql/types/base/index.js.map +0 -1
  83. package/dist/graphql/types/base/index.mjs +0 -8
  84. package/dist/graphql/types/base/index.mjs.map +0 -1
  85. package/dist/graphql/types/converted/index.d.ts +0 -2
  86. package/dist/graphql/types/converted/index.js +0 -200
  87. package/dist/graphql/types/converted/index.js.map +0 -1
  88. package/dist/graphql/types/converted/index.mjs +0 -19
  89. package/dist/graphql/types/converted/index.mjs.map +0 -1
  90. package/dist/groq-adapter-c8aec5c5.d.ts +0 -321
  91. package/dist/index-96b330da.d.ts +0 -119
  92. package/dist/langserve-0c6100e3.d.ts +0 -257
  93. package/dist/lib/cloud/index.d.ts +0 -6
  94. package/dist/lib/cloud/index.js +0 -18
  95. package/dist/lib/cloud/index.js.map +0 -1
  96. package/dist/lib/cloud/index.mjs +0 -1
  97. package/dist/lib/cloud/index.mjs.map +0 -1
  98. package/dist/lib/index.js +0 -7849
  99. package/dist/lib/index.js.map +0 -1
  100. package/dist/lib/index.mjs +0 -76
  101. package/dist/lib/index.mjs.map +0 -1
  102. package/dist/lib/integrations/index.d.ts +0 -34
  103. package/dist/lib/integrations/index.js +0 -3055
  104. package/dist/lib/integrations/index.js.map +0 -1
  105. package/dist/lib/integrations/index.mjs +0 -37
  106. package/dist/lib/integrations/index.mjs.map +0 -1
  107. package/dist/lib/integrations/nest/index.d.ts +0 -15
  108. package/dist/lib/integrations/nest/index.js +0 -2962
  109. package/dist/lib/integrations/nest/index.js.map +0 -1
  110. package/dist/lib/integrations/nest/index.mjs +0 -14
  111. package/dist/lib/integrations/nest/index.mjs.map +0 -1
  112. package/dist/lib/integrations/node-express/index.d.ts +0 -15
  113. package/dist/lib/integrations/node-express/index.js +0 -2962
  114. package/dist/lib/integrations/node-express/index.js.map +0 -1
  115. package/dist/lib/integrations/node-express/index.mjs +0 -14
  116. package/dist/lib/integrations/node-express/index.mjs.map +0 -1
  117. package/dist/lib/integrations/node-http/index.d.ts +0 -15
  118. package/dist/lib/integrations/node-http/index.js +0 -2948
  119. package/dist/lib/integrations/node-http/index.js.map +0 -1
  120. package/dist/lib/integrations/node-http/index.mjs +0 -13
  121. package/dist/lib/integrations/node-http/index.mjs.map +0 -1
  122. package/dist/service-adapters/index.d.ts +0 -162
  123. package/dist/service-adapters/index.js +0 -1787
  124. package/dist/service-adapters/index.js.map +0 -1
  125. package/dist/service-adapters/index.mjs +0 -34
  126. package/dist/service-adapters/index.mjs.map +0 -1
  127. package/dist/service-adapters/shared/index.d.ts +0 -9
  128. package/dist/service-adapters/shared/index.js +0 -72
  129. package/dist/service-adapters/shared/index.js.map +0 -1
  130. package/dist/service-adapters/shared/index.mjs +0 -8
  131. package/dist/service-adapters/shared/index.mjs.map +0 -1
  132. package/dist/shared-0a7346ce.d.ts +0 -466
  133. package/dist/utils/index.d.ts +0 -65
  134. package/dist/utils/index.js +0 -175
  135. package/dist/utils/index.js.map +0 -1
  136. package/dist/utils/index.mjs +0 -12
  137. package/dist/utils/index.mjs.map +0 -1
  138. package/src/lib/runtime/__tests__/remote-action-constructors.test.ts +0 -246
  139. package/src/lib/runtime/agui-action.ts +0 -180
  140. package/src/lib/runtime/remote-action-constructors.ts +0 -331
  141. package/src/lib/runtime/remote-actions.ts +0 -217
  142. package/src/lib/runtime/remote-lg-action.ts +0 -1006
@@ -1,11 +1,11 @@
1
1
  import { registerEnumType } from "type-graphql";
2
2
 
3
3
  export enum MessageRole {
4
- user = "user",
5
4
  assistant = "assistant",
5
+ developer = "developer",
6
6
  system = "system",
7
7
  tool = "tool",
8
- developer = "developer",
8
+ user = "user",
9
9
  }
10
10
 
11
11
  export enum CopilotRequestType {
@@ -11,7 +11,7 @@ registerEnumType(MessageStatusCode, {
11
11
  });
12
12
 
13
13
  @ObjectType()
14
- class BaseMessageStatus {
14
+ export class BaseMessageStatus {
15
15
  @Field(() => MessageStatusCode)
16
16
  code: MessageStatusCode;
17
17
  }
@@ -38,3 +38,5 @@ export const MessageStatusUnion = createUnionType({
38
38
  name: "MessageStatus",
39
39
  types: () => [PendingMessageStatus, SuccessMessageStatus, FailedMessageStatus] as const,
40
40
  });
41
+
42
+ export type MessageStatus = typeof MessageStatusUnion;
@@ -0,0 +1 @@
1
+ export * from "./lib/runtime/agent-integrations/langgraph";
package/src/lib/index.ts CHANGED
@@ -8,4 +8,45 @@ export * from "./integrations";
8
8
  export * from "./logger";
9
9
  export * from "./runtime/copilot-runtime";
10
10
  export * from "./runtime/mcp-tools-utils";
11
- export * from "./runtime/langgraph/langgraph-agent";
11
+ export * from "./runtime/telemetry-agent-runner";
12
+
13
+ // The below re-exports "dummy" classes and types, to get a deprecation warning redirecting the users to import these from the correct, new route
14
+
15
+ /**
16
+ * @deprecated LangGraphAgent import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
17
+ */
18
+ export class LangGraphAgent {
19
+ constructor() {
20
+ throw new Error(
21
+ "LangGraphAgent import from @copilotkit/runtime is deprecated. Please import it from @copilotkit/runtime/langgraph instead",
22
+ );
23
+ }
24
+ }
25
+
26
+ /**
27
+ * @deprecated LangGraphHttpAgent import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
28
+ */
29
+ export class LangGraphHttpAgent {
30
+ constructor() {
31
+ throw new Error(
32
+ "LangGraphHttpAgent import from @copilotkit/runtime is deprecated. Please import it from @copilotkit/runtime/langgraph instead",
33
+ );
34
+ }
35
+ }
36
+
37
+ /**
38
+ * @deprecated TextMessageEvents import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
39
+ */
40
+ export type TextMessageEvents = any;
41
+ /**
42
+ * @deprecated ToolCallEvents import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
43
+ */
44
+ export type ToolCallEvents = any;
45
+ /**
46
+ * @deprecated CustomEventNames import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
47
+ */
48
+ export type CustomEventNames = any;
49
+ /**
50
+ * @deprecated PredictStateTool import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead
51
+ */
52
+ export type PredictStateTool = any;
@@ -1,6 +1,7 @@
1
- import { createYoga } from "graphql-yoga";
1
+ import { createCopilotEndpointSingleRoute } from "@copilotkitnext/runtime";
2
2
  import { CreateCopilotRuntimeServerOptions, getCommonConfig } from "../shared";
3
3
  import telemetry, { getRuntimeInstanceTelemetryInfo } from "../../telemetry-client";
4
+ import { handle } from "hono/vercel";
4
5
 
5
6
  export function copilotRuntimeNextJSAppRouterEndpoint(options: CreateCopilotRuntimeServerOptions) {
6
7
  const commonConfig = getCommonConfig(options);
@@ -22,16 +23,16 @@ export function copilotRuntimeNextJSAppRouterEndpoint(options: CreateCopilotRunt
22
23
  const logger = commonConfig.logging;
23
24
  logger.debug("Creating NextJS App Router endpoint");
24
25
 
25
- const yoga = createYoga({
26
- ...commonConfig,
27
- graphqlEndpoint: options.endpoint,
28
- fetchAPI: { Response: globalThis.Response },
26
+ const serviceAdapter = options.serviceAdapter;
27
+ if (serviceAdapter) {
28
+ options.runtime.handleServiceAdapter(serviceAdapter);
29
+ }
30
+
31
+ const copilotRoute = createCopilotEndpointSingleRoute({
32
+ runtime: options.runtime.instance,
33
+ basePath: options.baseUrl ?? options.endpoint,
29
34
  });
30
35
 
31
- return {
32
- handleRequest: yoga,
33
- GET: yoga as any,
34
- POST: yoga as any,
35
- OPTIONS: yoga as any,
36
- };
36
+ const handleRequest = handle(copilotRoute as any);
37
+ return { handleRequest };
37
38
  }
@@ -1,6 +1,6 @@
1
- import { YogaServerInstance, createYoga } from "graphql-yoga";
2
- import { CreateCopilotRuntimeServerOptions, GraphQLContext, getCommonConfig } from "../shared";
1
+ import { CreateCopilotRuntimeServerOptions, getCommonConfig } from "../shared";
3
2
  import telemetry, { getRuntimeInstanceTelemetryInfo } from "../../telemetry-client";
3
+ import { copilotRuntimeNodeHttpEndpoint } from "../node-http";
4
4
 
5
5
  export const config = {
6
6
  api: {
@@ -8,8 +8,6 @@ export const config = {
8
8
  },
9
9
  };
10
10
 
11
- export type CopilotRuntimeServerInstance<T> = YogaServerInstance<T, Partial<GraphQLContext>>;
12
-
13
11
  // This import is needed to fix the type error
14
12
  // Fix is currently in TypeScript 5.5 beta, waiting for stable version
15
13
  // https://github.com/microsoft/TypeScript/issues/42873#issuecomment-2066874644
@@ -17,7 +15,7 @@ export type {} from "@whatwg-node/server";
17
15
 
18
16
  export function copilotRuntimeNextJSPagesRouterEndpoint(
19
17
  options: CreateCopilotRuntimeServerOptions,
20
- ): CopilotRuntimeServerInstance<GraphQLContext> {
18
+ ) {
21
19
  const commonConfig = getCommonConfig(options);
22
20
 
23
21
  telemetry.setGlobalProperties({
@@ -37,10 +35,5 @@ export function copilotRuntimeNextJSPagesRouterEndpoint(
37
35
  const logger = commonConfig.logging;
38
36
  logger.debug("Creating NextJS Pages Router endpoint");
39
37
 
40
- const yoga = createYoga({
41
- ...commonConfig,
42
- graphqlEndpoint: options.endpoint,
43
- });
44
-
45
- return yoga;
38
+ return copilotRuntimeNodeHttpEndpoint(options);
46
39
  }
@@ -1,6 +1,6 @@
1
- import { createYoga } from "graphql-yoga";
2
1
  import { CreateCopilotRuntimeServerOptions, getCommonConfig } from "../shared";
3
2
  import telemetry, { getRuntimeInstanceTelemetryInfo } from "../../telemetry-client";
3
+ import { createCopilotEndpointSingleRoute } from "@copilotkitnext/runtime";
4
4
 
5
5
  export function copilotRuntimeNodeHttpEndpoint(options: CreateCopilotRuntimeServerOptions) {
6
6
  const commonConfig = getCommonConfig(options);
@@ -22,10 +22,15 @@ export function copilotRuntimeNodeHttpEndpoint(options: CreateCopilotRuntimeServ
22
22
  const logger = commonConfig.logging;
23
23
  logger.debug("Creating Node HTTP endpoint");
24
24
 
25
- const yoga = createYoga({
26
- ...commonConfig,
27
- graphqlEndpoint: options.endpoint,
25
+ const serviceAdapter = options.serviceAdapter;
26
+ if (serviceAdapter) {
27
+ options.runtime.handleServiceAdapter(serviceAdapter);
28
+ }
29
+
30
+ const honoApp = createCopilotEndpointSingleRoute({
31
+ runtime: options.runtime.instance,
32
+ basePath: options.baseUrl ?? options.endpoint,
28
33
  });
29
34
 
30
- return yoga;
35
+ return honoApp.fetch;
31
36
  }
@@ -35,7 +35,7 @@ export type GraphQLContext = YogaInitialContext & {
35
35
 
36
36
  export interface CreateCopilotRuntimeServerOptions {
37
37
  runtime: CopilotRuntime<any>;
38
- serviceAdapter: CopilotServiceAdapter;
38
+ serviceAdapter?: CopilotServiceAdapter;
39
39
  endpoint: string;
40
40
  baseUrl?: string;
41
41
  cloud?: CopilotCloudOptions;
@@ -1,3 +1,5 @@
1
+ import { RuntimeEventSource, RuntimeEventTypes } from "../service-adapters/events";
2
+
1
3
  export interface LLMRequestData {
2
4
  threadId?: string;
3
5
  runId?: string;
@@ -71,3 +73,88 @@ export interface CopilotObservabilityConfig {
71
73
  */
72
74
  hooks: CopilotObservabilityHooks;
73
75
  }
76
+
77
+ /**
78
+ * Setup progressive logging by wrapping the event stream
79
+ */
80
+ function setupProgressiveLogging(
81
+ eventSource: RuntimeEventSource,
82
+ streamedChunks: any[],
83
+ requestStartTime: number,
84
+ context: {
85
+ threadId?: string;
86
+ runId?: string;
87
+ model?: string;
88
+ provider?: string;
89
+ agentName?: string;
90
+ nodeName?: string;
91
+ },
92
+ publicApiKey?: string,
93
+ ): void {
94
+ if (this.observability?.enabled && this.observability.progressive && publicApiKey) {
95
+ // Keep reference to original stream function
96
+ const originalStream = eventSource.stream.bind(eventSource);
97
+
98
+ // Wrap the stream function to intercept events
99
+ eventSource.stream = async (callback) => {
100
+ await originalStream(async (eventStream$) => {
101
+ // Create subscription to capture streaming events
102
+ eventStream$.subscribe({
103
+ next: (event) => {
104
+ // Only log content chunks
105
+ if (event.type === RuntimeEventTypes.TextMessageContent) {
106
+ // Store the chunk
107
+ streamedChunks.push(event.content);
108
+
109
+ // Log each chunk separately for progressive mode
110
+ try {
111
+ const progressiveData: LLMResponseData = {
112
+ threadId: context.threadId || "",
113
+ runId: context.runId,
114
+ model: context.model,
115
+ output: event.content,
116
+ latency: Date.now() - requestStartTime,
117
+ timestamp: Date.now(),
118
+ provider: context.provider,
119
+ isProgressiveChunk: true,
120
+ agentName: context.agentName,
121
+ nodeName: context.nodeName,
122
+ };
123
+
124
+ // Use Promise to handle async logger without awaiting
125
+ Promise.resolve()
126
+ .then(() => {
127
+ this.observability.hooks.handleResponse(progressiveData);
128
+ })
129
+ .catch((error) => {
130
+ console.error("Error in progressive logging:", error);
131
+ });
132
+ } catch (error) {
133
+ console.error("Error preparing progressive log data:", error);
134
+ }
135
+ }
136
+ },
137
+ });
138
+
139
+ // Call the original callback with the event stream
140
+ await callback(eventStream$);
141
+ });
142
+ };
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Log error if observability is enabled
148
+ */
149
+ async function logObservabilityError(
150
+ errorData: LLMErrorData,
151
+ publicApiKey?: string,
152
+ ): Promise<void> {
153
+ if (this.observability?.enabled && publicApiKey) {
154
+ try {
155
+ await this.observability.hooks.handleError(errorData);
156
+ } catch (logError) {
157
+ console.error("Error logging LLM error:", logError);
158
+ }
159
+ }
160
+ }
@@ -1,16 +1,5 @@
1
- import {
2
- RunAgentInput,
3
- EventType,
4
- CustomEvent,
5
- TextMessageStartEvent,
6
- TextMessageContentEvent,
7
- TextMessageEndEvent,
8
- ToolCallStartEvent,
9
- ToolCallArgsEvent,
10
- ToolCallEndEvent,
11
- } from "@ag-ui/client";
12
1
  import { map } from "rxjs";
13
- import { LangGraphEventTypes } from "../../../agents/langgraph/events";
2
+ import { LangGraphEventTypes } from "../../../../agents/langgraph/events";
14
3
  import { RawEvent } from "@ag-ui/core";
15
4
  import {
16
5
  LangGraphAgent as AGUILangGraphAgent,
@@ -31,31 +20,22 @@ interface CopilotKitStateEnrichment {
31
20
  };
32
21
  }
33
22
 
34
- export interface PredictStateTool {
35
- tool: string;
36
- state_key: string;
37
- tool_argument: string;
38
- }
39
-
40
- export type TextMessageEvents =
41
- | TextMessageStartEvent
42
- | TextMessageContentEvent
43
- | TextMessageEndEvent;
44
-
45
- export type ToolCallEvents = ToolCallStartEvent | ToolCallArgsEvent | ToolCallEndEvent;
23
+ import { RunAgentInput, EventType, CustomEvent } from "@ag-ui/client";
46
24
 
47
- export enum CustomEventNames {
48
- CopilotKitManuallyEmitMessage = "copilotkit_manually_emit_message",
49
- CopilotKitManuallyEmitToolCall = "copilotkit_manually_emit_tool_call",
50
- CopilotKitManuallyEmitIntermediateState = "copilotkit_manually_emit_intermediate_state",
51
- CopilotKitExit = "copilotkit_exit",
52
- }
25
+ // Import and re-export from separate file to maintain API compatibility
26
+ import { CustomEventNames, TextMessageEvents, ToolCallEvents, PredictStateTool } from "./consts";
27
+ export { CustomEventNames };
53
28
 
54
29
  export class LangGraphAgent extends AGUILangGraphAgent {
55
30
  constructor(config: LangGraphAgentConfig) {
56
31
  super(config);
57
32
  }
58
33
 
34
+ // @ts-ignore
35
+ public clone() {
36
+ return new LangGraphAgent(this.config);
37
+ }
38
+
59
39
  dispatchEvent(event: ProcessedEvents) {
60
40
  if (event.type === EventType.CUSTOM) {
61
41
  // const event = processedEvent as unknown as CustomEvent;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Constants for LangGraph integration.
3
+ * This file is separate from langgraph.agent.ts to avoid pulling in @ag-ui/langgraph
4
+ * when only these constants are needed.
5
+ */
6
+
7
+ import {
8
+ TextMessageStartEvent,
9
+ TextMessageContentEvent,
10
+ TextMessageEndEvent,
11
+ ToolCallStartEvent,
12
+ ToolCallArgsEvent,
13
+ ToolCallEndEvent,
14
+ } from "@ag-ui/client";
15
+
16
+ export type TextMessageEvents =
17
+ | TextMessageStartEvent
18
+ | TextMessageContentEvent
19
+ | TextMessageEndEvent;
20
+
21
+ export type ToolCallEvents = ToolCallStartEvent | ToolCallArgsEvent | ToolCallEndEvent;
22
+
23
+ export enum CustomEventNames {
24
+ CopilotKitManuallyEmitMessage = "copilotkit_manually_emit_message",
25
+ CopilotKitManuallyEmitToolCall = "copilotkit_manually_emit_tool_call",
26
+ CopilotKitManuallyEmitIntermediateState = "copilotkit_manually_emit_intermediate_state",
27
+ CopilotKitExit = "copilotkit_exit",
28
+ }
29
+
30
+ export interface PredictStateTool {
31
+ tool: string;
32
+ state_key: string;
33
+ tool_argument: string;
34
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./consts";
2
+ export * from "./agent";