Repository navigation
Open
Open
Copy link
Labels
pluginsPlugin SDK, runtime, marketplace
Description
The workflow
A plugin wants to add an item to the text-selection menu in the code-review diff and in the file preview — the same way messageAction contributes items to the timeline selection menu. Motivating case: the side-chat plugin's "Reply in side chat" on review selections (#6166) — quote a selected diff hunk into a side chat. #3342 (reply to selected Markdown in the document preview) is the same shape on another surface.
What happens today
A plugin cannot add an entry to the diff or file-preview selection menus at all:
- The only selection-capable slot is
messageAction. Its context documentsselectedTextas "the exact text the user highlighted insidemessage" (app-contract.ts#L3451-L3468), so it is defined only for timeline messages. - All three surfaces render the same shared menu component,
TimelineSelectionMenu, which already accepts apluginActionsprop (TimelineSelectionMenu.tsx#L38) — but only the timeline call site passes them. The diff menu (PierreLineSelectionActions.tsx#L563) and the file-preview menu (SecondaryPanelSelectionActions.tsx#L260) expose only the coreonSelectionAddToChatcallback and pass no plugin actions. - The only escape hatch is
experimental_diffRenderer— replacing the entire diff renderer (virtualization, lazy patch loading, highlighting) to own one menu item. Not practical.
What you would expect
A versioned slot analogous to messageAction, but for content surfaces instead of timeline messages:
app.slots.experimental_selectionAction({
id: "reply-in-side-chat",
label: "Reply in side chat",
icon,
surfaces: ["diff", "file-preview"],
isEnabled?: (context) => boolean,
run: (context) => void | Promise<void>,
});
// context: {
// selectedText: string;
// surface: "diff" | "file-preview";
// threadId: string | null; // owning thread for a review diff; null for a plain file preview
// filePath?: string;
// experimental_panel: ...; // same panel handle messageAction gets
// }Acceptance criteria:
- Registered actions render in the existing diff and file-preview selection menus after the built-in entries, reusing the
pluginActionsmechanismTimelineSelectionMenualready has; ordering across multiple plugins follows the same rules as timeline plugin actions. runreceives the exact selected text, the surface kind, the owning thread id when the surface belongs to a thread, and the file path when known.- Per AGENTS.md, the new SDK member ships
experimental_-prefixed with adocs/api_to_audit.mdentry, and is listed inplugins/plugin-api-docs/src/surfaces.tswith a Plugin Guide example. - Unit tests cover that a registered action appears in each surface's menu and receives the correct context, mirroring the existing
TimelineSelectionMenuplugin-action tests.
Context and alternatives
- Add "Reply in side chat" to code-review (git-diff) selections #6166 has a working core prototype and an open design question — "drive the side-chat plugin id + its RPC from core, or prefer a generic selection-action surface?". This slot is the generic answer: with it (plus composer-draft targeting, filed separately as its own issue) "Reply in side chat" from review becomes a pure plugin feature with zero core↔plugin-id coupling, and the same slot unblocks Reply to selected Markdown text without leaving the document preview #3342 and any future selection-driven plugin.
- Ruled out:
experimental_diffRenderer(full renderer rewrite for one menu item);messageAction(documented and implemented as timeline-message-only). - All code references are at main
d060de8e30f3310417054a74510a774dd2909e2b.
Checks
- I searched open and closed issues for the same request (closest: Add "Reply in side chat" to code-review (git-diff) selections #6166 — the motivating feature, not the API; Reply to selected Markdown text without leaving the document preview #3342 — another surface; feat(plugins): add a floating-menu slot in the agent stream #6481 — a different slot, completed; no generic selection-action slot request exists).
- If an agent wrote this, the body ends with
> AGENT GENERATED.
AGENT GENERATED
Activity
bb-slop-cop commentedon Nov 4, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotApplied classification:
pluginsAll classification fields were previously unset; no existing values were replaced. Final Type verified as Feature. Reproduction report and fix skipped; no pull request because this requests new functionality rather than correcting unexpected behavior.