export interface BgjobRoot {
    /** Stable identifier for the UI: 'claude', 'opencode', or basename of custom path. */
    id: string;
    /** Filesystem path. */
    path: string;
    /** Pretty label for display. */
    label: string;
}
export interface BgjobSummary {
    id: string;
    name: string;
    status: string;
    pid: number | null;
    started_at: string | null;
    ended_at: string | null;
    exit_code: number | null;
    restart_generation: number;
    /** Source root id (e.g. 'claude' or 'opencode') — useful when caller mixes roots. */
    rootId: string;
}
export interface BgjobDetail extends BgjobSummary {
    cmd: string[];
    workdir: string | null;
    out_dir: string | null;
    log_path: string | null;
    resources: {
        cpu_time?: number;
        rss_kb?: number;
        state?: string;
    } | null;
    /** Tail of log.txt (last `tailLines` lines). */
    log_tail: string | null;
}
/**
 * Resolve the configured roots. Reads env IMHUB_BGJOB_ROOTS — comma-separated
 * absolute paths, optionally with id prefix `id=path`. Falls back to the two
 * defaults so a fresh install just works.
 */
export declare function resolveRoots(): BgjobRoot[];
/**
 * List all bgjobs under one root, newest first by started_at.
 *
 * If <root>/index.json exists we use that as the authoritative ID set;
 * otherwise we fall back to scanning subdirectories that look like job IDs.
 * Both paths read each job's meta.json for status — index.json itself does
 * not record status.
 */
export declare function listJobsForRoot(root: BgjobRoot): Promise<BgjobSummary[]>;
/**
 * Get full detail for one job, including a tail of its log file. Returns null
 * if the id isn't found in this root.
 */
export declare function getJobDetail(root: BgjobRoot, id: string, tailLines?: number): Promise<BgjobDetail | null>;
/**
 * Convenience: list jobs across every configured root. Each item carries its
 * `rootId` so the UI can render or filter. Concurrency is per-root so a slow
 * filesystem on one root doesn't block another.
 */
export declare function listAllJobs(): Promise<{
    root: BgjobRoot;
    jobs: BgjobSummary[];
}[]>;
/** Resolve one root by id. Returns null if not configured. */
export declare function findRoot(rootId: string): BgjobRoot | null;
//# sourceMappingURL=bgjob-reader.d.ts.map