@voltagent/core 0.1.36 → 0.1.37
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 +67 -2
- package/dist/index.js +5121 -5226
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5120 -5227
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -520,6 +520,14 @@ interface AgentHistoryEntry {
|
|
|
520
520
|
*/
|
|
521
521
|
usage?: UsageInfo;
|
|
522
522
|
metadata?: Record<string, unknown>;
|
|
523
|
+
/**
|
|
524
|
+
* User ID associated with this history entry
|
|
525
|
+
*/
|
|
526
|
+
userId?: string;
|
|
527
|
+
/**
|
|
528
|
+
* Conversation ID associated with this history entry
|
|
529
|
+
*/
|
|
530
|
+
conversationId?: string;
|
|
523
531
|
/**
|
|
524
532
|
* Sequence number for the history entry
|
|
525
533
|
*/
|
|
@@ -858,7 +866,6 @@ interface CommonGenerateOptions {
|
|
|
858
866
|
historyEntryId?: string;
|
|
859
867
|
operationContext?: OperationContext;
|
|
860
868
|
userContext?: Map<string | symbol, unknown>;
|
|
861
|
-
streamEventForwarder?: (event: any) => Promise<void>;
|
|
862
869
|
}
|
|
863
870
|
/**
|
|
864
871
|
* Public-facing generate options for external users
|
|
@@ -1220,35 +1227,49 @@ type ProviderTextResponse<TOriginalResponse> = {
|
|
|
1220
1227
|
type TextDeltaStreamPart = {
|
|
1221
1228
|
type: "text-delta";
|
|
1222
1229
|
textDelta: string;
|
|
1230
|
+
subAgentId?: string;
|
|
1231
|
+
subAgentName?: string;
|
|
1223
1232
|
};
|
|
1224
1233
|
type ReasoningStreamPart = {
|
|
1225
1234
|
type: "reasoning";
|
|
1226
1235
|
reasoning: string;
|
|
1236
|
+
subAgentId?: string;
|
|
1237
|
+
subAgentName?: string;
|
|
1227
1238
|
};
|
|
1228
1239
|
type SourceStreamPart = {
|
|
1229
1240
|
type: "source";
|
|
1230
1241
|
source: string;
|
|
1242
|
+
subAgentId?: string;
|
|
1243
|
+
subAgentName?: string;
|
|
1231
1244
|
};
|
|
1232
1245
|
type ToolCallStreamPart = {
|
|
1233
1246
|
type: "tool-call";
|
|
1234
1247
|
toolCallId: string;
|
|
1235
1248
|
toolName: string;
|
|
1236
1249
|
args: Record<string, any>;
|
|
1250
|
+
subAgentId?: string;
|
|
1251
|
+
subAgentName?: string;
|
|
1237
1252
|
};
|
|
1238
1253
|
type ToolResultStreamPart = {
|
|
1239
1254
|
type: "tool-result";
|
|
1240
1255
|
toolCallId: string;
|
|
1241
1256
|
toolName: string;
|
|
1242
1257
|
result: any;
|
|
1258
|
+
subAgentId?: string;
|
|
1259
|
+
subAgentName?: string;
|
|
1243
1260
|
};
|
|
1244
1261
|
type FinishStreamPart = {
|
|
1245
1262
|
type: "finish";
|
|
1246
1263
|
finishReason?: string;
|
|
1247
1264
|
usage?: UsageInfo;
|
|
1265
|
+
subAgentId?: string;
|
|
1266
|
+
subAgentName?: string;
|
|
1248
1267
|
};
|
|
1249
1268
|
type ErrorStreamPart = {
|
|
1250
1269
|
type: "error";
|
|
1251
1270
|
error: Error;
|
|
1271
|
+
subAgentId?: string;
|
|
1272
|
+
subAgentName?: string;
|
|
1252
1273
|
};
|
|
1253
1274
|
type StreamPart = TextDeltaStreamPart | ReasoningStreamPart | SourceStreamPart | ToolCallStreamPart | ToolResultStreamPart | FinishStreamPart | ErrorStreamPart;
|
|
1254
1275
|
/**
|
|
@@ -2313,6 +2334,10 @@ declare class LibSQLStorage implements Memory {
|
|
|
2313
2334
|
* @param migratedCount Number of records migrated
|
|
2314
2335
|
*/
|
|
2315
2336
|
private setMigrationFlag;
|
|
2337
|
+
/**
|
|
2338
|
+
* Migrate agent history schema to add userId and conversationId columns
|
|
2339
|
+
*/
|
|
2340
|
+
private migrateAgentHistorySchema;
|
|
2316
2341
|
}
|
|
2317
2342
|
|
|
2318
2343
|
/**
|
|
@@ -2930,6 +2955,10 @@ declare class Agent<TProvider extends {
|
|
|
2930
2955
|
* Helper method to enrich and end an OpenTelemetry span associated with a tool call.
|
|
2931
2956
|
*/
|
|
2932
2957
|
private _endOtelToolSpan;
|
|
2958
|
+
/**
|
|
2959
|
+
* Create an enhanced fullStream that includes SubAgent events
|
|
2960
|
+
*/
|
|
2961
|
+
private createEnhancedFullStream;
|
|
2933
2962
|
/**
|
|
2934
2963
|
* Generate a text response without streaming
|
|
2935
2964
|
*/
|
|
@@ -3306,6 +3335,42 @@ declare const updateSinglePackage: (packageName: string, packagePath?: string) =
|
|
|
3306
3335
|
declare function safeJsonParse(value: string | null | undefined): any;
|
|
3307
3336
|
declare function serializeValueForDebug(value: unknown): unknown;
|
|
3308
3337
|
|
|
3338
|
+
/**
|
|
3339
|
+
* Utility for merging multiple async streams with event queue integration
|
|
3340
|
+
*/
|
|
3341
|
+
interface StreamMergerOptions {
|
|
3342
|
+
/**
|
|
3343
|
+
* Polling interval for checking events (in milliseconds)
|
|
3344
|
+
* Default: 16ms (~60fps for smooth UI updates)
|
|
3345
|
+
*/
|
|
3346
|
+
pollingInterval?: number;
|
|
3347
|
+
/**
|
|
3348
|
+
* Post-stream polling interval when main stream is finished (in milliseconds)
|
|
3349
|
+
* Default: 10ms
|
|
3350
|
+
*/
|
|
3351
|
+
postStreamInterval?: number;
|
|
3352
|
+
}
|
|
3353
|
+
/**
|
|
3354
|
+
* Creates an enhanced stream that merges an original async iterable with events
|
|
3355
|
+
* from a shared queue, ensuring chronological order and smooth UI updates.
|
|
3356
|
+
*
|
|
3357
|
+
* @param originalStream - The main stream to merge with
|
|
3358
|
+
* @param eventsQueue - Shared array that other sources push events to
|
|
3359
|
+
* @param options - Configuration options for polling intervals
|
|
3360
|
+
* @returns Enhanced async iterable that yields events from both sources
|
|
3361
|
+
*/
|
|
3362
|
+
declare function createMergedStream<T>(originalStream: AsyncIterable<T>, eventsQueue: T[], options?: StreamMergerOptions): AsyncIterable<T>;
|
|
3363
|
+
/**
|
|
3364
|
+
* Helper type for SubAgent events that can be merged into a main stream
|
|
3365
|
+
*/
|
|
3366
|
+
interface SubAgentEvent {
|
|
3367
|
+
type: string;
|
|
3368
|
+
data: any;
|
|
3369
|
+
timestamp: string;
|
|
3370
|
+
subAgentId: string;
|
|
3371
|
+
subAgentName: string;
|
|
3372
|
+
}
|
|
3373
|
+
|
|
3309
3374
|
/**
|
|
3310
3375
|
* Creates an AgentTool from a retriever, allowing it to be used as a tool in an agent.
|
|
3311
3376
|
* This is the preferred way to use a retriever as a tool, as it properly maintains the 'this' context.
|
|
@@ -3907,4 +3972,4 @@ declare class VoltAgent {
|
|
|
3907
3972
|
shutdownTelemetry(): Promise<void>;
|
|
3908
3973
|
}
|
|
3909
3974
|
|
|
3910
|
-
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, ErrorStreamPart, EventStatus, ExtractVariableNames, FEW_SHOT_EXAMPLES, FilePart, FinishStreamPart, 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, ReasoningStreamPart, ReasoningToolExecuteOptions, RetrieveOptions, Retriever, RetrieverErrorEvent, RetrieverOptions, RetrieverStartEvent, RetrieverSuccessEvent, SSEServerConfig, ServerOptions, SourceStreamPart, StandardEventData, StandardTimelineEvent, StdioServerConfig, StepChunkCallback, StepFinishCallback, StepWithContent, StreamObjectFinishResult, StreamObjectOnFinishCallback, StreamObjectOptions, StreamPart, StreamTextFinishResult, StreamTextOnFinishCallback, StreamTextOptions, StreamableHTTPServerConfig, TemplateVariables, TextDeltaStreamPart, TextPart, TimelineEventCoreLevel, TimelineEventCoreStatus, TimelineEventCoreType, Tool, ToolCall, ToolCallStreamPart, ToolErrorEvent, ToolErrorInfo, ToolExecuteOptions, ToolExecutionContext, ToolManager, ToolOptions, ToolResultStreamPart, ToolSchema, ToolStartEvent, ToolStatus, ToolStatusInfo, ToolSuccessEvent, Toolkit, ToolsetMap, ToolsetWithTools, TransportError, Usage, UsageInfo, Voice, VoiceEventData, VoiceEventType, VoiceMetadata, VoiceOptions, VoltAgent, VoltAgentError, VoltAgentExporter, VoltAgentExporterOptions, VoltAgentOptions, checkForUpdates, createAsyncIterableStream, createHooks, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createTool, createToolkit, VoltAgent as default, getNodeTypeFromNodeId, registerCustomEndpoint, registerCustomEndpoints, safeJsonParse, serializeValueForDebug, tool, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
|
|
3975
|
+
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, ErrorStreamPart, EventStatus, ExtractVariableNames, FEW_SHOT_EXAMPLES, FilePart, FinishStreamPart, 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, ReasoningStreamPart, ReasoningToolExecuteOptions, RetrieveOptions, Retriever, RetrieverErrorEvent, RetrieverOptions, RetrieverStartEvent, RetrieverSuccessEvent, SSEServerConfig, ServerOptions, SourceStreamPart, StandardEventData, StandardTimelineEvent, StdioServerConfig, StepChunkCallback, StepFinishCallback, StepWithContent, StreamMergerOptions, StreamObjectFinishResult, StreamObjectOnFinishCallback, StreamObjectOptions, StreamPart, StreamTextFinishResult, StreamTextOnFinishCallback, StreamTextOptions, StreamableHTTPServerConfig, SubAgentEvent, TemplateVariables, TextDeltaStreamPart, TextPart, TimelineEventCoreLevel, TimelineEventCoreStatus, TimelineEventCoreType, Tool, ToolCall, ToolCallStreamPart, ToolErrorEvent, ToolErrorInfo, ToolExecuteOptions, ToolExecutionContext, ToolManager, ToolOptions, ToolResultStreamPart, ToolSchema, ToolStartEvent, ToolStatus, ToolStatusInfo, ToolSuccessEvent, Toolkit, ToolsetMap, ToolsetWithTools, TransportError, Usage, UsageInfo, Voice, VoiceEventData, VoiceEventType, VoiceMetadata, VoiceOptions, VoltAgent, VoltAgentError, VoltAgentExporter, VoltAgentExporterOptions, VoltAgentOptions, checkForUpdates, createAsyncIterableStream, createHooks, createMergedStream, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createTool, createToolkit, VoltAgent as default, getNodeTypeFromNodeId, registerCustomEndpoint, registerCustomEndpoints, safeJsonParse, serializeValueForDebug, tool, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
|