@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 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 inside Zed and other editors that speak the Agent Client Protocol.</b>
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="#get-started"><b>Get started →</b></a>
8
+ <a href="#install"><b>Install →</b></a>
9
9
  &nbsp;·&nbsp;
10
- <a href="#what-works">What works</a>
10
+ <a href="#what-you-get">What you get</a>
11
11
  &nbsp;·&nbsp;
12
12
  <a href="#subagents-and-background-work">Subagents</a>
13
13
  &nbsp;·&nbsp;
@@ -26,35 +26,55 @@
26
26
 
27
27
  ## How it works
28
28
 
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.
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
- Zed (ACP client) ⇄ atomic-acp ⇄ atomic --mode rpc
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, exactly as it does in a terminal. Only open workspaces you trust.
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
- ## Get started
37
+ ## Install
38
38
 
39
- You need Node.js 20 or newer and Atomic 0.10.0 or newer, signed in to at least one model provider:
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 @bastani/atomic-acp
43
- atomic # sign in, then quit
56
+ npm install -g @bastani/atomic
44
57
  ```
45
58
 
46
- If you use Atomic's standalone release archive instead of the npm package, install only the adapter:
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
- `atomic-acp` uses the `atomic` on your `PATH`, or the one `ATOMIC_ACP_ATOMIC_COMMAND` names, and never installs Atomic itself. Run `atomic-acp --help` for its options.
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
- In Zed's `settings.json`:
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, 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.
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
- Without a global install, use `"command": "npx", "args": ["-y", "@bastani/atomic-acp"]`.
96
+ If you prefer not to install the adapter globally, use `"command": "npx"` with `"args": ["-y", "@bastani/atomic-acp"]`.
75
97
 
76
- ## What works
98
+ ## What you get
77
99
 
78
- - Text and reasoning stream into the thread. Tool calls show their status and files, edits show a diff, and shell commands show their output.
79
- - 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.
80
- - The model and thinking pickers list what your Atomic setup offers, and the context indicator shows how full the context is.
81
- - Prompt templates, skills (`/skill:name`) and extension commands appear in the slash menu.
82
- - When Atomic asks you to pick, confirm or type something, the editor shows a form.
83
- - `ask_user_question` shows all of its questions in one form, multi-select included.
84
- - 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.
85
- - If Atomic exits during a message, the message fails with the reason, and the next message starts Atomic again on the same session.
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 0.10 has no workflows. The agent splits work across [subagents](https://docs.bastani.ai/orchestration) and background shells instead, and the editor shows them as tool calls.
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 message ends when Atomic finishes its turn, even if subagents or shells it started are still running. Atomic doesn't report background work over RPC, so `atomic-acp` can't wait for it. To keep a message open until a result is in, ask the agent to wait for it.
92
- - When background work finishes, Atomic reads the result in a new turn. That turn streams into the thread without a message of yours. A message you send while it runs joins that turn and ends when it ends.
93
- - Cancelling a message stops the current turn and drops the messages queued behind it, as Esc does in Atomic. Subagents and shells keep running; ask the agent to stop them.
94
- - Opening another thread, deleting a thread, or opening it again with different MCP servers stops its Atomic process. A message still running there ends as cancelled, and its subagents stop with the process.
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
- Besides your Atomic prompts, skills and extension commands:
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]` | Compact the context |
103
- | `/autocompact on\|off\|toggle` | Turn automatic compaction on or off |
104
- | `/session` | Session ID, tokens, messages and cost |
105
- | `/name <name>` | Rename the session |
106
- | `/export` | Export the session as HTML to the working folder |
107
- | `/steering`, `/follow-up` | Show or set how queued messages are delivered |
108
- | `/changelog` | Show Atomic's changelog |
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 the editor's pickers instead of `/model` and `/thinking`, and a new thread instead of `/clear`.
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 in the `env` of your agent server entry:
136
+ Set any of these environment variables inside the `env` block of your editor's agent server entry:
115
137
 
116
- | Variable | Default | Purpose |
117
- | ------------------------------------ | -------- | --------------------------------------------------------------- |
118
- | `ATOMIC_ACP_ATOMIC_COMMAND` | `atomic` | Path or name of the Atomic executable |
119
- | `ATOMIC_ACP_ATOMIC_ARGS` | unset | JSON array of extra arguments for every Atomic process |
120
- | `ATOMIC_ACP_HEADLESS` | unset | `1` when no person can answer questions (see below) |
121
- | `ATOMIC_ACP_ENABLE_EMBEDDED_CONTEXT` | unset | `true` lets the editor attach file contents directly to prompts |
122
- | `ATOMIC_ACP_DIR` | unset | Directory for the adapter's own state (see below) |
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
- 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.
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
- Everything else, including logins, models, skills, extensions and the session store, comes from your normal Atomic settings.
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
- The adapter keeps one file of its own, `session-map.json`, which records the project each session belongs to so it can be listed and loaded again. It lives in `~/.atomic/atomic-acp`, or in `ATOMIC_ACP_DIR` when that is set. The directory is made on first use, readable only by you.
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 on a private agent directory (`ATOMIC_CODING_AGENT_DIR`) in a sandbox where your `~/.atomic` is read-only; otherwise starting a session fails because the map can't be written. A reload finds a session only through the same `ATOMIC_ACP_DIR` it was saved under.
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
- ### Headless clients
156
+ ### Automated runs without a user
135
157
 
136
- With `ATOMIC_ACP_HEADLESS=1`, questions end at once instead of waiting. `ask_user_question` tells the model that no person is available, and extension dialogs are cancelled.
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
- - `ask_user_question` needs an editor that supports ACP forms (elicitation). Without them, the question can't be answered.
141
- - Atomic reads, writes and runs commands itself. The editor's file and terminal APIs aren't used.
142
- - Messages sent while Atomic is busy are queued and sent one at a time.
143
- - Zed is the tested client. Other ACP clients should work but may render some updates differently.
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/` 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`.
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
- Merge a pull request whose commit is titled `Release X.Y.Z` (or `Release X.Y.Z-alpha.N`) and sets that version in `package.json`. Any merge style works: a squash merge's ` (#N)` suffix is accepted. The [tag-release workflow](.github/workflows/tag-release.yml) then tags that commit and starts the [publish workflow](.github/workflows/publish.yml), which 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`.
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
- To publish a tag that already exists, for example after a failed run, start the publish workflow from `main` with that tag: `gh workflow run publish.yml --ref main -f tag=X.Y.Z`.
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
- function isNpmInstall(realPath) {
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
- const resolved = resolveAtomicRealPath();
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
  }