@voltagent/core 0.1.31 → 0.1.33

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
@@ -215,6 +215,36 @@ declare const createTool: <T extends ToolSchema>(options: ToolOptions<T>) => Too
215
215
  */
216
216
  declare const tool: <T extends ToolSchema>(options: ToolOptions<T>) => Tool<T>;
217
217
 
218
+ /**
219
+ * An async iterable stream that can be read from.
220
+ * @example
221
+ * ```typescript
222
+ * const stream: AsyncIterableStream<string> = getStream();
223
+ * for await (const chunk of stream) {
224
+ * console.log(chunk);
225
+ * }
226
+ * ```
227
+ */
228
+ type AsyncIterableStream<T> = AsyncIterable<T> & ReadableStream<T>;
229
+ /**
230
+ * Create an async iterable stream from a readable stream.
231
+ *
232
+ * This is useful for creating an async iterable stream from a readable stream.
233
+ *
234
+ * @example
235
+ * ```typescript
236
+ * const stream: AsyncIterableStream<string> = createAsyncIterableStream(new ReadableStream({
237
+ * start(controller) {
238
+ * controller.enqueue("Hello");
239
+ * controller.close();
240
+ * },
241
+ * }));
242
+ * ```
243
+ * @param source The readable stream to create an async iterable stream from.
244
+ * @returns The async iterable stream.
245
+ */
246
+ declare function createAsyncIterableStream<T>(source: ReadableStream<T>): AsyncIterableStream<T>;
247
+
218
248
  /**
219
249
  * Memory options
220
250
  */
@@ -260,6 +290,7 @@ type MessageFilterOptions = {
260
290
  type Conversation = {
261
291
  id: string;
262
292
  resourceId: string;
293
+ userId: string;
263
294
  title: string;
264
295
  metadata: Record<string, unknown>;
265
296
  createdAt: string;
@@ -271,9 +302,21 @@ type Conversation = {
271
302
  type CreateConversationInput = {
272
303
  id: string;
273
304
  resourceId: string;
305
+ userId: string;
274
306
  title: string;
275
307
  metadata: Record<string, unknown>;
276
308
  };
309
+ /**
310
+ * Query builder options for conversations
311
+ */
312
+ type ConversationQueryOptions = {
313
+ userId?: string;
314
+ resourceId?: string;
315
+ limit?: number;
316
+ offset?: number;
317
+ orderBy?: "created_at" | "updated_at" | "title";
318
+ orderDirection?: "ASC" | "DESC";
319
+ };
277
320
  /**
278
321
  * Memory interface for storing and retrieving messages
279
322
  */
@@ -281,7 +324,7 @@ type Memory = {
281
324
  /**
282
325
  * Add a message to memory
283
326
  */
284
- addMessage(message: BaseMessage, userId: string, conversationId?: string): Promise<void>;
327
+ addMessage(message: BaseMessage, conversationId?: string): Promise<void>;
285
328
  /**
286
329
  * Get messages from memory
287
330
  */
@@ -305,6 +348,21 @@ type Memory = {
305
348
  * Get conversations for a resource
306
349
  */
307
350
  getConversations(resourceId: string): Promise<Conversation[]>;
351
+ /**
352
+ * Get conversations by user ID with query options
353
+ */
354
+ getConversationsByUserId(userId: string, options?: Omit<ConversationQueryOptions, "userId">): Promise<Conversation[]>;
355
+ /**
356
+ * Get conversations with advanced query options
357
+ */
358
+ queryConversations(options: ConversationQueryOptions): Promise<Conversation[]>;
359
+ /**
360
+ * Get all messages for a specific conversation
361
+ */
362
+ getConversationMessages(conversationId: string, options?: {
363
+ limit?: number;
364
+ offset?: number;
365
+ }): Promise<MemoryMessage[]>;
308
366
  /**
309
367
  * Update a conversation
310
368
  */
@@ -765,27 +823,27 @@ type ModelType<T> = T extends {
765
823
  /**
766
824
  * Infer generate text response type
767
825
  */
768
- type InferGenerateTextResponse$1<T extends {
826
+ type InferGenerateTextResponseFromProvider<TProvider extends {
769
827
  llm: LLMProvider<any>;
770
- }> = Awaited<ReturnType<T["llm"]["generateText"]>>;
828
+ }> = ProviderTextResponse<InferOriginalResponseFromProvider<TProvider, "generateText">>;
771
829
  /**
772
830
  * Infer stream text response type
773
831
  */
774
- type InferStreamTextResponse<T extends {
832
+ type InferStreamTextResponseFromProvider<TProvider extends {
775
833
  llm: LLMProvider<any>;
776
- }> = Awaited<ReturnType<T["llm"]["streamText"]>>;
834
+ }> = ProviderTextStreamResponse<InferOriginalResponseFromProvider<TProvider, "streamText">>;
777
835
  /**
778
836
  * Infer generate object response type
779
837
  */
780
- type InferGenerateObjectResponse$1<T extends {
838
+ type InferGenerateObjectResponseFromProvider<TProvider extends {
781
839
  llm: LLMProvider<any>;
782
- }> = Awaited<ReturnType<T["llm"]["generateObject"]>>;
840
+ }, TSchema extends z.ZodType> = ProviderObjectResponse<InferOriginalResponseFromProvider<TProvider, "generateObject">, z.infer<TSchema>>;
783
841
  /**
784
842
  * Infer stream object response type
785
843
  */
786
- type InferStreamObjectResponse<T extends {
844
+ type InferStreamObjectResponseFromProvider<TProvider extends {
787
845
  llm: LLMProvider<any>;
788
- }> = Awaited<ReturnType<T["llm"]["streamObject"]>>;
846
+ }, TSchema extends z.ZodType> = ProviderObjectStreamResponse<InferOriginalResponseFromProvider<TProvider, "streamObject">, z.infer<TSchema>>;
789
847
  /**
790
848
  * Common generate options - internal version that includes historyEntryId
791
849
  * Not exposed directly to users
@@ -945,6 +1003,8 @@ type OperationContext = {
945
1003
  otelSpan?: Span;
946
1004
  /** Map to store active OpenTelemetry spans for tool calls within this operation */
947
1005
  toolSpans?: Map<string, Span>;
1006
+ /** Conversation steps for building full message history including tool calls/results */
1007
+ conversationSteps?: StepWithContent[];
948
1008
  };
949
1009
  /**
950
1010
  * Tool execution context passed to tool.execute method
@@ -1082,6 +1142,12 @@ interface StandardizedObjectResult<TObject> {
1082
1142
  * Object types are generalized to 'unknown' here for the union.
1083
1143
  */
1084
1144
  type AgentOperationOutput = StandardizedTextResult | StreamTextFinishResult | StandardizedObjectResult<unknown> | StreamObjectFinishResult<unknown>;
1145
+ type InferResponseFromProvider<TProvider extends {
1146
+ llm: LLMProvider<any>;
1147
+ }, TMethod extends "generateText" | "streamText" | "generateObject" | "streamObject"> = Awaited<ReturnType<TProvider["llm"][TMethod]>>;
1148
+ type InferOriginalResponseFromProvider<TProvider extends {
1149
+ llm: LLMProvider<any>;
1150
+ }, TMethod extends "generateText" | "streamText" | "generateObject" | "streamObject"> = InferResponseFromProvider<TProvider, TMethod>["provider"];
1085
1151
 
1086
1152
  /**
1087
1153
  * Token usage information
@@ -1140,7 +1206,7 @@ type ProviderTextStreamResponse<TOriginalResponse> = {
1140
1206
  /**
1141
1207
  * Text stream for consuming the response
1142
1208
  */
1143
- textStream: ReadableStream<string>;
1209
+ textStream: AsyncIterableStream<string>;
1144
1210
  };
1145
1211
  /**
1146
1212
  * Response type for object generation operations
@@ -1174,7 +1240,7 @@ type ProviderObjectStreamResponse<TOriginalResponse, TObject> = {
1174
1240
  /**
1175
1241
  * Object stream for consuming partial objects
1176
1242
  */
1177
- objectStream: ReadableStream<Partial<TObject>>;
1243
+ objectStream: AsyncIterableStream<Partial<TObject>>;
1178
1244
  };
1179
1245
  /**
1180
1246
  * Data content type for binary data
@@ -1362,6 +1428,11 @@ type LLMProvider<TProvider> = {
1362
1428
  * @throws {VoltAgentError} If an error occurs during generation.
1363
1429
  */
1364
1430
  generateText(options: GenerateTextOptions<InferModel<TProvider>>): Promise<ProviderTextResponse<InferGenerateTextResponse<TProvider>>>;
1431
+ /**
1432
+ * Streams a text response based on the provided options.
1433
+ * Implementers should catch underlying SDK/API errors and throw a VoltAgentError.
1434
+ * @throws {VoltAgentError} If an error occurs during streaming.
1435
+ */
1365
1436
  streamText(options: StreamTextOptions<InferModel<TProvider>>): Promise<ProviderTextStreamResponse<InferStreamResponse<TProvider>>>;
1366
1437
  /**
1367
1438
  * Generates a structured object response based on the provided options and schema.
@@ -1369,8 +1440,21 @@ type LLMProvider<TProvider> = {
1369
1440
  * @throws {VoltAgentError} If an error occurs during generation.
1370
1441
  */
1371
1442
  generateObject<TSchema extends z.ZodType>(options: GenerateObjectOptions<InferModel<TProvider>, TSchema>): Promise<ProviderObjectResponse<InferGenerateObjectResponse<TProvider>, z.infer<TSchema>>>;
1443
+ /**
1444
+ * Streams a structured object response based on the provided options and schema.
1445
+ * Implementers should catch underlying SDK/API errors and throw a VoltAgentError.
1446
+ * @throws {VoltAgentError} If an error occurs during streaming.
1447
+ */
1372
1448
  streamObject<TSchema extends z.ZodType>(options: StreamObjectOptions<InferModel<TProvider>, TSchema>): Promise<ProviderObjectStreamResponse<InferStreamResponse<TProvider>, z.infer<TSchema>>>;
1449
+ /**
1450
+ * Converts a base message to a provider-specific message.
1451
+ * @param message The base message to convert.
1452
+ * @returns The provider-specific message.
1453
+ */
1373
1454
  toMessage(message: BaseMessage): InferMessage<TProvider>;
1455
+ /**
1456
+ * Optional tool conversion method.
1457
+ */
1374
1458
  toTool?: (tool: BaseTool) => InferTool<TProvider>;
1375
1459
  /**
1376
1460
  * Returns a string representation of the model identifier.
@@ -1663,10 +1747,9 @@ declare class InMemoryStorage implements Memory {
1663
1747
  /**
1664
1748
  * Add a message to the conversation history
1665
1749
  * @param message Message to add
1666
- * @param userId User identifier (optional, defaults to "default")
1667
1750
  * @param conversationId Conversation identifier (optional, defaults to "default")
1668
1751
  */
1669
- addMessage(message: MemoryMessage, userId?: string, conversationId?: string): Promise<void>;
1752
+ addMessage(message: MemoryMessage, conversationId?: string): Promise<void>;
1670
1753
  /**
1671
1754
  * Clear all messages for a user and optionally a specific conversation
1672
1755
  * @param options Options specifying which messages to clear
@@ -1693,6 +1776,110 @@ declare class InMemoryStorage implements Memory {
1693
1776
  * @returns Array of conversations
1694
1777
  */
1695
1778
  getConversations(resourceId: string): Promise<Conversation[]>;
1779
+ /**
1780
+ * Get conversations by user ID with query options
1781
+ * @param userId User ID
1782
+ * @param options Query options
1783
+ * @returns Array of conversations
1784
+ */
1785
+ getConversationsByUserId(userId: string, options?: Omit<ConversationQueryOptions, "userId">): Promise<Conversation[]>;
1786
+ /**
1787
+ * Query conversations with flexible filtering and pagination options
1788
+ *
1789
+ * This method provides a powerful way to search and filter conversations
1790
+ * with support for user-based filtering, resource filtering, pagination,
1791
+ * and custom sorting.
1792
+ *
1793
+ * @param options Query options for filtering and pagination
1794
+ * @param options.userId Optional user ID to filter conversations by specific user
1795
+ * @param options.resourceId Optional resource ID to filter conversations by specific resource
1796
+ * @param options.limit Maximum number of conversations to return (default: 50)
1797
+ * @param options.offset Number of conversations to skip for pagination (default: 0)
1798
+ * @param options.orderBy Field to sort by: 'created_at', 'updated_at', or 'title' (default: 'updated_at')
1799
+ * @param options.orderDirection Sort direction: 'ASC' or 'DESC' (default: 'DESC')
1800
+ *
1801
+ * @returns Promise that resolves to an array of conversations matching the criteria
1802
+ *
1803
+ * @example
1804
+ * ```typescript
1805
+ * // Get all conversations for a specific user
1806
+ * const userConversations = await storage.queryConversations({
1807
+ * userId: 'user123',
1808
+ * limit: 20
1809
+ * });
1810
+ *
1811
+ * // Get conversations for a resource with pagination
1812
+ * const resourceConversations = await storage.queryConversations({
1813
+ * resourceId: 'chatbot-v1',
1814
+ * limit: 10,
1815
+ * offset: 20,
1816
+ * orderBy: 'created_at',
1817
+ * orderDirection: 'ASC'
1818
+ * });
1819
+ *
1820
+ * // Get all conversations (admin view)
1821
+ * const allConversations = await storage.queryConversations({
1822
+ * limit: 100,
1823
+ * orderBy: 'updated_at'
1824
+ * });
1825
+ * ```
1826
+ */
1827
+ queryConversations(options: ConversationQueryOptions): Promise<Conversation[]>;
1828
+ /**
1829
+ * Get messages for a specific conversation with pagination support
1830
+ *
1831
+ * This method retrieves all messages within a conversation, ordered chronologically
1832
+ * from oldest to newest. It supports pagination to handle large conversations
1833
+ * efficiently and avoid memory issues.
1834
+ *
1835
+ * @param conversationId The unique identifier of the conversation to retrieve messages from
1836
+ * @param options Optional pagination and filtering options
1837
+ * @param options.limit Maximum number of messages to return (default: 100)
1838
+ * @param options.offset Number of messages to skip for pagination (default: 0)
1839
+ *
1840
+ * @returns Promise that resolves to an array of messages in chronological order (oldest first)
1841
+ *
1842
+ * @example
1843
+ * ```typescript
1844
+ * // Get the first 50 messages in a conversation
1845
+ * const messages = await storage.getConversationMessages('conv-123', {
1846
+ * limit: 50
1847
+ * });
1848
+ *
1849
+ * // Get messages with pagination (skip first 20, get next 30)
1850
+ * const olderMessages = await storage.getConversationMessages('conv-123', {
1851
+ * limit: 30,
1852
+ * offset: 20
1853
+ * });
1854
+ *
1855
+ * // Get all messages (use with caution for large conversations)
1856
+ * const allMessages = await storage.getConversationMessages('conv-123');
1857
+ *
1858
+ * // Process messages in batches
1859
+ * const batchSize = 100;
1860
+ * let offset = 0;
1861
+ * let hasMore = true;
1862
+ *
1863
+ * while (hasMore) {
1864
+ * const batch = await storage.getConversationMessages('conv-123', {
1865
+ * limit: batchSize,
1866
+ * offset: offset
1867
+ * });
1868
+ *
1869
+ * // Process batch
1870
+ * processBatch(batch);
1871
+ *
1872
+ * hasMore = batch.length === batchSize;
1873
+ * offset += batchSize;
1874
+ * }
1875
+ * ```
1876
+ *
1877
+ * @throws {Error} If the conversation ID is invalid or operation fails
1878
+ */
1879
+ getConversationMessages(conversationId: string, options?: {
1880
+ limit?: number;
1881
+ offset?: number;
1882
+ }): Promise<MemoryMessage[]>;
1696
1883
  /**
1697
1884
  * Update a conversation
1698
1885
  * @param id Conversation ID
@@ -1791,7 +1978,12 @@ declare class LibSQLStorage implements Memory {
1791
1978
  * @param userId User identifier (optional, defaults to "default")
1792
1979
  * @param conversationId Conversation identifier (optional, defaults to "default")
1793
1980
  */
1794
- addMessage(message: MemoryMessage, userId?: string, conversationId?: string): Promise<void>;
1981
+ addMessage(message: MemoryMessage, conversationId?: string): Promise<void>;
1982
+ /**
1983
+ * Prune old messages to respect storage limit
1984
+ * @param conversationId Conversation ID to prune messages for
1985
+ */
1986
+ private pruneOldMessages;
1795
1987
  /**
1796
1988
  * Clear messages from memory
1797
1989
  */
@@ -1856,6 +2048,27 @@ declare class LibSQLStorage implements Memory {
1856
2048
  createConversation(conversation: CreateConversationInput): Promise<Conversation>;
1857
2049
  getConversation(id: string): Promise<Conversation | null>;
1858
2050
  getConversations(resourceId: string): Promise<Conversation[]>;
2051
+ getConversationsByUserId(userId: string, options?: Omit<ConversationQueryOptions, "userId">): Promise<Conversation[]>;
2052
+ /**
2053
+ * Query conversations with filtering and pagination options
2054
+ *
2055
+ * @param options Query options for filtering and pagination
2056
+ * @returns Promise that resolves to an array of conversations matching the criteria
2057
+ * @see {@link https://voltagent.ai/docs/agents/memory/libsql#querying-conversations | Querying Conversations}
2058
+ */
2059
+ queryConversations(options: ConversationQueryOptions): Promise<Conversation[]>;
2060
+ /**
2061
+ * Get messages for a specific conversation with pagination support
2062
+ *
2063
+ * @param conversationId The unique identifier of the conversation to retrieve messages from
2064
+ * @param options Optional pagination and filtering options
2065
+ * @returns Promise that resolves to an array of messages in chronological order (oldest first)
2066
+ * @see {@link https://voltagent.ai/docs/agents/memory/libsql#conversation-messages | Getting Conversation Messages}
2067
+ */
2068
+ getConversationMessages(conversationId: string, options?: {
2069
+ limit?: number;
2070
+ offset?: number;
2071
+ }): Promise<MemoryMessage[]>;
1859
2072
  updateConversation(id: string, updates: Partial<Omit<Conversation, "id" | "createdAt" | "updatedAt">>): Promise<Conversation>;
1860
2073
  deleteConversation(id: string): Promise<void>;
1861
2074
  /**
@@ -1885,6 +2098,159 @@ declare class LibSQLStorage implements Memory {
1885
2098
  error?: Error;
1886
2099
  backupCreated?: boolean;
1887
2100
  }>;
2101
+ /**
2102
+ * Migrate conversation schema to add user_id and update messages table
2103
+ *
2104
+ * ⚠️ **CRITICAL WARNING: DESTRUCTIVE OPERATION** ⚠️
2105
+ *
2106
+ * This method performs a DESTRUCTIVE schema migration that:
2107
+ * - DROPS and recreates existing tables
2108
+ * - Creates temporary tables during migration
2109
+ * - Modifies the primary key structure of the messages table
2110
+ * - Can cause DATA LOSS if interrupted or if errors occur
2111
+ *
2112
+ * **IMPORTANT SAFETY REQUIREMENTS:**
2113
+ * - 🛑 STOP all application instances before running this migration
2114
+ * - 🛑 Ensure NO concurrent database operations are running
2115
+ * - 🛑 Take a full database backup before running (independent of built-in backup)
2116
+ * - 🛑 Test the migration on a copy of production data first
2117
+ * - 🛑 Plan for downtime during migration execution
2118
+ *
2119
+ * **What this migration does:**
2120
+ * 1. Creates backup tables (if createBackup=true)
2121
+ * 2. Creates temporary tables with new schema
2122
+ * 3. Migrates data from old tables to new schema
2123
+ * 4. DROPS original tables
2124
+ * 5. Renames temporary tables to original names
2125
+ * 6. All operations are wrapped in a transaction for atomicity
2126
+ *
2127
+ * @param options Migration configuration options
2128
+ * @param options.createBackup Whether to create backup tables before migration (default: true, HIGHLY RECOMMENDED)
2129
+ * @param options.restoreFromBackup Whether to restore from existing backup instead of migrating (default: false)
2130
+ * @param options.deleteBackupAfterSuccess Whether to delete backup tables after successful migration (default: false)
2131
+ *
2132
+ * @returns Promise resolving to migration result with success status, migrated count, and backup info
2133
+ *
2134
+ * @example
2135
+ * ```typescript
2136
+ * // RECOMMENDED: Run with backup creation (default)
2137
+ * const result = await storage.migrateConversationSchema({
2138
+ * createBackup: true,
2139
+ * deleteBackupAfterSuccess: false // Keep backup for safety
2140
+ * });
2141
+ *
2142
+ * if (result.success) {
2143
+ * console.log(`Migrated ${result.migratedCount} conversations successfully`);
2144
+ * } else {
2145
+ * console.error('Migration failed:', result.error);
2146
+ * // Consider restoring from backup
2147
+ * }
2148
+ *
2149
+ * // If migration fails, restore from backup:
2150
+ * const restoreResult = await storage.migrateConversationSchema({
2151
+ * restoreFromBackup: true
2152
+ * });
2153
+ * ```
2154
+ *
2155
+ * @throws {Error} If migration fails and transaction is rolled back
2156
+ *
2157
+ * @since This migration is typically only needed when upgrading from older schema versions
2158
+ */
2159
+ private migrateConversationSchema;
2160
+ /**
2161
+ * Get conversations for a user with a fluent query builder interface
2162
+ * @param userId User ID to filter by
2163
+ * @returns Query builder object
2164
+ */
2165
+ getUserConversations(userId: string): {
2166
+ /**
2167
+ * Limit the number of results
2168
+ * @param count Number of conversations to return
2169
+ * @returns Query builder
2170
+ */
2171
+ limit: (count: number) => {
2172
+ /**
2173
+ * Order results by a specific field
2174
+ * @param field Field to order by
2175
+ * @param direction Sort direction
2176
+ * @returns Query builder
2177
+ */
2178
+ orderBy: (field?: "created_at" | "updated_at" | "title", direction?: "ASC" | "DESC") => {
2179
+ /**
2180
+ * Execute the query and return results
2181
+ * @returns Promise of conversations
2182
+ */
2183
+ execute: () => Promise<Conversation[]>;
2184
+ };
2185
+ /**
2186
+ * Execute the query with default ordering
2187
+ * @returns Promise of conversations
2188
+ */
2189
+ execute: () => Promise<Conversation[]>;
2190
+ };
2191
+ /**
2192
+ * Order results by a specific field
2193
+ * @param field Field to order by
2194
+ * @param direction Sort direction
2195
+ * @returns Query builder
2196
+ */
2197
+ orderBy: (field?: "created_at" | "updated_at" | "title", direction?: "ASC" | "DESC") => {
2198
+ /**
2199
+ * Limit the number of results
2200
+ * @param count Number of conversations to return
2201
+ * @returns Query builder
2202
+ */
2203
+ limit: (count: number) => {
2204
+ /**
2205
+ * Execute the query and return results
2206
+ * @returns Promise of conversations
2207
+ */
2208
+ execute: () => Promise<Conversation[]>;
2209
+ };
2210
+ /**
2211
+ * Execute the query without limit
2212
+ * @returns Promise of conversations
2213
+ */
2214
+ execute: () => Promise<Conversation[]>;
2215
+ };
2216
+ /**
2217
+ * Execute the query with default options
2218
+ * @returns Promise of conversations
2219
+ */
2220
+ execute: () => Promise<Conversation[]>;
2221
+ };
2222
+ /**
2223
+ * Get conversation by ID and ensure it belongs to the specified user
2224
+ * @param conversationId Conversation ID
2225
+ * @param userId User ID to validate ownership
2226
+ * @returns Conversation or null
2227
+ */
2228
+ getUserConversation(conversationId: string, userId: string): Promise<Conversation | null>;
2229
+ /**
2230
+ * Get paginated conversations for a user
2231
+ * @param userId User ID
2232
+ * @param page Page number (1-based)
2233
+ * @param pageSize Number of items per page
2234
+ * @returns Object with conversations and pagination info
2235
+ */
2236
+ getPaginatedUserConversations(userId: string, page?: number, pageSize?: number): Promise<{
2237
+ conversations: Conversation[];
2238
+ page: number;
2239
+ pageSize: number;
2240
+ hasMore: boolean;
2241
+ }>;
2242
+ /**
2243
+ * Check and create migration flag table, return if migration already completed
2244
+ * @param migrationType Type of migration to check
2245
+ * @returns Object with completion status and details
2246
+ */
2247
+ private checkMigrationFlag;
2248
+ /**
2249
+ * Set migration flag after successful completion
2250
+ * @param migrationType Type of migration completed
2251
+ * @param migratedCount Number of records migrated
2252
+ */
2253
+ private setMigrationFlag;
1888
2254
  }
1889
2255
 
1890
2256
  /**
@@ -2207,11 +2573,19 @@ interface OnStartHookArgs {
2207
2573
  context: OperationContext;
2208
2574
  }
2209
2575
  interface OnEndHookArgs {
2576
+ /**
2577
+ * The conversation ID.
2578
+ */
2579
+ conversationId: string;
2580
+ /**
2581
+ * The agent that generated the output.
2582
+ */
2210
2583
  agent: Agent<any>;
2211
2584
  /** The standardized successful output object. Undefined on error. */
2212
2585
  output: AgentOperationOutput | undefined;
2213
2586
  /** The VoltAgentError object if the operation failed. Undefined on success. */
2214
2587
  error: VoltAgentError | undefined;
2588
+ /** The complete conversation messages including user input and assistant responses (Vercel AI SDK compatible) */
2215
2589
  context: OperationContext;
2216
2590
  }
2217
2591
  interface OnHandoffHookArgs {
@@ -2475,7 +2849,7 @@ declare class Agent<TProvider extends {
2475
2849
  */
2476
2850
  getHistory(): Promise<AgentHistoryEntry[]>;
2477
2851
  /**
2478
- * Add step to history immediately
2852
+ * Add step to history immediately and to conversation steps
2479
2853
  */
2480
2854
  private addStepToHistory;
2481
2855
  /**
@@ -2497,19 +2871,19 @@ declare class Agent<TProvider extends {
2497
2871
  /**
2498
2872
  * Generate a text response without streaming
2499
2873
  */
2500
- generateText(input: string | BaseMessage[], options?: PublicGenerateOptions): Promise<InferGenerateTextResponse$1<TProvider>>;
2874
+ generateText(input: string | BaseMessage[], options?: PublicGenerateOptions): Promise<InferGenerateTextResponseFromProvider<TProvider>>;
2501
2875
  /**
2502
2876
  * Stream a text response
2503
2877
  */
2504
- streamText(input: string | BaseMessage[], options?: PublicGenerateOptions): Promise<InferStreamTextResponse<TProvider>>;
2878
+ streamText(input: string | BaseMessage[], options?: PublicGenerateOptions): Promise<InferStreamTextResponseFromProvider<TProvider>>;
2505
2879
  /**
2506
2880
  * Generate a structured object response
2507
2881
  */
2508
- generateObject<T extends z.ZodType>(input: string | BaseMessage[], schema: T, options?: PublicGenerateOptions): Promise<InferGenerateObjectResponse$1<TProvider>>;
2882
+ generateObject<TSchema extends z.ZodType>(input: string | BaseMessage[], schema: TSchema, options?: PublicGenerateOptions): Promise<InferGenerateObjectResponseFromProvider<TProvider, TSchema>>;
2509
2883
  /**
2510
2884
  * Stream a structured object response
2511
2885
  */
2512
- streamObject<T extends z.ZodType>(input: string | BaseMessage[], schema: T, options?: PublicGenerateOptions): Promise<InferStreamObjectResponse<TProvider>>;
2886
+ streamObject<TSchema extends z.ZodType>(input: string | BaseMessage[], schema: TSchema, options?: PublicGenerateOptions): Promise<InferStreamObjectResponseFromProvider<TProvider, TSchema>>;
2513
2887
  /**
2514
2888
  * Add a sub-agent that this agent can delegate tasks to
2515
2889
  */
@@ -3387,4 +3761,4 @@ declare class VoltAgent {
3387
3761
  shutdownTelemetry(): Promise<void>;
3388
3762
  }
3389
3763
 
3390
- export { Agent, AgentErrorEvent, AgentHistoryEntry, AgentHookOnEnd, AgentHookOnHandoff, AgentHookOnStart, AgentHookOnToolEnd, AgentHookOnToolStart, AgentHooks, AgentOptions, AgentRegistry, AgentResponse, AgentStartEvent, AgentStartEventMetadata, AgentSuccessEvent, AgentSuccessEventMetadata, AgentTool, AllowedVariableValue, AnyToolConfig, BaseEventMetadata, BaseLLMOptions, BaseMessage, BaseRetriever, BaseTimelineEvent, BaseTool, BaseToolCall, ClientInfo, Conversation, CreateConversationInput, CreateReasoningToolsOptions, CustomEndpointDefinition, CustomEndpointError, CustomEndpointHandler, DEFAULT_INSTRUCTIONS, DataContent, EventStatus, ExtractVariableNames, FEW_SHOT_EXAMPLES, FilePart, GenerateObjectOptions, GenerateTextOptions, HTTPServerConfig, HistoryStatus, HttpMethod, ImagePart, InMemoryStorage, InferGenerateObjectResponse, InferGenerateTextResponse, InferMessage, InferModel, InferProviderParams, InferStreamResponse, InferTool, LLMProvider, LibSQLStorage, MCPClient, MCPClientConfig, MCPClientEvents, MCPConfiguration, MCPOptions, MCPServerConfig, MCPToolCall, MCPToolResult, Memory, MemoryEventMetadata, MemoryManager, MemoryMessage, MemoryOptions, MemoryReadErrorEvent, MemoryReadStartEvent, MemoryReadSuccessEvent, MemoryWriteErrorEvent, MemoryWriteStartEvent, MemoryWriteSuccessEvent, MessageContent, MessageFilterOptions, MessageRole, ModelToolCall, NewTimelineEvent, NextAction, NodeType, OnEndHookArgs, OnHandoffHookArgs, OnStartHookArgs, OnToolEndHookArgs, OnToolStartHookArgs, OperationContext, PackageUpdateInfo, PromptCreator, PromptTemplate, ProviderObjectResponse, ProviderObjectStreamResponse, ProviderParams, ProviderResponse, ProviderTextResponse, ProviderTextStreamResponse, ReadableStreamType, ReasoningStep, ReasoningStepSchema, ReasoningToolExecuteOptions, RetrieveOptions, Retriever, RetrieverErrorEvent, RetrieverOptions, RetrieverStartEvent, RetrieverSuccessEvent, RetryConfig, StandardEventData, StandardTimelineEvent, StdioServerConfig, StepChunkCallback, StepFinishCallback, StepWithContent, StreamObjectFinishResult, StreamObjectOnFinishCallback, StreamObjectOptions, StreamTextFinishResult, StreamTextOnFinishCallback, StreamTextOptions, TemplateVariables, TextPart, TimelineEventCoreLevel, TimelineEventCoreStatus, TimelineEventCoreType, Tool, ToolCall, ToolErrorEvent, ToolErrorInfo, ToolExecuteOptions, ToolExecutionContext, ToolManager, ToolOptions, ToolSchema, ToolStartEvent, ToolStatus, ToolStatusInfo, ToolSuccessEvent, Toolkit, ToolsetMap, ToolsetWithTools, TransportError, Usage, UsageInfo, Voice, VoiceEventData, VoiceEventType, VoiceMetadata, VoiceOptions, VoltAgent, VoltAgentError, VoltAgentExporter, VoltAgentExporterOptions, checkForUpdates, createHooks, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createTool, createToolkit, VoltAgent as default, getNodeTypeFromNodeId, registerCustomEndpoint, registerCustomEndpoints, safeJsonParse, serializeValueForDebug, tool, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
3764
+ export { Agent, AgentErrorEvent, AgentHistoryEntry, AgentHookOnEnd, AgentHookOnHandoff, AgentHookOnStart, AgentHookOnToolEnd, AgentHookOnToolStart, AgentHooks, AgentOptions, AgentRegistry, AgentResponse, AgentStartEvent, AgentStartEventMetadata, AgentSuccessEvent, AgentSuccessEventMetadata, AgentTool, AllowedVariableValue, AnyToolConfig, AsyncIterableStream, BaseEventMetadata, BaseLLMOptions, BaseMessage, BaseRetriever, BaseTimelineEvent, BaseTool, BaseToolCall, ClientInfo, Conversation, ConversationQueryOptions, CreateConversationInput, CreateReasoningToolsOptions, CustomEndpointDefinition, CustomEndpointError, CustomEndpointHandler, DEFAULT_INSTRUCTIONS, DataContent, EventStatus, ExtractVariableNames, FEW_SHOT_EXAMPLES, FilePart, GenerateObjectOptions, GenerateTextOptions, HTTPServerConfig, HistoryStatus, HttpMethod, ImagePart, InMemoryStorage, InferGenerateObjectResponse, InferGenerateTextResponse, InferMessage, InferModel, InferProviderParams, InferStreamResponse, InferTool, LLMProvider, LibSQLStorage, MCPClient, MCPClientConfig, MCPClientEvents, MCPConfiguration, MCPOptions, MCPServerConfig, MCPToolCall, MCPToolResult, Memory, MemoryEventMetadata, MemoryManager, MemoryMessage, MemoryOptions, MemoryReadErrorEvent, MemoryReadStartEvent, MemoryReadSuccessEvent, MemoryWriteErrorEvent, MemoryWriteStartEvent, MemoryWriteSuccessEvent, MessageContent, MessageFilterOptions, MessageRole, ModelToolCall, NewTimelineEvent, NextAction, NodeType, OnEndHookArgs, OnHandoffHookArgs, OnStartHookArgs, OnToolEndHookArgs, OnToolStartHookArgs, OperationContext, PackageUpdateInfo, PromptCreator, PromptTemplate, ProviderObjectResponse, ProviderObjectStreamResponse, ProviderParams, ProviderResponse, ProviderTextResponse, ProviderTextStreamResponse, ReadableStreamType, ReasoningStep, ReasoningStepSchema, ReasoningToolExecuteOptions, RetrieveOptions, Retriever, RetrieverErrorEvent, RetrieverOptions, RetrieverStartEvent, RetrieverSuccessEvent, RetryConfig, StandardEventData, StandardTimelineEvent, StdioServerConfig, StepChunkCallback, StepFinishCallback, StepWithContent, StreamObjectFinishResult, StreamObjectOnFinishCallback, StreamObjectOptions, StreamTextFinishResult, StreamTextOnFinishCallback, StreamTextOptions, TemplateVariables, TextPart, TimelineEventCoreLevel, TimelineEventCoreStatus, TimelineEventCoreType, Tool, ToolCall, ToolErrorEvent, ToolErrorInfo, ToolExecuteOptions, ToolExecutionContext, ToolManager, ToolOptions, ToolSchema, ToolStartEvent, ToolStatus, ToolStatusInfo, ToolSuccessEvent, Toolkit, ToolsetMap, ToolsetWithTools, TransportError, Usage, UsageInfo, Voice, VoiceEventData, VoiceEventType, VoiceMetadata, VoiceOptions, VoltAgent, VoltAgentError, VoltAgentExporter, VoltAgentExporterOptions, checkForUpdates, createAsyncIterableStream, createHooks, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createTool, createToolkit, VoltAgent as default, getNodeTypeFromNodeId, registerCustomEndpoint, registerCustomEndpoints, safeJsonParse, serializeValueForDebug, tool, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };