/** * Local, versioned crash report capture — Phase 1 of desktop diagnostics. * Shared by three writers: `main-runtime.ts`'s `uncaughtException`/ * `unhandledRejection` hooks (domain `node`), `assets/prod-server.mjs`'s * renderer error endpoint (domain `renderer`), and * `crates/native/src/launcher.rs`'s panic hook / unexpected-Node-exit path * (domain `native`, written directly by Rust using the same directory and * filename convention — see that file's `write_native_crash_report`). * * Murasaki never transmits these anywhere: this module only captures and * exposes them through `MainContext.diagnostics`. Reused from * `assets/prod-server.mjs` via the same `.murasaki-runtime/main/` copy that * already ships `logger.js`/`sidecar.js` (see `cli/bundle.ts`'s * `copyMainRuntime`), so keep this file free of anything beyond `./logger.js` * and Node builtins. */ export declare const CRASH_REPORT_VERSION = 1; export type CrashReportDomain = 'node' | 'native' | 'renderer'; /** One versioned local crash report. */ export interface CrashReport { reportVersion: 1; domain: CrashReportDomain; timestamp: string; appVersion: string; frameworkVersion: string; os: string; arch: string; message: string; stack?: string; extra?: Record; } /** Metadata-only projection returned by `listCrashReports()`. */ export interface CrashReportSummary { id: string; domain: CrashReportDomain; timestamp: string; appVersion: string; } /** Read/write surface exposed on `MainContext.diagnostics`. */ export interface CrashDiagnosticsApi { listCrashReports(): Promise; readCrashReport(id: string): Promise; clearCrashReports(): Promise; } export interface CrashReportInput { domain: CrashReportDomain; message: string; stack?: string; extra?: Record; appVersion: string; frameworkVersion: string; } export declare const DEFAULT_KEEP_CRASH_REPORTS = 20; /** @internal Exported for tests; also usable by app code validating a stored id. */ export declare function isValidCrashReportId(id: unknown): id is string; /** * Writes one crash report synchronously and atomically (temp file + rename) * so a caller about to end the process (`process.exit()`) cannot race past an * in-flight async write. Directory creation, the write, and rotation are all * best-effort: a failure here must never throw back into a crash path. */ export declare function writeCrashReportSync(directory: string, input: CrashReportInput, keepReports?: number): string | null; /** Builds the read/write API exposed on `MainContext.diagnostics`. */ export declare function createCrashDiagnostics(directory: string): CrashDiagnosticsApi; //# sourceMappingURL=crash-reports.d.ts.map