UNPKG

erosolar-cli

Version:

Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning

117 lines 3.05 kB
/** * Comprehensive Tool Validation System * * Provides proactive validation for AI tool usage with: * - Pre-flight validation before tool execution * - Real-time AI flow guidance * - Pattern-based anti-pattern detection * - Recovery suggestions for common failures */ import type { ToolDefinition } from './toolRuntime.js'; /** * Tool validation result */ export interface ToolValidationResult { readonly valid: boolean; readonly warnings: ToolValidationWarning[]; readonly suggestions: ToolValidationSuggestion[]; readonly criticalErrors: ToolValidationError[]; } /** * Tool validation warning */ export interface ToolValidationWarning { readonly code: string; readonly message: string; readonly severity: 'low' | 'medium' | 'high'; readonly suggestion?: string; } /** * Tool validation error */ export interface ToolValidationError { readonly code: string; readonly message: string; readonly recovery?: string; } /** * Tool validation suggestion */ export interface ToolValidationSuggestion { readonly code: string; readonly message: string; readonly action: string; } /** * AI flow guidance patterns */ export interface AIFlowPattern { readonly pattern: string; readonly description: string; readonly guidance: string; readonly examples: string[]; } /** * Tool usage context */ export interface ToolUsageContext { readonly toolName: string; readonly parameters: Record<string, unknown>; readonly workspaceContext?: { readonly currentFiles: string[]; readonly recentOperations: string[]; readonly workspacePath: string; }; } /** * Comprehensive tool validator */ export declare class ToolValidator { private readonly patterns; /** * Validate tool usage before execution */ validateToolUsage(tool: ToolDefinition, context: ToolUsageContext): ToolValidationResult; /** * Validate tool-specific patterns */ private validateToolSpecific; /** * Validate Edit tool usage */ private validateEditTool; /** * Validate search tools (Glob, Grep) */ private validateSearchTools; /** * Validate bash commands */ private validateBashCommands; /** * Validate AI flow patterns */ private validateAIFlowPatterns; /** * Validate performance optimizations */ private validatePerformance; private containsPlaceholderPattern; private isLongSingleLine; private hasIndentationMismatch; private detectIndentation; private isOverlyBroadPattern; private isBroadPattern; private containsRedundantGitOperations; private isIncompleteNpmPublish; /** * Get AI flow guidance for a specific pattern */ getAIFlowGuidance(patternId: string): AIFlowPattern | undefined; /** * Get all AI flow patterns */ getAllAIFlowPatterns(): AIFlowPattern[]; } export declare const globalToolValidator: ToolValidator; //# sourceMappingURL=toolValidation.d.ts.map