Show background command launches and late results in the TUI (#64015)

## Why

A background command can outlive the turn that launched it. Its result
could be dropped when no turn was active or appear as a separate
transcript entry if later output had already displaced its running row.

## What changed

- Show background commands as they start, including commands that don't
  match a recognized tool action. Keep tracking their exits after a
  turn ends or is interrupted.
- Update the original transcript row with the exit status and output,
  including when the command finishes in a parked side conversation.
- In rich terminal scrollback, label an unfinished launch `Started`.
  If the launch has already printed, append the result in order.
  Otherwise, replace the queued launch with the completed entry.

## Testing

Cover late exits after turn completion and interruption, completion
during a side conversation handoff, and result ordering behind queued
scrollback.

GitOrigin-RevId: 65f069af28c112078d85613da2c95e5c1c4f29bf
This commit is contained in:
Eric Traut
2026-11-25 22:54:56 +00:00
committed by copyberry
parent 2f83e4843f
commit ad07f04e47
34 changed files with 347 additions and 150 deletions
@@ -37,6 +37,8 @@ type ReplayedCloudItems = std::collections::HashMap<String, (bool, i64)>;
#[derive(Default)]
pub(super) struct TranscriptState {
pub(super) active_cell: Option<Box<dyn HistoryCell>>,
/// Background command rows awaiting an exit, even after turn cleanup or /stop.
pub(super) pending_command_rows: std::collections::HashSet<String>,
/// Shared retained rows for concurrently running dynamic tools, removed on completion.
pub(super) dynamic_calls:
std::collections::HashMap<String, crate::history_cell::DynamicToolCallCell>,