[Feature] Make built-in slash command replies client-neutral over ACP (not written for the VS Code sidebar)
Description
When an ACP client sends a built-in slash command such as /help, /settings or /model, Nanocoder answers with text written for the VS Code sidebar: "Available slash commands in VS Code GUI", "the Settings tab in the Nanocoder sidebar", "the model selector in the chat header", and so on. Other ACP clients show this text to their users, and it describes a UI they don't have.
I'd like the replies to be neutral for clients that are not the VS Code extension, while keeping the VS Code wording exactly as it is for the extension. The agent can tell the clients apart from the clientInfo that ACP clients send in initialize.
Tracked from Nano-Collective/nanocoder-desktop#12 (item 10). It is a nice-to-have there, because the desktop works around it by not showing the text.
Use Case
Nanocoder Desktop and other ACP clients (editors, other desktop apps) pass user input starting with / to the agent. A user who types /help in a client other than the VS Code extension is told about "the VS Code GUI", a keyboard shortcut for copying code that doesn't exist, a "chat header" selector, and a "Settings tab in the Nanocoder sidebar".
The desktop avoids showing Nanocoder's /help text as its own help and builds its command list from custom commands only. But the user can still type a built-in command, and the reply (also stored as a display-only message and replayed on resume) will mention VS Code.
Proposed Solution
- Read
clientInfo. Keep theclientInfo(name, title, version) frominitialize, which ACP sends and Nanocoder currently ignores. It may be missing or null. The VS Code extension already sendsname: 'Nanocoder VS Code Extension'. Nanocoder Desktop will send its own name. - Two wordings. For the VS Code extension, keep today's text unchanged. For every other client, including one that sends no
clientInfo, use neutral text:/help: "Available slash commands" (no "VS Code GUI"), listing only commands that apply to every client (/clear,/help) plus custom commands, and a note that interactive commands such as/init,/theme,/compact,/context-maxand/usageare CLI-only./copyis listed only for the VS Code extension, because only its webview handles it./copy: "/copyisn't available in this client."/model,/provider: "Use your client's model/provider selector."/settings: "Use your client's settings."/init,/theme,/compact,/context-max,/usage: "only available in the interactive Nanocoder CLI (nanocoderin a terminal)."
- Identification. Match the VS Code extension through one small helper, so the check lives in one place.
- Unchanged:
/clear, the unknown-command reply, and custom commands.
Alternatives Considered
- Neutral text for everyone. Simplest, but it removes useful VS Code guidance (the Settings tab, the keyboard shortcut) from the extension.
- Let the client supply the strings. A client-sent help text through
_metaoninitializeis flexible, but it makes every client write and maintain its own copy. - Advertise the built-in commands in
available_commands_updateso clients build their own help. Useful, but it doesn't change what happens when a user types a command, and it is a larger change. - Do nothing. Clients hide or ignore the text, as Nanocoder Desktop does today. Users who type a built-in command still see the VS Code wording.
Additional Context
- [x] I have searched existing issues to ensure this is not a duplicate
- [x] This feature aligns with the project's goals (local-first AI assistance)
Current behavior, checked against main at fc01e23:
source/acp/acp-agent.ts(~L249-368): built-in command handling insideprompt. The VS Code-specific text is at ~L317 and L324 (/help), L339 (/copy), L344 (/model,/provider), L350 (/settings) and L359 (/init,/theme,/compact,/context-max,/usage)./clear(L288) and the unknown-command reply (L364) are neutral.source/acp/acp-agent.ts(~L116-124):initializestores onlyparams.clientCapabilities.clientInfois ignored.- ACP's
InitializeRequest.clientInfois optional and nullable today, and the SDK notes that "in future versions of the protocol, this will be required". plugins/vscode/src/acp-client.ts(~L190): the extension sendsclientInfo: {name: 'Nanocoder VS Code Extension', version}.source/acp/acp-agent.ts(~L146-151):available_commands_updatecontains only custom commands.- The replies are stored as display-only messages (
sendBuiltinReply, ~L268-286), so they are replayed onsession/loadandsession/resume. source/acp/acp-agent.spec.ts(~L860-911) tests the/helpreply.docs/features/vscode-extension.md(~L133-134) documents the/settingsand CLI-only replies.
Implementation Notes (optional)
Store clientInfo on the agent next to clientCapabilities, add a small isVsCodeClient() helper, and move the reply strings into one function that takes that flag, so the VS Code text stays identical and the neutral text lives next to it. Replies already stored in a session keep whatever wording they had when they were written.
Open questions for maintainers:
- How to recognise the VS Code extension. Matching
clientInfo.nameis simple but a string check. A dedicated marker (for example a field in_metasent by the extension) would be sturdier. - Should the neutral
/helplist/copy? I propose listing it only for the VS Code extension. - Wording. Is "your client's settings" good enough, or should the neutral text name the client, using
clientInfo.titlewhen present andnameotherwise? - Other clients' names. How do Zed and other clients identify themselves? The neutral path doesn't depend on it, but it matters if replies ever name the client.
Acceptance criteria:
- [ ] For the VS Code extension, every built-in reply is unchanged, word for word.
- [ ] For any other client, no built-in reply mentions VS Code, the sidebar, the chat header, or a VS Code keyboard shortcut.
- [ ] For any other client,
/copyreturns a plain "not available in this client" line. - [ ] A client that sends no
clientInfo, or a null one, gets the neutral wording. - [ ]
/clear, the unknown-command reply and custom commands behave as before. - [ ]
docs/features/acp.mddescribes the two wordings, and the VS Code docs still match.
Test plan:
- ACP spec: with
clientInfoset to the VS Code extension's name,/help,/copy,/model,/settingsand/initreturn the current text. - ACP spec: with another, missing or null
clientInfo, the same commands return neutral text containing no "VS Code". - Regression:
/clearand the unknown-command reply are identical for both.
Out of scope: advertising built-in commands through available_commands_update, adding new built-in commands, and changing replies already stored in sessions.