You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e78d3e2
Browse filesBrowse the repository at this point in the historyBrowse files
feat(acp): prefix extension methods with _nanocoder/ and advertise them (#1909)
* feat(acp): prefix extension methods with _nanocoder/ and advertise them
ACP reserves the _ prefix for custom methods. Answer renameSession, timeline/list, timeline/revert and retryTurn as _nanocoder/<name>, keep the bare names as deprecated aliases that log a one-time notice, and list the exact method and notification names under agentCapabilities._meta.nanocoder. An unrecognised custom request now fails with Method not found (-32601). The VS Code extension uses the advertised names and falls back to the bare ones. Closes#1893
* fix(acp): share the notification name and prefix, and harden the new tests
Export the session title notification name and use it both where it is sent and in the advertised list, copy the advertised notification list like the method list, and have the VS Code client build the names it looks up from the shared prefix and method list instead of repeating the literals.
Tests: run the logger-patching deprecation test serially so the bare-name calls in other tests cannot land in its window, reuse makeHandshakenClient in the VS Code spec, and cover an agent that advertises only some of the extension methods.
ACP extension requests now use the `_` prefix ACP reserves for custom methods: `_nanocoder/renameSession`, `_nanocoder/timeline/list`, `_nanocoder/timeline/revert` and `_nanocoder/retryTurn`. The bare names still work as deprecated aliases and log a one-time notice, and will be removed in a later release. `initialize` now lists the exact method and notification names under `agentCapabilities._meta.nanocoder`, so a client can detect support instead of guessing from the version. A custom request the agent doesn't recognise now fails with the standard "Method not found" (`-32601`) instead of a plain error. The VS Code extension uses the advertised names and falls back to the bare ones for an older agent.
Copy file name to clipboardExpand all lines: docs/features/acp.md
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,9 +35,34 @@ With ACP the **client is the UI**: the agent runs headless and everything (strea
35
35
-**`ask_user`** — when the agent asks a clarifying question, the options appear as selectable buttons in the editor. (Selection only; a free-form typed answer is not available over ACP.)
36
36
-**`@`-mentioned files** — files you reference in the editor are read and included in the prompt, using the editor's live buffer (including unsaved edits) when available.
37
37
-**Session persistence** - ACP sessions are saved to disk like TUI sessions (see [Session Management](session-management.md)). Loading or resuming a thread replays its history, even after the editor and agent restart. Loading or resuming a session ID that is neither in memory nor on disk fails with `Session not found on disk: <id>` instead of creating an empty session; only `session/new` creates one.
38
-
-**Session management** - clients can list, resume, close and delete sessions. Nanocoder also answers a `renameSession` extension method (`sessionId`, `title`), and new sessions get a generated title from the first message.
38
+
-**Session management** - clients can list, resume, close and delete sessions. Nanocoder also answers a `_nanocoder/renameSession` extension method (`sessionId`, `title`; see [Extension methods](#extension-methods)), and new sessions get a generated title from the first message.
39
39
-**Images** - PNG, JPEG, GIF and WebP attachments are sent to the model as images.
40
40
41
+
## Extension methods
42
+
43
+
ACP reserves method names starting with `_` for custom methods. Nanocoder's are:
44
+
45
+
| Method | Params | What it does |
46
+
|--------|--------|--------------|
47
+
|`_nanocoder/renameSession`|`sessionId`, `title`| Sets a session's title |
48
+
|`_nanocoder/timeline/list`|`sessionId`| Lists the session's file-change checkpoints |
49
+
|`_nanocoder/timeline/revert`|`sessionId`, `checkpointId`| Reverts the files and history to before a checkpoint |
50
+
|`_nanocoder/retryTurn`|`sessionId`, optional `promptText`| Removes the last turn so the prompt can be sent again |
51
+
52
+
The agent also sends the `_nanocoder/sessionTitleChanged` notification when it titles a session in the background.
53
+
54
+
**Capability detection.**`initialize` lists the exact names under `agentCapabilities._meta.nanocoder`:
Take the names from that list as they are rather than building them from a prefix. An agent that doesn't list a method doesn't support it under that name.
61
+
62
+
**Deprecated aliases.** The same methods are still answered under their old bare names (`renameSession`, `timeline/list`, `timeline/revert`, `retryTurn`) for clients that predate the prefix. The first use of each logs a deprecation notice. The aliases will be removed in a later release, announced in the changelog.
63
+
64
+
**Unknown methods.** A custom request the agent doesn't recognise fails with the standard JSON-RPC "Method not found" error (`-32601`), so "not supported" can be told apart from "failed".
65
+
41
66
## Setup in Zed
42
67
43
68
[Zed](https://zed.dev) is the reference ACP client. Register Nanocoder as a custom agent in Zed's `settings.json` (`Cmd+,`, or **zed: open settings** from the command palette):
0 commit comments