Show successful TUI commands individually (#41893)

## What changed

- Emit a separate history cell for each completed command instead of grouping
  consecutive successes into a `Ran N commands` summary.
- Preserve `Explored` grouping for related file reads, searches, and listings.
- Replay completed commands as individual entries so their output and failure
  status remain visible.

## Testing

- Update TUI tests and snapshots for live exploration and replayed commands.

GitOrigin-RevId: 7dafe0b7846fc89784093791a6be137a1b1ab8ff
This commit is contained in:
Benjamin Carlsson
2026-08-31 18:34:10 +00:00
committed by copyberry
parent e51b54b4c0
commit 32f48598a0
16 changed files with 110 additions and 480 deletions
@@ -10,7 +10,6 @@ impl ChatWidget {
let Some(wait) = self.unified_exec_wait_streak.take() else {
return;
};
self.flush_completed_command_activity();
self.transcript.needs_final_message_separator = true;
let cell = history_cell::new_unified_exec_interaction(wait.command_display, String::new());
self.app_event_tx
@@ -362,7 +361,6 @@ impl ChatWidget {
if self.suppressed_exec_calls.remove(&id) {
return;
}
let was_running = running.is_some();
let (command, parsed, source) = match running {
Some(rc) => (rc.command, rc.parsed_cmd, rc.source),
None => (event_command, event_parsed, source),
@@ -371,33 +369,6 @@ impl ChatWidget {
let is_unified_exec_interaction =
matches!(source, ExecCommandSource::UnifiedExecInteraction);
let is_user_shell = source == ExecCommandSource::UserShell;
let retain_untracked_unified_exec = !was_running
&& source == ExecCommandSource::UnifiedExecStartup
&& self.transcript.active_cell.is_none();
// Unified exec skips unknown start events, so group their successful completions here.
if !was_running
&& source == ExecCommandSource::UnifiedExecStartup
&& let Some(cell) = self
.transcript
.active_cell
.as_mut()
.and_then(|cell| cell.as_any_mut().downcast_mut::<ExecCell>())
&& !cell.is_active()
&& cell.iter_calls().all(|call| {
matches!(
call.source,
ExecCommandSource::Agent | ExecCommandSource::UnifiedExecStartup
)
})
{
cell.add_call(
id.clone(),
command.clone(),
parsed.clone(),
source,
/*interaction_input*/ None,
);
}
let end_target = match self.transcript.active_cell.as_ref() {
Some(cell) => match cell.as_any().downcast_ref::<ExecCell>() {
Some(exec_cell) if exec_cell.iter_calls().any(|call| call.call_id == id) => {
@@ -424,10 +395,6 @@ impl ChatWidget {
match end_target {
ExecEndTarget::ActiveTracked => {
let has_active_hook = self
.active_hook_cell
.as_ref()
.is_some_and(HookCell::has_visible_running_run);
if let Some(cell) = self
.transcript
.active_cell
@@ -436,7 +403,7 @@ impl ChatWidget {
{
let completed = cell.complete_call(&id, output, duration);
debug_assert!(completed, "active exec cell should contain {id}");
if cell.should_flush() || (has_active_hook && !cell.is_active()) {
if cell.should_flush() {
self.flush_active_cell();
} else {
self.bump_active_cell_revision();
@@ -472,7 +439,7 @@ impl ChatWidget {
);
let completed = cell.complete_call(&id, output, duration);
debug_assert!(completed, "new exec cell should contain {id}");
if (!was_running && !retain_untracked_unified_exec) || cell.should_flush() {
if cell.should_flush() {
self.add_to_history(cell);
} else {
self.transcript.active_cell = Some(Box::new(cell));