import type { WorkflowHandoffRequest } from "@oscharko-dev/keiko-contracts/workflow-handoff";
import type { QueueEventSink } from "./sink.js";
export type RunStatus = "running" | "completed" | "cancelled" | "failed";
export interface AppliableSnapshot {
    readonly kind: "unit-tests" | "bug-investigation";
    readonly payload: unknown;
    readonly limits: Record<string, unknown> | undefined;
    readonly governedHandoff?: WorkflowHandoffRequest | undefined;
}
export interface RunRecord {
    readonly runId: string;
    readonly fingerprint: string;
    readonly modelId: string;
    readonly sink: QueueEventSink;
    status: RunStatus;
    report: unknown;
    readonly cancel: (reason?: string) => void;
    appliable: AppliableSnapshot | undefined;
    applyReport: unknown;
    appliedAt: number | undefined;
    terminatedAt: number | undefined;
}
export interface RegisterRunInput {
    readonly runId: string;
    readonly fingerprint: string;
    readonly modelId: string;
    readonly sink: QueueEventSink;
    readonly cancel: (reason?: string) => void;
}
export interface RunRegistryOptions {
    readonly maxActiveRuns?: number | undefined;
    readonly terminatedTtlMs?: number | undefined;
    readonly now?: (() => number) | undefined;
}
export declare class ActiveRunLimitError extends Error {
    constructor(limit: number);
}
export interface RunRegistry {
    register: (input: RegisterRunInput) => RunRecord;
    get: (runId: string) => RunRecord | undefined;
    snapshot?: (limit?: number) => readonly RunRecord[];
    complete: (runId: string, status: Exclude<RunStatus, "running">, report: unknown, appliable: AppliableSnapshot | undefined) => void;
    activeCount: () => number;
    size: () => number;
}
export declare function createRunRegistry(options?: RunRegistryOptions): RunRegistry;
//# sourceMappingURL=runs.d.ts.map