Package:
@hexos/runtimeRuntime dependencies injected into LLM provider streaming functions.
Contains all necessary runtime operations that providers delegate to the parent AgentRuntime, including infrastructure retry logic, approval flows, tool execution guards, and context building. This interface decouples provider implementations from runtime internals.
All methods are synchronous or async as needed. Approval flow methods (requiresApproval, waitForApproval) enable human-in-the-loop patterns.
interface ProviderDependencies {
hooks?: ProviderHooks;
withInfrastructureRetry<T>(operation: () => Promise<T>): Promise<T>;
buildToolContext(input: RuntimeInput, agentId: string): ToolContext;
requiresApproval(toolDef: ToolDefinition, toolContext: ToolContext): boolean;
waitForApproval(
conversationId: string,
toolCallId: string,
toolName: string,
toolDef: ToolDefinition,
args: unknown,
agentId: string
): Promise<ProviderApprovalDecision>;
executeToolWithGuards(
toolDef: ToolDefinition,
toolInput: unknown,
toolContext: ToolContext
): Promise<unknown>;
getErrorInfo(error: unknown, fallbackCode?: string): ProviderErrorInfo;
}hooks
withInfrastructureRetry
(operation: () => Promise) => Promise buildToolContext
(input: RuntimeInput, agentId: string) => ToolContextrequiresApproval
(toolDef: ToolDefinition, toolContext: ToolContext) => booleanwaitForApproval
(conversationId: string, toolCallId: string, toolName: string, toolDef: ToolDefinition, args: unknown, agentId: string) => Promise<ProviderApprovalDecision>executeToolWithGuards
(toolDef: ToolDefinition, toolInput: unknown, toolContext: ToolContext) => PromisegetErrorInfo
(error: unknown, fallbackCode?: string) => ProviderErrorInfo