import { z } from "zod";
import type { Logger } from "pino";
import type { AgentManager } from "./agent/agent-manager.js";
import type { AgentProvider } from "./agent/agent-sdk-types.js";
declare const LoopLogEntrySchema: z.ZodObject<{
    seq: z.ZodNumber;
    timestamp: z.ZodString;
    iteration: z.ZodNullable<z.ZodNumber>;
    source: z.ZodEnum<["loop", "worker", "verifier", "verify-check"]>;
    level: z.ZodEnum<["info", "error"]>;
    text: z.ZodString;
}, "strip", z.ZodTypeAny, {
    text: string;
    seq: number;
    timestamp: string;
    iteration: number | null;
    source: "loop" | "worker" | "verifier" | "verify-check";
    level: "error" | "info";
}, {
    text: string;
    seq: number;
    timestamp: string;
    iteration: number | null;
    source: "loop" | "worker" | "verifier" | "verify-check";
    level: "error" | "info";
}>;
declare const LoopVerifyCheckResultSchema: z.ZodObject<{
    command: z.ZodString;
    exitCode: z.ZodNumber;
    passed: z.ZodBoolean;
    stdout: z.ZodString;
    stderr: z.ZodString;
    startedAt: z.ZodString;
    completedAt: z.ZodString;
}, "strip", z.ZodTypeAny, {
    startedAt: string;
    command: string;
    exitCode: number;
    passed: boolean;
    stdout: string;
    stderr: string;
    completedAt: string;
}, {
    startedAt: string;
    command: string;
    exitCode: number;
    passed: boolean;
    stdout: string;
    stderr: string;
    completedAt: string;
}>;
declare const LoopVerifyPromptResultSchema: z.ZodObject<{
    passed: z.ZodBoolean;
    reason: z.ZodString;
    verifierAgentId: z.ZodNullable<z.ZodString>;
    startedAt: z.ZodString;
    completedAt: z.ZodString;
}, "strip", z.ZodTypeAny, {
    reason: string;
    startedAt: string;
    passed: boolean;
    completedAt: string;
    verifierAgentId: string | null;
}, {
    reason: string;
    startedAt: string;
    passed: boolean;
    completedAt: string;
    verifierAgentId: string | null;
}>;
declare const LoopIterationRecordSchema: z.ZodObject<{
    index: z.ZodNumber;
    workerAgentId: z.ZodNullable<z.ZodString>;
    workerStartedAt: z.ZodString;
    workerCompletedAt: z.ZodNullable<z.ZodString>;
    verifierAgentId: z.ZodNullable<z.ZodString>;
    status: z.ZodEnum<["running", "succeeded", "failed", "stopped"]>;
    workerOutcome: z.ZodNullable<z.ZodEnum<["completed", "failed", "canceled"]>>;
    failureReason: z.ZodNullable<z.ZodString>;
    verifyChecks: z.ZodArray<z.ZodObject<{
        command: z.ZodString;
        exitCode: z.ZodNumber;
        passed: z.ZodBoolean;
        stdout: z.ZodString;
        stderr: z.ZodString;
        startedAt: z.ZodString;
        completedAt: z.ZodString;
    }, "strip", z.ZodTypeAny, {
        startedAt: string;
        command: string;
        exitCode: number;
        passed: boolean;
        stdout: string;
        stderr: string;
        completedAt: string;
    }, {
        startedAt: string;
        command: string;
        exitCode: number;
        passed: boolean;
        stdout: string;
        stderr: string;
        completedAt: string;
    }>, "many">;
    verifyPrompt: z.ZodNullable<z.ZodObject<{
        passed: z.ZodBoolean;
        reason: z.ZodString;
        verifierAgentId: z.ZodNullable<z.ZodString>;
        startedAt: z.ZodString;
        completedAt: z.ZodString;
    }, "strip", z.ZodTypeAny, {
        reason: string;
        startedAt: string;
        passed: boolean;
        completedAt: string;
        verifierAgentId: string | null;
    }, {
        reason: string;
        startedAt: string;
        passed: boolean;
        completedAt: string;
        verifierAgentId: string | null;
    }>>;
}, "strip", z.ZodTypeAny, {
    status: "running" | "failed" | "succeeded" | "stopped";
    verifierAgentId: string | null;
    index: number;
    workerAgentId: string | null;
    workerStartedAt: string;
    workerCompletedAt: string | null;
    workerOutcome: "completed" | "failed" | "canceled" | null;
    failureReason: string | null;
    verifyChecks: {
        startedAt: string;
        command: string;
        exitCode: number;
        passed: boolean;
        stdout: string;
        stderr: string;
        completedAt: string;
    }[];
    verifyPrompt: {
        reason: string;
        startedAt: string;
        passed: boolean;
        completedAt: string;
        verifierAgentId: string | null;
    } | null;
}, {
    status: "running" | "failed" | "succeeded" | "stopped";
    verifierAgentId: string | null;
    index: number;
    workerAgentId: string | null;
    workerStartedAt: string;
    workerCompletedAt: string | null;
    workerOutcome: "completed" | "failed" | "canceled" | null;
    failureReason: string | null;
    verifyChecks: {
        startedAt: string;
        command: string;
        exitCode: number;
        passed: boolean;
        stdout: string;
        stderr: string;
        completedAt: string;
    }[];
    verifyPrompt: {
        reason: string;
        startedAt: string;
        passed: boolean;
        completedAt: string;
        verifierAgentId: string | null;
    } | null;
}>;
declare const LoopRecordSchema: z.ZodObject<{
    id: z.ZodString;
    name: z.ZodNullable<z.ZodString>;
    prompt: z.ZodString;
    cwd: z.ZodString;
    provider: z.ZodString;
    model: z.ZodNullable<z.ZodString>;
    workerProvider: z.ZodNullable<z.ZodString>;
    workerModel: z.ZodNullable<z.ZodString>;
    verifierProvider: z.ZodNullable<z.ZodString>;
    verifierModel: z.ZodNullable<z.ZodString>;
    verifyPrompt: z.ZodNullable<z.ZodString>;
    verifyChecks: z.ZodArray<z.ZodString, "many">;
    archive: z.ZodBoolean;
    sleepMs: z.ZodNumber;
    maxIterations: z.ZodNullable<z.ZodNumber>;
    maxTimeMs: z.ZodNullable<z.ZodNumber>;
    status: z.ZodEnum<["running", "succeeded", "failed", "stopped"]>;
    createdAt: z.ZodString;
    updatedAt: z.ZodString;
    startedAt: z.ZodString;
    completedAt: z.ZodNullable<z.ZodString>;
    stopRequestedAt: z.ZodNullable<z.ZodString>;
    iterations: z.ZodArray<z.ZodObject<{
        index: z.ZodNumber;
        workerAgentId: z.ZodNullable<z.ZodString>;
        workerStartedAt: z.ZodString;
        workerCompletedAt: z.ZodNullable<z.ZodString>;
        verifierAgentId: z.ZodNullable<z.ZodString>;
        status: z.ZodEnum<["running", "succeeded", "failed", "stopped"]>;
        workerOutcome: z.ZodNullable<z.ZodEnum<["completed", "failed", "canceled"]>>;
        failureReason: z.ZodNullable<z.ZodString>;
        verifyChecks: z.ZodArray<z.ZodObject<{
            command: z.ZodString;
            exitCode: z.ZodNumber;
            passed: z.ZodBoolean;
            stdout: z.ZodString;
            stderr: z.ZodString;
            startedAt: z.ZodString;
            completedAt: z.ZodString;
        }, "strip", z.ZodTypeAny, {
            startedAt: string;
            command: string;
            exitCode: number;
            passed: boolean;
            stdout: string;
            stderr: string;
            completedAt: string;
        }, {
            startedAt: string;
            command: string;
            exitCode: number;
            passed: boolean;
            stdout: string;
            stderr: string;
            completedAt: string;
        }>, "many">;
        verifyPrompt: z.ZodNullable<z.ZodObject<{
            passed: z.ZodBoolean;
            reason: z.ZodString;
            verifierAgentId: z.ZodNullable<z.ZodString>;
            startedAt: z.ZodString;
            completedAt: z.ZodString;
        }, "strip", z.ZodTypeAny, {
            reason: string;
            startedAt: string;
            passed: boolean;
            completedAt: string;
            verifierAgentId: string | null;
        }, {
            reason: string;
            startedAt: string;
            passed: boolean;
            completedAt: string;
            verifierAgentId: string | null;
        }>>;
    }, "strip", z.ZodTypeAny, {
        status: "running" | "failed" | "succeeded" | "stopped";
        verifierAgentId: string | null;
        index: number;
        workerAgentId: string | null;
        workerStartedAt: string;
        workerCompletedAt: string | null;
        workerOutcome: "completed" | "failed" | "canceled" | null;
        failureReason: string | null;
        verifyChecks: {
            startedAt: string;
            command: string;
            exitCode: number;
            passed: boolean;
            stdout: string;
            stderr: string;
            completedAt: string;
        }[];
        verifyPrompt: {
            reason: string;
            startedAt: string;
            passed: boolean;
            completedAt: string;
            verifierAgentId: string | null;
        } | null;
    }, {
        status: "running" | "failed" | "succeeded" | "stopped";
        verifierAgentId: string | null;
        index: number;
        workerAgentId: string | null;
        workerStartedAt: string;
        workerCompletedAt: string | null;
        workerOutcome: "completed" | "failed" | "canceled" | null;
        failureReason: string | null;
        verifyChecks: {
            startedAt: string;
            command: string;
            exitCode: number;
            passed: boolean;
            stdout: string;
            stderr: string;
            completedAt: string;
        }[];
        verifyPrompt: {
            reason: string;
            startedAt: string;
            passed: boolean;
            completedAt: string;
            verifierAgentId: string | null;
        } | null;
    }>, "many">;
    logs: z.ZodArray<z.ZodObject<{
        seq: z.ZodNumber;
        timestamp: z.ZodString;
        iteration: z.ZodNullable<z.ZodNumber>;
        source: z.ZodEnum<["loop", "worker", "verifier", "verify-check"]>;
        level: z.ZodEnum<["info", "error"]>;
        text: z.ZodString;
    }, "strip", z.ZodTypeAny, {
        text: string;
        seq: number;
        timestamp: string;
        iteration: number | null;
        source: "loop" | "worker" | "verifier" | "verify-check";
        level: "error" | "info";
    }, {
        text: string;
        seq: number;
        timestamp: string;
        iteration: number | null;
        source: "loop" | "worker" | "verifier" | "verify-check";
        level: "error" | "info";
    }>, "many">;
    nextLogSeq: z.ZodNumber;
    activeIteration: z.ZodNullable<z.ZodNumber>;
    activeWorkerAgentId: z.ZodNullable<z.ZodString>;
    activeVerifierAgentId: z.ZodNullable<z.ZodString>;
}, "strip", z.ZodTypeAny, {
    name: string | null;
    id: string;
    provider: string;
    cwd: string;
    createdAt: string;
    updatedAt: string;
    status: "running" | "failed" | "succeeded" | "stopped";
    model: string | null;
    startedAt: string;
    prompt: string;
    completedAt: string | null;
    verifyChecks: string[];
    verifyPrompt: string | null;
    workerProvider: string | null;
    workerModel: string | null;
    verifierProvider: string | null;
    verifierModel: string | null;
    archive: boolean;
    sleepMs: number;
    maxIterations: number | null;
    maxTimeMs: number | null;
    stopRequestedAt: string | null;
    iterations: {
        status: "running" | "failed" | "succeeded" | "stopped";
        verifierAgentId: string | null;
        index: number;
        workerAgentId: string | null;
        workerStartedAt: string;
        workerCompletedAt: string | null;
        workerOutcome: "completed" | "failed" | "canceled" | null;
        failureReason: string | null;
        verifyChecks: {
            startedAt: string;
            command: string;
            exitCode: number;
            passed: boolean;
            stdout: string;
            stderr: string;
            completedAt: string;
        }[];
        verifyPrompt: {
            reason: string;
            startedAt: string;
            passed: boolean;
            completedAt: string;
            verifierAgentId: string | null;
        } | null;
    }[];
    logs: {
        text: string;
        seq: number;
        timestamp: string;
        iteration: number | null;
        source: "loop" | "worker" | "verifier" | "verify-check";
        level: "error" | "info";
    }[];
    nextLogSeq: number;
    activeIteration: number | null;
    activeWorkerAgentId: string | null;
    activeVerifierAgentId: string | null;
}, {
    name: string | null;
    id: string;
    provider: string;
    cwd: string;
    createdAt: string;
    updatedAt: string;
    status: "running" | "failed" | "succeeded" | "stopped";
    model: string | null;
    startedAt: string;
    prompt: string;
    completedAt: string | null;
    verifyChecks: string[];
    verifyPrompt: string | null;
    workerProvider: string | null;
    workerModel: string | null;
    verifierProvider: string | null;
    verifierModel: string | null;
    archive: boolean;
    sleepMs: number;
    maxIterations: number | null;
    maxTimeMs: number | null;
    stopRequestedAt: string | null;
    iterations: {
        status: "running" | "failed" | "succeeded" | "stopped";
        verifierAgentId: string | null;
        index: number;
        workerAgentId: string | null;
        workerStartedAt: string;
        workerCompletedAt: string | null;
        workerOutcome: "completed" | "failed" | "canceled" | null;
        failureReason: string | null;
        verifyChecks: {
            startedAt: string;
            command: string;
            exitCode: number;
            passed: boolean;
            stdout: string;
            stderr: string;
            completedAt: string;
        }[];
        verifyPrompt: {
            reason: string;
            startedAt: string;
            passed: boolean;
            completedAt: string;
            verifierAgentId: string | null;
        } | null;
    }[];
    logs: {
        text: string;
        seq: number;
        timestamp: string;
        iteration: number | null;
        source: "loop" | "worker" | "verifier" | "verify-check";
        level: "error" | "info";
    }[];
    nextLogSeq: number;
    activeIteration: number | null;
    activeWorkerAgentId: string | null;
    activeVerifierAgentId: string | null;
}>;
export type LoopStatus = z.infer<typeof LoopRecordSchema>["status"];
export type LoopLogEntry = z.infer<typeof LoopLogEntrySchema>;
export type LoopVerifyCheckResult = z.infer<typeof LoopVerifyCheckResultSchema>;
export type LoopVerifyPromptResult = z.infer<typeof LoopVerifyPromptResultSchema>;
export type LoopIterationRecord = z.infer<typeof LoopIterationRecordSchema>;
export type LoopRecord = z.infer<typeof LoopRecordSchema>;
export interface LoopRunOptions {
    prompt: string;
    cwd: string;
    provider?: AgentProvider;
    model?: string;
    workerProvider?: AgentProvider;
    workerModel?: string;
    verifierProvider?: AgentProvider;
    verifierModel?: string;
    verifyPrompt?: string;
    verifyChecks?: string[];
    archive?: boolean;
    name?: string;
    sleepMs?: number;
    maxIterations?: number;
    maxTimeMs?: number;
}
export interface LoopListItem {
    id: string;
    name: string | null;
    status: LoopStatus;
    cwd: string;
    createdAt: string;
    updatedAt: string;
    activeIteration: number | null;
}
export interface LoopLogsResult {
    loop: LoopRecord;
    entries: LoopLogEntry[];
    nextCursor: number;
}
export declare class LoopService {
    private readonly options;
    private readonly storePath;
    private readonly logger;
    private loaded;
    private readonly loops;
    private persistQueue;
    private readonly running;
    constructor(options: {
        paseoHome: string;
        agentManager: AgentManager;
        logger: Logger;
    });
    initialize(): Promise<void>;
    runLoop(input: LoopRunOptions): Promise<LoopRecord>;
    listLoops(): Promise<LoopListItem[]>;
    inspectLoop(idOrPrefix: string): Promise<LoopRecord>;
    getLoopLogs(idOrPrefix: string, afterSeq?: number): Promise<LoopLogsResult>;
    stopLoop(idOrPrefix: string): Promise<LoopRecord>;
    private executeLoop;
    private runWorkerIteration;
    private runVerification;
    private buildWorkerConfig;
    private buildVerifierConfig;
    private resolveFinalText;
    private toPrompt;
    private finishLoop;
    private appendLog;
    private requireLoop;
    private persist;
}
export {};
//# sourceMappingURL=loop-service.d.ts.map