/**
 * Sub-agent orchestration for workflows.
 *
 * Spawns independent agent sessions with isolated context for workflow phases.
 * The sub-agent receives ONLY:
 *   - Phase instructions (from workflow definition)
 *   - Artifacts/context passed explicitly
 *   - AGENTS.md from the working directory (for project knowledge)
 *
 * It does NOT receive the parent session's conversation history.
 * This ensures unbiased, independent execution.
 */
import type { Phase, WorkflowArtifact } from "./types.js";
export interface SubAgentRequest {
    /** Unique id for tracking */
    id: string;
    /** The workflow phase to execute */
    phase: Phase;
    /** Working directory (same as parent session) */
    cwd: string;
    /** The prompt sent to the sub-agent (phase instructions + context) */
    prompt: string;
    /** Parent session ID (for artifact namespacing) */
    parentSessionId: string;
    /** Path to the agent CLI (optional, auto-resolved if omitted) */
    agentCliPath?: string;
    /** Timeout in ms (default: 10 minutes) */
    timeoutMs?: number;
}
export interface SubAgentResult {
    id: string;
    phaseId: string;
    status: "completed" | "failed" | "timeout";
    /** Full conversation from the sub-agent (for debugging / report) */
    conversation: string;
    /** Artifacts collected (if the sub-agent used the workflow tool) */
    artifacts: WorkflowArtifact[];
    /** Duration in ms */
    durationMs: number;
    /** Error message if failed */
    error?: string;
}
/**
 * Run a single phase in an independent sub-agent.
 *
 * Spawns a new agent process, sends the phase prompt, waits for completion
 * (agent_end event), and collects the conversation output.
 */
export declare function runSubAgent(request: SubAgentRequest): Promise<SubAgentResult>;
/**
 * Run multiple phases in parallel as independent sub-agents.
 * Returns results in the same order as the input requests.
 */
export declare function runSubAgentsParallel(requests: SubAgentRequest[]): Promise<SubAgentResult[]>;
/**
 * Build a sub-agent request for a workflow phase.
 */
export declare function createSubAgentRequest(phase: Phase, context: Record<string, string>, parentSessionId: string, cwd: string, agentCliPath?: string, timeoutMs?: number): SubAgentRequest;
//# sourceMappingURL=sub-agent.d.ts.map