/** * @module koi/oo-harness/pprint * * Bounded previews: how a live value looks when the model reads about it. * * Adapted from NVIDIA Object-Oriented Agents (NOOA, Apache-2.0, * github.com/NVIDIA-NeMo/labs-OO-Agents) — specifically its truncation-aware * `pprint` contract, which is the half of pass-by-reference that faces the * model. The format is theirs; the types are ours, because our cells are * JavaScript, so an array says `Array` and not `list`. * * The rule the whole harness rests on: a value's PREVIEW goes into the * context, the value itself stays live in the session. A preview always * states three things — the concrete type, the true size, and a head/tail * sample — so the model can tell the difference between "a list of 8" and * "a list of 80,000" and write code accordingly, without either one costing * more than a line of context. * * Two invariants that must not drift: * - **A short value is shown whole.** If it fits, there is no marker; the * model can rely on `[1, 2, 3]` meaning exactly that. * - **Anything elided is announced.** `len=` is the true length, never the * shown length, and every truncation leaves a visible marker. Silent * truncation is how a model ends up confidently summarizing the first 5 * of 900 rows. */ export type PprintOptions = { /** How many items of an array/set/map to show at each end. */ edgeItems?: number; /** Longest string shown whole; longer ones show head and tail. */ maxString?: number; /** How many characters of each end of a long string to show. */ stringEdge?: number; /** How deep to descend before writing `…`. */ maxDepth?: number; /** How many object keys to show before eliding. */ maxKeys?: number; }; /** * The one-line preview of a value: type, true size, and a sample of the ends. * Never throws — a value that cannot be inspected still yields a line. */ export declare function pformat(value: unknown, options?: PprintOptions): string; /** `name = preview` — one binding, as it appears in the live-variable block. */ export declare function formatBinding(name: string, value: unknown, options?: PprintOptions): string; /** * A rough size for a value, used to decide what is worth keeping live rather * than inlining. Deliberately cheap: it walks a bounded number of entries. */ export declare function roughSize(value: unknown, budget?: number): number;