@bastani/atomic-acp 0.0.11 → 0.0.13
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 +52 -168
- package/dist/index.js +10 -23
- 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,23 @@ 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
|
-
Sessions
|
|
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
|
+
- 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.
|
|
77
|
+
- If Atomic exits during a message, the message fails with the reason, and the next message starts Atomic again on the same session.
|
|
138
78
|
|
|
139
79
|
## Workflows
|
|
140
80
|
|
|
141
|
-
Atomic workflows run from the editor
|
|
81
|
+
Atomic workflows run from the editor as they do in the terminal:
|
|
142
82
|
|
|
143
83
|
```text
|
|
144
84
|
/workflow list
|
|
@@ -146,128 +86,72 @@ Atomic workflows run from the editor the same way they do in the terminal.
|
|
|
146
86
|
/workflow status
|
|
147
87
|
```
|
|
148
88
|
|
|
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.
|
|
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.
|
|
89
|
+
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
90
|
|
|
156
|
-
|
|
91
|
+
- Cancelling the message quits its runs. Resume one with `/workflow resume <runId>`.
|
|
92
|
+
- A run that waits for your input stops holding the message. Reply in the thread and the agent answers the prompt.
|
|
93
|
+
- Set `ATOMIC_ACP_WAIT_FOR_WORKFLOWS=0` to end the message as soon as a run starts.
|
|
157
94
|
|
|
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) |
|
|
95
|
+
`/workflow-runs [status]` lists the project's recent runs, and `/workflow-run <runId>` shows one run's saved summary.
|
|
162
96
|
|
|
163
97
|
## Slash commands
|
|
164
98
|
|
|
165
|
-
|
|
99
|
+
Besides your Atomic prompts, skills and extension commands:
|
|
166
100
|
|
|
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
|
|
101
|
+
| Command | What it does |
|
|
102
|
+
| ------------------------------ | ------------------------------------------------ |
|
|
103
|
+
| `/compact [instructions]` | Compact the context |
|
|
104
|
+
| `/autocompact on\|off\|toggle` | Turn automatic compaction on or off |
|
|
105
|
+
| `/session` | Session ID, tokens, messages and cost |
|
|
106
|
+
| `/name <name>` | Rename the session |
|
|
107
|
+
| `/export` | Export the session as HTML to the working folder |
|
|
108
|
+
| `/steering`, `/follow-up` | Show or set how queued messages are delivered |
|
|
109
|
+
| `/changelog` | Show Atomic's changelog |
|
|
176
110
|
|
|
177
|
-
Use the editor's
|
|
178
|
-
|
|
179
|
-
Prompt templates load from `~/.atomic/agent/prompts/` and `<project>/.atomic/prompts/`.
|
|
111
|
+
Use the editor's pickers instead of `/model` and `/thinking`, and a new thread instead of `/clear`.
|
|
180
112
|
|
|
181
113
|
## Configuration
|
|
182
114
|
|
|
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:
|
|
115
|
+
Set these in the `env` of your agent server entry:
|
|
212
116
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
117
|
+
| Variable | Default | Purpose |
|
|
118
|
+
| ------------------------------------ | -------- | --------------------------------------------------------------- |
|
|
119
|
+
| `ATOMIC_ACP_ATOMIC_COMMAND` | `atomic` | Path or name of the Atomic executable |
|
|
120
|
+
| `ATOMIC_ACP_ATOMIC_ARGS` | unset | JSON array of extra arguments for every Atomic process |
|
|
121
|
+
| `ATOMIC_ACP_WAIT_FOR_WORKFLOWS` | `1` | `0` ends a message without waiting for the runs it started |
|
|
122
|
+
| `ATOMIC_ACP_HEADLESS` | unset | `1` when no person can answer questions (see below) |
|
|
123
|
+
| `ATOMIC_ACP_ENABLE_EMBEDDED_CONTEXT` | unset | `true` lets the editor attach file contents directly to prompts |
|
|
216
124
|
|
|
217
|
-
|
|
125
|
+
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
126
|
|
|
219
|
-
|
|
127
|
+
Everything else, including logins, models, skills, extensions and the session store, comes from your normal Atomic settings.
|
|
220
128
|
|
|
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 `--`.
|
|
129
|
+
### Headless clients
|
|
228
130
|
|
|
229
|
-
|
|
131
|
+
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
132
|
|
|
231
133
|
## Limitations
|
|
232
134
|
|
|
233
|
-
- `ask_user_question` can't be answered over ACP because Atomic RPC mode can't carry its
|
|
234
|
-
- The editor's file and terminal APIs aren't used.
|
|
235
|
-
-
|
|
236
|
-
- Zed is the
|
|
135
|
+
- `ask_user_question` can't be answered over ACP, because Atomic's RPC mode can't carry its UI.
|
|
136
|
+
- Atomic reads, writes and runs commands itself. The editor's file and terminal APIs aren't used.
|
|
137
|
+
- Messages sent while Atomic is busy are queued and sent one at a time.
|
|
138
|
+
- Zed is the tested client. Other ACP clients should work but may render some updates differently.
|
|
237
139
|
|
|
238
140
|
## Development
|
|
239
141
|
|
|
240
142
|
```bash
|
|
241
143
|
npm install
|
|
242
|
-
npm run dev
|
|
243
|
-
npm run build
|
|
144
|
+
npm run dev # run from source
|
|
244
145
|
npm test
|
|
245
146
|
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
147
|
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
148
|
```
|
|
260
149
|
|
|
261
|
-
`
|
|
150
|
+
`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
151
|
|
|
263
152
|
## Releasing
|
|
264
153
|
|
|
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`.
|
|
154
|
+
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
155
|
|
|
272
156
|
## Credits
|
|
273
157
|
|
package/dist/index.js
CHANGED
|
@@ -169,7 +169,7 @@ async function requestDialog(conn, sessionId, ev, form, onClientCannotAnswer) {
|
|
|
169
169
|
...typeof ev.placeholder === "string" ? { description: ev.placeholder } : {},
|
|
170
170
|
...typeof ev.prefill === "string" ? { default: ev.prefill } : {}
|
|
171
171
|
};
|
|
172
|
-
const response2 = await conn.
|
|
172
|
+
const response2 = await conn.createElicitation({
|
|
173
173
|
sessionId,
|
|
174
174
|
mode: "form",
|
|
175
175
|
message: typeof ev.message === "string" ? `${title}
|
|
@@ -1348,7 +1348,7 @@ var SessionManager = class {
|
|
|
1348
1348
|
}
|
|
1349
1349
|
throw e;
|
|
1350
1350
|
}
|
|
1351
|
-
let state
|
|
1351
|
+
let state;
|
|
1352
1352
|
try {
|
|
1353
1353
|
state = await proc.getState();
|
|
1354
1354
|
} catch {
|
|
@@ -2729,7 +2729,7 @@ var AtomicAcpAgent = class {
|
|
|
2729
2729
|
this.cleanupFailedNewSession(session.sessionId);
|
|
2730
2730
|
throw maybeAuthRequiredError(err) ?? RequestError4.internalError({}, String(err));
|
|
2731
2731
|
}
|
|
2732
|
-
const { configOptions,
|
|
2732
|
+
const { configOptions, modes } = configuration;
|
|
2733
2733
|
if (typeof state?.sessionId === "string") {
|
|
2734
2734
|
this.store.upsert({ sessionId: session.sessionId, cwd: params.cwd });
|
|
2735
2735
|
}
|
|
@@ -2740,13 +2740,11 @@ var AtomicAcpAgent = class {
|
|
|
2740
2740
|
fileCommands,
|
|
2741
2741
|
updateNotice
|
|
2742
2742
|
});
|
|
2743
|
-
if (preludeText)
|
|
2744
|
-
session.setStartupInfo(preludeText);
|
|
2743
|
+
if (preludeText) session.setStartupInfo(preludeText);
|
|
2745
2744
|
this.sessions.closeAllExcept?.(session.sessionId);
|
|
2746
2745
|
const response = {
|
|
2747
2746
|
sessionId: session.sessionId,
|
|
2748
2747
|
configOptions,
|
|
2749
|
-
models,
|
|
2750
2748
|
modes,
|
|
2751
2749
|
_meta: {
|
|
2752
2750
|
atomicAcp: {
|
|
@@ -3017,7 +3015,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
3017
3015
|
});
|
|
3018
3016
|
return { stopReason: "end_turn" };
|
|
3019
3017
|
}
|
|
3020
|
-
let text
|
|
3018
|
+
let text;
|
|
3021
3019
|
try {
|
|
3022
3020
|
text = readFileSync5(changelogPath, "utf-8");
|
|
3023
3021
|
} catch (e) {
|
|
@@ -3056,7 +3054,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
3056
3054
|
}
|
|
3057
3055
|
const safeSessionId = session.sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3058
3056
|
const outputPath = join5(session.cwd, `atomic-session-${safeSessionId}.html`);
|
|
3059
|
-
let resultPath
|
|
3057
|
+
let resultPath;
|
|
3060
3058
|
try {
|
|
3061
3059
|
const result = await session.proc.exportHtml(outputPath);
|
|
3062
3060
|
resultPath = result.path;
|
|
@@ -3147,9 +3145,6 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
3147
3145
|
async listSessions(params) {
|
|
3148
3146
|
return this.listSessionsImpl(params);
|
|
3149
3147
|
}
|
|
3150
|
-
async unstable_listSessions(params) {
|
|
3151
|
-
return this.listSessionsImpl(params);
|
|
3152
|
-
}
|
|
3153
3148
|
async listSessionsImpl(params) {
|
|
3154
3149
|
const effectiveCwd = params.cwd ?? this.lastSessionCwd ?? process.cwd();
|
|
3155
3150
|
if (!isAbsolute2(effectiveCwd)) throw RequestError4.invalidParams(`cwd must be an absolute path: ${effectiveCwd}`);
|
|
@@ -3186,7 +3181,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
3186
3181
|
const enableSkillCommands = getEnableSkillCommands(params.cwd);
|
|
3187
3182
|
let atomicCommands = null;
|
|
3188
3183
|
let atomicCommandsErr = null;
|
|
3189
|
-
let state
|
|
3184
|
+
let state;
|
|
3190
3185
|
let configuration;
|
|
3191
3186
|
try {
|
|
3192
3187
|
state = await proc.getState();
|
|
@@ -3195,7 +3190,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
3195
3190
|
this.sessions.close(params.sessionId);
|
|
3196
3191
|
throw err;
|
|
3197
3192
|
}
|
|
3198
|
-
const { configOptions,
|
|
3193
|
+
const { configOptions, modes } = configuration;
|
|
3199
3194
|
const title = await this.readSessionTitle(proc, params.sessionId);
|
|
3200
3195
|
if (title !== null) await session.publishTitle(title || null, null);
|
|
3201
3196
|
try {
|
|
@@ -3292,7 +3287,6 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
3292
3287
|
}
|
|
3293
3288
|
const response = {
|
|
3294
3289
|
configOptions,
|
|
3295
|
-
models,
|
|
3296
3290
|
modes,
|
|
3297
3291
|
_meta: {
|
|
3298
3292
|
atomicAcp: {
|
|
@@ -3331,7 +3325,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
3331
3325
|
}, 0);
|
|
3332
3326
|
return response;
|
|
3333
3327
|
}
|
|
3334
|
-
async
|
|
3328
|
+
async deleteSession(params) {
|
|
3335
3329
|
return this.withSessionOperation(params.sessionId, () => this.deleteSessionImpl(params));
|
|
3336
3330
|
}
|
|
3337
3331
|
async deleteSessionImpl(params) {
|
|
@@ -3343,12 +3337,6 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
3343
3337
|
this.store.delete(sessionId);
|
|
3344
3338
|
return {};
|
|
3345
3339
|
}
|
|
3346
|
-
async unstable_setSessionModel(params) {
|
|
3347
|
-
const session = await this.restoreSession(params.sessionId);
|
|
3348
|
-
await setSessionModel(session.proc, params.modelId);
|
|
3349
|
-
await emitConfigOptionsUpdate(this.conn, session.sessionId, session.proc);
|
|
3350
|
-
await session.publishContextUsage();
|
|
3351
|
-
}
|
|
3352
3340
|
async setSessionMode(params) {
|
|
3353
3341
|
const session = await this.restoreSession(params.sessionId);
|
|
3354
3342
|
if (typeof params.modeId !== "string" || params.modeId.length === 0) {
|
|
@@ -3461,7 +3449,6 @@ async function setSessionModel(proc, requestedModelId) {
|
|
|
3461
3449
|
await proc.setModel(provider, modelId);
|
|
3462
3450
|
}
|
|
3463
3451
|
async function getModelState(proc, pre) {
|
|
3464
|
-
let availableModels = [];
|
|
3465
3452
|
const data = pre?.availableModels ?? await (async () => {
|
|
3466
3453
|
try {
|
|
3467
3454
|
return await proc.getAvailableModels();
|
|
@@ -3470,7 +3457,7 @@ async function getModelState(proc, pre) {
|
|
|
3470
3457
|
}
|
|
3471
3458
|
})();
|
|
3472
3459
|
const models = Array.isArray(data?.models) ? data.models : [];
|
|
3473
|
-
availableModels = models.map((m) => {
|
|
3460
|
+
const availableModels = models.map((m) => {
|
|
3474
3461
|
const provider = String(m?.provider ?? "").trim();
|
|
3475
3462
|
const id = String(m?.id ?? "").trim();
|
|
3476
3463
|
if (!provider || !id) return null;
|