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:
2026-11-09 23:47:14 +00:00
parent f2520a09b8
commit cf9f71f27c
21 changed files with 1534 additions and 77 deletions
@@ -51,6 +51,10 @@ class ChatShellRunsController extends ChangeNotifier {
/// Runs dismissed here or by another client: a readback racing the
/// dismissal does not bring their cards back.
final Set<String> _gone = {};
/// The dismissed runs this copy holds, shown collapsed in the transcript's
/// command history rather than as cards.
final Map<String, ChatShellRun> _dismissed = {};
bool _disposed = false;
int _generation = 0;
@@ -75,11 +79,16 @@ class ChatShellRunsController extends ChangeNotifier {
Future<void> refresh() async {
final token = ++_generation;
try {
final (:runs, :dismissed) = await _repository.runs(sessionId);
final (:runs, :dismissed, :dismissedRuns) = await _repository.runs(
sessionId,
);
if (_disposed || token != _generation) return;
dismissed.forEach(_remove);
_holdDismissed(dismissedRuns);
for (final run in runs) {
if (_gone.contains(run.id)) continue;
// Restored by another client while this copy missed the frame.
_dismissed.remove(run.id);
final held = _runs[run.id];
if (held != null &&
held.running &&
@@ -204,7 +213,10 @@ class ChatShellRunsController extends ChangeNotifier {
if (frame is! Map || frame['session_id'] != sessionId) return;
final id = '${frame['run_id'] ?? ''}';
if (frame['dismissed'] == true) {
final known = _runs.containsKey(id) || _dismissed.containsKey(id);
_remove(id);
// Another client dismissed a run this copy never held: read it.
if (!known) unawaited(refresh());
_changed(membership: true);
return;
}
@@ -212,6 +224,7 @@ class ChatShellRunsController extends ChangeNotifier {
if (record != null) {
// A restored run (another client's Undo) comes back without output.
if (_gone.remove(record.id) && !record.running) unawaited(refresh());
_dismissed.remove(record.id);
final held = _runs[record.id];
final next = held == null ? record : held.withLifecycle(record);
_runs[record.id] = next;