/** Hard cap for one journal line, including its newline. */ export declare const CRASH_EVENT_MAX_BYTES = 512; /** Journal line format tag. */ export declare const CRASH_EVENT_KIND = "gjc-crash-event.v1"; /** Preview cap for the message class carried by an event. */ export declare const CRASH_EVENT_MESSAGE_MAX_BYTES = 256; /** Bounded execution provenance carried only on newly written occurrences. */ export type CrashProvenance = "product" | "eval" | "bun_test"; /** * Classify only process-level harness modes that are explicit and stable. * Everything else is product provenance, including source checkouts, CLI * invocations, SDK/ACP hosts, and native-loader failures. */ export declare function detectCrashProvenance(argv?: readonly string[], env?: NodeJS.ProcessEnv, execArgv?: readonly string[]): CrashProvenance; export type CrashEvent = CrashOccurrenceEvent | CrashRefusedEvent | CrashReportedEvent | CrashRelayedEvent | CrashAcknowledgedEvent | CrashNudgedEvent; export interface CrashOccurrenceEvent { readonly kind: "occurrence"; readonly fingerprint: string; readonly fpv: number; readonly recordId: string; readonly at: number; readonly errorName: string; readonly messageClass: string; /** Legacy events omit this and are treated as product crashes. */ readonly provenance?: CrashProvenance; } export interface CrashRefusedEvent { readonly kind: "refused"; readonly fingerprint: string; readonly fpv: number; readonly recordId: string; readonly contractVersion: string; readonly at: number; } export interface CrashReportedEvent { readonly kind: "reported"; readonly fingerprint: string; readonly at: number; readonly issueUrl: string; /** Set when the submission was a "+1" comment rather than a new issue. */ readonly commented?: boolean; } export interface CrashRelayedEvent { readonly kind: "relayed"; readonly fingerprint: string; readonly at: number; /** Sentry event id accepted upstream: 32 lowercase hex. */ readonly eventId: string; /** Exact occurrence record represented by the accepted envelope. Absent on legacy pre-record-id relay lines. */ readonly recordId?: string; } export interface CrashAcknowledgedEvent { readonly kind: "acknowledged"; readonly fingerprint: string; readonly at: number; } export interface CrashNudgedEvent { readonly kind: "nudged"; readonly at: number; } /** * Serialize one event to a single journal line (newline included), bounded to * `CRASH_EVENT_MAX_BYTES`. Oversized message previews are shortened, and if the * line still does not fit the preview is dropped entirely rather than the event. */ export declare function formatCrashEventLine(event: CrashEvent): string; /** Parse one journal line. Anything unexpected yields `undefined`, never a throw. */ export declare function parseCrashEventLine(line: string): CrashEvent | undefined; /** * Append one event synchronously with `O_APPEND`. Never throws. * * No parse, no lock, no rename, no read: the only I/O is one bounded write to * an append-only file, so concurrent writers interleave whole lines instead of * corrupting each other's records. */ export declare function appendCrashEvent(event: CrashEvent, journalPath: string): boolean; /** * Fatal-path entry point: at most one journal append per process lifetime. * * A crash raised while handling a crash must not spend the process's remaining * moments on journal bookkeeping, so the latch is never cleared — the process * is exiting anyway. Returns whether this call wrote a line. */ export declare function appendFatalCrashEvent(event: CrashEvent, journalPath: string): boolean;