/**
 * TrackRunnerRegistry — per-project TrackRunner accounting.
 *
 * Singleton owned by backend/src/index.ts. Wraps creation of a runner
 * (with the project's PTY injector + workflow_data path) and exposes
 * lifecycle calls used by the HTTP route handlers.
 *
 * One project can have at most one in-flight track run; starting a
 * new one while another is running rejects with 'busy'.
 */
import { type AskUserFieldSpec } from './ask-user-bridge';
import type { TrackRunState } from './types';
export interface TrackRegistryDeps {
    /** Look up the absolute project folder path by projectId. */
    getProjectFolder: (projectId: string) => string | null;
    /** Inject text into the project's active CLI PTY. */
    injectIntoPty: (projectId: string, text: string) => Promise<void> | void;
    /** Push a JSON message to all WS clients subscribed to this project. */
    broadcast: (projectId: string, message: Record<string, unknown>) => void;
    /** Pino-compatible logger. */
    logger?: {
        debug?: PinoLogFn;
        info?: PinoLogFn;
        warn?: PinoLogFn;
        error?: PinoLogFn;
    };
}
interface PinoLogFn {
    (obj: object, msg?: string): void;
    (msg: string, ...args: unknown[]): void;
}
export interface TrackRegistry {
    /** Start a track run. */
    start(projectId: string, absTrackPath: string, trackFilename: string, args?: unknown[]): Promise<{
        ok: true;
        runId: string;
    } | {
        ok: false;
        reason: string;
    }>;
    /** Cancel the in-flight run for a project. */
    abort(projectId: string): boolean;
    /** Submit user input for a pending ask_user request. */
    submitInput(projectId: string, requestId: string, data: Record<string, unknown>): {
        ok: boolean;
        message?: string;
    };
    /** Get the latest state for a project (running or last finished). */
    getState(projectId: string): TrackRunState | null;
    /** True if a run is in flight (status === running or paused). */
    isRunning(projectId: string): boolean;
    /** Get the pending ask_user request if any. */
    getPendingAskUser(projectId: string): {
        runId: string;
        requestId: string;
        fields: AskUserFieldSpec[];
    } | null;
}
export declare function createTrackRegistry(deps: TrackRegistryDeps): TrackRegistry;
export {};
//# sourceMappingURL=registry.d.ts.map