mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-09-30 12:39:42 +02:00
fix(tui): make an attach fit the terminal, show the way out, and resume history
Three things the first beta test surfaced. 1. Attaching from a terminal of a different shape showed the pane clipped to the browser's size, with tmux's dot padding filling the rest. Codeman pins every window it owns to `window-size manual` at whatever the web client reports (tmux-manager.ts), so no attaching client can resize it. The handoff now brackets the attach with `window-size latest` and restores the snapshot on detach. `latest`, rather than a one-off resize to our own size, is also what lets a terminal resized MID-attach follow along: tmux recomputes on every SIGWINCH while the TUI is blocked in spawnSync and cannot. 2. Nothing on screen said how to get back out, because Codeman keeps the status bar off on its panes (the web UI carries that information around the terminal instead). The tester exited the agent looking for the exit, leaving a dead pane. An attach now wears a `status-format[0]` bar reading "<prefix> D detach, back to the codeman dashboard", with the prefix READ from tmux rather than assumed, and the session's options are put back exactly as they were on detach. One option, not status-left/status-right, so tmux draws no window list beside it; `reverse` so it inherits the terminal's own theme. Restoring an array option unsets the BASE name, since dropping the `[0]` index leaves an empty array, which renders as a blank bar on a session that had one. The help overlay names the chord, and the dashboard confirms the detach. 3. Enter on a RECENT row said resuming was not wired up. It now creates a session carrying that conversation (`resumeSessionId` plus `/interactive`, the path the web UI's Resume Conversation list already uses), in the directory it ran in and under its old name, then attaches to it. The attach mechanics deliberately sit in a method the group dispatch cannot reach, plus a re-entrancy flag: routing resume back through the Enter handler re-dispatched on "this row is RECENT" and spawned one session per pass, 35 in about 40 seconds on the beta before it was killed. test/tui/tui-e2e.test.ts pins one press to one session with a pane that never appears, which is exactly the case that looped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+18
-1
@@ -168,6 +168,16 @@ terminal to tmux with `stdio: inherit`. Colors, mouse and paste are tmux's, at f
|
||||
fidelity. Detach with **`Ctrl+B D`** (tmux's default prefix, which Codeman does not
|
||||
change for local sessions) and the dashboard comes back and refreshes.
|
||||
|
||||
You do not have to remember that: for as long as the attach lasts, the session wears
|
||||
a status bar reading **`Ctrl+B D detach, back to the codeman dashboard`**, in the
|
||||
prefix your own `~/.tmux.conf` sets if you remapped it. Codeman keeps the status bar
|
||||
off on its panes (the web UI carries that information around the terminal instead),
|
||||
so the TUI turns it on for the attach and puts it back exactly as it was on detach —
|
||||
along with the window size, which follows your terminal while you are attached and
|
||||
returns to the browser's afterwards. Detaching leaves the agent running; typing
|
||||
`exit` or pressing `Ctrl+D` would end it, which is the difference the bar exists to
|
||||
make obvious.
|
||||
|
||||
Three cases:
|
||||
|
||||
| Where you are | What happens |
|
||||
@@ -176,7 +186,14 @@ Three cases:
|
||||
| Already in tmux on Codeman's socket | `switch-client`, so you do not nest |
|
||||
| In tmux on a **different** socket | Refused, with an explanation: detach first (`Ctrl+B D`), then run `codeman tui` again |
|
||||
|
||||
A RECENT row and a direct-PTY session have no pane to attach to, and say so.
|
||||
A direct-PTY session has no pane to attach to, and says so.
|
||||
|
||||
**`Enter` on a RECENT row resumes that conversation** instead: there is no pane to
|
||||
attach to, so the TUI creates a new claude session carrying the old transcript
|
||||
(`resumeSessionId`, exactly what the web UI's "Resume Conversation" list does), in
|
||||
the directory it originally ran in and under its old name, then attaches to it. It
|
||||
is claude-only, and a row with no working directory or no conversation id says why
|
||||
rather than resuming something else.
|
||||
|
||||
`x` never bulk-kills: it kills one session, only after you retype its name, never a
|
||||
history row, and never the session the TUI itself is running in.
|
||||
|
||||
Reference in New Issue
Block a user