export type RecorderEventType = "action" | "state" | "nav" | "error" | "toast" | "log"; export type RecorderReportReason = "user" | "error" | "test" | "manual"; export interface RecorderEvent { /** Seconds before the report was made (negative). */ t: number; /** Epoch ms, the same clock as Clips diagnostics `timestampMs`. */ at: number; type: RecorderEventType; name?: string; ok?: boolean; status?: number; errorCode?: string; ms?: number; requestId?: string; /** Redacted and bounded: strings ≤ 200 characters, the event ≤ about 2 KB. */ data?: Record; } export interface RecorderPendingWork { type: "action" | "state" | string; name: string; ageMs: number; } export interface RecorderReport { app: string; build: string; /** The route path, with every query value redacted. */ url: string; at: string; reason: RecorderReportReason; windowSeconds: number; events: RecorderEvent[]; watched: Record; pending: RecorderPendingWork[]; /** Events lost to the caps since the last clear. */ dropped: number; } export interface RecorderReportOptions { seconds?: number; reason?: RecorderReportReason; } /** @internal Called when an action starts; call the result when it settles. */ export declare function recordActionStart(name: string, method: string): (outcome: { error: unknown; response: Response | undefined; signal: AbortSignal | undefined; }) => void; /** @internal An `application_state` write, or a delete when `value` is undefined. */ export declare function recordStateWrite(key: string, value: unknown, write: Promise, signal: AbortSignal | undefined): void; /** @internal */ export declare function recordNav(): void; /** @internal The report without notifying `onReport` listeners, for core's own destinations. */ export declare function buildRecorderReport(reason: RecorderReportReason, seconds?: number): RecorderReport; declare function report(options?: RecorderReportOptions): RecorderReport; declare function pending(): RecorderPendingWork[]; export declare const recorder: { /** Synchronous. Listeners hear about every report except a `"manual"` one. */ report: typeof report; log(name: string, data?: unknown): void; /** Adds `getValue()` to every report. Returns a function that stops it. */ watch(name: string, getValue: () => unknown): () => void; onReport(listener: (report: RecorderReport) => void): () => void; /** Field names (`"body"`), or dotted paths that start with the event's name (`"compose.body"`, `"payment.*"`). */ redact(...keys: string[]): void; pending: typeof pending; disable(): void; }; declare global { interface Window { __agentNativeRecorder?: { report: typeof report; }; } } export declare function configureRecorder(options: { windowSeconds?: number; maxEvents?: number; sentry?: boolean; enabled?: boolean; }): void; /** @internal Whether `ensureSentry()` should attach recorder events. */ export declare function recorderSentryEnabled(): boolean; /** @internal Forgets everything recorded, e.g. on sign-out. */ export declare function clearRecorder(): void; /** @internal Called once from client bootstrap. */ export declare function startRecorder(): void; /** @internal */ export declare function resetRecorderForTests(): void; export {};