import type { JsonPatchOp, StateDiff } from '../state-diff.js'; /** * Humanized renderers for `StateDiff` (JSON-Patch). The raw shape is * accurate but technical (`{ op: 'add', path: '/items/3/name', value: 'X' }`); * the agent panel reads better in plain prose. * * Two output forms: * - `summarizeDiff` — one-line headline ("3 items changed") for a * row in the activity feed. * - `groupDiff` — structured per-top-level-path summary for an * expanded sidecar that lists what changed in each region. * * Both are pure functions; both treat the input as immutable. Callers * that need a different rendering (e.g. an emoji-driven layout, a * deeper drill-down) should compose on top of `groupDiff` rather than * forking — the grouping covers 90% of the structural work. */ /** * One-line summary of the entire diff. Examples: * * - `[{ op: 'replace', path: '/cart/total', value: 9 }]` * → "1 field changed" * - `[{ op: 'add', path: '/items/-' }, { op: 'add', path: '/items/-' }]` * → "2 items added" * - mixed adds/removes/replaces across multiple regions * → "5 changes across 3 regions" * * The summary collapses multiple ops on the same logical path * (e.g. updating multiple fields on the same item) into a single * "change" — counting raw op entries would surface implementation * detail (which JSON-Patch ops the differ emitted), not user-relevant * counts. */ export declare function summarizeDiff(diff: StateDiff | undefined | null): string; /** * Per-top-level-path breakdown. Returns an array (stable order) where * each entry describes the changes affecting one top-level region. * Useful for a sidecar that wants to render a row per region with the * affected fields beneath it. * * The returned `paths` are the FULL JSON-Pointer paths of the ops, so * a consumer can render "/items/3/name" verbatim or further humanize * it. The renderer doesn't make policy choices about how deeply to * label — that's the host's call. */ export type DiffGroup = { /** Top-level state field, or `'*'` for whole-state replace. */ region: string; adds: number; removes: number; replaces: number; /** Full op paths in arrival order. */ paths: string[]; }; export declare function groupDiff(diff: StateDiff | undefined | null): DiffGroup[]; /** * Per-op short verb + readable path. Useful for a flat detail view: * * - `{ op: 'replace', path: '/cart/total', value: 9 }` → `'changed cart.total'` * - `{ op: 'add', path: '/items/3' }` → `'added items.3'` * - `{ op: 'remove', path: '/items/3' }` → `'removed items.3'` * - `{ op: 'replace', path: '/' }` → `'replaced state'` * * The path is converted from JSON-Pointer to dotted form (with * `~0`/`~1` un-escaping) so it reads as a plain field accessor. */ export declare function describeOp(op: JsonPatchOp): string; //# sourceMappingURL=diff-render.d.ts.map