nest the whole sub-agent run under its Agent card (T-264)

A sub-agent's sidechain run used to spill loose into the main chain,
indistinguishable from main-thread items. Now:

- _sidechainFold routes every sidechain item to its owning Agent/Task
  tool-use by walking the parentUuid chain up to the Agent message it
  branches off (nearest-preceding Agent as fallback) — correct even for
  parallel agents.
- The run (prose / thinking / tool cards) nests in an "agent run"
  ClideHolderCard UNDER the Agent card, suppressed from the top level. The
  prompt still folds into the call (T-263); a successful sidechain tool
  result folds into its own tool card inside the run, so it isn't a
  separate step.
- When a run is shown, the Agent card's returned-result segment is dropped
  (it duplicates the run's final output, note E) — but kept when no run
  was captured, so output is never lost.

Tests: run nesting, returned-result dedup, parallel-run attachment (would
fail under nearest-preceding), and folded-result-not-double-counted.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-08 11:26:09 +02:00
co-authored by Claude Opus 4.8
parent 5253b7b759
commit db6ecbd5df
5 changed files with 223 additions and 47 deletions
+5
View File
@@ -144,6 +144,11 @@ heading, and (b) bumping `pubspec.yaml` `version:` in the same commit.
### Changed
- A **sub-agent's whole run** — its prose, thinking, and tool calls — now nests
in an **`agent run` holder under its Agent card** instead of spilling loose
into the main thread, so you can tell where the sub-agent's work begins and
ends. The run attaches via `parentUuid` (correct even for parallel agents),
and the redundant returned-result is no longer shown twice. (T-264)
- The folded **activity card** now reads as one **container that wraps its
sub-cards**, and you can collapse it by clicking anywhere on the holder's own
background — not just a top header that scrolls out of reach while a run