Skip to content

feat: inspect generic conversation records#7

Merged
siriusctrl merged 9 commits into
mainfrom
agent/conversation-json
Jul 22, 2026
Merged

feat: inspect generic conversation records#7
siriusctrl merged 9 commits into
mainfrom
agent/conversation-json

Conversation

@siriusctrl

@siriusctrl siriusctrl commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • link nested typed tool results to earlier calls while preserving exact argument tokens and unknown fields
  • collapse explicitly typed inline base64 media only in the interactive display with bounded validation and decoded-size summaries
  • add bounded immutable raw-record snapshots with search, wrap, follow-safe background refresh, and structured/raw toggling
  • document the fmtview-core ownership boundary and add real-terminal conversation verification scenarios

No application storage types or paths are introduced; terminal lifecycle remains in the outer fmtview package.

Fresh review

Independent review PR #8 found and fixed five blockers before this PR was marked ready:

  • false media inference and mixed standard/base64url alphabets
  • duplicate nested-result versus role-tool envelope links
  • lazy raw views rereading mutable source bytes
  • terminal scroll hints crossing structured/raw content spaces
  • invalid UTF-8 boundary adjustment exceeding the documented three-byte cap

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 --check
  • cargo 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 warnings
  • RUSTDOCFLAGS=-Dwarnings cargo doc --workspace --no-deps
  • cargo publish -p fmtview-core --dry-run --locked
  • 16 MiB media load after immutable raw spooling: 48.023 ms median; formatted display spool 58 bytes / 3 lines
  • fresh Kitty/Xvfb long-record r -> j x48 -> r: raw moved 20% to 53%; structured screen before/after was byte-identical
  • durable PTY: exit 0; alternate screen 1/1; synchronized output 5/5; mouse 1000/1002/1003/1015/1006 each 1/1; exact raw and restored structured screen markers passed
  • final GitHub CI: run 29906904695 passed

Local 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 plus pty.log, pty-check.json, and reconstructed raw/structured screens.

Streaming limits

  • sibling metadata must precede data for bounded streaming recognition
  • escaped data-URI headers remain uncollapsed
  • raw search intentionally does not match across an artificial 32 KiB chunk seam

These limits are documented and do not affect redirected token-preserving JSONL output.

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
siriusctrl marked this pull request as ready for review July 22, 2026 09:13
@siriusctrl
siriusctrl merged commit 23a4c28 into main Jul 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant