@nextclaw/agent-chat 0.1.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.
- package/LICENSE +21 -0
- package/dist/index.d.ts +430 -0
- package/dist/index.js +990 -0
- package/package.json +37 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NextClaw contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import { Subscribable, BehaviorSubject, Observable, Subject } from 'rxjs';
|
|
2
|
+
import { JSONSchema7 } from 'json-schema';
|
|
3
|
+
|
|
4
|
+
declare enum EventType {
|
|
5
|
+
TEXT_START = "TEXT_START",
|
|
6
|
+
TEXT_DELTA = "TEXT_DELTA",
|
|
7
|
+
TEXT_END = "TEXT_END",
|
|
8
|
+
TOOL_CALL_START = "TOOL_CALL_START",
|
|
9
|
+
TOOL_CALL_ARGS = "TOOL_CALL_ARGS",
|
|
10
|
+
TOOL_CALL_ARGS_DELTA = "TOOL_CALL_ARGS_DELTA",
|
|
11
|
+
TOOL_CALL_END = "TOOL_CALL_END",
|
|
12
|
+
TOOL_CALL_RESULT = "TOOL_CALL_RESULT",
|
|
13
|
+
RUN_STARTED = "RUN_STARTED",
|
|
14
|
+
RUN_FINISHED = "RUN_FINISHED",
|
|
15
|
+
RUN_ERROR = "RUN_ERROR",
|
|
16
|
+
RUN_METADATA = "RUN_METADATA",
|
|
17
|
+
REASONING_START = "REASONING_START",
|
|
18
|
+
REASONING_DELTA = "REASONING_DELTA",
|
|
19
|
+
REASONING_END = "REASONING_END"
|
|
20
|
+
}
|
|
21
|
+
interface BaseAgentEvent {
|
|
22
|
+
type: EventType;
|
|
23
|
+
}
|
|
24
|
+
interface TextStartEvent extends BaseAgentEvent {
|
|
25
|
+
type: EventType.TEXT_START;
|
|
26
|
+
messageId: string;
|
|
27
|
+
}
|
|
28
|
+
interface TextDeltaEvent extends BaseAgentEvent {
|
|
29
|
+
type: EventType.TEXT_DELTA;
|
|
30
|
+
messageId: string;
|
|
31
|
+
delta: string;
|
|
32
|
+
}
|
|
33
|
+
interface TextEndEvent extends BaseAgentEvent {
|
|
34
|
+
type: EventType.TEXT_END;
|
|
35
|
+
messageId: string;
|
|
36
|
+
}
|
|
37
|
+
interface ReasoningStartEvent extends BaseAgentEvent {
|
|
38
|
+
type: EventType.REASONING_START;
|
|
39
|
+
messageId: string;
|
|
40
|
+
}
|
|
41
|
+
interface ReasoningDeltaEvent extends BaseAgentEvent {
|
|
42
|
+
type: EventType.REASONING_DELTA;
|
|
43
|
+
messageId: string;
|
|
44
|
+
delta: string;
|
|
45
|
+
}
|
|
46
|
+
interface ReasoningEndEvent extends BaseAgentEvent {
|
|
47
|
+
type: EventType.REASONING_END;
|
|
48
|
+
messageId: string;
|
|
49
|
+
}
|
|
50
|
+
interface ToolCallStartEvent extends BaseAgentEvent {
|
|
51
|
+
type: EventType.TOOL_CALL_START;
|
|
52
|
+
messageId?: string;
|
|
53
|
+
toolCallId: string;
|
|
54
|
+
toolName: string;
|
|
55
|
+
}
|
|
56
|
+
interface ToolCallArgsEvent extends BaseAgentEvent {
|
|
57
|
+
type: EventType.TOOL_CALL_ARGS;
|
|
58
|
+
toolCallId: string;
|
|
59
|
+
args: string;
|
|
60
|
+
}
|
|
61
|
+
interface ToolCallArgsDeltaEvent extends BaseAgentEvent {
|
|
62
|
+
type: EventType.TOOL_CALL_ARGS_DELTA;
|
|
63
|
+
toolCallId: string;
|
|
64
|
+
argsDelta: string;
|
|
65
|
+
}
|
|
66
|
+
interface ToolCallEndEvent extends BaseAgentEvent {
|
|
67
|
+
type: EventType.TOOL_CALL_END;
|
|
68
|
+
toolCallId: string;
|
|
69
|
+
}
|
|
70
|
+
interface ToolCallResultEvent extends BaseAgentEvent {
|
|
71
|
+
type: EventType.TOOL_CALL_RESULT;
|
|
72
|
+
toolCallId: string;
|
|
73
|
+
content: unknown;
|
|
74
|
+
}
|
|
75
|
+
interface RunStartedEvent extends BaseAgentEvent {
|
|
76
|
+
type: EventType.RUN_STARTED;
|
|
77
|
+
threadId?: string;
|
|
78
|
+
runId?: string;
|
|
79
|
+
}
|
|
80
|
+
interface RunFinishedEvent extends BaseAgentEvent {
|
|
81
|
+
type: EventType.RUN_FINISHED;
|
|
82
|
+
threadId?: string;
|
|
83
|
+
runId?: string;
|
|
84
|
+
}
|
|
85
|
+
interface RunErrorEvent extends BaseAgentEvent {
|
|
86
|
+
type: EventType.RUN_ERROR;
|
|
87
|
+
error?: string;
|
|
88
|
+
threadId?: string;
|
|
89
|
+
runId?: string;
|
|
90
|
+
}
|
|
91
|
+
interface RunMetadataEvent extends BaseAgentEvent {
|
|
92
|
+
type: EventType.RUN_METADATA;
|
|
93
|
+
runId?: string;
|
|
94
|
+
metadata: Record<string, unknown>;
|
|
95
|
+
}
|
|
96
|
+
type AgentEvent = TextStartEvent | TextDeltaEvent | TextEndEvent | ReasoningStartEvent | ReasoningDeltaEvent | ReasoningEndEvent | ToolCallStartEvent | ToolCallArgsEvent | ToolCallArgsDeltaEvent | ToolCallEndEvent | ToolCallResultEvent | RunStartedEvent | RunFinishedEvent | RunErrorEvent | RunMetadataEvent;
|
|
97
|
+
|
|
98
|
+
type JSONValue = null | string | number | boolean | JSONObject | JSONArray;
|
|
99
|
+
type JSONObject = {
|
|
100
|
+
[key: string]: JSONValue;
|
|
101
|
+
};
|
|
102
|
+
type JSONArray = JSONValue[];
|
|
103
|
+
type LanguageModelV1ProviderMetadata = Record<string, Record<string, JSONValue>>;
|
|
104
|
+
type LanguageModelV1Source = {
|
|
105
|
+
sourceType: 'url';
|
|
106
|
+
id: string;
|
|
107
|
+
url: string;
|
|
108
|
+
title?: string;
|
|
109
|
+
providerMetadata?: LanguageModelV1ProviderMetadata;
|
|
110
|
+
};
|
|
111
|
+
interface ToolInvocation<ARGS = unknown, RESULT = unknown> {
|
|
112
|
+
status: ToolInvocationStatus;
|
|
113
|
+
toolCallId: string;
|
|
114
|
+
toolName: string;
|
|
115
|
+
args: string;
|
|
116
|
+
parsedArgs?: ARGS;
|
|
117
|
+
result?: RESULT;
|
|
118
|
+
error?: string;
|
|
119
|
+
cancelled?: boolean;
|
|
120
|
+
}
|
|
121
|
+
interface UIMessage {
|
|
122
|
+
id: string;
|
|
123
|
+
role: 'system' | 'user' | 'assistant' | 'data' | 'tool';
|
|
124
|
+
parts: Array<TextUIPart | ReasoningUIPart | ToolInvocationUIPart | SourceUIPart | FileUIPart | StepStartUIPart>;
|
|
125
|
+
meta?: UiMessageMeta;
|
|
126
|
+
}
|
|
127
|
+
type TextUIPart = {
|
|
128
|
+
type: 'text';
|
|
129
|
+
text: string;
|
|
130
|
+
};
|
|
131
|
+
type ReasoningUIPart = {
|
|
132
|
+
type: 'reasoning';
|
|
133
|
+
reasoning: string;
|
|
134
|
+
details: Array<{
|
|
135
|
+
type: 'text';
|
|
136
|
+
text: string;
|
|
137
|
+
signature?: string;
|
|
138
|
+
} | {
|
|
139
|
+
type: 'redacted';
|
|
140
|
+
data: string;
|
|
141
|
+
}>;
|
|
142
|
+
};
|
|
143
|
+
type ToolInvocationUIPart = {
|
|
144
|
+
type: 'tool-invocation';
|
|
145
|
+
toolInvocation: ToolInvocation;
|
|
146
|
+
};
|
|
147
|
+
type SourceUIPart = {
|
|
148
|
+
type: 'source';
|
|
149
|
+
source: LanguageModelV1Source;
|
|
150
|
+
};
|
|
151
|
+
type FileUIPart = {
|
|
152
|
+
type: 'file';
|
|
153
|
+
mimeType: string;
|
|
154
|
+
data: string;
|
|
155
|
+
};
|
|
156
|
+
type StepStartUIPart = {
|
|
157
|
+
type: 'step-start';
|
|
158
|
+
};
|
|
159
|
+
type UiMessageRole = UIMessage['role'];
|
|
160
|
+
type UiMessage = UIMessage;
|
|
161
|
+
type UiMessagePart = UIMessage['parts'][number];
|
|
162
|
+
type UiMessageTextPart = TextUIPart;
|
|
163
|
+
type UiMessageReasoningPart = ReasoningUIPart;
|
|
164
|
+
type UiMessageToolInvocationPart = ToolInvocationUIPart;
|
|
165
|
+
type UiMessageSourcePart = SourceUIPart;
|
|
166
|
+
type UiMessageFilePart = FileUIPart;
|
|
167
|
+
type UiMessageStepStartPart = StepStartUIPart;
|
|
168
|
+
type UiMessageSource = 'history' | 'stream' | 'optimistic' | 'local';
|
|
169
|
+
type UiMessageStatus = 'pending' | 'streaming' | 'final' | 'error';
|
|
170
|
+
type UiMessageMeta = {
|
|
171
|
+
seq?: number;
|
|
172
|
+
status?: UiMessageStatus;
|
|
173
|
+
source?: UiMessageSource;
|
|
174
|
+
runId?: string;
|
|
175
|
+
sessionKey?: string;
|
|
176
|
+
timestamp?: string;
|
|
177
|
+
isDraft?: boolean;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
declare enum ToolInvocationStatus {
|
|
181
|
+
CALL = "call",
|
|
182
|
+
RESULT = "result",
|
|
183
|
+
PARTIAL_CALL = "partial-call",
|
|
184
|
+
ERROR = "error",
|
|
185
|
+
CANCELLED = "cancelled"
|
|
186
|
+
}
|
|
187
|
+
interface ToolCall {
|
|
188
|
+
id: string;
|
|
189
|
+
type: string;
|
|
190
|
+
function: {
|
|
191
|
+
name: string;
|
|
192
|
+
arguments: string;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
interface ToolResult<RESULT = ToolExecutionResult> {
|
|
196
|
+
toolCallId: string;
|
|
197
|
+
result?: RESULT;
|
|
198
|
+
status: ToolInvocationStatus;
|
|
199
|
+
error?: string;
|
|
200
|
+
cancelled?: boolean;
|
|
201
|
+
}
|
|
202
|
+
type ToolExecutionResult = unknown;
|
|
203
|
+
type ToolExecutor<ARGS = unknown, RESULT = ToolExecutionResult> = (toolCallArgs: ARGS, context?: Record<string, unknown>) => RESULT | Promise<RESULT>;
|
|
204
|
+
interface ToolDefinition {
|
|
205
|
+
name: string;
|
|
206
|
+
description: string;
|
|
207
|
+
parameters: JSONSchema7;
|
|
208
|
+
}
|
|
209
|
+
interface ToolRenderer<ARGS = unknown, RESULT = ToolExecutionResult> {
|
|
210
|
+
render: ToolRenderFn<ARGS, RESULT>;
|
|
211
|
+
definition: ToolDefinition;
|
|
212
|
+
}
|
|
213
|
+
type ToolRenderFn<ARGS = unknown, RESULT = ToolExecutionResult> = (tool: ToolInvocation<ARGS, RESULT>, onResult: (result: ToolResult<RESULT>) => void) => unknown;
|
|
214
|
+
interface Tool<ARGS = unknown, RESULT = ToolExecutionResult> extends ToolDefinition {
|
|
215
|
+
execute?: ToolExecutor<ARGS, RESULT>;
|
|
216
|
+
render?: ToolRenderFn<ARGS, RESULT>;
|
|
217
|
+
}
|
|
218
|
+
interface Context {
|
|
219
|
+
description: string;
|
|
220
|
+
value: string;
|
|
221
|
+
}
|
|
222
|
+
interface RunAgentInput {
|
|
223
|
+
threadId?: string;
|
|
224
|
+
runId?: string;
|
|
225
|
+
messages: UIMessage[];
|
|
226
|
+
tools?: Tool[];
|
|
227
|
+
context?: Context[];
|
|
228
|
+
metadata?: Record<string, unknown>;
|
|
229
|
+
}
|
|
230
|
+
interface IAgent {
|
|
231
|
+
run: (input: RunAgentInput) => Subscribable<AgentEvent>;
|
|
232
|
+
abortRun?: () => void;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface ActiveRunContext {
|
|
236
|
+
localRunId: number;
|
|
237
|
+
sessionId?: string;
|
|
238
|
+
agentId?: string;
|
|
239
|
+
remoteRunId?: string;
|
|
240
|
+
remoteStopCapable: boolean;
|
|
241
|
+
remoteStopReason?: string;
|
|
242
|
+
sourceMessage?: string;
|
|
243
|
+
restoreDraftOnError?: boolean;
|
|
244
|
+
}
|
|
245
|
+
declare function getStopDisabledReason(run: ActiveRunContext | null): string | null;
|
|
246
|
+
interface RunReadyInfo {
|
|
247
|
+
remoteRunId?: string;
|
|
248
|
+
sessionId?: string;
|
|
249
|
+
stopCapable?: boolean;
|
|
250
|
+
stopReason?: string;
|
|
251
|
+
}
|
|
252
|
+
interface RunFinalInfo {
|
|
253
|
+
sessionId?: string;
|
|
254
|
+
hasOutput?: boolean;
|
|
255
|
+
}
|
|
256
|
+
interface RunLifecycleCallbacks {
|
|
257
|
+
onRunSettled?: (info: {
|
|
258
|
+
sourceSessionId?: string;
|
|
259
|
+
resultSessionId?: string;
|
|
260
|
+
}) => void | Promise<void>;
|
|
261
|
+
onRunError?: (info: {
|
|
262
|
+
error: string;
|
|
263
|
+
sourceMessage?: string;
|
|
264
|
+
restoreDraft?: boolean;
|
|
265
|
+
}) => void;
|
|
266
|
+
onSessionChanged?: (sessionId: string) => void;
|
|
267
|
+
}
|
|
268
|
+
interface RunMetadataParsers {
|
|
269
|
+
parseReady: (metadata: Record<string, unknown>) => RunReadyInfo | null;
|
|
270
|
+
parseFinal: (metadata: Record<string, unknown>) => RunFinalInfo | null;
|
|
271
|
+
}
|
|
272
|
+
interface SendRunOptions {
|
|
273
|
+
message: string;
|
|
274
|
+
sessionId?: string;
|
|
275
|
+
agentId?: string;
|
|
276
|
+
metadata?: Record<string, unknown>;
|
|
277
|
+
restoreDraftOnError?: boolean;
|
|
278
|
+
stopCapable?: boolean;
|
|
279
|
+
stopReason?: string;
|
|
280
|
+
}
|
|
281
|
+
interface ResumeRunOptions {
|
|
282
|
+
remoteRunId: string;
|
|
283
|
+
sessionId?: string;
|
|
284
|
+
agentId?: string;
|
|
285
|
+
metadata?: Record<string, unknown>;
|
|
286
|
+
stopCapable?: boolean;
|
|
287
|
+
stopReason?: string;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
interface IAgentProvider {
|
|
291
|
+
agent: IAgent;
|
|
292
|
+
getToolDefs: () => ToolDefinition[];
|
|
293
|
+
getContexts: () => Context[];
|
|
294
|
+
getToolExecutor: (name: string) => ToolExecutor | undefined;
|
|
295
|
+
}
|
|
296
|
+
interface AgentChatControllerOptions {
|
|
297
|
+
initialMessages?: UIMessage[];
|
|
298
|
+
metadataParsers?: RunMetadataParsers;
|
|
299
|
+
callbacks?: RunLifecycleCallbacks;
|
|
300
|
+
}
|
|
301
|
+
type RunAgentOptions = {
|
|
302
|
+
threadId?: string;
|
|
303
|
+
metadata?: Record<string, unknown>;
|
|
304
|
+
sessionId?: string;
|
|
305
|
+
agentId?: string;
|
|
306
|
+
stopCapable?: boolean;
|
|
307
|
+
stopReason?: string;
|
|
308
|
+
sourceMessage?: string;
|
|
309
|
+
restoreDraftOnError?: boolean;
|
|
310
|
+
};
|
|
311
|
+
declare class Disposable {
|
|
312
|
+
private disposables;
|
|
313
|
+
addDisposable: (disposable: () => void) => void;
|
|
314
|
+
dispose: () => void;
|
|
315
|
+
}
|
|
316
|
+
declare class AgentChatController extends Disposable {
|
|
317
|
+
private readonly agentProvider;
|
|
318
|
+
_messages$: BehaviorSubject<UIMessage[]>;
|
|
319
|
+
messages$: Observable<UIMessage[]>;
|
|
320
|
+
threadId$: BehaviorSubject<string | null>;
|
|
321
|
+
isAgentResponding$: BehaviorSubject<boolean>;
|
|
322
|
+
activeRun$: BehaviorSubject<ActiveRunContext | null>;
|
|
323
|
+
lastError$: BehaviorSubject<string | null>;
|
|
324
|
+
isAwaitingResponse$: BehaviorSubject<boolean>;
|
|
325
|
+
runCompleted$: Subject<{
|
|
326
|
+
runId: string;
|
|
327
|
+
}>;
|
|
328
|
+
runError$: Subject<{
|
|
329
|
+
runId: string;
|
|
330
|
+
error: unknown;
|
|
331
|
+
isAbort: boolean;
|
|
332
|
+
}>;
|
|
333
|
+
runMetadata$: Subject<{
|
|
334
|
+
runId: string;
|
|
335
|
+
metadata: Record<string, unknown>;
|
|
336
|
+
}>;
|
|
337
|
+
private activeSubscription;
|
|
338
|
+
addMessagesEvent$: Subject<{
|
|
339
|
+
messages: UIMessage[];
|
|
340
|
+
}>;
|
|
341
|
+
updateMessageEvent$: Subject<{
|
|
342
|
+
message: UIMessage;
|
|
343
|
+
}>;
|
|
344
|
+
setMessagesEvent$: Subject<{
|
|
345
|
+
messages: UIMessage[];
|
|
346
|
+
}>;
|
|
347
|
+
toolCall$: Subject<{
|
|
348
|
+
toolCall: ToolCall;
|
|
349
|
+
}>;
|
|
350
|
+
private eventHandler;
|
|
351
|
+
private runIdCounter;
|
|
352
|
+
private metadataParsers;
|
|
353
|
+
private callbacks;
|
|
354
|
+
constructor(agentProvider?: IAgentProvider | null, options?: AgentChatControllerOptions);
|
|
355
|
+
getMessages: () => UIMessage[];
|
|
356
|
+
setMessages: (messages: UIMessage[]) => void;
|
|
357
|
+
handleEvent: (event: AgentEvent) => void;
|
|
358
|
+
setCallbacks: (callbacks: RunLifecycleCallbacks) => void;
|
|
359
|
+
reset: () => void;
|
|
360
|
+
addMessages: (messages: UIMessage[]) => void;
|
|
361
|
+
removeMessages: (messageIds: string[]) => void;
|
|
362
|
+
updateMessage: (message: UIMessage) => void;
|
|
363
|
+
addToolResult: (result: ToolResult, _options?: {
|
|
364
|
+
triggerAgent?: boolean;
|
|
365
|
+
}) => void;
|
|
366
|
+
send: (options: SendRunOptions) => Promise<void>;
|
|
367
|
+
resume: (options: ResumeRunOptions) => Promise<void>;
|
|
368
|
+
stop: () => Promise<void>;
|
|
369
|
+
handleAgentResponse: (response: Observable<AgentEvent>) => void;
|
|
370
|
+
abortAgentRun: () => void;
|
|
371
|
+
runAgent: (options?: RunAgentOptions) => Promise<void>;
|
|
372
|
+
private processRunMetadata;
|
|
373
|
+
private applyReadyMetadata;
|
|
374
|
+
private applyFinalMetadata;
|
|
375
|
+
private isMatchingRun;
|
|
376
|
+
private connectToolExecutor;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
declare class AgentEventHandler {
|
|
380
|
+
private readonly sessionManager;
|
|
381
|
+
private currentMessageId?;
|
|
382
|
+
private currentReasoningMessageId?;
|
|
383
|
+
private currentReasoningContent;
|
|
384
|
+
private currentToolCallId?;
|
|
385
|
+
private currentToolCallMessageId?;
|
|
386
|
+
private currentToolCallName?;
|
|
387
|
+
private currentToolCallArgs;
|
|
388
|
+
private emittedToolCallIds;
|
|
389
|
+
constructor(sessionManager: AgentChatController);
|
|
390
|
+
private findAssistantMessageById;
|
|
391
|
+
private findAssistantMessageByToolCallId;
|
|
392
|
+
private findAssistantMessageForCurrentTool;
|
|
393
|
+
reset(): void;
|
|
394
|
+
private emitToolCallEvents;
|
|
395
|
+
handleEvent(event: AgentEvent): void;
|
|
396
|
+
private handleTextStart;
|
|
397
|
+
private appendTextDelta;
|
|
398
|
+
private handleTextContent;
|
|
399
|
+
private handleTextEnd;
|
|
400
|
+
private updateReasoningPart;
|
|
401
|
+
private handleReasoningStart;
|
|
402
|
+
private handleReasoningContent;
|
|
403
|
+
private handleReasoningEnd;
|
|
404
|
+
private handleToolCallStart;
|
|
405
|
+
private handleToolCallArgsDelta;
|
|
406
|
+
private handleToolCallArgs;
|
|
407
|
+
private handleToolCallEnd;
|
|
408
|
+
private handleToolCallResult;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
declare const toolCallToToolInvocation: (toolCall: ToolCall) => ToolInvocation;
|
|
412
|
+
declare function finalizePendingToolInvocations(messages: UIMessage[], options?: {
|
|
413
|
+
stubResult?: unknown;
|
|
414
|
+
}): UIMessage[];
|
|
415
|
+
|
|
416
|
+
declare function extractTextFromMessage(message: UIMessage): string;
|
|
417
|
+
declare function hasCopyableText(message: UIMessage): boolean;
|
|
418
|
+
declare function getMessagePreview(message: UIMessage, maxLength?: number): string;
|
|
419
|
+
|
|
420
|
+
declare const getToolDefFromTool: (tool: Tool) => ToolDefinition;
|
|
421
|
+
declare const toolInvocationToToolCall: (toolInvocation: ToolInvocation) => ToolCall;
|
|
422
|
+
|
|
423
|
+
declare function isAbortLikeError(error: unknown): boolean;
|
|
424
|
+
declare function formatSendError(error: unknown): string;
|
|
425
|
+
declare function buildLocalAssistantMessage(text: string, options?: {
|
|
426
|
+
sessionKey?: string;
|
|
427
|
+
status?: UiMessageStatus;
|
|
428
|
+
}): UIMessage;
|
|
429
|
+
|
|
430
|
+
export { type ActiveRunContext, AgentChatController, type AgentChatControllerOptions, type AgentEvent, AgentEventHandler, type BaseAgentEvent, type Context, Disposable, EventType, type FileUIPart, type IAgent, type IAgentProvider, type ReasoningDeltaEvent, type ReasoningEndEvent, type ReasoningStartEvent, type ReasoningUIPart, type ResumeRunOptions, type RunAgentInput, type RunErrorEvent, type RunFinalInfo, type RunFinishedEvent, type RunLifecycleCallbacks, type RunMetadataEvent, type RunMetadataParsers, type RunReadyInfo, type RunStartedEvent, type SendRunOptions, type SourceUIPart, type StepStartUIPart, type TextDeltaEvent, type TextEndEvent, type TextStartEvent, type TextUIPart, type Tool, type ToolCall, type ToolCallArgsDeltaEvent, type ToolCallArgsEvent, type ToolCallEndEvent, type ToolCallResultEvent, type ToolCallStartEvent, type ToolDefinition, type ToolExecutionResult, type ToolExecutor, type ToolInvocation, ToolInvocationStatus, type ToolInvocationUIPart, type ToolRenderFn, type ToolRenderer, type ToolResult, type UIMessage, type UiMessage, type UiMessageFilePart, type UiMessageMeta, type UiMessagePart, type UiMessageReasoningPart, type UiMessageRole, type UiMessageSource, type UiMessageSourcePart, type UiMessageStatus, type UiMessageStepStartPart, type UiMessageTextPart, type UiMessageToolInvocationPart, buildLocalAssistantMessage, extractTextFromMessage, finalizePendingToolInvocations, formatSendError, getMessagePreview, getStopDisabledReason, getToolDefFromTool, hasCopyableText, isAbortLikeError, toolCallToToolInvocation, toolInvocationToToolCall };
|