/** * `--summary` — bounded, additive views of large CLI envelopes. * * * Rationale (measured, session 2026-09-07-session-245530): dumping a full * `peaks memory reindex --json` array four times cost ≈ 160 KB ≈ 40K tokens * of orchestrator context — roughly 4% of a 1M window for ONE command * repeated. The default envelopes stay exactly as they are (back-compat); * `--summary` is an OPT-IN view that keeps counts + names-of-first-N and * drops the per-entry bodies, which remain on disk and are re-readable with * the full command. No information is destroyed — only the in-context copy * shrinks. * * Byte bound: every summary object is passed through `fitSummaryToBytes`, * which shrinks string arrays (longest first) until the JSON serialization is * ≤ `SUMMARY_DATA_MAX_BYTES` (2 KB minus a small envelope reserve, so the * PRINTED envelope stays ≤ `SUMMARY_MAX_BYTES`). Scalars are never touched, * so counts and paths stay exact. */ /** Hard ceiling for the PRINTED `--summary` envelope, in UTF-8 bytes. */ export declare const SUMMARY_MAX_BYTES = 2048; /** * Reserve for the envelope wrapper (`ok`/`command`/`warnings`/`nextActions`/ * error fields) that the CLI adds around `data`. The builders cap `data` at * `SUMMARY_DATA_MAX_BYTES` so the whole printed envelope stays ≤ 2 KB. */ export declare const SUMMARY_ENVELOPE_RESERVE_BYTES = 512; /** Cap applied to the summary `data` object itself (pretty-printed size). */ export declare const SUMMARY_DATA_MAX_BYTES: number; /** Per-name character cap — a name is a label, not a document. */ export declare const SUMMARY_NAME_MAX_CHARS = 120; /** How many names each command asks for before the byte fitter trims. */ export declare const SUMMARY_INITIAL_NAMES = 40; /** A bounded `{count, names}` view: `count` is the true total, `names` a prefix. */ export interface BoundedNames { readonly count: number; readonly names: readonly string[]; } /** * Build a `{count, names}` view. `count` is always the full length; `names` * carries the first `SUMMARY_INITIAL_NAMES` (clipped) entries — the byte * fitter may trim further. */ export declare function boundedNames(names: readonly string[]): BoundedNames; /** * Shrink `data` (in place on a clone) until its JSON form fits `maxBytes`. * * Algorithm: repeatedly find the LONGEST nested array and drop its last * element. Scalars are never modified, so `count` fields stay truthful; the * `names` arrays simply show fewer names. Returns the input unchanged when it * already fits or when there is no array left to trim. */ export declare function fitSummaryToBytes>(data: T, maxBytes?: number): T;