@bastani/atomic-acp 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -168
- package/dist/index.js +140 -68
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
<b>Use the <a href="https://github.com/bastani-inc/atomic">Atomic</a> coding agent inside Zed and other editors that speak the Agent Client Protocol.</b>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
<p align="center">
|
|
8
|
-
Chat with Atomic, watch its tool calls and diffs, switch models and thinking levels, and run Atomic workflows from your editor's agent panel.
|
|
9
|
-
</p>
|
|
10
|
-
|
|
11
7
|
<p align="center">
|
|
12
8
|
<a href="#get-started"><b>Get started →</b></a>
|
|
13
9
|
·
|
|
@@ -15,7 +11,7 @@
|
|
|
15
11
|
·
|
|
16
12
|
<a href="#workflows">Workflows</a>
|
|
17
13
|
·
|
|
18
|
-
<a href="#
|
|
14
|
+
<a href="#configuration">Configuration</a>
|
|
19
15
|
·
|
|
20
16
|
<a href="https://docs.bastani.ai/">Atomic docs</a>
|
|
21
17
|
</p>
|
|
@@ -30,41 +26,28 @@
|
|
|
30
26
|
|
|
31
27
|
## How it works
|
|
32
28
|
|
|
33
|
-
Your editor starts `atomic-acp` and talks to it over stdio
|
|
29
|
+
Your editor starts `atomic-acp` and talks to it over stdio with [ACP](https://agentclientprotocol.com/). For each chat thread, `atomic-acp` starts an `atomic --mode rpc` process and translates between the two.
|
|
34
30
|
|
|
35
31
|
```text
|
|
36
32
|
Zed (ACP client) ⇄ atomic-acp ⇄ atomic --mode rpc
|
|
37
33
|
```
|
|
38
34
|
|
|
39
|
-
Atomic reads files, edits code
|
|
35
|
+
Atomic reads files, edits code and runs commands on your machine, exactly as it does in a terminal. Only open workspaces you trust.
|
|
40
36
|
|
|
41
37
|
## Get started
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
- Node.js 22 or newer (20 is the minimum).
|
|
46
|
-
- Atomic 0.9.39 or newer, installed and logged in to at least one model provider:
|
|
39
|
+
You need Node.js 20 or newer and Atomic 0.9.39 or newer, signed in to at least one model provider:
|
|
47
40
|
|
|
48
41
|
```bash
|
|
49
|
-
npm install -g @bastani/atomic
|
|
42
|
+
npm install -g @bastani/atomic @bastani/atomic-acp
|
|
50
43
|
atomic # sign in, then quit
|
|
51
44
|
```
|
|
52
45
|
|
|
53
|
-
`atomic-acp` uses
|
|
54
|
-
|
|
55
|
-
### Install
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
npm install -g @bastani/atomic-acp
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
To run from source instead, clone this repository and run `npm install && npm run build`. The entry point is `dist/index.js`.
|
|
62
|
-
|
|
63
|
-
`atomic-acp --version` prints the installed version and `atomic-acp --help` lists the options. With no options, `atomic-acp` waits for an ACP client on stdio. Any other option before `--` makes it exit with an error.
|
|
46
|
+
`atomic-acp` uses the `atomic` on your `PATH`. Run `atomic-acp --help` for its options.
|
|
64
47
|
|
|
65
48
|
### Add it to Zed
|
|
66
49
|
|
|
67
|
-
|
|
50
|
+
In Zed's `settings.json`:
|
|
68
51
|
|
|
69
52
|
```json
|
|
70
53
|
{
|
|
@@ -79,66 +62,24 @@ Open Zed's `settings.json` and add an agent server:
|
|
|
79
62
|
}
|
|
80
63
|
```
|
|
81
64
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
| Setup | `command` | `args` |
|
|
85
|
-
| ------------------------- | ------------ | --------------------------------------- |
|
|
86
|
-
| Global install | `atomic-acp` | `[]` |
|
|
87
|
-
| No install, always latest | `npx` | `["-y", "@bastani/atomic-acp"]` |
|
|
88
|
-
| Source checkout | `node` | `["/path/to/atomic-acp/dist/index.js"]` |
|
|
65
|
+
Open the agent panel, pick **Atomic** and start a thread. If Atomic has no working login, Zed shows an **Authenticate** banner that opens Atomic in a terminal. `atomic-acp --terminal-login` does the same.
|
|
89
66
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
If Atomic has no working provider login, Zed shows an **Authenticate** banner that opens Atomic in a terminal. You can run the same flow yourself with `atomic-acp --terminal-login`. Since Atomic 0.9.42, device-code logins such as GitHub Copilot, Kimi Code and Meta show the code and wait for you to press Enter in that terminal before they open the browser and copy the code.
|
|
67
|
+
Without a global install, use `"command": "npx", "args": ["-y", "@bastani/atomic-acp"]`.
|
|
93
68
|
|
|
94
69
|
## What works
|
|
95
70
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
- Atomic saves every session in its own session store (by default its local database), so you can pick a thread back up in Zed's history or with `atomic --resume` in a terminal.
|
|
106
|
-
- The editor's thread history lists the project's sessions the way Atomic's `/resume` does: newest first, leaving out sessions that have no messages, name or summary.
|
|
107
|
-
- Threads get a title from your first message. Renaming in Atomic updates the title in the editor.
|
|
108
|
-
- Deleting a thread in the editor deletes its session from Atomic's session store.
|
|
109
|
-
- Listing or deleting sessions of a project with no open thread briefly starts Atomic in that project to read its session store.
|
|
110
|
-
- Sessions survive an adapter restart. The next message restores the saved session.
|
|
111
|
-
- Work that a previous Atomic process left unfinished in a session, such as messages from background subagents that never reached the agent, is recovered once the session is loaded or restored: Atomic replays it in a turn that streams into the thread, as `atomic --resume` does in a terminal.
|
|
112
|
-
- When a background shell or subagent finishes while no message is running, Atomic answers its completion notice in a turn that streams into the thread. Since Atomic 0.9.44 this also works after the session was loaded or restored in a new Atomic process; earlier versions could drop those notices.
|
|
113
|
-
- If a session's Atomic process exits during a message, the message fails with an error saying how Atomic exited, and its open tool calls and workflow runs are marked failed. A message that fails never ends as a normal reply. The next message starts Atomic again on the same session, with the same MCP servers.
|
|
114
|
-
|
|
115
|
-
Models and context
|
|
116
|
-
|
|
117
|
-
- The model and thinking-level pickers list what your Atomic setup offers, including model-specific levels such as `max`.
|
|
118
|
-
- The context window indicator shows how full the current context is after each turn.
|
|
119
|
-
|
|
120
|
-
Commands and dialogs
|
|
121
|
-
|
|
122
|
-
- Atomic prompt templates, skills (`/skill:name`), and extension commands such as `/workflow` show up in the slash command menu.
|
|
123
|
-
- When an Atomic extension or workflow asks you to pick, confirm, or type something, the editor shows a form. Clients without form support get a permission prompt for pick and confirm questions.
|
|
124
|
-
- Extension notifications show up in the thread.
|
|
125
|
-
|
|
126
|
-
MCP servers
|
|
127
|
-
|
|
128
|
-
- MCP servers the editor passes in `session/new` and `session/load` are given to that session's Atomic process. Stdio and streamable HTTP servers work; SSE servers are skipped with a warning on stderr, because Atomic doesn't support SSE.
|
|
129
|
-
- Their tools are exposed directly as `mcp__<server>__<tool>`, so a prompt can name a tool and the model can call it without codemode or tool search.
|
|
130
|
-
- `atomic-acp` doesn't write to `~/.atomic/agent/mcp.json` or `.atomic/mcp.json`. It registers the servers through a temporary Atomic extension in a private directory, deleted when the session's Atomic process exits or the adapter quits. Env and header values are never written to that file: they reach Atomic through its environment and are used exactly as the editor sent them, with no `${VAR}` or `!command` expansion. Node's compile cache is turned off for that Atomic process so it keeps no copy of the extension. Server names are reduced to letters, digits, `_` and `-`.
|
|
131
|
-
- `session/new` and `session/load` fail with invalid params for a server Atomic can't use safely: an HTTP header name that isn't a valid token, a header value with a CR, LF or NUL, a URL containing `${` or `$env:` (Atomic would fill in its own environment variables), or a stdio env value with a NUL. The error names the server and header, never the value.
|
|
132
|
-
- If your own Atomic MCP configuration defines a server with the same name, your configuration wins, as it does for any extension-contributed server.
|
|
133
|
-
- Loading a running session with a different set of servers restarts its Atomic process. A session restored by a prompt after an adapter restart has no editor MCP servers until the editor loads it again.
|
|
134
|
-
|
|
135
|
-
Startup info
|
|
136
|
-
|
|
137
|
-
- New threads open with a short summary of the Atomic version, skills, prompts, and extensions in use. Set `quietStartup: true` in your Atomic settings to hide it.
|
|
71
|
+
- Text and reasoning stream into the thread. Tool calls show their status and files, edits show a diff, and shell commands show their output.
|
|
72
|
+
- Threads are Atomic sessions. They appear in the editor's history and in `atomic --resume`, keep their title and survive an adapter restart. Deleting a thread deletes its session.
|
|
73
|
+
- The model and thinking pickers list what your Atomic setup offers, and the context indicator shows how full the context is.
|
|
74
|
+
- Prompt templates, skills (`/skill:name`) and extension commands such as `/workflow` appear in the slash menu.
|
|
75
|
+
- When Atomic asks you to pick, confirm or type something, the editor shows a form.
|
|
76
|
+
- `ask_user_question` shows all of its questions in one form, multi-select included.
|
|
77
|
+
- MCP servers the editor configures reach the thread's Atomic process, and their tools are callable as `mcp__<server>__<tool>`. Stdio and HTTP servers work, SSE servers are skipped. `atomic-acp` never writes to your Atomic MCP config, and a server you define there under the same name wins.
|
|
78
|
+
- If Atomic exits during a message, the message fails with the reason, and the next message starts Atomic again on the same session.
|
|
138
79
|
|
|
139
80
|
## Workflows
|
|
140
81
|
|
|
141
|
-
Atomic workflows run from the editor
|
|
82
|
+
Atomic workflows run from the editor as they do in the terminal:
|
|
142
83
|
|
|
143
84
|
```text
|
|
144
85
|
/workflow list
|
|
@@ -146,128 +87,72 @@ Atomic workflows run from the editor the same way they do in the terminal.
|
|
|
146
87
|
/workflow status
|
|
147
88
|
```
|
|
148
89
|
|
|
149
|
-
A message that starts
|
|
150
|
-
|
|
151
|
-
- Stopping the message (cancel in the editor) also quits the runs it started. They stay resumable with `/workflow resume <runId>`.
|
|
152
|
-
- If a run stops to wait for human input, the message stops waiting for that run and tells you. Reply in the thread and the agent can answer the prompt with its `workflow` tool.
|
|
153
|
-
- Runs that use Atomic's local worker pools (the `workflows.localWorkers` setting) run under the session's Atomic process too. Since Atomic 0.9.43, a worker that dies is replaced and its child replays from its last checkpoint, so the run can still complete. If the pool gives up, the run's tool call is marked failed and shows Atomic's error, which names the worker's log file under `worker-logs/`. Since Atomic 0.9.44, a pool's workers run under a coordinator process that exits with the session's Atomic process, so stopping the message, quitting `atomic-acp` or Atomic exiting leaves no pool processes behind. Since Atomic 0.9.45, a large pool on a busy machine gets more time to start when `workflows.localWorkers.startupTimeoutMs` isn't set. If its workers are still too slow, the run's tool call fails with an error that names that setting.
|
|
154
|
-
- Set `ATOMIC_ACP_WAIT_FOR_WORKFLOWS=0` to end the message as soon as the run starts, as before. Runs then continue in the background, and their notices stream into the thread.
|
|
90
|
+
A message that starts a workflow stays open until every run it started ends, so the editor doesn't report the agent as done while work is still going. Each run appears as a tool call with its stages and result.
|
|
155
91
|
|
|
156
|
-
|
|
92
|
+
- Cancelling the message quits its runs. Resume one with `/workflow resume <runId>`.
|
|
93
|
+
- A run that waits for your input stops holding the message. Reply in the thread and the agent answers the prompt.
|
|
94
|
+
- Set `ATOMIC_ACP_WAIT_FOR_WORKFLOWS=0` to end the message as soon as a run starts.
|
|
157
95
|
|
|
158
|
-
|
|
159
|
-
| ------------------------- | -------------------------------------------------- |
|
|
160
|
-
| `/workflow-runs [status]` | Recent runs, optionally filtered by status |
|
|
161
|
-
| `/workflow-run <runId>` | The saved summary for one run (may lag a live run) |
|
|
96
|
+
`/workflow-runs [status]` lists the project's recent runs, and `/workflow-run <runId>` shows one run's saved summary.
|
|
162
97
|
|
|
163
98
|
## Slash commands
|
|
164
99
|
|
|
165
|
-
|
|
100
|
+
Besides your Atomic prompts, skills and extension commands:
|
|
166
101
|
|
|
167
|
-
| Command | What it does
|
|
168
|
-
| ------------------------------ |
|
|
169
|
-
| `/compact [instructions]` | Compact the context
|
|
170
|
-
| `/autocompact on\|off\|toggle` | Turn automatic compaction on or off
|
|
171
|
-
| `/session` | Session ID,
|
|
172
|
-
| `/name <name>` | Rename the session
|
|
173
|
-
| `/export` | Export the session as HTML
|
|
174
|
-
| `/steering`, `/follow-up` | Show or set how queued messages are delivered
|
|
175
|
-
| `/changelog` | Show
|
|
102
|
+
| Command | What it does |
|
|
103
|
+
| ------------------------------ | ------------------------------------------------ |
|
|
104
|
+
| `/compact [instructions]` | Compact the context |
|
|
105
|
+
| `/autocompact on\|off\|toggle` | Turn automatic compaction on or off |
|
|
106
|
+
| `/session` | Session ID, tokens, messages and cost |
|
|
107
|
+
| `/name <name>` | Rename the session |
|
|
108
|
+
| `/export` | Export the session as HTML to the working folder |
|
|
109
|
+
| `/steering`, `/follow-up` | Show or set how queued messages are delivered |
|
|
110
|
+
| `/changelog` | Show Atomic's changelog |
|
|
176
111
|
|
|
177
|
-
Use the editor's
|
|
178
|
-
|
|
179
|
-
Prompt templates load from `~/.atomic/agent/prompts/` and `<project>/.atomic/prompts/`.
|
|
112
|
+
Use the editor's pickers instead of `/model` and `/thinking`, and a new thread instead of `/clear`.
|
|
180
113
|
|
|
181
114
|
## Configuration
|
|
182
115
|
|
|
183
|
-
Set these in the `env`
|
|
184
|
-
|
|
185
|
-
| Variable | Default | Purpose |
|
|
186
|
-
| ------------------------------------ | ---------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
187
|
-
| `ATOMIC_ACP_ATOMIC_COMMAND` | `atomic` (`atomic.cmd` on Windows) | Path or name of the Atomic executable. Arguments are not allowed here. |
|
|
188
|
-
| `ATOMIC_ACP_ENABLE_EMBEDDED_CONTEXT` | unset | Set to `true` to tell the editor it may attach file contents directly to prompts. |
|
|
189
|
-
| `ATOMIC_ACP_WAIT_FOR_WORKFLOWS` | `1` | Set to `0` to end a message without waiting for the workflow runs it started. |
|
|
190
|
-
| `ATOMIC_ACP_HEADLESS` | unset | Set to `1` when no person can answer questions. See [Headless clients](#headless-clients). |
|
|
191
|
-
| `ATOMIC_ACP_ATOMIC_ARGS` | unset | JSON array of extra arguments for every Atomic process, for example `["--model", "openai/gpt-5.5"]`. |
|
|
192
|
-
|
|
193
|
-
```json
|
|
194
|
-
{
|
|
195
|
-
"agent_servers": {
|
|
196
|
-
"Atomic": {
|
|
197
|
-
"type": "custom",
|
|
198
|
-
"command": "atomic-acp",
|
|
199
|
-
"args": [],
|
|
200
|
-
"env": {
|
|
201
|
-
"ATOMIC_ACP_ATOMIC_COMMAND": "/path/to/atomic",
|
|
202
|
-
"ATOMIC_ACP_ENABLE_EMBEDDED_CONTEXT": "true"
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
### Headless clients
|
|
210
|
-
|
|
211
|
-
Set `ATOMIC_ACP_HEADLESS=1` for clients that run Atomic without a person watching, such as automation. Questions then end at once instead of waiting:
|
|
116
|
+
Set these in the `env` of your agent server entry:
|
|
212
117
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
118
|
+
| Variable | Default | Purpose |
|
|
119
|
+
| ------------------------------------ | -------- | --------------------------------------------------------------- |
|
|
120
|
+
| `ATOMIC_ACP_ATOMIC_COMMAND` | `atomic` | Path or name of the Atomic executable |
|
|
121
|
+
| `ATOMIC_ACP_ATOMIC_ARGS` | unset | JSON array of extra arguments for every Atomic process |
|
|
122
|
+
| `ATOMIC_ACP_WAIT_FOR_WORKFLOWS` | `1` | `0` ends a message without waiting for the runs it started |
|
|
123
|
+
| `ATOMIC_ACP_HEADLESS` | unset | `1` when no person can answer questions (see below) |
|
|
124
|
+
| `ATOMIC_ACP_ENABLE_EMBEDDED_CONTEXT` | unset | `true` lets the editor attach file contents directly to prompts |
|
|
216
125
|
|
|
217
|
-
|
|
126
|
+
Arguments after `--` also go to every Atomic process, for example `"args": ["--", "--model", "openai/gpt-6.1-sol"]`. Flags the adapter manages itself, such as `--mode` and the session flags, are refused at startup.
|
|
218
127
|
|
|
219
|
-
|
|
128
|
+
Everything else, including logins, models, skills, extensions and the session store, comes from your normal Atomic settings.
|
|
220
129
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
```json
|
|
224
|
-
{ "command": "atomic-acp", "args": ["--", "--model", "openai/gpt-5.5", "-e", "/path/to/extension.ts"] }
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
Each argument is passed to Atomic as is, without a shell. `atomic-acp` exits with an error at startup if `ATOMIC_ACP_ATOMIC_ARGS` isn't a JSON array of strings, or if an argument would take over what the adapter manages: `--mode`, `--print`, the session flags (`--session`, `--session-id`, `--session-dir`, `--session-store`, `--session-prefix`, `--storage`, `--storage-file`, `--no-session`, `--continue`, `--resume`, `--fork`, `--import`), `--export`, `--list-models`, `--help`, `--version`, or a nested `--`.
|
|
130
|
+
### Headless clients
|
|
228
131
|
|
|
229
|
-
|
|
132
|
+
With `ATOMIC_ACP_HEADLESS=1`, questions end at once instead of waiting. `ask_user_question` tells the model that no person is available, extension dialogs are cancelled, and a workflow that stops for input is quit. It stays resumable.
|
|
230
133
|
|
|
231
134
|
## Limitations
|
|
232
135
|
|
|
233
|
-
- `ask_user_question`
|
|
234
|
-
- The editor's file and terminal APIs aren't used.
|
|
235
|
-
-
|
|
236
|
-
- Zed is the
|
|
136
|
+
- `ask_user_question` needs Atomic 0.9.50 or newer and an editor that supports ACP forms (elicitation). Without them, the question can't be answered.
|
|
137
|
+
- Atomic reads, writes and runs commands itself. The editor's file and terminal APIs aren't used.
|
|
138
|
+
- Messages sent while Atomic is busy are queued and sent one at a time.
|
|
139
|
+
- Zed is the tested client. Other ACP clients should work but may render some updates differently.
|
|
237
140
|
|
|
238
141
|
## Development
|
|
239
142
|
|
|
240
143
|
```bash
|
|
241
144
|
npm install
|
|
242
|
-
npm run dev
|
|
243
|
-
npm run build
|
|
145
|
+
npm run dev # run from source
|
|
244
146
|
npm test
|
|
245
147
|
npm run lint
|
|
246
|
-
npm run format
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
The ACP side lives in `src/acp/`, and the wrapper around the Atomic subprocess lives in `src/atomic-rpc/`.
|
|
250
|
-
|
|
251
|
-
These smoke scripts exercise a real Atomic install. They need a provider login and use real model tokens, so they aren't part of `npm test`:
|
|
252
|
-
|
|
253
|
-
```bash
|
|
254
148
|
npm run build
|
|
255
|
-
npm run smoke:e2e:atomic # one prompt, checks streamed text and end_turn
|
|
256
|
-
npm run smoke:mcp # an editor MCP server's tool is called through ACP
|
|
257
|
-
npm run smoke:workflow-wait # /workflow sleepy keeps the message open until the run ends; killing Atomic mid-run fails the message and the next one restarts it
|
|
258
|
-
node scripts/smoke-workflow.mjs # runs /workflow list over ACP
|
|
259
149
|
```
|
|
260
150
|
|
|
261
|
-
`
|
|
151
|
+
`src/acp/` holds the ACP side and `src/atomic-rpc/` the Atomic process wrapper. The `npm run smoke:*` scripts drive a real, signed-in Atomic and spend model tokens, so they aren't part of `npm test`.
|
|
262
152
|
|
|
263
153
|
## Releasing
|
|
264
154
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
1. Merge a commit to `main` titled `Release X.Y.Z` (or `Release X.Y.Z-alpha.N`) that sets the same version in `package.json`.
|
|
268
|
-
2. Push a tag named `X.Y.Z` on that commit.
|
|
269
|
-
|
|
270
|
-
The [publish workflow](.github/workflows/publish.yml) checks the tag against the version and commit title, runs the test suite, stages a draft GitHub Release, publishes to npm from the `npm-publish` environment, and then publishes the release. Stable versions go to the `latest` tag on npm and alpha versions go to `next`.
|
|
155
|
+
Merge a commit titled `Release X.Y.Z` (or `Release X.Y.Z-alpha.N`) that sets that version in `package.json`, then push the tag `X.Y.Z` on it. The [publish workflow](.github/workflows/publish.yml) checks the tag, runs the tests and publishes to npm with [trusted publishing](https://docs.npmjs.com/trusted-publishers). Stable versions go to `latest` and alphas to `next`.
|
|
271
156
|
|
|
272
157
|
## Credits
|
|
273
158
|
|