/** * Request Logger * * Captures HTTP requests passing through capture mode (webhook, tunnel --log) to JSONL files. * Each tunnel gets its own log at ~/.otterkit/requests/.jsonl. * One JSON object per line - appendable, streamable, agent-friendly. */ export interface RequestEntry { ts: string; /** Server-minted request id (absent in logs from older CLI versions). */ id?: string; method: string; path: string; headers: Record; body: string | null; status?: number; durationMs?: number; bodySize: number; /** Response side of the exchange (absent in logs from older CLI versions). */ response?: { headers: Record; body: string | null; }; /** Answered server-side (always-on endpoint); imported as a mirror/replay. */ buffered?: boolean; /** Standby replay (arrived while disconnected), as opposed to a live mirror. */ replayed?: boolean; /** Body exceeded the capture cap - body is null, bodySize is the true size. */ bodyTruncated?: boolean; /** Response body exceeded the cap or was an asset content-type. */ responseBodyTruncated?: boolean; } export declare function ensureRequestsDir(): Promise; export declare function logRequest(subdomain: string, entry: RequestEntry): Promise; export declare function getLogPath(subdomain: string): string; export declare function readLog(subdomain: string): Promise; export declare function clearLog(subdomain: string): Promise; /** * Watch a log for appended entries (`inspect --follow`). Polls file size and * parses only the newly appended bytes, so it works across processes (the * daemon appends, inspect reads). Returns a stop function. */ export declare function watchLog(subdomain: string, onEntry: (entry: RequestEntry) => void): () => void;