Skip to content

feat: scrollable transcript viewer for the interactive share wizard#88

Merged
kai-rayward merged 1 commit into
rayward-external:mainfrom
lwshanbd:feat/transcript-viewer
Jun 19, 2026
Merged

feat: scrollable transcript viewer for the interactive share wizard#88
kai-rayward merged 1 commit into
rayward-external:mainfrom
lwshanbd:feat/transcript-viewer

Conversation

@lwshanbd

@lwshanbd lwshanbd commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Closes #89

Problem

clawjournal share --interactive dumped full transcripts straight to stdout, overflowing terminal scrollback so long transcripts couldn't be reviewed.

Change

Adds a modal, scrollable transcript viewer and routes the two full-transcript views through it.

  • transcript_viewer.view_transcript() — a full-screen pager on a read-only, buffer-backed prompt_toolkit TextArea. (A buffer is required to scroll: a cursorless control snaps the scroll position back every render.) Mouse wheel, arrows, PgUp/PgDn, and Home/End all work; q / Ctrl-C exit. The user/assistant role labels keep their colors via a small lexer.
  • Never aborts the share flow — falls back to the plain dump whenever a TUI can't run (stdin or stdout not a tty, prompt_toolkit unavailable, dumb $TERM, or a malformed session), leaving a one-line stderr breadcrumb instead of failing silently.
  • Terminal-escape hardening — strips C0/DEL control characters from displayed message content so escape sequences in (untrusted) agent logs can't manipulate the reviewer's terminal; applied in _transcript_lines, covering both the pager and the plain dump.
  • Extracts a pure _transcript_lines() helper from render_transcript; adds prompt_toolkit>=3.0 (imported lazily); wires the step-2 redact preview and step-3 [v]iew calls (the short inline previews are unchanged).

Testing

Full suite green (2275 passed). New tests cover the scroll-and-hold regression (real Down keys, cursor advances & holds), mouse-wheel scrolling, Home/End, the lexer wiring, escape stripping, zero-message sessions, and the non-tty / missing-dep / malformed-session fallback paths.

🤖 Generated with Claude Code

The `share --interactive` wizard dumped full transcripts straight to
stdout, overflowing terminal scrollback so long transcripts couldn't be
reviewed. Add a modal, scrollable viewer and route the two
full-transcript views through it.

- transcript_viewer.view_transcript(): a full-screen pager built on a
  read-only, buffer-backed prompt_toolkit TextArea. A buffer is required
  to scroll — a cursorless control snaps the scroll position back on
  every render. Mouse wheel, arrows, PgUp/PgDn, and Home/End all work;
  q / Ctrl-C exit. Message text is plain; the user/assistant role labels
  keep their original colors via a small lexer.
- Falls back to the plain dump whenever a TUI can't run (stdin or stdout
  is not a tty, prompt_toolkit unavailable, or any runtime error) so the
  share flow is never aborted — even on a malformed session.
- Extract a pure _transcript_lines() helper from render_transcript and
  reuse it for both the dump and the pager.
- Add prompt_toolkit>=3.0, imported lazily.
- Wire the step-2 redact preview and step-3 [v]iew calls in share_cli to
  the viewer; the short inline previews are unchanged.

Hardening from PR review:
- Strip C0/DEL control characters from displayed message content so
  terminal escape sequences in (untrusted) agent logs cannot manipulate
  the reviewer's terminal — applied in _transcript_lines, covering both
  the pager and the plain dump.
- Emit a one-line stderr breadcrumb when the viewer falls back, so the
  "never abort" degradation is diagnosable rather than silent.
- Narrow the tty-helper excepts to (AttributeError, OSError); document
  prompt_toolkit as a hard dependency; add tests for mouse-wheel scroll,
  Home/End, the lexer wiring, escape stripping, and zero-message sessions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lwshanbd lwshanbd marked this pull request as ready for review June 19, 2026 20:06
@kai-rayward kai-rayward merged commit 24a7e37 into rayward-external:main Jun 19, 2026
5 checks passed
@kai-rayward

Copy link
Copy Markdown
Collaborator

Thanks @lwshanbd !

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.

Interactive share wizard dumps full transcripts to the terminal (can't review long ones)

2 participants