/**
 * Solo Mode Evaluator — parallel N-agent PK with user-triggered evaluation.
 *
 * Flow:
 *   1. solo.start → create N isolated git worktrees, spawn N agents in parallel
 *   2. Each agent receives the same task prompt in its own worktree
 *      (all agents share initial config: memory/rules from project .qlogicagent/)
 *   3. On completion of initial task, agents enter "idle" state (process kept alive)
 *   4. User can send follow-up messages to individual agents via solo.message
 *   5. User triggers evaluation via solo.evaluate (or skips directly to solo.select)
 *   6. solo.select → merge winning worktree, clean up others
 *
 * Key design:
 *   - Solo = special project type (persisted in .qlogicagent/solos/)
 *   - Agents share the same initial config but operate in isolated worktrees
 *   - User controls the evaluation timing (not automatic)
 *   - Follow-up instructions to individual agents supported
 *
 * Degradation: if K agents fail but ≥1 succeeds, session remains interactive.
 */
import type { AgentProcessManager } from "../runtime/infra/agent-process.js";
import type { AcpDetector } from "../runtime/infra/acp-detector.js";
import type { AgentConfigStore } from "../runtime/infra/agent-config-store.js";
import type { SoloState, SoloAgentState, SoloEvaluation, SoloStatus, SoloStartParams, SoloSelectParams, SoloSpec } from "../protocol/wire/acp-agent-management.js";
export interface SoloCallbacks {
    log?: {
        info(msg: string): void;
        warn(msg: string): void;
        debug?(msg: string): void;
    };
    onProgress?: (soloId: string, agentId: string, state: SoloAgentState, progress?: string) => void;
    onEvaluation?: (soloId: string, evaluation: SoloEvaluation) => void;
    /** Streaming text delta from a competing agent (forwarded from child process). */
    onAgentDelta?: (soloId: string, agentId: string, text: string) => void;
    /** File diff produced by a completed agent. */
    onAgentDiff?: (soloId: string, agentId: string, files: {
        path: string;
        hunks: string;
    }[]) => void;
    /** Token usage report after agent completes. */
    onAgentUsage?: (soloId: string, agentId: string, inputTokens: number, outputTokens: number) => void;
    /**
     * Race reached a terminal state WITHOUT an evaluation winner (all agents failed, or cancelled).
     * The success path uses onEvaluation; this lets the host write back the plan project's planStatus
     * (failed/cancelled) so 历史方案 is correct and recovery doesn't restore a dead run.
     */
    onTerminal?: (soloId: string, state: SoloState) => void;
}
/**
 * Assemble the prompt every competitor receives (Cut4). Shared context (rules/memory) + optional
 * <spec> block, then the body. Body = spec.rawTask when a Spec was built (the task captured during
 * specBuild), else the raw task. With neither sharedConfig nor spec the result is exactly `task`
 * (regression-safe vs the pre-Spec path).
 */
export declare function buildEnrichedTask(task: string, sharedConfig: {
    memory?: string[];
    rules?: string[];
    model?: string;
} | undefined, spec: SoloSpec | undefined): string;
/**
 * Build the judge prompt (Cut4). When the Spec defines acceptance criteria, the judge scores
 * per-criterion (满足/部分/不满足) instead of a subjective compare. The WINNER:/REASONING: output
 * markers are unchanged so parseEvaluationResponse still works — only the basis of REASONING upgrades.
 */
export declare function buildEvaluationPrompt(originalTask: string, spec: SoloSpec | undefined, succeeded: ReadonlyArray<{
    displayId: string;
    resultText?: string;
    diff?: string;
}>): string;
export declare class SoloEvaluator {
    private processManager;
    private acpDetector;
    private configStore;
    private callbacks;
    private sessions;
    constructor(processManager: AgentProcessManager, acpDetector: AcpDetector, configStore: AgentConfigStore | null, callbacks?: SoloCallbacks);
    /** Persist current session data to disk (fire-and-forget). */
    private persistSession;
    /** Restore sessions from disk (call once at startup). */
    restoreFromDisk(cwd?: string): Promise<number>;
    /** Delete a solo session from memory and disk. */
    deleteSolo(soloId: string): Promise<boolean>;
    /**
     * Start a Solo Mode PK session.
     * Creates worktrees, spawns agents in parallel, waits for completion, then evaluates.
     */
    start(params: SoloStartParams): Promise<string>;
    /**
     * Send a follow-up message to a specific agent within a solo session.
     * Agent must be in "idle" or "completed" state.
     */
    message(soloId: string, agentId: string, content: string, agentIndex?: number): Promise<{
        resultText: string;
    }>;
    /**
     * User-triggered evaluation — compare all completed/idle agents' results.
     * The user chooses which agent in the session performs the evaluation comparison.
     */
    triggerEvaluation(soloId: string, evaluatorAgentId: string, evaluatorIndex?: number): Promise<SoloEvaluation>;
    /** Map a spawned member back to its solo run + UI column id (for live delta forwarding). */
    getMemberContext(memberId: string): {
        soloId: string;
        displayId: string;
    } | null;
    /** Get the current status of a solo session. */
    getStatus(soloId: string): SoloStatus | null;
    /** Cancel a running solo session. Kill all agents and clean up worktrees. */
    cancel(soloId: string): Promise<void>;
    /**
     * Select a winner and merge their worktree into the main branch.
     */
    select(params: SoloSelectParams): Promise<string>;
    /** List all solo sessions. */
    listSessions(): SoloStatus[];
    /** Delete a solo session, killing agents and cleaning up worktrees if still active. */
    delete(soloId: string): Promise<void>;
    /**
     * Build an evaluation prompt and send to the user-chosen evaluator agent.
     * Returns evaluation result.
     */
    private evaluate;
    private parseEvaluationResponse;
    private cleanupWorktrees;
}
