Skip to content

feat(native): transcript rows and streaming markdown at web fidelity - #17

Merged
rynfar merged 6 commits into
nativefrom
nw/w1-transcript
Nov 2, 2026
Merged

rynfar merged 6 commits into
nativefrom
nw/w1-transcript

Conversation

@rynfar

@rynfar rynfar commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Problem

The native transcript drew one plain row per turn item: no work groups, no folds, no live activity, and markdown that reparsed the whole message on the UI thread for every streamed token.

Approach

Row model in t3-core (#7). crates/core/src/timeline/ ports the web pipeline as pure Rust:

  • entries.rs: visible turn items to timeline entries (session-logic.ts deriveTimelineEntriesFromVisibleTurnItems / projectedWorkEntry), with attempt resolution through nodes. Entries are cached by item Arc, so an update rebuilds only the items that changed.
  • rows.rs + folds.rs: deriveMessagesTimelineRows: work groups ("Ran 2 commands and changed 1 file"), single-tool rows, Worked-for / You-stopped / Continued-for turn folds, superseded-attempt folds, the shared live activity row, Working and Thinking rows, compaction rows, subagent batches, created-thread summaries, assistant-meta after trailing tool groups, and grouping of consecutive own messages and steers.
  • presentation.rs, tool_activity.rs, user_input.rs: work-log/presentation.ts, toolActivity.ts, commandLabel.ts (common paths), userInput.ts, plus liveThoughtLine, compaction labels and icons.
  • activity.rs: latest/activity run, working state and pending approvals from the projection (threadExecution.ts, threadRequests.ts).

Per-token cost: entries memoize their failure scan and tool action, and a token that only grows one streaming assistant message patches the previous rows (replaceStreamingMessageRows) instead of re-deriving.

Rendering (crates/app/src/transcript/, design system §7.5–§7.8). transcript_row.rs is replaced by a module: work rows with icon slot, hover timestamp and chevron that open to command input/output, file-change path and +/- stats, search patterns/results, dynamic-tool arguments and output, todo steps, question answers; group headers that expand into a bounded scroll list; live and Thinking rows; folds; user bubbles (80% lane, grouped corners, "Show full message" collapse at 176px with fade, steer marker, "Sent by T3 Code", model-switch divider, attachment names, hover timestamp + Copy); assistant prose with hover meta (status pill, Copy, timestamp); proposed plan card (title, badge, Copy, Expand plan); lifecycle dividers (interrupted, handoff, fork); subagent rows/groups that open the child thread; secret and link request cards in waiting and answered states; approval rows showing "Waiting for approval" (the actions stay with the composer).

Markdown (#8). I kept gpui-component's TextView rather than writing a renderer tonight: it already has block-level selection across a message, tables, lists, blockquotes and links, and its push_str reparses only the last block on a background task. MarkdownStore appends with push_str when new text extends the old (full set_text only for real replacements), creates states lazily for rows that render, and bounds the cache (LRU halving past 400). Code blocks use the design-system frame with a mono language label and Copy, highlighted by tree-sitter (13 languages enabled); styles are cached per block, so settled blocks never re-highlight. Links use info_foreground.

Icons. Lucide SVGs vendored from lucide-react 0.564.0 with the web's strokes baked in (1.75; 2 under stroke-2/ for work rows), served by icons::Assets. The files overlapping with the diff worker's vendored set are byte-identical.

Shared files touched minimally: main.rs (two mod lines, with_assets), core/lib.rs (pub mod timeline), app/Cargo.toml (tree-sitter features, chrono for local timestamps), theme/mod.rs (link color), turn_item.rs (optional wire fields, placed clear of the wire-body work in flight).

Ledger

TR-GROUPING, TR-WORK, TR-REASONING (#7); TR-MARKDOWN, TR-ASSISTANT (#8); TR-USER, TR-PLAN, TR-TODO, TR-APPROVAL, TR-INPUT, TR-SECRET, TR-LIFECYCLE. TR-REASONING and TR-TODO are done; the rest partial.

Verification

  • cargo test -p t3-core -p t3-client: 34 tests, including web cases (terminal-message copy, Worked-for folds, trailing activity folding unless failed or live, live row ownership, group summaries, steer grouping), a synthetic showcase fixture, and a captured devReplay stream checking that incremental derives match a fresh derive at every frame. cargo clippy --workspace --all-targets -D warnings, gen-theme --check, parity/sync.test.ts pass.
  • Read-only sweep of the real-data server (timeline_sweep, counts only): 59 threads, 13,558 visible items, 3,559 rows, 0 empty labels, no decode errors. Cold derive peaks at 6.7 ms (1,855 items); warm derive at 2.6 ms before the streaming fast path, which reduces a token to a pointer comparison over the entries.
  • Smoke server probe:
    status: Connected
    thread mcp:d91b633e-…: snapshot seq=1299 items=19 visible=19
    thread mcp:d91b633e-…: Synchronized
    timeline_sweep: threads=7 visible_items=186 rows=121 empty_labels=0
    slowest warm derive (per streamed update): 34µs for 127 items
    
  • The app starts and renders the showcase thread with no panics or warnings. Screenshots could not be taken in this session (no Screen Recording permission), so before/after captures are still needed.

Known gaps

  • Omitted command and tool output (outputOmitted) shows "Output not loaded." Fetching it needs orchestration.getTurnItem through ClientHandle::request, which the composer worker is adding. This is the last piece of Transcript work groups and tool rows at web fidelity #7's "expanding a command shows its output", so neither issue is closed here.
  • Not ported: T3 MCP tool labels (t3McpToolPresentation.ts), deferred-work loading for collapsed history, HTML/MCP-app frames, worktree setup rows, revert targets and per-turn diff cards, idle-resume compaction titles, images and file previews in bubbles, Edit/Fork buttons, provider icons in handoffs, mermaid/math/alerts, the 600ms block fade and the running shimmer (rows render static, which §9 allows).
  • Streaming a long code block re-highlights that block once per parse update on the UI thread; settled blocks are cached.

Visible turn items become timeline entries and then rows with work groups, turn and attempt folds, live activity, working/thinking rows and assistant meta, ported from MessagesTimeline.logic.ts, session-logic.ts and the client-runtime work-log presentation. Adds the optional turn-item wire fields those rules read, and a dump_thread example for building fixtures.
Entries memoize their failure and tool action, and a streamed token that only grows one assistant message patches the previous rows instead of re-deriving, as the web's replaceStreamingMessageRows does. A captured replay stream checks that incremental derives match a fresh derive at every frame. timeline_sweep derives every thread on a server read-only and reports row kinds and derive time.
Rows from t3_core::timeline render as the web lays them out: grouped work rows that open to command, file-change, search and tool details, live activity and Thinking rows, Worked-for folds, user bubbles with long-message collapse, steer and model-switch markers, assistant prose with hover meta and Copy, proposed plan cards, todo rows, lifecycle dividers, subagent rows and request cards in their waiting and answered states. Markdown uses gpui-component's TextView: streamed text appends with push_str (background reparse of the last block), code blocks get tree-sitter highlighting, a language label and Copy. Lucide icons are vendored at the web's version with its strokes.
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