import { spawn as defaultSpawn } from "../../../agent-spawn/dist/index.js";
import type { Task } from "../../../task-list/dist/index.js";
import type { ResolvedConfig } from "../config/schema.js";
import type { AttemptPhase, FailureCategory } from "../runtime/phases.js";
export interface AttemptOutcome {
    reason: "normal" | "abnormal" | "skip";
    skipReason?: "terminal_state" | "unconfigured_state";
    failure?: FailureCategory;
    failedStep?: string;
    error?: string;
}
export type AttemptReconcileResult = "continue" | "canceled";
export type AttemptEvent = {
    type: "attempt_phase";
    task_id: string;
    from: AttemptPhase | null;
    to: AttemptPhase;
    step?: string;
    failure?: FailureCategory;
} | {
    type: "agent_event";
    task_id: string;
    step: string;
    session_id: string;
    event: string;
    payload?: unknown;
} | {
    type: "unconfigured_state";
    task_id: string;
    state: string;
};
export interface AttemptDeps {
    spawn?: typeof defaultSpawn;
    taskPromptTemplate?: string;
    refreshTask?: (qualifiedId: string) => Promise<Task>;
    reconcile?: (ctx: {
        task: Task;
        attempt: number | null;
        cfg: ResolvedConfig;
    }) => Promise<AttemptReconcileResult>;
    onEvent?: (event: AttemptEvent) => void;
    logger?: {
        warn(message: string, meta?: Record<string, unknown>): void;
    };
}
export declare function runAttempt(args: {
    task: Task;
    attempt: number | null;
    cfg: ResolvedConfig;
    workspaceDir?: string;
    planPath?: string | null;
    deps: AttemptDeps;
    abort: AbortSignal;
}): Promise<AttemptOutcome>;
