/** Crash records kept per endpoint. A crash loop rewrites the file down to this many. */
export declare const HOST_CRASH_RECORD_LIMIT = 50;
/** `<daemonDir>/crashes.jsonl` - one JSON object per line, oldest first. */
export declare function hostCrashRecordFile(daemonDir: string): string;
/** Who sent a stop: the process, the role it acted in, and the generation it acted for when it has one. */
export interface HostStopSender {
    readonly pid: number;
    readonly kind: "ensure" | "supervisor" | "stop" | "successor" | "handoff";
    readonly generation?: string;
}
export interface HostCrashRecord {
    /** ISO-8601 instant the death or stop was observed. */
    readonly at: string;
    /** The signal that killed the child, when it died from one. */
    readonly signal?: string;
    /** The exit code, when it exited rather than signalled. */
    readonly code?: number;
    /**
     * How long the child had been alive, in milliseconds. Absent when the writer cannot know it: a caller
     * recording a supervisor it had to SIGKILL never saw the child start.
     */
    readonly uptimeMs?: number;
    /**
     * `rpc-host` (terminal), `rpc-host-watchdog`, or `rpc-host-drain-overdue` (a drain still running past its grace,
     * senpi#7098); absent on records written before the field existed.
     */
    readonly kind?: "rpc-host" | "rpc-host-watchdog" | "rpc-host-drain-overdue";
    /** How long an overdue drain had been running when it was recorded. */
    readonly drainingForMs?: number;
    /** The generation (`instanceId`) the record is about. */
    readonly generation?: string;
    /**
     * `supervisor`: the child died and nobody asked for it. `external`: it was signalled with no stop
     * intent on record. `engine_stop`: an engine process stopped it on purpose (`sender`, `reason`).
     */
    readonly detection?: "supervisor" | "external" | "engine_stop";
    readonly sender?: HostStopSender;
    /** Every sender that acted, outermost first, when the stop passed through more than one. */
    readonly chain?: readonly HostStopSender[];
    readonly reason?: string;
    /** Whether a fresh stop intent for this generation was on record when it ended. */
    readonly stopIntent?: boolean;
    /** The newest loop stall the host measured, when it was recent at the end. */
    readonly stall?: {
        readonly driftMs: number;
        readonly at: string;
        readonly attributedSessionId?: string;
    };
    /** The runtime the supervisor and its child share, as of the death. */
    readonly bunVersion?: string;
    readonly senpiVersion?: string;
    readonly productVersion?: string;
}
/** A record that counts as a death: a terminal record no engine process asked for. */
export declare function isHostCrash(record: HostCrashRecord): boolean;
/**
 * Append one record, then bound the file.
 *
 * NEVER throws: this runs on exit paths, where a filesystem failure must not be able to delay or
 * prevent the shutdown it is only annotating.
 */
export declare function recordHostCrash(daemonDir: string, record: HostCrashRecord): void;
/**
 * Append a TERMINAL record unless one for the same generation already exists: the supervisor's exit
 * handler and a caller that had to SIGKILL that supervisor can both reach this for one generation.
 * The check-then-append runs under `crashes.lock`; a lock that cannot be had in time appends anyway.
 */
export declare function recordTerminalHostRecord(daemonDir: string, record: HostCrashRecord): Promise<void>;
/** Every record currently held, oldest first. Unparseable lines are skipped, never thrown on. */
export declare function readHostCrashRecords(daemonDir: string): readonly HostCrashRecord[];
//# sourceMappingURL=host-crash-record.d.ts.map