import type Database from 'better-sqlite3';
import type { AgentEngine } from '../bridge/engine.js';
export interface JobRunnerConfig {
    db: Database.Database;
    bridge: AgentEngine;
    broadcast: (squadName: string, message: Record<string, unknown>) => void;
    broadcastToAll: (message: Record<string, unknown>) => void;
    squadsDir: string;
}
export interface RunOptions {
    squadName: string;
    prompt: string;
    timeoutMinutes: number;
    retryOnFailure: number;
    attempt: number;
    maxTurns?: number;
}
export type RunResult = 'completed' | 'failed' | 'skipped' | 'queued';
export interface ChainTarget {
    squadName: string;
    description?: string;
    maxTurns?: number;
}
export declare class JobRunner {
    private db;
    private bridge;
    private broadcast;
    private broadcastToAll;
    private squadsDir;
    private runningSquads;
    private squadQueues;
    private summaryCounter;
    constructor(config: JobRunnerConfig);
    /**
     * On server startup, any squad state.json left in status "running" from a previous
     * server process is stale — the executor is dead. Mark them as "interrupted" so the
     * UI doesn't show phantom running pipelines.
     * Checks both <squad>/state.json and <squad>/_state/state.json patterns.
     */
    private cleanupStaleRunningStates;
    run(opts: RunOptions): Promise<RunResult>;
    /**
     * Generate an intelligent L1 summary via a micro-call to Claude.
     * Returns null on failure (timeout, error) — caller should fallback to truncation.
     */
    private generateSummary;
    /**
     * Read chain targets from squad.yaml.
     * Supports both formats:
     *   chain: "squad-name"
     *   chain: ["squad-a", "squad-b"]
     *   chain: [{ target_squad: "squad-a", trigger: "on_complete", description: "..." }]
     */
    private readChainConfig;
    private processNextInQueue;
    /**
     * Read last-published.json and return how many ms remain before the spacing window opens.
     * Returns 0 if the window is already open or the file doesn't exist.
     */
    private getSpacingDelayMs;
    /**
     * After a run completes, check if the agent wrote _state/retry-at.json requesting a
     * scheduled one-shot retry (e.g. because the spacing window hadn't opened yet).
     * Consumes the file immediately to prevent duplicate scheduling.
     */
    private scheduleRetryIfNeeded;
    isRunning(squadName: string): boolean;
    stopAll(): void;
}
//# sourceMappingURL=job-runner.d.ts.map