Skip to content

feat(tui,agent,cli,mobile,desktop): a git panel, picture previews, crash-safe journals - #1384

Merged
huichen merged 68 commits into
mainfrom
pr/huichen
Oct 27, 2026
Merged

huichen merged 68 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

This branch is one developer's accumulated work on the TUI workbench. The files panel moves off the rail into a surface of its own and a git panel joins it, the picture preview gains buttons, drag and sharp zoom, and the rail, composer and transcript shed the padding they were carrying. Alongside it the agent folds run journals a crash left behind, the CLI gains verbatim dispatch from a file, and desktop and mobile both preview pictures properly.

Commits

  • fix(mobile): a long line pans instead of folding the code block
  • fix(tui): apply the model row that was picked when two providers share its id
  • fix(rpc): give the journal report the maintenance deadline
  • docs(guide): measure run-journal cost and the reclamation procedure
  • fix(tui): the rail opens to 60 columns, not 48
  • feat(cli,agent): add --message-file for verbatim programmatic dispatch
  • fix(agent): map thinking levels onto each model's declared effort vocabulary
  • feat(desktop): step through a folder's images in the preview, and read them at 1:1
  • fix(tui): the rail's arrows switch tabs in the files view too
  • feat(tui): reasoning starts collapsed, like the desktop
  • feat(tui): a framed user bubble instead of a full-width band
  • fix(tui): the activity row follows the session, and counts a call once
  • docs(screenshots): a sheet for the user bubble's hairline, with and without
  • feat(tui): the rail's recent list splits into active and earlier, with a spinner
  • fix(tui): the conversation starts under the header's rule, with no gap row
  • fix(tui): the composer's box is as tall as its draft, not as tall as the cursor
  • feat(tui): delete a conversation, with a chord and a confirm box
  • refactor(tui): drop linear reading
  • feat(tui): colour a previewed file by its language
  • feat(mobile): preview any picture in the conversation, and send pictures as pictures
  • refactor(tui): drop the density preference, always draw the two-row header
  • feat(tui): a rail that repeats neither its title nor a band of its own
  • fix(tui): shift+left/right walks the rail's three tabs, shift+up/down the conversations
  • feat(tui): a git panel for the workbench
  • feat(tui): a user bubble that is only its background
  • fix(agent): a settled run's journal is foldable when its stream was cut off
  • feat(agent): a bounded startup catch-up folds what a crash left behind
  • docs(guide): the fold admission rule, the catch-up, and the second measurement
  • feat(tui): the files panel moves out of the rail into its own surface
  • feat(tui): the prompt is a full-width band again, not a bubble
  • feat(tui): buttons and drag in the picture preview, and sharp zoom
  • fix(tasks): give a run with no answer a reason instead of completed

Verification

Run in a throwaway worktree at the branch tip, with rustc/clippy 1.99.1 from rustup (Homebrew's 1.96 shadows the PATH) and ulimit -n 8192:

  • cargo fmt --all -- --check clean
  • cargo clippy -p future-agent -p future-cli -p future-tui -p future-rpc --all-targets -- -D warnings clean
  • cargo clippy -p future-host -p future-cli -p future-agent -p future-tasks --all-targets -- -D warnings clean (re-run at the final tip, which gained one fix(tasks) commit after the first pass)
  • cargo test -p future-tui --lib 1381 passed
  • cargo test -p future-cli --lib 1446 passed
  • cargo test -p future-agent --lib 2528 passed, 4 failed: sandbox::tests::session_allow_takes_effect, sandbox::windows_plan::tests::allow_write_rule_lands_in_writable_allow_read_does_not, tools::tests::enabled_scope_rejects_unapproved_absolute_outside_write, tools::tests::scoped_workspace_rejects_symlink_escape. Each of them passes in isolation, the failing subset changes between two full runs (7 then 4), and this branch touches no sandbox or write-scope source — an order/environment-dependent shape, not this PR's code.
  • cargo test -p future-rpc clean

Notes

  • TUI: the density preference is gone and the two-row header is always drawn; linear reading is removed; reasoning starts collapsed.
  • TUI: the rail's recent list is split into active and earlier, the files panel moved off the rail into its own surface, and the rail opens at 60 columns.
  • Agent: a run journal a crash left behind is folded by a bounded startup catch-up, and a settled run whose stream was cut off is foldable.
  • CLI: --message-file sends a prompt verbatim, for programmatic dispatch.
  • Desktop and mobile: pictures are previewed in place, stepped through within their folder, and sent as pictures.

A code block's layout is its meaning. Folding a line onto the next one
shifts every column after the fold, so box-drawing art, an aligned table
and a paste of a TUI screen all come out scrambled: on a phone the
launchpad capture `│ |> [Image #1][Image #2] … │` lost its right border
onto a second line and the frame below it no longer closed.

The block now sits in a horizontal ScrollView with the gutter on its
scrolling content, and the virtual rows of a long block stack in a column
(a horizontal ScrollView's content is a row, which would have put them
side by side). A sideways pan is not contended for by the surrounding
message list — the tables in the same file already rely on that — while
the nested *vertical* viewport the old comment warned about stays gone;
the expand toggle is still what makes a long block's tail reachable.

This also matches the desktop, whose `<pre>` scrolls sideways instead of
wrapping (`desktop/src/features/markdown/renderers/CodeBlock.tsx`), so the
same reply now reads the same on both.

Measured in the mobile harness (390×844, headless Chrome, a fenced box-art
capture appended to the demo reply): the painted height divided by its
line height is 5 for a 5-line source — no line folded — and the scroller
carries 81 CSS px of horizontal overflow (scrollWidth 431 vs clientWidth
350) inside a 350 px column. Jest: 150 suites / 2889 tests pass.
…e its id

The model picker keyed its rows by the bare model id, and `enter` sent that
id straight to `set_model`. With two providers offering one id — `future`'s
`deepseek-flash` and a `models.json` `westlakehpc/deepseek-flash` — the row
picked and the model set were decided by the agent's own resolution order
(user-defined models before the built-in catalogue), so choosing the `future`
row left the session on `westlakehpc/deepseek-flash`.

Rows now carry the `provider/id` reference the desktop and phone clients
already send, which is also the canonical spelling the agent persists. The
launchpad's model chip and the model lookups behind the thinking-level ring
resolve a reference (exact match first, bare id/tail only as a fallback) and
cycle over references, so a staged choice names the same model the row did.
The run-journal report scans the table it reports on: it sums the
payload length of every run_events row, so its cost follows the one
table that grows without bound. Measured on a real 4.4 GiB store:
23.8 s for the first, cold, report, and an earlier cold run hit the
30 s STORAGE_TIMEOUT and printed 'Timeout expired' — the diagnostic
failing on the database it exists to diagnose.

Class it with the reclamation next to it (60 s) instead, and pin the
invariant in a policy test. The cheap indexed reads must not follow it
there, which the same test asserts.

Also pin the sweep's own red line in a store test: entries and
message_blocks are byte-identical across a reclamation.
A 4.4 GiB agent.db was 76% run_events plus its uniqueness index, and
the reads around it were not slow at all: session list, get_state and
transcript measured the same at 4.4 GiB and 1.3 GiB. What was unbounded
is the journal itself — only a completion notification folds it, and
135 of 1,166 settled runs still held their raw stream.

Record the measurement, what the sanctioned sweep does and does not
touch, the one-off VACUUM (5.4 s, 4.22 -> 1.30 GiB) with its lock and
disk requirements, the backup/restore path, and the leftovers: 50
journals that never got an agent_end, 179 MiB, kept by design.
The divider stopped at 48 whatever the terminal width, so a file or a
session row read in the rail was clipped to a column count the reader
could not widen. The ceiling is now 60, which still leaves the
conversation more than its 20-column floor at the narrowest frame that
shows a rail (88 - 60 - 1 = 27).
`future run` had one way to carry a message from a file: `@<file>`, which
wraps the content in a `<file name="…">` block. That shape is right for a
human attaching a file in a terminal, and the agent guideline told every
programmatic dispatch (agent → agent, sub-session hand-off) to use it for
long or non-ASCII payloads — so a dispatched child's first user turn was a
file attachment rather than the instruction, and the title derived from that
turn started at the wrapper. `host/src/agent_bridge/import.rs` already
carries a patch for exactly that symptom.

- `--message-file <path>`: the file's bytes ARE the message — no wrapper, no
  joining, nothing trimmed. Mutually exclusive with a message argument and
  `@files` (a usage error, not a silent winner). Empty/whitespace-only,
  unreadable, non-UTF-8 and NUL-bearing (binary) files each fail with their
  own message instead of sending nothing or truncating.
- `@<file>` is untouched, byte for byte: same wrapper, same semantics.
- The agent guideline now points programmatic dispatch at `--message-file`
  and says why `@<file>` is the wrong shape for it; the docs (wiki CLI in
  both languages, and the self-inspection guide's dispatch section) say the
  same.
- The generic "No prompt provided" line no longer stacks on top of a failed
  read, so the reported reason is the only one printed.

Verified live: a child session dispatched with `--message-file` stored the
file's text verbatim (207 bytes, byte-identical) with no `<file` in its first
user entry, and a session created that way was titled from the instruction's
first line.
…abulary

`westlakehpc/deepseek-flash` answers `reasoning_effort: "medium"` with
HTTP 400 ("DeepSeek V4.1 reasoning_effort must be low, high, xhigh, max,
or an integer within [1, 100] in chat_template_kwargs"), because the level
was sent verbatim: `thinkingLevels` named the picker's levels, not the
values that access path accepts. Any model at `medium` failed 100% of the
time, and `medium` is one of the shipped levels.

Which values a model accepts is now data. A model (or its provider) can
declare `compat.reasoningEffort`:

  { "values": ["low", "high", "xhigh", "max"],
    "integer": {"min": 1, "max": 100},
    "param": "chat_template_kwargs.reasoning_effort" }

and each thinking level is mapped onto it, monotone and without dropping a
level: a listed spelling travels as itself; an unlisted level travels as
the integer at its own point of the provider's range (`medium` -> 50 for
1..=100, the midpoint, because the provider accepts a number but no such
spelling); with no integer range it snaps to the closest spelling, ties
going shallower (never more effort than the user chose). `param` exists
because this gateway accepts the spellings at the top level but a number
only under `chat_template_kwargs` (a top-level integer is a 500). A
malformed declaration fails model resolution, and a level the vocabulary
cannot express is named in a deduped warning when the model is resolved,
instead of surfacing as a provider 400 after the user waited a request.

Without `compat.reasoningEffort` every model keeps the previous contract
(levels are wire values, sent verbatim), so the built-in catalogue is
unchanged. `default` still sends nothing and `off` still sends the
protocol's disable spelling; neither is used to paper over a refusal.

Tests cover the failure shape end to end, every chat format plus the
Responses API, the mapping rules and parse errors, and a sweep over every
registered model at every level it offers, asserting the value on the wire
is one the model declares it accepts.
…d them at 1:1

Opening a picture from the right-hand Files panel showed one image at a time,
so comparing a folder of figures meant closing the overlay and finding the next
row by hand. The control bar also reported a percentage relative to "fit", which
said 100% for a screenshot that was really being drawn at a third of its pixels —
the number could not tell you whether you were looking at the real thing.

- The bar now leads with <-/-> and a "2 / 5" readout that walk the images of the
  directory the row was opened from, in the tree's own order; the arrows disable
  at the ends, and Left/Right do the same from the keyboard. The list comes from
  the listing the row was drawn from, so no extra read. A folder with one image,
  or a preview that is not a picture, shows no stepping at all.
- The percentage is now the picture's real scale against its own pixels, and a
  1:1 button jumps to it (double-click still toggles fit <-> actual size). "Fit to
  window" replaces "Reset zoom", which no longer describes what that button does
  now that 1:1 sits beside it.
- MAX_SCALE rises from 6x to 12x of fit so 1:1 stays reachable for very large
  images, whose fit is a small fraction (an 8000px screenshot in a 1200px window
  fits at 0.15).
- The picture carries a hover hint — scroll/double-click to zoom, drag to pan
  once zoomed — because dragging at fit cannot move anything (the whole picture
  is already on screen) and that reads as "drag is broken".
A focused rail answers ←/→ with its neighbour tab, and its own hint row says
so (`… · ←→ 页签`) — except on 文件, where the arrows had been given to the
tree. There they did nothing at all on a file or on a closed top-level
directory, and `→` on a file dropped a preview over the whole screen, so the
third tab read as a dead end: the only ways out were `ctrl+1`…`ctrl+3` or the
pointer.

←/→ are the strip's on all three tabs again. The tree keeps the keys that are
its own: ↑↓ walk, `enter` opens a directory or previews a file, and `⌫` closes
a directory or walks up to the one holding the row — the "up one" every file
browser has. 文件's hint row names that key (`↑↓ · ⏎ 打开 · ⌫ 收起 · ←→ 页签`),
which is the only place it can be discovered, and the other two tabs never
claim it.

Tests: ←/→ return `SwitchPanel` from four different tree rows (a file, a closed
directory, an open one, a picture); `⌫` closes an open directory and climbs out
of a nested row; the footer names `⌫` only on 文件.
The transcript printed the model's reasoning text in full by default, so a
streamed reply spent the screen on its own thinking and pushed the answer it
had just written off the bottom. The desktop and the phone both start a
`Thinking` block collapsed; the terminal was the one client that did not.

Reasoning now keeps one `▸ thinking` row at the default level — with the count
in the compact view, and the ellipsis only while the reasoning itself is still
arriving — and the text lives at the full-process level, so `ctrl+e` alone
answers "what did it think?". `render_all_detailed` (the `/transcript` record)
reveals it too. The old placeholder hint said `ctrl+o`, which in the workbench
opens Preferences, so it is gone with the placeholder.

A settled reply already folded to the answer it ends on; that path is
unchanged, and the streaming/folding tests now pin the collapsed reasoning
alongside it.
A prompt used to be one full row of grey: the background started at the
transcript's left edge and ran to its right edge, so the reader's own words
looked like a highlight rather than a message, and two prompts in a row read
as one striped block.

The prompt is now a bubble, the same shape the desktop draws: a rounded frame
in the palette's accent, `user_bg` filling only what the box covers, one column
of padding either side, right-aligned with a column of margin. It hugs its own
text (`hi there` gets a 12-column box, not a 120-column bar) and stops at 64
columns, which is the desktop's `max-w-2xl` inside `max-w-3xl` proportion.

The run state (`queued (#2)`, `cancelled`, `merged into the previous run`) moves
inside the bubble as its last row — it describes that prompt, and the box now
holds everything about the message and nothing else. A column too narrow to
frame (under 13 columns of bubble content) keeps the old band, because two
borders and two padding columns there would leave almost nothing for the words.

Tests: the transcript-row helpers now read *through* the frame (a body row
gives back its words, the border rows drop), since fold/seam/spacer assertions
are not about the box; three new tests pin the box itself — geometry and right
alignment, the width cap with a wrapping prompt, and the narrow-column
fallback.
The footer's `思考 · 1071s · 53 工具` belonged to whichever conversation this
client last narrated, not to the one on screen: `Live`'s run state (kind,
clock, tool tally, rate) is the client's own and nothing dropped it when the
reader clicked another row in the rail, so the conversation they had left kept
counting there for as long as the TUI stayed open.

- `switch`, a fork and `/new` now forget the run this client was narrating
  (`Live::forget_run`), and the newly attached session takes the row back:
  `get_state`'s `isStreaming` says whether its run is still in flight, which is
  what makes a conversation started by the desktop (or by a queued run) show
  the spinner instead of `idle` until its next event.
- `53 工具` was also twice the truth. The agent announces one call twice
  (`phase: "input"` while its arguments stream, `phase: "execution"` when it
  runs) and `add_tool_start` dedupes the row, but the counter incremented per
  event — 26 calls read as 52, and `tool_end` only took one phantom back. The
  tally is now a set of call ids, and it is a tally for the run (what the row
  and the demo's `2 tool calls` both say) rather than a count of the calls still
  open, which would read `0` while the model thinks.

`docs/guide/tui.md` says what the row means, since that ambiguity is what let
both of these sit: the row describes the conversation on screen, counts one
call per call, and starts over at a switch.
…ithout

The user's own messages in a conversation are drawn as a filled bubble with a
1px accent hairline around it. Whether that hairline earns its place is a
judgement about a soft edge, so it wants two panels of the same frame rather
than an argument: `user-bubble-border-variants` renders the first user message
with the border and with the border's colour taken out, injecting a stylesheet
so a re-render cannot put the hairline back, and rejecting the capture if the
bubble is not fully on screen — a sheet framed on the wrong element would
otherwise look plausible.

The window is 900 wide and the frame is scrolled last: two 1280 panels halve a
2x capture, and the fixture's approval card settles after boot, which moved the
bubble under an earlier scroll.
The desktop's recent view files a conversation whose run is still in flight
above the ones that have gone quiet, and marks the running row with a
spinner. The rail had one flat list, so a run started from another client (or
a `/future-goal` worker on the same agent) was invisible here.

最近 now leads with an 活跃 stretch and follows with 更早, each captioned with
how many conversations it holds — the desktop's caption in the rail's shape.
The two headings are only drawn while both stretches are non-empty: with
nothing running the whole list *is* 更早, and a heading saying so would spend
one of the rail's twenty rows on nothing. A running row draws the activity
row's spinner in its state slot (`SessionRow::streaming`, from the agent's own
`isStreaming`); the conversation on screen keeps its `▸` while it is quiet and
yields the slot while it runs, because its title is already the accent one.

Two things had to follow the flag. The rail's list is re-read every five
seconds while the rail is on screen: the agent pushes events for the attached
session only, so another client's run reaches this surface no other way, and
without it the spinner would freeze mid-turn and 活跃 would never empty. And
the tick clock now animates for the rail as well as the activity row, each
gated on its band being laid out.

Verified on a real pty against the demo agent: the frame shows
`活跃 1` / `更早 2` with the spinner on the running row, and the spinner turns
through all ten frames at the designed two a second (an earlier `paint |= …`
kept a frame owed on every tick, which measured as eight).
…p row

The tall layout put the conversation one row below the header
(`body_y = header_h + 1`), leaving a row no band paints: title, hairline, a
blank line, then the transcript. It cost the conversation a row on every
frame, and the frame diagram in `docs/guide/tui.md` draws the transcript
directly beneath the hairline, so that gap was the one band nobody could name.

The body now starts on `header_h`. Every frame row belongs to a band, and
`the_bands_tile_the_frame_without_overlap_or_holes` says so outright
(`blank == 0`) instead of allowing one. The rail moves up with it — its tab
strip is row 2, not row 3 — so
`the_rail_button_collapses_and_reopens_from_the_edge` is pinned to the frame's
new shape.
…the cursor

A draft typed with ctrl+j lost its closing rule as soon as the reader moved
back up a line: the band grew by the cursor's row while the box painted every
row of the draft, so the box was taller than the band and its *last* row — the
closing rule — was what got cut off.

The height now comes from the box itself (widgets::input_content_rows, sharing
one window calculation with input_box), measured at the width the box paints
at, and the composer passes that room back in so a draft taller than the window
scrolls inside the box instead of overflowing it. The hardware cursor follows
the row the box reports instead of assuming the draft's last line, and the key
handler's line width is the box's own (-4, not -6): one definition of the
draft's width for painting, moving and measuring.
`future tui` had no way to remove a conversation: the rail only opened rows,
`ctrl+r` only switched, and the palette had no verb for it — the agent's
`delete_session`, the desktop's thread menu and the client's own
`GrpcClient::delete_session` had no surface here.

`ctrl+d` is now a rebindable action (`deleteSession`, listed in the shortcut
editor and the help overlay), `/delete` is the palette's door to it, and
`delete` in a focused rail opens the same box for the row under the cursor.
None of them deletes: the box names the conversation and where it lives, and
its `enter` is what asks the agent.

Deleting the conversation on screen opens the row that took its place, so the
transcript never stays on a session the agent no longer has; the last one
detaches to the launchpad. A refusal (the agent keeps a session a compaction
holds) leaves everything as it was and says why on the notice row.
`/git` (or `alt+g`) is a read-only, tig-shaped browser with four tabs: commits
(`git log --graph`, 200 commits, decorations), refs (local/remote branches and
tags with upstream tracking), changes (the working tree, the same porcelain read
`/diff` uses) and stashes. The selected row's detail loads on its own: a
commit's stat and patch, a ref's upstream and tip, a file's patch, a stash's
diff.

Keys inside the panel: `1`-`4` switch tabs, `tab` moves the keys between the
list and the detail (a wide box shows both), `enter` opens what is under the
cursor (a ref filters the log to it, a changed file opens in the preview box, a
commit hands the keys to its patch), `y` copies the sha/ref name/path,
`backspace` clears the filter, `r` re-reads and `esc` closes. Rows the log's
graph only draws are painted but never selected, and the pointer is held to the
same rule.

Nothing here stages, commits, checks out, resets or drops a stash: the panel is
a reader, like `/diff` and `/worktree`. Every query is argv-only, bounded (one
page of log, a capped patch) and has a deadline, so a `git` waiting on another
session's rebase lock cannot freeze the frame that asked for it.
The prompt is drawn right-aligned with a fill of `user_bg`, and it had a
rounded accent frame on top of that: two rule rows, two side bars, and a colour
that appears nowhere else in the transcript. The frame drew the eye to the box
rather than to the words in it, so it is gone — the bubble is its background,
one column of padding either side, nothing else. What is left is the same hug
around the widest row and the same one-column margin off the transcript's edge,
so a prompt still reads as its own block rather than a full-width band.

The narrow-column fallback keeps its meaning with two fewer columns of chrome
(the plain band now starts below 11 columns, not 13), and the transcript
helpers that used to strip the frame no longer have one to strip.
…ut off

`agent_end` answered the wrong question. Whether a run is over is what
`runs` says — every attempt re-reads it and again under the publish lock —
while `agent_end` only says whether the *stream* is complete. The old gate
used the second as the first, so it refused exactly the journals a crash
leaves behind: truncated streams that will never grow a terminal. Measured
on a real store, that was 50 runs / 762k events / 179 MiB kept forever, and
they were the ones that most needed reclaiming.

Now a truncated stream folds too, once its run has been settled for a minute
(the `run_terminal` entry settles `runs` *before* the final event broadcast,
so inside that window a producer may still be appending; a minute later it
either finished or died). A run with no settle time — a legacy import — has
no age to read and keeps its journal. The decision is made from the source
read that already ran, so a refusal costs one indexed read instead of a full
fold, and the source equality that fences publication now includes the tail's
event type.

Nothing diagnostic is lost by folding a truncated stream: `DeltaFolder` keeps
every non-delta event verbatim — `error`, an unfinished `tool_start`, the
partial arguments of a cancelled call — and only merges delta runs, which is
what it already did for complete streams. The published snapshot carries
exactly the events that were there. `journal.truncated_publishes` counts them
durably and the report prints it as `Truncated`.

`a_concurrent_append_never_produces_an_inconsistent_snapshot` asserted a
gapless index sequence for *both* replay representations, which a folded
snapshot cannot satisfy: merging a run of deltas moves the segment's index to
the last one it absorbed. It now asserts no duplicate/ordering for both and
gaplessness only for a raw journal, which is what those words mean.
A completion notification only covers a run whose process is still alive when
it ends. Everything else — a crash, a stop, an older build, a fold that failed —
stayed a raw journal until somebody remembered to run `future session journal
--reclaim`. That is how a real store reached 4.4 GiB with 135 of 1,166 settled
runs still holding their streams, and the structure that produced it was still
there for the next time.

The compactor thread now takes one bounded catch-up pass, queued first at
start: at most 16 runs and at most 10 s of folding, whichever ends first, with
the budget starting after the candidate plan is read (at startup that job waits
behind the storage worker's own migration, and billing that wait spent the whole
budget before the first fold — measured on a 4.77 GiB store: 33 s of queueing).
The plan itself is index-driven, not the sweep's whole-journal GROUP BY, because
this runs at startup. Not interrupted mid-fold, so one very large run can exceed
the time bound; `has_more` says the next start continues.

It is not a timer and not on a request path, and it logs one line either way:
folded/examined counts, events, snapshot bytes, truncated, errors, the refusal
reasons and the elapsed time. Before this, "the store is quiet" and "the store
has no idea" looked identical in a file that stopped shrinking.

Measured on a 4.77 GiB copy with 148 settled runs holding raw journals: the
first start after the upgrade folded 10 runs (162,544 events, 8 of them
truncated) in 10.05 s and reported has_more; the explicit sweep took the
remaining 138 (8,162,910 events) and left 0 reclaimable. Every one of the 363
session transcripts was byte-identical at each step.
…asurement

The run-journal page said truncated streams are kept forever. They are not
any more, so the page now states what actually decides a fold — `runs` for the
run being over, `agent_end` for the stream being complete, the 60 s grace for
the producer being gone — with a table of every state and its durable refusal
reason, and the two cases that genuinely stay: no settle time to age, and
provider deltas that cannot be proven duplicates.

Adds the startup catch-up as its own section: the bounds, the fact that it is
one pass on the compactor thread rather than a timer or a request path, the
exact log line, and how to read it. Records the second measurement on a
4.77 GiB copy — 148 settled runs holding journals, 47 sessions with a crash-cut
run, 138 runs / 8.16 M events reclaimed, 0 reclaimable after, 77.6 % off the
file, and 0 transcript differences across all 363 sessions at every step.
The rail listed three things, two of which are true for the whole agent
(the conversation list, filed two ways) and one of which is true for the
conversation on screen (its workspace). A tree that belongs to a session
does not belong in a tab strip of agent-wide lists.

文件 is now its own panel, the way /git is: `ctrl+3` (the chord the third
tab answered to), the header's `[ctrl+3] 文件` button, or `/files` opens a
box over the frame holding the session's workspace tree. The keys are the
tree's own — `↑`/`↓` walk, `⏎`/`→` open, `⌫`/`←` go up a level, `r`
re-reads, `esc`/`q` close — and a click on a row is the same verb as
`⏎` on it.

The rail keeps two tabs: `←`/`→`, `shift+←`/`→`, `ctrl+1`, `ctrl+2` and
`/panel`-style verbs walk 最近 and 工作区 only. `PanelId::TABS` is the one
list they read, so 文件 cannot be stepped onto by accident.

The panel is scoped to the session, like the git browser: opening it
re-reads the directory, and `Live::refresh_local` re-scans the tree when
the conversation moves to another workspace, so switching conversations
never leaves yesterday's tree on screen.

The header paints its first pointer button — the app's `[key] label`
shape, dropped whole when the row is too narrow to keep the title beside
it — and the rows the box paints register their own hit regions, so the
same model serves the rail, the narrow-terminal panel and the box.
Reverts the framed bubble (`cd8cd659a`) and its follow-up (`d380ca766`), which
had taken the frame off but kept the hug and the right alignment. What the
reader's own words want here is the plainest thing the surface can do: the
prompt on the transcript's left edge, its background running the full width of
the column, nothing drawn around it.

So `render_user_message` is one loop again — each markdown line as ` line`
filled to the column width — and the run state (`queued (#2)`, `cancelled`,
`merged into the previous run`) is a full-width dim row under it rather than a
row inside a box. The bubble's constants, its row painter, its width cap and
the geometry tests that pinned them go with it.
The preview box was keyboard-only: a reader with a mouse could zoom with the
wheel and nothing else, a picture could not be dragged, and stepping to the
next figure meant closing the box and finding the next row in the panel. And
the picture itself was decoded to 1024 px, so zooming past 2x showed an upscaled
guess rather than detail.

- The box opens with a control row: `[缩小] 2x [放大] [适应]` and
  `[上一张] 2/5 [下一张]`. Every control is a key the box already answered
  (`+`/`-`/`0`, `[`/`]`), routed through the same handler — the row exists so a
  pointer does not need the chords, not as a second implementation. A segment
  that would do nothing (the ends of the folder, the terminals that cannot place
  a bitmap) is drawn dim, so nothing looks live that is not.
- `[` and `]` step through the pictures of the folder the row was opened from,
  in the panel's own order; the list is read once when the box opens
  (`files::image_siblings`), and a folder with one picture offers no steps.
- Dragging the picture pans it, one cell per cell, clamped by the paint to the
  picture's own edge. The delta comes from the press cell, so a drop and re-grab
  never drifts.
- A preview is decoded to 2048 px now, which is what a zoom actually shows, while
  the bitmap transmitted to the terminal is downsampled to ten pixels per cell
  (`run::transmit_bitmap`): a 2048px photograph across a hundred cells does not
  ship fifteen megabytes over the pty to be scaled away on arrival.

Images in the conversation are not part of this change: the transcript renders
Markdown images as nothing today, so they need the message model, the shared
renderer and the transcript's hit map to carry a picture's path before a click
or `enter` can open it. That is the next step, not a flag away.
An hourly task run that produced no output left `status=completed` and an
empty summary, and a `session_retention=delete` task had already thrown the
conversation away — nothing said why, so the run could not be attributed at
all. The 2026-10-27 sweep lost a whole turn that way (dev was 24 commits
ahead of main with no open PR, and the ledger read "completed").

Two defects stacked up:

- `agent_bridge::stream` read `cancelled` and `interrupted_by_restart` as
  clean terminals. The Agent labels a run it cut off exactly that way, so a
  run the Agent host restarted under was recorded as a finished one. A
  terminal carrying an `error` was ignored too.
- `run_prepared_prompt_inner` marked the local run failed and then returned
  `Ok(())`, so the task executor saw success and read an empty answer out of
  the journal.

Now the fold maps every non-finishing state to its own termination kind,
headless callers are told about the failure, and the ledger records
`finish_reason` (`answer` / `empty_answer` / `cancelled` / `interrupted` /
`timeout` / `provider_error` / `error`) plus a one-line `finish_note` saying
how far the run got (answer size, last tool call). A blank answer is a
failure with `[EMPTY_ANSWER]`, not a completion with an empty string.
`future task runs --json` (and the phone's ledger view) expose both fields.

`future session wait` had the same silent success for delegated sub-sessions:
it printed nothing and exited 0 whether the child answered or was cut off.
It now names the run's ending and fails on anything but an answer.

Goal workers already read the Agent's raw terminal state and never claimed a
`completed` run it had not finished; their remaining gap (a completed-but-
empty turn counts as success for todos with no evidence contract) is left
alone here.
@huichen
huichen enabled auto-merge (squash) October 27, 2026 05:37
Every default was either `ctrl+…` or `alt+…` depending on when it was added —
`ctrl+m` model beside `alt+m` mouse, `ctrl+r` sessions beside `alt+r` refresh —
and five of them were chords the terminal owns: `ctrl+m` is Enter without
modifier reporting, `ctrl+1/2/3` are not ctrl chords at all in a legacy
terminal, `ctrl+b` is tmux's prefix, `ctrl+v` is some terminals' paste, and
`alt` composes a character on macOS unless Option is set to Meta, which is the
terminal this surface is developed against.

Now every default is a `ctrl` chord (or an arrow with shift), and the map is the
fifteen letters that actually arrive: `ctrl+c` quit, `ctrl+n` new chat,
`ctrl+r` sessions, `ctrl+d` delete, `ctrl+x` stop, `ctrl+q` queue, `ctrl+e`
fold/unfold the process, `ctrl+p` commands, `ctrl+o` model, `ctrl+t` effort,
`ctrl+l` language, `ctrl+g` git, `ctrl+s` the rail, `ctrl+f` refresh, `ctrl+v`
paste.

The rest have no chord and keep a typed door instead: approval `/mode`,
workspaces `/workspace`, copy `/copy`, mouse capture `/mouse`, preferences
`/preferences`, the newest attachment `/preview` (new command), the files panel
`/files`, the rail's three panels (a click, or `shift+←`/`shift+→`), reduced
motion (the preferences row). The help overlay prints `—` in the key column for
those, the shortcut editor round-trips "no chord" as an empty override, and
moving a chord onto such an action takes it from its owner instead of
duplicating it.

Letters are excluded for stated reasons, documented on `default_key`: a terminal
sends Backspace/Tab/`\n`/Enter for `ctrl+h`/`i`/`j`/`m`; `ctrl+a` and `ctrl+b`
are the `screen` and `tmux` prefixes; `ctrl+z` is suspend; and
`ctrl+u`/`k`/`w`/`y` are the composer's own readline set, which a global chord
would shadow.
The TUI had six palettes while the desktop ships fourteen; the reader who
picks `tokyo-night` there had nothing comparable here. `/theme` now offers
22: the six the workbench already shipped, unchanged and still first, plus
the desktop's own family — `ayu`, `catppuccin`, `everforest`, `gruvbox`,
`kanagawa`, `nightfox`, `nord`, `rose-pine`, `solarized`, `tokyo-night`,
`vesper` — and `-light` renditions of catppuccin, everforest, gruvbox, rose
pine and solarized, because a TUI theme is one rendition and a light
terminal deserves more than two choices.

Each new palette exists twice, as the file layout requires: a 29-field
inline `Theme` (`tui/src/themes.rs`) and a workbench `Palette`
(`tui/src/workbench/theme.rs`), same id, same order, both next to the
existing six. Hues are nearest-match 256-colour approximations of
`desktop/src/theme/palettes.json` (the comments carry the source hex), so
the two apps read as one product; backgrounds are the desktop canvas stepped
one index for `panel`, `tool_*_bg` and the selection band, which is what a
full-screen surface needs and an inline one does not.

The tests that pin the catalogue move with it: the frozen id list, the
picker's window at 22 rows (a short terminal must still reach the last
entry), and a new frame test that renders every palette end to end — a
palette is data, and one that broke a row would otherwise only show up on
the reader's screen. The i18n guard gains the seven new multi-word names as
proper-noun exemptions (BUDGET 34 → 41).

Docs: the user guide, the workbench spec's theme item (the frozen colour
table stays as the contract for the original six) and the dsh parity table.
The keymap redesign (`ctrl` only, `ctrl+1/2/3` retired) landed while the
files panel was being built, so a few sentences still described the old
entry: the spec promised `ctrl+3`, and its Chinese half promised `alt+t` —
a chord this branch had picked and the redesign ruled out. Neither is
back: the files panel keeps the doors it actually has, `/files` and the
header's 文件 button, and the shortcut editor still lists the action so a
reader who wants a chord can bind one. With every `ctrl` letter either
taken (15) or unusable (11: Backspace/Tab/newline/Enter, the screen and
tmux prefixes, suspend, and the composer's readline set) there is no
letter left to give it.

Its help row now says what it opens — "打开本会话的文件面板" — instead of a
bare 文件 sitting in a column of descriptions, which is the `HelpKeyFiles`
row the table already carried.

Also in this pass: the Chinese spec's Keyboard section is brought in line
with the English one the redesign rewrote (it still named `ctrl+b`,
`ctrl+m` and `alt+z`), the duplicated `shift+←`/`shift+→` row in the zh
key table is dropped, and the layout note over `layout_preferences` names
`ctrl+s`.

Tests: the help table and the shortcut editor print `—` for the chordless
rows and never `ctrl+1`/`ctrl+2`/`ctrl+3`.
…ox's protocol

The `tui-cli` job failed two ways on the same branch, both for real.

`i18n_guard` caught five hardcoded English sentences in `workbench/git_panel.rs`
— the panel is new and never reached `workbench/i18n.rs`. Three of them are the
panel's own words: a `git` that failed without a message, the empty-repository
case (reusing the existing "not a git repository" row), and the ref header's
`ahead N · behind N`. They are now `GitNoMessage`, `GitNoRepo` and
`GitAheadBehind`, drawn with `t` / `render` in the reader's language. The
`git show --format=` template behind a ref's tip is `GitTipFormat`: its
`Author:` / `Date:` labels are drawn, so it belongs to the table too. Only the
`does not have any commits` comparison — matched against git's own stderr and
never painted — is exempt, with an `// i18n:` marker and one BUDGET step
(34 → 35).

The two preview tests (`the_preview_box_controls_step_through_the_folder`,
`dragging_the_picture_pans_it`) asserted that a box drawn for a terminal with
the kitty protocol has zoom controls and a drag surface, but never said which
terminal that was: they read the process-global capability cache, which
`terminal_image`'s own tests leave at whatever they last set —
`render_image_iterm2` leaves Iterm2, `render_image_none_capabilities_returns_null`
leaves None — and which `the_preview_box_paints_the_picture_and_stays_in_the_frame`
overwrites twice mid-run. Outside a kitty/ghostty terminal (CI) detection
answers None by itself, so the pair fails every run there; inside one it fails
only when a sibling wins the race. `terminal_image::CapabilitiesGuard` gives
each such test an exclusive hold that installs its protocol and restores the
previous value on drop, and every test that touches the cache now goes through
it.

Measured: `cargo test -p future-tui --lib` with no kitty/ghostty in the
environment failed both tests before (2 of 2 runs), passes 1382 tests twice with
the guard; green in the developer's Ghostty env and with KITTY_WINDOW_ID=1 too.
@huichen
huichen merged commit eb54d8a into main Oct 27, 2026
31 checks passed
@huichen
huichen deleted the pr/huichen branch October 27, 2026 06:16
huichen added a commit that referenced this pull request Oct 27, 2026
`… N more lines · ctrl+g to expand` has been lying twice over. `ctrl+g` is
the git browser since #1384, and the view toggle it used to answer was
dropped in the Rust port (#1346): pressing the advertised key opened the
repository panel, and nothing expanded a tool body at all.

The footer names `/tool-output` now — the verb the original design already
carried (`/tool-output <call-id>` in #796, still named in a comment the port
left behind) — implemented as a palette entry that flips the same
`ChatArea` toggle: every call's body under its row, up to 200 rows each,
and back again. No chord: the map has no ctrl+letter left (`ctrl+a`/`ctrl+b`
are tmux's, the composer keeps the readline set), which is the same reason
the port left it behind.

The guard stops reading the hint as a sentence to translate once it names a
command, so its allowlist row and the budget go down by one; the docs' own
inventory loses the row and the key table gains the verb.
huichen added a commit that referenced this pull request Oct 27, 2026
…canvas at AA (#1389)

* feat(tui): let the workspace picker choose no workspace — a plain chat

The `ctrl+l` chooser listed every directory this client has a conversation in
plus a row that creates one from the path typed into its search line, so a reader
who wanted a conversation with no workspace had no row to press: "I did not pick
a workspace" was the one choice the menu could not express.

That choice is now a row of its own — 对话会话 / "Chat", with 不绑工作区 / "no
workspace" where the workspaces print their paths. `enter` there stages the
agent's own `agent/workspace` for the session the next message creates, or moves
an attached one with `set_cwd`; it is the directory the rail's 对话会话 section
already files such a conversation under, and the surface creates it on the way
because nobody else owns that path. An already-chat session is left where it is,
like `esc`.

The row sits after a typed path and never before it: `enter` straight after
typing a directory must still create the directory the reader named. It is keyed
by a NUL sentinel no real path can carry (`picker::CHAT_WORKSPACE_KEY`) and maps
to its own `WbAction::SelectChatWorkspace`, since the directory it moves to is
the app's rather than one the reader chose.

`SessionMeta` gains `chat` (the adapter sets it from `is_chat_directory`), which
is what ticks that row, and the launchpad's 工作区 chip now names a chat by the
same word instead of printing the scratch folder's last segment as if it were a
project.

* fix(tui): make a conversation switch one round trip, and hold the ones you pass

`shift+↑`/`shift+↓` walked the rail by opening every conversation it landed
on. Each open cost three sequential RPCs (`switch_session`, `get_state`, then
the transcript page), a rebuild of the transcript from that page and a full
frame — and a held key repeats every 30–40 ms, so the conversations in between
were loaded only to be thrown away 30 ms later. Measured on a 180×50 terminal
against the release build: one press took 70–75 ms to settle, and eight repeats
took 412 ms in six frames (178 KB written) with the transcript trailing the
reader's fingers the whole way.

Three changes, each one thing a switch no longer does:

* **The rail's cursor moves; the conversation opens once the keys are quiet.**
  A step still resolves immediately (`Workbench::step_session`), so the cursor
  follows the reader's fingers, but the open is deferred by `OPEN_SETTLE`
  (80 ms) and every repeat pushes it out. A key that is released opens what it
  stopped on; the ones passed through are never loaded.
* **Conversations already read come back from memory.** `Live` keeps the last
  eight conversations it showed — rendered rows and all — and a switch that
  hits one paints them *before* it asks the agent anything. The reconcile that
  follows is one `get_state` + `get_session_entries` pair, both addressed by
  name so they go out together; a page that comes back unchanged keeps the rows
  it is compared against (`ChatArea::full_renders` does not move), one that
  changed rebuilds the transcript instead of appending to it.
* **`switch_session` is gone from the switch.** `get_state` resolves the very
  same `try_get_session`, so addressing it by name hydrates the session the
  switch was going to hydrate anyway: three sequential round trips become one
  concurrent pair. A click on the row already on screen now reads nothing at
  all (it used to re-fetch and rebuild, dropping the reader's scroll position
  and any older pages they had loaded).

`/new` keeps the conversation it leaves for the same reason, and
`ChatArea::empty_like` carries the presentation settings (`ctrl+e` level,
`ctrl+d` folding, `ctrl+g` bodies, theme) into the empty side of a swap, so a
cache hit does not silently reset how the reader reads.

Not included: `get_state` still reads the whole `history_shapes` projection once
per call for `queryCount`/parent lineage/unterminated-run recovery — it looked
like a pure waste, but all three readers are real, so making it lazy needs a
memoised projection with its own invalidation. That is a separate change, and
this one does not depend on it.

Tests: a cached conversation comes back without re-fetching or re-rendering its
rows, one that moved on is rebuilt rather than appended, `/new` keeps what it
left, clicking the row on screen reads nothing, and the settle window collapses
a 30/s repeat into one open (with its two bounds pinned so a later tweak cannot
break the property). Spec and both guides say what a held key now does.

* fix(tui): pageUp/pageDown scroll the transcript, never the rail

With the rail focused, `scroll()` handed the page keys (and `ctrl+↑`/`ctrl+↓`)
to the rail's list, so the same key meant two different things depending on
where `tab` had left the cursor — and the transcript was unreachable from the
rail without leaving it first.

The transcript is the one thing those keys mean now. The rail scrolls where a
list should: its cursor walks with `↑`/`↓` (the window follows it), a wheel over
the rail moves it, and the full-screen panel keeps its own keys. `end` — the
same verb — follows the same rule.

* feat(tui): a fresh launchpad opens on 对话会话, the agent's defaults and 完全访问

`/new` (and a TUI started against an agent with no session) carried the
conversation it had just left into the next one: the workspace chip named that
session's directory, the model chip its model, the effort chip its level, and the
approval chip its mode. A fresh screen was therefore a copy of what came before,
and the only way to get "just a chat" was to notice the workspace chooser's own
row and press it.

The four chips now name the product defaults when nothing is staged:

* 工作区 — the plain chat. The session is created in the agent's own
  `agent/workspace` (the directory the rail's 对话会话 section already files),
  which the surface creates on the way: a session parked in a directory that is
  not there has no tool that works.
* 模型 / 强度 — the agent's default model and the level that model starts at,
  read from `list_models` (`isDefault`, `defaultThinkingLevel` — the same
  resolution `new_session` performs), so the chip and the created session agree.
* 审批 — 完全访问 (`off`), and it is *applied* to the created session rather
  than only named: a chip that named a mode the session did not run under would
  be a lie.

Choices the reader makes still win, and staging is spent exactly as before.

Two consequences fixed with it, because they would have described the old
directory while the session ran in the new one: `@` (and `@file` expansion, the
files panel, the branch in the header) now follows the staged directory instead
of the one `/new` left behind, and the chip's cycle became a stable ring that
starts at the chat — it used to reorder itself around whatever was in force, so
two presses bounced between the same pair and the chat became unreachable once
stepped off.

The header, the box title and the chip all name such a conversation 对话会话
rather than printing `~/.future/agent/workspace` as if it were a checkout.

* fix(tui): esc from a preview goes back one level, and the key tables list keys

Three things the help box and the footer were saying that the surface no
longer does:

- `esc` in the preview box closed it *and* the panel under it, so a file
  opened from the files tree landed back in the chat. The box is now a
  level: `open_preview` remembers the surface it opened over (the files
  tree, the `/git` browser), `esc` returns to it, and only the last `esc`
  reaches the chat. A picture opened from the draft had nothing under it
  and still closes onto the chat.
- `?` opens the help; the full-width `?` a Chinese IME types for the same
  key did not, which is exactly the reader who wants the Chinese copy.
  Both do now, and the footer names the key (`? 帮助`), where it used to
  spell `esc 回到聊天` — the key that leaves *whatever the reader is in*,
  which is not one of its five destinations and is printed by the boxes
  that answer it.
- the help table listed every action and printed `—` in the key column
  for the ten with no chord. A key table lists keys; those verbs keep
  their typed door in the command list at the end of the same box, and
  the shortcut editor still lists all of them (that screen exists to give
  a chordless action a chord).

* feat(tui): put language, palette and rail visibility in the preferences box

The preferences box is the one screen a reader visits to see what this
terminal client remembers, so it now lists the choices that had only a
slash command or nothing at all:

* Interface language and Color theme — the two rows that are menus: Enter
  opens the same picker `/lang` and `/theme` open, and committing or
  dismissing it lands back on the box, on the row that opened it (the way
  `Customize shortcuts` already returns there).
* Show sidebar — the rail's visibility had a chord (`ctrl+d`) and an edge
  button but no row, so a reader who had hidden the rail had to know the
  chord to get it back. Toggling it here leaves the keys with the box.

`Restore defaults` was a half-truth once the box showed language and
palette: it now hands the language back to the system and the palette back
to the terminal's light/dark hint (the stored `themeId` is cleared rather
than pinned to today's hint), and drops a stale rail focus.

The rail's width was not remembered above 48 columns: `settings.json`
clamped `sidebarWidth` to 30..48 while the divider drag ran to 60, so the
widest third of the drag was narrowed again on the next start. The file
now clamps to the drag's own `SIDEBAR_MIN..=SIDEBAR_MAX`, and a test walks
every width in that range through the write/read round trip.

The docs gain the new rows (and lose a stale `Ctrl+O`/`ctrl+o` for the
panel, which has been `ctrl+q`), and the 30–48 column range the drag
outgrew.

* feat(tui): a lane graph, a selection band and pageable details in `/git`

The git browser drew git's own ASCII graph in one colour, so a merge read as
punctuation rather than as a line of work; the selected row was an arrow; the
patch beside it was plain text; and the page keys moved the cursor, which left
a long patch to be walked one line at a time.

* The log is read across every branch, remote-tracking branch and tag, so the
  graph has more than one lane to draw (`--branches --remotes --tags
  --date-order`; not `--all`, which would put `refs/stash` in the log as if it
  were a branch, and not `HEAD` as well, which is fatal on an unborn branch and
  takes the other branches' commits down with it).
* Each lane keeps a colour of its own, so two branches running side by side
  stay apart, and the glyphs are the box-drawing twins (`●`, `│`, `╱`, `╲`)
  that let a vertical run read as one line instead of a dotted column of `|`.
* Every field of a row now travels with what it is (`GitKind`), so the painter
  colours a sha, a decoration, a ref's name and a date by meaning rather than
  by position (an empty field is dropped, so positions shift). The selected row
  is a band across the whole list, in a colour stepped off the palette's panel
  onto the grey ramp — the 256-colour table is not a number line, and the
  high-contrast palette's near-white *border* painted white text on white.
* The detail pane paints what it shows — hunk headers, `+++`/`---`, added and
  removed lines, a diffstat's bars, the commit's own header — classified by the
  *source* line, so a wrapped tail keeps the colour of the line it belongs to.
* `PgUp`/`PgDn` page the detail rather than moving the cursor while the detail
  is on screen; the panel splits from 108 columns so a patch is never wrapped
  under about fifty cells, and below that `tab` gives it the full width. The
  detail's offset stops at the last screenful instead of scrolling into blank,
  its title says which rows are on show (`1–35/1017`), and the offset starts
  over when the cursor lands on another row.

`shot.sh git` captures the panel from a checkout: the scripted session's
directory is overridable with `FUTURE_DEMO_CWD`, and the fictional default
keeps every other frame byte-identical across machines.

* fix(tui): the workbench paints its own black canvas, and every theme's text clears AA

The frame painted only the panels; the canvas was whatever the terminal
profile drew. Ghostty ships `#282c34`, a mid slate, so every dark theme read
washed out no matter which palette was in force, and secondary text sat under
4.5:1. Measured at 120x38 on that profile: 98.6% of the cells carried no
background of ours, `muted` landed at 4.06:1 (2.9:1 for one-dark/dracula on
their own panel) and the rail divider at 1.44:1.

- `workbench::run::canvas_rows` paints every row to the last column with the
  palette's `bg`, re-applying it after each span reset (that is what a
  `styled()` reset would otherwise clear). A row that paints a surface of its
  own — the user bubble, a tool block — keeps its colours and only gets the
  canvas as a fallback; a row on the canvas also gets the palette's `fg`, so
  neither a light palette on a dark profile nor a dark one on a light profile
  is left to the reader's default pair.
- Every dark palette uses the same near-black canvas (`232`, `#080808`) with
  `panel` one step above (`234`); `high-contrast` keeps true black. A theme's
  identity is its hues, not a lighter canvas.
- Every text role now clears WCAG AA (4.5:1) on both the canvas and the panel,
  `fg` 7:1 on the canvas: `muted` is lifted where it was 2.9-4.4:1, and three
  dark palettes' accents (`gruvbox` iris, `nord` red, `solarized` purple).
  The light palettes keep the desktop's shared hues; only their `fg`/`muted`
  moved, and their remaining sub-AA accents are reported in the spec.
- Pinned by `text_roles_clear_aa_on_their_own_canvas`,
  `every_dark_canvas_is_the_same_near_black` and
  `canvas_rows_fill_every_column_and_survive_resets`; the visual spec's table
  and its light-palette shortfall list follow.

The 19 frames in `docs/tui/assets/` predate the painted canvas and are marked
for a re-shoot with the live recipe (verification.md §7).

* feat(tui): tab walks the conversation's links and pictures

`tab` used to move the keys into the rail, which is the one thing a reader
stepping towards a link never meant. It now walks the openable spans of the
transcript — a markdown link, a `futureos://session/…` conversation link, a
local file, a picture path written in prose — and `enter` opens the one under
the cursor: a URL in the browser, a conversation by switching to it, a file in
the preview box (a picture as a picture). `esc` hands the keys back to the
draft, and the rail keeps its own chord (`ctrl+d`, which now also lands its
cursor on the conversation on screen).

The spans are read back from what the renderer actually emitted (the OSC 8
hyperlinks around every markdown link) rather than parsed a second time, so a
row's targets cannot drift from what it draws; a bare path is accepted only
when it names an existing picture, because every candidate costs a `stat`.

Pictures became reachable by the same route: `![caption](path)` used to render
nothing at all, and now renders its caption (its path, with no caption) linked
to the file; a user message's attached images render the same way from the
path the entry kept. Clicking any visible span does what `enter` does — the
terminal's own ctrl/cmd+click cannot, since it hands the destination to the
browser.

* fix(tui): the tool-output footer names a door that exists

`… N more lines · ctrl+g to expand` has been lying twice over. `ctrl+g` is
the git browser since #1384, and the view toggle it used to answer was
dropped in the Rust port (#1346): pressing the advertised key opened the
repository panel, and nothing expanded a tool body at all.

The footer names `/tool-output` now — the verb the original design already
carried (`/tool-output <call-id>` in #796, still named in a comment the port
left behind) — implemented as a palette entry that flips the same
`ChatArea` toggle: every call's body under its row, up to 200 rows each,
and back again. No chord: the map has no ctrl+letter left (`ctrl+a`/`ctrl+b`
are tmux's, the composer keeps the readline set), which is the same reason
the port left it behind.

The guard stops reading the hint as a sentence to translate once it names a
command, so its allowlist row and the budget go down by one; the docs' own
inventory loses the row and the key table gains the verb.

* fix(tui): the key table counts the door the tool footer names

The merge of feat/tui-transcript-links and fix/tui-tool-output added one key
on each side; the exhaustive table's length caught it.

* fix(tui): exempt git's diff-header tokens, which the guard read as chrome

`git_detail_line` colours a patch line by the prefix it starts with: `diff
--git`, `new file mode`, `similarity index`, `rename from `, `old mode `,
`new mode `. Those strings are git's own diff format compared against the
line, never text this tree writes — the row on screen is the line git
printed, so translating them would be inventing words git never emitted.

Seven `NotChrome` rows in the i18n guard's allowlist, and `BUDGET` 43 → 50
with the reason written next to it.
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