@voltagent/core 0.1.7 → 0.1.9
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 +283 -121
- package/dist/index.js +1082 -413
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1080 -412
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -3
package/dist/index.d.ts
CHANGED
|
@@ -422,6 +422,7 @@ type ProviderOptions = {
|
|
|
422
422
|
onStepFinish?: (step: StepWithContent) => Promise<void>;
|
|
423
423
|
onFinish?: (result: unknown) => Promise<void>;
|
|
424
424
|
onError?: (error: unknown) => Promise<void>;
|
|
425
|
+
toolExecutionContext?: ToolExecutionContext;
|
|
425
426
|
};
|
|
426
427
|
/**
|
|
427
428
|
* Agent configuration options
|
|
@@ -506,12 +507,13 @@ interface CommonGenerateOptions {
|
|
|
506
507
|
tools?: BaseTool[];
|
|
507
508
|
signal?: AbortSignal;
|
|
508
509
|
historyEntryId?: string;
|
|
510
|
+
operationContext?: OperationContext;
|
|
509
511
|
}
|
|
510
512
|
/**
|
|
511
513
|
* Public-facing generate options for external users
|
|
512
|
-
* Omits internal implementation details
|
|
514
|
+
* Omits internal implementation details like historyEntryId and operationContext
|
|
513
515
|
*/
|
|
514
|
-
type PublicGenerateOptions = Omit<CommonGenerateOptions, "historyEntryId">;
|
|
516
|
+
type PublicGenerateOptions = Omit<CommonGenerateOptions, "historyEntryId" | "operationContext">;
|
|
515
517
|
/**
|
|
516
518
|
* Agent status information
|
|
517
519
|
*/
|
|
@@ -628,21 +630,152 @@ interface AgentHandoffResult {
|
|
|
628
630
|
error?: Error | string;
|
|
629
631
|
}
|
|
630
632
|
/**
|
|
631
|
-
*
|
|
632
|
-
* Prevents race conditions when the same agent instance is used concurrently
|
|
633
|
+
* Context for a specific agent operation (e.g., one generateText call)
|
|
633
634
|
*/
|
|
634
635
|
type OperationContext = {
|
|
636
|
+
/** Unique identifier for the operation (maps to historyEntryId) */
|
|
637
|
+
readonly operationId: string;
|
|
638
|
+
/** User-managed context map for this specific operation */
|
|
639
|
+
readonly userContext: Map<string | symbol, any>;
|
|
635
640
|
/** The history entry associated with this operation */
|
|
636
641
|
historyEntry: AgentHistoryEntry;
|
|
637
642
|
/** Map to store tool event updaters using tool call ID as key */
|
|
638
643
|
eventUpdaters: Map<string, EventUpdater>;
|
|
639
644
|
/** Whether this operation is still active */
|
|
640
645
|
isActive: boolean;
|
|
641
|
-
/** Parent agent ID */
|
|
646
|
+
/** Parent agent ID if part of a delegation chain */
|
|
642
647
|
parentAgentId?: string;
|
|
643
|
-
/** Parent history entry ID */
|
|
648
|
+
/** Parent history entry ID if part of a delegation chain */
|
|
644
649
|
parentHistoryEntryId?: string;
|
|
645
650
|
};
|
|
651
|
+
/**
|
|
652
|
+
* Tool execution context passed to tool.execute method
|
|
653
|
+
* Includes operation-specific context and necessary identifiers
|
|
654
|
+
* Extends base ToolExecuteOptions.
|
|
655
|
+
*/
|
|
656
|
+
type ToolExecutionContext = ToolExecuteOptions & {
|
|
657
|
+
/** ID of the agent executing the tool */
|
|
658
|
+
agentId: string;
|
|
659
|
+
/** History ID associated with the current operation */
|
|
660
|
+
historyEntryId: string;
|
|
661
|
+
};
|
|
662
|
+
/**
|
|
663
|
+
* Specific information related to a tool execution error.
|
|
664
|
+
*/
|
|
665
|
+
interface ToolErrorInfo {
|
|
666
|
+
/** The unique identifier of the tool call. */
|
|
667
|
+
toolCallId: string;
|
|
668
|
+
/** The name of the tool that was executed. */
|
|
669
|
+
toolName: string;
|
|
670
|
+
/** The original error thrown directly by the tool during execution (if available). */
|
|
671
|
+
toolExecutionError?: unknown;
|
|
672
|
+
/** The arguments passed to the tool when the error occurred (for debugging). */
|
|
673
|
+
toolArguments?: unknown;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Standardized error structure for Voltagent agent operations.
|
|
677
|
+
* Providers should wrap their specific errors in this structure before
|
|
678
|
+
* passing them to onError callbacks.
|
|
679
|
+
*/
|
|
680
|
+
interface VoltAgentError {
|
|
681
|
+
/** A clear, human-readable error message. This could be a general message or derived from toolError info. */
|
|
682
|
+
message: string;
|
|
683
|
+
/** The original error object thrown by the provider or underlying system (if available). */
|
|
684
|
+
originalError?: unknown;
|
|
685
|
+
/** Optional error code or identifier from the provider. */
|
|
686
|
+
code?: string | number;
|
|
687
|
+
/** Additional metadata related to the error (e.g., retry info, request ID). */
|
|
688
|
+
metadata?: Record<string, any>;
|
|
689
|
+
/** Information about the step or stage where the error occurred (optional, e.g., 'llm_request', 'tool_execution', 'response_parsing'). */
|
|
690
|
+
stage?: string;
|
|
691
|
+
/** If the error occurred during tool execution, this field contains the relevant details. Otherwise, it's undefined. */
|
|
692
|
+
toolError?: ToolErrorInfo;
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Type for onError callbacks in streaming operations.
|
|
696
|
+
* Providers must pass an error conforming to the VoltAgentError structure.
|
|
697
|
+
*/
|
|
698
|
+
type StreamOnErrorCallback = (error: VoltAgentError) => Promise<void> | void;
|
|
699
|
+
/**
|
|
700
|
+
* Standardized object structure passed to the onFinish callback
|
|
701
|
+
* when streamText completes successfully.
|
|
702
|
+
*/
|
|
703
|
+
interface StreamTextFinishResult {
|
|
704
|
+
/** The final, consolidated text output from the stream. */
|
|
705
|
+
text: string;
|
|
706
|
+
/** Token usage information (if available). */
|
|
707
|
+
usage?: UsageInfo;
|
|
708
|
+
/** The reason the stream finished (if available, e.g., 'stop', 'length', 'tool-calls'). */
|
|
709
|
+
finishReason?: string;
|
|
710
|
+
/** The original completion response object from the provider (if available). */
|
|
711
|
+
providerResponse?: unknown;
|
|
712
|
+
/** Any warnings generated during the completion (if available). */
|
|
713
|
+
warnings?: unknown[];
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Type for the onFinish callback function for streamText.
|
|
717
|
+
*/
|
|
718
|
+
type StreamTextOnFinishCallback = (result: StreamTextFinishResult) => Promise<void> | void;
|
|
719
|
+
/**
|
|
720
|
+
* Standardized object structure passed to the onFinish callback
|
|
721
|
+
* when streamObject completes successfully.
|
|
722
|
+
* @template TObject The expected type of the fully formed object.
|
|
723
|
+
*/
|
|
724
|
+
interface StreamObjectFinishResult<TObject> {
|
|
725
|
+
/** The final, fully formed object from the stream. */
|
|
726
|
+
object: TObject;
|
|
727
|
+
/** Token usage information (if available). */
|
|
728
|
+
usage?: UsageInfo;
|
|
729
|
+
/** The original completion response object from the provider (if available). */
|
|
730
|
+
providerResponse?: unknown;
|
|
731
|
+
/** Any warnings generated during the completion (if available). */
|
|
732
|
+
warnings?: unknown[];
|
|
733
|
+
/** The reason the stream finished (if available). Although less common for object streams. */
|
|
734
|
+
finishReason?: string;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Type for the onFinish callback function for streamObject.
|
|
738
|
+
* @template TObject The expected type of the fully formed object.
|
|
739
|
+
*/
|
|
740
|
+
type StreamObjectOnFinishCallback<TObject> = (result: StreamObjectFinishResult<TObject>) => Promise<void> | void;
|
|
741
|
+
/**
|
|
742
|
+
* Standardized success result structure for generateText.
|
|
743
|
+
*/
|
|
744
|
+
interface StandardizedTextResult {
|
|
745
|
+
/** The generated text. */
|
|
746
|
+
text: string;
|
|
747
|
+
/** Token usage information (if available). */
|
|
748
|
+
usage?: UsageInfo;
|
|
749
|
+
/** Original provider response (if needed). */
|
|
750
|
+
providerResponse?: unknown;
|
|
751
|
+
/** Finish reason (if available from provider). */
|
|
752
|
+
finishReason?: string;
|
|
753
|
+
/** Warnings (if available from provider). */
|
|
754
|
+
warnings?: unknown[];
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Standardized success result structure for generateObject.
|
|
758
|
+
* @template TObject The expected type of the generated object.
|
|
759
|
+
*/
|
|
760
|
+
interface StandardizedObjectResult<TObject> {
|
|
761
|
+
/** The generated object. */
|
|
762
|
+
object: TObject;
|
|
763
|
+
/** Token usage information (if available). */
|
|
764
|
+
usage?: UsageInfo;
|
|
765
|
+
/** Original provider response (if needed). */
|
|
766
|
+
providerResponse?: unknown;
|
|
767
|
+
/** Finish reason (if available from provider). */
|
|
768
|
+
finishReason?: string;
|
|
769
|
+
/** Warnings (if available from provider). */
|
|
770
|
+
warnings?: unknown[];
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Unified output type for the onEnd hook, representing the successful result
|
|
774
|
+
* of any core agent operation. Use 'type guarding' or check specific fields
|
|
775
|
+
* within the hook implementation to determine the concrete type.
|
|
776
|
+
* Object types are generalized to 'unknown' here for the union.
|
|
777
|
+
*/
|
|
778
|
+
type AgentOperationOutput = StandardizedTextResult | StreamTextFinishResult | StandardizedObjectResult<unknown> | StreamObjectFinishResult<unknown>;
|
|
646
779
|
|
|
647
780
|
/**
|
|
648
781
|
* Token usage information
|
|
@@ -808,6 +941,11 @@ type ToolExecuteOptions = {
|
|
|
808
941
|
* Optional AbortSignal to abort the execution
|
|
809
942
|
*/
|
|
810
943
|
signal?: AbortSignal;
|
|
944
|
+
/**
|
|
945
|
+
* The operation context associated with the agent invocation triggering this tool execution.
|
|
946
|
+
* Provides access to operation-specific state like userContext.
|
|
947
|
+
*/
|
|
948
|
+
operationContext?: OperationContext;
|
|
811
949
|
/**
|
|
812
950
|
* Additional options can be added in the future
|
|
813
951
|
*/
|
|
@@ -849,6 +987,7 @@ interface GenerateTextOptions<TModel> {
|
|
|
849
987
|
provider?: ProviderOptions;
|
|
850
988
|
onStepFinish?: StepFinishCallback;
|
|
851
989
|
signal?: AbortSignal;
|
|
990
|
+
toolExecutionContext?: ToolExecutionContext;
|
|
852
991
|
}
|
|
853
992
|
interface StreamTextOptions<TModel> {
|
|
854
993
|
messages: BaseMessage[];
|
|
@@ -858,11 +997,10 @@ interface StreamTextOptions<TModel> {
|
|
|
858
997
|
provider?: ProviderOptions;
|
|
859
998
|
onStepFinish?: StepFinishCallback;
|
|
860
999
|
onChunk?: StepChunkCallback;
|
|
861
|
-
onFinish?:
|
|
862
|
-
|
|
863
|
-
}) => void | Promise<void>;
|
|
864
|
-
onError?: (error: any) => void | Promise<void>;
|
|
1000
|
+
onFinish?: StreamTextOnFinishCallback;
|
|
1001
|
+
onError?: StreamOnErrorCallback;
|
|
865
1002
|
signal?: AbortSignal;
|
|
1003
|
+
toolExecutionContext?: ToolExecutionContext;
|
|
866
1004
|
}
|
|
867
1005
|
interface GenerateObjectOptions<TModel, TSchema extends z.ZodType> {
|
|
868
1006
|
messages: BaseMessage[];
|
|
@@ -871,6 +1009,7 @@ interface GenerateObjectOptions<TModel, TSchema extends z.ZodType> {
|
|
|
871
1009
|
provider?: ProviderOptions;
|
|
872
1010
|
onStepFinish?: StepFinishCallback;
|
|
873
1011
|
signal?: AbortSignal;
|
|
1012
|
+
toolExecutionContext?: ToolExecutionContext;
|
|
874
1013
|
}
|
|
875
1014
|
interface StreamObjectOptions<TModel, TSchema extends z.ZodType> {
|
|
876
1015
|
messages: BaseMessage[];
|
|
@@ -878,11 +1017,10 @@ interface StreamObjectOptions<TModel, TSchema extends z.ZodType> {
|
|
|
878
1017
|
schema: TSchema;
|
|
879
1018
|
provider?: ProviderOptions;
|
|
880
1019
|
onStepFinish?: StepFinishCallback;
|
|
881
|
-
onFinish?:
|
|
882
|
-
|
|
883
|
-
}) => void | Promise<void>;
|
|
884
|
-
onError?: (error: any) => void | Promise<void>;
|
|
1020
|
+
onFinish?: StreamObjectOnFinishCallback<z.infer<TSchema>>;
|
|
1021
|
+
onError?: StreamOnErrorCallback;
|
|
885
1022
|
signal?: AbortSignal;
|
|
1023
|
+
toolExecutionContext?: ToolExecutionContext;
|
|
886
1024
|
}
|
|
887
1025
|
type InferStreamResponse<T> = T extends {
|
|
888
1026
|
streamText: (...args: any[]) => Promise<infer R>;
|
|
@@ -912,8 +1050,18 @@ type InferProviderParams<T> = T extends {
|
|
|
912
1050
|
schema?: any;
|
|
913
1051
|
} ? Omit<P, "messages" | "model" | "tools" | "maxSteps" | "schema"> : Record<string, never> : Record<string, never>;
|
|
914
1052
|
type LLMProvider<TProvider> = {
|
|
1053
|
+
/**
|
|
1054
|
+
* Generates a text response based on the provided options.
|
|
1055
|
+
* Implementers should catch underlying SDK/API errors and throw a VoltAgentError.
|
|
1056
|
+
* @throws {VoltAgentError} If an error occurs during generation.
|
|
1057
|
+
*/
|
|
915
1058
|
generateText(options: GenerateTextOptions<InferModel<TProvider>>): Promise<ProviderTextResponse<InferGenerateTextResponse<TProvider>>>;
|
|
916
1059
|
streamText(options: StreamTextOptions<InferModel<TProvider>>): Promise<ProviderTextStreamResponse<InferStreamResponse<TProvider>>>;
|
|
1060
|
+
/**
|
|
1061
|
+
* Generates a structured object response based on the provided options and schema.
|
|
1062
|
+
* Implementers should catch underlying SDK/API errors and throw a VoltAgentError.
|
|
1063
|
+
* @throws {VoltAgentError} If an error occurs during generation.
|
|
1064
|
+
*/
|
|
917
1065
|
generateObject<TSchema extends z.ZodType>(options: GenerateObjectOptions<InferModel<TProvider>, TSchema>): Promise<ProviderObjectResponse<InferGenerateObjectResponse<TProvider>, z.infer<TSchema>>>;
|
|
918
1066
|
streamObject<TSchema extends z.ZodType>(options: StreamObjectOptions<InferModel<TProvider>, TSchema>): Promise<ProviderObjectStreamResponse<InferStreamResponse<TProvider>, z.infer<TSchema>>>;
|
|
919
1067
|
toMessage(message: BaseMessage): InferMessage<TProvider>;
|
|
@@ -1524,45 +1672,53 @@ declare class MemoryManager {
|
|
|
1524
1672
|
addEventToHistoryEntry(agentId: string, entryId: string, event: any): Promise<any | undefined>;
|
|
1525
1673
|
}
|
|
1526
1674
|
|
|
1675
|
+
interface OnStartHookArgs {
|
|
1676
|
+
agent: Agent<any>;
|
|
1677
|
+
context: OperationContext;
|
|
1678
|
+
}
|
|
1679
|
+
interface OnEndHookArgs {
|
|
1680
|
+
agent: Agent<any>;
|
|
1681
|
+
/** The standardized successful output object. Undefined on error. */
|
|
1682
|
+
output: AgentOperationOutput | undefined;
|
|
1683
|
+
/** The VoltAgentError object if the operation failed. Undefined on success. */
|
|
1684
|
+
error: VoltAgentError | undefined;
|
|
1685
|
+
context: OperationContext;
|
|
1686
|
+
}
|
|
1687
|
+
interface OnHandoffHookArgs {
|
|
1688
|
+
agent: Agent<any>;
|
|
1689
|
+
source: Agent<any>;
|
|
1690
|
+
}
|
|
1691
|
+
interface OnToolStartHookArgs {
|
|
1692
|
+
agent: Agent<any>;
|
|
1693
|
+
tool: AgentTool;
|
|
1694
|
+
context: OperationContext;
|
|
1695
|
+
}
|
|
1696
|
+
interface OnToolEndHookArgs {
|
|
1697
|
+
agent: Agent<any>;
|
|
1698
|
+
tool: AgentTool;
|
|
1699
|
+
/** The successful output from the tool. Undefined on error. */
|
|
1700
|
+
output: unknown | undefined;
|
|
1701
|
+
/** The VoltAgentError if the tool execution failed. Undefined on success. */
|
|
1702
|
+
error: VoltAgentError | undefined;
|
|
1703
|
+
context: OperationContext;
|
|
1704
|
+
}
|
|
1705
|
+
type AgentHookOnStart = (args: OnStartHookArgs) => Promise<void> | void;
|
|
1706
|
+
type AgentHookOnEnd = (args: OnEndHookArgs) => Promise<void> | void;
|
|
1707
|
+
type AgentHookOnHandoff = (args: OnHandoffHookArgs) => Promise<void> | void;
|
|
1708
|
+
type AgentHookOnToolStart = (args: OnToolStartHookArgs) => Promise<void> | void;
|
|
1709
|
+
type AgentHookOnToolEnd = (args: OnToolEndHookArgs) => Promise<void> | void;
|
|
1527
1710
|
/**
|
|
1528
|
-
* Type definition for agent hooks
|
|
1711
|
+
* Type definition for agent hooks using single argument objects.
|
|
1529
1712
|
*/
|
|
1530
1713
|
type AgentHooks = {
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
/**
|
|
1537
|
-
* Called when the agent produces a final output
|
|
1538
|
-
* @param agent The agent that produced the output
|
|
1539
|
-
* @param output The output produced by the agent
|
|
1540
|
-
*/
|
|
1541
|
-
onEnd?: (agent: Agent<any>, output: any) => Promise<void> | void;
|
|
1542
|
-
/**
|
|
1543
|
-
* Called when the agent is being handed off to
|
|
1544
|
-
* @param agent The agent being handed off to
|
|
1545
|
-
* @param source The agent that is handing off
|
|
1546
|
-
*/
|
|
1547
|
-
onHandoff?: (agent: Agent<any>, source: Agent<any>) => Promise<void> | void;
|
|
1548
|
-
/**
|
|
1549
|
-
* Called before a tool is invoked
|
|
1550
|
-
* @param agent The agent invoking the tool
|
|
1551
|
-
* @param tool The tool being invoked
|
|
1552
|
-
*/
|
|
1553
|
-
onToolStart?: (agent: Agent<any>, tool: AgentTool) => Promise<void> | void;
|
|
1554
|
-
/**
|
|
1555
|
-
* Called after a tool is invoked
|
|
1556
|
-
* @param agent The agent that invoked the tool
|
|
1557
|
-
* @param tool The tool that was invoked
|
|
1558
|
-
* @param result The result of the tool invocation
|
|
1559
|
-
*/
|
|
1560
|
-
onToolEnd?: (agent: Agent<any>, tool: AgentTool, result: any) => Promise<void> | void;
|
|
1714
|
+
onStart?: AgentHookOnStart;
|
|
1715
|
+
onEnd?: AgentHookOnEnd;
|
|
1716
|
+
onHandoff?: AgentHookOnHandoff;
|
|
1717
|
+
onToolStart?: AgentHookOnToolStart;
|
|
1718
|
+
onToolEnd?: AgentHookOnToolEnd;
|
|
1561
1719
|
};
|
|
1562
1720
|
/**
|
|
1563
|
-
* Create hooks from an object literal
|
|
1564
|
-
* @param hooks Object with hook methods
|
|
1565
|
-
* @returns A complete hooks object
|
|
1721
|
+
* Create hooks from an object literal.
|
|
1566
1722
|
*/
|
|
1567
1723
|
declare function createHooks(hooks?: Partial<AgentHooks>): AgentHooks;
|
|
1568
1724
|
|
|
@@ -1834,7 +1990,7 @@ type Voice = {
|
|
|
1834
1990
|
* Agent class for interacting with AI models
|
|
1835
1991
|
*/
|
|
1836
1992
|
declare class Agent<TProvider extends {
|
|
1837
|
-
llm: LLMProvider<
|
|
1993
|
+
llm: LLMProvider<unknown>;
|
|
1838
1994
|
}> {
|
|
1839
1995
|
/**
|
|
1840
1996
|
* Unique identifier for the agent
|
|
@@ -2164,22 +2320,30 @@ interface RetryConfig {
|
|
|
2164
2320
|
}
|
|
2165
2321
|
|
|
2166
2322
|
/**
|
|
2167
|
-
*
|
|
2323
|
+
* Prompt management utilities for agent prompt tuning
|
|
2168
2324
|
*/
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2325
|
+
type ExtractVariableNames<T extends string> = T extends `${string}{{${infer Param}}}${infer Rest}` ? Param | ExtractVariableNames<Rest> : never;
|
|
2326
|
+
type AllowedVariableValue = string | number | boolean | undefined | null;
|
|
2327
|
+
type TemplateVariables<T extends string> = {
|
|
2328
|
+
[K in ExtractVariableNames<T>]: AllowedVariableValue;
|
|
2329
|
+
};
|
|
2330
|
+
type PromptTemplate<T extends string> = [ExtractVariableNames<T>] extends [never] ? {
|
|
2331
|
+
template: T;
|
|
2332
|
+
variables?: Record<string, never>;
|
|
2333
|
+
} : {
|
|
2334
|
+
template: T;
|
|
2335
|
+
variables: TemplateVariables<T>;
|
|
2336
|
+
};
|
|
2337
|
+
type PromptCreator<T extends string> = (extraVariables?: Partial<TemplateVariables<T>>) => string;
|
|
2177
2338
|
/**
|
|
2178
|
-
*
|
|
2179
|
-
*
|
|
2180
|
-
*
|
|
2339
|
+
* Creates a type-safe, customizable prompt function from a template string.
|
|
2340
|
+
* Variable names are automatically inferred from the template `{{variable}}` syntax.
|
|
2341
|
+
*
|
|
2342
|
+
* @param template - The template string with `{{variable}}` placeholders.
|
|
2343
|
+
* @param variables - An object containing the default values for the template variables.
|
|
2344
|
+
* @returns A function that takes optional extra variables and returns the processed prompt string.
|
|
2181
2345
|
*/
|
|
2182
|
-
declare
|
|
2346
|
+
declare const createPrompt: <T extends string>({ template, variables, }: PromptTemplate<T>) => PromptCreator<T>;
|
|
2183
2347
|
|
|
2184
2348
|
/**
|
|
2185
2349
|
* Node types for agents, tools, and other components
|
|
@@ -2209,26 +2373,69 @@ declare const createNodeId: (type: NodeType, name: string, ownerId?: string) =>
|
|
|
2209
2373
|
declare const getNodeTypeFromNodeId: (nodeId: string) => NodeType | null;
|
|
2210
2374
|
|
|
2211
2375
|
/**
|
|
2212
|
-
*
|
|
2376
|
+
* Tool call interface
|
|
2213
2377
|
*/
|
|
2378
|
+
interface ToolCall {
|
|
2379
|
+
id: string;
|
|
2380
|
+
type: "function";
|
|
2381
|
+
function: {
|
|
2382
|
+
name: string;
|
|
2383
|
+
arguments: string;
|
|
2384
|
+
};
|
|
2385
|
+
}
|
|
2214
2386
|
/**
|
|
2215
|
-
*
|
|
2387
|
+
* Converts a Zod-like schema to a JSON representation usable in the UI
|
|
2388
|
+
* @param schema Any Zod schema object
|
|
2389
|
+
* @returns A JSON Schema compatible representation of the Zod schema
|
|
2216
2390
|
*/
|
|
2217
|
-
|
|
2391
|
+
declare function zodSchemaToJsonUI(schema: any): any;
|
|
2392
|
+
|
|
2393
|
+
type UpdateOptions = {
|
|
2394
|
+
filter?: string;
|
|
2395
|
+
};
|
|
2218
2396
|
/**
|
|
2219
|
-
*
|
|
2397
|
+
* Package update info with semver details
|
|
2220
2398
|
*/
|
|
2221
|
-
type
|
|
2222
|
-
|
|
2223
|
-
|
|
2399
|
+
type PackageUpdateInfo = {
|
|
2400
|
+
name: string;
|
|
2401
|
+
installed: string;
|
|
2402
|
+
latest: string;
|
|
2403
|
+
type: "major" | "minor" | "patch" | "latest";
|
|
2404
|
+
packageJson: string;
|
|
2224
2405
|
};
|
|
2225
2406
|
/**
|
|
2226
|
-
*
|
|
2227
|
-
*
|
|
2228
|
-
* @param options - Template configuration with default variables
|
|
2229
|
-
* @returns Function that generates the prompt with provided variables
|
|
2407
|
+
* Checks for dependency updates using npm-check-updates
|
|
2408
|
+
* @returns Object containing update information
|
|
2230
2409
|
*/
|
|
2231
|
-
declare const
|
|
2410
|
+
declare const checkForUpdates: (packagePath?: string, options?: UpdateOptions) => Promise<{
|
|
2411
|
+
hasUpdates: boolean;
|
|
2412
|
+
updates: PackageUpdateInfo[];
|
|
2413
|
+
count: number;
|
|
2414
|
+
message: string;
|
|
2415
|
+
}>;
|
|
2416
|
+
/**
|
|
2417
|
+
* Update all packages that have available updates using npm-check-updates
|
|
2418
|
+
* @param packagePath Optional path to package.json, uses current directory if not provided
|
|
2419
|
+
* @returns Result of the update operation
|
|
2420
|
+
*/
|
|
2421
|
+
declare const updateAllPackages: (packagePath?: string) => Promise<{
|
|
2422
|
+
success: boolean;
|
|
2423
|
+
message: string;
|
|
2424
|
+
updatedPackages?: string[];
|
|
2425
|
+
}>;
|
|
2426
|
+
/**
|
|
2427
|
+
* Update a single package to its latest version using npm-check-updates
|
|
2428
|
+
* @param packageName Name of the package to update
|
|
2429
|
+
* @param packagePath Optional path to package.json, uses current directory if not provided
|
|
2430
|
+
* @returns Result of the update operation
|
|
2431
|
+
*/
|
|
2432
|
+
declare const updateSinglePackage: (packageName: string, packagePath?: string) => Promise<{
|
|
2433
|
+
success: boolean;
|
|
2434
|
+
message: string;
|
|
2435
|
+
packageName: string;
|
|
2436
|
+
}>;
|
|
2437
|
+
|
|
2438
|
+
declare function serializeValueForDebug(value: unknown): unknown;
|
|
2232
2439
|
|
|
2233
2440
|
/**
|
|
2234
2441
|
* Creates an AgentTool from a retriever, allowing it to be used as a tool in an agent.
|
|
@@ -2682,51 +2889,6 @@ declare class AgentRegistry {
|
|
|
2682
2889
|
isRegistryInitialized(): boolean;
|
|
2683
2890
|
}
|
|
2684
2891
|
|
|
2685
|
-
type UpdateOptions = {
|
|
2686
|
-
filter?: string;
|
|
2687
|
-
};
|
|
2688
|
-
/**
|
|
2689
|
-
* Package update info with semver details
|
|
2690
|
-
*/
|
|
2691
|
-
type PackageUpdateInfo = {
|
|
2692
|
-
name: string;
|
|
2693
|
-
installed: string;
|
|
2694
|
-
latest: string;
|
|
2695
|
-
type: "major" | "minor" | "patch" | "latest";
|
|
2696
|
-
packageJson: string;
|
|
2697
|
-
};
|
|
2698
|
-
/**
|
|
2699
|
-
* Checks for dependency updates using npm-check-updates
|
|
2700
|
-
* @returns Object containing update information
|
|
2701
|
-
*/
|
|
2702
|
-
declare const checkForUpdates: (packagePath?: string, options?: UpdateOptions) => Promise<{
|
|
2703
|
-
hasUpdates: boolean;
|
|
2704
|
-
updates: PackageUpdateInfo[];
|
|
2705
|
-
count: number;
|
|
2706
|
-
message: string;
|
|
2707
|
-
}>;
|
|
2708
|
-
/**
|
|
2709
|
-
* Update all packages that have available updates using npm-check-updates
|
|
2710
|
-
* @param packagePath Optional path to package.json, uses current directory if not provided
|
|
2711
|
-
* @returns Result of the update operation
|
|
2712
|
-
*/
|
|
2713
|
-
declare const updateAllPackages: (packagePath?: string) => Promise<{
|
|
2714
|
-
success: boolean;
|
|
2715
|
-
message: string;
|
|
2716
|
-
updatedPackages?: string[];
|
|
2717
|
-
}>;
|
|
2718
|
-
/**
|
|
2719
|
-
* Update a single package to its latest version using npm-check-updates
|
|
2720
|
-
* @param packageName Name of the package to update
|
|
2721
|
-
* @param packagePath Optional path to package.json, uses current directory if not provided
|
|
2722
|
-
* @returns Result of the update operation
|
|
2723
|
-
*/
|
|
2724
|
-
declare const updateSinglePackage: (packageName: string, packagePath?: string) => Promise<{
|
|
2725
|
-
success: boolean;
|
|
2726
|
-
message: string;
|
|
2727
|
-
packageName: string;
|
|
2728
|
-
}>;
|
|
2729
|
-
|
|
2730
2892
|
type VoltAgentOptions = {
|
|
2731
2893
|
agents: Record<string, Agent<any>>;
|
|
2732
2894
|
port?: number;
|
|
@@ -2755,7 +2917,7 @@ declare class VoltAgent {
|
|
|
2755
2917
|
/**
|
|
2756
2918
|
* Start the server
|
|
2757
2919
|
*/
|
|
2758
|
-
startServer(
|
|
2920
|
+
startServer(): Promise<void>;
|
|
2759
2921
|
/**
|
|
2760
2922
|
* Get all registered agents
|
|
2761
2923
|
*/
|
|
@@ -2770,4 +2932,4 @@ declare class VoltAgent {
|
|
|
2770
2932
|
getAgentCount(): number;
|
|
2771
2933
|
}
|
|
2772
2934
|
|
|
2773
|
-
export { Agent, AgentHooks, AgentOptions, AgentRegistry, AgentResponse, AgentTool, AnyToolConfig, BaseLLMOptions, BaseMessage, BaseRetriever, BaseTool, BaseToolCall, ClientInfo, Conversation, CreateConversationInput, CreateReasoningToolsOptions, DEFAULT_INSTRUCTIONS, DataContent, FEW_SHOT_EXAMPLES, FilePart, GenerateObjectOptions, GenerateTextOptions, HTTPServerConfig, ImagePart, InMemoryStorage, InferGenerateObjectResponse, InferGenerateTextResponse, InferMessage, InferModel, InferProviderParams, InferStreamResponse, InferTool, LLMProvider, LibSQLStorage, MCPClient, MCPClientConfig, MCPClientEvents, MCPConfiguration, MCPOptions, MCPServerConfig, MCPToolCall, MCPToolResult, Memory, MemoryManager, MemoryMessage, MemoryOptions, MessageContent, MessageFilterOptions, MessageRole, ModelToolCall, NextAction, NodeType, PackageUpdateInfo,
|
|
2935
|
+
export { Agent, AgentHistoryEntry, AgentHookOnEnd, AgentHookOnHandoff, AgentHookOnStart, AgentHookOnToolEnd, AgentHookOnToolStart, AgentHooks, AgentOptions, AgentRegistry, AgentResponse, AgentTool, AllowedVariableValue, AnyToolConfig, BaseLLMOptions, BaseMessage, BaseRetriever, BaseTool, BaseToolCall, ClientInfo, Conversation, CreateConversationInput, CreateReasoningToolsOptions, DEFAULT_INSTRUCTIONS, DataContent, ExtractVariableNames, FEW_SHOT_EXAMPLES, FilePart, GenerateObjectOptions, GenerateTextOptions, HTTPServerConfig, ImagePart, InMemoryStorage, InferGenerateObjectResponse, InferGenerateTextResponse, InferMessage, InferModel, InferProviderParams, InferStreamResponse, InferTool, LLMProvider, LibSQLStorage, MCPClient, MCPClientConfig, MCPClientEvents, MCPConfiguration, MCPOptions, MCPServerConfig, MCPToolCall, MCPToolResult, Memory, MemoryManager, MemoryMessage, MemoryOptions, MessageContent, MessageFilterOptions, MessageRole, ModelToolCall, NextAction, NodeType, OnEndHookArgs, OnHandoffHookArgs, OnStartHookArgs, OnToolEndHookArgs, OnToolStartHookArgs, OperationContext, PackageUpdateInfo, PromptCreator, PromptTemplate, ProviderObjectResponse, ProviderObjectStreamResponse, ProviderParams, ProviderResponse, ProviderTextResponse, ProviderTextStreamResponse, ReadableStreamType, ReasoningStep, ReasoningStepSchema, ReasoningToolExecuteOptions, Retriever, RetrieverOptions, RetryConfig, StdioServerConfig, StepChunkCallback, StepFinishCallback, StepWithContent, StreamObjectFinishResult, StreamObjectOnFinishCallback, StreamObjectOptions, StreamTextFinishResult, StreamTextOnFinishCallback, StreamTextOptions, TemplateVariables, TextPart, Tool, ToolCall, ToolErrorInfo, ToolExecuteOptions, ToolExecutionContext, ToolManager, ToolOptions, ToolSchema, ToolStatus, ToolStatusInfo, Toolkit, ToolsetMap, ToolsetWithTools, TransportError, UsageInfo, Voice, VoiceEventData, VoiceEventType, VoiceMetadata, VoiceOptions, VoltAgent, VoltAgentError, checkForUpdates, createHooks, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createTool, VoltAgent as default, getNodeTypeFromNodeId, serializeValueForDebug, tool, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
|