import { AgentExecutor, AgentFinish, AgentStep } from 'langchain/agents';
import { FormSubmission } from '../forms/types';
import { ToolInterface } from '@langchain/core/tools';
import { ChainValues } from '@langchain/core/utils/types';
import { CallbackManagerForChainRun } from '@langchain/core/callbacks/manager';
import { RunnableConfig } from '@langchain/core/runnables';

interface ToolWithOriginal {
    originalTool?: {
        call?: (args: Record<string, unknown>) => Promise<string>;
    };
}
interface PendingFormData {
    toolName: string;
    originalInput: unknown;
    originalToolInput?: unknown;
    schema: unknown;
    toolRef?: ToolInterface | undefined;
    originalToolRef?: ToolWithOriginal['originalTool'];
}
/**
 * Parameter preprocessing callback interface
 */
export interface ParameterPreprocessingCallback {
    (toolName: string, parameters: Record<string, unknown>): Promise<Record<string, unknown>>;
}
/**
 * Agent executor that intercepts Zod validation errors and generates forms,
 * and processes HashLink block responses for rich UI rendering
 */
export declare class FormAwareAgentExecutor extends AgentExecutor {
    private formGenerator;
    private formEngine;
    private formLogger;
    private pendingForms;
    private parameterPreprocessingCallback;
    /**
     * Type guard to check if a Zod type is a ZodObject
     */
    private isZodObject;
    /**
     * Type guard to check if metadata has hashLinkBlock
     */
    private hasHashLinkBlock;
    constructor(...args: ConstructorParameters<typeof AgentExecutor>);
    /**
     * Set parameter preprocessing callback
     */
    setParameterPreprocessingCallback(callback: ParameterPreprocessingCallback | undefined): void;
    /**
     * BULLETPROOF TOOL INTERCEPTION
     * Override the single-step execution to intercept tool calls BEFORE LangChain processes them
     */
    _takeNextStep(nameToolMap: Record<string, ToolInterface>, inputs: ChainValues, intermediateSteps: AgentStep[], runManager?: CallbackManagerForChainRun, config?: RunnableConfig): Promise<AgentFinish | AgentStep[]>;
    /**
     * Helper to determine if a field is required in the schema
     */
    private isFieldRequired;
    /**
     * Override _call to intercept Zod validation errors at the execution level
     */
    _call(inputs: Record<string, unknown>): Promise<Record<string, unknown>>;
    /**
     * Handles Zod validation errors by generating forms
     */
    private handleValidationError;
    /**
     * Get a copy of pending forms for preservation during executor recreation
     */
    getPendingForms(): Map<string, PendingFormData>;
    /**
     * Restore pending forms from a previous executor instance
     */
    restorePendingForms(forms: Map<string, PendingFormData>): void;
    /**
     * Processes form submission and continues tool execution
     */
    processFormSubmission(submission: FormSubmission): Promise<Record<string, unknown>>;
    /**
     * Extracts tool information from the execution context
     */
    private extractToolInfoFromError;
    /**
     * Attempts to find tool from execution context
     */
    private findToolFromContext;
    /**
     * Additional fallback to detect tool from error context
     */
    private detectToolFromErrorContext;
    /**
     * Checks if a schema structure matches error paths
     */
    private schemaMatchesErrorPaths;
    /**
     * Extracts keywords from tool name for matching
     */
    private extractToolKeywords;
    /**
     * Formats the form message for display
     */
    private formatFormResponse;
    /**
     * Check if there are pending forms
     */
    hasPendingForms(): boolean;
    /**
     * Get information about pending forms
     */
    getPendingFormsInfo(): Array<{
        formId: string;
        toolName: string;
    }>;
    /**
     * Processes HashLink block responses from tools
     */
    private processHashLinkResponse;
    /**
     * Get FormEngine statistics for debugging
     */
    getFormEngineStatistics(): {
        strategies: string[];
        middleware: string[];
    };
}
export {};
