Skip to content

feat(tui,mobile,agent): a new-session screen; named and gated desktops; a cancel told apart - #1345

Merged
huichen merged 14 commits into
mainfrom
pr/huichen
Oct 25, 2026
Merged

huichen merged 14 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

Three threads land together.

  • The terminal client gets a dedicated new-session screen: a workspace-aware candidate list, a final-answer view in the transcript, and routing for terminal paste and raw ctrl+c while that screen is open. Its design spec ships alongside it.
  • The phone learns to work with a paired desktop's identity: edit its name and icon from its own row, and offer that machine's settings only while the machine can actually be configured.
  • The agent now reports a terminal commit that a shutdown cancelled as an interruption instead of a silent gap.

Commits

  • feat(tui): new-session screen, final-answer view and workspace-aware session list
  • feat(mobile): edit a paired desktop's name and icon on its row
  • fix(mobile): offer a machine's settings only while it can be configured
  • fix(tui): route terminal paste and raw ctrl+c to the new-session screen
  • docs(tui): add the workbench design spec
  • fix(agent): report a shutdown-cancelled terminal commit as an interruption
  • test(tui): prove a refused workspace path fails on every platform

Verification

Run locally on the branch tip, Rust on the pinned 1.97.0 toolchain and mobile on Node 22 (the CI line):

  • cargo fmt --all -- --check — clean
  • cargo clippy -p future-tui --all-targets -- -D warnings — clean
  • cargo test -p future-tui --lib — 2280 passed (before the last three commits; the refused-workspace case was then re-run on its own: 1 passed, plus 419 passing in the surrounding app::tests workspace neighbourhood)
  • mobile npx tsc --noEmit — clean
  • mobile npx eslint on the 10 touched paths — clean
  • mobile npx jest --runInBand src/features/settings src/remote/__tests__/desktopStatus.test.ts src/screens/__tests__/{DesktopLabelDialog,DesktopsScreen,SessionsScreen}.test.ts — 13 suites / 316 tests passed
  • scripts/screenshots/scenarios.json parses

Notes

The effective diff against main is 27 files, +4472/−385. docs/guide/tui.md and docs/guide/tui.zh-CN.md document the new session screen, and docs/ carries the workbench design spec.

The refused-workspace test previously used /proc/nope/cannot as an uncreatable folder, which is a POSIX assumption: on the Windows runner that path resolves under the drive root and create_dir_all succeeds. It now uses a child of a regular file, which cannot be created on any platform, and asserts the notice names the failure and nothing was left behind.

The phone's own label for a machine (its name and icon) is stored in the local
credential book and never sent to the desktop, but the only way to change it was
a device page whose every other row is read from or written to that machine.
That mixed a local label into remote settings, and it meant the one thing a user
wants with the machine switched off — call it something recognisable — was
behind a gear that works on a machine that answers.

The label now has its own affording where it is drawn: a pencil beside the name
on the paired list's row opens a dialog with the name field and the icon grid,
and one Save writes one patch carrying only what changed. A blank name still
clears the label, and the icon grid needs no "none" entry because the default
mark is drawn by the default id. A refused write keeps the dialog open with what
the user typed instead of closing on a write that did not happen.

The device settings page drops its identity section, so it is now one subject:
what the machine answers. The label is reachable with the machine offline, which
that page could not offer.

Tests move with the field: the identity cases leave `SettingsScreen`'s suite and
`DesktopLabelDialog` gets its own (opens on the stored label, one patch per save,
a blank name clears, a refusal is reported and retried), and the list's suite
covers the pencil opening the editor for the right machine and the startup
picker's rows carrying no inner control. The screenshot scenarios follow: the
`desktops` rows now expect three controls, `desktop-settings` no longer expects
the identity fields, and `desktop-label-edit` drives the new editor end to end.
…session list

The TUI was the only client without the two things the conversation screen
needs once a session gets long: a way to start a new one with its workspace,
model and thinking level chosen up front, and the same "final answer only"
reading level the desktop and the phone have.

- `ctrl+n` opens a whole-surface new-session screen: one prompt box plus the
  workspace, model and thinking rows, with `@`/`#`/`/` hints. Enter creates
  the session with those choices, sends the draft as its first message and
  switches onto it; the conversation's own draft is untouched. The workspace
  row can name a new folder (`n`, then a path), and the model/workspace lists
  come from the agent (`list_models`, `list_sessions`).
- `ctrl+e` (and `/reply-detail [default|detailed]`) sets the reading level of
  a settled reply. The default keeps the answer a reply ends on and folds the
  reasoning and calls that produced it into one `▸ N tool calls · M thoughts`
  row; `detailed` shows every slice. Neither level inlines tool bodies — those
  still wait for `ctrl+g`. A reply that is streaming, or one with no prose of
  its own, is never folded. The level persists as `replyDetail`, the same key
  the GUI clients store.
- `/workspace`, `/workspace new <path>` and the `ctrl+r` list: the picker now
  orders sessions by last activity and names the workspace each one belongs
  to, and workspaces can be listed, created and switched into.

Two supporting fixes fell out of the fold: a message that had stopped growing
kept `pending` set (nothing ever finished a reasoning-only message), which
also left `thinking…` beside finished work; it is now settled when the run
moves past it. `/transcript` renders at the detailed level, since it is a
record rather than the reading view.
The gear on a paired desktop's row opened a page whose every row is read from
or written to that machine — and it did so whether or not the machine was
answering, and whether or not this phone was the one driving it. Off, still
connecting, or held by another device, that page could only say so: a tap that
lands on a notice, which reads as a broken app.

The action is now offered only when the machine is `connected` and not in
standby, and the row says why in place of the desktop id it would otherwise
file the machine under: "未连接" / "连接中" / "准备中", or who has taken it over.
The gear is dimmed by opacity rather than recoloured — `inkSoft` and `inkMuted`
are two greys that differ in the dark theme but are nearly the same in the light
one, so a token swap would have read as no change exactly where the phone is
easiest to read.

Naming and unpairing stay available in every state: they act on this phone's own
records, and a machine that is off is precisely when a label wants changing.
Taking a held machine back is offered where a machine is picked and on the
connection sheet, so nothing is reachable only through the greyed control.

`pairedMachines` is the list the popover, the picker and this page now share —
the open machine judged from the connection the app renders from, the rest from
their own runtimes — so no surface calls a machine by a state another one
contradicts. `machineConfigurable` owns the two-part rule and treats a machine
no runtime has reported on as configurable, because missing data is not
evidence of a fault.

Covered by unit tests for both helpers, list tests for each state (off,
connecting, held with and without a holder name, per-row independence, and the
no-report case), and two screenshot scenarios that show the greyed action beside
one that still works — including pressing it and proving no page opens.
The screen is modal for keys, but two input paths bypassed it: a bracketed
paste wrote straight into the conversation's composer, and the raw `\x03`
byte interrupted the run instead of leaving the screen. A paste now lands in
the screen's own prompt (the conversation draft stays untouched), and ctrl+c
closes the screen — the rawer form of the same "get me out" as ctrl+n.

refs feat/tui-sessions-reply
@huichen
huichen enabled auto-merge (squash) October 25, 2026 08:19
huichen and others added 6 commits October 25, 2026 16:26
The spec for the planned full-screen workbench existed only as an untracked
file in a working tree: no commit, so no other worker could read it, and the
next cleanup would have taken it with it. It is a contract between workers
(type names, file layout, layout constants, key bindings, acceptance
commands), so the one place it has to live is the repository.

The Chinese text is the frozen contract, moved here byte for byte as
`workbench-spec.zh-CN.md`. `workbench-spec.md` is its translation, which the
docs policy requires for every document under `docs/`; only the prose was
translated — the code blocks, type names, constants, colour table, key
bindings and acceptance commands are identical between the two, and the
layout diagram was re-padded so its borders line up with English text.

This is a design proposal for work that has **not** been built: the TUI today
ships the `ctrl+n` composer, `ctrl+e` / `/reply-detail` reply fold and
`/workspace`, which is what `guide/tui.md` documents. `docs/README.md` indexes
the spec as planned work so the two are not mistaken for each other.
…ption

A run's terminal commit is a spawn_blocking task, so a join that reports
cancellation means the runtime shut down under it: the process is exiting,
not the store failing. When that same shutdown also interrupted the run, the
old code marked the session persistence_degraded and logged "restart or
operator intervention required", which sends an operator looking for a
storage fault that does not exist and keeps the session fail-closed.

Such a commit is now read as the interruption it is: one warn line plus an
agent_end carrying the state the journal will be settled to on the next
start (interrupted_by_restart). A real failure - a refused commit, a panicked
task, or a cancelled join without a shutdown interruption - keeps the
fail-closed path and its wording unchanged.
The refused-path case used `/proc/nope/cannot` as a folder that cannot be
created, which is a POSIX assumption: on Windows the path resolves under the
current drive root, and an elevated GitHub Actions runner can create
`<drive>:\proc\nope\cannot`, so `accept_workspace` returned true and the
assertion failed (CI run Rust Windows test / tui-cli).

Build the uncreatable path from a regular file inside a tempdir instead:
`create_dir_all` fails on such a parent on every platform (ENOTDIR on POSIX,
ERROR_PATH_NOT_FOUND/ERROR_ALREADY_EXISTS on Windows), so "cannot create the
folder keeps the editor open and says why" is now really exercised
everywhere. Product behaviour is unchanged.
@huichen huichen changed the title feat(tui,mobile): a new-session screen in the terminal; name and gate paired desktops feat(tui,mobile,agent): a new-session screen; named and gated desktops; a cancel told apart Oct 25, 2026
@huichen
huichen merged commit 1d8a972 into main Oct 25, 2026
25 checks passed
@huichen
huichen deleted the pr/huichen branch October 25, 2026 09:17
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