@voltagent/core 1.2.7 → 1.2.8
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.mts +37 -2
- package/dist/index.d.ts +37 -2
- package/dist/index.js +82 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ import { AsyncIterableStream } from '@voltagent/internal/utils';
|
|
|
8
8
|
export { AsyncIterableStream, createAsyncIterableStream } from '@voltagent/internal/utils';
|
|
9
9
|
import { Logger, LogFn, LogBuffer } from '@voltagent/internal';
|
|
10
10
|
import { Tracer, SpanOptions, Span, SpanStatusCode as SpanStatusCode$1, context, trace, SpanKind as SpanKind$1, Context } from '@opentelemetry/api';
|
|
11
|
-
export { Span, SpanOptions, Tracer, context, trace } from '@opentelemetry/api';
|
|
11
|
+
export { ROOT_CONTEXT, Span, SpanOptions, Tracer, context, propagation, trace } from '@opentelemetry/api';
|
|
12
12
|
import { LogRecordProcessor, LoggerProvider, ReadableLogRecord, SdkLogRecord } from '@opentelemetry/sdk-logs';
|
|
13
13
|
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
|
|
14
14
|
import { SpanProcessor, BasicTracerProvider, ReadableSpan, Span as Span$1 } from '@opentelemetry/sdk-trace-base';
|
|
@@ -3444,6 +3444,12 @@ declare class VoltAgentObservability$1 {
|
|
|
3444
3444
|
getLogsBySpanId(spanId: string): Promise<any[]>;
|
|
3445
3445
|
shutdown(): Promise<void>;
|
|
3446
3446
|
forceFlush(): Promise<void>;
|
|
3447
|
+
/**
|
|
3448
|
+
* Flushes spans on finish.
|
|
3449
|
+
* We force flush here to ensure spans are exported even if the runtime
|
|
3450
|
+
* is incorrectly detected or if we are in a short-lived process.
|
|
3451
|
+
*/
|
|
3452
|
+
flushOnFinish(): Promise<void>;
|
|
3447
3453
|
getProvider(): NodeTracerProvider;
|
|
3448
3454
|
getContext(): typeof context;
|
|
3449
3455
|
getTraceAPI(): typeof trace;
|
|
@@ -3500,6 +3506,11 @@ declare class ServerlessVoltAgentObservability {
|
|
|
3500
3506
|
getLogsBySpanId(spanId: string): Promise<any[]>;
|
|
3501
3507
|
shutdown(): Promise<void>;
|
|
3502
3508
|
forceFlush(): Promise<void>;
|
|
3509
|
+
/**
|
|
3510
|
+
* Flushes spans without blocking the response if waitUntil is available.
|
|
3511
|
+
* This is the preferred method to call at the end of a request.
|
|
3512
|
+
*/
|
|
3513
|
+
flushOnFinish(): Promise<void>;
|
|
3503
3514
|
getProvider(): BasicTracerProvider;
|
|
3504
3515
|
getContext(): typeof context;
|
|
3505
3516
|
getTraceAPI(): typeof trace;
|
|
@@ -3914,6 +3925,30 @@ declare class RemoteLogProcessor implements LogRecordProcessor {
|
|
|
3914
3925
|
private tryInitialize;
|
|
3915
3926
|
}
|
|
3916
3927
|
|
|
3928
|
+
/**
|
|
3929
|
+
* Sets the waitUntil function for the current execution context.
|
|
3930
|
+
* This is used by the observability pipeline to flush spans without blocking the response
|
|
3931
|
+
* in serverless environments (e.g., Cloudflare Workers, Vercel).
|
|
3932
|
+
*
|
|
3933
|
+
* @param waitUntil - The platform-specific waitUntil function
|
|
3934
|
+
*
|
|
3935
|
+
* @example
|
|
3936
|
+
* // In Next.js App Router
|
|
3937
|
+
* import { setWaitUntil } from '@voltagent/core';
|
|
3938
|
+
* import { after } from 'next/server'; // or from context
|
|
3939
|
+
*
|
|
3940
|
+
* export async function POST(req: Request) {
|
|
3941
|
+
* // If using Vercel's waitUntil from context or similar
|
|
3942
|
+
* // setWaitUntil(ctx.waitUntil);
|
|
3943
|
+
*
|
|
3944
|
+
* // Or if using Next.js 15+ after()
|
|
3945
|
+
* // setWaitUntil(after);
|
|
3946
|
+
*
|
|
3947
|
+
* // ... agent code ...
|
|
3948
|
+
* }
|
|
3949
|
+
*/
|
|
3950
|
+
declare function setWaitUntil(waitUntil: (promise: Promise<unknown>) => void): void;
|
|
3951
|
+
|
|
3917
3952
|
/**
|
|
3918
3953
|
* VoltAgent Observability - Built on OpenTelemetry
|
|
3919
3954
|
*
|
|
@@ -9991,4 +10026,4 @@ declare class VoltAgent {
|
|
|
9991
10026
|
*/
|
|
9992
10027
|
declare function convertUsage(usage: LanguageModelUsage | undefined): UsageInfo | undefined;
|
|
9993
10028
|
|
|
9994
|
-
export { A2AServerRegistry, AbortError, Agent, type AgentEvalConfig, type AgentEvalContext, type AgentEvalOperationType, type AgentEvalPayload, type AgentEvalResult, type AgentEvalSamplingPolicy, type AgentEvalScorerConfig, type AgentEvalScorerFactory, type AgentEvalScorerReference, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnHandoff, type AgentHookOnHandoffComplete, type AgentHookOnPrepareMessages, type AgentHookOnPrepareModelMessages, type AgentHookOnStart, type AgentHookOnStepFinish, type AgentHookOnToolEnd, type AgentHookOnToolStart, type AgentHooks, type AgentOptions, AgentRegistry, type AgentResponse, type AgentScorerState, type AgentStatus, type AgentTool, AiSdkEmbeddingAdapter, type AllowedVariableValue, type ApiToolInfo, type BaseEventMetadata, type BaseGenerationOptions, type BaseLLMOptions, type BaseMessage, BaseRetriever, type BaseTool, type BaseToolCall, type BuildScorerOptions, type BuildScorerRunArgs, type BuildScorerRunResult, type BuilderAnalyzeContext, type BuilderPrepareContext, type BuilderReasonContext, type BuilderScoreContext, type CachedPrompt, type ChatMessage, ClientHTTPError, type ClientSideToolResult, type CloudflareFetchHandler, type Conversation, ConversationAlreadyExistsError, ConversationNotFoundError, type ConversationQueryOptions, type ConversationQueryOptions as ConversationQueryOptionsV2, type ConversationStepRecord, type ConversationStepType, type Conversation as ConversationV2, type CreateConversationInput, type CreateConversationInput as CreateConversationInputV2, type CreateInputGuardrailOptions, type CreateOutputGuardrailOptions, type CreateReasoningToolsOptions, type CreateScorerOptions, DEFAULT_INSTRUCTIONS, type DataContent, type Document, type DynamicValue, type DynamicValueOptions, type EmbeddingAdapter$1 as EmbeddingAdapter, EmbeddingAdapterNotConfiguredError, EmbeddingError, type ExtractVariableNames, FEW_SHOT_EXAMPLES, type GenerateObjectOptions, type GenerateObjectSubAgentConfig, type GenerateReasonResult, type GenerateScoreResult, type GenerateScoreStep, type GenerateTextOptions, type GenerateTextSubAgentConfig, type GetConversationStepsOptions, type GetMessagesOptions, type GuardrailAction, type GuardrailContext, type GuardrailDefinition, type GuardrailFunction, type GuardrailSeverity, type IServerProvider, type IServerlessProvider, type VoltOpsClient$1 as IVoltOpsClient, InMemoryStorageAdapter$1 as InMemoryObservabilityAdapter, InMemoryStorageAdapter, InMemoryVectorAdapter, type InferGenerateObjectResponse, type InferGenerateTextResponse, type InferMessage, type InferModel, type InferProviderParams, type InferStreamResponse, type InferTool, type InputGuardrail, type InputGuardrailArgs, type InputGuardrailResult, type LLMProvider, LazyRemoteExportProcessor, type LocalScorerDefinition, type LocalScorerExecutionResult, LocalStorageSpanProcessor, type LogFilter, LoggerProxy, MCPConfiguration, type MCPElicitationAdapter, type MCPLoggingAdapter, type MCPPromptsAdapter, type MCPResourcesAdapter, MCPServerRegistry, type ManagedMemoryAddMessageInput, type ManagedMemoryAddMessagesInput, type ManagedMemoryClearMessagesInput, type ManagedMemoryConnectionInfo, type ManagedMemoryConversationsClient, type ManagedMemoryCredentialCreateResult, type ManagedMemoryCredentialListResult, type ManagedMemoryCredentialSummary, type ManagedMemoryDatabaseSummary, type ManagedMemoryGetMessagesInput, type ManagedMemoryMessagesClient, type ManagedMemorySetWorkingMemoryInput, type ManagedMemoryStatus, type ManagedMemoryUpdateConversationInput, type ManagedMemoryVoltOpsClient, type ManagedMemoryWorkflowStateUpdateInput, type ManagedMemoryWorkflowStatesClient, type ManagedMemoryWorkingMemoryClient, type ManagedMemoryWorkingMemoryInput, Memory, type MemoryConfig, type MemoryOptions, type MemoryStorageMetadata, type MemoryUpdateMode, Memory as MemoryV2, MemoryV2Error, type MessageContent, MessageContentBuilder, type MessageRole, type ModelToolCall, NextAction, NodeType, VoltAgentObservability$1 as NodeVoltAgentObservability, type ObservabilityConfig, type ObservabilityLogRecord, type ObservabilitySpan, type ObservabilityStorageAdapter, type ObservabilityWebSocketEvent, type OnEndHookArgs, type OnErrorHookArgs, type OnHandoffCompleteHookArgs, type OnHandoffHookArgs, type OnPrepareMessagesHookArgs, type OnPrepareMessagesHookResult, type OnPrepareModelMessagesHookArgs, type OnPrepareModelMessagesHookResult, type OnStartHookArgs, type OnStepFinishHookArgs, type OnToolEndHookArgs, type OnToolStartHookArgs, type OperationContext, type OutputGuardrail, type OutputGuardrailArgs, type OutputGuardrailResult, type PackageUpdateInfo, type PromptApiClient, type PromptApiResponse, type PromptContent, type PromptCreator, type PromptHelper, type PromptReference, type PromptTemplate, type ProviderObjectResponse, type ProviderObjectStreamResponse, type ProviderParams, type ProviderResponse, type ProviderTextResponse, type ProviderTextStreamResponse, type ProviderTool, type ReadableStreamType, type ReasoningStep, ReasoningStepSchema, type RegisterOptions, type RegisteredTrigger, type RegisteredWorkflow, type RemoteLogExportConfig, RemoteLogProcessor, type RetrieveOptions, type Retriever, type RetrieverOptions, type RunLocalScorersArgs, type RunLocalScorersResult, type SamplingMetadata, type SamplingPolicy, type ScorerBuilder, type ScorerContext, type ScorerLifecycleScope, type ScorerPipelineContext, type ScorerReasonContext, type ScorerResult, type SearchOptions, type SearchResult, type ServerAgentResponse, type ServerApiResponse, type ServerProviderDeps, type ServerProviderFactory, type ServerWorkflowResponse, type ServerlessProviderFactory, type ServerlessRemoteEndpointConfig, type ServerlessRemoteExportConfig, type ServerlessRequestHandler, ServerlessVoltAgentObservability, type SpanAttributes, type SpanEvent, type SpanFilterConfig, SpanFilterProcessor, SpanKind, type SpanLink, type SpanStatus, SpanStatusCode, type SpanTreeNode, type StepChunkCallback, type StepFinishCallback, type StepWithContent, type StopWhen, type StorageAdapter, StorageError, StorageLogProcessor, type StoredUIMessage, type StreamObjectFinishResult, type StreamObjectOnFinishCallback, type StreamObjectOptions, type StreamObjectSubAgentConfig, type StreamPart, type StreamTextFinishResult, type StreamTextOnFinishCallback, type StreamTextOptions, type StreamTextSubAgentConfig, type SubAgentConfig, type SubAgentMethod, type SubAgentStateData, type SupervisorConfig, TRIGGER_CONTEXT_KEY, type TemplateVariables, type TimelineEventCoreLevel, type TimelineEventCoreStatus, type TimelineEventCoreType, Tool, type ToolCall, type ToolContext, ToolDeniedError, type ToolErrorInfo, type ToolExecuteOptions, ToolManager, type ToolOptions, type ToolResultOutput, type ToolSchema, type ToolStatus, type ToolStatusInfo, type ToolWithNodeId, type Toolkit, type TriggerHandler, type TriggerHandlerBody, type TriggerHandlerContext, type TriggerHandlerResponse, type TriggerHandlerResult, type TriggerHandlerReturn, type TriggerHttpMethod, TriggerRegistry, type Usage, type UsageInfo, type VectorAdapter, VectorAdapterNotConfiguredError, VectorError, type VectorItem, type VectorSearchOptions, type Voice, type VoiceEventData, type VoiceEventType, type VoiceMetadata, type VoiceOptions, VoltAgent, VoltAgentError, VoltAgentObservability, type VoltAgentOptions, type VoltAgentStreamTextResult, type VoltAgentTextStreamPart, type VoltAgentTriggerConfig, type VoltAgentTriggersConfig, type VoltOpsActionExecutionResult, type VoltOpsActionsApi, VoltOpsActionsClient, type VoltOpsActionsTransport, type VoltOpsAirtableCreateRecordParams, type VoltOpsAirtableCredential, type VoltOpsAirtableDeleteRecordParams, type VoltOpsAirtableGetRecordParams, type VoltOpsAirtableListRecordsParams, type VoltOpsAirtableUpdateRecordParams, type VoltOpsAppendEvalRunResultPayload, type VoltOpsAppendEvalRunResultsRequest, VoltOpsClient, type VoltOpsClientOptions, type VoltOpsCompleteEvalRunRequest, type VoltOpsCreateEvalRunRequest, type VoltOpsCreateScorerRequest, type VoltOpsDiscordChannelMessageParams, type VoltOpsDiscordChannelType, type VoltOpsDiscordConfig, type VoltOpsDiscordCreateChannelParams, type VoltOpsDiscordCredential, type VoltOpsDiscordDeleteChannelParams, type VoltOpsDiscordGetChannelParams, type VoltOpsDiscordListChannelsParams, type VoltOpsDiscordListMembersParams, type VoltOpsDiscordListMessagesParams, type VoltOpsDiscordMemberRoleParams, type VoltOpsDiscordReactionParams, type VoltOpsDiscordSendMessageParams, type VoltOpsDiscordSendWebhookMessageParams, type VoltOpsDiscordUpdateChannelParams, type VoltOpsEvalResultStatus, type VoltOpsEvalRunCompletionSummaryPayload, type VoltOpsEvalRunErrorPayload, type VoltOpsEvalRunResultLiveMetadata, type VoltOpsEvalRunResultScorePayload, type VoltOpsEvalRunStatus, type VoltOpsEvalRunSummary, VoltOpsPromptApiClient, type VoltOpsPromptManager, VoltOpsPromptManagerImpl, type VoltOpsScorerSummary, type VoltOpsSlackCredential, type VoltOpsSlackDeleteMessageParams, type VoltOpsSlackPostMessageParams, type VoltOpsSlackSearchMessagesParams, type VoltOpsTerminalEvalRunStatus, type VoltOpsTriggerDefinition, VoltOpsTriggerDefinitions, type VoltOpsTriggerEnvelope, type VoltOpsTriggerGroupMap, type VoltOpsTriggerName, VoltOpsTriggerNames, WebSocketEventEmitter, WebSocketLogProcessor, WebSocketSpanProcessor, type WeightedBlendComponent, type WeightedBlendOptions, type Workflow, type WorkflowConfig, type WorkflowExecutionContext, WorkflowRegistry, type WorkflowStateEntry, type WorkflowStats, type WorkflowStepContext, type WorkflowStepType, type WorkflowTimelineEvent, type WorkingMemoryConfig, type WorkingMemoryScope, type WorkingMemorySummary, type WorkingMemoryUpdateOptions, addTimestampToMessage, andAgent, andAll, andRace, andTap, andThen, andWhen, andWorkflow, appendToMessage, buildRetrieverLogMessage, buildSamplingMetadata, buildScorer, buildSpanTree, checkForUpdates, convertUsage, cosineSimilarity, createDefaultInputSafetyGuardrails, createDefaultPIIGuardrails, createDefaultSafetyGuardrails, createEmailRedactorGuardrail, createHTMLSanitizerInputGuardrail, createHooks, createInputGuardrail, createInputLengthGuardrail, createMaxLengthGuardrail, createNodeId, createOutputGuardrail, createPIIInputGuardrail, createPhoneNumberGuardrail, createProfanityGuardrail, createProfanityInputGuardrail, createPrompt, createPromptInjectionGuardrail, createReasoningTools, createRetrieverTool, createScorer, createSensitiveNumberGuardrail, createSimpleTemplateEngine, createSubagent, createSuspendController, createTool, createToolkit, createTriggers, createVoltAgentObservability, createVoltOpsClient, createWorkflow, createWorkflowChain, createWorkflowStepNodeId, VoltAgent as default, defineVoltOpsTrigger, extractFileParts, extractImageParts, extractText, extractTextParts, extractWorkflowStepInfo, filterContentParts, getContentLength, getEnvVar, getGlobalLogBuffer, getGlobalLogger, getNodeTypeFromNodeId, getVoltOpsTriggerDefinition, getWorkflowStepNodeType, hasContent, hasFilePart, hasImagePart, hasTextPart, isAbortError, isNodeRuntime, isServerlessRuntime, isStructuredContent, isTextContent, isVoltAgentError, mapMessageContent, messageHelpers, normalizeContent, normalizeScorerResult, normalizeToArray, prependToMessage, readableLogRecordToObservabilityLog, readableSpanToObservabilitySpan, runLocalScorers, safeJsonParse, serializeValueForDebug, shouldSample, tool, transformTextContent, updateAllPackages, updateSinglePackage, weightedBlend, zodSchemaToJsonUI };
|
|
10029
|
+
export { A2AServerRegistry, AbortError, Agent, type AgentEvalConfig, type AgentEvalContext, type AgentEvalOperationType, type AgentEvalPayload, type AgentEvalResult, type AgentEvalSamplingPolicy, type AgentEvalScorerConfig, type AgentEvalScorerFactory, type AgentEvalScorerReference, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnHandoff, type AgentHookOnHandoffComplete, type AgentHookOnPrepareMessages, type AgentHookOnPrepareModelMessages, type AgentHookOnStart, type AgentHookOnStepFinish, type AgentHookOnToolEnd, type AgentHookOnToolStart, type AgentHooks, type AgentOptions, AgentRegistry, type AgentResponse, type AgentScorerState, type AgentStatus, type AgentTool, AiSdkEmbeddingAdapter, type AllowedVariableValue, type ApiToolInfo, type BaseEventMetadata, type BaseGenerationOptions, type BaseLLMOptions, type BaseMessage, BaseRetriever, type BaseTool, type BaseToolCall, type BuildScorerOptions, type BuildScorerRunArgs, type BuildScorerRunResult, type BuilderAnalyzeContext, type BuilderPrepareContext, type BuilderReasonContext, type BuilderScoreContext, type CachedPrompt, type ChatMessage, ClientHTTPError, type ClientSideToolResult, type CloudflareFetchHandler, type Conversation, ConversationAlreadyExistsError, ConversationNotFoundError, type ConversationQueryOptions, type ConversationQueryOptions as ConversationQueryOptionsV2, type ConversationStepRecord, type ConversationStepType, type Conversation as ConversationV2, type CreateConversationInput, type CreateConversationInput as CreateConversationInputV2, type CreateInputGuardrailOptions, type CreateOutputGuardrailOptions, type CreateReasoningToolsOptions, type CreateScorerOptions, DEFAULT_INSTRUCTIONS, type DataContent, type Document, type DynamicValue, type DynamicValueOptions, type EmbeddingAdapter$1 as EmbeddingAdapter, EmbeddingAdapterNotConfiguredError, EmbeddingError, type ExtractVariableNames, FEW_SHOT_EXAMPLES, type GenerateObjectOptions, type GenerateObjectSubAgentConfig, type GenerateReasonResult, type GenerateScoreResult, type GenerateScoreStep, type GenerateTextOptions, type GenerateTextSubAgentConfig, type GetConversationStepsOptions, type GetMessagesOptions, type GuardrailAction, type GuardrailContext, type GuardrailDefinition, type GuardrailFunction, type GuardrailSeverity, type IServerProvider, type IServerlessProvider, type VoltOpsClient$1 as IVoltOpsClient, InMemoryStorageAdapter$1 as InMemoryObservabilityAdapter, InMemoryStorageAdapter, InMemoryVectorAdapter, type InferGenerateObjectResponse, type InferGenerateTextResponse, type InferMessage, type InferModel, type InferProviderParams, type InferStreamResponse, type InferTool, type InputGuardrail, type InputGuardrailArgs, type InputGuardrailResult, type LLMProvider, LazyRemoteExportProcessor, type LocalScorerDefinition, type LocalScorerExecutionResult, LocalStorageSpanProcessor, type LogFilter, LoggerProxy, MCPConfiguration, type MCPElicitationAdapter, type MCPLoggingAdapter, type MCPPromptsAdapter, type MCPResourcesAdapter, MCPServerRegistry, type ManagedMemoryAddMessageInput, type ManagedMemoryAddMessagesInput, type ManagedMemoryClearMessagesInput, type ManagedMemoryConnectionInfo, type ManagedMemoryConversationsClient, type ManagedMemoryCredentialCreateResult, type ManagedMemoryCredentialListResult, type ManagedMemoryCredentialSummary, type ManagedMemoryDatabaseSummary, type ManagedMemoryGetMessagesInput, type ManagedMemoryMessagesClient, type ManagedMemorySetWorkingMemoryInput, type ManagedMemoryStatus, type ManagedMemoryUpdateConversationInput, type ManagedMemoryVoltOpsClient, type ManagedMemoryWorkflowStateUpdateInput, type ManagedMemoryWorkflowStatesClient, type ManagedMemoryWorkingMemoryClient, type ManagedMemoryWorkingMemoryInput, Memory, type MemoryConfig, type MemoryOptions, type MemoryStorageMetadata, type MemoryUpdateMode, Memory as MemoryV2, MemoryV2Error, type MessageContent, MessageContentBuilder, type MessageRole, type ModelToolCall, NextAction, NodeType, VoltAgentObservability$1 as NodeVoltAgentObservability, type ObservabilityConfig, type ObservabilityLogRecord, type ObservabilitySpan, type ObservabilityStorageAdapter, type ObservabilityWebSocketEvent, type OnEndHookArgs, type OnErrorHookArgs, type OnHandoffCompleteHookArgs, type OnHandoffHookArgs, type OnPrepareMessagesHookArgs, type OnPrepareMessagesHookResult, type OnPrepareModelMessagesHookArgs, type OnPrepareModelMessagesHookResult, type OnStartHookArgs, type OnStepFinishHookArgs, type OnToolEndHookArgs, type OnToolStartHookArgs, type OperationContext, type OutputGuardrail, type OutputGuardrailArgs, type OutputGuardrailResult, type PackageUpdateInfo, type PromptApiClient, type PromptApiResponse, type PromptContent, type PromptCreator, type PromptHelper, type PromptReference, type PromptTemplate, type ProviderObjectResponse, type ProviderObjectStreamResponse, type ProviderParams, type ProviderResponse, type ProviderTextResponse, type ProviderTextStreamResponse, type ProviderTool, type ReadableStreamType, type ReasoningStep, ReasoningStepSchema, type RegisterOptions, type RegisteredTrigger, type RegisteredWorkflow, type RemoteLogExportConfig, RemoteLogProcessor, type RetrieveOptions, type Retriever, type RetrieverOptions, type RunLocalScorersArgs, type RunLocalScorersResult, type SamplingMetadata, type SamplingPolicy, type ScorerBuilder, type ScorerContext, type ScorerLifecycleScope, type ScorerPipelineContext, type ScorerReasonContext, type ScorerResult, type SearchOptions, type SearchResult, type ServerAgentResponse, type ServerApiResponse, type ServerProviderDeps, type ServerProviderFactory, type ServerWorkflowResponse, type ServerlessProviderFactory, type ServerlessRemoteEndpointConfig, type ServerlessRemoteExportConfig, type ServerlessRequestHandler, ServerlessVoltAgentObservability, type SpanAttributes, type SpanEvent, type SpanFilterConfig, SpanFilterProcessor, SpanKind, type SpanLink, type SpanStatus, SpanStatusCode, type SpanTreeNode, type StepChunkCallback, type StepFinishCallback, type StepWithContent, type StopWhen, type StorageAdapter, StorageError, StorageLogProcessor, type StoredUIMessage, type StreamObjectFinishResult, type StreamObjectOnFinishCallback, type StreamObjectOptions, type StreamObjectSubAgentConfig, type StreamPart, type StreamTextFinishResult, type StreamTextOnFinishCallback, type StreamTextOptions, type StreamTextSubAgentConfig, type SubAgentConfig, type SubAgentMethod, type SubAgentStateData, type SupervisorConfig, TRIGGER_CONTEXT_KEY, type TemplateVariables, type TimelineEventCoreLevel, type TimelineEventCoreStatus, type TimelineEventCoreType, Tool, type ToolCall, type ToolContext, ToolDeniedError, type ToolErrorInfo, type ToolExecuteOptions, ToolManager, type ToolOptions, type ToolResultOutput, type ToolSchema, type ToolStatus, type ToolStatusInfo, type ToolWithNodeId, type Toolkit, type TriggerHandler, type TriggerHandlerBody, type TriggerHandlerContext, type TriggerHandlerResponse, type TriggerHandlerResult, type TriggerHandlerReturn, type TriggerHttpMethod, TriggerRegistry, type Usage, type UsageInfo, type VectorAdapter, VectorAdapterNotConfiguredError, VectorError, type VectorItem, type VectorSearchOptions, type Voice, type VoiceEventData, type VoiceEventType, type VoiceMetadata, type VoiceOptions, VoltAgent, VoltAgentError, VoltAgentObservability, type VoltAgentOptions, type VoltAgentStreamTextResult, type VoltAgentTextStreamPart, type VoltAgentTriggerConfig, type VoltAgentTriggersConfig, type VoltOpsActionExecutionResult, type VoltOpsActionsApi, VoltOpsActionsClient, type VoltOpsActionsTransport, type VoltOpsAirtableCreateRecordParams, type VoltOpsAirtableCredential, type VoltOpsAirtableDeleteRecordParams, type VoltOpsAirtableGetRecordParams, type VoltOpsAirtableListRecordsParams, type VoltOpsAirtableUpdateRecordParams, type VoltOpsAppendEvalRunResultPayload, type VoltOpsAppendEvalRunResultsRequest, VoltOpsClient, type VoltOpsClientOptions, type VoltOpsCompleteEvalRunRequest, type VoltOpsCreateEvalRunRequest, type VoltOpsCreateScorerRequest, type VoltOpsDiscordChannelMessageParams, type VoltOpsDiscordChannelType, type VoltOpsDiscordConfig, type VoltOpsDiscordCreateChannelParams, type VoltOpsDiscordCredential, type VoltOpsDiscordDeleteChannelParams, type VoltOpsDiscordGetChannelParams, type VoltOpsDiscordListChannelsParams, type VoltOpsDiscordListMembersParams, type VoltOpsDiscordListMessagesParams, type VoltOpsDiscordMemberRoleParams, type VoltOpsDiscordReactionParams, type VoltOpsDiscordSendMessageParams, type VoltOpsDiscordSendWebhookMessageParams, type VoltOpsDiscordUpdateChannelParams, type VoltOpsEvalResultStatus, type VoltOpsEvalRunCompletionSummaryPayload, type VoltOpsEvalRunErrorPayload, type VoltOpsEvalRunResultLiveMetadata, type VoltOpsEvalRunResultScorePayload, type VoltOpsEvalRunStatus, type VoltOpsEvalRunSummary, VoltOpsPromptApiClient, type VoltOpsPromptManager, VoltOpsPromptManagerImpl, type VoltOpsScorerSummary, type VoltOpsSlackCredential, type VoltOpsSlackDeleteMessageParams, type VoltOpsSlackPostMessageParams, type VoltOpsSlackSearchMessagesParams, type VoltOpsTerminalEvalRunStatus, type VoltOpsTriggerDefinition, VoltOpsTriggerDefinitions, type VoltOpsTriggerEnvelope, type VoltOpsTriggerGroupMap, type VoltOpsTriggerName, VoltOpsTriggerNames, WebSocketEventEmitter, WebSocketLogProcessor, WebSocketSpanProcessor, type WeightedBlendComponent, type WeightedBlendOptions, type Workflow, type WorkflowConfig, type WorkflowExecutionContext, WorkflowRegistry, type WorkflowStateEntry, type WorkflowStats, type WorkflowStepContext, type WorkflowStepType, type WorkflowTimelineEvent, type WorkingMemoryConfig, type WorkingMemoryScope, type WorkingMemorySummary, type WorkingMemoryUpdateOptions, addTimestampToMessage, andAgent, andAll, andRace, andTap, andThen, andWhen, andWorkflow, appendToMessage, buildRetrieverLogMessage, buildSamplingMetadata, buildScorer, buildSpanTree, checkForUpdates, convertUsage, cosineSimilarity, createDefaultInputSafetyGuardrails, createDefaultPIIGuardrails, createDefaultSafetyGuardrails, createEmailRedactorGuardrail, createHTMLSanitizerInputGuardrail, createHooks, createInputGuardrail, createInputLengthGuardrail, createMaxLengthGuardrail, createNodeId, createOutputGuardrail, createPIIInputGuardrail, createPhoneNumberGuardrail, createProfanityGuardrail, createProfanityInputGuardrail, createPrompt, createPromptInjectionGuardrail, createReasoningTools, createRetrieverTool, createScorer, createSensitiveNumberGuardrail, createSimpleTemplateEngine, createSubagent, createSuspendController, createTool, createToolkit, createTriggers, createVoltAgentObservability, createVoltOpsClient, createWorkflow, createWorkflowChain, createWorkflowStepNodeId, VoltAgent as default, defineVoltOpsTrigger, extractFileParts, extractImageParts, extractText, extractTextParts, extractWorkflowStepInfo, filterContentParts, getContentLength, getEnvVar, getGlobalLogBuffer, getGlobalLogger, getNodeTypeFromNodeId, getVoltOpsTriggerDefinition, getWorkflowStepNodeType, hasContent, hasFilePart, hasImagePart, hasTextPart, isAbortError, isNodeRuntime, isServerlessRuntime, isStructuredContent, isTextContent, isVoltAgentError, mapMessageContent, messageHelpers, normalizeContent, normalizeScorerResult, normalizeToArray, prependToMessage, readableLogRecordToObservabilityLog, readableSpanToObservabilitySpan, runLocalScorers, safeJsonParse, serializeValueForDebug, setWaitUntil, shouldSample, tool, transformTextContent, updateAllPackages, updateSinglePackage, weightedBlend, zodSchemaToJsonUI };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { AsyncIterableStream } from '@voltagent/internal/utils';
|
|
|
8
8
|
export { AsyncIterableStream, createAsyncIterableStream } from '@voltagent/internal/utils';
|
|
9
9
|
import { Logger, LogFn, LogBuffer } from '@voltagent/internal';
|
|
10
10
|
import { Tracer, SpanOptions, Span, SpanStatusCode as SpanStatusCode$1, context, trace, SpanKind as SpanKind$1, Context } from '@opentelemetry/api';
|
|
11
|
-
export { Span, SpanOptions, Tracer, context, trace } from '@opentelemetry/api';
|
|
11
|
+
export { ROOT_CONTEXT, Span, SpanOptions, Tracer, context, propagation, trace } from '@opentelemetry/api';
|
|
12
12
|
import { LogRecordProcessor, LoggerProvider, ReadableLogRecord, SdkLogRecord } from '@opentelemetry/sdk-logs';
|
|
13
13
|
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
|
|
14
14
|
import { SpanProcessor, BasicTracerProvider, ReadableSpan, Span as Span$1 } from '@opentelemetry/sdk-trace-base';
|
|
@@ -3444,6 +3444,12 @@ declare class VoltAgentObservability$1 {
|
|
|
3444
3444
|
getLogsBySpanId(spanId: string): Promise<any[]>;
|
|
3445
3445
|
shutdown(): Promise<void>;
|
|
3446
3446
|
forceFlush(): Promise<void>;
|
|
3447
|
+
/**
|
|
3448
|
+
* Flushes spans on finish.
|
|
3449
|
+
* We force flush here to ensure spans are exported even if the runtime
|
|
3450
|
+
* is incorrectly detected or if we are in a short-lived process.
|
|
3451
|
+
*/
|
|
3452
|
+
flushOnFinish(): Promise<void>;
|
|
3447
3453
|
getProvider(): NodeTracerProvider;
|
|
3448
3454
|
getContext(): typeof context;
|
|
3449
3455
|
getTraceAPI(): typeof trace;
|
|
@@ -3500,6 +3506,11 @@ declare class ServerlessVoltAgentObservability {
|
|
|
3500
3506
|
getLogsBySpanId(spanId: string): Promise<any[]>;
|
|
3501
3507
|
shutdown(): Promise<void>;
|
|
3502
3508
|
forceFlush(): Promise<void>;
|
|
3509
|
+
/**
|
|
3510
|
+
* Flushes spans without blocking the response if waitUntil is available.
|
|
3511
|
+
* This is the preferred method to call at the end of a request.
|
|
3512
|
+
*/
|
|
3513
|
+
flushOnFinish(): Promise<void>;
|
|
3503
3514
|
getProvider(): BasicTracerProvider;
|
|
3504
3515
|
getContext(): typeof context;
|
|
3505
3516
|
getTraceAPI(): typeof trace;
|
|
@@ -3914,6 +3925,30 @@ declare class RemoteLogProcessor implements LogRecordProcessor {
|
|
|
3914
3925
|
private tryInitialize;
|
|
3915
3926
|
}
|
|
3916
3927
|
|
|
3928
|
+
/**
|
|
3929
|
+
* Sets the waitUntil function for the current execution context.
|
|
3930
|
+
* This is used by the observability pipeline to flush spans without blocking the response
|
|
3931
|
+
* in serverless environments (e.g., Cloudflare Workers, Vercel).
|
|
3932
|
+
*
|
|
3933
|
+
* @param waitUntil - The platform-specific waitUntil function
|
|
3934
|
+
*
|
|
3935
|
+
* @example
|
|
3936
|
+
* // In Next.js App Router
|
|
3937
|
+
* import { setWaitUntil } from '@voltagent/core';
|
|
3938
|
+
* import { after } from 'next/server'; // or from context
|
|
3939
|
+
*
|
|
3940
|
+
* export async function POST(req: Request) {
|
|
3941
|
+
* // If using Vercel's waitUntil from context or similar
|
|
3942
|
+
* // setWaitUntil(ctx.waitUntil);
|
|
3943
|
+
*
|
|
3944
|
+
* // Or if using Next.js 15+ after()
|
|
3945
|
+
* // setWaitUntil(after);
|
|
3946
|
+
*
|
|
3947
|
+
* // ... agent code ...
|
|
3948
|
+
* }
|
|
3949
|
+
*/
|
|
3950
|
+
declare function setWaitUntil(waitUntil: (promise: Promise<unknown>) => void): void;
|
|
3951
|
+
|
|
3917
3952
|
/**
|
|
3918
3953
|
* VoltAgent Observability - Built on OpenTelemetry
|
|
3919
3954
|
*
|
|
@@ -9991,4 +10026,4 @@ declare class VoltAgent {
|
|
|
9991
10026
|
*/
|
|
9992
10027
|
declare function convertUsage(usage: LanguageModelUsage | undefined): UsageInfo | undefined;
|
|
9993
10028
|
|
|
9994
|
-
export { A2AServerRegistry, AbortError, Agent, type AgentEvalConfig, type AgentEvalContext, type AgentEvalOperationType, type AgentEvalPayload, type AgentEvalResult, type AgentEvalSamplingPolicy, type AgentEvalScorerConfig, type AgentEvalScorerFactory, type AgentEvalScorerReference, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnHandoff, type AgentHookOnHandoffComplete, type AgentHookOnPrepareMessages, type AgentHookOnPrepareModelMessages, type AgentHookOnStart, type AgentHookOnStepFinish, type AgentHookOnToolEnd, type AgentHookOnToolStart, type AgentHooks, type AgentOptions, AgentRegistry, type AgentResponse, type AgentScorerState, type AgentStatus, type AgentTool, AiSdkEmbeddingAdapter, type AllowedVariableValue, type ApiToolInfo, type BaseEventMetadata, type BaseGenerationOptions, type BaseLLMOptions, type BaseMessage, BaseRetriever, type BaseTool, type BaseToolCall, type BuildScorerOptions, type BuildScorerRunArgs, type BuildScorerRunResult, type BuilderAnalyzeContext, type BuilderPrepareContext, type BuilderReasonContext, type BuilderScoreContext, type CachedPrompt, type ChatMessage, ClientHTTPError, type ClientSideToolResult, type CloudflareFetchHandler, type Conversation, ConversationAlreadyExistsError, ConversationNotFoundError, type ConversationQueryOptions, type ConversationQueryOptions as ConversationQueryOptionsV2, type ConversationStepRecord, type ConversationStepType, type Conversation as ConversationV2, type CreateConversationInput, type CreateConversationInput as CreateConversationInputV2, type CreateInputGuardrailOptions, type CreateOutputGuardrailOptions, type CreateReasoningToolsOptions, type CreateScorerOptions, DEFAULT_INSTRUCTIONS, type DataContent, type Document, type DynamicValue, type DynamicValueOptions, type EmbeddingAdapter$1 as EmbeddingAdapter, EmbeddingAdapterNotConfiguredError, EmbeddingError, type ExtractVariableNames, FEW_SHOT_EXAMPLES, type GenerateObjectOptions, type GenerateObjectSubAgentConfig, type GenerateReasonResult, type GenerateScoreResult, type GenerateScoreStep, type GenerateTextOptions, type GenerateTextSubAgentConfig, type GetConversationStepsOptions, type GetMessagesOptions, type GuardrailAction, type GuardrailContext, type GuardrailDefinition, type GuardrailFunction, type GuardrailSeverity, type IServerProvider, type IServerlessProvider, type VoltOpsClient$1 as IVoltOpsClient, InMemoryStorageAdapter$1 as InMemoryObservabilityAdapter, InMemoryStorageAdapter, InMemoryVectorAdapter, type InferGenerateObjectResponse, type InferGenerateTextResponse, type InferMessage, type InferModel, type InferProviderParams, type InferStreamResponse, type InferTool, type InputGuardrail, type InputGuardrailArgs, type InputGuardrailResult, type LLMProvider, LazyRemoteExportProcessor, type LocalScorerDefinition, type LocalScorerExecutionResult, LocalStorageSpanProcessor, type LogFilter, LoggerProxy, MCPConfiguration, type MCPElicitationAdapter, type MCPLoggingAdapter, type MCPPromptsAdapter, type MCPResourcesAdapter, MCPServerRegistry, type ManagedMemoryAddMessageInput, type ManagedMemoryAddMessagesInput, type ManagedMemoryClearMessagesInput, type ManagedMemoryConnectionInfo, type ManagedMemoryConversationsClient, type ManagedMemoryCredentialCreateResult, type ManagedMemoryCredentialListResult, type ManagedMemoryCredentialSummary, type ManagedMemoryDatabaseSummary, type ManagedMemoryGetMessagesInput, type ManagedMemoryMessagesClient, type ManagedMemorySetWorkingMemoryInput, type ManagedMemoryStatus, type ManagedMemoryUpdateConversationInput, type ManagedMemoryVoltOpsClient, type ManagedMemoryWorkflowStateUpdateInput, type ManagedMemoryWorkflowStatesClient, type ManagedMemoryWorkingMemoryClient, type ManagedMemoryWorkingMemoryInput, Memory, type MemoryConfig, type MemoryOptions, type MemoryStorageMetadata, type MemoryUpdateMode, Memory as MemoryV2, MemoryV2Error, type MessageContent, MessageContentBuilder, type MessageRole, type ModelToolCall, NextAction, NodeType, VoltAgentObservability$1 as NodeVoltAgentObservability, type ObservabilityConfig, type ObservabilityLogRecord, type ObservabilitySpan, type ObservabilityStorageAdapter, type ObservabilityWebSocketEvent, type OnEndHookArgs, type OnErrorHookArgs, type OnHandoffCompleteHookArgs, type OnHandoffHookArgs, type OnPrepareMessagesHookArgs, type OnPrepareMessagesHookResult, type OnPrepareModelMessagesHookArgs, type OnPrepareModelMessagesHookResult, type OnStartHookArgs, type OnStepFinishHookArgs, type OnToolEndHookArgs, type OnToolStartHookArgs, type OperationContext, type OutputGuardrail, type OutputGuardrailArgs, type OutputGuardrailResult, type PackageUpdateInfo, type PromptApiClient, type PromptApiResponse, type PromptContent, type PromptCreator, type PromptHelper, type PromptReference, type PromptTemplate, type ProviderObjectResponse, type ProviderObjectStreamResponse, type ProviderParams, type ProviderResponse, type ProviderTextResponse, type ProviderTextStreamResponse, type ProviderTool, type ReadableStreamType, type ReasoningStep, ReasoningStepSchema, type RegisterOptions, type RegisteredTrigger, type RegisteredWorkflow, type RemoteLogExportConfig, RemoteLogProcessor, type RetrieveOptions, type Retriever, type RetrieverOptions, type RunLocalScorersArgs, type RunLocalScorersResult, type SamplingMetadata, type SamplingPolicy, type ScorerBuilder, type ScorerContext, type ScorerLifecycleScope, type ScorerPipelineContext, type ScorerReasonContext, type ScorerResult, type SearchOptions, type SearchResult, type ServerAgentResponse, type ServerApiResponse, type ServerProviderDeps, type ServerProviderFactory, type ServerWorkflowResponse, type ServerlessProviderFactory, type ServerlessRemoteEndpointConfig, type ServerlessRemoteExportConfig, type ServerlessRequestHandler, ServerlessVoltAgentObservability, type SpanAttributes, type SpanEvent, type SpanFilterConfig, SpanFilterProcessor, SpanKind, type SpanLink, type SpanStatus, SpanStatusCode, type SpanTreeNode, type StepChunkCallback, type StepFinishCallback, type StepWithContent, type StopWhen, type StorageAdapter, StorageError, StorageLogProcessor, type StoredUIMessage, type StreamObjectFinishResult, type StreamObjectOnFinishCallback, type StreamObjectOptions, type StreamObjectSubAgentConfig, type StreamPart, type StreamTextFinishResult, type StreamTextOnFinishCallback, type StreamTextOptions, type StreamTextSubAgentConfig, type SubAgentConfig, type SubAgentMethod, type SubAgentStateData, type SupervisorConfig, TRIGGER_CONTEXT_KEY, type TemplateVariables, type TimelineEventCoreLevel, type TimelineEventCoreStatus, type TimelineEventCoreType, Tool, type ToolCall, type ToolContext, ToolDeniedError, type ToolErrorInfo, type ToolExecuteOptions, ToolManager, type ToolOptions, type ToolResultOutput, type ToolSchema, type ToolStatus, type ToolStatusInfo, type ToolWithNodeId, type Toolkit, type TriggerHandler, type TriggerHandlerBody, type TriggerHandlerContext, type TriggerHandlerResponse, type TriggerHandlerResult, type TriggerHandlerReturn, type TriggerHttpMethod, TriggerRegistry, type Usage, type UsageInfo, type VectorAdapter, VectorAdapterNotConfiguredError, VectorError, type VectorItem, type VectorSearchOptions, type Voice, type VoiceEventData, type VoiceEventType, type VoiceMetadata, type VoiceOptions, VoltAgent, VoltAgentError, VoltAgentObservability, type VoltAgentOptions, type VoltAgentStreamTextResult, type VoltAgentTextStreamPart, type VoltAgentTriggerConfig, type VoltAgentTriggersConfig, type VoltOpsActionExecutionResult, type VoltOpsActionsApi, VoltOpsActionsClient, type VoltOpsActionsTransport, type VoltOpsAirtableCreateRecordParams, type VoltOpsAirtableCredential, type VoltOpsAirtableDeleteRecordParams, type VoltOpsAirtableGetRecordParams, type VoltOpsAirtableListRecordsParams, type VoltOpsAirtableUpdateRecordParams, type VoltOpsAppendEvalRunResultPayload, type VoltOpsAppendEvalRunResultsRequest, VoltOpsClient, type VoltOpsClientOptions, type VoltOpsCompleteEvalRunRequest, type VoltOpsCreateEvalRunRequest, type VoltOpsCreateScorerRequest, type VoltOpsDiscordChannelMessageParams, type VoltOpsDiscordChannelType, type VoltOpsDiscordConfig, type VoltOpsDiscordCreateChannelParams, type VoltOpsDiscordCredential, type VoltOpsDiscordDeleteChannelParams, type VoltOpsDiscordGetChannelParams, type VoltOpsDiscordListChannelsParams, type VoltOpsDiscordListMembersParams, type VoltOpsDiscordListMessagesParams, type VoltOpsDiscordMemberRoleParams, type VoltOpsDiscordReactionParams, type VoltOpsDiscordSendMessageParams, type VoltOpsDiscordSendWebhookMessageParams, type VoltOpsDiscordUpdateChannelParams, type VoltOpsEvalResultStatus, type VoltOpsEvalRunCompletionSummaryPayload, type VoltOpsEvalRunErrorPayload, type VoltOpsEvalRunResultLiveMetadata, type VoltOpsEvalRunResultScorePayload, type VoltOpsEvalRunStatus, type VoltOpsEvalRunSummary, VoltOpsPromptApiClient, type VoltOpsPromptManager, VoltOpsPromptManagerImpl, type VoltOpsScorerSummary, type VoltOpsSlackCredential, type VoltOpsSlackDeleteMessageParams, type VoltOpsSlackPostMessageParams, type VoltOpsSlackSearchMessagesParams, type VoltOpsTerminalEvalRunStatus, type VoltOpsTriggerDefinition, VoltOpsTriggerDefinitions, type VoltOpsTriggerEnvelope, type VoltOpsTriggerGroupMap, type VoltOpsTriggerName, VoltOpsTriggerNames, WebSocketEventEmitter, WebSocketLogProcessor, WebSocketSpanProcessor, type WeightedBlendComponent, type WeightedBlendOptions, type Workflow, type WorkflowConfig, type WorkflowExecutionContext, WorkflowRegistry, type WorkflowStateEntry, type WorkflowStats, type WorkflowStepContext, type WorkflowStepType, type WorkflowTimelineEvent, type WorkingMemoryConfig, type WorkingMemoryScope, type WorkingMemorySummary, type WorkingMemoryUpdateOptions, addTimestampToMessage, andAgent, andAll, andRace, andTap, andThen, andWhen, andWorkflow, appendToMessage, buildRetrieverLogMessage, buildSamplingMetadata, buildScorer, buildSpanTree, checkForUpdates, convertUsage, cosineSimilarity, createDefaultInputSafetyGuardrails, createDefaultPIIGuardrails, createDefaultSafetyGuardrails, createEmailRedactorGuardrail, createHTMLSanitizerInputGuardrail, createHooks, createInputGuardrail, createInputLengthGuardrail, createMaxLengthGuardrail, createNodeId, createOutputGuardrail, createPIIInputGuardrail, createPhoneNumberGuardrail, createProfanityGuardrail, createProfanityInputGuardrail, createPrompt, createPromptInjectionGuardrail, createReasoningTools, createRetrieverTool, createScorer, createSensitiveNumberGuardrail, createSimpleTemplateEngine, createSubagent, createSuspendController, createTool, createToolkit, createTriggers, createVoltAgentObservability, createVoltOpsClient, createWorkflow, createWorkflowChain, createWorkflowStepNodeId, VoltAgent as default, defineVoltOpsTrigger, extractFileParts, extractImageParts, extractText, extractTextParts, extractWorkflowStepInfo, filterContentParts, getContentLength, getEnvVar, getGlobalLogBuffer, getGlobalLogger, getNodeTypeFromNodeId, getVoltOpsTriggerDefinition, getWorkflowStepNodeType, hasContent, hasFilePart, hasImagePart, hasTextPart, isAbortError, isNodeRuntime, isServerlessRuntime, isStructuredContent, isTextContent, isVoltAgentError, mapMessageContent, messageHelpers, normalizeContent, normalizeScorerResult, normalizeToArray, prependToMessage, readableLogRecordToObservabilityLog, readableSpanToObservabilitySpan, runLocalScorers, safeJsonParse, serializeValueForDebug, shouldSample, tool, transformTextContent, updateAllPackages, updateSinglePackage, weightedBlend, zodSchemaToJsonUI };
|
|
10029
|
+
export { A2AServerRegistry, AbortError, Agent, type AgentEvalConfig, type AgentEvalContext, type AgentEvalOperationType, type AgentEvalPayload, type AgentEvalResult, type AgentEvalSamplingPolicy, type AgentEvalScorerConfig, type AgentEvalScorerFactory, type AgentEvalScorerReference, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnHandoff, type AgentHookOnHandoffComplete, type AgentHookOnPrepareMessages, type AgentHookOnPrepareModelMessages, type AgentHookOnStart, type AgentHookOnStepFinish, type AgentHookOnToolEnd, type AgentHookOnToolStart, type AgentHooks, type AgentOptions, AgentRegistry, type AgentResponse, type AgentScorerState, type AgentStatus, type AgentTool, AiSdkEmbeddingAdapter, type AllowedVariableValue, type ApiToolInfo, type BaseEventMetadata, type BaseGenerationOptions, type BaseLLMOptions, type BaseMessage, BaseRetriever, type BaseTool, type BaseToolCall, type BuildScorerOptions, type BuildScorerRunArgs, type BuildScorerRunResult, type BuilderAnalyzeContext, type BuilderPrepareContext, type BuilderReasonContext, type BuilderScoreContext, type CachedPrompt, type ChatMessage, ClientHTTPError, type ClientSideToolResult, type CloudflareFetchHandler, type Conversation, ConversationAlreadyExistsError, ConversationNotFoundError, type ConversationQueryOptions, type ConversationQueryOptions as ConversationQueryOptionsV2, type ConversationStepRecord, type ConversationStepType, type Conversation as ConversationV2, type CreateConversationInput, type CreateConversationInput as CreateConversationInputV2, type CreateInputGuardrailOptions, type CreateOutputGuardrailOptions, type CreateReasoningToolsOptions, type CreateScorerOptions, DEFAULT_INSTRUCTIONS, type DataContent, type Document, type DynamicValue, type DynamicValueOptions, type EmbeddingAdapter$1 as EmbeddingAdapter, EmbeddingAdapterNotConfiguredError, EmbeddingError, type ExtractVariableNames, FEW_SHOT_EXAMPLES, type GenerateObjectOptions, type GenerateObjectSubAgentConfig, type GenerateReasonResult, type GenerateScoreResult, type GenerateScoreStep, type GenerateTextOptions, type GenerateTextSubAgentConfig, type GetConversationStepsOptions, type GetMessagesOptions, type GuardrailAction, type GuardrailContext, type GuardrailDefinition, type GuardrailFunction, type GuardrailSeverity, type IServerProvider, type IServerlessProvider, type VoltOpsClient$1 as IVoltOpsClient, InMemoryStorageAdapter$1 as InMemoryObservabilityAdapter, InMemoryStorageAdapter, InMemoryVectorAdapter, type InferGenerateObjectResponse, type InferGenerateTextResponse, type InferMessage, type InferModel, type InferProviderParams, type InferStreamResponse, type InferTool, type InputGuardrail, type InputGuardrailArgs, type InputGuardrailResult, type LLMProvider, LazyRemoteExportProcessor, type LocalScorerDefinition, type LocalScorerExecutionResult, LocalStorageSpanProcessor, type LogFilter, LoggerProxy, MCPConfiguration, type MCPElicitationAdapter, type MCPLoggingAdapter, type MCPPromptsAdapter, type MCPResourcesAdapter, MCPServerRegistry, type ManagedMemoryAddMessageInput, type ManagedMemoryAddMessagesInput, type ManagedMemoryClearMessagesInput, type ManagedMemoryConnectionInfo, type ManagedMemoryConversationsClient, type ManagedMemoryCredentialCreateResult, type ManagedMemoryCredentialListResult, type ManagedMemoryCredentialSummary, type ManagedMemoryDatabaseSummary, type ManagedMemoryGetMessagesInput, type ManagedMemoryMessagesClient, type ManagedMemorySetWorkingMemoryInput, type ManagedMemoryStatus, type ManagedMemoryUpdateConversationInput, type ManagedMemoryVoltOpsClient, type ManagedMemoryWorkflowStateUpdateInput, type ManagedMemoryWorkflowStatesClient, type ManagedMemoryWorkingMemoryClient, type ManagedMemoryWorkingMemoryInput, Memory, type MemoryConfig, type MemoryOptions, type MemoryStorageMetadata, type MemoryUpdateMode, Memory as MemoryV2, MemoryV2Error, type MessageContent, MessageContentBuilder, type MessageRole, type ModelToolCall, NextAction, NodeType, VoltAgentObservability$1 as NodeVoltAgentObservability, type ObservabilityConfig, type ObservabilityLogRecord, type ObservabilitySpan, type ObservabilityStorageAdapter, type ObservabilityWebSocketEvent, type OnEndHookArgs, type OnErrorHookArgs, type OnHandoffCompleteHookArgs, type OnHandoffHookArgs, type OnPrepareMessagesHookArgs, type OnPrepareMessagesHookResult, type OnPrepareModelMessagesHookArgs, type OnPrepareModelMessagesHookResult, type OnStartHookArgs, type OnStepFinishHookArgs, type OnToolEndHookArgs, type OnToolStartHookArgs, type OperationContext, type OutputGuardrail, type OutputGuardrailArgs, type OutputGuardrailResult, type PackageUpdateInfo, type PromptApiClient, type PromptApiResponse, type PromptContent, type PromptCreator, type PromptHelper, type PromptReference, type PromptTemplate, type ProviderObjectResponse, type ProviderObjectStreamResponse, type ProviderParams, type ProviderResponse, type ProviderTextResponse, type ProviderTextStreamResponse, type ProviderTool, type ReadableStreamType, type ReasoningStep, ReasoningStepSchema, type RegisterOptions, type RegisteredTrigger, type RegisteredWorkflow, type RemoteLogExportConfig, RemoteLogProcessor, type RetrieveOptions, type Retriever, type RetrieverOptions, type RunLocalScorersArgs, type RunLocalScorersResult, type SamplingMetadata, type SamplingPolicy, type ScorerBuilder, type ScorerContext, type ScorerLifecycleScope, type ScorerPipelineContext, type ScorerReasonContext, type ScorerResult, type SearchOptions, type SearchResult, type ServerAgentResponse, type ServerApiResponse, type ServerProviderDeps, type ServerProviderFactory, type ServerWorkflowResponse, type ServerlessProviderFactory, type ServerlessRemoteEndpointConfig, type ServerlessRemoteExportConfig, type ServerlessRequestHandler, ServerlessVoltAgentObservability, type SpanAttributes, type SpanEvent, type SpanFilterConfig, SpanFilterProcessor, SpanKind, type SpanLink, type SpanStatus, SpanStatusCode, type SpanTreeNode, type StepChunkCallback, type StepFinishCallback, type StepWithContent, type StopWhen, type StorageAdapter, StorageError, StorageLogProcessor, type StoredUIMessage, type StreamObjectFinishResult, type StreamObjectOnFinishCallback, type StreamObjectOptions, type StreamObjectSubAgentConfig, type StreamPart, type StreamTextFinishResult, type StreamTextOnFinishCallback, type StreamTextOptions, type StreamTextSubAgentConfig, type SubAgentConfig, type SubAgentMethod, type SubAgentStateData, type SupervisorConfig, TRIGGER_CONTEXT_KEY, type TemplateVariables, type TimelineEventCoreLevel, type TimelineEventCoreStatus, type TimelineEventCoreType, Tool, type ToolCall, type ToolContext, ToolDeniedError, type ToolErrorInfo, type ToolExecuteOptions, ToolManager, type ToolOptions, type ToolResultOutput, type ToolSchema, type ToolStatus, type ToolStatusInfo, type ToolWithNodeId, type Toolkit, type TriggerHandler, type TriggerHandlerBody, type TriggerHandlerContext, type TriggerHandlerResponse, type TriggerHandlerResult, type TriggerHandlerReturn, type TriggerHttpMethod, TriggerRegistry, type Usage, type UsageInfo, type VectorAdapter, VectorAdapterNotConfiguredError, VectorError, type VectorItem, type VectorSearchOptions, type Voice, type VoiceEventData, type VoiceEventType, type VoiceMetadata, type VoiceOptions, VoltAgent, VoltAgentError, VoltAgentObservability, type VoltAgentOptions, type VoltAgentStreamTextResult, type VoltAgentTextStreamPart, type VoltAgentTriggerConfig, type VoltAgentTriggersConfig, type VoltOpsActionExecutionResult, type VoltOpsActionsApi, VoltOpsActionsClient, type VoltOpsActionsTransport, type VoltOpsAirtableCreateRecordParams, type VoltOpsAirtableCredential, type VoltOpsAirtableDeleteRecordParams, type VoltOpsAirtableGetRecordParams, type VoltOpsAirtableListRecordsParams, type VoltOpsAirtableUpdateRecordParams, type VoltOpsAppendEvalRunResultPayload, type VoltOpsAppendEvalRunResultsRequest, VoltOpsClient, type VoltOpsClientOptions, type VoltOpsCompleteEvalRunRequest, type VoltOpsCreateEvalRunRequest, type VoltOpsCreateScorerRequest, type VoltOpsDiscordChannelMessageParams, type VoltOpsDiscordChannelType, type VoltOpsDiscordConfig, type VoltOpsDiscordCreateChannelParams, type VoltOpsDiscordCredential, type VoltOpsDiscordDeleteChannelParams, type VoltOpsDiscordGetChannelParams, type VoltOpsDiscordListChannelsParams, type VoltOpsDiscordListMembersParams, type VoltOpsDiscordListMessagesParams, type VoltOpsDiscordMemberRoleParams, type VoltOpsDiscordReactionParams, type VoltOpsDiscordSendMessageParams, type VoltOpsDiscordSendWebhookMessageParams, type VoltOpsDiscordUpdateChannelParams, type VoltOpsEvalResultStatus, type VoltOpsEvalRunCompletionSummaryPayload, type VoltOpsEvalRunErrorPayload, type VoltOpsEvalRunResultLiveMetadata, type VoltOpsEvalRunResultScorePayload, type VoltOpsEvalRunStatus, type VoltOpsEvalRunSummary, VoltOpsPromptApiClient, type VoltOpsPromptManager, VoltOpsPromptManagerImpl, type VoltOpsScorerSummary, type VoltOpsSlackCredential, type VoltOpsSlackDeleteMessageParams, type VoltOpsSlackPostMessageParams, type VoltOpsSlackSearchMessagesParams, type VoltOpsTerminalEvalRunStatus, type VoltOpsTriggerDefinition, VoltOpsTriggerDefinitions, type VoltOpsTriggerEnvelope, type VoltOpsTriggerGroupMap, type VoltOpsTriggerName, VoltOpsTriggerNames, WebSocketEventEmitter, WebSocketLogProcessor, WebSocketSpanProcessor, type WeightedBlendComponent, type WeightedBlendOptions, type Workflow, type WorkflowConfig, type WorkflowExecutionContext, WorkflowRegistry, type WorkflowStateEntry, type WorkflowStats, type WorkflowStepContext, type WorkflowStepType, type WorkflowTimelineEvent, type WorkingMemoryConfig, type WorkingMemoryScope, type WorkingMemorySummary, type WorkingMemoryUpdateOptions, addTimestampToMessage, andAgent, andAll, andRace, andTap, andThen, andWhen, andWorkflow, appendToMessage, buildRetrieverLogMessage, buildSamplingMetadata, buildScorer, buildSpanTree, checkForUpdates, convertUsage, cosineSimilarity, createDefaultInputSafetyGuardrails, createDefaultPIIGuardrails, createDefaultSafetyGuardrails, createEmailRedactorGuardrail, createHTMLSanitizerInputGuardrail, createHooks, createInputGuardrail, createInputLengthGuardrail, createMaxLengthGuardrail, createNodeId, createOutputGuardrail, createPIIInputGuardrail, createPhoneNumberGuardrail, createProfanityGuardrail, createProfanityInputGuardrail, createPrompt, createPromptInjectionGuardrail, createReasoningTools, createRetrieverTool, createScorer, createSensitiveNumberGuardrail, createSimpleTemplateEngine, createSubagent, createSuspendController, createTool, createToolkit, createTriggers, createVoltAgentObservability, createVoltOpsClient, createWorkflow, createWorkflowChain, createWorkflowStepNodeId, VoltAgent as default, defineVoltOpsTrigger, extractFileParts, extractImageParts, extractText, extractTextParts, extractWorkflowStepInfo, filterContentParts, getContentLength, getEnvVar, getGlobalLogBuffer, getGlobalLogger, getNodeTypeFromNodeId, getVoltOpsTriggerDefinition, getWorkflowStepNodeType, hasContent, hasFilePart, hasImagePart, hasTextPart, isAbortError, isNodeRuntime, isServerlessRuntime, isStructuredContent, isTextContent, isVoltAgentError, mapMessageContent, messageHelpers, normalizeContent, normalizeScorerResult, normalizeToArray, prependToMessage, readableLogRecordToObservabilityLog, readableSpanToObservabilitySpan, runLocalScorers, safeJsonParse, serializeValueForDebug, setWaitUntil, shouldSample, tool, transformTextContent, updateAllPackages, updateSinglePackage, weightedBlend, zodSchemaToJsonUI };
|
package/dist/index.js
CHANGED
|
@@ -208,6 +208,7 @@ __export(index_exports, {
|
|
|
208
208
|
NextAction: () => NextAction,
|
|
209
209
|
NodeType: () => NodeType,
|
|
210
210
|
NodeVoltAgentObservability: () => VoltAgentObservability,
|
|
211
|
+
ROOT_CONTEXT: () => import_api8.ROOT_CONTEXT,
|
|
211
212
|
ReasoningStepSchema: () => ReasoningStepSchema,
|
|
212
213
|
RemoteLogProcessor: () => RemoteLogProcessor,
|
|
213
214
|
ServerlessVoltAgentObservability: () => ServerlessVoltAgentObservability,
|
|
@@ -317,11 +318,13 @@ __export(index_exports, {
|
|
|
317
318
|
normalizeScorerResult: () => normalizeScorerResult,
|
|
318
319
|
normalizeToArray: () => normalizeToArray,
|
|
319
320
|
prependToMessage: () => prependToMessage,
|
|
321
|
+
propagation: () => import_api8.propagation,
|
|
320
322
|
readableLogRecordToObservabilityLog: () => readableLogRecordToObservabilityLog,
|
|
321
323
|
readableSpanToObservabilitySpan: () => readableSpanToObservabilitySpan,
|
|
322
324
|
runLocalScorers: () => runLocalScorers,
|
|
323
325
|
safeJsonParse: () => safeJsonParse,
|
|
324
326
|
serializeValueForDebug: () => serializeValueForDebug,
|
|
327
|
+
setWaitUntil: () => setWaitUntil,
|
|
325
328
|
shouldSample: () => shouldSample,
|
|
326
329
|
stepCountIs: () => import_ai6.stepCountIs,
|
|
327
330
|
tool: () => tool,
|
|
@@ -4310,6 +4313,14 @@ var VoltAgentObservability = class {
|
|
|
4310
4313
|
await this.provider.forceFlush();
|
|
4311
4314
|
await this.loggerProvider.forceFlush();
|
|
4312
4315
|
}
|
|
4316
|
+
/**
|
|
4317
|
+
* Flushes spans on finish.
|
|
4318
|
+
* We force flush here to ensure spans are exported even if the runtime
|
|
4319
|
+
* is incorrectly detected or if we are in a short-lived process.
|
|
4320
|
+
*/
|
|
4321
|
+
async flushOnFinish() {
|
|
4322
|
+
await this.forceFlush();
|
|
4323
|
+
}
|
|
4313
4324
|
getProvider() {
|
|
4314
4325
|
return this.provider;
|
|
4315
4326
|
}
|
|
@@ -4336,6 +4347,7 @@ var import_resources2 = require("@opentelemetry/resources");
|
|
|
4336
4347
|
var import_sdk_logs3 = require("@opentelemetry/sdk-logs");
|
|
4337
4348
|
var import_sdk_trace_base3 = require("@opentelemetry/sdk-trace-base");
|
|
4338
4349
|
var import_semantic_conventions3 = require("@opentelemetry/semantic-conventions");
|
|
4350
|
+
var import_context_async_hooks = require("@opentelemetry/context-async-hooks");
|
|
4339
4351
|
var textDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder() : void 0;
|
|
4340
4352
|
var isPromiseLike = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && typeof value.then === "function", "isPromiseLike");
|
|
4341
4353
|
var DEFAULT_MAX_ATTEMPTS = 3;
|
|
@@ -4473,6 +4485,9 @@ var ServerlessVoltAgentObservability = class {
|
|
|
4473
4485
|
resource: this.resource,
|
|
4474
4486
|
spanProcessors
|
|
4475
4487
|
});
|
|
4488
|
+
const contextManager = new import_context_async_hooks.AsyncHooksContextManager();
|
|
4489
|
+
contextManager.enable();
|
|
4490
|
+
import_api7.context.setGlobalContextManager(contextManager);
|
|
4476
4491
|
import_api7.trace.setGlobalTracerProvider(provider);
|
|
4477
4492
|
const tracer = provider.getTracer(
|
|
4478
4493
|
this.instrumentationScopeName,
|
|
@@ -4606,6 +4621,26 @@ var ServerlessVoltAgentObservability = class {
|
|
|
4606
4621
|
await this.provider.forceFlush();
|
|
4607
4622
|
await this.loggerProvider.forceFlush();
|
|
4608
4623
|
}
|
|
4624
|
+
/**
|
|
4625
|
+
* Flushes spans without blocking the response if waitUntil is available.
|
|
4626
|
+
* This is the preferred method to call at the end of a request.
|
|
4627
|
+
*/
|
|
4628
|
+
async flushOnFinish() {
|
|
4629
|
+
const waitUntil = globalThis.___voltagent_wait_until;
|
|
4630
|
+
if (waitUntil) {
|
|
4631
|
+
try {
|
|
4632
|
+
waitUntil(
|
|
4633
|
+
this.forceFlush().catch((err) => {
|
|
4634
|
+
console.warn("[voltagent] Background flush failed", err);
|
|
4635
|
+
})
|
|
4636
|
+
);
|
|
4637
|
+
return;
|
|
4638
|
+
} catch (error) {
|
|
4639
|
+
console.warn("[voltagent] waitUntil failed, falling back to blocking flush", error);
|
|
4640
|
+
}
|
|
4641
|
+
}
|
|
4642
|
+
await this.forceFlush();
|
|
4643
|
+
}
|
|
4609
4644
|
getProvider() {
|
|
4610
4645
|
return this.provider;
|
|
4611
4646
|
}
|
|
@@ -4655,7 +4690,12 @@ function createRemoteSpanProcessor(config) {
|
|
|
4655
4690
|
return void 0;
|
|
4656
4691
|
}
|
|
4657
4692
|
const exporter = new FetchTraceExporter(config.traces);
|
|
4658
|
-
let processor = new import_sdk_trace_base3.
|
|
4693
|
+
let processor = new import_sdk_trace_base3.BatchSpanProcessor(exporter, {
|
|
4694
|
+
// Don't keep the process alive for the export timer
|
|
4695
|
+
scheduledDelayMillis: 1e3,
|
|
4696
|
+
// Export quickly if we have enough spans
|
|
4697
|
+
maxExportBatchSize: 64
|
|
4698
|
+
});
|
|
4659
4699
|
if (config.sampling?.strategy && config.sampling.strategy !== "always") {
|
|
4660
4700
|
processor = new SamplingWrapperProcessor(
|
|
4661
4701
|
processor,
|
|
@@ -4821,6 +4861,15 @@ var FetchLogExporter = class {
|
|
|
4821
4861
|
// src/observability/index.ts
|
|
4822
4862
|
init_types();
|
|
4823
4863
|
var import_api8 = require("@opentelemetry/api");
|
|
4864
|
+
|
|
4865
|
+
// src/observability/wait-until.ts
|
|
4866
|
+
function setWaitUntil(waitUntil) {
|
|
4867
|
+
const globals = globalThis;
|
|
4868
|
+
globals.___voltagent_wait_until = waitUntil;
|
|
4869
|
+
}
|
|
4870
|
+
__name(setWaitUntil, "setWaitUntil");
|
|
4871
|
+
|
|
4872
|
+
// src/observability/index.ts
|
|
4824
4873
|
var VoltAgentObservability2 = VoltAgentObservability;
|
|
4825
4874
|
var createVoltAgentObservability = /* @__PURE__ */ __name((config) => {
|
|
4826
4875
|
const baseConfig = { ...config };
|
|
@@ -6214,6 +6263,7 @@ function createWorkflow({
|
|
|
6214
6263
|
await hooks?.onStepEnd?.(stateManager.state);
|
|
6215
6264
|
traceContext.recordCancellation(reason);
|
|
6216
6265
|
traceContext.end("cancelled");
|
|
6266
|
+
await observability.flushOnFinish();
|
|
6217
6267
|
workflowRegistry.activeExecutions.delete(executionId);
|
|
6218
6268
|
try {
|
|
6219
6269
|
await effectiveMemory.updateWorkflowState(executionId, {
|
|
@@ -6334,6 +6384,7 @@ function createWorkflow({
|
|
|
6334
6384
|
checkpoint
|
|
6335
6385
|
);
|
|
6336
6386
|
traceContext.end("suspended");
|
|
6387
|
+
await observability.flushOnFinish();
|
|
6337
6388
|
runLogger.debug(
|
|
6338
6389
|
`Workflow suspended | user=${options?.userId || "anonymous"} conv=${options?.conversationId || "none"} step=${index}`,
|
|
6339
6390
|
{
|
|
@@ -6541,6 +6592,7 @@ function createWorkflow({
|
|
|
6541
6592
|
suspensionMetadata?.checkpoint
|
|
6542
6593
|
);
|
|
6543
6594
|
traceContext.end("suspended");
|
|
6595
|
+
await observability.flushOnFinish();
|
|
6544
6596
|
try {
|
|
6545
6597
|
await saveSuspensionState(
|
|
6546
6598
|
suspensionMetadata,
|
|
@@ -6576,6 +6628,7 @@ function createWorkflow({
|
|
|
6576
6628
|
traceContext.setOutput(finalState.result);
|
|
6577
6629
|
traceContext.setUsage(stateManager.state.usage);
|
|
6578
6630
|
traceContext.end("completed");
|
|
6631
|
+
await observability.flushOnFinish();
|
|
6579
6632
|
try {
|
|
6580
6633
|
await effectiveMemory.updateWorkflowState(executionContext.executionId, {
|
|
6581
6634
|
status: "completed",
|
|
@@ -6626,6 +6679,7 @@ function createWorkflow({
|
|
|
6626
6679
|
stateManager.cancel(cancellationReason);
|
|
6627
6680
|
traceContext.recordCancellation(cancellationReason);
|
|
6628
6681
|
traceContext.end("cancelled");
|
|
6682
|
+
await observability.flushOnFinish();
|
|
6629
6683
|
workflowRegistry.activeExecutions.delete(executionId);
|
|
6630
6684
|
emitAndCollectEvent({
|
|
6631
6685
|
type: "workflow-cancelled",
|
|
@@ -6674,6 +6728,7 @@ function createWorkflow({
|
|
|
6674
6728
|
stateManager.state.suspension?.checkpoint
|
|
6675
6729
|
);
|
|
6676
6730
|
traceContext.end("suspended");
|
|
6731
|
+
await observability.flushOnFinish();
|
|
6677
6732
|
streamController?.close();
|
|
6678
6733
|
return createWorkflowExecutionResult(
|
|
6679
6734
|
id,
|
|
@@ -6690,6 +6745,7 @@ function createWorkflow({
|
|
|
6690
6745
|
);
|
|
6691
6746
|
}
|
|
6692
6747
|
traceContext.end("error", error);
|
|
6748
|
+
await observability.flushOnFinish();
|
|
6693
6749
|
runLogger.debug(
|
|
6694
6750
|
`Workflow failed | user=${options?.userId || "anonymous"} conv=${options?.conversationId || "none"} error=${error instanceof Error ? error.message : String(error)}`,
|
|
6695
6751
|
{
|
|
@@ -8123,9 +8179,6 @@ var MemoryManager = class {
|
|
|
8123
8179
|
// src/observability/context-keys.ts
|
|
8124
8180
|
var TRIGGER_CONTEXT_KEY = Symbol.for("voltagent.trigger.context");
|
|
8125
8181
|
|
|
8126
|
-
// src/tool/index.ts
|
|
8127
|
-
var import_uuid2 = require("uuid");
|
|
8128
|
-
|
|
8129
8182
|
// src/tool/manager/BaseToolManager.ts
|
|
8130
8183
|
function isBaseTool(tool2) {
|
|
8131
8184
|
return "type" in tool2 && tool2.type === "user-defined";
|
|
@@ -8557,7 +8610,7 @@ var Tool = class {
|
|
|
8557
8610
|
if (!options.parameters) {
|
|
8558
8611
|
throw new Error(`Tool '${options.name}' parameters schema is required`);
|
|
8559
8612
|
}
|
|
8560
|
-
this.id = options.id
|
|
8613
|
+
this.id = options.id ?? options.name;
|
|
8561
8614
|
this.name = options.name;
|
|
8562
8615
|
this.description = options.description || "";
|
|
8563
8616
|
this.parameters = options.parameters;
|
|
@@ -16471,6 +16524,8 @@ var Agent = class {
|
|
|
16471
16524
|
await this.flushPendingMessagesOnError(oc).catch(() => {
|
|
16472
16525
|
});
|
|
16473
16526
|
return this.handleError(error, oc, options, startTime);
|
|
16527
|
+
} finally {
|
|
16528
|
+
await this.getObservability().flushOnFinish();
|
|
16474
16529
|
}
|
|
16475
16530
|
});
|
|
16476
16531
|
}
|
|
@@ -16589,7 +16644,7 @@ var Agent = class {
|
|
|
16589
16644
|
// VoltAgent controlled (these should not be overridden)
|
|
16590
16645
|
abortSignal: oc.abortController.signal,
|
|
16591
16646
|
onStepFinish: this.createStepHandler(oc, options),
|
|
16592
|
-
onError: /* @__PURE__ */ __name((errorData) => {
|
|
16647
|
+
onError: /* @__PURE__ */ __name(async (errorData) => {
|
|
16593
16648
|
const actualError = errorData?.error || errorData;
|
|
16594
16649
|
if (isBailError(actualError)) {
|
|
16595
16650
|
methodLogger.info("Stream aborted due to subagent bail (not an error)", {
|
|
@@ -16610,6 +16665,8 @@ var Agent = class {
|
|
|
16610
16665
|
context: oc
|
|
16611
16666
|
});
|
|
16612
16667
|
oc.traceContext.end("error", actualError);
|
|
16668
|
+
await this.getObservability().flushOnFinish().catch(() => {
|
|
16669
|
+
});
|
|
16613
16670
|
}, "onError"),
|
|
16614
16671
|
onFinish: /* @__PURE__ */ __name(async (finalResult) => {
|
|
16615
16672
|
const providerUsage = finalResult.usage ? await Promise.resolve(finalResult.usage) : void 0;
|
|
@@ -16723,6 +16780,7 @@ var Agent = class {
|
|
|
16723
16780
|
finishReason: finalResult.finishReason
|
|
16724
16781
|
});
|
|
16725
16782
|
oc.traceContext.end("completed");
|
|
16783
|
+
await this.getObservability().flushOnFinish();
|
|
16726
16784
|
}, "onFinish")
|
|
16727
16785
|
});
|
|
16728
16786
|
const agent = this;
|
|
@@ -16925,7 +16983,10 @@ var Agent = class {
|
|
|
16925
16983
|
} catch (error) {
|
|
16926
16984
|
await this.flushPendingMessagesOnError(oc).catch(() => {
|
|
16927
16985
|
});
|
|
16986
|
+
await this.getObservability().flushOnFinish().catch(() => {
|
|
16987
|
+
});
|
|
16928
16988
|
return this.handleError(error, oc, options, startTime);
|
|
16989
|
+
} finally {
|
|
16929
16990
|
}
|
|
16930
16991
|
});
|
|
16931
16992
|
}
|
|
@@ -17102,6 +17163,8 @@ var Agent = class {
|
|
|
17102
17163
|
await this.flushPendingMessagesOnError(oc).catch(() => {
|
|
17103
17164
|
});
|
|
17104
17165
|
return this.handleError(error, oc, options, startTime);
|
|
17166
|
+
} finally {
|
|
17167
|
+
await this.getObservability().flushOnFinish();
|
|
17105
17168
|
}
|
|
17106
17169
|
});
|
|
17107
17170
|
}
|
|
@@ -17194,7 +17257,7 @@ var Agent = class {
|
|
|
17194
17257
|
providerOptions,
|
|
17195
17258
|
// VoltAgent controlled
|
|
17196
17259
|
abortSignal: oc.abortController.signal,
|
|
17197
|
-
onError: /* @__PURE__ */ __name((errorData) => {
|
|
17260
|
+
onError: /* @__PURE__ */ __name(async (errorData) => {
|
|
17198
17261
|
const actualError = errorData?.error || errorData;
|
|
17199
17262
|
methodLogger.error("Stream object error occurred", {
|
|
17200
17263
|
error: actualError,
|
|
@@ -17209,6 +17272,8 @@ var Agent = class {
|
|
|
17209
17272
|
});
|
|
17210
17273
|
oc.traceContext.end("error", actualError);
|
|
17211
17274
|
rejectGuardrailObject?.(actualError);
|
|
17275
|
+
await this.getObservability().flushOnFinish().catch(() => {
|
|
17276
|
+
});
|
|
17212
17277
|
}, "onError"),
|
|
17213
17278
|
onFinish: /* @__PURE__ */ __name(async (finalResult) => {
|
|
17214
17279
|
try {
|
|
@@ -17298,6 +17363,7 @@ var Agent = class {
|
|
|
17298
17363
|
}
|
|
17299
17364
|
});
|
|
17300
17365
|
oc.traceContext.end("completed");
|
|
17366
|
+
await this.getObservability().flushOnFinish();
|
|
17301
17367
|
} catch (error) {
|
|
17302
17368
|
rejectGuardrailObject?.(error);
|
|
17303
17369
|
throw error;
|
|
@@ -17335,7 +17401,10 @@ var Agent = class {
|
|
|
17335
17401
|
} catch (error) {
|
|
17336
17402
|
await this.flushPendingMessagesOnError(oc).catch(() => {
|
|
17337
17403
|
});
|
|
17404
|
+
await this.getObservability().flushOnFinish().catch(() => {
|
|
17405
|
+
});
|
|
17338
17406
|
return this.handleError(error, oc, options, 0);
|
|
17407
|
+
} finally {
|
|
17339
17408
|
}
|
|
17340
17409
|
});
|
|
17341
17410
|
}
|
|
@@ -19147,7 +19216,7 @@ function createHooks(hooks = {}) {
|
|
|
19147
19216
|
__name(createHooks, "createHooks");
|
|
19148
19217
|
|
|
19149
19218
|
// src/tool/reasoning/tools.ts
|
|
19150
|
-
var
|
|
19219
|
+
var import_uuid2 = require("uuid");
|
|
19151
19220
|
var import_zod5 = require("zod");
|
|
19152
19221
|
|
|
19153
19222
|
// src/tool/reasoning/types.ts
|
|
@@ -19206,7 +19275,7 @@ var thinkTool = createTool({
|
|
|
19206
19275
|
return "Error: Missing required agentId or historyEntryId in execution options.";
|
|
19207
19276
|
}
|
|
19208
19277
|
const step = {
|
|
19209
|
-
id: (0,
|
|
19278
|
+
id: (0, import_uuid2.v4)(),
|
|
19210
19279
|
type: "thought",
|
|
19211
19280
|
title,
|
|
19212
19281
|
reasoning: thought,
|
|
@@ -19252,7 +19321,7 @@ var analyzeTool = createTool({
|
|
|
19252
19321
|
return "Error: Missing required agentId or historyEntryId in execution options.";
|
|
19253
19322
|
}
|
|
19254
19323
|
const step = {
|
|
19255
|
-
id: (0,
|
|
19324
|
+
id: (0, import_uuid2.v4)(),
|
|
19256
19325
|
type: "analysis",
|
|
19257
19326
|
title,
|
|
19258
19327
|
reasoning: analysis,
|
|
@@ -22878,6 +22947,7 @@ var import_ai6 = require("ai");
|
|
|
22878
22947
|
NextAction,
|
|
22879
22948
|
NodeType,
|
|
22880
22949
|
NodeVoltAgentObservability,
|
|
22950
|
+
ROOT_CONTEXT,
|
|
22881
22951
|
ReasoningStepSchema,
|
|
22882
22952
|
RemoteLogProcessor,
|
|
22883
22953
|
ServerlessVoltAgentObservability,
|
|
@@ -22986,11 +23056,13 @@ var import_ai6 = require("ai");
|
|
|
22986
23056
|
normalizeScorerResult,
|
|
22987
23057
|
normalizeToArray,
|
|
22988
23058
|
prependToMessage,
|
|
23059
|
+
propagation,
|
|
22989
23060
|
readableLogRecordToObservabilityLog,
|
|
22990
23061
|
readableSpanToObservabilitySpan,
|
|
22991
23062
|
runLocalScorers,
|
|
22992
23063
|
safeJsonParse,
|
|
22993
23064
|
serializeValueForDebug,
|
|
23065
|
+
setWaitUntil,
|
|
22994
23066
|
shouldSample,
|
|
22995
23067
|
stepCountIs,
|
|
22996
23068
|
tool,
|