/** * JSON and tool-output compression. * * Their SmartCrusher claims 70-90% on "typical API response payloads". Most of * that is not clever: an API response is overwhelmingly repeated key names, * indentation, and rows that say the same thing as the row above. * * WHAT IS DROPPED, AND WHETHER IT CAN COME BACK: * * whitespace preserves parsed values; original formatting is not retained * nulls retained -- absent and null are distinct * long array tails LOSSY -- spilled to a path, or the count is stated so * the model knows what it is not seeing * * ROWS ARE NEVER SILENTLY TRUNCATED. A tail is either spilled to a real path or * announced with its length and the shape of what was cut. A model told "38 * more rows, same shape" can decide it does not care; a model handed a * truncated array with no marker cannot tell it was truncated at all, and will * reason confidently from a partial list. That failure is silent, which makes * it worse than the tokens it saves. * * AND THE ROWS THAT DIFFER ARE NEVER IN THE TAIL, which is the harder half and * the one this got wrong first. Keeping the head and eliding the rest reads as * a 95.7% reduction and is really a truncation: measured on a 60-row search * payload with a UUID record at index 47 and an error record at index 23, * BOTH WERE DESTROYED. The number looked like the best in the module and the * output had thrown away the only two rows anybody would have searched for. * * HeadRoom's SmartCrusher lists "statistical anomaly preservation" among its * transforms, and their benchmark generator plants exactly these: UUID needles * and error rows, inserted for relevance testing. A homogeneous tail is * genuinely redundant; a row that breaks the shape is the signal. So the shape * is computed first, every row that departs from it is kept wherever it sits, * and only the rows that truly repeat are elided. */ import type { CompressionResult, EngineContext } from './types.js'; /** Recognises JSON without paying to parse something that plainly is not. */ export declare function looksLikeJson(text: string): boolean; /** * Compresses a JSON document. * * Whitespace and nulls first, because they are free and lossless. The array * tail is considered only when the document is still large afterwards -- a * payload that fits comfortably once minified should not pay a marker to lose * rows it could have carried whole. */ export declare function compressJson(text: string, ctx?: EngineContext): CompressionResult; //# sourceMappingURL=json.d.ts.map