import type { Logger } from './types.js';
import type { SystemdScopeHandle } from './systemd-spawn.js';
export type RcSpawnMode = 'new' | 'resume';
export interface RcScriptSpawnDeps {
    claudeBin: string;
    spawnCwd: string;
    accountId: string;
    platformRoot: string;
    claudeConfigDir: string;
    brandedNeo4jUri: string;
    brandedNeo4jPassword: string;
    uiPort: string;
    pidFileTimeoutMs: number;
    logger: Logger;
    systemdSpawn: (params: {
        claudeBin: string;
        claudeArgs: readonly string[];
        env: Readonly<Record<string, string>>;
        cwd: string;
        unitToken: string;
        captureFilePath: string;
    }) => Promise<SystemdScopeHandle>;
    /** waitForPid binding from the fs watcher (resolves once claude writes
     *  its pid file under sessions/<pid>.json). Injectable for tests. */
    waitForPid: (pid: number, timeoutMs: number) => Promise<{
        pidFilePath: string | null;
        bridgeSessionId: string | null;
    }>;
    /** Injectable clock for tests. Defaults to Date.now. */
    now?: () => number;
    /** Liveness poll interval. Default 15_000 ms. Brief permits up to 30 s. */
    livenessPollIntervalMs?: number;
}
export interface RcScriptSpawnRequest {
    sessionId: string | null;
    name: string | null;
}
export interface RcScriptSpawnResult {
    spawnedPid: number;
    sessionId: string | null;
    unitToken: string;
    mode: RcSpawnMode;
}
export interface RcScriptSpawnEntry {
    unitToken: string;
    pid: number;
    sessionId: string | null;
    mode: RcSpawnMode;
    spawnedAt: number;
    captureFilePath: string;
    handle: SystemdScopeHandle;
    pidFileSeen: boolean;
    remoteBound: boolean;
    exited: boolean;
}
/** For tests + the census sweep. Read-only iteration. */
export declare function forEachLiveScriptScopeRcSpawn(cb: (entry: RcScriptSpawnEntry) => void): void;
export declare function liveScriptScopeRcSpawnCount(): number;
/** Clear the tracker map. Test-only seam — production never calls. */
export declare function __resetScriptScopeRcSpawnsForTests(): void;
/** Schema-tagged line emitter. Every consumer of the cross-arm `[rc-life]`
 *  surface must use this so the field order + null-handling stays
 *  identical between rc-spawn and rc-daemon. */
export declare function emitRcLife(logger: Logger, op: string, source: 'rc-spawn' | 'rc-daemon', path: 'script-scope' | 'node-pty', mode: RcSpawnMode | 'daemon', unitToken: string, fields?: Record<string, string | number | boolean | null>): void;
/** Run the script-scope rc-spawn. Returns once `systemdSpawn` resolves
 *  (scope is active, cgroup pid captured). Liveness polling, pid-file
 *  binding, and exit observation run in the background — the route
 *  responds immediately with `spawnedPid` like the node-pty arm does. */
export declare function handleRcSpawnScriptScope(deps: RcScriptSpawnDeps, req: RcScriptSpawnRequest): Promise<RcScriptSpawnResult>;
/** Census sweep — reconciles expected (dashboard-initiated sessions) vs
 *  actual (live tracked entries). Detects a leaked entry whose pid is
 *  gone but the tracker still holds it, or a tracker whose handle's
 *  scope vanished without an exit event. Traffic-independent — runs on
 *  a timer in index.ts so a quiet failure surfaces within one interval.
 *
 *  The daemon's live handle is supplied via `daemonAlive`; the daemon
 *  itself owns the canonical accounting (a single handle reference),
 *  but exposing it here keeps the schema unified. */
export declare function runRcLifeCensus(logger: Logger, daemonAlive: number): void;
//# sourceMappingURL=rc-script-spawn.d.ts.map