@octavus/core 0.2.0 → 2.0.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.d.ts CHANGED
@@ -15,829 +15,458 @@ declare class ValidationError extends AppError {
15
15
  declare class ConflictError extends AppError {
16
16
  constructor(resource: string, identifier: string);
17
17
  }
18
+ declare class ForbiddenError extends AppError {
19
+ constructor(message?: string);
20
+ }
18
21
 
19
22
  /**
20
- * Generate a unique ID for messages, tool calls, etc.
21
- * Format: timestamp-random (e.g., "1702345678901-abc123def")
23
+ * Error types for Octavus streaming errors.
24
+ * These types categorize errors to enable appropriate UI handling.
22
25
  */
23
- declare function generateId(): string;
26
+ type 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';
24
27
  /**
25
- * Check if an error is an abort error.
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.
26
72
  *
27
- * This handles the various ways abort errors can manifest across different
28
- * environments (browsers, Node.js, Next.js, etc.).
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
29
78
  *
30
- * @param error - The error to check
31
- * @returns True if the error is an abort error
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
+ * ```
32
94
  */
33
- declare function isAbortError(error: unknown): error is Error;
34
-
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
+ }
35
124
  /**
36
- * Default thread name when none is specified.
125
+ * Check if an error is a rate limit error.
37
126
  */
38
- declare const MAIN_THREAD: "main";
127
+ declare function isRateLimitError(error: unknown): error is OctavusError;
39
128
  /**
40
- * Resolve a thread name, defaulting to main thread.
129
+ * Check if an error is an authentication error.
41
130
  */
42
- declare function resolveThread(thread: string | undefined): string;
131
+ declare function isAuthenticationError(error: unknown): error is OctavusError;
43
132
  /**
44
- * Check if a thread is the main thread.
133
+ * Check if an error is a provider error.
45
134
  */
46
- declare function isMainThread(thread: string | undefined): boolean;
135
+ declare function isProviderError(error: unknown): error is OctavusError;
47
136
  /**
48
- * Normalize thread for storage in message parts.
49
- * Main thread is stored as undefined to save space.
137
+ * Check if an error is a tool error.
50
138
  */
51
- declare function threadForPart(thread: string | undefined): string | undefined;
139
+ declare function isToolError(error: unknown): error is OctavusError;
52
140
  /**
53
- * Check if a message part belongs to a non-main thread.
54
- * Non-main thread content (e.g., "summary") is typically displayed differently.
141
+ * Check if an error is retryable.
55
142
  */
56
- declare function isOtherThread(part: {
57
- thread?: string;
58
- }): boolean;
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;
59
148
 
60
149
  /**
61
- * Zod schemas for stream events.
150
+ * Stream event types for Octavus agent communication.
62
151
  *
63
- * Schemas are organized into two categories:
64
- * - Standard Events (====): Aligned with Vercel AI SDK for interoperability
152
+ * Events are organized into two categories:
153
+ * - Standard Events (====): Common streaming patterns for AI agents
65
154
  * - Octavus Events (----): Octavus-specific protocol events
66
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
+ */
67
163
 
68
- declare const toolResultSchema: z.ZodObject<{
69
- toolCallId: z.ZodString;
70
- toolName: z.ZodOptional<z.ZodString>;
71
- result: z.ZodOptional<z.ZodUnknown>;
72
- error: z.ZodOptional<z.ZodString>;
73
- outputVariable: z.ZodOptional<z.ZodString>;
74
- blockIndex: z.ZodOptional<z.ZodNumber>;
75
- }, z.core.$strip>;
164
+ type DisplayMode = 'hidden' | 'name' | 'description' | 'stream';
165
+ type ToolHandler = (args: Record<string, unknown>) => Promise<unknown>;
166
+ type ToolHandlers = Record<string, ToolHandler>;
76
167
  /**
77
- * Schema for file references used in trigger input and user messages.
168
+ * Reference to an uploaded file.
169
+ * Used in trigger input and user messages for file attachments.
170
+ * Compatible with UIFilePart structure for rendering.
78
171
  */
79
- declare const fileReferenceSchema: z.ZodObject<{
80
- id: z.ZodString;
81
- mediaType: z.ZodString;
82
- url: z.ZodString;
83
- filename: z.ZodOptional<z.ZodString>;
84
- size: z.ZodOptional<z.ZodNumber>;
85
- }, z.core.$strip>;
86
- declare const chatMessageSchema: z.ZodObject<{
87
- id: z.ZodString;
88
- role: z.ZodEnum<{
89
- user: "user";
90
- assistant: "assistant";
91
- system: "system";
92
- }>;
93
- parts: z.ZodArray<z.ZodObject<{
94
- type: z.ZodEnum<{
95
- object: "object";
96
- file: "file";
97
- source: "source";
98
- text: "text";
99
- reasoning: "reasoning";
100
- "tool-call": "tool-call";
101
- }>;
102
- visible: z.ZodBoolean;
103
- content: z.ZodOptional<z.ZodString>;
104
- toolCall: z.ZodOptional<z.ZodObject<{
105
- id: z.ZodString;
106
- name: z.ZodString;
107
- description: z.ZodOptional<z.ZodString>;
108
- arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
109
- status: z.ZodEnum<{
110
- pending: "pending";
111
- streaming: "streaming";
112
- available: "available";
113
- error: "error";
114
- }>;
115
- result: z.ZodOptional<z.ZodUnknown>;
116
- error: z.ZodOptional<z.ZodString>;
117
- }, z.core.$strip>>;
118
- source: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
119
- sourceType: z.ZodLiteral<"url">;
120
- id: z.ZodString;
121
- url: z.ZodString;
122
- title: z.ZodOptional<z.ZodString>;
123
- }, z.core.$strip>, z.ZodObject<{
124
- sourceType: z.ZodLiteral<"document">;
125
- id: z.ZodString;
126
- mediaType: z.ZodString;
127
- title: z.ZodString;
128
- filename: z.ZodOptional<z.ZodString>;
129
- }, z.core.$strip>], "sourceType">>;
130
- file: z.ZodOptional<z.ZodObject<{
131
- id: z.ZodString;
132
- mediaType: z.ZodString;
133
- url: z.ZodString;
134
- filename: z.ZodOptional<z.ZodString>;
135
- size: z.ZodOptional<z.ZodNumber>;
136
- toolCallId: z.ZodOptional<z.ZodString>;
137
- }, z.core.$strip>>;
138
- object: z.ZodOptional<z.ZodObject<{
139
- id: z.ZodString;
140
- typeName: z.ZodString;
141
- value: z.ZodUnknown;
142
- }, z.core.$strip>>;
143
- thread: z.ZodOptional<z.ZodString>;
144
- }, z.core.$strip>>;
145
- createdAt: z.ZodString;
146
- visible: z.ZodOptional<z.ZodBoolean>;
147
- content: z.ZodString;
148
- toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
149
- id: z.ZodString;
150
- name: z.ZodString;
151
- description: z.ZodOptional<z.ZodString>;
152
- arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
153
- status: z.ZodEnum<{
154
- pending: "pending";
155
- streaming: "streaming";
156
- available: "available";
157
- error: "error";
158
- }>;
159
- result: z.ZodOptional<z.ZodUnknown>;
160
- error: z.ZodOptional<z.ZodString>;
161
- }, z.core.$strip>>>;
162
- reasoning: z.ZodOptional<z.ZodString>;
163
- reasoningSignature: z.ZodOptional<z.ZodString>;
164
- }, z.core.$strip>;
165
- declare const uiMessagePartSchema: z.ZodUnion<readonly [z.ZodObject<{
166
- type: z.ZodLiteral<"text">;
167
- text: z.ZodString;
168
- status: z.ZodEnum<{
169
- streaming: "streaming";
170
- done: "done";
171
- }>;
172
- thread: z.ZodOptional<z.ZodString>;
173
- }, z.core.$strip>, z.ZodObject<{
174
- type: z.ZodLiteral<"reasoning">;
175
- text: z.ZodString;
176
- status: z.ZodEnum<{
177
- streaming: "streaming";
178
- done: "done";
179
- }>;
180
- thread: z.ZodOptional<z.ZodString>;
181
- }, z.core.$strip>, z.ZodObject<{
182
- type: z.ZodLiteral<"tool-call">;
183
- toolCallId: z.ZodString;
184
- toolName: z.ZodString;
185
- displayName: z.ZodOptional<z.ZodString>;
186
- args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
187
- result: z.ZodOptional<z.ZodUnknown>;
188
- error: z.ZodOptional<z.ZodString>;
189
- status: z.ZodEnum<{
190
- pending: "pending";
191
- error: "error";
192
- done: "done";
193
- running: "running";
194
- }>;
195
- thread: z.ZodOptional<z.ZodString>;
196
- }, z.core.$strip>, z.ZodObject<{
197
- type: z.ZodLiteral<"operation">;
198
- operationId: z.ZodString;
199
- name: z.ZodString;
200
- operationType: z.ZodString;
201
- status: z.ZodEnum<{
202
- done: "done";
203
- running: "running";
204
- }>;
205
- thread: z.ZodOptional<z.ZodString>;
206
- }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
207
- type: z.ZodLiteral<"source">;
208
- sourceType: z.ZodLiteral<"url">;
209
- id: z.ZodString;
210
- url: z.ZodString;
211
- title: z.ZodOptional<z.ZodString>;
212
- thread: z.ZodOptional<z.ZodString>;
213
- }, z.core.$strip>, z.ZodObject<{
214
- type: z.ZodLiteral<"source">;
215
- sourceType: z.ZodLiteral<"document">;
216
- id: z.ZodString;
217
- mediaType: z.ZodString;
218
- title: z.ZodString;
219
- filename: z.ZodOptional<z.ZodString>;
220
- thread: z.ZodOptional<z.ZodString>;
221
- }, z.core.$strip>], "sourceType">, z.ZodObject<{
222
- type: z.ZodLiteral<"file">;
223
- id: z.ZodString;
224
- mediaType: z.ZodString;
225
- url: z.ZodString;
226
- filename: z.ZodOptional<z.ZodString>;
227
- size: z.ZodOptional<z.ZodNumber>;
228
- toolCallId: z.ZodOptional<z.ZodString>;
229
- thread: z.ZodOptional<z.ZodString>;
230
- }, z.core.$strip>, z.ZodObject<{
231
- type: z.ZodLiteral<"object">;
232
- id: z.ZodString;
233
- typeName: z.ZodString;
234
- partial: z.ZodOptional<z.ZodUnknown>;
235
- object: z.ZodOptional<z.ZodUnknown>;
236
- status: z.ZodEnum<{
237
- streaming: "streaming";
238
- error: "error";
239
- done: "done";
240
- }>;
241
- error: z.ZodOptional<z.ZodString>;
242
- thread: z.ZodOptional<z.ZodString>;
243
- }, z.core.$strip>]>;
244
- declare const uiMessageSchema: z.ZodObject<{
245
- id: z.ZodString;
246
- role: z.ZodEnum<{
247
- user: "user";
248
- assistant: "assistant";
249
- }>;
250
- parts: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
251
- type: z.ZodLiteral<"text">;
252
- text: z.ZodString;
253
- status: z.ZodEnum<{
254
- streaming: "streaming";
255
- done: "done";
256
- }>;
257
- thread: z.ZodOptional<z.ZodString>;
258
- }, z.core.$strip>, z.ZodObject<{
259
- type: z.ZodLiteral<"reasoning">;
260
- text: z.ZodString;
261
- status: z.ZodEnum<{
262
- streaming: "streaming";
263
- done: "done";
264
- }>;
265
- thread: z.ZodOptional<z.ZodString>;
266
- }, z.core.$strip>, z.ZodObject<{
267
- type: z.ZodLiteral<"tool-call">;
268
- toolCallId: z.ZodString;
269
- toolName: z.ZodString;
270
- displayName: z.ZodOptional<z.ZodString>;
271
- args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
272
- result: z.ZodOptional<z.ZodUnknown>;
273
- error: z.ZodOptional<z.ZodString>;
274
- status: z.ZodEnum<{
275
- pending: "pending";
276
- error: "error";
277
- done: "done";
278
- running: "running";
279
- }>;
280
- thread: z.ZodOptional<z.ZodString>;
281
- }, z.core.$strip>, z.ZodObject<{
282
- type: z.ZodLiteral<"operation">;
283
- operationId: z.ZodString;
284
- name: z.ZodString;
285
- operationType: z.ZodString;
286
- status: z.ZodEnum<{
287
- done: "done";
288
- running: "running";
289
- }>;
290
- thread: z.ZodOptional<z.ZodString>;
291
- }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
292
- type: z.ZodLiteral<"source">;
293
- sourceType: z.ZodLiteral<"url">;
294
- id: z.ZodString;
295
- url: z.ZodString;
296
- title: z.ZodOptional<z.ZodString>;
297
- thread: z.ZodOptional<z.ZodString>;
298
- }, z.core.$strip>, z.ZodObject<{
299
- type: z.ZodLiteral<"source">;
300
- sourceType: z.ZodLiteral<"document">;
301
- id: z.ZodString;
302
- mediaType: z.ZodString;
303
- title: z.ZodString;
304
- filename: z.ZodOptional<z.ZodString>;
305
- thread: z.ZodOptional<z.ZodString>;
306
- }, z.core.$strip>], "sourceType">, z.ZodObject<{
307
- type: z.ZodLiteral<"file">;
308
- id: z.ZodString;
309
- mediaType: z.ZodString;
310
- url: z.ZodString;
311
- filename: z.ZodOptional<z.ZodString>;
312
- size: z.ZodOptional<z.ZodNumber>;
313
- toolCallId: z.ZodOptional<z.ZodString>;
314
- thread: z.ZodOptional<z.ZodString>;
315
- }, z.core.$strip>, z.ZodObject<{
316
- type: z.ZodLiteral<"object">;
317
- id: z.ZodString;
318
- typeName: z.ZodString;
319
- partial: z.ZodOptional<z.ZodUnknown>;
320
- object: z.ZodOptional<z.ZodUnknown>;
321
- status: z.ZodEnum<{
322
- streaming: "streaming";
323
- error: "error";
324
- done: "done";
325
- }>;
326
- error: z.ZodOptional<z.ZodString>;
327
- thread: z.ZodOptional<z.ZodString>;
328
- }, z.core.$strip>]>>;
329
- status: z.ZodEnum<{
330
- streaming: "streaming";
331
- done: "done";
332
- }>;
333
- createdAt: z.ZodCoercedDate<unknown>;
334
- }, z.core.$strip>;
335
- declare function safeParseStreamEvent(data: unknown): z.ZodSafeParseResult<{
336
- type: "source";
337
- sourceType: "url";
172
+ interface FileReference {
173
+ /** Unique file ID (platform-generated) */
338
174
  id: string;
175
+ /** IANA media type (e.g., 'image/png', 'application/pdf') */
176
+ mediaType: string;
177
+ /** Presigned download URL (S3) */
339
178
  url: string;
340
- title?: string | undefined;
341
- } | {
342
- type: "source";
343
- sourceType: "document";
179
+ /** Original filename */
180
+ filename?: string;
181
+ /** File size in bytes */
182
+ size?: number;
183
+ }
184
+ type ResourceUpdateHandler = (name: string, value: unknown) => Promise<void> | void;
185
+ type MessageRole = 'user' | 'assistant' | 'system';
186
+ type ToolCallStatus = 'pending' | 'streaming' | 'available' | 'error';
187
+ interface ToolCallInfo {
344
188
  id: string;
345
- mediaType: string;
346
- title: string;
347
- filename?: string | undefined;
348
- } | {
349
- type: "start";
350
- messageId?: string | undefined;
351
- } | {
352
- type: "finish";
353
- finishReason: "error" | "stop" | "tool-calls" | "length" | "content-filter" | "other";
354
- } | {
355
- type: "error";
356
- errorText: string;
357
- } | {
358
- type: "text-start";
189
+ name: string;
190
+ description?: string;
191
+ arguments: Record<string, unknown>;
192
+ status: ToolCallStatus;
193
+ result?: unknown;
194
+ error?: string;
195
+ }
196
+ /** Signals the start of a response message */
197
+ interface StartEvent {
198
+ type: 'start';
199
+ messageId?: string;
200
+ /** Execution ID for tool continuation. Used by client to resume after client-side tool handling. */
201
+ executionId?: string;
202
+ }
203
+ /** Signals completion of streaming */
204
+ interface FinishEvent {
205
+ type: 'finish';
206
+ finishReason: FinishReason;
207
+ /** Execution ID for cleanup confirmation. Present when execution completes or pauses for client tools. */
208
+ executionId?: string;
209
+ }
210
+
211
+ /**
212
+ * Error during streaming.
213
+ *
214
+ * Enhanced with structured error information including:
215
+ * - Error type classification for UI handling
216
+ * - Source information (platform, provider, tool)
217
+ * - Retryability flag and retry delay
218
+ * - Provider/tool details when applicable
219
+ *
220
+ * @example Rate limit error from provider
221
+ * ```typescript
222
+ * {
223
+ * type: 'error',
224
+ * errorType: 'rate_limit_error',
225
+ * message: 'Rate limit exceeded',
226
+ * source: 'provider',
227
+ * retryable: true,
228
+ * retryAfter: 60,
229
+ * provider: { name: 'anthropic', statusCode: 429 }
230
+ * }
231
+ * ```
232
+ */
233
+ interface ErrorEvent {
234
+ type: 'error';
235
+ /** Error type classification for UI handling */
236
+ errorType: ErrorType;
237
+ /** Human-readable error message */
238
+ message: string;
239
+ /** Whether automatic retry is possible */
240
+ retryable: boolean;
241
+ /** Where the error originated */
242
+ source: ErrorSource;
243
+ /** Suggested retry delay in seconds (from provider headers) */
244
+ retryAfter?: number;
245
+ /** Machine-readable error code */
246
+ code?: string;
247
+ /** Provider details (when source === 'provider') */
248
+ provider?: ProviderErrorInfo;
249
+ /** Tool details (when source === 'tool') */
250
+ tool?: ToolErrorInfo;
251
+ }
252
+ type FinishReason = 'stop' | 'tool-calls' | 'client-tool-calls' | 'length' | 'content-filter' | 'error' | 'other';
253
+ /**
254
+ * Start of text generation for a specific text part.
255
+ *
256
+ * If `responseType` is set, the text content is JSON matching a custom type.
257
+ * The client SDK should parse the text as a structured object instead of
258
+ * displaying it as plain text.
259
+ */
260
+ interface TextStartEvent {
261
+ type: 'text-start';
359
262
  id: string;
360
- responseType?: string | undefined;
361
- } | {
362
- type: "text-delta";
263
+ /**
264
+ * If specified, the text content is JSON matching this type name.
265
+ * Client SDK should parse as object, not display as text.
266
+ */
267
+ responseType?: string;
268
+ }
269
+ /** Incremental text content */
270
+ interface TextDeltaEvent {
271
+ type: 'text-delta';
363
272
  id: string;
364
273
  delta: string;
365
- } | {
366
- type: "text-end";
274
+ }
275
+ /** End of text generation for a specific text part */
276
+ interface TextEndEvent {
277
+ type: 'text-end';
367
278
  id: string;
368
- } | {
369
- type: "reasoning-start";
279
+ }
280
+ /** Start of reasoning/thinking generation */
281
+ interface ReasoningStartEvent {
282
+ type: 'reasoning-start';
370
283
  id: string;
371
- } | {
372
- type: "reasoning-delta";
284
+ }
285
+ /** Incremental reasoning content */
286
+ interface ReasoningDeltaEvent {
287
+ type: 'reasoning-delta';
373
288
  id: string;
374
289
  delta: string;
375
- } | {
376
- type: "reasoning-end";
290
+ }
291
+ /** End of reasoning generation */
292
+ interface ReasoningEndEvent {
293
+ type: 'reasoning-end';
377
294
  id: string;
378
- } | {
379
- type: "tool-input-start";
295
+ }
296
+ /** Tool call initiated - input streaming will follow */
297
+ interface ToolInputStartEvent {
298
+ type: 'tool-input-start';
380
299
  toolCallId: string;
381
300
  toolName: string;
382
- title?: string | undefined;
383
- } | {
384
- type: "tool-input-delta";
301
+ /** Human-readable title/description for the tool call */
302
+ title?: string;
303
+ }
304
+ /** Incremental tool input/arguments */
305
+ interface ToolInputDeltaEvent {
306
+ type: 'tool-input-delta';
385
307
  toolCallId: string;
386
308
  inputTextDelta: string;
387
- } | {
388
- type: "tool-input-end";
309
+ }
310
+ /** Tool input streaming has ended */
311
+ interface ToolInputEndEvent {
312
+ type: 'tool-input-end';
389
313
  toolCallId: string;
390
- } | {
391
- type: "tool-input-available";
314
+ }
315
+ /** Tool input is complete and available */
316
+ interface ToolInputAvailableEvent {
317
+ type: 'tool-input-available';
392
318
  toolCallId: string;
393
319
  toolName: string;
394
320
  input: unknown;
395
- } | {
396
- type: "tool-output-available";
321
+ }
322
+ /** Tool output/result is available */
323
+ interface ToolOutputAvailableEvent {
324
+ type: 'tool-output-available';
397
325
  toolCallId: string;
398
326
  output: unknown;
399
- } | {
400
- type: "tool-output-error";
327
+ }
328
+ /** Tool execution resulted in error */
329
+ interface ToolOutputErrorEvent {
330
+ type: 'tool-output-error';
401
331
  toolCallId: string;
402
- errorText: string;
403
- } | {
404
- type: "block-start";
332
+ error: string;
333
+ }
334
+ /** Base source event fields */
335
+ interface BaseSourceEvent {
336
+ type: 'source';
337
+ /** Unique source ID */
338
+ id: string;
339
+ }
340
+ /** URL source from web search or similar tools */
341
+ interface SourceUrlEvent extends BaseSourceEvent {
342
+ sourceType: 'url';
343
+ /** URL of the source */
344
+ url: string;
345
+ /** Title of the source */
346
+ title?: string;
347
+ }
348
+ /** Document source from file processing */
349
+ interface SourceDocumentEvent extends BaseSourceEvent {
350
+ sourceType: 'document';
351
+ /** IANA media type (e.g., 'application/pdf') */
352
+ mediaType: string;
353
+ /** Title of the document */
354
+ title: string;
355
+ /** Filename of the document */
356
+ filename?: string;
357
+ }
358
+ /** Source event - union of all source types */
359
+ type SourceEvent = SourceUrlEvent | SourceDocumentEvent;
360
+ /** Protocol block execution started */
361
+ interface BlockStartEvent {
362
+ type: 'block-start';
405
363
  blockId: string;
406
364
  blockName: string;
407
365
  blockType: string;
408
- display: "hidden" | "name" | "description" | "stream";
409
- description?: string | undefined;
410
- outputToChat?: boolean | undefined;
411
- thread?: string | undefined;
412
- } | {
413
- type: "block-end";
414
- blockId: string;
415
- summary?: string | undefined;
416
- } | {
417
- type: "resource-update";
418
- name: string;
366
+ display: DisplayMode;
367
+ description?: string;
368
+ /** Whether output goes to main chat (false for independent blocks) */
369
+ outputToChat?: boolean;
370
+ /** Thread name (undefined or 'main' for main thread) */
371
+ thread?: string;
372
+ }
373
+ /** Protocol block execution completed */
374
+ interface BlockEndEvent {
375
+ type: 'block-end';
376
+ blockId: string;
377
+ summary?: string;
378
+ }
379
+ /** Resource value updated */
380
+ interface ResourceUpdateEvent {
381
+ type: 'resource-update';
382
+ name: string;
419
383
  value: unknown;
420
- } | {
421
- type: "tool-request";
422
- toolCalls: {
423
- toolCallId: string;
424
- toolName: string;
425
- args: Record<string, unknown>;
426
- source?: "llm" | "block" | undefined;
427
- outputVariable?: string | undefined;
428
- blockIndex?: number | undefined;
429
- }[];
430
- } | {
431
- type: "file-available";
432
- id: string;
433
- mediaType: string;
434
- url: string;
435
- filename?: string | undefined;
436
- size?: number | undefined;
437
- toolCallId?: string | undefined;
438
- }>;
439
- declare function safeParseUIMessage(data: unknown): z.ZodSafeParseResult<{
440
- id: string;
441
- role: "user" | "assistant";
442
- parts: ({
443
- type: "source";
444
- sourceType: "url";
445
- id: string;
446
- url: string;
447
- title?: string | undefined;
448
- thread?: string | undefined;
449
- } | {
450
- type: "source";
451
- sourceType: "document";
452
- id: string;
453
- mediaType: string;
454
- title: string;
455
- filename?: string | undefined;
456
- thread?: string | undefined;
457
- } | {
458
- type: "text";
459
- text: string;
460
- status: "streaming" | "done";
461
- thread?: string | undefined;
462
- } | {
463
- type: "reasoning";
464
- text: string;
465
- status: "streaming" | "done";
466
- thread?: string | undefined;
467
- } | {
468
- type: "tool-call";
469
- toolCallId: string;
470
- toolName: string;
471
- args: Record<string, unknown>;
472
- status: "pending" | "error" | "done" | "running";
473
- displayName?: string | undefined;
474
- result?: unknown;
475
- error?: string | undefined;
476
- thread?: string | undefined;
477
- } | {
478
- type: "operation";
479
- operationId: string;
480
- name: string;
481
- operationType: string;
482
- status: "done" | "running";
483
- thread?: string | undefined;
484
- } | {
485
- type: "file";
486
- id: string;
487
- mediaType: string;
488
- url: string;
489
- filename?: string | undefined;
490
- size?: number | undefined;
491
- toolCallId?: string | undefined;
492
- thread?: string | undefined;
493
- } | {
494
- type: "object";
495
- id: string;
496
- typeName: string;
497
- status: "streaming" | "error" | "done";
498
- partial?: unknown;
499
- object?: unknown;
500
- error?: string | undefined;
501
- thread?: string | undefined;
502
- })[];
503
- status: "streaming" | "done";
504
- createdAt: Date;
505
- }>;
506
- declare function safeParseUIMessages(data: unknown): z.ZodSafeParseResult<{
507
- id: string;
508
- role: "user" | "assistant";
509
- parts: ({
510
- type: "source";
511
- sourceType: "url";
512
- id: string;
513
- url: string;
514
- title?: string | undefined;
515
- thread?: string | undefined;
516
- } | {
517
- type: "source";
518
- sourceType: "document";
519
- id: string;
520
- mediaType: string;
521
- title: string;
522
- filename?: string | undefined;
523
- thread?: string | undefined;
524
- } | {
525
- type: "text";
526
- text: string;
527
- status: "streaming" | "done";
528
- thread?: string | undefined;
529
- } | {
530
- type: "reasoning";
531
- text: string;
532
- status: "streaming" | "done";
533
- thread?: string | undefined;
534
- } | {
535
- type: "tool-call";
536
- toolCallId: string;
537
- toolName: string;
538
- args: Record<string, unknown>;
539
- status: "pending" | "error" | "done" | "running";
540
- displayName?: string | undefined;
541
- result?: unknown;
542
- error?: string | undefined;
543
- thread?: string | undefined;
544
- } | {
545
- type: "operation";
546
- operationId: string;
547
- name: string;
548
- operationType: string;
549
- status: "done" | "running";
550
- thread?: string | undefined;
551
- } | {
552
- type: "file";
553
- id: string;
554
- mediaType: string;
555
- url: string;
556
- filename?: string | undefined;
557
- size?: number | undefined;
558
- toolCallId?: string | undefined;
559
- thread?: string | undefined;
560
- } | {
561
- type: "object";
562
- id: string;
563
- typeName: string;
564
- status: "streaming" | "error" | "done";
565
- partial?: unknown;
566
- object?: unknown;
567
- error?: string | undefined;
568
- thread?: string | undefined;
569
- })[];
570
- status: "streaming" | "done";
571
- createdAt: Date;
572
- }[]>;
573
- /**
574
- * Type guard to check if a value is a FileReference object.
575
- */
576
- declare function isFileReference(value: unknown): value is z.infer<typeof fileReferenceSchema>;
384
+ }
385
+ /** Pending tool call that needs external execution (continuation pattern) */
386
+ interface PendingToolCall {
387
+ toolCallId: string;
388
+ toolName: string;
389
+ args: Record<string, unknown>;
390
+ /** 'llm' for LLM-initiated, 'block' for protocol block */
391
+ source?: 'llm' | 'block';
392
+ /** For block-based tools: variable name to store result in */
393
+ outputVariable?: string;
394
+ /** For block-based tools: block index to resume from after execution */
395
+ blockIndex?: number;
396
+ }
577
397
  /**
578
- * Type guard to check if a value is an array of FileReference objects.
398
+ * When this event is received, the stream will close.
399
+ * Consumer should execute the tools and POST a new trigger request with toolResults.
579
400
  */
580
- declare function isFileReferenceArray(value: unknown): value is z.infer<typeof fileReferenceSchema>[];
581
-
401
+ interface ToolRequestEvent {
402
+ type: 'tool-request';
403
+ toolCalls: PendingToolCall[];
404
+ }
582
405
  /**
583
- * Stream event types for Octavus agent communication.
584
- *
585
- * Events are organized into two categories:
586
- * - Standard Events (====): Aligned with Vercel AI SDK for interoperability
587
- * - Octavus Events (----): Octavus-specific protocol events
406
+ * Request for client-side tool execution.
407
+ * Emitted by server-SDK when a tool has no server handler registered.
408
+ * Client should execute the tools and submit results via `continueWithToolResults(executionId, results)`.
588
409
  */
410
+ interface ClientToolRequestEvent {
411
+ type: 'client-tool-request';
412
+ /**
413
+ * Unique execution ID for this trigger execution.
414
+ * Include this when sending tool results back to continue the execution.
415
+ */
416
+ executionId: string;
417
+ toolCalls: PendingToolCall[];
418
+ /**
419
+ * Server tool results already executed in this round.
420
+ * When mixed server+client tools are requested, the server executes its tools
421
+ * first and includes results here. Client must include these when continuing.
422
+ */
423
+ serverToolResults?: ToolResult[];
424
+ }
425
+ /** Result from tool execution (consumer's response to tool-request) */
426
+ interface ToolResult {
427
+ toolCallId: string;
428
+ toolName?: string;
429
+ result?: unknown;
430
+ error?: string;
431
+ outputVariable?: string;
432
+ blockIndex?: number;
433
+ }
589
434
  /**
590
- * Display mode - controls execution indicator visibility (NOT final message visibility).
591
- * - hidden: Block runs silently
592
- * - name: Shows block/tool name
593
- * - description: Shows description
594
- * - stream: Shows live streaming content
435
+ * A file generated during execution.
436
+ * Used for skill outputs, image generation, code execution artifacts, etc.
595
437
  */
596
- type DisplayMode = 'hidden' | 'name' | 'description' | 'stream';
597
- type ToolHandler = (args: Record<string, unknown>) => Promise<unknown>;
598
- type ToolHandlers = Record<string, ToolHandler>;
438
+ interface GeneratedFile {
439
+ /** Unique file ID */
440
+ id: string;
441
+ /** MIME type (e.g., 'image/png', 'application/pdf') */
442
+ mediaType: string;
443
+ /** URL for download/display */
444
+ url: string;
445
+ /** Original filename (for display/download) */
446
+ filename?: string;
447
+ /** Size in bytes */
448
+ size?: number;
449
+ }
599
450
  /**
600
- * Reference to an uploaded file.
601
- * Used in trigger input and user messages for file attachments.
602
- * Compatible with UIFilePart structure for rendering.
451
+ * File generated and available for download/display.
452
+ * Emitted when a tool or skill produces a file output.
603
453
  */
604
- interface FileReference {
605
- /** Unique file ID (platform-generated) */
454
+ interface FileAvailableEvent {
455
+ type: 'file-available';
456
+ /** Unique file ID */
606
457
  id: string;
607
- /** IANA media type (e.g., 'image/png', 'application/pdf') */
458
+ /** MIME type (e.g., 'image/png', 'application/pdf') */
608
459
  mediaType: string;
609
- /** Presigned download URL (S3) */
460
+ /** URL for download/display */
610
461
  url: string;
611
462
  /** Original filename */
612
463
  filename?: string;
613
- /** File size in bytes */
464
+ /** Size in bytes */
614
465
  size?: number;
466
+ /** Tool call that generated this file */
467
+ toolCallId?: string;
615
468
  }
616
- type ResourceUpdateHandler = (name: string, value: unknown) => Promise<void> | void;
617
- type MessageRole = 'user' | 'assistant' | 'system';
618
- type ToolCallStatus = 'pending' | 'streaming' | 'available' | 'error';
619
- interface ToolCallInfo {
620
- id: string;
621
- name: string;
622
- description?: string;
623
- arguments: Record<string, unknown>;
624
- status: ToolCallStatus;
625
- result?: unknown;
626
- error?: string;
627
- }
628
- /** Signals the start of a response message */
629
- interface StartEvent {
630
- type: 'start';
631
- messageId?: string;
632
- }
633
- /** Signals completion of streaming */
634
- interface FinishEvent {
635
- type: 'finish';
636
- finishReason: FinishReason;
637
- }
638
- /** Error during streaming */
639
- interface ErrorEvent {
640
- type: 'error';
641
- errorText: string;
642
- }
643
- type FinishReason = 'stop' | 'tool-calls' | 'length' | 'content-filter' | 'error' | 'other';
644
- /**
645
- * Start of text generation for a specific text part.
646
- *
647
- * If `responseType` is set, the text content is JSON matching a custom type.
648
- * The client SDK should parse the text as a structured object instead of
649
- * displaying it as plain text.
650
- */
651
- interface TextStartEvent {
652
- type: 'text-start';
653
- id: string;
654
- /**
655
- * If specified, the text content is JSON matching this type name.
656
- * Client SDK should parse as object, not display as text.
657
- */
658
- responseType?: string;
659
- }
660
- /** Incremental text content */
661
- interface TextDeltaEvent {
662
- type: 'text-delta';
663
- id: string;
664
- delta: string;
665
- }
666
- /** End of text generation for a specific text part */
667
- interface TextEndEvent {
668
- type: 'text-end';
669
- id: string;
670
- }
671
- /** Start of reasoning/thinking generation */
672
- interface ReasoningStartEvent {
673
- type: 'reasoning-start';
674
- id: string;
675
- }
676
- /** Incremental reasoning content */
677
- interface ReasoningDeltaEvent {
678
- type: 'reasoning-delta';
679
- id: string;
680
- delta: string;
681
- }
682
- /** End of reasoning generation */
683
- interface ReasoningEndEvent {
684
- type: 'reasoning-end';
685
- id: string;
686
- }
687
- /** Tool call initiated - input streaming will follow */
688
- interface ToolInputStartEvent {
689
- type: 'tool-input-start';
690
- toolCallId: string;
691
- toolName: string;
692
- /** Human-readable title/description for the tool call */
693
- title?: string;
694
- }
695
- /** Incremental tool input/arguments */
696
- interface ToolInputDeltaEvent {
697
- type: 'tool-input-delta';
698
- toolCallId: string;
699
- inputTextDelta: string;
700
- }
701
- /** Tool input streaming has ended */
702
- interface ToolInputEndEvent {
703
- type: 'tool-input-end';
704
- toolCallId: string;
705
- }
706
- /** Tool input is complete and available */
707
- interface ToolInputAvailableEvent {
708
- type: 'tool-input-available';
709
- toolCallId: string;
710
- toolName: string;
711
- input: unknown;
712
- }
713
- /** Tool output/result is available */
714
- interface ToolOutputAvailableEvent {
715
- type: 'tool-output-available';
716
- toolCallId: string;
717
- output: unknown;
718
- }
719
- /** Tool execution resulted in error */
720
- interface ToolOutputErrorEvent {
721
- type: 'tool-output-error';
722
- toolCallId: string;
723
- errorText: string;
724
- }
725
- /** Base source event fields */
726
- interface BaseSourceEvent {
727
- type: 'source';
728
- /** The ID of the source */
729
- id: string;
730
- }
731
- /** URL source from web search or similar tools */
732
- interface SourceUrlEvent extends BaseSourceEvent {
733
- sourceType: 'url';
734
- /** The URL of the source */
735
- url: string;
736
- /** The title of the source */
737
- title?: string;
738
- }
739
- /** Document source from file processing */
740
- interface SourceDocumentEvent extends BaseSourceEvent {
741
- sourceType: 'document';
742
- /** IANA media type of the document (e.g., 'application/pdf') */
743
- mediaType: string;
744
- /** The title of the document */
745
- title: string;
746
- /** Optional filename of the document */
747
- filename?: string;
748
- }
749
- /** Source event - union of all source types */
750
- type SourceEvent = SourceUrlEvent | SourceDocumentEvent;
751
- /** Protocol block execution started */
752
- interface BlockStartEvent {
753
- type: 'block-start';
754
- blockId: string;
755
- blockName: string;
756
- blockType: string;
757
- display: DisplayMode;
758
- description?: string;
759
- /** Whether output goes to main chat (false for independent blocks) */
760
- outputToChat?: boolean;
761
- /** Thread name (undefined or 'main' for main thread) */
762
- thread?: string;
763
- }
764
- /** Protocol block execution completed */
765
- interface BlockEndEvent {
766
- type: 'block-end';
767
- blockId: string;
768
- summary?: string;
769
- }
770
- /** Resource value updated */
771
- interface ResourceUpdateEvent {
772
- type: 'resource-update';
773
- name: string;
774
- value: unknown;
775
- }
776
- /** Pending tool call that needs external execution (continuation pattern) */
777
- interface PendingToolCall {
778
- toolCallId: string;
779
- toolName: string;
780
- args: Record<string, unknown>;
781
- /** 'llm' for LLM-initiated, 'block' for protocol block */
782
- source?: 'llm' | 'block';
783
- /** For block-based tools: variable name to store result in */
784
- outputVariable?: string;
785
- /** For block-based tools: block index to resume from after execution */
786
- blockIndex?: number;
787
- }
788
- /**
789
- * When this event is received, the stream will close.
790
- * Consumer should execute the tools and POST a new trigger request with toolResults.
791
- */
792
- interface ToolRequestEvent {
793
- type: 'tool-request';
794
- toolCalls: PendingToolCall[];
795
- }
796
- /** Result from tool execution (consumer's response to tool-request) */
797
- interface ToolResult {
798
- toolCallId: string;
799
- toolName?: string;
800
- result?: unknown;
801
- error?: string;
802
- outputVariable?: string;
803
- blockIndex?: number;
804
- }
805
- /**
806
- * A file generated during execution (aligned with Vercel AI SDK FilePart).
807
- * Used for skill outputs, image generation, code execution artifacts, etc.
808
- */
809
- interface GeneratedFile {
810
- /** Unique file ID */
811
- id: string;
812
- /** MIME type (e.g., 'image/png', 'application/pdf') - aligned with Vercel AI SDK */
813
- mediaType: string;
814
- /** URL for download/display (presigned S3 URL or data URL) */
815
- url: string;
816
- /** Original filename (optional, for display/download) */
817
- filename?: string;
818
- /** Size in bytes (optional, for display) */
819
- size?: number;
820
- }
821
- /**
822
- * File generated and available for download/display.
823
- * Emitted when a tool or skill produces a file output.
824
- */
825
- interface FileAvailableEvent {
826
- type: 'file-available';
827
- /** Unique file ID */
828
- id: string;
829
- /** MIME type (aligned with Vercel AI SDK) */
830
- mediaType: string;
831
- /** URL for download/display */
832
- url: string;
833
- /** Original filename */
834
- filename?: string;
835
- /** Size in bytes */
836
- size?: number;
837
- /** Tool call that generated this file */
838
- toolCallId?: string;
839
- }
840
- type StreamEvent = StartEvent | FinishEvent | ErrorEvent | TextStartEvent | TextDeltaEvent | TextEndEvent | ReasoningStartEvent | ReasoningDeltaEvent | ReasoningEndEvent | ToolInputStartEvent | ToolInputDeltaEvent | ToolInputEndEvent | ToolInputAvailableEvent | ToolOutputAvailableEvent | ToolOutputErrorEvent | SourceEvent | BlockStartEvent | BlockEndEvent | ResourceUpdateEvent | ToolRequestEvent | FileAvailableEvent;
469
+ type StreamEvent = StartEvent | FinishEvent | ErrorEvent | TextStartEvent | TextDeltaEvent | TextEndEvent | ReasoningStartEvent | ReasoningDeltaEvent | ReasoningEndEvent | ToolInputStartEvent | ToolInputDeltaEvent | ToolInputEndEvent | ToolInputAvailableEvent | ToolOutputAvailableEvent | ToolOutputErrorEvent | SourceEvent | BlockStartEvent | BlockEndEvent | ResourceUpdateEvent | ToolRequestEvent | ClientToolRequestEvent | FileAvailableEvent;
841
470
  /**
842
471
  * Type of content in a message part (internal)
843
472
  */
@@ -1024,16 +653,16 @@ interface UISourceDocumentPart extends BaseUISourcePart {
1024
653
  */
1025
654
  type UISourcePart = UISourceUrlPart | UISourceDocumentPart;
1026
655
  /**
1027
- * File attachment part (aligned with Vercel AI SDK FilePart).
656
+ * File attachment part.
1028
657
  * Generated by skill execution, image generation, code execution, etc.
1029
658
  */
1030
659
  interface UIFilePart {
1031
660
  type: 'file';
1032
661
  /** Unique file ID */
1033
662
  id: string;
1034
- /** MIME type for rendering (aligned with Vercel AI SDK) */
663
+ /** MIME type (e.g., 'image/png', 'application/pdf') */
1035
664
  mediaType: string;
1036
- /** URL for download/display (presigned URL or data URL) */
665
+ /** URL for download/display */
1037
666
  url: string;
1038
667
  /** Original filename (for display/download) */
1039
668
  filename?: string;
@@ -1086,6 +715,644 @@ interface UIMessage {
1086
715
  createdAt: Date;
1087
716
  }
1088
717
 
718
+ /**
719
+ * Options for creating an error event.
720
+ */
721
+ interface CreateErrorEventOptions {
722
+ errorType: ErrorType;
723
+ message: string;
724
+ source: ErrorSource;
725
+ retryable?: boolean;
726
+ retryAfter?: number;
727
+ code?: string;
728
+ provider?: ProviderErrorInfo;
729
+ tool?: ToolErrorInfo;
730
+ }
731
+ /**
732
+ * Create an ErrorEvent from options.
733
+ * Use this for constructing error events in streaming responses.
734
+ */
735
+ declare function createErrorEvent(options: CreateErrorEventOptions): ErrorEvent;
736
+ /**
737
+ * Create an ErrorEvent from an OctavusError.
738
+ */
739
+ declare function errorToStreamEvent(error: OctavusError): ErrorEvent;
740
+ /**
741
+ * Create an internal error event.
742
+ * Convenience function for platform-level errors.
743
+ */
744
+ declare function createInternalErrorEvent(message: string): ErrorEvent;
745
+ /**
746
+ * Create an error event from an API response.
747
+ * Maps HTTP status codes to appropriate error types.
748
+ *
749
+ * Use this when handling errors from API responses (before streaming starts).
750
+ *
751
+ * @param statusCode - HTTP status code from the response
752
+ * @param message - Error message to display
753
+ */
754
+ declare function createApiErrorEvent(statusCode: number, message: string): ErrorEvent;
755
+
756
+ /**
757
+ * Generate a unique ID for messages, tool calls, etc.
758
+ * Format: timestamp-random (e.g., "1702345678901-abc123def")
759
+ */
760
+ declare function generateId(): string;
761
+ /**
762
+ * Check if an error is an abort error.
763
+ *
764
+ * This handles the various ways abort errors can manifest across different
765
+ * environments (browsers, Node.js, Next.js, etc.).
766
+ *
767
+ * @param error - The error to check
768
+ * @returns True if the error is an abort error
769
+ */
770
+ declare function isAbortError(error: unknown): error is Error;
771
+
772
+ /**
773
+ * Default thread name when none is specified.
774
+ */
775
+ declare const MAIN_THREAD: "main";
776
+ /**
777
+ * Resolve a thread name, defaulting to main thread.
778
+ */
779
+ declare function resolveThread(thread: string | undefined): string;
780
+ /**
781
+ * Check if a thread is the main thread.
782
+ */
783
+ declare function isMainThread(thread: string | undefined): boolean;
784
+ /**
785
+ * Normalize thread for storage in message parts.
786
+ * Main thread is stored as undefined to save space.
787
+ */
788
+ declare function threadForPart(thread: string | undefined): string | undefined;
789
+ /**
790
+ * Check if a message part belongs to a non-main thread.
791
+ * Non-main thread content (e.g., "summary") is typically displayed differently.
792
+ */
793
+ declare function isOtherThread(part: {
794
+ thread?: string;
795
+ }): boolean;
796
+
797
+ /**
798
+ * Zod schemas for stream events.
799
+ *
800
+ * Schemas are organized into two categories:
801
+ * - Standard Events (====): Common streaming patterns for AI agents
802
+ * - Octavus Events (----): Octavus-specific protocol events
803
+ */
804
+
805
+ declare const toolResultSchema: z.ZodObject<{
806
+ toolCallId: z.ZodString;
807
+ toolName: z.ZodOptional<z.ZodString>;
808
+ result: z.ZodOptional<z.ZodUnknown>;
809
+ error: z.ZodOptional<z.ZodString>;
810
+ outputVariable: z.ZodOptional<z.ZodString>;
811
+ blockIndex: z.ZodOptional<z.ZodNumber>;
812
+ }, z.core.$strip>;
813
+ /**
814
+ * Schema for file references used in trigger input and user messages.
815
+ */
816
+ declare const fileReferenceSchema: z.ZodObject<{
817
+ id: z.ZodString;
818
+ mediaType: z.ZodString;
819
+ url: z.ZodString;
820
+ filename: z.ZodOptional<z.ZodString>;
821
+ size: z.ZodOptional<z.ZodNumber>;
822
+ }, z.core.$strip>;
823
+ declare const chatMessageSchema: z.ZodObject<{
824
+ id: z.ZodString;
825
+ role: z.ZodEnum<{
826
+ user: "user";
827
+ assistant: "assistant";
828
+ system: "system";
829
+ }>;
830
+ parts: z.ZodArray<z.ZodObject<{
831
+ type: z.ZodEnum<{
832
+ object: "object";
833
+ source: "source";
834
+ text: "text";
835
+ reasoning: "reasoning";
836
+ "tool-call": "tool-call";
837
+ file: "file";
838
+ }>;
839
+ visible: z.ZodBoolean;
840
+ content: z.ZodOptional<z.ZodString>;
841
+ toolCall: z.ZodOptional<z.ZodObject<{
842
+ id: z.ZodString;
843
+ name: z.ZodString;
844
+ description: z.ZodOptional<z.ZodString>;
845
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
846
+ status: z.ZodEnum<{
847
+ pending: "pending";
848
+ streaming: "streaming";
849
+ available: "available";
850
+ error: "error";
851
+ }>;
852
+ result: z.ZodOptional<z.ZodUnknown>;
853
+ error: z.ZodOptional<z.ZodString>;
854
+ }, z.core.$strip>>;
855
+ source: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
856
+ sourceType: z.ZodLiteral<"url">;
857
+ id: z.ZodString;
858
+ url: z.ZodString;
859
+ title: z.ZodOptional<z.ZodString>;
860
+ }, z.core.$strip>, z.ZodObject<{
861
+ sourceType: z.ZodLiteral<"document">;
862
+ id: z.ZodString;
863
+ mediaType: z.ZodString;
864
+ title: z.ZodString;
865
+ filename: z.ZodOptional<z.ZodString>;
866
+ }, z.core.$strip>], "sourceType">>;
867
+ file: z.ZodOptional<z.ZodObject<{
868
+ id: z.ZodString;
869
+ mediaType: z.ZodString;
870
+ url: z.ZodString;
871
+ filename: z.ZodOptional<z.ZodString>;
872
+ size: z.ZodOptional<z.ZodNumber>;
873
+ toolCallId: z.ZodOptional<z.ZodString>;
874
+ }, z.core.$strip>>;
875
+ object: z.ZodOptional<z.ZodObject<{
876
+ id: z.ZodString;
877
+ typeName: z.ZodString;
878
+ value: z.ZodUnknown;
879
+ }, z.core.$strip>>;
880
+ thread: z.ZodOptional<z.ZodString>;
881
+ }, z.core.$strip>>;
882
+ createdAt: z.ZodString;
883
+ visible: z.ZodOptional<z.ZodBoolean>;
884
+ content: z.ZodString;
885
+ toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
886
+ id: z.ZodString;
887
+ name: z.ZodString;
888
+ description: z.ZodOptional<z.ZodString>;
889
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
890
+ status: z.ZodEnum<{
891
+ pending: "pending";
892
+ streaming: "streaming";
893
+ available: "available";
894
+ error: "error";
895
+ }>;
896
+ result: z.ZodOptional<z.ZodUnknown>;
897
+ error: z.ZodOptional<z.ZodString>;
898
+ }, z.core.$strip>>>;
899
+ reasoning: z.ZodOptional<z.ZodString>;
900
+ reasoningSignature: z.ZodOptional<z.ZodString>;
901
+ }, z.core.$strip>;
902
+ declare const uiMessagePartSchema: z.ZodUnion<readonly [z.ZodObject<{
903
+ type: z.ZodLiteral<"text">;
904
+ text: z.ZodString;
905
+ status: z.ZodEnum<{
906
+ streaming: "streaming";
907
+ done: "done";
908
+ }>;
909
+ thread: z.ZodOptional<z.ZodString>;
910
+ }, z.core.$strip>, z.ZodObject<{
911
+ type: z.ZodLiteral<"reasoning">;
912
+ text: z.ZodString;
913
+ status: z.ZodEnum<{
914
+ streaming: "streaming";
915
+ done: "done";
916
+ }>;
917
+ thread: z.ZodOptional<z.ZodString>;
918
+ }, z.core.$strip>, z.ZodObject<{
919
+ type: z.ZodLiteral<"tool-call">;
920
+ toolCallId: z.ZodString;
921
+ toolName: z.ZodString;
922
+ displayName: z.ZodOptional<z.ZodString>;
923
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
924
+ result: z.ZodOptional<z.ZodUnknown>;
925
+ error: z.ZodOptional<z.ZodString>;
926
+ status: z.ZodEnum<{
927
+ pending: "pending";
928
+ error: "error";
929
+ done: "done";
930
+ running: "running";
931
+ }>;
932
+ thread: z.ZodOptional<z.ZodString>;
933
+ }, z.core.$strip>, z.ZodObject<{
934
+ type: z.ZodLiteral<"operation">;
935
+ operationId: z.ZodString;
936
+ name: z.ZodString;
937
+ operationType: z.ZodString;
938
+ status: z.ZodEnum<{
939
+ done: "done";
940
+ running: "running";
941
+ }>;
942
+ thread: z.ZodOptional<z.ZodString>;
943
+ }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
944
+ type: z.ZodLiteral<"source">;
945
+ sourceType: z.ZodLiteral<"url">;
946
+ id: z.ZodString;
947
+ url: z.ZodString;
948
+ title: z.ZodOptional<z.ZodString>;
949
+ thread: z.ZodOptional<z.ZodString>;
950
+ }, z.core.$strip>, z.ZodObject<{
951
+ type: z.ZodLiteral<"source">;
952
+ sourceType: z.ZodLiteral<"document">;
953
+ id: z.ZodString;
954
+ mediaType: z.ZodString;
955
+ title: z.ZodString;
956
+ filename: z.ZodOptional<z.ZodString>;
957
+ thread: z.ZodOptional<z.ZodString>;
958
+ }, z.core.$strip>], "sourceType">, z.ZodObject<{
959
+ type: z.ZodLiteral<"file">;
960
+ id: z.ZodString;
961
+ mediaType: z.ZodString;
962
+ url: z.ZodString;
963
+ filename: z.ZodOptional<z.ZodString>;
964
+ size: z.ZodOptional<z.ZodNumber>;
965
+ toolCallId: z.ZodOptional<z.ZodString>;
966
+ thread: z.ZodOptional<z.ZodString>;
967
+ }, z.core.$strip>, z.ZodObject<{
968
+ type: z.ZodLiteral<"object">;
969
+ id: z.ZodString;
970
+ typeName: z.ZodString;
971
+ partial: z.ZodOptional<z.ZodUnknown>;
972
+ object: z.ZodOptional<z.ZodUnknown>;
973
+ status: z.ZodEnum<{
974
+ streaming: "streaming";
975
+ error: "error";
976
+ done: "done";
977
+ }>;
978
+ error: z.ZodOptional<z.ZodString>;
979
+ thread: z.ZodOptional<z.ZodString>;
980
+ }, z.core.$strip>]>;
981
+ declare const uiMessageSchema: z.ZodObject<{
982
+ id: z.ZodString;
983
+ role: z.ZodEnum<{
984
+ user: "user";
985
+ assistant: "assistant";
986
+ }>;
987
+ parts: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
988
+ type: z.ZodLiteral<"text">;
989
+ text: z.ZodString;
990
+ status: z.ZodEnum<{
991
+ streaming: "streaming";
992
+ done: "done";
993
+ }>;
994
+ thread: z.ZodOptional<z.ZodString>;
995
+ }, z.core.$strip>, z.ZodObject<{
996
+ type: z.ZodLiteral<"reasoning">;
997
+ text: z.ZodString;
998
+ status: z.ZodEnum<{
999
+ streaming: "streaming";
1000
+ done: "done";
1001
+ }>;
1002
+ thread: z.ZodOptional<z.ZodString>;
1003
+ }, z.core.$strip>, z.ZodObject<{
1004
+ type: z.ZodLiteral<"tool-call">;
1005
+ toolCallId: z.ZodString;
1006
+ toolName: z.ZodString;
1007
+ displayName: z.ZodOptional<z.ZodString>;
1008
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1009
+ result: z.ZodOptional<z.ZodUnknown>;
1010
+ error: z.ZodOptional<z.ZodString>;
1011
+ status: z.ZodEnum<{
1012
+ pending: "pending";
1013
+ error: "error";
1014
+ done: "done";
1015
+ running: "running";
1016
+ }>;
1017
+ thread: z.ZodOptional<z.ZodString>;
1018
+ }, z.core.$strip>, z.ZodObject<{
1019
+ type: z.ZodLiteral<"operation">;
1020
+ operationId: z.ZodString;
1021
+ name: z.ZodString;
1022
+ operationType: z.ZodString;
1023
+ status: z.ZodEnum<{
1024
+ done: "done";
1025
+ running: "running";
1026
+ }>;
1027
+ thread: z.ZodOptional<z.ZodString>;
1028
+ }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
1029
+ type: z.ZodLiteral<"source">;
1030
+ sourceType: z.ZodLiteral<"url">;
1031
+ id: z.ZodString;
1032
+ url: z.ZodString;
1033
+ title: z.ZodOptional<z.ZodString>;
1034
+ thread: z.ZodOptional<z.ZodString>;
1035
+ }, z.core.$strip>, z.ZodObject<{
1036
+ type: z.ZodLiteral<"source">;
1037
+ sourceType: z.ZodLiteral<"document">;
1038
+ id: z.ZodString;
1039
+ mediaType: z.ZodString;
1040
+ title: z.ZodString;
1041
+ filename: z.ZodOptional<z.ZodString>;
1042
+ thread: z.ZodOptional<z.ZodString>;
1043
+ }, z.core.$strip>], "sourceType">, z.ZodObject<{
1044
+ type: z.ZodLiteral<"file">;
1045
+ id: z.ZodString;
1046
+ mediaType: z.ZodString;
1047
+ url: z.ZodString;
1048
+ filename: z.ZodOptional<z.ZodString>;
1049
+ size: z.ZodOptional<z.ZodNumber>;
1050
+ toolCallId: z.ZodOptional<z.ZodString>;
1051
+ thread: z.ZodOptional<z.ZodString>;
1052
+ }, z.core.$strip>, z.ZodObject<{
1053
+ type: z.ZodLiteral<"object">;
1054
+ id: z.ZodString;
1055
+ typeName: z.ZodString;
1056
+ partial: z.ZodOptional<z.ZodUnknown>;
1057
+ object: z.ZodOptional<z.ZodUnknown>;
1058
+ status: z.ZodEnum<{
1059
+ streaming: "streaming";
1060
+ error: "error";
1061
+ done: "done";
1062
+ }>;
1063
+ error: z.ZodOptional<z.ZodString>;
1064
+ thread: z.ZodOptional<z.ZodString>;
1065
+ }, z.core.$strip>]>>;
1066
+ status: z.ZodEnum<{
1067
+ streaming: "streaming";
1068
+ done: "done";
1069
+ }>;
1070
+ createdAt: z.ZodCoercedDate<unknown>;
1071
+ }, z.core.$strip>;
1072
+ declare function safeParseStreamEvent(data: unknown): z.ZodSafeParseResult<{
1073
+ type: "source";
1074
+ sourceType: "url";
1075
+ id: string;
1076
+ url: string;
1077
+ title?: string | undefined;
1078
+ } | {
1079
+ type: "source";
1080
+ sourceType: "document";
1081
+ id: string;
1082
+ mediaType: string;
1083
+ title: string;
1084
+ filename?: string | undefined;
1085
+ } | {
1086
+ type: "start";
1087
+ messageId?: string | undefined;
1088
+ executionId?: string | undefined;
1089
+ } | {
1090
+ type: "finish";
1091
+ finishReason: "error" | "stop" | "tool-calls" | "client-tool-calls" | "length" | "content-filter" | "other";
1092
+ executionId?: string | undefined;
1093
+ } | {
1094
+ type: "error";
1095
+ 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";
1096
+ message: string;
1097
+ retryable: boolean;
1098
+ source: "platform" | "provider" | "tool" | "client";
1099
+ retryAfter?: number | undefined;
1100
+ code?: string | undefined;
1101
+ provider?: {
1102
+ name: string;
1103
+ model?: string | undefined;
1104
+ statusCode?: number | undefined;
1105
+ errorType?: string | undefined;
1106
+ requestId?: string | undefined;
1107
+ } | undefined;
1108
+ tool?: {
1109
+ name: string;
1110
+ callId?: string | undefined;
1111
+ } | undefined;
1112
+ } | {
1113
+ type: "text-start";
1114
+ id: string;
1115
+ responseType?: string | undefined;
1116
+ } | {
1117
+ type: "text-delta";
1118
+ id: string;
1119
+ delta: string;
1120
+ } | {
1121
+ type: "text-end";
1122
+ id: string;
1123
+ } | {
1124
+ type: "reasoning-start";
1125
+ id: string;
1126
+ } | {
1127
+ type: "reasoning-delta";
1128
+ id: string;
1129
+ delta: string;
1130
+ } | {
1131
+ type: "reasoning-end";
1132
+ id: string;
1133
+ } | {
1134
+ type: "tool-input-start";
1135
+ toolCallId: string;
1136
+ toolName: string;
1137
+ title?: string | undefined;
1138
+ } | {
1139
+ type: "tool-input-delta";
1140
+ toolCallId: string;
1141
+ inputTextDelta: string;
1142
+ } | {
1143
+ type: "tool-input-end";
1144
+ toolCallId: string;
1145
+ } | {
1146
+ type: "tool-input-available";
1147
+ toolCallId: string;
1148
+ toolName: string;
1149
+ input: unknown;
1150
+ } | {
1151
+ type: "tool-output-available";
1152
+ toolCallId: string;
1153
+ output: unknown;
1154
+ } | {
1155
+ type: "tool-output-error";
1156
+ toolCallId: string;
1157
+ error: string;
1158
+ } | {
1159
+ type: "block-start";
1160
+ blockId: string;
1161
+ blockName: string;
1162
+ blockType: string;
1163
+ display: "name" | "hidden" | "description" | "stream";
1164
+ description?: string | undefined;
1165
+ outputToChat?: boolean | undefined;
1166
+ thread?: string | undefined;
1167
+ } | {
1168
+ type: "block-end";
1169
+ blockId: string;
1170
+ summary?: string | undefined;
1171
+ } | {
1172
+ type: "resource-update";
1173
+ name: string;
1174
+ value: unknown;
1175
+ } | {
1176
+ type: "tool-request";
1177
+ toolCalls: {
1178
+ toolCallId: string;
1179
+ toolName: string;
1180
+ args: Record<string, unknown>;
1181
+ source?: "llm" | "block" | undefined;
1182
+ outputVariable?: string | undefined;
1183
+ blockIndex?: number | undefined;
1184
+ }[];
1185
+ } | {
1186
+ type: "client-tool-request";
1187
+ executionId: string;
1188
+ toolCalls: {
1189
+ toolCallId: string;
1190
+ toolName: string;
1191
+ args: Record<string, unknown>;
1192
+ source?: "llm" | "block" | undefined;
1193
+ outputVariable?: string | undefined;
1194
+ blockIndex?: number | undefined;
1195
+ }[];
1196
+ serverToolResults?: {
1197
+ toolCallId: string;
1198
+ toolName?: string | undefined;
1199
+ result?: unknown;
1200
+ error?: string | undefined;
1201
+ outputVariable?: string | undefined;
1202
+ blockIndex?: number | undefined;
1203
+ }[] | undefined;
1204
+ } | {
1205
+ type: "file-available";
1206
+ id: string;
1207
+ mediaType: string;
1208
+ url: string;
1209
+ filename?: string | undefined;
1210
+ size?: number | undefined;
1211
+ toolCallId?: string | undefined;
1212
+ }>;
1213
+ declare function safeParseUIMessage(data: unknown): z.ZodSafeParseResult<{
1214
+ id: string;
1215
+ role: "user" | "assistant";
1216
+ parts: ({
1217
+ type: "source";
1218
+ sourceType: "url";
1219
+ id: string;
1220
+ url: string;
1221
+ title?: string | undefined;
1222
+ thread?: string | undefined;
1223
+ } | {
1224
+ type: "source";
1225
+ sourceType: "document";
1226
+ id: string;
1227
+ mediaType: string;
1228
+ title: string;
1229
+ filename?: string | undefined;
1230
+ thread?: string | undefined;
1231
+ } | {
1232
+ type: "text";
1233
+ text: string;
1234
+ status: "streaming" | "done";
1235
+ thread?: string | undefined;
1236
+ } | {
1237
+ type: "reasoning";
1238
+ text: string;
1239
+ status: "streaming" | "done";
1240
+ thread?: string | undefined;
1241
+ } | {
1242
+ type: "tool-call";
1243
+ toolCallId: string;
1244
+ toolName: string;
1245
+ args: Record<string, unknown>;
1246
+ status: "pending" | "error" | "done" | "running";
1247
+ displayName?: string | undefined;
1248
+ result?: unknown;
1249
+ error?: string | undefined;
1250
+ thread?: string | undefined;
1251
+ } | {
1252
+ type: "operation";
1253
+ operationId: string;
1254
+ name: string;
1255
+ operationType: string;
1256
+ status: "done" | "running";
1257
+ thread?: string | undefined;
1258
+ } | {
1259
+ type: "file";
1260
+ id: string;
1261
+ mediaType: string;
1262
+ url: string;
1263
+ filename?: string | undefined;
1264
+ size?: number | undefined;
1265
+ toolCallId?: string | undefined;
1266
+ thread?: string | undefined;
1267
+ } | {
1268
+ type: "object";
1269
+ id: string;
1270
+ typeName: string;
1271
+ status: "streaming" | "error" | "done";
1272
+ partial?: unknown;
1273
+ object?: unknown;
1274
+ error?: string | undefined;
1275
+ thread?: string | undefined;
1276
+ })[];
1277
+ status: "streaming" | "done";
1278
+ createdAt: Date;
1279
+ }>;
1280
+ declare function safeParseUIMessages(data: unknown): z.ZodSafeParseResult<{
1281
+ id: string;
1282
+ role: "user" | "assistant";
1283
+ parts: ({
1284
+ type: "source";
1285
+ sourceType: "url";
1286
+ id: string;
1287
+ url: string;
1288
+ title?: string | undefined;
1289
+ thread?: string | undefined;
1290
+ } | {
1291
+ type: "source";
1292
+ sourceType: "document";
1293
+ id: string;
1294
+ mediaType: string;
1295
+ title: string;
1296
+ filename?: string | undefined;
1297
+ thread?: string | undefined;
1298
+ } | {
1299
+ type: "text";
1300
+ text: string;
1301
+ status: "streaming" | "done";
1302
+ thread?: string | undefined;
1303
+ } | {
1304
+ type: "reasoning";
1305
+ text: string;
1306
+ status: "streaming" | "done";
1307
+ thread?: string | undefined;
1308
+ } | {
1309
+ type: "tool-call";
1310
+ toolCallId: string;
1311
+ toolName: string;
1312
+ args: Record<string, unknown>;
1313
+ status: "pending" | "error" | "done" | "running";
1314
+ displayName?: string | undefined;
1315
+ result?: unknown;
1316
+ error?: string | undefined;
1317
+ thread?: string | undefined;
1318
+ } | {
1319
+ type: "operation";
1320
+ operationId: string;
1321
+ name: string;
1322
+ operationType: string;
1323
+ status: "done" | "running";
1324
+ thread?: string | undefined;
1325
+ } | {
1326
+ type: "file";
1327
+ id: string;
1328
+ mediaType: string;
1329
+ url: string;
1330
+ filename?: string | undefined;
1331
+ size?: number | undefined;
1332
+ toolCallId?: string | undefined;
1333
+ thread?: string | undefined;
1334
+ } | {
1335
+ type: "object";
1336
+ id: string;
1337
+ typeName: string;
1338
+ status: "streaming" | "error" | "done";
1339
+ partial?: unknown;
1340
+ object?: unknown;
1341
+ error?: string | undefined;
1342
+ thread?: string | undefined;
1343
+ })[];
1344
+ status: "streaming" | "done";
1345
+ createdAt: Date;
1346
+ }[]>;
1347
+ /**
1348
+ * Type guard to check if a value is a FileReference object.
1349
+ */
1350
+ declare function isFileReference(value: unknown): value is z.infer<typeof fileReferenceSchema>;
1351
+ /**
1352
+ * Type guard to check if a value is an array of FileReference objects.
1353
+ */
1354
+ declare function isFileReferenceArray(value: unknown): value is z.infer<typeof fileReferenceSchema>[];
1355
+
1089
1356
  /**
1090
1357
  * Octavus skill tool names
1091
1358
  *
@@ -1131,4 +1398,4 @@ declare function isOctavusSkillTool(toolName: string): toolName is OctavusSkillT
1131
1398
  */
1132
1399
  declare function getSkillSlugFromToolCall(toolName: string, args: Record<string, unknown> | undefined): string | undefined;
1133
1400
 
1134
- export { AppError, type BlockEndEvent, type BlockStartEvent, type ChatMessage, ConflictError, type DisplayMode, type ErrorEvent, type FileAvailableEvent, type FileInfo, type FileReference, type FinishEvent, type FinishReason, type GeneratedFile, MAIN_THREAD, type MessagePart, type MessagePartType, type MessageRole, NotFoundError, OCTAVUS_SKILL_TOOLS, type ObjectInfo, type OctavusSkillToolName, type PendingToolCall, 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 ToolHandler, type ToolHandlers, type ToolInputAvailableEvent, type ToolInputDeltaEvent, type ToolInputEndEvent, type ToolInputStartEvent, type ToolOutputAvailableEvent, type ToolOutputErrorEvent, type ToolRequestEvent, type ToolResult, 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, ValidationError, chatMessageSchema, fileReferenceSchema, generateId, getSkillSlugFromToolCall, isAbortError, isFileReference, isFileReferenceArray, isMainThread, isOctavusSkillTool, isOtherThread, resolveThread, safeParseStreamEvent, safeParseUIMessage, safeParseUIMessages, threadForPart, toolResultSchema, uiMessagePartSchema, uiMessageSchema };
1401
+ 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_SKILL_TOOLS, type ObjectInfo, OctavusError, type OctavusErrorOptions, type OctavusSkillToolName, 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 ToolRequestEvent, type ToolResult, 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, ValidationError, chatMessageSchema, createApiErrorEvent, createErrorEvent, createInternalErrorEvent, errorToStreamEvent, fileReferenceSchema, generateId, getSkillSlugFromToolCall, isAbortError, isAuthenticationError, isFileReference, isFileReferenceArray, isMainThread, isOctavusSkillTool, isOtherThread, isProviderError, isRateLimitError, isRetryableError, isToolError, isValidationError, resolveThread, safeParseStreamEvent, safeParseUIMessage, safeParseUIMessages, threadForPart, toolResultSchema, uiMessagePartSchema, uiMessageSchema };