/** * Approval request for any tool operation */ export interface ApprovalRequest { toolName: string; description?: string; params: Record; } /** * Generic approval callback - simple and scalable * Returns true if approved, false if rejected or user declines */ export type ApprovalCallback = (request: ApprovalRequest) => Promise; /** * Generic, simple approval handler for all tools * * Design: Single, scalable approval flow for any number of tools * - Tools declare requires_approval in YAML OR contain destructive keywords * - Check MATIMO_AUTO_APPROVE env var (approve all) * - Check MATIMO_APPROVED_PATTERNS env var (pre-approved patterns) * - If not pre-approved, invoke single generic callback * - No per-provider validators or custom logic needed */ export declare class ApprovalHandler { private autoApprove; private approvedPatterns; private approvalCallback; private destructiveKeywords; constructor(); /** * Load destructive keywords from YAML configuration file * Searches for destructive-keywords.yaml in: * 1. packages/core/ (development/workspace) * 2. node_modules/@matimo/core/ (installed package) * 3. Relative to current working directory */ private loadDestructiveKeywords; /** * Set default destructive keywords */ private useDefaultKeywords; /** * Set approval callback for interactive/custom approval */ setApprovalCallback(callback: ApprovalCallback | null): void; /** * Get the current approval callback (for save/restore patterns) */ getApprovalCallback(): ApprovalCallback | null; /** * Check if a tool requires approval based on YAML definition or supplied content. * @param requiresApproval In Yaml - From tool definition `requires_approval` field * @param content - Optional content (SQL, shell command, etc.) to check for destructive keywords * * Notes: * - We now accept any textual content so keyword detection also applies to command/shell and sql * based tools (e.g. `params.command`). */ requiresApproval(requiresApprovalInYaml: boolean | undefined, content?: string): boolean; /** * Check if operation is pre-approved via env vars */ isPreApproved(toolName: string): boolean; /** * Request approval for an operation * Throws if not approved and no callback available */ requestApproval(request: ApprovalRequest): Promise; /** * Simple pattern matching (supports wildcards) */ private matchesPattern; } /** * Get or create global approval handler */ export declare function getGlobalApprovalHandler(): ApprovalHandler; //# sourceMappingURL=approval-handler.d.ts.map