/** * Prompt capture (task 088) — serialize every constructed prompt to a * per-thread `.prompts/` sidecar directory for observability and measurement. * * Write-only observation: capture is a fire-and-forget JSON write after the * assistant response persists. Nothing on the hot path reads these files. * The `.prompts/` directory is invisible to every retrieval source and * thread enumeration (all of which filter by file extension), so captured * prompts can never feed back into retrieval. * * Storage is JSON rather than delimited markdown: prompt sections contain * arbitrary text (including other prompts), so any in-band delimiter could * collide with content. JSON escaping makes parsing unambiguous. */ /** One named section of a constructed prompt (instructions, retrieved, etc.) */ export interface PromptCaptureSection { name: string; text: string; tokens: number; } export interface PromptCaptureMeta { timestamp: number; threadName: string; /** Which assembly path produced this prompt */ path: 'cli' | 'hf'; model: string; userMessageId?: string; assistantMessageId?: string; ttftMs?: number | null; /** Wall time of the retrieve() call for this turn */ retrievalMs?: number | null; /** Token budget composition for the turn */ budget?: Record; /** Retrieval summary: counts, queryType, per-result scores */ retrieval?: unknown; systemPromptTokens?: number; } export interface PromptCaptureRecord { meta: PromptCaptureMeta; sections: PromptCaptureSection[]; } /** Max capture files kept per thread (FIFO by mtime) */ export declare const PROMPT_CAPTURE_MAX = 500; /** `.prompts/` sidecar directory for a thread's JSONL path */ export declare function getPromptsDirForThreadPath(threadPath: string): string; /** Guard against path traversal in capture ids coming from the API */ export declare function isValidCaptureId(captureId: string): boolean; /** * Write a capture record atomically (tmp → rename), then prune FIFO. * Callers invoke fire-and-forget; errors are the caller's to swallow/log. */ export declare function writePromptCapture(promptsDir: string, captureId: string, record: PromptCaptureRecord): Promise; /** Prune oldest capture files beyond `max`. Returns number removed. */ export declare function prunePromptCaptures(promptsDir: string, max?: number): Promise; /** Read a capture record; null if missing/invalid. */ export declare function readPromptCapture(promptsDir: string, captureId: string): Promise; //# sourceMappingURL=prompt-capture.d.ts.map