/** * [WHO]: Provides DiagnosticEvent types, reportDiagnostic(), subscribeDiagnostics(), isDevRuntime() * [FROM]: Depends only on node:events and node built-ins * [TO]: Imported by repo-root code (extensions/, core/, modes/) for unified background-failure reporting; mirrored by tiny shells in standalone packages (e.g. packages/mem-core/src/diagnostics.ts) that share the same Symbol.for slot at runtime * [HERE]: utils/diagnostics.ts - canonical diagnostic bus; explicit dev/debug mode prints to console, every mode emits to the in-process bus where the diagnostics extension subscribes and auto-uploads * * Cross-compile-boundary sharing: independent packages compile their own copy of * a thin shell, but every copy resolves the same `Symbol.for(...)` slot on * globalThis at runtime, so all reportDiagnostic() calls flow through one bus. */ export type DiagnosticSeverity = "debug" | "info" | "warning" | "error"; export type DiagnosticCategory = "network" | "fallback" | "persistence" | "config" | "extension_timeout" | "schema" | "unknown"; export interface DiagnosticEvent { source: string; severity: DiagnosticSeverity; category: DiagnosticCategory; message: string; detail?: unknown; fingerprint?: string; context?: Record; } /** * Unified dev-mode predicate. True only for explicit developer intent: * - NODE_ENV=development, OR * - npm_lifecycle_event is "dev" or "test", OR * - CATUI_DEBUG is truthy (legacy NANOPENCIL_DEBUG is also accepted). * * Always false when NODE_ENV=production. */ export declare function isDevRuntime(): boolean; export declare function reportDiagnostic(event: DiagnosticEvent): void; /** * Subscribe to all diagnostic events, including those queued before the first * subscriber attached. Returns an unsubscribe function. Typically called once * by the diagnostics extension on load. */ export declare function subscribeDiagnostics(handler: (event: DiagnosticEvent) => void): () => void;