mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-10 13:31:38 +00:00
S2 of docs/plans/opentui-transcript-windowing.md (#27), behind HERMES_TUI_WINDOWING (OFF path renders the byte-identical legacy tree). Append-time adjudication: the window now recomputes on transcript GROWTH, not just scroll — a createComputed on messages.length re-windows synchronously per append, and while pinned at the bottom computeWindow anchors to the cumulative content BOTTOM (pinnedBottom) instead of the stale pre-layout scrollTop, so burst-appended rows are spacer-swapped the moment they pass the margin. The frame driver additionally treats a ≥ ¼-viewport scrollHeight change (streaming growth) like scroll movement. Unseen-row default changed from "always mounted" to "mounted iff created streaming or within the bottom-30" — live rows still paint instantly with zero added latency; a bulk commitSnapshot (resume) mounts ONLY the bottom window and everything above starts as line-count-estimate spacers (chip- and-spacing-aware estimateMessageHeight). Spacer corrections (zero-jank rule): when a measure lands a height different from what the spacer occupied, the wrapper's onSizeChange fires inside the layout traversal, pre-paint. Pinned at bottom the scrollbox's own sticky re-pin (content onSizeChange runs before the row wrappers') already compensated — verified by test; otherwise scrollTop is compensated same-frame for rows fully above the viewport (correctionIsLegal). Frames stay byte-stable across corrections in both pinned and mid-history tests. Lazy exact-measure (design §4 — the simple choice, documented): no true offscreen layout exists in @opentui/core, so an idle pulse (no appends, no scroll, no turn, no selection for HERMES_TUI_WINDOW_IDLE_MS≈1s) mounts MEASURE_BATCH_ROWS=10 never-measured rows nearest the bottom window edge (edgeMeasureBatch), records exact heights (incl. a direct post-layout pull for rows whose mount changed nothing — no onSizeChange fires), and the next recompute swaps them back to now-exact spacers. Scrolling itself still measures the margin band. DEV counter: windowRowStats (current/peak simultaneously-mounted rows), exposed on globalThis behind HERMES_TUI_WINDOW_STATS; tests assert it. Measured (this build, 39f9f433e+S2): - check: exit 0 (647 tests / 39 files; +11 pure window cases, +4 headless) - peak mounted: 31 rows over a 1500-row burst; 30 rows on a 600-row resume snapshot (bound asserted < 120) - gate digest: otui-capped d5e9558583159eac… — byte-identical, 2/2 reps - mem2000 (otui-capped, windowing ON, 8GB heap): vmhwm 300MB (S1 same-heap 518MB; S1 right-sized-heap 427MB; Ink 229-239MB; target ≤ 350MB) - scroll2000 otui-capped: p50 2.0ms / p99 5.0ms / max 18ms (gate ≤ 17ms p99; S1 baseline p99 15ms) Known S2 limits (deferred to S3, design §5): /compact·/details toggles and width resizes leave out-of-window spacer heights stale until remount or the idle march; expanded-body state above the window may re-collapse on remount (S1-accepted). |
||
|---|---|---|
| .. | ||
| scripts | ||
| src | ||
| .gitignore | ||
| .prettierrc | ||
| eslint.config.mjs | ||
| package-lock.json | ||
| package.json | ||
| tsconfig.json | ||
| vitest.config.ts | ||