@bastani/atomic-acp 0.0.19 → 0.0.20
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 +90 -62
- package/dist/index.js +2 -13
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<h1 align="center">atomic-acp</h1>
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<b>Use the <a href="https://github.com/bastani-inc/atomic">Atomic</a> coding agent
|
|
4
|
+
<b>Use the <a href="https://github.com/bastani-inc/atomic">Atomic</a> coding agent in Zed and other editors that support the Agent Client Protocol.</b>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<a href="#
|
|
8
|
+
<a href="#install"><b>Install →</b></a>
|
|
9
9
|
·
|
|
10
|
-
<a href="#what-
|
|
10
|
+
<a href="#what-you-get">What you get</a>
|
|
11
11
|
·
|
|
12
12
|
<a href="#subagents-and-background-work">Subagents</a>
|
|
13
13
|
·
|
|
@@ -26,35 +26,55 @@
|
|
|
26
26
|
|
|
27
27
|
## How it works
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
`atomic-acp` connects your code editor to Atomic using the [Agent Client Protocol (ACP)](https://agentclientprotocol.com/), a standard way for editors to talk to coding agents. For each chat thread, `atomic-acp` starts a background Atomic process (`atomic --mode rpc`) and translates messages back and forth between Atomic and your editor.
|
|
30
30
|
|
|
31
31
|
```text
|
|
32
|
-
|
|
32
|
+
Editor (such as Zed) <-> atomic-acp <-> Atomic (atomic --mode rpc)
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Atomic reads files, edits code and runs commands on your machine,
|
|
35
|
+
Atomic reads files, edits code, and runs shell commands directly on your machine, just as it does in a terminal. Only open folders you trust.
|
|
36
36
|
|
|
37
|
-
##
|
|
37
|
+
## Install
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
`atomic-acp` needs Node.js 20 or newer. It does not install Atomic for you. Instead, it runs whichever `atomic` command is available on your `PATH`, so install Atomic 0.10.0 or newer first.
|
|
40
|
+
|
|
41
|
+
**Recommended: standalone Atomic installer.** Atomic brings its own runtime, so Atomic itself does not depend on your Node.js version:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# macOS and Linux
|
|
45
|
+
curl -fsSL https://raw.githubusercontent.com/bastani-inc/atomic/main/install.sh | sh
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```powershell
|
|
49
|
+
# Windows PowerShell
|
|
50
|
+
irm https://raw.githubusercontent.com/bastani-inc/atomic/main/install.ps1 | iex
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Alternative: install Atomic with npm.** The npm package requires Node.js 24.20 or newer:
|
|
40
54
|
|
|
41
55
|
```bash
|
|
42
|
-
npm install -g @bastani/atomic
|
|
43
|
-
atomic # sign in, then quit
|
|
56
|
+
npm install -g @bastani/atomic
|
|
44
57
|
```
|
|
45
58
|
|
|
46
|
-
|
|
59
|
+
Next, install the adapter and sign in to Atomic once:
|
|
47
60
|
|
|
48
61
|
```bash
|
|
49
|
-
curl -fsSL https://raw.githubusercontent.com/bastani-inc/atomic/main/install.sh | sh # Windows: irm https://raw.githubusercontent.com/bastani-inc/atomic/main/install.ps1 | iex
|
|
50
62
|
npm install -g @bastani/atomic-acp
|
|
63
|
+
atomic # sign in to a model provider, then quit
|
|
51
64
|
```
|
|
52
65
|
|
|
53
|
-
|
|
66
|
+
To point the adapter at a specific Atomic binary instead of the one on your `PATH`, set `ATOMIC_ACP_ATOMIC_COMMAND` to its path. Run `atomic-acp --help` to see all command-line options.
|
|
67
|
+
|
|
68
|
+
### Update
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
atomic update # update Atomic itself
|
|
72
|
+
npm install -g @bastani/atomic-acp@latest # update this adapter
|
|
73
|
+
```
|
|
54
74
|
|
|
55
75
|
### Add it to Zed
|
|
56
76
|
|
|
57
|
-
|
|
77
|
+
Add this entry to Zed's `settings.json`:
|
|
58
78
|
|
|
59
79
|
```json
|
|
60
80
|
{
|
|
@@ -69,78 +89,80 @@ In Zed's `settings.json`:
|
|
|
69
89
|
}
|
|
70
90
|
```
|
|
71
91
|
|
|
72
|
-
Open the agent panel,
|
|
92
|
+
Open the agent panel in Zed, choose **Atomic**, and start a thread.
|
|
93
|
+
|
|
94
|
+
If Atomic is not signed in to a model provider yet, Zed shows an **Authenticate** banner that opens Atomic in a terminal so you can sign in. Running `atomic-acp --terminal-login` does the same thing.
|
|
73
95
|
|
|
74
|
-
|
|
96
|
+
If you prefer not to install the adapter globally, use `"command": "npx"` with `"args": ["-y", "@bastani/atomic-acp"]`.
|
|
75
97
|
|
|
76
|
-
## What
|
|
98
|
+
## What you get
|
|
77
99
|
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
- MCP servers
|
|
85
|
-
- If Atomic exits
|
|
100
|
+
- Replies and reasoning stream into the chat thread as Atomic writes them.
|
|
101
|
+
- Tool calls show their status and the files they touch. File edits show a diff, and shell commands show their output.
|
|
102
|
+
- Each editor thread maps to a real Atomic session. Threads appear in your editor's history and in `atomic --resume`, keep their title, and survive an adapter restart. Deleting a thread deletes its Atomic session.
|
|
103
|
+
- The editor's model and thinking pickers show the options available in your Atomic setup. The context meter shows how full the conversation window is.
|
|
104
|
+
- Your Atomic prompt templates, skills (`/skill:name`), and extension commands appear in the slash menu.
|
|
105
|
+
- When Atomic asks you to choose an option, confirm an action, or type an answer, the editor shows a form. Multi-question prompts appear together in one form, including multi-select questions.
|
|
106
|
+
- External tool servers (MCP servers) configured in your editor are forwarded to that thread's Atomic session, with tools named `mcp__<server>__<tool>`. Local command servers and HTTP servers work; legacy SSE servers are skipped. `atomic-acp` never edits your Atomic MCP config file, and any server with the same name in your Atomic config takes priority.
|
|
107
|
+
- If Atomic exits unexpectedly in the middle of a reply, the message reports why it failed. Your next message restarts Atomic on the same session.
|
|
86
108
|
|
|
87
109
|
## Subagents and background work
|
|
88
110
|
|
|
89
|
-
Atomic
|
|
111
|
+
Atomic can hand off larger tasks to [subagents](https://docs.bastani.ai/orchestration) and background shell commands. Your editor shows each one as a tool call.
|
|
90
112
|
|
|
91
|
-
- A
|
|
92
|
-
- When background
|
|
93
|
-
- Cancelling a
|
|
94
|
-
-
|
|
113
|
+
- A reply finishes as soon as Atomic finishes its turn, even if subagents or background commands are still running. Atomic does not report background work over its background protocol, so `atomic-acp` cannot wait for it automatically. If you want the reply to stay open until a background task finishes, ask the agent to wait for it.
|
|
114
|
+
- When a background task finishes, Atomic handles its result in a new turn that streams into the thread automatically. A message you send while that turn is running joins it.
|
|
115
|
+
- Cancelling a reply stops the current turn and drops any messages queued behind it, just like pressing Esc in Atomic. Subagents and background commands keep running until you ask the agent to stop them.
|
|
116
|
+
- Switching to another thread, deleting a thread, or reopening a thread with different MCP servers stops its Atomic process. Any active reply ends as cancelled, and its subagents stop with the process.
|
|
95
117
|
|
|
96
118
|
## Slash commands
|
|
97
119
|
|
|
98
|
-
|
|
120
|
+
In addition to your Atomic prompts, skills, and extension commands, `atomic-acp` provides:
|
|
99
121
|
|
|
100
|
-
| Command | What it does
|
|
101
|
-
| ------------------------------ |
|
|
102
|
-
| `/compact [instructions]` |
|
|
103
|
-
| `/autocompact on\|off\|toggle` | Turn automatic compaction on or off
|
|
104
|
-
| `/session` |
|
|
105
|
-
| `/name <name>` | Rename the session
|
|
106
|
-
| `/export` |
|
|
107
|
-
| `/steering`, `/follow-up` |
|
|
108
|
-
| `/changelog` | Show Atomic
|
|
122
|
+
| Command | What it does |
|
|
123
|
+
| ------------------------------ | ------------------------------------------------------ |
|
|
124
|
+
| `/compact [instructions]` | Summarize older messages to free up context space |
|
|
125
|
+
| `/autocompact on\|off\|toggle` | Turn automatic compaction on or off |
|
|
126
|
+
| `/session` | Show the session ID, token counts, messages, and cost |
|
|
127
|
+
| `/name <name>` | Rename the session |
|
|
128
|
+
| `/export` | Save the session as an HTML file in the project folder |
|
|
129
|
+
| `/steering`, `/follow-up` | View or change how queued messages are delivered |
|
|
130
|
+
| `/changelog` | Show the changelog for your installed version of Atomic |
|
|
109
131
|
|
|
110
|
-
Use
|
|
132
|
+
Use your editor's pickers instead of `/model` and `/thinking`. Start a new thread instead of `/clear`.
|
|
111
133
|
|
|
112
134
|
## Configuration
|
|
113
135
|
|
|
114
|
-
Set these
|
|
136
|
+
Set any of these environment variables inside the `env` block of your editor's agent server entry:
|
|
115
137
|
|
|
116
|
-
| Variable | Default |
|
|
117
|
-
| ------------------------------------ | -------- |
|
|
118
|
-
| `ATOMIC_ACP_ATOMIC_COMMAND` | `atomic` |
|
|
119
|
-
| `ATOMIC_ACP_ATOMIC_ARGS` | unset | JSON array of extra
|
|
120
|
-
| `ATOMIC_ACP_HEADLESS` | unset | `1`
|
|
121
|
-
| `ATOMIC_ACP_ENABLE_EMBEDDED_CONTEXT` | unset | `true`
|
|
122
|
-
| `ATOMIC_ACP_DIR` | unset |
|
|
138
|
+
| Variable | Default | What it does |
|
|
139
|
+
| ------------------------------------ | -------- | --------------------------------------------------------------------------- |
|
|
140
|
+
| `ATOMIC_ACP_ATOMIC_COMMAND` | `atomic` | Command name or full path of the Atomic executable |
|
|
141
|
+
| `ATOMIC_ACP_ATOMIC_ARGS` | unset | JSON array of extra flags passed to every Atomic process |
|
|
142
|
+
| `ATOMIC_ACP_HEADLESS` | unset | Set to `1` for automated runs where nobody is present to answer questions |
|
|
143
|
+
| `ATOMIC_ACP_ENABLE_EMBEDDED_CONTEXT` | unset | Set to `true` to let the editor attach full file contents inside prompts |
|
|
144
|
+
| `ATOMIC_ACP_DIR` | unset | Folder for the adapter's own session map (see below) |
|
|
123
145
|
|
|
124
|
-
|
|
146
|
+
You can also pass extra Atomic flags after `--`, for example `"args": ["--", "--model", "openai/gpt-6.1-sol"]`. The adapter rejects flags that it controls itself, such as `--mode` and session flags.
|
|
125
147
|
|
|
126
|
-
|
|
148
|
+
All other settings, including logins, models, skills, extensions, and session storage, come from your normal Atomic configuration.
|
|
127
149
|
|
|
128
150
|
### The adapter's own state
|
|
129
151
|
|
|
130
|
-
|
|
152
|
+
`atomic-acp` stores one file of its own, `session-map.json`, which records which project folder each thread belongs to so threads can be listed and reopened. By default it lives in `~/.atomic/atomic-acp`, or in `ATOMIC_ACP_DIR` when set. The folder is created on first use and is readable only by your user account.
|
|
131
153
|
|
|
132
|
-
Set `ATOMIC_ACP_DIR` when Atomic runs
|
|
154
|
+
Set `ATOMIC_ACP_DIR` when Atomic runs inside a sandbox with its own private agent folder (`ATOMIC_CODING_AGENT_DIR`) and your home `~/.atomic` folder is read-only. Without it, starting a thread fails because `session-map.json` cannot be written. Keep using the same `ATOMIC_ACP_DIR` across restarts so saved threads can still be reopened.
|
|
133
155
|
|
|
134
|
-
###
|
|
156
|
+
### Automated runs without a user
|
|
135
157
|
|
|
136
|
-
|
|
158
|
+
When `ATOMIC_ACP_HEADLESS=1` is set, prompts that ask for human input return immediately instead of waiting. Question tools tell the model that no person is available, and interactive dialogs are cancelled.
|
|
137
159
|
|
|
138
160
|
## Limitations
|
|
139
161
|
|
|
140
|
-
-
|
|
141
|
-
- Atomic reads,
|
|
142
|
-
- Messages sent while Atomic is busy
|
|
143
|
-
- Zed is the tested
|
|
162
|
+
- Interactive question forms require an editor that supports ACP form prompts. In editors without form support, `ask_user_question` cannot be answered.
|
|
163
|
+
- Atomic reads files, edits files, and runs commands directly on the machine rather than going through your editor's file or terminal APIs.
|
|
164
|
+
- Messages sent while Atomic is busy wait in a queue and run one at a time.
|
|
165
|
+
- Zed is the tested editor. Other ACP-compatible editors should work, though some updates may display differently.
|
|
144
166
|
|
|
145
167
|
## Development
|
|
146
168
|
|
|
@@ -152,13 +174,19 @@ npm run lint
|
|
|
152
174
|
npm run build
|
|
153
175
|
```
|
|
154
176
|
|
|
155
|
-
`src/acp/`
|
|
177
|
+
`src/acp/` handles the editor-facing ACP protocol, and `src/atomic-rpc/` manages the Atomic child process. The `npm run smoke:*` scripts talk to a live, signed-in Atomic and spend model tokens, so `npm test` does not run them.
|
|
156
178
|
|
|
157
179
|
## Releasing
|
|
158
180
|
|
|
159
|
-
|
|
181
|
+
1. Open a pull request that updates `version` in `package.json` and whose final commit title is `Release X.Y.Z` (or `Release X.Y.Z-alpha.N` for a prerelease).
|
|
182
|
+
2. Merge it with a squash or rebase merge. A standard merge commit is titled `Merge pull request ...` and does not trigger a release. For a squash merge, set the commit title to `Release X.Y.Z` (GitHub's ` (#N)` suffix is accepted).
|
|
183
|
+
3. The [tag-release workflow](.github/workflows/tag-release.yml) tags the commit and starts the [publish workflow](.github/workflows/publish.yml), which verifies the tag, runs the test suite, and publishes to npm with [trusted publishing](https://docs.npmjs.com/trusted-publishers). Stable versions publish under the `latest` tag and alphas under `next`.
|
|
160
184
|
|
|
161
|
-
|
|
185
|
+
If a publish run fails after the tag is created, re-run it from `main`:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
gh workflow run publish.yml --ref main -f tag=X.Y.Z
|
|
189
|
+
```
|
|
162
190
|
|
|
163
191
|
## Credits
|
|
164
192
|
|
package/dist/index.js
CHANGED
|
@@ -98,12 +98,7 @@ function withExcludedTool(extraArgs, tool) {
|
|
|
98
98
|
// src/atomic-rpc/install.ts
|
|
99
99
|
import { basename, dirname, join } from "path";
|
|
100
100
|
var ATOMIC_INSTALL_HINT = "Install it with `curl -fsSL https://raw.githubusercontent.com/bastani-inc/atomic/main/install.sh | sh` (Windows: `install.ps1`) or `npm install -g @bastani/atomic`, or ensure `atomic` is on your PATH";
|
|
101
|
-
|
|
102
|
-
return /[\\/]node_modules[\\/]@bastani[\\/]atomic[\\/]/.test(realPath);
|
|
103
|
-
}
|
|
104
|
-
function atomicInstallKind(realPath) {
|
|
105
|
-
return isNpmInstall(realPath) ? "npm" : "archive";
|
|
106
|
-
}
|
|
101
|
+
var ATOMIC_UPDATE_COMMAND = "atomic update";
|
|
107
102
|
function atomicChangelogCandidates(realPath) {
|
|
108
103
|
const dir = dirname(realPath);
|
|
109
104
|
const parent = dirname(dir);
|
|
@@ -112,10 +107,6 @@ function atomicChangelogCandidates(realPath) {
|
|
|
112
107
|
candidates.push(join(parent, "CHANGELOG.md"));
|
|
113
108
|
return candidates;
|
|
114
109
|
}
|
|
115
|
-
function atomicUpdateCommand(kind, platform2) {
|
|
116
|
-
if (kind === "npm") return "npm i -g @bastani/atomic";
|
|
117
|
-
return platform2 === "win32" ? "irm https://raw.githubusercontent.com/bastani-inc/atomic/main/install.ps1 | iex" : "curl -fsSL https://raw.githubusercontent.com/bastani-inc/atomic/main/install.sh | sh";
|
|
118
|
-
}
|
|
119
110
|
|
|
120
111
|
// src/atomic-rpc/process.ts
|
|
121
112
|
import { spawn } from "child_process";
|
|
@@ -3437,9 +3428,7 @@ function buildUpdateNotice() {
|
|
|
3437
3428
|
const latest = String(latestRes.stdout ?? "").trim().replace(/^v/i, "");
|
|
3438
3429
|
if (!latest || !isSemver(latest)) return null;
|
|
3439
3430
|
if (compareSemver(latest, installed) <= 0) return null;
|
|
3440
|
-
|
|
3441
|
-
const kind = resolved ? atomicInstallKind(resolved) : "npm";
|
|
3442
|
-
return `New version available: v${latest} (installed v${installed}). Run: \`${atomicUpdateCommand(kind, process.platform)}\``;
|
|
3431
|
+
return `New version available: v${latest} (installed v${installed}). Run: \`${ATOMIC_UPDATE_COMMAND}\``;
|
|
3443
3432
|
} catch {
|
|
3444
3433
|
return null;
|
|
3445
3434
|
}
|