@voltagent/core 0.1.25 → 0.1.27

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
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { Span } from '@opentelemetry/api';
3
+ import { Context } from 'hono';
3
4
  import { SpanExporter } from '@opentelemetry/sdk-trace-base';
4
5
  import { ClientCapabilities } from '@modelcontextprotocol/sdk/types.js';
5
6
  import { EventEmitter } from 'node:events';
@@ -2522,6 +2523,43 @@ declare class Agent<TProvider extends {
2522
2523
  _INTERNAL_setVoltAgentExporter(exporter: VoltAgentExporter): void;
2523
2524
  }
2524
2525
 
2526
+ /**
2527
+ * HTTP methods supported by custom endpoints
2528
+ */
2529
+ type HttpMethod = "get" | "post" | "put" | "patch" | "delete" | "options" | "head";
2530
+ /**
2531
+ * Handler function for custom endpoints
2532
+ */
2533
+ type CustomEndpointHandler = (c: Context) => Promise<Response> | Response;
2534
+ /**
2535
+ * Definition for a custom endpoint
2536
+ */
2537
+ interface CustomEndpointDefinition {
2538
+ /**
2539
+ * The path for the endpoint, relative to the API root
2540
+ * Example: "/custom-endpoint" or "/custom/:param"
2541
+ */
2542
+ path: string;
2543
+ /**
2544
+ * The HTTP method for the endpoint
2545
+ */
2546
+ method: HttpMethod;
2547
+ /**
2548
+ * The handler function for the endpoint
2549
+ */
2550
+ handler: CustomEndpointHandler;
2551
+ /**
2552
+ * Optional description for the endpoint
2553
+ */
2554
+ description?: string;
2555
+ }
2556
+ /**
2557
+ * Error thrown when a custom endpoint definition is invalid
2558
+ */
2559
+ declare class CustomEndpointError extends Error {
2560
+ constructor(message: string);
2561
+ }
2562
+
2525
2563
  /**
2526
2564
  * Enum defining the next action to take after a reasoning step.
2527
2565
  */
@@ -3220,13 +3258,30 @@ declare class AgentRegistry {
3220
3258
  getGlobalVoltAgentExporter(): VoltAgentExporter | undefined;
3221
3259
  }
3222
3260
 
3261
+ /**
3262
+ * Register a single custom endpoint with the API server
3263
+ * @param endpoint The custom endpoint definition
3264
+ * @throws CustomEndpointError if the endpoint definition is invalid or registration fails
3265
+ */
3266
+ declare function registerCustomEndpoint(endpoint: CustomEndpointDefinition): void;
3267
+ /**
3268
+ * Register multiple custom endpoints with the API server
3269
+ * @param endpoints Array of custom endpoint definitions
3270
+ * @throws CustomEndpointError if any endpoint definition is invalid or registration fails
3271
+ */
3272
+ declare function registerCustomEndpoints(endpoints: CustomEndpointDefinition[]): void;
3273
+
3223
3274
  type VoltAgentOptions = {
3224
3275
  agents: Record<string, Agent<any>>;
3225
3276
  port?: number;
3226
3277
  autoStart?: boolean;
3227
3278
  checkDependencies?: boolean;
3228
3279
  /**
3229
- * Optional OpenTelemetry SpanExporter instance or array of instances,
3280
+ * Optional array of custom endpoint definitions to register with the API server
3281
+ */
3282
+ customEndpoints?: CustomEndpointDefinition[];
3283
+ /**
3284
+ * Optional OpenTelemetry SpanExporter instance or array of instances.
3230
3285
  * or a VoltAgentExporter instance or array of instances.
3231
3286
  * If provided, VoltAgent will attempt to initialize and register
3232
3287
  * a NodeTracerProvider with a BatchSpanProcessor for the given exporter(s).
@@ -3240,6 +3295,7 @@ type VoltAgentOptions = {
3240
3295
  declare class VoltAgent {
3241
3296
  private registry;
3242
3297
  private serverStarted;
3298
+ private customEndpoints;
3243
3299
  constructor(options: VoltAgentOptions);
3244
3300
  /**
3245
3301
  * Check for dependency updates
@@ -3257,6 +3313,18 @@ declare class VoltAgent {
3257
3313
  * Start the server
3258
3314
  */
3259
3315
  startServer(): Promise<void>;
3316
+ /**
3317
+ * Register a custom endpoint with the API server
3318
+ * @param endpoint The custom endpoint definition
3319
+ * @throws Error if the endpoint definition is invalid or registration fails
3320
+ */
3321
+ registerCustomEndpoint(endpoint: CustomEndpointDefinition): void;
3322
+ /**
3323
+ * Register multiple custom endpoints with the API server
3324
+ * @param endpoints Array of custom endpoint definitions
3325
+ * @throws Error if any endpoint definition is invalid or registration fails
3326
+ */
3327
+ registerCustomEndpoints(endpoints: CustomEndpointDefinition[]): void;
3260
3328
  /**
3261
3329
  * Get all registered agents
3262
3330
  */
@@ -3273,4 +3341,4 @@ declare class VoltAgent {
3273
3341
  shutdownTelemetry(): Promise<void>;
3274
3342
  }
3275
3343
 
3276
- 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, DEFAULT_INSTRUCTIONS, DataContent, EventStatus, ExtractVariableNames, FEW_SHOT_EXAMPLES, FilePart, GenerateObjectOptions, GenerateTextOptions, HTTPServerConfig, HistoryStatus, 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, 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, safeJsonParse, serializeValueForDebug, tool, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
3344
+ 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, 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 };