/**
 * Job runner — the deterministic state machine behind job runs.
 *
 * Control flow lives here, not in any agent's context window: the runner
 * walks a run's frozen step list, spawns agent sessions for the steps that
 * need judgment, persists every transition to the run file, and resumes
 * cleanly after a backend restart (re-arming timers, re-registering event
 * listeners, and harvesting step sessions that finished while it was down).
 *
 * Step session lifecycle:
 *   enterStep() → spawnStepSession() → session runs (and may call the
 *   complete_job_step tool, which persists a pendingResult onto the run) →
 *   sessionRegistry emits session_stopped → handleStepSessionEnd() harvests
 *   the result and advances the machine.
 *
 * Dependencies on claude.ts (sendMessage, stopSession, getActiveSession) are
 * injected via setJobRunnerDeps() — the same lazy pattern the other
 * services use to break the circular import.
 */
import type { EventEmitter } from "events";
import type { EffortLevel, JobRun } from "shared";
export interface JobContext {
    runId: string;
    stepId: string;
    /** Advisory sessions (approval notifiers) never advance the run. */
    advisory?: boolean;
}
type MessageSender = (opts: {
    prompt: AsyncIterable<unknown>;
    folder?: string;
    systemPrompt?: string;
    agentAlias?: string;
    maxTurns?: number;
    defaultPermissions?: any;
    triggered?: boolean;
    triggeredBy?: "cron" | "event" | "trigger" | "tool" | "job";
    provider?: "claude-code" | "openrouter";
    model?: string;
    effort?: EffortLevel;
    jobContext?: JobContext;
    requireExplicitCompletion?: boolean;
}) => Promise<EventEmitter>;
interface JobRunnerDeps {
    sendMessage: MessageSender;
    stopSession: (chatId: string) => boolean;
    getActiveSession: (chatId: string) => unknown | undefined;
}
export declare function setJobRunnerDeps(deps: JobRunnerDeps): void;
export declare function initJobRunner(): void;
export declare function shutdownJobRunner(): void;
export declare function spawnJobRun(jobId: string, inputs: Record<string, string>): JobRun;
export declare function respondToApproval(runId: string, decision: "approve" | "reject", comment?: string, via?: string): JobRun;
export declare function cancelRun(runId: string): JobRun;
export declare function pauseRun(runId: string): JobRun;
export declare function resumeRun(runId: string): JobRun;
/** Re-enter the current step of a failed run with a fresh attempt. */
export declare function retryRunStep(runId: string): JobRun;
export {};
//# sourceMappingURL=job-runner.d.ts.map