export interface BrokerStartupFailureMarker { version: 1; reason: string; exitCode: number | null; signal: string | null; writtenAt: number; /** * pid of the exact broker process that wrote this marker. `ensureBroker` * only trusts a marker whose pid matches the exact spawned child it just * reaped -- a marker left behind by a stale or foreign broker process (for * example a losing racer from a concurrent spawn, or a marker predating the * pre-spawn clear) must never be misattributed to a different spawn's * failure. */ pid: number; } export declare function brokerStartupFailurePath(agentDir: string): string; /** * Best-effort durable marker write; never throws (diagnostics must not mask the * exit itself). `pid` must be the writing broker process's own pid * (`process.pid`) so a later reader can bind the marker to the exact spawned * child it is attributing the failure to. */ export declare function writeBrokerStartupFailureMarker(agentDir: string, failure: { reason: string; exitCode: number | null; signal: string | null; pid: number; }): Promise; /** Reads a bounded startup-failure marker; `undefined` when absent or malformed. */ export declare function readBrokerStartupFailureMarker(agentDir: string): Promise; /** Best-effort marker removal; used at spawn so a stale marker never misattributes an older failure. */ export declare function clearBrokerStartupFailureMarker(agentDir: string): Promise; /** Typed error returned when a detached broker exits before discovery. */ export declare class BrokerStartupError extends Error { readonly code = "broker_startup_failed"; readonly exitCode: number | null; readonly signal: string | null; readonly reason: string; readonly stderrExcerpt?: string; constructor(fields: { exitCode: number | null; signal: string | null; reason: string; stderrExcerpt?: string; }); }