/**
 * Subagent Executor
 *
 * Handles execution of subagent tasks with isolated context and tool filtering.
 * Supports concurrent execution via unique agentId for progress isolation.
 */
import type { ToolManager } from '../tools/tool-manager.js';
import type { DevelopmentMode, LLMClient } from '../types/core.js';
import type { SubagentResult, SubagentTask } from './types.js';
/** Maximum number of concurrent subagents */
export declare const MAX_CONCURRENT_AGENTS = 5;
/**
 * SubagentExecutor manages the execution of delegated tasks to subagents.
 * Each subagent runs in an isolated context with filtered tools.
 */
export declare class SubagentExecutor {
    private toolManager;
    private parentClient;
    private projectRoot;
    private parentMode;
    /**
     * Live source for the current development mode, read on every tool-approval
     * check. When set (the interactive app wires it to the same ref the main
     * loop uses), it takes precedence over the static `parentMode` so the
     * subagent honors the mode at spawn time AND a switch made while it is mid
     * execution (e.g. flipping to yolo). Falls back to `parentMode` for callers
     * that don't supply a resolver (plain shell, tests).
     */
    private modeResolver?;
    constructor(toolManager: ToolManager, parentClient: LLMClient, projectRoot?: string, parentMode?: DevelopmentMode);
    /**
     * Update the parent development mode (called when mode changes).
     */
    setParentMode(mode: DevelopmentMode): void;
    /**
     * Provide a live getter for the current development mode. Read per tool
     * call, so mode changes take effect immediately - including while a
     * subagent is already running.
     */
    setModeResolver(resolver: () => DevelopmentMode): void;
    /** The mode in effect right now: live resolver if set, else the snapshot. */
    private currentMode;
    /**
     * Execute a subagent task.
     *
     * @param task - The task to execute
     * @param signal - Optional abort signal for cancellation
     * @param depth - Recursion depth (prevents infinite delegation)
     * @param agentId - Optional unique ID for concurrent progress tracking.
     *                  When provided, progress is written to the agent-specific
     *                  slot in the progress map instead of the global singleton.
     */
    execute(task: SubagentTask, signal?: AbortSignal, depth?: number, agentId?: string): Promise<SubagentResult>;
    private createSubagentContext;
    private buildTaskPrompt;
    private getAvailableToolNames;
    /**
     * Filter tools based on subagent configuration.
     * Only includes tools in the allow list (or all if no list specified),
     * minus any in the disallow list, and always excludes the agent tool.
     */
    private filterTools;
    /**
     * Prepare the LLM client for subagent execution.
     *
     * If the agent specifies a `provider`, creates a brand-new client for that
     * provider/model combination. This lets subagents use a completely different
     * backend (e.g. local Ollama for research, cloud API for the main agent).
     *
     * If no provider is set, reuses the parent client (switching model if needed).
     *
     * @param concurrent - When true, creates a new client instead of mutating
     *                     the parent client's model (safe for parallel execution).
     */
    private prepareClient;
    /**
     * Run the subagent conversation loop.
     *
     * @param agentId - When provided, writes progress to the agent-specific
     *                  slot instead of the global singleton.
     */
    private runSubagentConversation;
    /**
     * Check if a tool needs user approval.
     * Uses the same logic as the main conversation loop.
     */
    private needsApprovalForTool;
    /**
     * Execute a single tool call with permission enforcement, approval, and argument parsing.
     */
    private executeToolCall;
}
//# sourceMappingURL=subagent-executor.d.ts.map