/** * CommandOutputDistiller — turns raw build/test/lint output into the few lines a model * actually needs, without ever losing the rest. * * The problem it solves: a failing `npm test` dumps thousands of lines into the model's * context, of which maybe thirty carry signal (which tests failed, why, and where). The * other 99% is code frames the model can read from the file itself, passing-test noise, * and node_modules stack frames. * * Two rules this module is built around: * * 1. Deterministic only. Every parser here is a grammar over a known reporter format — * no LLM summarization. A summarizer that hallucinates a test name is worse than the * raw dump it replaced. * 2. Lossless on demand. The complete output is always written to disk first and the * distilled view carries a handle back to it, so anything trimmed can be retrieved * verbatim (see `readRegion`). Nothing is silently dropped. */ export type OutputFormat = "jest" | "vitest" | "tsc" | "eslint" | "generic"; /** A named, retrievable slice of the raw output (1-indexed, inclusive). */ export interface OutputSection { name: string; startLine: number; endLine: number; } export interface DistilledOutput { format: OutputFormat; /** The text to hand to the model. */ text: string; /** Null when the output was small enough to pass through untouched. */ handle: string | null; originalChars: number; distilledChars: number; originalLines: number; sections: OutputSection[]; } /** * Persist the complete output and return its handle. Written before anything is trimmed, * so a distilled view can never reference output that was never saved. */ export declare function storeRawOutput(raw: string, command: string, format: OutputFormat, sections: OutputSection[]): string; export interface RegionRequest { handle: string; /** Name of a section reported by the distiller (e.g. a failing test title). Prefix match, case-insensitive. */ section?: string; startLine?: number; endLine?: number; /** Return the entire stored output. */ all?: boolean; } export interface RegionResult { found: boolean; command?: string; totalLines?: number; startLine?: number; endLine?: number; text?: string; /** Section names available for this handle, so a failed lookup can be retried precisely. */ availableSections?: string[]; error?: string; } /** Retrieve raw output verbatim — the escape hatch that makes distillation lossless. */ export declare function readRegion(req: RegionRequest): RegionResult; export declare function detectFormat(raw: string): OutputFormat; export interface DistillOptions { command: string; /** Skip distillation entirely and return the raw output (still stored). */ raw?: boolean; /** Outputs at or below this size pass through untouched. */ thresholdChars?: number; } export declare function distillCommandOutput(rawOutput: string, options: DistillOptions): DistilledOutput; /** The footer that tells the model — and the user — that this view is not the whole output. */ export declare function buildDistillFooter(d: DistilledOutput): string; //# sourceMappingURL=CommandOutputDistiller.d.ts.map