@copilotkit/runtime 1.10.7-next.0 → 1.50.0-beta.1

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 (134) hide show
  1. package/CHANGELOG.md +0 -6
  2. package/dist/index.d.ts +1655 -27
  3. package/dist/index.js +2172 -5049
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +5441 -99
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/v2/index.d.ts +1 -0
  8. package/dist/v2/index.js +15 -0
  9. package/dist/v2/index.js.map +1 -0
  10. package/dist/v2/index.mjs +4 -0
  11. package/dist/v2/index.mjs.map +1 -0
  12. package/package.json +17 -5
  13. package/src/graphql/message-conversion/agui-to-gql.test.ts +1263 -0
  14. package/src/graphql/message-conversion/agui-to-gql.ts +333 -0
  15. package/src/graphql/message-conversion/gql-to-agui.test.ts +1578 -0
  16. package/src/graphql/message-conversion/gql-to-agui.ts +278 -0
  17. package/src/graphql/message-conversion/index.ts +2 -0
  18. package/src/graphql/message-conversion/roundtrip-conversion.test.ts +526 -0
  19. package/src/graphql/resolvers/copilot.resolver.ts +3 -48
  20. package/src/graphql/resolvers/state.resolver.ts +3 -2
  21. package/src/graphql/types/converted/index.ts +32 -6
  22. package/src/graphql/types/enums.ts +2 -2
  23. package/src/graphql/types/message-status.type.ts +3 -1
  24. package/src/lib/index.ts +1 -1
  25. package/src/lib/integrations/nextjs/app-router.ts +10 -11
  26. package/src/lib/integrations/nextjs/pages-router.ts +4 -11
  27. package/src/lib/integrations/node-http/index.ts +64 -5
  28. package/src/lib/integrations/shared.ts +1 -1
  29. package/src/lib/observability.ts +87 -0
  30. package/src/lib/runtime/{langgraph/langgraph-agent.ts → agent-integrations/langgraph.agent.ts} +5 -0
  31. package/src/lib/runtime/copilot-runtime.ts +346 -1333
  32. package/src/lib/runtime/types.ts +49 -0
  33. package/src/lib/runtime/utils.ts +87 -0
  34. package/src/lib/telemetry-client.ts +6 -5
  35. package/src/service-adapters/anthropic/anthropic-adapter.ts +5 -1
  36. package/src/service-adapters/bedrock/bedrock-adapter.ts +6 -1
  37. package/src/service-adapters/empty/empty-adapter.ts +3 -0
  38. package/src/service-adapters/events.ts +0 -254
  39. package/src/service-adapters/experimental/ollama/ollama-adapter.ts +5 -1
  40. package/src/service-adapters/google/google-genai-adapter.ts +7 -1
  41. package/src/service-adapters/groq/groq-adapter.ts +5 -1
  42. package/src/service-adapters/langchain/langchain-adapter.ts +3 -0
  43. package/src/service-adapters/openai/openai-adapter.ts +5 -1
  44. package/src/service-adapters/openai/openai-assistant-adapter.ts +4 -0
  45. package/src/service-adapters/service-adapter.ts +3 -0
  46. package/src/service-adapters/unify/unify-adapter.ts +6 -1
  47. package/src/v2/index.ts +2 -0
  48. package/tsup.config.ts +2 -1
  49. package/dist/chunk-27JKTS6P.mjs +0 -1704
  50. package/dist/chunk-27JKTS6P.mjs.map +0 -1
  51. package/dist/chunk-2OZAGFV3.mjs +0 -43
  52. package/dist/chunk-2OZAGFV3.mjs.map +0 -1
  53. package/dist/chunk-5BW5IBTZ.mjs +0 -80
  54. package/dist/chunk-5BW5IBTZ.mjs.map +0 -1
  55. package/dist/chunk-AMUJQ6IR.mjs +0 -50
  56. package/dist/chunk-AMUJQ6IR.mjs.map +0 -1
  57. package/dist/chunk-BMIYSM5W.mjs +0 -25
  58. package/dist/chunk-BMIYSM5W.mjs.map +0 -1
  59. package/dist/chunk-FDTCG47E.mjs +0 -25
  60. package/dist/chunk-FDTCG47E.mjs.map +0 -1
  61. package/dist/chunk-FHD4JECV.mjs +0 -33
  62. package/dist/chunk-FHD4JECV.mjs.map +0 -1
  63. package/dist/chunk-LRCKLBMO.mjs +0 -6020
  64. package/dist/chunk-LRCKLBMO.mjs.map +0 -1
  65. package/dist/chunk-R7RMYEPZ.mjs +0 -175
  66. package/dist/chunk-R7RMYEPZ.mjs.map +0 -1
  67. package/dist/chunk-SHBDMA63.mjs +0 -141
  68. package/dist/chunk-SHBDMA63.mjs.map +0 -1
  69. package/dist/chunk-XWBDEXDA.mjs +0 -153
  70. package/dist/chunk-XWBDEXDA.mjs.map +0 -1
  71. package/dist/graphql/types/base/index.d.ts +0 -6
  72. package/dist/graphql/types/base/index.js +0 -63
  73. package/dist/graphql/types/base/index.js.map +0 -1
  74. package/dist/graphql/types/base/index.mjs +0 -8
  75. package/dist/graphql/types/base/index.mjs.map +0 -1
  76. package/dist/graphql/types/converted/index.d.ts +0 -2
  77. package/dist/graphql/types/converted/index.js +0 -200
  78. package/dist/graphql/types/converted/index.js.map +0 -1
  79. package/dist/graphql/types/converted/index.mjs +0 -19
  80. package/dist/graphql/types/converted/index.mjs.map +0 -1
  81. package/dist/groq-adapter-c8aec5c5.d.ts +0 -321
  82. package/dist/index-96b330da.d.ts +0 -119
  83. package/dist/langserve-0c6100e3.d.ts +0 -257
  84. package/dist/lib/cloud/index.d.ts +0 -6
  85. package/dist/lib/cloud/index.js +0 -18
  86. package/dist/lib/cloud/index.js.map +0 -1
  87. package/dist/lib/cloud/index.mjs +0 -1
  88. package/dist/lib/cloud/index.mjs.map +0 -1
  89. package/dist/lib/index.d.ts +0 -212
  90. package/dist/lib/index.js +0 -7843
  91. package/dist/lib/index.js.map +0 -1
  92. package/dist/lib/index.mjs +0 -76
  93. package/dist/lib/index.mjs.map +0 -1
  94. package/dist/lib/integrations/index.d.ts +0 -34
  95. package/dist/lib/integrations/index.js +0 -3052
  96. package/dist/lib/integrations/index.js.map +0 -1
  97. package/dist/lib/integrations/index.mjs +0 -37
  98. package/dist/lib/integrations/index.mjs.map +0 -1
  99. package/dist/lib/integrations/nest/index.d.ts +0 -15
  100. package/dist/lib/integrations/nest/index.js +0 -2959
  101. package/dist/lib/integrations/nest/index.js.map +0 -1
  102. package/dist/lib/integrations/nest/index.mjs +0 -14
  103. package/dist/lib/integrations/nest/index.mjs.map +0 -1
  104. package/dist/lib/integrations/node-express/index.d.ts +0 -15
  105. package/dist/lib/integrations/node-express/index.js +0 -2959
  106. package/dist/lib/integrations/node-express/index.js.map +0 -1
  107. package/dist/lib/integrations/node-express/index.mjs +0 -14
  108. package/dist/lib/integrations/node-express/index.mjs.map +0 -1
  109. package/dist/lib/integrations/node-http/index.d.ts +0 -15
  110. package/dist/lib/integrations/node-http/index.js +0 -2945
  111. package/dist/lib/integrations/node-http/index.js.map +0 -1
  112. package/dist/lib/integrations/node-http/index.mjs +0 -13
  113. package/dist/lib/integrations/node-http/index.mjs.map +0 -1
  114. package/dist/service-adapters/index.d.ts +0 -162
  115. package/dist/service-adapters/index.js +0 -1787
  116. package/dist/service-adapters/index.js.map +0 -1
  117. package/dist/service-adapters/index.mjs +0 -34
  118. package/dist/service-adapters/index.mjs.map +0 -1
  119. package/dist/service-adapters/shared/index.d.ts +0 -9
  120. package/dist/service-adapters/shared/index.js +0 -72
  121. package/dist/service-adapters/shared/index.js.map +0 -1
  122. package/dist/service-adapters/shared/index.mjs +0 -8
  123. package/dist/service-adapters/shared/index.mjs.map +0 -1
  124. package/dist/shared-0a7346ce.d.ts +0 -466
  125. package/dist/utils/index.d.ts +0 -65
  126. package/dist/utils/index.js +0 -175
  127. package/dist/utils/index.js.map +0 -1
  128. package/dist/utils/index.mjs +0 -12
  129. package/dist/utils/index.mjs.map +0 -1
  130. package/src/lib/runtime/__tests__/remote-action-constructors.test.ts +0 -246
  131. package/src/lib/runtime/agui-action.ts +0 -180
  132. package/src/lib/runtime/remote-action-constructors.ts +0 -331
  133. package/src/lib/runtime/remote-actions.ts +0 -217
  134. package/src/lib/runtime/remote-lg-action.ts +0 -1006
@@ -1,257 +0,0 @@
1
- import { A as ActionInputAvailability, T as TextMessage, a as ActionExecutionMessage, R as ResultMessage, M as Message } from './index-96b330da.js';
2
- import * as rxjs from 'rxjs';
3
- import { Subject, ReplaySubject } from 'rxjs';
4
- import { Action, Parameter } from '@copilotkit/shared';
5
-
6
- declare class ActionInput {
7
- name: string;
8
- description: string;
9
- jsonSchema: string;
10
- available?: ActionInputAvailability;
11
- }
12
-
13
- declare enum GuardrailsResultStatus {
14
- ALLOWED = "allowed",
15
- DENIED = "denied"
16
- }
17
- declare class GuardrailsResult {
18
- status: GuardrailsResultStatus;
19
- reason?: string;
20
- }
21
-
22
- declare enum RuntimeEventTypes {
23
- TextMessageStart = "TextMessageStart",
24
- TextMessageContent = "TextMessageContent",
25
- TextMessageEnd = "TextMessageEnd",
26
- ActionExecutionStart = "ActionExecutionStart",
27
- ActionExecutionArgs = "ActionExecutionArgs",
28
- ActionExecutionEnd = "ActionExecutionEnd",
29
- ActionExecutionResult = "ActionExecutionResult",
30
- AgentStateMessage = "AgentStateMessage",
31
- MetaEvent = "MetaEvent",
32
- RunError = "RunError"
33
- }
34
- declare enum RuntimeMetaEventName {
35
- LangGraphInterruptEvent = "LangGraphInterruptEvent",
36
- LangGraphInterruptResumeEvent = "LangGraphInterruptResumeEvent",
37
- CopilotKitLangGraphInterruptEvent = "CopilotKitLangGraphInterruptEvent"
38
- }
39
- type RunTimeMetaEvent = {
40
- type: RuntimeEventTypes.MetaEvent;
41
- name: RuntimeMetaEventName.LangGraphInterruptEvent;
42
- value: string;
43
- } | {
44
- type: RuntimeEventTypes.MetaEvent;
45
- name: RuntimeMetaEventName.CopilotKitLangGraphInterruptEvent;
46
- data: {
47
- value: string;
48
- messages: (TextMessage | ActionExecutionMessage | ResultMessage)[];
49
- };
50
- } | {
51
- type: RuntimeEventTypes.MetaEvent;
52
- name: RuntimeMetaEventName.LangGraphInterruptResumeEvent;
53
- data: string;
54
- };
55
- type RuntimeErrorEvent = {
56
- type: RuntimeEventTypes.RunError;
57
- message: string;
58
- code?: string;
59
- };
60
- type RuntimeEvent = {
61
- type: RuntimeEventTypes.TextMessageStart;
62
- messageId: string;
63
- parentMessageId?: string;
64
- } | {
65
- type: RuntimeEventTypes.TextMessageContent;
66
- messageId: string;
67
- content: string;
68
- } | {
69
- type: RuntimeEventTypes.TextMessageEnd;
70
- messageId: string;
71
- } | {
72
- type: RuntimeEventTypes.ActionExecutionStart;
73
- actionExecutionId: string;
74
- actionName: string;
75
- parentMessageId?: string;
76
- } | {
77
- type: RuntimeEventTypes.ActionExecutionArgs;
78
- actionExecutionId: string;
79
- args: string;
80
- } | {
81
- type: RuntimeEventTypes.ActionExecutionEnd;
82
- actionExecutionId: string;
83
- } | {
84
- type: RuntimeEventTypes.ActionExecutionResult;
85
- actionName: string;
86
- actionExecutionId: string;
87
- result: string;
88
- } | {
89
- type: RuntimeEventTypes.AgentStateMessage;
90
- threadId: string;
91
- agentName: string;
92
- nodeName: string;
93
- runId: string;
94
- active: boolean;
95
- role: string;
96
- state: string;
97
- running: boolean;
98
- } | RunTimeMetaEvent | RuntimeErrorEvent;
99
- type EventSourceCallback = (eventStream$: RuntimeEventSubject) => Promise<void>;
100
- declare class RuntimeEventSubject extends ReplaySubject<RuntimeEvent> {
101
- constructor();
102
- sendTextMessageStart({ messageId, parentMessageId, }: {
103
- messageId: string;
104
- parentMessageId?: string;
105
- }): void;
106
- sendTextMessageContent({ messageId, content }: {
107
- messageId: string;
108
- content: string;
109
- }): void;
110
- sendTextMessageEnd({ messageId }: {
111
- messageId: string;
112
- }): void;
113
- sendTextMessage(messageId: string, content: string): void;
114
- sendActionExecutionStart({ actionExecutionId, actionName, parentMessageId, }: {
115
- actionExecutionId: string;
116
- actionName: string;
117
- parentMessageId?: string;
118
- }): void;
119
- sendActionExecutionArgs({ actionExecutionId, args, }: {
120
- actionExecutionId: string;
121
- args: string;
122
- }): void;
123
- sendActionExecutionEnd({ actionExecutionId }: {
124
- actionExecutionId: string;
125
- }): void;
126
- sendActionExecution({ actionExecutionId, actionName, args, parentMessageId, }: {
127
- actionExecutionId: string;
128
- actionName: string;
129
- args: string;
130
- parentMessageId?: string;
131
- }): void;
132
- sendActionExecutionResult({ actionExecutionId, actionName, result, error, }: {
133
- actionExecutionId: string;
134
- actionName: string;
135
- result?: string;
136
- error?: {
137
- code: string;
138
- message: string;
139
- };
140
- }): void;
141
- sendAgentStateMessage({ threadId, agentName, nodeName, runId, active, role, state, running, }: {
142
- threadId: string;
143
- agentName: string;
144
- nodeName: string;
145
- runId: string;
146
- active: boolean;
147
- role: string;
148
- state: string;
149
- running: boolean;
150
- }): void;
151
- }
152
- declare class RuntimeEventSource {
153
- private eventStream$;
154
- private callback;
155
- private errorHandler?;
156
- private errorContext?;
157
- constructor(params?: {
158
- errorHandler?: (error: any, context: any) => Promise<void>;
159
- errorContext?: any;
160
- });
161
- stream(callback: EventSourceCallback): Promise<void>;
162
- sendErrorMessageToChat(message?: string): void;
163
- processRuntimeEvents({ serverSideActions, guardrailsResult$, actionInputsWithoutAgents, threadId, }: {
164
- serverSideActions: Action<any>[];
165
- guardrailsResult$?: Subject<GuardrailsResult>;
166
- actionInputsWithoutAgents: ActionInput[];
167
- threadId: string;
168
- }): rxjs.Observable<RuntimeEvent>;
169
- }
170
-
171
- declare class ForwardedParametersInput {
172
- model?: string;
173
- maxTokens?: number;
174
- stop?: string[];
175
- toolChoice?: String;
176
- toolChoiceFunctionName?: string;
177
- temperature?: number;
178
- }
179
-
180
- /**
181
- * The extensions input is used to pass additional information to the copilot runtime, specific to a
182
- * service adapter or agent framework.
183
- */
184
- declare class ExtensionsInput {
185
- openaiAssistantAPI?: OpenAIApiAssistantAPIInput;
186
- }
187
- declare class OpenAIApiAssistantAPIInput {
188
- runId?: string;
189
- threadId?: string;
190
- }
191
-
192
- /**
193
- * The extensions response is used to receive additional information from the copilot runtime, specific to a
194
- * service adapter or agent framework.
195
- *
196
- * Next time a request to the runtime is made, the extensions response will be included in the request as input.
197
- */
198
- declare class ExtensionsResponse {
199
- openaiAssistantAPI?: OpenAIApiAssistantAPIResponse;
200
- }
201
- declare class OpenAIApiAssistantAPIResponse {
202
- runId?: string;
203
- threadId?: string;
204
- }
205
-
206
- declare class AgentSessionInput {
207
- agentName: string;
208
- threadId?: string;
209
- nodeName?: string;
210
- }
211
-
212
- declare class AgentStateInput {
213
- agentName: string;
214
- state: string;
215
- config?: string;
216
- }
217
-
218
- interface CopilotRuntimeChatCompletionRequest {
219
- eventSource: RuntimeEventSource;
220
- messages: Message[];
221
- actions: ActionInput[];
222
- model?: string;
223
- threadId?: string;
224
- runId?: string;
225
- forwardedParameters?: ForwardedParametersInput;
226
- extensions?: ExtensionsInput;
227
- agentSession?: AgentSessionInput;
228
- agentStates?: AgentStateInput[];
229
- }
230
- interface CopilotRuntimeChatCompletionResponse {
231
- threadId: string;
232
- runId?: string;
233
- extensions?: ExtensionsResponse;
234
- }
235
- interface CopilotServiceAdapter {
236
- process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
237
- }
238
-
239
- interface RemoteChainParameters {
240
- name: string;
241
- description: string;
242
- chainUrl: string;
243
- parameters?: Parameter[];
244
- parameterType?: "single" | "multi";
245
- }
246
- declare class RemoteChain {
247
- name: string;
248
- description: string;
249
- chainUrl: string;
250
- parameters?: Parameter[];
251
- parameterType: "single" | "multi";
252
- constructor(options: RemoteChainParameters);
253
- toAction(): Promise<Action<any>>;
254
- inferLangServeParameters(): Promise<void>;
255
- }
256
-
257
- export { ActionInput as A, CopilotRuntimeChatCompletionRequest as C, ExtensionsInput as E, ForwardedParametersInput as F, RemoteChainParameters as R, CopilotRuntimeChatCompletionResponse as a, CopilotServiceAdapter as b, RemoteChain as c, AgentSessionInput as d, AgentStateInput as e, RuntimeEventSource as f, ExtensionsResponse as g };
@@ -1,6 +0,0 @@
1
- interface CopilotCloudOptions {
2
- baseUrl?: string;
3
- publicApiKey?: string;
4
- }
5
-
6
- export { CopilotCloudOptions };
@@ -1,18 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
-
15
- // src/lib/cloud/index.ts
16
- var cloud_exports = {};
17
- module.exports = __toCommonJS(cloud_exports);
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/cloud/index.ts"],"sourcesContent":["export interface CopilotCloudOptions {\n baseUrl?: string;\n publicApiKey?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;","names":[]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,212 +0,0 @@
1
- export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from '../groq-adapter-c8aec5c5.js';
2
- export { e as CommonConfig, C as CopilotRequestContextProperties, k as CopilotRuntime, j as CopilotRuntimeConstructorParams, f as CopilotRuntimeLogger, i as CopilotRuntimeRequest, b as CreateCopilotRuntimeServerOptions, G as GraphQLContext, L as LogLevel, o as MCPClient, p as MCPEndpointConfig, M as MCPTool, a as addCustomHeaderPlugin, d as buildSchema, s as convertMCPToolsToActions, m as copilotKitEndpoint, c as createContext, h as createLogger, q as extractParametersFromSchema, l as flattenToolCallsNoDuplicates, t as generateMcpToolInstructions, g as getCommonConfig, n as langGraphPlatformEndpoint, r as resolveEndpointType } from '../shared-0a7346ce.js';
3
- export { CopilotRuntimeServerInstance, config, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint } from './integrations/index.js';
4
- export { copilotRuntimeNodeHttpEndpoint } from './integrations/node-http/index.js';
5
- export { copilotRuntimeNodeExpressEndpoint } from './integrations/node-express/index.js';
6
- export { copilotRuntimeNestEndpoint } from './integrations/nest/index.js';
7
- import * as rxjs from 'rxjs';
8
- import { TextMessageStartEvent, TextMessageContentEvent, TextMessageEndEvent, ToolCallStartEvent, ToolCallArgsEvent, ToolCallEndEvent, RunAgentInput, EventType } from '@ag-ui/client';
9
- import { LangGraphAgent as LangGraphAgent$1, LangGraphAgentConfig, ProcessedEvents, State, StateEnrichment, SchemaKeys } from '@ag-ui/langgraph';
10
- export { LangGraphHttpAgent } from '@ag-ui/langgraph';
11
- import { Message } from '@langchain/langgraph-sdk/dist/types.messages';
12
- import 'openai';
13
- import '../langserve-0c6100e3.js';
14
- import '../index-96b330da.js';
15
- import '../graphql/types/base/index.js';
16
- import '@copilotkit/shared';
17
- import '@langchain/core/messages';
18
- import '@langchain/core/tools';
19
- import '@langchain/core/utils/stream';
20
- import 'groq-sdk';
21
- import 'graphql';
22
- import 'pino';
23
- import 'graphql-yoga';
24
- import './cloud/index.js';
25
-
26
- interface CopilotKitStateEnrichment {
27
- copilotkit: {
28
- actions: StateEnrichment["ag-ui"]["tools"];
29
- context: StateEnrichment["ag-ui"]["context"];
30
- };
31
- }
32
- interface PredictStateTool {
33
- tool: string;
34
- state_key: string;
35
- tool_argument: string;
36
- }
37
- type TextMessageEvents = TextMessageStartEvent | TextMessageContentEvent | TextMessageEndEvent;
38
- type ToolCallEvents = ToolCallStartEvent | ToolCallArgsEvent | ToolCallEndEvent;
39
- declare enum CustomEventNames {
40
- CopilotKitManuallyEmitMessage = "copilotkit_manually_emit_message",
41
- CopilotKitManuallyEmitToolCall = "copilotkit_manually_emit_tool_call",
42
- CopilotKitManuallyEmitIntermediateState = "copilotkit_manually_emit_intermediate_state",
43
- CopilotKitExit = "copilotkit_exit"
44
- }
45
- declare class LangGraphAgent extends LangGraphAgent$1 {
46
- constructor(config: LangGraphAgentConfig);
47
- dispatchEvent(event: ProcessedEvents): boolean;
48
- run(input: RunAgentInput): rxjs.Observable<{
49
- type: EventType.TEXT_MESSAGE_START;
50
- role: "developer" | "system" | "assistant" | "user";
51
- messageId: string;
52
- timestamp?: number | undefined;
53
- rawEvent?: any;
54
- } | {
55
- type: EventType.TEXT_MESSAGE_CONTENT;
56
- messageId: string;
57
- delta: string;
58
- timestamp?: number | undefined;
59
- rawEvent?: any;
60
- } | {
61
- type: EventType.TEXT_MESSAGE_END;
62
- messageId: string;
63
- timestamp?: number | undefined;
64
- rawEvent?: any;
65
- } | {
66
- type: EventType.TOOL_CALL_START;
67
- toolCallId: string;
68
- toolCallName: string;
69
- timestamp?: number | undefined;
70
- rawEvent?: any;
71
- parentMessageId?: string | undefined;
72
- } | {
73
- type: EventType.TOOL_CALL_ARGS;
74
- toolCallId: string;
75
- delta: string;
76
- timestamp?: number | undefined;
77
- rawEvent?: any;
78
- } | {
79
- type: EventType.TOOL_CALL_END;
80
- toolCallId: string;
81
- timestamp?: number | undefined;
82
- rawEvent?: any;
83
- } | {
84
- type: EventType.THINKING_TEXT_MESSAGE_START;
85
- timestamp?: number | undefined;
86
- rawEvent?: any;
87
- } | {
88
- type: EventType.THINKING_TEXT_MESSAGE_CONTENT;
89
- delta: string;
90
- timestamp?: number | undefined;
91
- rawEvent?: any;
92
- } | {
93
- type: EventType.THINKING_TEXT_MESSAGE_END;
94
- timestamp?: number | undefined;
95
- rawEvent?: any;
96
- } | {
97
- type: EventType.TOOL_CALL_RESULT;
98
- content: string;
99
- toolCallId: string;
100
- messageId: string;
101
- role?: "tool" | undefined;
102
- timestamp?: number | undefined;
103
- rawEvent?: any;
104
- } | {
105
- type: EventType.THINKING_START;
106
- timestamp?: number | undefined;
107
- rawEvent?: any;
108
- title?: string | undefined;
109
- } | {
110
- type: EventType.THINKING_END;
111
- timestamp?: number | undefined;
112
- rawEvent?: any;
113
- } | {
114
- type: EventType.STATE_SNAPSHOT;
115
- timestamp?: number | undefined;
116
- rawEvent?: any;
117
- snapshot?: any;
118
- } | {
119
- type: EventType.STATE_DELTA;
120
- delta: any[];
121
- timestamp?: number | undefined;
122
- rawEvent?: any;
123
- } | {
124
- type: EventType.MESSAGES_SNAPSHOT;
125
- messages: ({
126
- id: string;
127
- role: "developer";
128
- content: string;
129
- name?: string | undefined;
130
- } | {
131
- id: string;
132
- role: "system";
133
- content: string;
134
- name?: string | undefined;
135
- } | {
136
- id: string;
137
- role: "assistant";
138
- name?: string | undefined;
139
- content?: string | undefined;
140
- toolCalls?: {
141
- function: {
142
- name: string;
143
- arguments: string;
144
- };
145
- type: "function";
146
- id: string;
147
- }[] | undefined;
148
- } | {
149
- id: string;
150
- role: "user";
151
- content: string;
152
- name?: string | undefined;
153
- } | {
154
- id: string;
155
- role: "tool";
156
- content: string;
157
- toolCallId: string;
158
- error?: string | undefined;
159
- })[];
160
- timestamp?: number | undefined;
161
- rawEvent?: any;
162
- } | {
163
- type: EventType.RAW;
164
- timestamp?: number | undefined;
165
- rawEvent?: any;
166
- event?: any;
167
- source?: string | undefined;
168
- } | {
169
- name: string;
170
- type: EventType.CUSTOM;
171
- value?: any;
172
- timestamp?: number | undefined;
173
- rawEvent?: any;
174
- } | {
175
- type: EventType.RUN_STARTED;
176
- threadId: string;
177
- runId: string;
178
- timestamp?: number | undefined;
179
- rawEvent?: any;
180
- } | {
181
- type: EventType.RUN_FINISHED;
182
- threadId: string;
183
- runId: string;
184
- timestamp?: number | undefined;
185
- rawEvent?: any;
186
- result?: any;
187
- } | {
188
- message: string;
189
- type: EventType.RUN_ERROR;
190
- code?: string | undefined;
191
- timestamp?: number | undefined;
192
- rawEvent?: any;
193
- } | {
194
- type: EventType.STEP_STARTED;
195
- stepName: string;
196
- timestamp?: number | undefined;
197
- rawEvent?: any;
198
- } | {
199
- type: EventType.STEP_FINISHED;
200
- stepName: string;
201
- timestamp?: number | undefined;
202
- rawEvent?: any;
203
- } | {
204
- type: EventType;
205
- name: string;
206
- value: any;
207
- }>;
208
- langGraphDefaultMergeState(state: State, messages: Message[], input: RunAgentInput): State<StateEnrichment & CopilotKitStateEnrichment>;
209
- getSchemaKeys(): Promise<SchemaKeys>;
210
- }
211
-
212
- export { CustomEventNames, LangGraphAgent, PredictStateTool, TextMessageEvents, ToolCallEvents };