@bastani/atomic-acp 0.0.6 → 0.0.8

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
@@ -43,7 +43,7 @@ Atomic reads files, edits code, and runs commands on your machine, exactly as it
43
43
  ### Prerequisites
44
44
 
45
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:
46
+ - Atomic 0.9.39 or newer (the 0.9.41 pre-releases work too), installed and logged in to at least one model provider:
47
47
 
48
48
  ```bash
49
49
  npm install -g @bastani/atomic
@@ -108,6 +108,7 @@ Sessions
108
108
  - Deleting a thread in the editor deletes its session from Atomic's session store.
109
109
  - Listing or deleting sessions of a project with no open thread briefly starts Atomic in that project to read its session store.
110
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.
111
112
  - 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.
112
113
 
113
114
  Models and context
@@ -221,9 +222,9 @@ Arguments after `--` are added to every `atomic --mode rpc` that `atomic-acp` st
221
222
  { "command": "atomic-acp", "args": ["--", "--model", "openai/gpt-5.5", "-e", "/path/to/extension.ts"] }
222
223
  ```
223
224
 
224
- 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`, `--no-session`, `--continue`, `--resume`, `--fork`, `--import`), `--export`, `--list-models`, `--help`, `--version`, or a nested `--`.
225
+ 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 `--`.
225
226
 
226
- Everything else comes from Atomic itself. Provider logins, models, skills, extensions, and the session store (`sessions.storage`) use your normal Atomic settings in `~/.atomic/agent/settings.json` and `<project>/.atomic/settings.json`. Atomic's own variables, such as `ATOMIC_CODING_AGENT_DIR` and `ATOMIC_CODING_AGENT_SESSION_DIR`, pass through to the Atomic process.
227
+ Everything else comes from Atomic itself. Provider logins, models, skills, extensions, and the session store (`sessions.storage`) use your normal Atomic settings in `~/.atomic/agent/settings.json` and `<project>/.atomic/settings.json`. Atomic's own variables, such as `ATOMIC_CODING_AGENT_DIR`, `ATOMIC_CODING_AGENT_SESSION_DIR` and `ATOMIC_STORAGE`, pass through to every Atomic process.
227
228
 
228
229
  ## Limitations
229
230
 
package/dist/index.js CHANGED
@@ -273,6 +273,8 @@ var RESERVED_ATOMIC_ARGS = /* @__PURE__ */ new Set([
273
273
  "--session-store",
274
274
  "--session-prefix",
275
275
  "--import",
276
+ "--storage",
277
+ "--storage-file",
276
278
  "--no-session",
277
279
  "-c",
278
280
  "--continue",
@@ -705,6 +707,15 @@ var AtomicRpcProcess = class _AtomicRpcProcess {
705
707
  const res = await this.request({ type: "delete_session", sessionId });
706
708
  if (!res.success) throw new Error(`Atomic delete_session failed: ${res.error ?? JSON.stringify(res.data)}`);
707
709
  }
710
+ /**
711
+ * Recover work an earlier Atomic left unfinished in the open session: replay interrupted deliveries
712
+ * in a turn that streams as usual. Since 0.9.40 Atomic does this only when asked, once the transcript is shown.
713
+ */
714
+ async startPendingRecovery(reason) {
715
+ const res = await this.request({ type: "start_pending_recovery", reason });
716
+ if (!res.success) throw new Error(`Atomic start_pending_recovery failed: ${res.error ?? JSON.stringify(res.data)}`);
717
+ return res.data;
718
+ }
708
719
  async getMessages() {
709
720
  const res = await this.request({ type: "get_messages" });
710
721
  if (!res.success) throw new Error(`Atomic get_messages failed: ${res.error ?? JSON.stringify(res.data)}`);
@@ -2602,6 +2613,7 @@ var AtomicAcpAgent = class {
2602
2613
  const title = await this.readSessionTitle(proc, sessionId);
2603
2614
  if (title !== null) await session.publishTitle(title || null, null);
2604
2615
  }
2616
+ if (!opts?.deferRecovery) startPendingRecovery(proc);
2605
2617
  return session;
2606
2618
  } catch (error) {
2607
2619
  if (this.sessions.maybeGet(sessionId)?.proc === proc) this.sessions.close(sessionId);
@@ -3166,7 +3178,8 @@ ${JSON.stringify(stats, null, 2)}`;
3166
3178
  const session = await this.restoreSessionImpl(params.sessionId, {
3167
3179
  cwd: params.cwd,
3168
3180
  mcpServers: params.mcpServers,
3169
- deferTitle: true
3181
+ deferTitle: true,
3182
+ deferRecovery: true
3170
3183
  });
3171
3184
  const proc = session.proc;
3172
3185
  const fileCommands = loadSlashCommands(params.cwd);
@@ -3289,6 +3302,7 @@ ${JSON.stringify(stats, null, 2)}`;
3289
3302
  };
3290
3303
  setTimeout(() => {
3291
3304
  void (async () => {
3305
+ startPendingRecovery(proc);
3292
3306
  await session.publishContextUsage();
3293
3307
  try {
3294
3308
  if (atomicCommandsErr || !atomicCommands) throw atomicCommandsErr;
@@ -3362,6 +3376,10 @@ ${JSON.stringify(stats, null, 2)}`;
3362
3376
  return { configOptions };
3363
3377
  }
3364
3378
  };
3379
+ function startPendingRecovery(proc) {
3380
+ void proc.startPendingRecovery("resume").catch(() => {
3381
+ });
3382
+ }
3365
3383
  async function getThinkingState(proc, pre) {
3366
3384
  const state = pre?.state ?? await proc.getState();
3367
3385
  const available = await proc.getAvailableThinkingLevels();