Show dismissed commands as an answer footer chip; move Copy to the left gutter
Dismissed shell runs leave the transcript and fold into a "N commands" chip in the footer of the first answer at or after each run (the last answer for newer runs, or a row of its own without any answer). The chip opens the turn sheet (wide) or a full-screen page (narrow) listing the commands; each opens its output read-only with Copy output, Send to agent and Restore. On a wide conversation the answer's Copy button moves out of the footer into a 48 px gutter left of the reading column (chatCopyGutter), shown on hover or focus on desktops and always on touch; narrow widths keep it in the footer.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# Answer Copy button in the left gutter
|
||||
|
||||
Operator request: "Let's move the copy button from the answer to the left,
|
||||
outside the chat, to the left."
|
||||
|
||||
- On a wide conversation the answer's Copy icon button sits in a strip left
|
||||
of the reading column, outside the answer, bottom-aligned with the
|
||||
answer's footer row. The footer now starts with the chips, model and time.
|
||||
- The rule is centralized in `conversation/chat_reading_width.dart`:
|
||||
`chatCopyGutter(width)` is `kChatCopyGutterWidth` (48 px) when the margin
|
||||
beside the centred 760 px reading column is at least that wide, else 0.
|
||||
With 0 (phones, narrow panes) Copy stays first in the footer as before.
|
||||
- The transcript list starts the gutter's width further left; answer rows
|
||||
draw the gutter themselves (`ChatCopyGutterRow`, provided through the
|
||||
`ChatCopyGutter` inherited width) and every other row and notice is inset
|
||||
past it (`chatCopyGutterInset`), so the column itself does not move.
|
||||
- Visibility: touch platforms always show it. Desktops
|
||||
(`prefersCompactHitTargets`) show it while the pointer is over the answer
|
||||
or the button has keyboard focus. Hidden, it stays in the focus order and
|
||||
the semantics tree (tooltip and name "Copy").
|
||||
- Files: `lib/features/chat/ui/transcript/chat_copy_gutter.dart`,
|
||||
`chat_message_view.dart`, `conversation/chat_reading_width.dart`,
|
||||
`conversation/chat_thread_view.dart`.
|
||||
- Tests: `test/features/chat/ui/transcript/chat_copy_gutter_test.dart` (the
|
||||
rule, footer vs gutter placement, alignment with the footer, hover and
|
||||
focus on macOS, semantics while hidden, a 1400 px vs 560 px conversation).
|
||||
- Verification (2026-11-09): `tool/memwatch/full.sh test/features/chat`:
|
||||
`PASS: 1161 passed, 0 failed`; `tool/analyze.sh` clean. Real Chrome
|
||||
captures (Material light and dark): at 1400x900 the gutter Copy hidden and
|
||||
shown on hover, aligned with the footer chip; at 560x1000 Copy back in the
|
||||
footer. Touch platforms (always visible) were checked by widget tests only.
|
||||
@@ -143,28 +143,34 @@ change, and `{session_id, run_id, output, offset, end}` for output chunks.
|
||||
run has finished. It dismisses every finished run and leaves running ones.
|
||||
- Dismissal is per chat, for every client (not per device). The card goes at
|
||||
once. A refusal brings the card back with the server's reason.
|
||||
- Undo: a 5 s SnackBar (Material) or a transient notice over the
|
||||
conversation (Cupertino, `ChatUndoBar` in the root overlay) offers Undo.
|
||||
The Cupertino notice briefly covers the composer.
|
||||
- Server design: dismiss-then-restore within a window, then purge.
|
||||
- History: a dismissed card is not lost. It moves into a "N commands" chip
|
||||
in an answer's footer (see "Command history" below), which can restore it.
|
||||
There is no Undo notice.
|
||||
- Server design (since 2026-11-09): dismiss keeps the run.
|
||||
`chat_shell_dismiss {session_id, run_ids}` sets `dismissed_at` on finished
|
||||
runs and pushes `chat_shell_run_event {dismissed: true}` to every watcher.
|
||||
`chat_shell_restore {session_id, run_ids}` clears it within
|
||||
`ChatShellRunUndoWindow` (30 s, longer than the 5 s notice). The reply
|
||||
carries the runs, and watchers get lifecycle frames. A client that held no
|
||||
copy reads the list again for the output. After the window the server
|
||||
purges the run's command, output, output text and error (an `AfterFunc`,
|
||||
plus on every server start). Only a tombstone row remains.
|
||||
- Readback: `chat_shell_runs` and `chat_shell_run_output` exclude dismissed
|
||||
runs. `chat_shell_runs` lists tombstone ids in `chat_shell_dismissed`, so a
|
||||
client that missed the event drops those cards on its next refresh.
|
||||
Tombstones age out with the 50-run history prune.
|
||||
The command, folder, status, exit code, times, output tail (1 MiB) and
|
||||
plain-text rendering stay, within the usual 50-run history. Nothing is
|
||||
purged: the undo window, its `AfterFunc` and the startup purge are gone.
|
||||
`chat_shell_restore {session_id, run_ids}` clears `dismissed_at` at any
|
||||
time. The reply carries the runs, and watchers get lifecycle frames.
|
||||
- Readback: `chat_shell_runs` leaves dismissed runs out of
|
||||
`chat_shell_runs`, lists their ids in `chat_shell_dismissed` (as before)
|
||||
and the runs themselves in `chat_shell_dismissed_runs` (oldest first,
|
||||
64 KiB tail each, `dismissed: true`, `dismissed_at`).
|
||||
`chat_shell_run_output` and `chat_shell_share` work for a dismissed run.
|
||||
- Older rows: a run an older server already purged keeps `purged = 1`. It is
|
||||
listed with `purged: true` and no command or output. The app shows it as
|
||||
"Command not kept" / "Output not kept" and offers no Restore (the server
|
||||
refuses to restore it).
|
||||
- Files: `internal/protocol/chat_shell_dismiss.go`,
|
||||
`internal/pipeline/chat_shell_dismiss.go`,
|
||||
`internal/server/chat_shell_dismiss.go`,
|
||||
`lib/features/chat/shell/chat_shell_dismiss.dart` (button, menu entry,
|
||||
Undo notice) and `chat_shell_runs_dismissal.dart` (controller part).
|
||||
- Tests: `internal/pipeline/chat_shell_dismiss_test.go` covers dismiss,
|
||||
`lib/features/chat/shell/chat_shell_dismiss.dart` (button, menu entry)
|
||||
and `chat_shell_runs_dismissal.dart` (controller part).
|
||||
- Tests and verification of the first version (superseded where they
|
||||
mention Undo or purging; see "Command history" below for the current
|
||||
tests): `internal/pipeline/chat_shell_dismiss_test.go` covers dismiss,
|
||||
readback, restore, purge and tombstones.
|
||||
`internal/server/chat_shell_dismiss_test.go` covers the websocket dismiss
|
||||
to two watchers, refusing a running or empty request, readback with
|
||||
@@ -247,5 +253,56 @@ end to end. The Go websocket tests cover the server with real processes, and
|
||||
the browser captures use the fixture channel. Mobile devices were not tested.
|
||||
|
||||
**Update:** dismissing no longer shows a notice or Undo; the card simply
|
||||
goes away (operator request). The server still accepts `chat_shell_restore`
|
||||
within its 30 s window, but the app no longer offers it.
|
||||
goes away (operator request).
|
||||
|
||||
## Command history (2026-11-09)
|
||||
|
||||
Operator request: "when we dismiss a command, it should show in the bottom
|
||||
like the files changes, model, etc, so that I can expand and see the
|
||||
history."
|
||||
|
||||
- A dismissed run leaves the transcript and shows as a chip in an answer's
|
||||
footer, in the same row and chip family (`ChatTurnChip`) as
|
||||
"3 files changed +9 −2", the tool chips, the model and the time: a terminal
|
||||
icon and "2 commands".
|
||||
- Placement (`shell/chat_shell_history.dart`, `attachChatShellHistory`):
|
||||
each run goes to the first assistant reply created at or after the run
|
||||
started. A run newer than every reply goes to the last reply. A chat with
|
||||
no reply shows the chip on its own row at the end of the transcript.
|
||||
- Tapping the chip opens the turn sheet on a wide window (≥ 600 px) or a
|
||||
full-screen page on a narrow one, like the diff chip. "Dismissed commands"
|
||||
lists each command with its exit status chip and duration, its start time,
|
||||
and Restore. Tapping a command opens its whole retained output read-only
|
||||
in the card's terminal view (`chat_shell_run_output`), with Copy output,
|
||||
Send to agent and Restore. Restore puts the card back in the transcript for
|
||||
every client. A refusal shows the server's reason under the entry.
|
||||
- Multi-machine: everything goes through the chat's own gateway, as cards do.
|
||||
- Files: `lib/features/chat/shell/chat_shell_history.dart` (placement,
|
||||
labels), `chat_shell_history_chip.dart`, `chat_shell_history_view.dart`,
|
||||
`chat_shell_history_output_page.dart`; controller part
|
||||
`chat_shell_runs_dismissal.dart` (`dismissedRuns`, `restore`,
|
||||
`fullOutput`); hooks in `conversation/chat_thread_view.dart`. Server:
|
||||
`internal/{protocol,pipeline,server}/chat_shell_dismiss.go`.
|
||||
- Tests: `internal/pipeline/chat_shell_dismiss_test.go` (dismiss keeps
|
||||
output, readback, restore without a time limit, older purged tombstones,
|
||||
dismissed runs counting toward the 50-run history);
|
||||
`internal/server/chat_shell_dismiss_test.go` (websocket dismiss to two
|
||||
watchers, readback of dismissed runs with output, output read of a
|
||||
dismissed run, restore, restore a day later after a restart);
|
||||
`test/features/chat/shell/chat_shell_history_test.dart` (placement rules)
|
||||
and `chat_shell_history_view_test.dart` (chip in the right answer's
|
||||
footer, the no-reply row, dismiss moving a card into the chip, sheet,
|
||||
output, Copy, Send to agent, Restore, narrow page, purged rows, a refused
|
||||
restore).
|
||||
- Capture fixture: `?shell_dismissed=run_status,run_tests` starts with those
|
||||
runs dismissed (`tool/perf/chat_shell_fixture.dart`).
|
||||
- Verification (2026-11-09): `go test ./internal/protocol ./internal/pipeline
|
||||
./internal/server` all ok (server 74 s). `tool/memwatch/full.sh
|
||||
test/features/chat`: `PASS: 1161 passed, 0 failed`. `tool/analyze.sh`:
|
||||
clean. Real Chrome captures (`tool/capture`,
|
||||
`chats=1&msgs=4&shell=1&rich=1&shell_dismissed=run_status,run_tests`),
|
||||
Material light and dark: at 1400x900 the footer chip, the sheet and a
|
||||
command's output page; at 560x1000 the footer chip, the full-screen list
|
||||
and the list after Restore, plus (light) the restored card back in the
|
||||
transcript with "1 command". The PNGs were inspected. Cupertino, a live
|
||||
server end to end and mobile devices were not exercised.
|
||||
|
||||
Reference in New Issue
Block a user