import type { Logger } from '@polka-codes/core';
import type { CliToolRegistry } from '../workflow-tools';
import type { AgentState, CliWorkflowContext, Task, ToolRegistry, WorkflowExecutionResult } from './types';
/**
 * Executes tasks by invoking appropriate workflows
 *
 * Features:
 * - Timeout protection with AbortController
 * - Proper workflow cancellation on timeout
 * - Manual task cancellation support
 */
export declare class TaskExecutor<TTools extends ToolRegistry = CliToolRegistry> {
    #private;
    constructor(context: CliWorkflowContext<TTools>, logger: Logger, defaultTimeoutMs?: number);
    /**
     * Execute a task with timeout protection
     *
     * Uses AbortController to properly cancel the workflow if timeout occurs
     */
    execute(task: Task, _state: AgentState, timeoutMs?: number): Promise<WorkflowExecutionResult>;
    /**
     * Execute task with timeout wrapper and proper cancellation
     *
     * This implementation uses AbortController to properly cancel the workflow
     * when a timeout occurs or manual cancellation is requested.
     */
    private executeTaskInternal;
    /**
     * Invoke workflow for task with AbortSignal
     *
     * The AbortSignal is passed to the workflow adapter, which propagates
     * it through the workflow execution chain for proper cancellation support.
     */
    private invokeWorkflow;
    /**
     * Cancel running task
     *
     * Aborts the task's workflow and clears its timeout
     */
    cancel(taskId: string): boolean;
    /**
     * Cancel all tasks
     *
     * Aborts all running workflows and clears all timeouts
     */
    cancelAll(): void;
    /**
     * Check if a task is currently running
     */
    isRunning(taskId: string): boolean;
    /**
     * Get number of currently running tasks
     */
    getRunningCount(): number;
}
//# sourceMappingURL=executor.d.ts.map