feat: inspect generic conversation records#7
Merged
Conversation
Recognize typed tool_result and function-result objects inside generic conversation content arrays and match their IDs against earlier typed tool calls. Add a schema-neutral conversation fixture and exact-token CLI assertions so embedded tool arguments and unknown metadata remain intact.
Add a viewer-only streaming JSON formatter that recognizes high-confidence data URI and same-object base64 media, validates payloads without decoding, and writes a compact decoded-size summary. Redirected output and non-media strings retain their exact source tokens. Keep formatted media spools bounded for large records and add focused correctness plus 16 MiB load benchmark coverage.
Add a ViewFile seam that opens exact source or spool ranges as chunked raw record views without copying an entire record into viewer state. Keep line-to-record mappings stable across lazy loading, older prepends, appends, and replacement resets, while already-open views retain their original snapshot.
Let record-stream viewers open the current exact source record as a bounded chunked overlay with the r key, then return to the structured display without involving the terminal backend. Preserve follow refreshes and detached anchors behind the snapshot, synchronize wrap and mouse-capture state on return, and exercise raw search, resize, reset, and quit behavior headlessly.
Document nested tool relations, bounded raw snapshots, and viewer-only media summaries. Add a pretty multi-line headless regression test for exact tool-pair navigation.
Add a real-emulator scenario for tool-pair navigation, raw records, media summaries, search, and wrap.
Open the raw record containing an active search match before falling back to the viewport top. Cover the case where both records remain visible and the viewport never moves from the first record.
Blockers addressed: - require explicit media typing and validate standard versus URL-safe alphabets - suppress duplicate tool-result envelopes while preserving canonical fallbacks - snapshot lazy raw records so source rewrites cannot change an open record - force a full redraw when switching structured and raw content spaces Invariants preserved: - redirected output and tool arguments remain token-preserving - media payloads stay streaming and decoded-size-only in the display spool - raw record reads remain bounded to 32 KiB plus at most 3 UTF-8 boundary bytes - terminal lifecycle stays outside fmtview-core
fix(viewer): harden conversation record inspection
siriusctrl
marked this pull request as ready for review
July 22, 2026 09:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fmtview-coreownership boundary and add real-terminal conversation verification scenariosNo application storage types or paths are introduced; terminal lifecycle remains in the outer
fmtviewpackage.Fresh review
Independent review PR #8 found and fixed five blockers before this PR was marked ready:
The review also locked canonical tool-link fallbacks, JSON-escaped media payloads, source rewrite snapshots, and long-record redraw behavior with adversarial tests.
Verification
cargo fmt --checkcargo test --workspace --all-targets --no-fail-fast(root 8; CLI 39; core 255 / 11 ignored perf; headless 8; timeline 43)cargo clippy --workspace --all-targets -- -D warningsRUSTDOCFLAGS=-Dwarnings cargo doc --workspace --no-depscargo publish -p fmtview-core --dry-run --lockedr -> j x48 -> r: raw moved 20% to 53%; structured screen before/after was byte-identicalLocal fresh-review evidence is under
target/fmtview-emulator-recordings/raw-scroll-review-d80e725-3/in the review worktree. It includes the Kitty video/contact sheet and text snapshots pluspty.log,pty-check.json, and reconstructed raw/structured screens.Streaming limits
datafor bounded streaming recognitionThese limits are documented and do not affect redirected token-preserving JSONL output.