@octavus/core 2.18.0 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +883 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2239 -0
- package/package.json +11 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,2239 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare class AppError extends Error {
|
|
4
|
+
code: string;
|
|
5
|
+
statusCode: number;
|
|
6
|
+
constructor(message: string, code: string, statusCode?: number);
|
|
7
|
+
}
|
|
8
|
+
declare class NotFoundError extends AppError {
|
|
9
|
+
constructor(resource: string, id: string);
|
|
10
|
+
}
|
|
11
|
+
declare class ValidationError extends AppError {
|
|
12
|
+
issues?: unknown[] | undefined;
|
|
13
|
+
constructor(message: string, issues?: unknown[] | undefined);
|
|
14
|
+
}
|
|
15
|
+
declare class ConflictError extends AppError {
|
|
16
|
+
constructor(resource: string, identifier: string);
|
|
17
|
+
}
|
|
18
|
+
declare class ForbiddenError extends AppError {
|
|
19
|
+
constructor(message?: string);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Error types for Octavus streaming errors.
|
|
24
|
+
* These types categorize errors to enable appropriate UI handling.
|
|
25
|
+
*/
|
|
26
|
+
type ErrorType = 'authentication_error' | 'permission_error' | 'validation_error' | 'not_found_error' | 'rate_limit_error' | 'quota_exceeded_error' | 'provider_error' | 'provider_overloaded' | 'provider_timeout' | 'unsupported_error' | 'execution_error' | 'tool_error' | 'protocol_error' | 'internal_error' | 'unknown_error';
|
|
27
|
+
/**
|
|
28
|
+
* Error source - where the error originated.
|
|
29
|
+
*/
|
|
30
|
+
type ErrorSource = 'platform' | 'provider' | 'tool' | 'client';
|
|
31
|
+
/**
|
|
32
|
+
* Provider information for provider errors.
|
|
33
|
+
*/
|
|
34
|
+
interface ProviderErrorInfo {
|
|
35
|
+
/** Provider name (e.g., 'openai', 'anthropic', 'google') */
|
|
36
|
+
name: string;
|
|
37
|
+
/** Model that caused the error */
|
|
38
|
+
model?: string;
|
|
39
|
+
/** HTTP status code from provider */
|
|
40
|
+
statusCode?: number;
|
|
41
|
+
/** Provider's error type string */
|
|
42
|
+
errorType?: string;
|
|
43
|
+
/** Provider's request ID for support */
|
|
44
|
+
requestId?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Tool information for tool errors.
|
|
48
|
+
*/
|
|
49
|
+
interface ToolErrorInfo {
|
|
50
|
+
/** Tool name */
|
|
51
|
+
name: string;
|
|
52
|
+
/** Tool call ID */
|
|
53
|
+
callId?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Options for creating an OctavusError.
|
|
57
|
+
*/
|
|
58
|
+
interface OctavusErrorOptions {
|
|
59
|
+
errorType: ErrorType;
|
|
60
|
+
message: string;
|
|
61
|
+
source: ErrorSource;
|
|
62
|
+
retryable?: boolean;
|
|
63
|
+
retryAfter?: number;
|
|
64
|
+
code?: string;
|
|
65
|
+
provider?: ProviderErrorInfo;
|
|
66
|
+
tool?: ToolErrorInfo;
|
|
67
|
+
cause?: unknown;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Base error class for Octavus streaming errors.
|
|
72
|
+
*
|
|
73
|
+
* Provides structured error information including:
|
|
74
|
+
* - Error type classification for UI handling
|
|
75
|
+
* - Source information (platform, provider, tool)
|
|
76
|
+
* - Retryability flag and retry delay
|
|
77
|
+
* - Provider/tool details when applicable
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* const error = new OctavusError({
|
|
82
|
+
* errorType: 'rate_limit_error',
|
|
83
|
+
* message: 'Rate limit exceeded. Please try again later.',
|
|
84
|
+
* source: 'provider',
|
|
85
|
+
* retryable: true,
|
|
86
|
+
* retryAfter: 60,
|
|
87
|
+
* provider: {
|
|
88
|
+
* name: 'anthropic',
|
|
89
|
+
* statusCode: 429,
|
|
90
|
+
* requestId: 'req_xxx',
|
|
91
|
+
* },
|
|
92
|
+
* });
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
declare class OctavusError extends Error {
|
|
96
|
+
/** @internal Marker for cross-version instanceof checks */
|
|
97
|
+
readonly __octavusErrorMarker = "octavus.error";
|
|
98
|
+
/** Error type classification */
|
|
99
|
+
readonly errorType: ErrorType;
|
|
100
|
+
/** Where the error originated */
|
|
101
|
+
readonly source: ErrorSource;
|
|
102
|
+
/** Whether automatic retry is possible */
|
|
103
|
+
readonly retryable: boolean;
|
|
104
|
+
/** Suggested retry delay in seconds (from provider headers) */
|
|
105
|
+
readonly retryAfter?: number;
|
|
106
|
+
/** Machine-readable error code */
|
|
107
|
+
readonly code?: string;
|
|
108
|
+
/** Provider details (when source === 'provider') */
|
|
109
|
+
readonly provider?: ProviderErrorInfo;
|
|
110
|
+
/** Tool details (when source === 'tool') */
|
|
111
|
+
readonly tool?: ToolErrorInfo;
|
|
112
|
+
constructor(options: OctavusErrorOptions);
|
|
113
|
+
/**
|
|
114
|
+
* Check if an unknown value is an OctavusError.
|
|
115
|
+
* Works reliably across package versions using marker property.
|
|
116
|
+
*/
|
|
117
|
+
static isInstance(error: unknown): error is OctavusError;
|
|
118
|
+
/**
|
|
119
|
+
* Convert error to plain object for serialization.
|
|
120
|
+
* Used for streaming error events.
|
|
121
|
+
*/
|
|
122
|
+
toJSON(): Record<string, unknown>;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Check if an error is a rate limit error.
|
|
126
|
+
*/
|
|
127
|
+
declare function isRateLimitError(error: unknown): error is OctavusError;
|
|
128
|
+
/**
|
|
129
|
+
* Check if an error is an authentication error.
|
|
130
|
+
*/
|
|
131
|
+
declare function isAuthenticationError(error: unknown): error is OctavusError;
|
|
132
|
+
/**
|
|
133
|
+
* Check if an error is a provider error.
|
|
134
|
+
*/
|
|
135
|
+
declare function isProviderError(error: unknown): error is OctavusError;
|
|
136
|
+
/**
|
|
137
|
+
* Check if an error is a tool error.
|
|
138
|
+
*/
|
|
139
|
+
declare function isToolError(error: unknown): error is OctavusError;
|
|
140
|
+
/**
|
|
141
|
+
* Check if an error is retryable.
|
|
142
|
+
*/
|
|
143
|
+
declare function isRetryableError(error: unknown): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Check if an error is a validation error (non-retryable request issue).
|
|
146
|
+
*/
|
|
147
|
+
declare function isValidationError(error: unknown): error is OctavusError;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Stream event types for Octavus agent communication.
|
|
151
|
+
*
|
|
152
|
+
* Events are organized into two categories:
|
|
153
|
+
* - Standard Events (====): Common streaming patterns for AI agents
|
|
154
|
+
* - Octavus Events (----): Octavus-specific protocol events
|
|
155
|
+
*/
|
|
156
|
+
/**
|
|
157
|
+
* Display mode - controls execution indicator visibility (NOT final message visibility).
|
|
158
|
+
* - hidden: Block runs silently
|
|
159
|
+
* - name: Shows block/tool name
|
|
160
|
+
* - description: Shows description
|
|
161
|
+
* - stream: Shows live streaming content
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
type DisplayMode = 'hidden' | 'name' | 'description' | 'stream';
|
|
165
|
+
type ToolHandler = (args: Record<string, unknown>) => Promise<unknown>;
|
|
166
|
+
type ToolHandlers = Record<string, ToolHandler>;
|
|
167
|
+
/** Schema for a tool provided via additionalToolSchemas (device MCP tools, etc.) */
|
|
168
|
+
interface ToolSchema {
|
|
169
|
+
name: string;
|
|
170
|
+
description: string;
|
|
171
|
+
inputSchema: Record<string, unknown>;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Interface for providing namespaced tools to a session.
|
|
175
|
+
* Implementors include `@octavus/computer` (browser, filesystem, shell)
|
|
176
|
+
* and custom consumer-defined tool providers.
|
|
177
|
+
*/
|
|
178
|
+
interface ToolProvider {
|
|
179
|
+
toolHandlers(): Record<string, ToolHandler>;
|
|
180
|
+
toolSchemas(): ToolSchema[];
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Reference to an uploaded file.
|
|
184
|
+
* Used in trigger input, user messages, and tool results for file attachments.
|
|
185
|
+
* Compatible with UIFilePart structure for rendering.
|
|
186
|
+
*/
|
|
187
|
+
interface FileReference {
|
|
188
|
+
/** Unique file ID (platform-generated) */
|
|
189
|
+
id: string;
|
|
190
|
+
/** IANA media type (e.g., 'image/png', 'application/pdf') */
|
|
191
|
+
mediaType: string;
|
|
192
|
+
/** Presigned download URL (S3) */
|
|
193
|
+
url: string;
|
|
194
|
+
/** Original filename */
|
|
195
|
+
filename?: string;
|
|
196
|
+
/** File size in bytes */
|
|
197
|
+
size?: number;
|
|
198
|
+
}
|
|
199
|
+
type ResourceUpdateHandler = (name: string, value: unknown) => Promise<void> | void;
|
|
200
|
+
type MessageRole = 'user' | 'assistant' | 'system';
|
|
201
|
+
type ToolCallStatus = 'pending' | 'streaming' | 'available' | 'error';
|
|
202
|
+
interface ToolCallInfo {
|
|
203
|
+
id: string;
|
|
204
|
+
name: string;
|
|
205
|
+
description?: string;
|
|
206
|
+
arguments: Record<string, unknown>;
|
|
207
|
+
status: ToolCallStatus;
|
|
208
|
+
result?: unknown;
|
|
209
|
+
error?: string;
|
|
210
|
+
/** Google Gemini 3 thought signature - required for tool call continuation */
|
|
211
|
+
thoughtSignature?: string;
|
|
212
|
+
/** Display mode from tool definition - controls what data flows to UIMessage */
|
|
213
|
+
display?: DisplayMode;
|
|
214
|
+
}
|
|
215
|
+
/** Signals the start of a response message */
|
|
216
|
+
interface StartEvent {
|
|
217
|
+
type: 'start';
|
|
218
|
+
messageId?: string;
|
|
219
|
+
/** Execution ID for tool continuation. Used by client to resume after client-side tool handling. */
|
|
220
|
+
executionId?: string;
|
|
221
|
+
/** ID of the last ChatMessage in session state before this execution. Used by client SDK for retry rollback. */
|
|
222
|
+
lastMessageId?: string;
|
|
223
|
+
}
|
|
224
|
+
/** Signals completion of streaming */
|
|
225
|
+
interface FinishEvent {
|
|
226
|
+
type: 'finish';
|
|
227
|
+
finishReason: FinishReason;
|
|
228
|
+
/** Execution ID for cleanup confirmation. Present when execution completes or pauses for client tools. */
|
|
229
|
+
executionId?: string;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Error during streaming.
|
|
234
|
+
*
|
|
235
|
+
* Enhanced with structured error information including:
|
|
236
|
+
* - Error type classification for UI handling
|
|
237
|
+
* - Source information (platform, provider, tool)
|
|
238
|
+
* - Retryability flag and retry delay
|
|
239
|
+
* - Provider/tool details when applicable
|
|
240
|
+
*
|
|
241
|
+
* @example Rate limit error from provider
|
|
242
|
+
* ```typescript
|
|
243
|
+
* {
|
|
244
|
+
* type: 'error',
|
|
245
|
+
* errorType: 'rate_limit_error',
|
|
246
|
+
* message: 'Rate limit exceeded',
|
|
247
|
+
* source: 'provider',
|
|
248
|
+
* retryable: true,
|
|
249
|
+
* retryAfter: 60,
|
|
250
|
+
* provider: { name: 'anthropic', statusCode: 429 }
|
|
251
|
+
* }
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
interface ErrorEvent {
|
|
255
|
+
type: 'error';
|
|
256
|
+
/** Error type classification for UI handling */
|
|
257
|
+
errorType: ErrorType;
|
|
258
|
+
/** Human-readable error message */
|
|
259
|
+
message: string;
|
|
260
|
+
/** Whether automatic retry is possible */
|
|
261
|
+
retryable: boolean;
|
|
262
|
+
/** Where the error originated */
|
|
263
|
+
source: ErrorSource;
|
|
264
|
+
/** Suggested retry delay in seconds (from provider headers) */
|
|
265
|
+
retryAfter?: number;
|
|
266
|
+
/** Machine-readable error code */
|
|
267
|
+
code?: string;
|
|
268
|
+
/** Provider details (when source === 'provider') */
|
|
269
|
+
provider?: ProviderErrorInfo;
|
|
270
|
+
/** Tool details (when source === 'tool') */
|
|
271
|
+
tool?: ToolErrorInfo;
|
|
272
|
+
}
|
|
273
|
+
type FinishReason = 'stop' | 'tool-calls' | 'client-tool-calls' | 'length' | 'content-filter' | 'error' | 'other';
|
|
274
|
+
/**
|
|
275
|
+
* Start of text generation for a specific text part.
|
|
276
|
+
*
|
|
277
|
+
* If `responseType` is set, the text content is JSON matching a custom type.
|
|
278
|
+
* The client SDK should parse the text as a structured object instead of
|
|
279
|
+
* displaying it as plain text.
|
|
280
|
+
*/
|
|
281
|
+
interface TextStartEvent {
|
|
282
|
+
type: 'text-start';
|
|
283
|
+
id: string;
|
|
284
|
+
/**
|
|
285
|
+
* If specified, the text content is JSON matching this type name.
|
|
286
|
+
* Client SDK should parse as object, not display as text.
|
|
287
|
+
*/
|
|
288
|
+
responseType?: string;
|
|
289
|
+
/** Worker ID if this event originated from a worker execution */
|
|
290
|
+
workerId?: string;
|
|
291
|
+
}
|
|
292
|
+
/** Incremental text content */
|
|
293
|
+
interface TextDeltaEvent {
|
|
294
|
+
type: 'text-delta';
|
|
295
|
+
id: string;
|
|
296
|
+
delta: string;
|
|
297
|
+
/** Worker ID if this event originated from a worker execution */
|
|
298
|
+
workerId?: string;
|
|
299
|
+
}
|
|
300
|
+
/** End of text generation for a specific text part */
|
|
301
|
+
interface TextEndEvent {
|
|
302
|
+
type: 'text-end';
|
|
303
|
+
id: string;
|
|
304
|
+
/** Worker ID if this event originated from a worker execution */
|
|
305
|
+
workerId?: string;
|
|
306
|
+
}
|
|
307
|
+
/** Start of reasoning/thinking generation */
|
|
308
|
+
interface ReasoningStartEvent {
|
|
309
|
+
type: 'reasoning-start';
|
|
310
|
+
id: string;
|
|
311
|
+
/** Worker ID if this event originated from a worker execution */
|
|
312
|
+
workerId?: string;
|
|
313
|
+
}
|
|
314
|
+
/** Incremental reasoning content */
|
|
315
|
+
interface ReasoningDeltaEvent {
|
|
316
|
+
type: 'reasoning-delta';
|
|
317
|
+
id: string;
|
|
318
|
+
delta: string;
|
|
319
|
+
/** Worker ID if this event originated from a worker execution */
|
|
320
|
+
workerId?: string;
|
|
321
|
+
}
|
|
322
|
+
/** End of reasoning generation */
|
|
323
|
+
interface ReasoningEndEvent {
|
|
324
|
+
type: 'reasoning-end';
|
|
325
|
+
id: string;
|
|
326
|
+
/** Worker ID if this event originated from a worker execution */
|
|
327
|
+
workerId?: string;
|
|
328
|
+
}
|
|
329
|
+
/** Tool call initiated - input streaming will follow */
|
|
330
|
+
interface ToolInputStartEvent {
|
|
331
|
+
type: 'tool-input-start';
|
|
332
|
+
toolCallId: string;
|
|
333
|
+
toolName: string;
|
|
334
|
+
/** Human-readable title/description for the tool call */
|
|
335
|
+
title?: string;
|
|
336
|
+
/** Worker ID if this event originated from a worker execution */
|
|
337
|
+
workerId?: string;
|
|
338
|
+
}
|
|
339
|
+
/** Incremental tool input/arguments */
|
|
340
|
+
interface ToolInputDeltaEvent {
|
|
341
|
+
type: 'tool-input-delta';
|
|
342
|
+
toolCallId: string;
|
|
343
|
+
inputTextDelta: string;
|
|
344
|
+
/** Worker ID if this event originated from a worker execution */
|
|
345
|
+
workerId?: string;
|
|
346
|
+
}
|
|
347
|
+
/** Tool input streaming has ended */
|
|
348
|
+
interface ToolInputEndEvent {
|
|
349
|
+
type: 'tool-input-end';
|
|
350
|
+
toolCallId: string;
|
|
351
|
+
/** Worker ID if this event originated from a worker execution */
|
|
352
|
+
workerId?: string;
|
|
353
|
+
}
|
|
354
|
+
/** Tool input is complete and available */
|
|
355
|
+
interface ToolInputAvailableEvent {
|
|
356
|
+
type: 'tool-input-available';
|
|
357
|
+
toolCallId: string;
|
|
358
|
+
toolName: string;
|
|
359
|
+
input: unknown;
|
|
360
|
+
/** Worker ID if this event originated from a worker execution */
|
|
361
|
+
workerId?: string;
|
|
362
|
+
}
|
|
363
|
+
/** Tool output/result is available */
|
|
364
|
+
interface ToolOutputAvailableEvent {
|
|
365
|
+
type: 'tool-output-available';
|
|
366
|
+
toolCallId: string;
|
|
367
|
+
output: unknown;
|
|
368
|
+
/** Worker ID if this event originated from a worker execution */
|
|
369
|
+
workerId?: string;
|
|
370
|
+
}
|
|
371
|
+
/** Tool execution resulted in error */
|
|
372
|
+
interface ToolOutputErrorEvent {
|
|
373
|
+
type: 'tool-output-error';
|
|
374
|
+
toolCallId: string;
|
|
375
|
+
error: string;
|
|
376
|
+
/** Worker ID if this event originated from a worker execution */
|
|
377
|
+
workerId?: string;
|
|
378
|
+
}
|
|
379
|
+
/** Base source event fields */
|
|
380
|
+
interface BaseSourceEvent {
|
|
381
|
+
type: 'source';
|
|
382
|
+
/** Unique source ID */
|
|
383
|
+
id: string;
|
|
384
|
+
/** Worker ID if this event originated from a worker execution */
|
|
385
|
+
workerId?: string;
|
|
386
|
+
}
|
|
387
|
+
/** URL source from web search or similar tools */
|
|
388
|
+
interface SourceUrlEvent extends BaseSourceEvent {
|
|
389
|
+
sourceType: 'url';
|
|
390
|
+
/** URL of the source */
|
|
391
|
+
url: string;
|
|
392
|
+
/** Title of the source */
|
|
393
|
+
title?: string;
|
|
394
|
+
}
|
|
395
|
+
/** Document source from file processing */
|
|
396
|
+
interface SourceDocumentEvent extends BaseSourceEvent {
|
|
397
|
+
sourceType: 'document';
|
|
398
|
+
/** IANA media type (e.g., 'application/pdf') */
|
|
399
|
+
mediaType: string;
|
|
400
|
+
/** Title of the document */
|
|
401
|
+
title: string;
|
|
402
|
+
/** Filename of the document */
|
|
403
|
+
filename?: string;
|
|
404
|
+
}
|
|
405
|
+
/** Source event - union of all source types */
|
|
406
|
+
type SourceEvent = SourceUrlEvent | SourceDocumentEvent;
|
|
407
|
+
/** Protocol block execution started */
|
|
408
|
+
interface BlockStartEvent {
|
|
409
|
+
type: 'block-start';
|
|
410
|
+
blockId: string;
|
|
411
|
+
blockName: string;
|
|
412
|
+
blockType: string;
|
|
413
|
+
display: DisplayMode;
|
|
414
|
+
description?: string;
|
|
415
|
+
/** Whether output goes to main chat (false for independent blocks) */
|
|
416
|
+
outputToChat?: boolean;
|
|
417
|
+
/** Thread name (undefined or 'main' for main thread) */
|
|
418
|
+
thread?: string;
|
|
419
|
+
/** Worker ID if this event originated from a worker execution */
|
|
420
|
+
workerId?: string;
|
|
421
|
+
}
|
|
422
|
+
/** Protocol block execution completed */
|
|
423
|
+
interface BlockEndEvent {
|
|
424
|
+
type: 'block-end';
|
|
425
|
+
blockId: string;
|
|
426
|
+
summary?: string;
|
|
427
|
+
/** Worker ID if this event originated from a worker execution */
|
|
428
|
+
workerId?: string;
|
|
429
|
+
}
|
|
430
|
+
/** Resource value updated */
|
|
431
|
+
interface ResourceUpdateEvent {
|
|
432
|
+
type: 'resource-update';
|
|
433
|
+
name: string;
|
|
434
|
+
value: unknown;
|
|
435
|
+
}
|
|
436
|
+
/** Pending tool call that needs external execution (continuation pattern) */
|
|
437
|
+
interface PendingToolCall {
|
|
438
|
+
toolCallId: string;
|
|
439
|
+
toolName: string;
|
|
440
|
+
args: Record<string, unknown>;
|
|
441
|
+
/** 'llm' for LLM-initiated, 'block' for protocol block */
|
|
442
|
+
source?: 'llm' | 'block';
|
|
443
|
+
/** For block-based tools: variable name to store result in */
|
|
444
|
+
outputVariable?: string;
|
|
445
|
+
/** For block-based tools: block index to resume from after execution */
|
|
446
|
+
blockIndex?: number;
|
|
447
|
+
/** Thread name where this tool call originated (for workers with threads) */
|
|
448
|
+
thread?: string;
|
|
449
|
+
/** Worker ID if this tool call originated from a worker execution */
|
|
450
|
+
workerId?: string;
|
|
451
|
+
/** Google Gemini 3 thought signature - required for tool call continuation */
|
|
452
|
+
thoughtSignature?: string;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* When this event is received, the stream will close.
|
|
456
|
+
* Consumer should execute the tools and POST a new trigger request with toolResults.
|
|
457
|
+
*/
|
|
458
|
+
interface ToolRequestEvent {
|
|
459
|
+
type: 'tool-request';
|
|
460
|
+
toolCalls: PendingToolCall[];
|
|
461
|
+
/** Worker ID if this tool request originated from a worker execution */
|
|
462
|
+
workerId?: string;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Request for client-side tool execution.
|
|
466
|
+
* Emitted by server-SDK when a tool has no server handler registered.
|
|
467
|
+
* Client should execute the tools and submit results via `continueWithToolResults(executionId, results)`.
|
|
468
|
+
*/
|
|
469
|
+
interface ClientToolRequestEvent {
|
|
470
|
+
type: 'client-tool-request';
|
|
471
|
+
/**
|
|
472
|
+
* Unique execution ID for this trigger execution.
|
|
473
|
+
* Include this when sending tool results back to continue the execution.
|
|
474
|
+
*/
|
|
475
|
+
executionId: string;
|
|
476
|
+
toolCalls: PendingToolCall[];
|
|
477
|
+
/**
|
|
478
|
+
* Server tool results already executed in this round.
|
|
479
|
+
* When mixed server+client tools are requested, the server executes its tools
|
|
480
|
+
* first and includes results here. Client must include these when continuing.
|
|
481
|
+
*/
|
|
482
|
+
serverToolResults?: ToolResult[];
|
|
483
|
+
}
|
|
484
|
+
/** Result from tool execution (consumer's response to tool-request) */
|
|
485
|
+
interface ToolResult {
|
|
486
|
+
toolCallId: string;
|
|
487
|
+
toolName?: string;
|
|
488
|
+
result?: unknown;
|
|
489
|
+
error?: string;
|
|
490
|
+
/** Files produced by the tool (e.g., screenshots, generated images). */
|
|
491
|
+
files?: FileReference[];
|
|
492
|
+
outputVariable?: string;
|
|
493
|
+
blockIndex?: number;
|
|
494
|
+
/** Thread name where this tool call originated (for workers with threads) */
|
|
495
|
+
thread?: string;
|
|
496
|
+
/** Worker ID if this tool result is for a worker execution */
|
|
497
|
+
workerId?: string;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* A file generated during execution.
|
|
501
|
+
* Used for skill outputs, image generation, code execution artifacts, etc.
|
|
502
|
+
*/
|
|
503
|
+
interface GeneratedFile {
|
|
504
|
+
/** Unique file ID */
|
|
505
|
+
id: string;
|
|
506
|
+
/** MIME type (e.g., 'image/png', 'application/pdf') */
|
|
507
|
+
mediaType: string;
|
|
508
|
+
/** URL for download/display */
|
|
509
|
+
url: string;
|
|
510
|
+
/** Original filename (for display/download) */
|
|
511
|
+
filename?: string;
|
|
512
|
+
/** Size in bytes */
|
|
513
|
+
size?: number;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* File generated and available for download/display.
|
|
517
|
+
* Emitted when a tool or skill produces a file output.
|
|
518
|
+
*/
|
|
519
|
+
interface FileAvailableEvent {
|
|
520
|
+
type: 'file-available';
|
|
521
|
+
/** Unique file ID */
|
|
522
|
+
id: string;
|
|
523
|
+
/** MIME type (e.g., 'image/png', 'application/pdf') */
|
|
524
|
+
mediaType: string;
|
|
525
|
+
/** URL for download/display */
|
|
526
|
+
url: string;
|
|
527
|
+
/** Original filename */
|
|
528
|
+
filename?: string;
|
|
529
|
+
/** Size in bytes */
|
|
530
|
+
size?: number;
|
|
531
|
+
/** Tool call that generated this file */
|
|
532
|
+
toolCallId?: string;
|
|
533
|
+
/** Worker ID if this event originated from a worker execution */
|
|
534
|
+
workerId?: string;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Worker execution has started.
|
|
538
|
+
* Emitted when a worker begins execution (standalone or delegated from another agent).
|
|
539
|
+
*/
|
|
540
|
+
interface WorkerStartEvent {
|
|
541
|
+
type: 'worker-start';
|
|
542
|
+
/** Unique ID for this worker invocation (correlates with worker-result, also used as session ID) */
|
|
543
|
+
workerId: string;
|
|
544
|
+
/** The worker's slug (agent identifier) */
|
|
545
|
+
workerSlug: string;
|
|
546
|
+
/** Display description for the worker execution */
|
|
547
|
+
description?: string;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Worker execution completed with output value.
|
|
551
|
+
* Emitted by worker agents before the finish event when output is defined.
|
|
552
|
+
*/
|
|
553
|
+
interface WorkerResultEvent {
|
|
554
|
+
type: 'worker-result';
|
|
555
|
+
/** Unique ID for this worker invocation (correlates with worker-start) */
|
|
556
|
+
workerId: string;
|
|
557
|
+
/** The worker's output value (undefined if no output variable defined) */
|
|
558
|
+
output?: unknown;
|
|
559
|
+
/** Error message if the worker failed */
|
|
560
|
+
error?: string;
|
|
561
|
+
}
|
|
562
|
+
type StreamEvent = StartEvent | FinishEvent | ErrorEvent | TextStartEvent | TextDeltaEvent | TextEndEvent | ReasoningStartEvent | ReasoningDeltaEvent | ReasoningEndEvent | ToolInputStartEvent | ToolInputDeltaEvent | ToolInputEndEvent | ToolInputAvailableEvent | ToolOutputAvailableEvent | ToolOutputErrorEvent | SourceEvent | BlockStartEvent | BlockEndEvent | ResourceUpdateEvent | ToolRequestEvent | ClientToolRequestEvent | FileAvailableEvent | WorkerStartEvent | WorkerResultEvent;
|
|
563
|
+
/**
|
|
564
|
+
* Type of content in a message part (internal)
|
|
565
|
+
*/
|
|
566
|
+
type MessagePartType = 'text' | 'reasoning' | 'tool-call' | 'operation' | 'source' | 'file' | 'object' | 'worker';
|
|
567
|
+
/**
|
|
568
|
+
* Source info for URL sources (from web search, etc.)
|
|
569
|
+
*/
|
|
570
|
+
interface SourceUrlInfo {
|
|
571
|
+
sourceType: 'url';
|
|
572
|
+
id: string;
|
|
573
|
+
url: string;
|
|
574
|
+
title?: string;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Source info for document sources (from file processing)
|
|
578
|
+
*/
|
|
579
|
+
interface SourceDocumentInfo {
|
|
580
|
+
sourceType: 'document';
|
|
581
|
+
id: string;
|
|
582
|
+
mediaType: string;
|
|
583
|
+
title: string;
|
|
584
|
+
filename?: string;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Source info - union of all source types (internal)
|
|
588
|
+
*/
|
|
589
|
+
type SourceInfo = SourceUrlInfo | SourceDocumentInfo;
|
|
590
|
+
/**
|
|
591
|
+
* File info for generated files (from skill execution, code execution, etc.)
|
|
592
|
+
*/
|
|
593
|
+
interface FileInfo {
|
|
594
|
+
id: string;
|
|
595
|
+
mediaType: string;
|
|
596
|
+
url: string;
|
|
597
|
+
filename?: string;
|
|
598
|
+
size?: number;
|
|
599
|
+
toolCallId?: string;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Object info for structured output (internal storage)
|
|
603
|
+
*/
|
|
604
|
+
interface ObjectInfo {
|
|
605
|
+
id: string;
|
|
606
|
+
/** Type name from the protocol */
|
|
607
|
+
typeName: string;
|
|
608
|
+
/** The structured object value */
|
|
609
|
+
value: unknown;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Operation info for block operations (internal storage).
|
|
613
|
+
* Used for operations like set-resource, serialize-thread, etc.
|
|
614
|
+
*/
|
|
615
|
+
interface OperationInfo {
|
|
616
|
+
/** Operation ID (same as block ID) */
|
|
617
|
+
id: string;
|
|
618
|
+
/** Human-readable name (from block name/description) */
|
|
619
|
+
name: string;
|
|
620
|
+
/** Type of operation (e.g., 'set-resource', 'serialize-thread') */
|
|
621
|
+
operationType: string;
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Worker part info for worker execution (internal storage).
|
|
625
|
+
* Stores nested parts generated by a worker, enabling parallel workers
|
|
626
|
+
* and persistence across page refresh.
|
|
627
|
+
*/
|
|
628
|
+
interface WorkerPartInfo {
|
|
629
|
+
/** Unique ID for this worker invocation (also used as session ID for debug) */
|
|
630
|
+
workerId: string;
|
|
631
|
+
/** The worker's slug (agent identifier) */
|
|
632
|
+
workerSlug: string;
|
|
633
|
+
/** Display description for the worker */
|
|
634
|
+
description?: string;
|
|
635
|
+
/** Nested parts generated by the worker (text, reasoning, tool calls, etc.) */
|
|
636
|
+
nestedParts: MessagePart[];
|
|
637
|
+
/** Worker output value (when completed) */
|
|
638
|
+
output?: unknown;
|
|
639
|
+
/** Error message if worker failed */
|
|
640
|
+
error?: string;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* A single part of a message, stored in order for proper display (internal)
|
|
644
|
+
*/
|
|
645
|
+
interface MessagePart {
|
|
646
|
+
type: MessagePartType;
|
|
647
|
+
/** Whether shown in chat UI (false = LLM sees it, user doesn't) */
|
|
648
|
+
visible: boolean;
|
|
649
|
+
/** Content for text/reasoning parts */
|
|
650
|
+
content?: string;
|
|
651
|
+
/** Tool call info for tool-call parts */
|
|
652
|
+
toolCall?: ToolCallInfo;
|
|
653
|
+
/** Operation info for operation parts (block operations) */
|
|
654
|
+
operation?: OperationInfo;
|
|
655
|
+
/** Source info for source parts (from web search, etc.) */
|
|
656
|
+
source?: SourceInfo;
|
|
657
|
+
/** File info for file parts (from skill execution, etc.) */
|
|
658
|
+
file?: FileInfo;
|
|
659
|
+
/** Object info for object parts (structured output) */
|
|
660
|
+
object?: ObjectInfo;
|
|
661
|
+
/** Worker info for worker parts (worker execution container) */
|
|
662
|
+
worker?: WorkerPartInfo;
|
|
663
|
+
/** Thread name for non-main-thread content (e.g., "summary") */
|
|
664
|
+
thread?: string;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Tool result entry for tool continuation messages.
|
|
668
|
+
* Used internally when injecting tool results back into conversation history.
|
|
669
|
+
*/
|
|
670
|
+
interface ToolResultEntry {
|
|
671
|
+
toolCallId: string;
|
|
672
|
+
toolName?: string;
|
|
673
|
+
result: unknown;
|
|
674
|
+
/** Files produced by the tool, included as visual content for the LLM. */
|
|
675
|
+
files?: FileReference[];
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Internal chat message - stored in session state, used by LLM
|
|
679
|
+
*/
|
|
680
|
+
interface ChatMessage {
|
|
681
|
+
id: string;
|
|
682
|
+
role: MessageRole;
|
|
683
|
+
/** Ordered parts for display - preserves reasoning/tool/text order */
|
|
684
|
+
parts: MessagePart[];
|
|
685
|
+
createdAt: string;
|
|
686
|
+
/**
|
|
687
|
+
* Whether shown in chat UI (false = LLM sees it, user doesn't).
|
|
688
|
+
* Use for internal directives. Different from `display` which controls execution indicator.
|
|
689
|
+
* @default true
|
|
690
|
+
*/
|
|
691
|
+
visible?: boolean;
|
|
692
|
+
content: string;
|
|
693
|
+
toolCalls?: ToolCallInfo[];
|
|
694
|
+
reasoning?: string;
|
|
695
|
+
/** Required by Anthropic to verify reasoning blocks */
|
|
696
|
+
reasoningSignature?: string;
|
|
697
|
+
/**
|
|
698
|
+
* Tool results for continuation messages.
|
|
699
|
+
* When present, this message represents tool results being injected back
|
|
700
|
+
* into the conversation (converted to role: 'tool' for the AI SDK).
|
|
701
|
+
*/
|
|
702
|
+
toolResults?: ToolResultEntry[];
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Status of a UI message
|
|
706
|
+
*/
|
|
707
|
+
type UIMessageStatus = 'streaming' | 'done';
|
|
708
|
+
/**
|
|
709
|
+
* Status of a UI message part
|
|
710
|
+
*/
|
|
711
|
+
type UIPartStatus = 'streaming' | 'done';
|
|
712
|
+
/**
|
|
713
|
+
* Text content in a UI message
|
|
714
|
+
*/
|
|
715
|
+
interface UITextPart {
|
|
716
|
+
type: 'text';
|
|
717
|
+
text: string;
|
|
718
|
+
status: UIPartStatus;
|
|
719
|
+
/** Thread name (undefined or 'main' for main thread) */
|
|
720
|
+
thread?: string;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Reasoning/thinking content in a UI message
|
|
724
|
+
*/
|
|
725
|
+
interface UIReasoningPart {
|
|
726
|
+
type: 'reasoning';
|
|
727
|
+
text: string;
|
|
728
|
+
status: UIPartStatus;
|
|
729
|
+
/** Thread name (undefined or 'main' for main thread) */
|
|
730
|
+
thread?: string;
|
|
731
|
+
/**
|
|
732
|
+
* Provider-specific metadata for this reasoning block.
|
|
733
|
+
* Used to preserve cryptographic signatures across session restore.
|
|
734
|
+
* e.g. `{ anthropic: { signature: "..." } }`
|
|
735
|
+
*/
|
|
736
|
+
providerMetadata?: Record<string, unknown>;
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Tool call status for UI
|
|
740
|
+
*/
|
|
741
|
+
type UIToolCallStatus = 'pending' | 'running' | 'done' | 'error' | 'cancelled';
|
|
742
|
+
/**
|
|
743
|
+
* Tool call in a UI message
|
|
744
|
+
*/
|
|
745
|
+
interface UIToolCallPart {
|
|
746
|
+
type: 'tool-call';
|
|
747
|
+
toolCallId: string;
|
|
748
|
+
toolName: string;
|
|
749
|
+
/** Human-readable display name (from protocol description) */
|
|
750
|
+
displayName?: string;
|
|
751
|
+
args: Record<string, unknown>;
|
|
752
|
+
result?: unknown;
|
|
753
|
+
error?: string;
|
|
754
|
+
status: UIToolCallStatus;
|
|
755
|
+
/** Thread name (undefined or 'main' for main thread) */
|
|
756
|
+
thread?: string;
|
|
757
|
+
/**
|
|
758
|
+
* Provider-specific metadata for this tool call.
|
|
759
|
+
* Used to preserve cryptographic signatures across session restore.
|
|
760
|
+
* e.g. `{ google: { thoughtSignature: "..." } }`
|
|
761
|
+
*/
|
|
762
|
+
providerMetadata?: Record<string, unknown>;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Operation status for UI
|
|
766
|
+
*/
|
|
767
|
+
type UIOperationStatus = 'running' | 'done' | 'cancelled';
|
|
768
|
+
/**
|
|
769
|
+
* Internal operation in a UI message (e.g., set-resource, serialize-thread)
|
|
770
|
+
* These are Octavus-specific operations, not LLM tool calls
|
|
771
|
+
*/
|
|
772
|
+
interface UIOperationPart {
|
|
773
|
+
type: 'operation';
|
|
774
|
+
operationId: string;
|
|
775
|
+
/** Human-readable name (from block name/description) */
|
|
776
|
+
name: string;
|
|
777
|
+
/** Type of operation (e.g., 'set-resource', 'serialize-thread') */
|
|
778
|
+
operationType: string;
|
|
779
|
+
status: UIOperationStatus;
|
|
780
|
+
/** Thread name (undefined or 'main' for main thread) */
|
|
781
|
+
thread?: string;
|
|
782
|
+
}
|
|
783
|
+
/** Base UI source part fields */
|
|
784
|
+
interface BaseUISourcePart {
|
|
785
|
+
type: 'source';
|
|
786
|
+
/** The ID of the source */
|
|
787
|
+
id: string;
|
|
788
|
+
/** Thread name (undefined or 'main' for main thread) */
|
|
789
|
+
thread?: string;
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* URL source part (from web search results)
|
|
793
|
+
*/
|
|
794
|
+
interface UISourceUrlPart extends BaseUISourcePart {
|
|
795
|
+
sourceType: 'url';
|
|
796
|
+
url: string;
|
|
797
|
+
title?: string;
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Document source part (from file processing)
|
|
801
|
+
*/
|
|
802
|
+
interface UISourceDocumentPart extends BaseUISourcePart {
|
|
803
|
+
sourceType: 'document';
|
|
804
|
+
mediaType: string;
|
|
805
|
+
title: string;
|
|
806
|
+
filename?: string;
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Source part - union of all source types
|
|
810
|
+
*/
|
|
811
|
+
type UISourcePart = UISourceUrlPart | UISourceDocumentPart;
|
|
812
|
+
/**
|
|
813
|
+
* File attachment part.
|
|
814
|
+
* Generated by skill execution, image generation, code execution, etc.
|
|
815
|
+
*/
|
|
816
|
+
interface UIFilePart {
|
|
817
|
+
type: 'file';
|
|
818
|
+
/** Unique file ID */
|
|
819
|
+
id: string;
|
|
820
|
+
/** MIME type (e.g., 'image/png', 'application/pdf') */
|
|
821
|
+
mediaType: string;
|
|
822
|
+
/** URL for download/display */
|
|
823
|
+
url: string;
|
|
824
|
+
/** Original filename (for display/download) */
|
|
825
|
+
filename?: string;
|
|
826
|
+
/** Size in bytes */
|
|
827
|
+
size?: number;
|
|
828
|
+
/** Tool call that generated this file */
|
|
829
|
+
toolCallId?: string;
|
|
830
|
+
/** Thread name (undefined or 'main' for main thread) */
|
|
831
|
+
thread?: string;
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Status of a UI object part
|
|
835
|
+
*/
|
|
836
|
+
type UIObjectStatus = 'streaming' | 'done' | 'error';
|
|
837
|
+
/**
|
|
838
|
+
* Structured object part in a UI message.
|
|
839
|
+
* Used when the agent response is a typed object (structured output).
|
|
840
|
+
* Client applications can render custom UI based on the typeName.
|
|
841
|
+
*/
|
|
842
|
+
interface UIObjectPart {
|
|
843
|
+
type: 'object';
|
|
844
|
+
/** Unique part ID */
|
|
845
|
+
id: string;
|
|
846
|
+
/** The type name from the protocol (e.g., "ChatResponse") */
|
|
847
|
+
typeName: string;
|
|
848
|
+
/** Partial object while streaming (may have missing/incomplete fields) */
|
|
849
|
+
partial?: unknown;
|
|
850
|
+
/** Final validated object when done */
|
|
851
|
+
object?: unknown;
|
|
852
|
+
/** Current status */
|
|
853
|
+
status: UIObjectStatus;
|
|
854
|
+
/** Error message if status is 'error' */
|
|
855
|
+
error?: string;
|
|
856
|
+
/** Thread name (undefined or 'main' for main thread) */
|
|
857
|
+
thread?: string;
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Status of a UI worker part
|
|
861
|
+
*/
|
|
862
|
+
type UIWorkerStatus = 'running' | 'done' | 'error';
|
|
863
|
+
/**
|
|
864
|
+
* Worker execution in a UI message.
|
|
865
|
+
* Represents a nested worker agent execution with its own parts.
|
|
866
|
+
* Used to display worker content in a dedicated container.
|
|
867
|
+
*/
|
|
868
|
+
interface UIWorkerPart {
|
|
869
|
+
type: 'worker';
|
|
870
|
+
/** Unique ID for this worker invocation (correlates events, also used as session ID for debug) */
|
|
871
|
+
workerId: string;
|
|
872
|
+
/** The worker's slug (agent identifier) */
|
|
873
|
+
workerSlug: string;
|
|
874
|
+
/** Display description for the worker */
|
|
875
|
+
description?: string;
|
|
876
|
+
/** Nested parts generated by the worker */
|
|
877
|
+
parts: UIMessagePart[];
|
|
878
|
+
/** Worker output value (when done) */
|
|
879
|
+
output?: unknown;
|
|
880
|
+
/** Error message if worker failed */
|
|
881
|
+
error?: string;
|
|
882
|
+
/** Current status */
|
|
883
|
+
status: UIWorkerStatus;
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Union of all UI message part types
|
|
887
|
+
*/
|
|
888
|
+
type UIMessagePart = UITextPart | UIReasoningPart | UIToolCallPart | UIOperationPart | UISourcePart | UIFilePart | UIObjectPart | UIWorkerPart;
|
|
889
|
+
/**
|
|
890
|
+
* UI Message - the client-facing message format
|
|
891
|
+
* All complexity is handled by the SDK, this is what consumers render
|
|
892
|
+
*/
|
|
893
|
+
interface UIMessage {
|
|
894
|
+
id: string;
|
|
895
|
+
role: 'user' | 'assistant';
|
|
896
|
+
parts: UIMessagePart[];
|
|
897
|
+
status: UIMessageStatus;
|
|
898
|
+
createdAt: Date;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* Options for creating an error event.
|
|
903
|
+
*/
|
|
904
|
+
interface CreateErrorEventOptions {
|
|
905
|
+
errorType: ErrorType;
|
|
906
|
+
message: string;
|
|
907
|
+
source: ErrorSource;
|
|
908
|
+
retryable?: boolean;
|
|
909
|
+
retryAfter?: number;
|
|
910
|
+
code?: string;
|
|
911
|
+
provider?: ProviderErrorInfo;
|
|
912
|
+
tool?: ToolErrorInfo;
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Create an ErrorEvent from options.
|
|
916
|
+
* Use this for constructing error events in streaming responses.
|
|
917
|
+
*/
|
|
918
|
+
declare function createErrorEvent(options: CreateErrorEventOptions): ErrorEvent;
|
|
919
|
+
/**
|
|
920
|
+
* Create an ErrorEvent from an OctavusError.
|
|
921
|
+
*/
|
|
922
|
+
declare function errorToStreamEvent(error: OctavusError): ErrorEvent;
|
|
923
|
+
/**
|
|
924
|
+
* Create an internal error event.
|
|
925
|
+
* Convenience function for platform-level errors.
|
|
926
|
+
*/
|
|
927
|
+
declare function createInternalErrorEvent(message: string): ErrorEvent;
|
|
928
|
+
/**
|
|
929
|
+
* Create an error event from an API response.
|
|
930
|
+
* Maps HTTP status codes to appropriate error types.
|
|
931
|
+
*
|
|
932
|
+
* Use this when handling errors from API responses (before streaming starts).
|
|
933
|
+
*
|
|
934
|
+
* @param statusCode - HTTP status code from the response
|
|
935
|
+
* @param message - Error message to display
|
|
936
|
+
*/
|
|
937
|
+
declare function createApiErrorEvent(statusCode: number, message: string): ErrorEvent;
|
|
938
|
+
|
|
939
|
+
/**
|
|
940
|
+
* Generate a unique ID for messages, tool calls, etc.
|
|
941
|
+
* Format: timestamp-random (e.g., "1702345678901-abc123def")
|
|
942
|
+
*/
|
|
943
|
+
declare function generateId(): string;
|
|
944
|
+
/**
|
|
945
|
+
* Check if an error is an abort error.
|
|
946
|
+
*
|
|
947
|
+
* This handles the various ways abort errors can manifest across different
|
|
948
|
+
* environments (browsers, Node.js, Next.js, etc.).
|
|
949
|
+
*
|
|
950
|
+
* @param error - The error to check
|
|
951
|
+
* @returns True if the error is an abort error
|
|
952
|
+
*/
|
|
953
|
+
declare function isAbortError(error: unknown): error is Error;
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* Default thread name when none is specified.
|
|
957
|
+
*/
|
|
958
|
+
declare const MAIN_THREAD: "main";
|
|
959
|
+
/**
|
|
960
|
+
* Resolve a thread name, defaulting to main thread.
|
|
961
|
+
*/
|
|
962
|
+
declare function resolveThread(thread: string | undefined): string;
|
|
963
|
+
/**
|
|
964
|
+
* Check if a thread is the main thread.
|
|
965
|
+
*/
|
|
966
|
+
declare function isMainThread(thread: string | undefined): boolean;
|
|
967
|
+
/**
|
|
968
|
+
* Normalize thread for storage in message parts.
|
|
969
|
+
* Main thread is stored as undefined to save space.
|
|
970
|
+
*/
|
|
971
|
+
declare function threadForPart(thread: string | undefined): string | undefined;
|
|
972
|
+
/**
|
|
973
|
+
* Check if a message part belongs to a non-main thread.
|
|
974
|
+
* Non-main thread content (e.g., "summary") is typically displayed differently.
|
|
975
|
+
*/
|
|
976
|
+
declare function isOtherThread(part: {
|
|
977
|
+
thread?: string;
|
|
978
|
+
}): boolean;
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* Zod schemas for stream events.
|
|
982
|
+
*
|
|
983
|
+
* Schemas are organized into two categories:
|
|
984
|
+
* - Standard Events (====): Common streaming patterns for AI agents
|
|
985
|
+
* - Octavus Events (----): Octavus-specific protocol events
|
|
986
|
+
*/
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* Schema for file references used in trigger input, user messages, and tool results.
|
|
990
|
+
*/
|
|
991
|
+
declare const fileReferenceSchema: z.ZodObject<{
|
|
992
|
+
id: z.ZodString;
|
|
993
|
+
mediaType: z.ZodString;
|
|
994
|
+
url: z.ZodString;
|
|
995
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
996
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
997
|
+
}, z.core.$strip>;
|
|
998
|
+
declare const toolResultSchema: z.ZodObject<{
|
|
999
|
+
toolCallId: z.ZodString;
|
|
1000
|
+
toolName: z.ZodOptional<z.ZodString>;
|
|
1001
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
1002
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1003
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1004
|
+
id: z.ZodString;
|
|
1005
|
+
mediaType: z.ZodString;
|
|
1006
|
+
url: z.ZodString;
|
|
1007
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1008
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
1009
|
+
}, z.core.$strip>>>;
|
|
1010
|
+
outputVariable: z.ZodOptional<z.ZodString>;
|
|
1011
|
+
blockIndex: z.ZodOptional<z.ZodNumber>;
|
|
1012
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1013
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
1014
|
+
}, z.core.$strip>;
|
|
1015
|
+
declare const chatMessageSchema: z.ZodObject<{
|
|
1016
|
+
id: z.ZodString;
|
|
1017
|
+
role: z.ZodEnum<{
|
|
1018
|
+
user: "user";
|
|
1019
|
+
assistant: "assistant";
|
|
1020
|
+
system: "system";
|
|
1021
|
+
}>;
|
|
1022
|
+
parts: z.ZodArray<z.ZodObject<{
|
|
1023
|
+
type: z.ZodEnum<{
|
|
1024
|
+
object: "object";
|
|
1025
|
+
source: "source";
|
|
1026
|
+
text: "text";
|
|
1027
|
+
reasoning: "reasoning";
|
|
1028
|
+
"tool-call": "tool-call";
|
|
1029
|
+
operation: "operation";
|
|
1030
|
+
file: "file";
|
|
1031
|
+
worker: "worker";
|
|
1032
|
+
}>;
|
|
1033
|
+
visible: z.ZodBoolean;
|
|
1034
|
+
content: z.ZodOptional<z.ZodString>;
|
|
1035
|
+
toolCall: z.ZodOptional<z.ZodObject<{
|
|
1036
|
+
id: z.ZodString;
|
|
1037
|
+
name: z.ZodString;
|
|
1038
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1039
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1040
|
+
status: z.ZodEnum<{
|
|
1041
|
+
pending: "pending";
|
|
1042
|
+
streaming: "streaming";
|
|
1043
|
+
available: "available";
|
|
1044
|
+
error: "error";
|
|
1045
|
+
}>;
|
|
1046
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
1047
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1048
|
+
thoughtSignature: z.ZodOptional<z.ZodString>;
|
|
1049
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
1050
|
+
name: "name";
|
|
1051
|
+
hidden: "hidden";
|
|
1052
|
+
description: "description";
|
|
1053
|
+
stream: "stream";
|
|
1054
|
+
}>>;
|
|
1055
|
+
}, z.core.$strip>>;
|
|
1056
|
+
operation: z.ZodOptional<z.ZodObject<{
|
|
1057
|
+
id: z.ZodString;
|
|
1058
|
+
name: z.ZodString;
|
|
1059
|
+
operationType: z.ZodString;
|
|
1060
|
+
}, z.core.$strip>>;
|
|
1061
|
+
source: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1062
|
+
sourceType: z.ZodLiteral<"url">;
|
|
1063
|
+
id: z.ZodString;
|
|
1064
|
+
url: z.ZodString;
|
|
1065
|
+
title: z.ZodOptional<z.ZodString>;
|
|
1066
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1067
|
+
sourceType: z.ZodLiteral<"document">;
|
|
1068
|
+
id: z.ZodString;
|
|
1069
|
+
mediaType: z.ZodString;
|
|
1070
|
+
title: z.ZodString;
|
|
1071
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1072
|
+
}, z.core.$strip>], "sourceType">>;
|
|
1073
|
+
file: z.ZodOptional<z.ZodObject<{
|
|
1074
|
+
id: z.ZodString;
|
|
1075
|
+
mediaType: z.ZodString;
|
|
1076
|
+
url: z.ZodString;
|
|
1077
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1078
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
1079
|
+
toolCallId: z.ZodOptional<z.ZodString>;
|
|
1080
|
+
}, z.core.$strip>>;
|
|
1081
|
+
object: z.ZodOptional<z.ZodObject<{
|
|
1082
|
+
id: z.ZodString;
|
|
1083
|
+
typeName: z.ZodString;
|
|
1084
|
+
value: z.ZodUnknown;
|
|
1085
|
+
}, z.core.$strip>>;
|
|
1086
|
+
worker: z.ZodOptional<z.ZodObject<{
|
|
1087
|
+
workerId: z.ZodString;
|
|
1088
|
+
workerSlug: z.ZodString;
|
|
1089
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1090
|
+
nestedParts: z.ZodArray<z.ZodObject<{
|
|
1091
|
+
type: z.ZodEnum<{
|
|
1092
|
+
object: "object";
|
|
1093
|
+
source: "source";
|
|
1094
|
+
text: "text";
|
|
1095
|
+
reasoning: "reasoning";
|
|
1096
|
+
"tool-call": "tool-call";
|
|
1097
|
+
operation: "operation";
|
|
1098
|
+
file: "file";
|
|
1099
|
+
}>;
|
|
1100
|
+
visible: z.ZodBoolean;
|
|
1101
|
+
content: z.ZodOptional<z.ZodString>;
|
|
1102
|
+
toolCall: z.ZodOptional<z.ZodObject<{
|
|
1103
|
+
id: z.ZodString;
|
|
1104
|
+
name: z.ZodString;
|
|
1105
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1106
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1107
|
+
status: z.ZodEnum<{
|
|
1108
|
+
pending: "pending";
|
|
1109
|
+
streaming: "streaming";
|
|
1110
|
+
available: "available";
|
|
1111
|
+
error: "error";
|
|
1112
|
+
}>;
|
|
1113
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
1114
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1115
|
+
thoughtSignature: z.ZodOptional<z.ZodString>;
|
|
1116
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
1117
|
+
name: "name";
|
|
1118
|
+
hidden: "hidden";
|
|
1119
|
+
description: "description";
|
|
1120
|
+
stream: "stream";
|
|
1121
|
+
}>>;
|
|
1122
|
+
}, z.core.$strip>>;
|
|
1123
|
+
operation: z.ZodOptional<z.ZodObject<{
|
|
1124
|
+
id: z.ZodString;
|
|
1125
|
+
name: z.ZodString;
|
|
1126
|
+
operationType: z.ZodString;
|
|
1127
|
+
}, z.core.$strip>>;
|
|
1128
|
+
source: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1129
|
+
sourceType: z.ZodLiteral<"url">;
|
|
1130
|
+
id: z.ZodString;
|
|
1131
|
+
url: z.ZodString;
|
|
1132
|
+
title: z.ZodOptional<z.ZodString>;
|
|
1133
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1134
|
+
sourceType: z.ZodLiteral<"document">;
|
|
1135
|
+
id: z.ZodString;
|
|
1136
|
+
mediaType: z.ZodString;
|
|
1137
|
+
title: z.ZodString;
|
|
1138
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1139
|
+
}, z.core.$strip>], "sourceType">>;
|
|
1140
|
+
file: z.ZodOptional<z.ZodObject<{
|
|
1141
|
+
id: z.ZodString;
|
|
1142
|
+
mediaType: z.ZodString;
|
|
1143
|
+
url: z.ZodString;
|
|
1144
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1145
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
1146
|
+
toolCallId: z.ZodOptional<z.ZodString>;
|
|
1147
|
+
}, z.core.$strip>>;
|
|
1148
|
+
object: z.ZodOptional<z.ZodObject<{
|
|
1149
|
+
id: z.ZodString;
|
|
1150
|
+
typeName: z.ZodString;
|
|
1151
|
+
value: z.ZodUnknown;
|
|
1152
|
+
}, z.core.$strip>>;
|
|
1153
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1154
|
+
}, z.core.$strip>>;
|
|
1155
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
1156
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1157
|
+
}, z.core.$strip>>;
|
|
1158
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1159
|
+
}, z.core.$strip>>;
|
|
1160
|
+
createdAt: z.ZodString;
|
|
1161
|
+
visible: z.ZodOptional<z.ZodBoolean>;
|
|
1162
|
+
content: z.ZodString;
|
|
1163
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1164
|
+
id: z.ZodString;
|
|
1165
|
+
name: z.ZodString;
|
|
1166
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1167
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1168
|
+
status: z.ZodEnum<{
|
|
1169
|
+
pending: "pending";
|
|
1170
|
+
streaming: "streaming";
|
|
1171
|
+
available: "available";
|
|
1172
|
+
error: "error";
|
|
1173
|
+
}>;
|
|
1174
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
1175
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1176
|
+
thoughtSignature: z.ZodOptional<z.ZodString>;
|
|
1177
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
1178
|
+
name: "name";
|
|
1179
|
+
hidden: "hidden";
|
|
1180
|
+
description: "description";
|
|
1181
|
+
stream: "stream";
|
|
1182
|
+
}>>;
|
|
1183
|
+
}, z.core.$strip>>>;
|
|
1184
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
1185
|
+
reasoningSignature: z.ZodOptional<z.ZodString>;
|
|
1186
|
+
}, z.core.$strip>;
|
|
1187
|
+
declare const uiWorkerStatusSchema: z.ZodEnum<{
|
|
1188
|
+
error: "error";
|
|
1189
|
+
done: "done";
|
|
1190
|
+
running: "running";
|
|
1191
|
+
}>;
|
|
1192
|
+
declare const uiWorkerPartSchema: z.ZodObject<{
|
|
1193
|
+
type: z.ZodLiteral<"worker">;
|
|
1194
|
+
workerId: z.ZodString;
|
|
1195
|
+
workerSlug: z.ZodString;
|
|
1196
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1197
|
+
parts: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1198
|
+
type: z.ZodLiteral<"text">;
|
|
1199
|
+
text: z.ZodString;
|
|
1200
|
+
status: z.ZodEnum<{
|
|
1201
|
+
streaming: "streaming";
|
|
1202
|
+
done: "done";
|
|
1203
|
+
}>;
|
|
1204
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1205
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1206
|
+
type: z.ZodLiteral<"reasoning">;
|
|
1207
|
+
text: z.ZodString;
|
|
1208
|
+
status: z.ZodEnum<{
|
|
1209
|
+
streaming: "streaming";
|
|
1210
|
+
done: "done";
|
|
1211
|
+
}>;
|
|
1212
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1213
|
+
providerMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1214
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1215
|
+
type: z.ZodLiteral<"tool-call">;
|
|
1216
|
+
toolCallId: z.ZodString;
|
|
1217
|
+
toolName: z.ZodString;
|
|
1218
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
1219
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1220
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
1221
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1222
|
+
status: z.ZodEnum<{
|
|
1223
|
+
pending: "pending";
|
|
1224
|
+
error: "error";
|
|
1225
|
+
done: "done";
|
|
1226
|
+
running: "running";
|
|
1227
|
+
}>;
|
|
1228
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1229
|
+
providerMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1230
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1231
|
+
type: z.ZodLiteral<"operation">;
|
|
1232
|
+
operationId: z.ZodString;
|
|
1233
|
+
name: z.ZodString;
|
|
1234
|
+
operationType: z.ZodString;
|
|
1235
|
+
status: z.ZodEnum<{
|
|
1236
|
+
done: "done";
|
|
1237
|
+
running: "running";
|
|
1238
|
+
}>;
|
|
1239
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1240
|
+
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1241
|
+
type: z.ZodLiteral<"source">;
|
|
1242
|
+
sourceType: z.ZodLiteral<"url">;
|
|
1243
|
+
id: z.ZodString;
|
|
1244
|
+
url: z.ZodString;
|
|
1245
|
+
title: z.ZodOptional<z.ZodString>;
|
|
1246
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1247
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1248
|
+
type: z.ZodLiteral<"source">;
|
|
1249
|
+
sourceType: z.ZodLiteral<"document">;
|
|
1250
|
+
id: z.ZodString;
|
|
1251
|
+
mediaType: z.ZodString;
|
|
1252
|
+
title: z.ZodString;
|
|
1253
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1254
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1255
|
+
}, z.core.$strip>], "sourceType">, z.ZodObject<{
|
|
1256
|
+
type: z.ZodLiteral<"file">;
|
|
1257
|
+
id: z.ZodString;
|
|
1258
|
+
mediaType: z.ZodString;
|
|
1259
|
+
url: z.ZodString;
|
|
1260
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1261
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
1262
|
+
toolCallId: z.ZodOptional<z.ZodString>;
|
|
1263
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1264
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1265
|
+
type: z.ZodLiteral<"object">;
|
|
1266
|
+
id: z.ZodString;
|
|
1267
|
+
typeName: z.ZodString;
|
|
1268
|
+
partial: z.ZodOptional<z.ZodUnknown>;
|
|
1269
|
+
object: z.ZodOptional<z.ZodUnknown>;
|
|
1270
|
+
status: z.ZodEnum<{
|
|
1271
|
+
streaming: "streaming";
|
|
1272
|
+
error: "error";
|
|
1273
|
+
done: "done";
|
|
1274
|
+
}>;
|
|
1275
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1276
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1277
|
+
}, z.core.$strip>]>>;
|
|
1278
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
1279
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1280
|
+
status: z.ZodEnum<{
|
|
1281
|
+
error: "error";
|
|
1282
|
+
done: "done";
|
|
1283
|
+
running: "running";
|
|
1284
|
+
}>;
|
|
1285
|
+
}, z.core.$strip>;
|
|
1286
|
+
declare const uiMessagePartSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
1287
|
+
type: z.ZodLiteral<"text">;
|
|
1288
|
+
text: z.ZodString;
|
|
1289
|
+
status: z.ZodEnum<{
|
|
1290
|
+
streaming: "streaming";
|
|
1291
|
+
done: "done";
|
|
1292
|
+
}>;
|
|
1293
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1294
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1295
|
+
type: z.ZodLiteral<"reasoning">;
|
|
1296
|
+
text: z.ZodString;
|
|
1297
|
+
status: z.ZodEnum<{
|
|
1298
|
+
streaming: "streaming";
|
|
1299
|
+
done: "done";
|
|
1300
|
+
}>;
|
|
1301
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1302
|
+
providerMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1303
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1304
|
+
type: z.ZodLiteral<"tool-call">;
|
|
1305
|
+
toolCallId: z.ZodString;
|
|
1306
|
+
toolName: z.ZodString;
|
|
1307
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
1308
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1309
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
1310
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1311
|
+
status: z.ZodEnum<{
|
|
1312
|
+
pending: "pending";
|
|
1313
|
+
error: "error";
|
|
1314
|
+
done: "done";
|
|
1315
|
+
running: "running";
|
|
1316
|
+
}>;
|
|
1317
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1318
|
+
providerMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1319
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1320
|
+
type: z.ZodLiteral<"operation">;
|
|
1321
|
+
operationId: z.ZodString;
|
|
1322
|
+
name: z.ZodString;
|
|
1323
|
+
operationType: z.ZodString;
|
|
1324
|
+
status: z.ZodEnum<{
|
|
1325
|
+
done: "done";
|
|
1326
|
+
running: "running";
|
|
1327
|
+
}>;
|
|
1328
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1329
|
+
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1330
|
+
type: z.ZodLiteral<"source">;
|
|
1331
|
+
sourceType: z.ZodLiteral<"url">;
|
|
1332
|
+
id: z.ZodString;
|
|
1333
|
+
url: z.ZodString;
|
|
1334
|
+
title: z.ZodOptional<z.ZodString>;
|
|
1335
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1336
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1337
|
+
type: z.ZodLiteral<"source">;
|
|
1338
|
+
sourceType: z.ZodLiteral<"document">;
|
|
1339
|
+
id: z.ZodString;
|
|
1340
|
+
mediaType: z.ZodString;
|
|
1341
|
+
title: z.ZodString;
|
|
1342
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1343
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1344
|
+
}, z.core.$strip>], "sourceType">, z.ZodObject<{
|
|
1345
|
+
type: z.ZodLiteral<"file">;
|
|
1346
|
+
id: z.ZodString;
|
|
1347
|
+
mediaType: z.ZodString;
|
|
1348
|
+
url: z.ZodString;
|
|
1349
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1350
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
1351
|
+
toolCallId: z.ZodOptional<z.ZodString>;
|
|
1352
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1353
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1354
|
+
type: z.ZodLiteral<"object">;
|
|
1355
|
+
id: z.ZodString;
|
|
1356
|
+
typeName: z.ZodString;
|
|
1357
|
+
partial: z.ZodOptional<z.ZodUnknown>;
|
|
1358
|
+
object: z.ZodOptional<z.ZodUnknown>;
|
|
1359
|
+
status: z.ZodEnum<{
|
|
1360
|
+
streaming: "streaming";
|
|
1361
|
+
error: "error";
|
|
1362
|
+
done: "done";
|
|
1363
|
+
}>;
|
|
1364
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1365
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1366
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1367
|
+
type: z.ZodLiteral<"worker">;
|
|
1368
|
+
workerId: z.ZodString;
|
|
1369
|
+
workerSlug: z.ZodString;
|
|
1370
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1371
|
+
parts: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1372
|
+
type: z.ZodLiteral<"text">;
|
|
1373
|
+
text: z.ZodString;
|
|
1374
|
+
status: z.ZodEnum<{
|
|
1375
|
+
streaming: "streaming";
|
|
1376
|
+
done: "done";
|
|
1377
|
+
}>;
|
|
1378
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1379
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1380
|
+
type: z.ZodLiteral<"reasoning">;
|
|
1381
|
+
text: z.ZodString;
|
|
1382
|
+
status: z.ZodEnum<{
|
|
1383
|
+
streaming: "streaming";
|
|
1384
|
+
done: "done";
|
|
1385
|
+
}>;
|
|
1386
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1387
|
+
providerMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1388
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1389
|
+
type: z.ZodLiteral<"tool-call">;
|
|
1390
|
+
toolCallId: z.ZodString;
|
|
1391
|
+
toolName: z.ZodString;
|
|
1392
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
1393
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1394
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
1395
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1396
|
+
status: z.ZodEnum<{
|
|
1397
|
+
pending: "pending";
|
|
1398
|
+
error: "error";
|
|
1399
|
+
done: "done";
|
|
1400
|
+
running: "running";
|
|
1401
|
+
}>;
|
|
1402
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1403
|
+
providerMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1404
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1405
|
+
type: z.ZodLiteral<"operation">;
|
|
1406
|
+
operationId: z.ZodString;
|
|
1407
|
+
name: z.ZodString;
|
|
1408
|
+
operationType: z.ZodString;
|
|
1409
|
+
status: z.ZodEnum<{
|
|
1410
|
+
done: "done";
|
|
1411
|
+
running: "running";
|
|
1412
|
+
}>;
|
|
1413
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1414
|
+
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1415
|
+
type: z.ZodLiteral<"source">;
|
|
1416
|
+
sourceType: z.ZodLiteral<"url">;
|
|
1417
|
+
id: z.ZodString;
|
|
1418
|
+
url: z.ZodString;
|
|
1419
|
+
title: z.ZodOptional<z.ZodString>;
|
|
1420
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1421
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1422
|
+
type: z.ZodLiteral<"source">;
|
|
1423
|
+
sourceType: z.ZodLiteral<"document">;
|
|
1424
|
+
id: z.ZodString;
|
|
1425
|
+
mediaType: z.ZodString;
|
|
1426
|
+
title: z.ZodString;
|
|
1427
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1428
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1429
|
+
}, z.core.$strip>], "sourceType">, z.ZodObject<{
|
|
1430
|
+
type: z.ZodLiteral<"file">;
|
|
1431
|
+
id: z.ZodString;
|
|
1432
|
+
mediaType: z.ZodString;
|
|
1433
|
+
url: z.ZodString;
|
|
1434
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1435
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
1436
|
+
toolCallId: z.ZodOptional<z.ZodString>;
|
|
1437
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1438
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1439
|
+
type: z.ZodLiteral<"object">;
|
|
1440
|
+
id: z.ZodString;
|
|
1441
|
+
typeName: z.ZodString;
|
|
1442
|
+
partial: z.ZodOptional<z.ZodUnknown>;
|
|
1443
|
+
object: z.ZodOptional<z.ZodUnknown>;
|
|
1444
|
+
status: z.ZodEnum<{
|
|
1445
|
+
streaming: "streaming";
|
|
1446
|
+
error: "error";
|
|
1447
|
+
done: "done";
|
|
1448
|
+
}>;
|
|
1449
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1450
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1451
|
+
}, z.core.$strip>]>>;
|
|
1452
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
1453
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1454
|
+
status: z.ZodEnum<{
|
|
1455
|
+
error: "error";
|
|
1456
|
+
done: "done";
|
|
1457
|
+
running: "running";
|
|
1458
|
+
}>;
|
|
1459
|
+
}, z.core.$strip>]>;
|
|
1460
|
+
declare const uiMessageSchema: z.ZodObject<{
|
|
1461
|
+
id: z.ZodString;
|
|
1462
|
+
role: z.ZodEnum<{
|
|
1463
|
+
user: "user";
|
|
1464
|
+
assistant: "assistant";
|
|
1465
|
+
}>;
|
|
1466
|
+
parts: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1467
|
+
type: z.ZodLiteral<"text">;
|
|
1468
|
+
text: z.ZodString;
|
|
1469
|
+
status: z.ZodEnum<{
|
|
1470
|
+
streaming: "streaming";
|
|
1471
|
+
done: "done";
|
|
1472
|
+
}>;
|
|
1473
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1474
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1475
|
+
type: z.ZodLiteral<"reasoning">;
|
|
1476
|
+
text: z.ZodString;
|
|
1477
|
+
status: z.ZodEnum<{
|
|
1478
|
+
streaming: "streaming";
|
|
1479
|
+
done: "done";
|
|
1480
|
+
}>;
|
|
1481
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1482
|
+
providerMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1483
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1484
|
+
type: z.ZodLiteral<"tool-call">;
|
|
1485
|
+
toolCallId: z.ZodString;
|
|
1486
|
+
toolName: z.ZodString;
|
|
1487
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
1488
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1489
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
1490
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1491
|
+
status: z.ZodEnum<{
|
|
1492
|
+
pending: "pending";
|
|
1493
|
+
error: "error";
|
|
1494
|
+
done: "done";
|
|
1495
|
+
running: "running";
|
|
1496
|
+
}>;
|
|
1497
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1498
|
+
providerMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1499
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1500
|
+
type: z.ZodLiteral<"operation">;
|
|
1501
|
+
operationId: z.ZodString;
|
|
1502
|
+
name: z.ZodString;
|
|
1503
|
+
operationType: z.ZodString;
|
|
1504
|
+
status: z.ZodEnum<{
|
|
1505
|
+
done: "done";
|
|
1506
|
+
running: "running";
|
|
1507
|
+
}>;
|
|
1508
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1509
|
+
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1510
|
+
type: z.ZodLiteral<"source">;
|
|
1511
|
+
sourceType: z.ZodLiteral<"url">;
|
|
1512
|
+
id: z.ZodString;
|
|
1513
|
+
url: z.ZodString;
|
|
1514
|
+
title: z.ZodOptional<z.ZodString>;
|
|
1515
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1516
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1517
|
+
type: z.ZodLiteral<"source">;
|
|
1518
|
+
sourceType: z.ZodLiteral<"document">;
|
|
1519
|
+
id: z.ZodString;
|
|
1520
|
+
mediaType: z.ZodString;
|
|
1521
|
+
title: z.ZodString;
|
|
1522
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1523
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1524
|
+
}, z.core.$strip>], "sourceType">, z.ZodObject<{
|
|
1525
|
+
type: z.ZodLiteral<"file">;
|
|
1526
|
+
id: z.ZodString;
|
|
1527
|
+
mediaType: z.ZodString;
|
|
1528
|
+
url: z.ZodString;
|
|
1529
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1530
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
1531
|
+
toolCallId: z.ZodOptional<z.ZodString>;
|
|
1532
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1533
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1534
|
+
type: z.ZodLiteral<"object">;
|
|
1535
|
+
id: z.ZodString;
|
|
1536
|
+
typeName: z.ZodString;
|
|
1537
|
+
partial: z.ZodOptional<z.ZodUnknown>;
|
|
1538
|
+
object: z.ZodOptional<z.ZodUnknown>;
|
|
1539
|
+
status: z.ZodEnum<{
|
|
1540
|
+
streaming: "streaming";
|
|
1541
|
+
error: "error";
|
|
1542
|
+
done: "done";
|
|
1543
|
+
}>;
|
|
1544
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1545
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1546
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1547
|
+
type: z.ZodLiteral<"worker">;
|
|
1548
|
+
workerId: z.ZodString;
|
|
1549
|
+
workerSlug: z.ZodString;
|
|
1550
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1551
|
+
parts: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1552
|
+
type: z.ZodLiteral<"text">;
|
|
1553
|
+
text: z.ZodString;
|
|
1554
|
+
status: z.ZodEnum<{
|
|
1555
|
+
streaming: "streaming";
|
|
1556
|
+
done: "done";
|
|
1557
|
+
}>;
|
|
1558
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1559
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1560
|
+
type: z.ZodLiteral<"reasoning">;
|
|
1561
|
+
text: z.ZodString;
|
|
1562
|
+
status: z.ZodEnum<{
|
|
1563
|
+
streaming: "streaming";
|
|
1564
|
+
done: "done";
|
|
1565
|
+
}>;
|
|
1566
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1567
|
+
providerMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1568
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1569
|
+
type: z.ZodLiteral<"tool-call">;
|
|
1570
|
+
toolCallId: z.ZodString;
|
|
1571
|
+
toolName: z.ZodString;
|
|
1572
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
1573
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1574
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
1575
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1576
|
+
status: z.ZodEnum<{
|
|
1577
|
+
pending: "pending";
|
|
1578
|
+
error: "error";
|
|
1579
|
+
done: "done";
|
|
1580
|
+
running: "running";
|
|
1581
|
+
}>;
|
|
1582
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1583
|
+
providerMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1584
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1585
|
+
type: z.ZodLiteral<"operation">;
|
|
1586
|
+
operationId: z.ZodString;
|
|
1587
|
+
name: z.ZodString;
|
|
1588
|
+
operationType: z.ZodString;
|
|
1589
|
+
status: z.ZodEnum<{
|
|
1590
|
+
done: "done";
|
|
1591
|
+
running: "running";
|
|
1592
|
+
}>;
|
|
1593
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1594
|
+
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1595
|
+
type: z.ZodLiteral<"source">;
|
|
1596
|
+
sourceType: z.ZodLiteral<"url">;
|
|
1597
|
+
id: z.ZodString;
|
|
1598
|
+
url: z.ZodString;
|
|
1599
|
+
title: z.ZodOptional<z.ZodString>;
|
|
1600
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1601
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1602
|
+
type: z.ZodLiteral<"source">;
|
|
1603
|
+
sourceType: z.ZodLiteral<"document">;
|
|
1604
|
+
id: z.ZodString;
|
|
1605
|
+
mediaType: z.ZodString;
|
|
1606
|
+
title: z.ZodString;
|
|
1607
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1608
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1609
|
+
}, z.core.$strip>], "sourceType">, z.ZodObject<{
|
|
1610
|
+
type: z.ZodLiteral<"file">;
|
|
1611
|
+
id: z.ZodString;
|
|
1612
|
+
mediaType: z.ZodString;
|
|
1613
|
+
url: z.ZodString;
|
|
1614
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1615
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
1616
|
+
toolCallId: z.ZodOptional<z.ZodString>;
|
|
1617
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1618
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1619
|
+
type: z.ZodLiteral<"object">;
|
|
1620
|
+
id: z.ZodString;
|
|
1621
|
+
typeName: z.ZodString;
|
|
1622
|
+
partial: z.ZodOptional<z.ZodUnknown>;
|
|
1623
|
+
object: z.ZodOptional<z.ZodUnknown>;
|
|
1624
|
+
status: z.ZodEnum<{
|
|
1625
|
+
streaming: "streaming";
|
|
1626
|
+
error: "error";
|
|
1627
|
+
done: "done";
|
|
1628
|
+
}>;
|
|
1629
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1630
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
1631
|
+
}, z.core.$strip>]>>;
|
|
1632
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
1633
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1634
|
+
status: z.ZodEnum<{
|
|
1635
|
+
error: "error";
|
|
1636
|
+
done: "done";
|
|
1637
|
+
running: "running";
|
|
1638
|
+
}>;
|
|
1639
|
+
}, z.core.$strip>]>>;
|
|
1640
|
+
status: z.ZodEnum<{
|
|
1641
|
+
streaming: "streaming";
|
|
1642
|
+
done: "done";
|
|
1643
|
+
}>;
|
|
1644
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
1645
|
+
}, z.core.$strip>;
|
|
1646
|
+
declare function safeParseStreamEvent(data: unknown): z.ZodSafeParseResult<{
|
|
1647
|
+
type: "source";
|
|
1648
|
+
sourceType: "url";
|
|
1649
|
+
id: string;
|
|
1650
|
+
url: string;
|
|
1651
|
+
title?: string | undefined;
|
|
1652
|
+
workerId?: string | undefined;
|
|
1653
|
+
} | {
|
|
1654
|
+
type: "source";
|
|
1655
|
+
sourceType: "document";
|
|
1656
|
+
id: string;
|
|
1657
|
+
mediaType: string;
|
|
1658
|
+
title: string;
|
|
1659
|
+
filename?: string | undefined;
|
|
1660
|
+
workerId?: string | undefined;
|
|
1661
|
+
} | {
|
|
1662
|
+
type: "start";
|
|
1663
|
+
messageId?: string | undefined;
|
|
1664
|
+
executionId?: string | undefined;
|
|
1665
|
+
lastMessageId?: string | undefined;
|
|
1666
|
+
} | {
|
|
1667
|
+
type: "finish";
|
|
1668
|
+
finishReason: "error" | "stop" | "tool-calls" | "client-tool-calls" | "length" | "content-filter" | "other";
|
|
1669
|
+
executionId?: string | undefined;
|
|
1670
|
+
} | {
|
|
1671
|
+
type: "error";
|
|
1672
|
+
errorType: "authentication_error" | "permission_error" | "validation_error" | "not_found_error" | "rate_limit_error" | "quota_exceeded_error" | "provider_error" | "provider_overloaded" | "provider_timeout" | "execution_error" | "tool_error" | "protocol_error" | "internal_error" | "unknown_error";
|
|
1673
|
+
message: string;
|
|
1674
|
+
retryable: boolean;
|
|
1675
|
+
source: "platform" | "provider" | "tool" | "client";
|
|
1676
|
+
retryAfter?: number | undefined;
|
|
1677
|
+
code?: string | undefined;
|
|
1678
|
+
provider?: {
|
|
1679
|
+
name: string;
|
|
1680
|
+
model?: string | undefined;
|
|
1681
|
+
statusCode?: number | undefined;
|
|
1682
|
+
errorType?: string | undefined;
|
|
1683
|
+
requestId?: string | undefined;
|
|
1684
|
+
} | undefined;
|
|
1685
|
+
tool?: {
|
|
1686
|
+
name: string;
|
|
1687
|
+
callId?: string | undefined;
|
|
1688
|
+
} | undefined;
|
|
1689
|
+
} | {
|
|
1690
|
+
type: "text-start";
|
|
1691
|
+
id: string;
|
|
1692
|
+
responseType?: string | undefined;
|
|
1693
|
+
workerId?: string | undefined;
|
|
1694
|
+
} | {
|
|
1695
|
+
type: "text-delta";
|
|
1696
|
+
id: string;
|
|
1697
|
+
delta: string;
|
|
1698
|
+
workerId?: string | undefined;
|
|
1699
|
+
} | {
|
|
1700
|
+
type: "text-end";
|
|
1701
|
+
id: string;
|
|
1702
|
+
workerId?: string | undefined;
|
|
1703
|
+
} | {
|
|
1704
|
+
type: "reasoning-start";
|
|
1705
|
+
id: string;
|
|
1706
|
+
workerId?: string | undefined;
|
|
1707
|
+
} | {
|
|
1708
|
+
type: "reasoning-delta";
|
|
1709
|
+
id: string;
|
|
1710
|
+
delta: string;
|
|
1711
|
+
workerId?: string | undefined;
|
|
1712
|
+
} | {
|
|
1713
|
+
type: "reasoning-end";
|
|
1714
|
+
id: string;
|
|
1715
|
+
workerId?: string | undefined;
|
|
1716
|
+
} | {
|
|
1717
|
+
type: "tool-input-start";
|
|
1718
|
+
toolCallId: string;
|
|
1719
|
+
toolName: string;
|
|
1720
|
+
title?: string | undefined;
|
|
1721
|
+
workerId?: string | undefined;
|
|
1722
|
+
} | {
|
|
1723
|
+
type: "tool-input-delta";
|
|
1724
|
+
toolCallId: string;
|
|
1725
|
+
inputTextDelta: string;
|
|
1726
|
+
workerId?: string | undefined;
|
|
1727
|
+
} | {
|
|
1728
|
+
type: "tool-input-end";
|
|
1729
|
+
toolCallId: string;
|
|
1730
|
+
workerId?: string | undefined;
|
|
1731
|
+
} | {
|
|
1732
|
+
type: "tool-input-available";
|
|
1733
|
+
toolCallId: string;
|
|
1734
|
+
toolName: string;
|
|
1735
|
+
input: unknown;
|
|
1736
|
+
workerId?: string | undefined;
|
|
1737
|
+
} | {
|
|
1738
|
+
type: "tool-output-available";
|
|
1739
|
+
toolCallId: string;
|
|
1740
|
+
output: unknown;
|
|
1741
|
+
workerId?: string | undefined;
|
|
1742
|
+
} | {
|
|
1743
|
+
type: "tool-output-error";
|
|
1744
|
+
toolCallId: string;
|
|
1745
|
+
error: string;
|
|
1746
|
+
workerId?: string | undefined;
|
|
1747
|
+
} | {
|
|
1748
|
+
type: "block-start";
|
|
1749
|
+
blockId: string;
|
|
1750
|
+
blockName: string;
|
|
1751
|
+
blockType: string;
|
|
1752
|
+
display: "name" | "hidden" | "description" | "stream";
|
|
1753
|
+
description?: string | undefined;
|
|
1754
|
+
outputToChat?: boolean | undefined;
|
|
1755
|
+
thread?: string | undefined;
|
|
1756
|
+
workerId?: string | undefined;
|
|
1757
|
+
} | {
|
|
1758
|
+
type: "block-end";
|
|
1759
|
+
blockId: string;
|
|
1760
|
+
summary?: string | undefined;
|
|
1761
|
+
workerId?: string | undefined;
|
|
1762
|
+
} | {
|
|
1763
|
+
type: "resource-update";
|
|
1764
|
+
name: string;
|
|
1765
|
+
value: unknown;
|
|
1766
|
+
} | {
|
|
1767
|
+
type: "tool-request";
|
|
1768
|
+
toolCalls: {
|
|
1769
|
+
toolCallId: string;
|
|
1770
|
+
toolName: string;
|
|
1771
|
+
args: Record<string, unknown>;
|
|
1772
|
+
source?: "llm" | "block" | undefined;
|
|
1773
|
+
outputVariable?: string | undefined;
|
|
1774
|
+
blockIndex?: number | undefined;
|
|
1775
|
+
thread?: string | undefined;
|
|
1776
|
+
workerId?: string | undefined;
|
|
1777
|
+
}[];
|
|
1778
|
+
workerId?: string | undefined;
|
|
1779
|
+
} | {
|
|
1780
|
+
type: "client-tool-request";
|
|
1781
|
+
executionId: string;
|
|
1782
|
+
toolCalls: {
|
|
1783
|
+
toolCallId: string;
|
|
1784
|
+
toolName: string;
|
|
1785
|
+
args: Record<string, unknown>;
|
|
1786
|
+
source?: "llm" | "block" | undefined;
|
|
1787
|
+
outputVariable?: string | undefined;
|
|
1788
|
+
blockIndex?: number | undefined;
|
|
1789
|
+
thread?: string | undefined;
|
|
1790
|
+
workerId?: string | undefined;
|
|
1791
|
+
}[];
|
|
1792
|
+
serverToolResults?: {
|
|
1793
|
+
toolCallId: string;
|
|
1794
|
+
toolName?: string | undefined;
|
|
1795
|
+
result?: unknown;
|
|
1796
|
+
error?: string | undefined;
|
|
1797
|
+
files?: {
|
|
1798
|
+
id: string;
|
|
1799
|
+
mediaType: string;
|
|
1800
|
+
url: string;
|
|
1801
|
+
filename?: string | undefined;
|
|
1802
|
+
size?: number | undefined;
|
|
1803
|
+
}[] | undefined;
|
|
1804
|
+
outputVariable?: string | undefined;
|
|
1805
|
+
blockIndex?: number | undefined;
|
|
1806
|
+
thread?: string | undefined;
|
|
1807
|
+
workerId?: string | undefined;
|
|
1808
|
+
}[] | undefined;
|
|
1809
|
+
} | {
|
|
1810
|
+
type: "file-available";
|
|
1811
|
+
id: string;
|
|
1812
|
+
mediaType: string;
|
|
1813
|
+
url: string;
|
|
1814
|
+
filename?: string | undefined;
|
|
1815
|
+
size?: number | undefined;
|
|
1816
|
+
toolCallId?: string | undefined;
|
|
1817
|
+
workerId?: string | undefined;
|
|
1818
|
+
} | {
|
|
1819
|
+
type: "worker-start";
|
|
1820
|
+
workerId: string;
|
|
1821
|
+
workerSlug: string;
|
|
1822
|
+
description?: string | undefined;
|
|
1823
|
+
} | {
|
|
1824
|
+
type: "worker-result";
|
|
1825
|
+
workerId: string;
|
|
1826
|
+
output?: unknown;
|
|
1827
|
+
error?: string | undefined;
|
|
1828
|
+
}>;
|
|
1829
|
+
declare function safeParseUIMessage(data: unknown): z.ZodSafeParseResult<{
|
|
1830
|
+
id: string;
|
|
1831
|
+
role: "user" | "assistant";
|
|
1832
|
+
parts: ({
|
|
1833
|
+
type: "source";
|
|
1834
|
+
sourceType: "url";
|
|
1835
|
+
id: string;
|
|
1836
|
+
url: string;
|
|
1837
|
+
title?: string | undefined;
|
|
1838
|
+
thread?: string | undefined;
|
|
1839
|
+
} | {
|
|
1840
|
+
type: "source";
|
|
1841
|
+
sourceType: "document";
|
|
1842
|
+
id: string;
|
|
1843
|
+
mediaType: string;
|
|
1844
|
+
title: string;
|
|
1845
|
+
filename?: string | undefined;
|
|
1846
|
+
thread?: string | undefined;
|
|
1847
|
+
} | {
|
|
1848
|
+
type: "text";
|
|
1849
|
+
text: string;
|
|
1850
|
+
status: "streaming" | "done";
|
|
1851
|
+
thread?: string | undefined;
|
|
1852
|
+
} | {
|
|
1853
|
+
type: "reasoning";
|
|
1854
|
+
text: string;
|
|
1855
|
+
status: "streaming" | "done";
|
|
1856
|
+
thread?: string | undefined;
|
|
1857
|
+
providerMetadata?: Record<string, unknown> | undefined;
|
|
1858
|
+
} | {
|
|
1859
|
+
type: "tool-call";
|
|
1860
|
+
toolCallId: string;
|
|
1861
|
+
toolName: string;
|
|
1862
|
+
args: Record<string, unknown>;
|
|
1863
|
+
status: "pending" | "error" | "done" | "running";
|
|
1864
|
+
displayName?: string | undefined;
|
|
1865
|
+
result?: unknown;
|
|
1866
|
+
error?: string | undefined;
|
|
1867
|
+
thread?: string | undefined;
|
|
1868
|
+
providerMetadata?: Record<string, unknown> | undefined;
|
|
1869
|
+
} | {
|
|
1870
|
+
type: "operation";
|
|
1871
|
+
operationId: string;
|
|
1872
|
+
name: string;
|
|
1873
|
+
operationType: string;
|
|
1874
|
+
status: "done" | "running";
|
|
1875
|
+
thread?: string | undefined;
|
|
1876
|
+
} | {
|
|
1877
|
+
type: "file";
|
|
1878
|
+
id: string;
|
|
1879
|
+
mediaType: string;
|
|
1880
|
+
url: string;
|
|
1881
|
+
filename?: string | undefined;
|
|
1882
|
+
size?: number | undefined;
|
|
1883
|
+
toolCallId?: string | undefined;
|
|
1884
|
+
thread?: string | undefined;
|
|
1885
|
+
} | {
|
|
1886
|
+
type: "object";
|
|
1887
|
+
id: string;
|
|
1888
|
+
typeName: string;
|
|
1889
|
+
status: "streaming" | "error" | "done";
|
|
1890
|
+
partial?: unknown;
|
|
1891
|
+
object?: unknown;
|
|
1892
|
+
error?: string | undefined;
|
|
1893
|
+
thread?: string | undefined;
|
|
1894
|
+
} | {
|
|
1895
|
+
type: "worker";
|
|
1896
|
+
workerId: string;
|
|
1897
|
+
workerSlug: string;
|
|
1898
|
+
parts: ({
|
|
1899
|
+
type: "source";
|
|
1900
|
+
sourceType: "url";
|
|
1901
|
+
id: string;
|
|
1902
|
+
url: string;
|
|
1903
|
+
title?: string | undefined;
|
|
1904
|
+
thread?: string | undefined;
|
|
1905
|
+
} | {
|
|
1906
|
+
type: "source";
|
|
1907
|
+
sourceType: "document";
|
|
1908
|
+
id: string;
|
|
1909
|
+
mediaType: string;
|
|
1910
|
+
title: string;
|
|
1911
|
+
filename?: string | undefined;
|
|
1912
|
+
thread?: string | undefined;
|
|
1913
|
+
} | {
|
|
1914
|
+
type: "text";
|
|
1915
|
+
text: string;
|
|
1916
|
+
status: "streaming" | "done";
|
|
1917
|
+
thread?: string | undefined;
|
|
1918
|
+
} | {
|
|
1919
|
+
type: "reasoning";
|
|
1920
|
+
text: string;
|
|
1921
|
+
status: "streaming" | "done";
|
|
1922
|
+
thread?: string | undefined;
|
|
1923
|
+
providerMetadata?: Record<string, unknown> | undefined;
|
|
1924
|
+
} | {
|
|
1925
|
+
type: "tool-call";
|
|
1926
|
+
toolCallId: string;
|
|
1927
|
+
toolName: string;
|
|
1928
|
+
args: Record<string, unknown>;
|
|
1929
|
+
status: "pending" | "error" | "done" | "running";
|
|
1930
|
+
displayName?: string | undefined;
|
|
1931
|
+
result?: unknown;
|
|
1932
|
+
error?: string | undefined;
|
|
1933
|
+
thread?: string | undefined;
|
|
1934
|
+
providerMetadata?: Record<string, unknown> | undefined;
|
|
1935
|
+
} | {
|
|
1936
|
+
type: "operation";
|
|
1937
|
+
operationId: string;
|
|
1938
|
+
name: string;
|
|
1939
|
+
operationType: string;
|
|
1940
|
+
status: "done" | "running";
|
|
1941
|
+
thread?: string | undefined;
|
|
1942
|
+
} | {
|
|
1943
|
+
type: "file";
|
|
1944
|
+
id: string;
|
|
1945
|
+
mediaType: string;
|
|
1946
|
+
url: string;
|
|
1947
|
+
filename?: string | undefined;
|
|
1948
|
+
size?: number | undefined;
|
|
1949
|
+
toolCallId?: string | undefined;
|
|
1950
|
+
thread?: string | undefined;
|
|
1951
|
+
} | {
|
|
1952
|
+
type: "object";
|
|
1953
|
+
id: string;
|
|
1954
|
+
typeName: string;
|
|
1955
|
+
status: "streaming" | "error" | "done";
|
|
1956
|
+
partial?: unknown;
|
|
1957
|
+
object?: unknown;
|
|
1958
|
+
error?: string | undefined;
|
|
1959
|
+
thread?: string | undefined;
|
|
1960
|
+
})[];
|
|
1961
|
+
status: "error" | "done" | "running";
|
|
1962
|
+
description?: string | undefined;
|
|
1963
|
+
output?: unknown;
|
|
1964
|
+
error?: string | undefined;
|
|
1965
|
+
})[];
|
|
1966
|
+
status: "streaming" | "done";
|
|
1967
|
+
createdAt: Date;
|
|
1968
|
+
}>;
|
|
1969
|
+
declare function safeParseUIMessages(data: unknown): z.ZodSafeParseResult<{
|
|
1970
|
+
id: string;
|
|
1971
|
+
role: "user" | "assistant";
|
|
1972
|
+
parts: ({
|
|
1973
|
+
type: "source";
|
|
1974
|
+
sourceType: "url";
|
|
1975
|
+
id: string;
|
|
1976
|
+
url: string;
|
|
1977
|
+
title?: string | undefined;
|
|
1978
|
+
thread?: string | undefined;
|
|
1979
|
+
} | {
|
|
1980
|
+
type: "source";
|
|
1981
|
+
sourceType: "document";
|
|
1982
|
+
id: string;
|
|
1983
|
+
mediaType: string;
|
|
1984
|
+
title: string;
|
|
1985
|
+
filename?: string | undefined;
|
|
1986
|
+
thread?: string | undefined;
|
|
1987
|
+
} | {
|
|
1988
|
+
type: "text";
|
|
1989
|
+
text: string;
|
|
1990
|
+
status: "streaming" | "done";
|
|
1991
|
+
thread?: string | undefined;
|
|
1992
|
+
} | {
|
|
1993
|
+
type: "reasoning";
|
|
1994
|
+
text: string;
|
|
1995
|
+
status: "streaming" | "done";
|
|
1996
|
+
thread?: string | undefined;
|
|
1997
|
+
providerMetadata?: Record<string, unknown> | undefined;
|
|
1998
|
+
} | {
|
|
1999
|
+
type: "tool-call";
|
|
2000
|
+
toolCallId: string;
|
|
2001
|
+
toolName: string;
|
|
2002
|
+
args: Record<string, unknown>;
|
|
2003
|
+
status: "pending" | "error" | "done" | "running";
|
|
2004
|
+
displayName?: string | undefined;
|
|
2005
|
+
result?: unknown;
|
|
2006
|
+
error?: string | undefined;
|
|
2007
|
+
thread?: string | undefined;
|
|
2008
|
+
providerMetadata?: Record<string, unknown> | undefined;
|
|
2009
|
+
} | {
|
|
2010
|
+
type: "operation";
|
|
2011
|
+
operationId: string;
|
|
2012
|
+
name: string;
|
|
2013
|
+
operationType: string;
|
|
2014
|
+
status: "done" | "running";
|
|
2015
|
+
thread?: string | undefined;
|
|
2016
|
+
} | {
|
|
2017
|
+
type: "file";
|
|
2018
|
+
id: string;
|
|
2019
|
+
mediaType: string;
|
|
2020
|
+
url: string;
|
|
2021
|
+
filename?: string | undefined;
|
|
2022
|
+
size?: number | undefined;
|
|
2023
|
+
toolCallId?: string | undefined;
|
|
2024
|
+
thread?: string | undefined;
|
|
2025
|
+
} | {
|
|
2026
|
+
type: "object";
|
|
2027
|
+
id: string;
|
|
2028
|
+
typeName: string;
|
|
2029
|
+
status: "streaming" | "error" | "done";
|
|
2030
|
+
partial?: unknown;
|
|
2031
|
+
object?: unknown;
|
|
2032
|
+
error?: string | undefined;
|
|
2033
|
+
thread?: string | undefined;
|
|
2034
|
+
} | {
|
|
2035
|
+
type: "worker";
|
|
2036
|
+
workerId: string;
|
|
2037
|
+
workerSlug: string;
|
|
2038
|
+
parts: ({
|
|
2039
|
+
type: "source";
|
|
2040
|
+
sourceType: "url";
|
|
2041
|
+
id: string;
|
|
2042
|
+
url: string;
|
|
2043
|
+
title?: string | undefined;
|
|
2044
|
+
thread?: string | undefined;
|
|
2045
|
+
} | {
|
|
2046
|
+
type: "source";
|
|
2047
|
+
sourceType: "document";
|
|
2048
|
+
id: string;
|
|
2049
|
+
mediaType: string;
|
|
2050
|
+
title: string;
|
|
2051
|
+
filename?: string | undefined;
|
|
2052
|
+
thread?: string | undefined;
|
|
2053
|
+
} | {
|
|
2054
|
+
type: "text";
|
|
2055
|
+
text: string;
|
|
2056
|
+
status: "streaming" | "done";
|
|
2057
|
+
thread?: string | undefined;
|
|
2058
|
+
} | {
|
|
2059
|
+
type: "reasoning";
|
|
2060
|
+
text: string;
|
|
2061
|
+
status: "streaming" | "done";
|
|
2062
|
+
thread?: string | undefined;
|
|
2063
|
+
providerMetadata?: Record<string, unknown> | undefined;
|
|
2064
|
+
} | {
|
|
2065
|
+
type: "tool-call";
|
|
2066
|
+
toolCallId: string;
|
|
2067
|
+
toolName: string;
|
|
2068
|
+
args: Record<string, unknown>;
|
|
2069
|
+
status: "pending" | "error" | "done" | "running";
|
|
2070
|
+
displayName?: string | undefined;
|
|
2071
|
+
result?: unknown;
|
|
2072
|
+
error?: string | undefined;
|
|
2073
|
+
thread?: string | undefined;
|
|
2074
|
+
providerMetadata?: Record<string, unknown> | undefined;
|
|
2075
|
+
} | {
|
|
2076
|
+
type: "operation";
|
|
2077
|
+
operationId: string;
|
|
2078
|
+
name: string;
|
|
2079
|
+
operationType: string;
|
|
2080
|
+
status: "done" | "running";
|
|
2081
|
+
thread?: string | undefined;
|
|
2082
|
+
} | {
|
|
2083
|
+
type: "file";
|
|
2084
|
+
id: string;
|
|
2085
|
+
mediaType: string;
|
|
2086
|
+
url: string;
|
|
2087
|
+
filename?: string | undefined;
|
|
2088
|
+
size?: number | undefined;
|
|
2089
|
+
toolCallId?: string | undefined;
|
|
2090
|
+
thread?: string | undefined;
|
|
2091
|
+
} | {
|
|
2092
|
+
type: "object";
|
|
2093
|
+
id: string;
|
|
2094
|
+
typeName: string;
|
|
2095
|
+
status: "streaming" | "error" | "done";
|
|
2096
|
+
partial?: unknown;
|
|
2097
|
+
object?: unknown;
|
|
2098
|
+
error?: string | undefined;
|
|
2099
|
+
thread?: string | undefined;
|
|
2100
|
+
})[];
|
|
2101
|
+
status: "error" | "done" | "running";
|
|
2102
|
+
description?: string | undefined;
|
|
2103
|
+
output?: unknown;
|
|
2104
|
+
error?: string | undefined;
|
|
2105
|
+
})[];
|
|
2106
|
+
status: "streaming" | "done";
|
|
2107
|
+
createdAt: Date;
|
|
2108
|
+
}[]>;
|
|
2109
|
+
/**
|
|
2110
|
+
* Type guard to check if a value is a FileReference object.
|
|
2111
|
+
*/
|
|
2112
|
+
declare function isFileReference(value: unknown): value is z.infer<typeof fileReferenceSchema>;
|
|
2113
|
+
/**
|
|
2114
|
+
* Type guard to check if a value is an array of FileReference objects.
|
|
2115
|
+
*/
|
|
2116
|
+
declare function isFileReferenceArray(value: unknown): value is z.infer<typeof fileReferenceSchema>[];
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* Internal Octavus tool definitions.
|
|
2120
|
+
*
|
|
2121
|
+
* These tools are reserved by Octavus and executed server-side.
|
|
2122
|
+
* User-defined tools and workers cannot use the "octavus_" prefix.
|
|
2123
|
+
*/
|
|
2124
|
+
/**
|
|
2125
|
+
* Prefix reserved for internal Octavus tools.
|
|
2126
|
+
* User-defined tools/workers cannot use this prefix.
|
|
2127
|
+
*/
|
|
2128
|
+
declare const OCTAVUS_INTERNAL_PREFIX = "octavus_";
|
|
2129
|
+
/**
|
|
2130
|
+
* All internal Octavus tool names.
|
|
2131
|
+
*
|
|
2132
|
+
* These are tools that are executed server-side by the Octavus runtime.
|
|
2133
|
+
* They should never be sent to client handlers.
|
|
2134
|
+
*/
|
|
2135
|
+
declare const OCTAVUS_INTERNAL_TOOLS: {
|
|
2136
|
+
/** Read skill documentation (SKILL.md) */
|
|
2137
|
+
readonly SKILL_READ: "octavus_skill_read";
|
|
2138
|
+
/** List available scripts in a skill */
|
|
2139
|
+
readonly SKILL_LIST: "octavus_skill_list";
|
|
2140
|
+
/** Execute a pre-built skill script */
|
|
2141
|
+
readonly SKILL_RUN: "octavus_skill_run";
|
|
2142
|
+
/** Execute Python/Bash code in sandbox */
|
|
2143
|
+
readonly CODE_RUN: "octavus_code_run";
|
|
2144
|
+
/** Create/write files in sandbox */
|
|
2145
|
+
readonly FILE_WRITE: "octavus_file_write";
|
|
2146
|
+
/** Read files from sandbox */
|
|
2147
|
+
readonly FILE_READ: "octavus_file_read";
|
|
2148
|
+
/** List all available references with descriptions */
|
|
2149
|
+
readonly REFERENCE_LIST: "octavus_reference_list";
|
|
2150
|
+
/** Read the full content of a specific reference */
|
|
2151
|
+
readonly REFERENCE_READ: "octavus_reference_read";
|
|
2152
|
+
/** Generate images using AI models */
|
|
2153
|
+
readonly GENERATE_IMAGE: "octavus_generate_image";
|
|
2154
|
+
/** Search the web for current information */
|
|
2155
|
+
readonly WEB_SEARCH: "octavus_web_search";
|
|
2156
|
+
};
|
|
2157
|
+
type OctavusInternalToolName = (typeof OCTAVUS_INTERNAL_TOOLS)[keyof typeof OCTAVUS_INTERNAL_TOOLS];
|
|
2158
|
+
/**
|
|
2159
|
+
* Check if a tool name is an internal Octavus tool.
|
|
2160
|
+
*
|
|
2161
|
+
* Internal tools are reserved by Octavus and executed server-side.
|
|
2162
|
+
* User-defined tools cannot start with "octavus_".
|
|
2163
|
+
*
|
|
2164
|
+
* @example
|
|
2165
|
+
* ```typescript
|
|
2166
|
+
* if (isOctavusInternalTool(toolName)) {
|
|
2167
|
+
* // This is an internal Octavus tool, skip client handling
|
|
2168
|
+
* }
|
|
2169
|
+
* ```
|
|
2170
|
+
*/
|
|
2171
|
+
declare function isOctavusInternalTool(toolName: string): boolean;
|
|
2172
|
+
/**
|
|
2173
|
+
* Skill tool names (subset of internal tools).
|
|
2174
|
+
*
|
|
2175
|
+
* Use this for skill-specific filtering. For checking if any tool is internal,
|
|
2176
|
+
* use `isOctavusInternalTool()` instead.
|
|
2177
|
+
*/
|
|
2178
|
+
declare const OCTAVUS_SKILL_TOOLS: {
|
|
2179
|
+
readonly SKILL_READ: "octavus_skill_read";
|
|
2180
|
+
readonly SKILL_LIST: "octavus_skill_list";
|
|
2181
|
+
readonly SKILL_RUN: "octavus_skill_run";
|
|
2182
|
+
readonly CODE_RUN: "octavus_code_run";
|
|
2183
|
+
readonly FILE_WRITE: "octavus_file_write";
|
|
2184
|
+
readonly FILE_READ: "octavus_file_read";
|
|
2185
|
+
};
|
|
2186
|
+
type OctavusSkillToolName = (typeof OCTAVUS_SKILL_TOOLS)[keyof typeof OCTAVUS_SKILL_TOOLS];
|
|
2187
|
+
/**
|
|
2188
|
+
* Check if a tool name is an Octavus skill tool.
|
|
2189
|
+
*
|
|
2190
|
+
* Skill tools are a subset of internal tools that execute in E2B sandboxes.
|
|
2191
|
+
*
|
|
2192
|
+
* @example
|
|
2193
|
+
* ```typescript
|
|
2194
|
+
* if (isOctavusSkillTool(event.toolName)) {
|
|
2195
|
+
* // This is a skill tool, executed in E2B sandbox
|
|
2196
|
+
* const skillSlug = event.input?.skill;
|
|
2197
|
+
* }
|
|
2198
|
+
* ```
|
|
2199
|
+
*/
|
|
2200
|
+
declare function isOctavusSkillTool(toolName: string): toolName is OctavusSkillToolName;
|
|
2201
|
+
/**
|
|
2202
|
+
* Reference tool names (subset of internal tools).
|
|
2203
|
+
*
|
|
2204
|
+
* Reference tools let agents dynamically fetch agent-local documents
|
|
2205
|
+
* without loading everything into the system prompt upfront.
|
|
2206
|
+
*/
|
|
2207
|
+
declare const OCTAVUS_REFERENCE_TOOLS: {
|
|
2208
|
+
readonly REFERENCE_LIST: "octavus_reference_list";
|
|
2209
|
+
readonly REFERENCE_READ: "octavus_reference_read";
|
|
2210
|
+
};
|
|
2211
|
+
type OctavusReferenceToolName = (typeof OCTAVUS_REFERENCE_TOOLS)[keyof typeof OCTAVUS_REFERENCE_TOOLS];
|
|
2212
|
+
/**
|
|
2213
|
+
* Check if a tool name is an Octavus reference tool.
|
|
2214
|
+
*/
|
|
2215
|
+
declare function isOctavusReferenceTool(toolName: string): toolName is OctavusReferenceToolName;
|
|
2216
|
+
|
|
2217
|
+
/**
|
|
2218
|
+
* Skill-specific utilities.
|
|
2219
|
+
*
|
|
2220
|
+
* For internal tool definitions and checking, see internal-tools.ts
|
|
2221
|
+
*/
|
|
2222
|
+
|
|
2223
|
+
/**
|
|
2224
|
+
* Extract skill slug from skill tool arguments.
|
|
2225
|
+
*
|
|
2226
|
+
* Most skill tools include a `skill` parameter with the skill slug.
|
|
2227
|
+
* Returns undefined if the tool is not a skill tool or if the skill slug is not present.
|
|
2228
|
+
*
|
|
2229
|
+
* @example
|
|
2230
|
+
* ```typescript
|
|
2231
|
+
* const slug = getSkillSlugFromToolCall(event.toolName, event.input);
|
|
2232
|
+
* if (slug) {
|
|
2233
|
+
* console.log(`Using skill: ${slug}`);
|
|
2234
|
+
* }
|
|
2235
|
+
* ```
|
|
2236
|
+
*/
|
|
2237
|
+
declare function getSkillSlugFromToolCall(toolName: string, args: Record<string, unknown> | undefined): string | undefined;
|
|
2238
|
+
|
|
2239
|
+
export { AppError, type BlockEndEvent, type BlockStartEvent, type ChatMessage, type ClientToolRequestEvent, ConflictError, type CreateErrorEventOptions, type DisplayMode, type ErrorEvent, type ErrorSource, type ErrorType, type FileAvailableEvent, type FileInfo, type FileReference, type FinishEvent, type FinishReason, ForbiddenError, type GeneratedFile, MAIN_THREAD, type MessagePart, type MessagePartType, type MessageRole, NotFoundError, OCTAVUS_INTERNAL_PREFIX, OCTAVUS_INTERNAL_TOOLS, OCTAVUS_REFERENCE_TOOLS, OCTAVUS_SKILL_TOOLS, type ObjectInfo, OctavusError, type OctavusErrorOptions, type OctavusInternalToolName, type OctavusReferenceToolName, type OctavusSkillToolName, type OperationInfo, type PendingToolCall, type ProviderErrorInfo, type ReasoningDeltaEvent, type ReasoningEndEvent, type ReasoningStartEvent, type ResourceUpdateEvent, type ResourceUpdateHandler, type SourceDocumentEvent, type SourceDocumentInfo, type SourceEvent, type SourceInfo, type SourceUrlEvent, type SourceUrlInfo, type StartEvent, type StreamEvent, type TextDeltaEvent, type TextEndEvent, type TextStartEvent, type ToolCallInfo, type ToolCallStatus, type ToolErrorInfo, type ToolHandler, type ToolHandlers, type ToolInputAvailableEvent, type ToolInputDeltaEvent, type ToolInputEndEvent, type ToolInputStartEvent, type ToolOutputAvailableEvent, type ToolOutputErrorEvent, type ToolProvider, type ToolRequestEvent, type ToolResult, type ToolResultEntry, type ToolSchema, type UIFilePart, type UIMessage, type UIMessagePart, type UIMessageStatus, type UIObjectPart, type UIObjectStatus, type UIOperationPart, type UIOperationStatus, type UIPartStatus, type UIReasoningPart, type UISourceDocumentPart, type UISourcePart, type UISourceUrlPart, type UITextPart, type UIToolCallPart, type UIToolCallStatus, type UIWorkerPart, type UIWorkerStatus, ValidationError, type WorkerPartInfo, type WorkerResultEvent, type WorkerStartEvent, chatMessageSchema, createApiErrorEvent, createErrorEvent, createInternalErrorEvent, errorToStreamEvent, fileReferenceSchema, generateId, getSkillSlugFromToolCall, isAbortError, isAuthenticationError, isFileReference, isFileReferenceArray, isMainThread, isOctavusInternalTool, isOctavusReferenceTool, isOctavusSkillTool, isOtherThread, isProviderError, isRateLimitError, isRetryableError, isToolError, isValidationError, resolveThread, safeParseStreamEvent, safeParseUIMessage, safeParseUIMessages, threadForPart, toolResultSchema, uiMessagePartSchema, uiMessageSchema, uiWorkerPartSchema, uiWorkerStatusSchema };
|