Files
paseo/plugin-examples/composer-controls/index.client.tsx
T
Mohamed Boudra 0aeb1ae1f9 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.
2026-11-04 08:10:28 +01:00

31 lines
1.1 KiB
TypeScript

import type { PluginClientContext } from "@getpaseo/plugin/client";
import { Checklist, ContextLength, PlanFirst, REVIEW_KEY, ReviewFlag } from "./client/controls";
import { ComposerTools } from "./client/panel";
export default function contribute(client: PluginClientContext) {
client.addComposerItem({ id: "context-length", Component: ContextLength });
client.addComposerItem({ id: "review-flag", Component: ReviewFlag });
client.addComposerItem({ id: "plan-first", Component: PlanFirst });
client.addComposerItem({ id: "checklist", Component: Checklist });
client.addWorkspacePanel({
id: "composer-tools",
title: "Composer tools",
icon: "ListChecks",
locations: ["explorer"],
Component: ComposerTools,
});
client.addCommandCenterItem({
id: "mark-for-review",
title: "Composer controls: mark for review",
icon: "Flag",
context: "agent",
async onSelect({ agent, composers }) {
// The agent's tab does not have to be open.
for (const composer of composers({ agentId: agent.id })) {
await composer.setMetadata({ [REVIEW_KEY]: true });
}
},
});
return () => {};
}