/** * Dispatch: classify a block, then hand it to the engine that fits. * * NO INSTANCE STATE, AND THAT IS THE WHOLE DESIGN. HeadRoom's open issue #3486 * is "Concurrent requests cross-contaminate compression options -- one shared * `ContentRouter` stores per-request state on `self`". A proxy is concurrent by * definition: two agents, or one agent with parallel tool calls, are two * requests in flight through the same router at the same time. Per-request * state on a shared object means request A's options silently decide how * request B's content is compressed. * * The fix is not care, it is shape. Everything here is a pure function of * (text, context). There is no object to hold state on, so the bug is not * something we avoid -- it is something that cannot be written. * * THE BUILT-INS REGISTER LIKE ANYBODY ELSE'S. They are ordinary registry * entries, so there is one dispatch path to test and a custom engine can claim * content ahead of them. What used to be the order of a `switch` is now * priority, which makes the reasoning explicit: * * diff 70 its hunks ARE the content; nothing may elide them * json 60 before prose, since a pretty-printed payload of English * strings reads as wordy lines * search 50 grep output carries source lines AND timestamps, so both * code and log would claim it and then find nothing * log 40 * code 30 * prose 10 the most permissive claim, so it goes last */ import type { CompressionResult, ContentKind, EngineContext } from './types.js'; /** Built-in names, so a caller can tell ours from a third party's. */ export declare const BUILT_IN_ENGINES: readonly string[]; /** * What kind of content this is. * * Answers with the winning engine's name, so a custom engine appears in a * report rather than being invisible. */ export declare function classify(text: string, ctx?: EngineContext): ContentKind; /** The engine that would handle this block, built-in or not. */ export declare function engineNameFor(text: string, ctx?: EngineContext): string | null; /** * Compresses one block. * * The boundary in `runEngine` applies to every engine equally: a result that * grew is discarded, a throw passes the input through untouched, and a lossy * elision with nowhere to recover from is refused. */ export declare function compressBlock(text: string, ctx?: EngineContext): CompressionResult; //# sourceMappingURL=router.d.ts.map