/** * Action Validator * * Validates tool/function calls before execution. * Ensures agents only perform allowed actions with valid parameters. */ import type { ActionDefinition, GuardrailResult, InterceptedToolCall, Violation, ViolationSeverity } from './types'; /** * Action validation result */ export interface ActionValidationResult { valid: boolean; violations: Violation[]; sanitizedArguments?: Record; requiresApproval?: boolean; } /** * Action validator configuration */ export interface ActionValidatorConfig { /** Allowed actions with their definitions */ allowedActions?: ActionDefinition[]; /** Default behavior for undefined actions */ defaultAllow?: boolean; /** Default risk level for undefined actions */ defaultRiskLevel?: ViolationSeverity; /** Block high-risk actions automatically */ blockHighRisk?: boolean; /** Custom validation function */ customValidator?: (toolCall: InterceptedToolCall) => Promise; } /** * Action Validator * * Validates tool/function calls against defined policies. */ export declare class ActionValidator { private config; private actionMap; private callHistory; private callCounts; constructor(config?: ActionValidatorConfig); /** * Validate a tool/function call */ validate(toolCall: InterceptedToolCall): Promise; /** * Create a guardrail function from this validator */ asGuardrail(): (content: string, context?: Record) => Promise; /** * Register an allowed action */ registerAction(action: ActionDefinition): void; /** * Remove an action from allowed list */ unregisterAction(name: string): void; /** * Get all registered actions */ getRegisteredActions(): ActionDefinition[]; /** * Get call history */ getCallHistory(): InterceptedToolCall[]; /** * Clear call history */ clearHistory(): void; /** * Check rate limit for an action */ private checkRateLimit; /** * Validate parameters against definitions */ private validateParameters; /** * Check if value matches expected type */ private checkType; /** * Run validation rules on a parameter value */ private runValidation; } /** * Create a pre-configured action validator with common dangerous actions blocked */ export declare function createDefaultActionValidator(): ActionValidator; //# sourceMappingURL=action-validator.d.ts.map