feat(plugins): reach a running agent's composer by reference

useComposers(selector) in any plugin component and composers(selector) on every command context return the composer of a running agent, named by id or by focus, whether or not its tab is open.

A running agent now has one store-backed composer model apart from any mounted tab. The mounted composer plugs its cursor-aware insert in while mounted; otherwise insertText and setPrompt write the agent's saved prompt. model and thinking resolve through the provider catalog with the picker's own function, so a read equals what the picker shows.

The host reads one ComposerModel from context and no longer knows whether it is in an agent, a draft or New workspace. The daemon rejects an unlisted model or thinking option for a running agent, replacing the app-side guard.
This commit is contained in:
Mohamed Boudra
2026-11-05 23:25:42 +01:00
parent 03580ce50b
commit f665cc697c
42 changed files with 1621 additions and 272 deletions
+13 -2
View File
@@ -14,5 +14,16 @@ Each component calls `useComposer()` and uses the same commands in every compose
controls inline when the composer has room and as rows in the composer's overflow sheet when it
does not, including on a phone.
[client/controls.tsx](client/controls.tsx) holds the four components; [index.client.tsx](index.client.tsx)
registers them with `addComposerItem`.
## Reaching a composer from outside it
Two more contributions use a composer without sitting in one. Both name the agent instead of
reading the composer they are mounted in, and neither needs the agent's tab to be open.
| Contribution | What it does |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------- |
| **Composer tools** (Explorer panel) | `useComposers({ focused: true })` inserts the checklist into the focused agent's prompt. |
| **Mark for review** (Command Center) | `composers({ agentId })` sets the same `needsReview` metadata as the toggle, for the agent you selected. |
[client/controls.tsx](client/controls.tsx) holds the four composer components,
[client/panel.tsx](client/panel.tsx) the panel, and [index.client.tsx](index.client.tsx) registers
everything.