Repository navigation
Replies: 1 comment
|
Both halves you asked for are in. Client slash commands take arguments, and plugins register their own: client.addSlashCommand({
name: "side",
description: "Ask a side question about the current run",
argumentHint: "<question>",
context: "agent",
async onSubmit({ args, agent, rpc, openPanel }) {
await rpc(askSide, { agentId: agent.id, question: args });
openPanel("side");
},
});
Two things that affect the name you pick:
Registration lives in the client entry now, which is a change from the plugin you have today. See the 0.8 migration guide for the client/server entry split, and Slash commands for the full contract. This shipped in #4192 and is in v0.8.0. Thanks for the writeup. Tracing it to |
Uh oh!
There was an error while loading. Please reload this page.
What I'm trying to do
While an agent is mid-run, ask a question about what it's doing — from the keyboard — without derailing the run. Codex has
/sidefor this. The question is usually short and reactive: I see a diff scroll past, I want to know why that helper and not the existing one, and I want the answer without spending the agent's turn or interrupting its plan.The key property is that the main agent's turn never observes the question.
How I do it today
I built a Paseo plugin that does the actual work, and it works:
create_agentfrom inside an agent resolvescallerAgentIdas the parent and inherits the caller'sproviderOptions—packages/server/src/server/agent/tools/paseo-tools.js,resolveCallerAgent),So the mechanism is fine. The entry point is the problem: reaching it means leaving the keyboard and going to a panel. The natural gesture — the one my hands already do — is typing
/side why this helper and not the existing one?in the composer.Where Paseo gets in the way
Two separate walls, both in the client slash command path.
1. The client-side command set is closed and hardcoded.
packages/app/src/client-slash-commands/index.tsis the whole surface:and
CLIENT_SLASH_COMMANDSis a two-item readonly array:/exit(aliasesquit,q) and/clear(aliasnew). There is no registry, no lookup by contributed name, no extension point.packages/app/src/composer/index.tsxconsumes it directly — it importsresolveClientSlashCommandandClientSlashCommand(around line 139) and dispatches throughrunClientSlashCommand(around lines 1287–1315, plus call sites near 1591 and 1856), gated onexecution: "immediate".2. Client commands cannot take arguments at all.
Same file, in
resolveClientSlashCommand:Any whitespace in the line makes the whole thing resolve to
null. Both built-ins declareargumentHint: "", which is consistent — neither needs an argument. But it means/side why this API?can never resolve as a client command, no matter what else changes.3. Plugins have no slash-command surface.
PluginContextinpackages/plugin/src/contracts.tsoffers exactly:handle,addSurface,addSidebarItem,addWorkspacePanel,addCommandCenterItem,addAttachmentSource,addTheme. Nothing composer-adjacent.4. The path that does accept arguments is the wrong path.
Provider-level slash commands and skills take arguments fine — but the agent executes them. So anything I type in the composer reaches the running agent as a steer or a queued message. That is precisely the interruption a side question exists to avoid.
Net effect: the choice today is a command that costs a main-agent turn, or a panel that costs leaving the keyboard. There's no third option, and the third option is the one I want.
What the flow would look like if it worked
I type in the composer:
It's intercepted before the agent sees it. A plugin gets the argument string and the focused agent, and does the rest — snapshot, spawn, surface the answer. The main turn never knows it happened.
Shape — offered as a sketch, not a spec
I don't have a view on the right API and would defer entirely to whatever fits the plugin system's grain. Roughly what I'd reach for:
Worth separating, because they're independent and land at different sizes:
(a) Argument parsing in
resolveClientSlashCommand— split the first token from the rest of the line instead of rejecting anything containing whitespace. This has standalone value even with zero plugin work: the built-ins are argument-free today, but the resolver currently forecloses any future client command that wants an argument, and it's the smaller of the two changes.(b) A contribution point so plugins can register into that set at all.
(a) without (b) still unblocks first-party commands with arguments. (b) without (a) gives plugins argument-free commands, which is less useful but not useless.
Why this generalises past side chat
Any plugin action that wants a keyboard entry point with a free-text argument: filing an issue from a phrase (
/issue the retry loop double-counts), querying a docs plugin, jotting a note to a memory plugin. Side chat is just the case I hit first — the composer is where my hands are, and right now plugins can't reach it.Related
fork_context, timeline watch, focused agent for launcher-visible panels). That one is about the data a side chat needs; this one is about the keyboard entry point.claude/codex/opencodeagents because the plugin client sent noappVersion.All reactions