agents-can-communicate 0.4.3 → 0.5.0

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.
Files changed (71) hide show
  1. package/README.md +8 -4
  2. package/bin/acc-maintenance-worker.mjs +6 -0
  3. package/bin/entrypoints/acc-hook.mjs +58 -5
  4. package/docs/ARCHITECTURE.md +21 -9
  5. package/docs/CLI.md +21 -10
  6. package/docs/CONCEPTS.md +2 -1
  7. package/docs/CONFIGURATION.md +2 -1
  8. package/docs/GETTING_STARTED.md +4 -2
  9. package/docs/HOW_IT_WORKS.md +2 -1
  10. package/docs/PROTOCOL.md +7 -0
  11. package/docs/RELEASING.md +1 -1
  12. package/docs/SECURITY_MODEL.md +16 -7
  13. package/docs/TROUBLESHOOTING.md +13 -6
  14. package/docs/UPGRADING.md +121 -22
  15. package/docs/WHY_ACC.md +1 -1
  16. package/node_modules/@agents-can-communicate/adapter-claude-code/package.json +1 -1
  17. package/node_modules/@agents-can-communicate/adapter-codex/package.json +1 -1
  18. package/node_modules/@agents-can-communicate/adapter-codex/src/adapter.mjs +10 -4
  19. package/node_modules/@agents-can-communicate/adapter-codex/src/app-server-client.mjs +4 -0
  20. package/node_modules/@agents-can-communicate/adapter-codex/src/maintenance-host.mjs +120 -0
  21. package/node_modules/@agents-can-communicate/adapter-codex/src/maintenance-threads.mjs +49 -0
  22. package/node_modules/@agents-can-communicate/adapter-codex/src/maintenance.mjs +108 -0
  23. package/node_modules/@agents-can-communicate/adapter-codex/src/native-delivery.mjs +67 -22
  24. package/node_modules/@agents-can-communicate/adapter-gemini-cli/extension/gemini-extension.json +1 -1
  25. package/node_modules/@agents-can-communicate/adapter-gemini-cli/package.json +1 -1
  26. package/node_modules/@agents-can-communicate/adapter-grok/package.json +1 -1
  27. package/node_modules/@agents-can-communicate/adapter-kimi/package.json +1 -1
  28. package/node_modules/@agents-can-communicate/adapter-sdk/package.json +1 -1
  29. package/node_modules/@agents-can-communicate/adapter-sdk/src/index.mjs +1 -1
  30. package/node_modules/@agents-can-communicate/adapter-sdk/src/native-delivery.mjs +63 -16
  31. package/node_modules/@agents-can-communicate/adapter-sdk/src/session-binding.mjs +16 -1
  32. package/node_modules/@agents-can-communicate/cli/package.json +1 -1
  33. package/node_modules/@agents-can-communicate/cli/src/args.mjs +1 -1
  34. package/node_modules/@agents-can-communicate/cli/src/doctor-command.mjs +10 -5
  35. package/node_modules/@agents-can-communicate/cli/src/help.mjs +2 -0
  36. package/node_modules/@agents-can-communicate/cli/src/index.mjs +5 -0
  37. package/node_modules/@agents-can-communicate/cli/src/main.mjs +5 -3
  38. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/activation.mjs +225 -11
  39. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/command.mjs +15 -0
  40. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/diagnostics.mjs +36 -0
  41. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/download.mjs +17 -2
  42. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/entry.mjs +54 -14
  43. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/generation.mjs +44 -25
  44. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/install.mjs +46 -29
  45. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/legacy-maintenance.mjs +47 -0
  46. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/maintenance-state.mjs +57 -0
  47. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/maintenance-worker.mjs +118 -0
  48. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/maintenance.mjs +140 -0
  49. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/management-recovery.mjs +80 -0
  50. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/pins.mjs +125 -0
  51. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/refresh.mjs +6 -7
  52. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/retire.mjs +56 -0
  53. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/schedule.mjs +4 -2
  54. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/staging.mjs +95 -0
  55. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/state.mjs +8 -1
  56. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/worker.mjs +34 -12
  57. package/node_modules/@agents-can-communicate/cli/src/native-session-diagnostics.mjs +83 -7
  58. package/node_modules/@agents-can-communicate/core/package.json +1 -1
  59. package/node_modules/@agents-can-communicate/delivery-router/package.json +1 -1
  60. package/node_modules/@agents-can-communicate/delivery-router/src/router.mjs +44 -2
  61. package/node_modules/@agents-can-communicate/hook-runner/package.json +1 -1
  62. package/node_modules/@agents-can-communicate/hook-runner/src/native-binding.mjs +10 -1
  63. package/node_modules/@agents-can-communicate/hook-runner/src/runner.mjs +55 -6
  64. package/node_modules/@agents-can-communicate/installer/package.json +1 -1
  65. package/node_modules/@agents-can-communicate/installer/src/apply.mjs +2 -2
  66. package/node_modules/@agents-can-communicate/installer/src/plan.mjs +10 -3
  67. package/node_modules/@agents-can-communicate/mcp-server/package.json +1 -1
  68. package/node_modules/@agents-can-communicate/protocol/package.json +1 -1
  69. package/node_modules/@agents-can-communicate/storage-filesystem/package.json +1 -1
  70. package/node_modules/@agents-can-communicate/storage-filesystem/src/safe-directory.mjs +38 -4
  71. package/package.json +3 -1
package/README.md CHANGED
@@ -80,7 +80,7 @@ state, commonly your home directory, cannot be used as a workspace; start the cl
80
80
  project directory. See [Troubleshooting](docs/TROUBLESHOOTING.md).
81
81
 
82
82
  Already using ACC? Follow the [upgrade guide](docs/UPGRADING.md), including the 0.4.x →
83
- 0.4.3 update and the data-format boundary when moving from 0.3.1.
83
+ 0.5.0 update and the data-format boundary when moving from 0.3.1.
84
84
 
85
85
  ## When messages arrive
86
86
 
@@ -141,9 +141,13 @@ One npm package. ACC needs no separate account, model API key, or hosted service
141
141
  ## Update or remove ACC
142
142
 
143
143
  Initial installation enables automatic updates. ACC downloads stable releases in the
144
- background and waits for active clients and ACC processes to exit before switching the
145
- runtime and refreshing integrations. Restart clients afterward and complete any requested
146
- hook or plugin trust review.
144
+ background, then switches the runtime and refreshes integrations once nothing blocks. A
145
+ live client or ACC process blocks only while the store contract it declares differs from
146
+ the incoming version's or is unknown; one declaring a matching contract keeps running
147
+ through the switch. When a verified Codex service needs a restart,
148
+ `acc update` asks once, then completes maintenance in a separate process. Open clients
149
+ disconnect; `acc doctor` reports progress and the result. See [update and recovery details](docs/UPGRADING.md#confirmed-client-service-maintenance).
150
+ Restart or resume clients afterward and complete any requested hook or plugin trust review.
147
151
 
148
152
  For an immediate update:
149
153
 
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { runMaintenance } from "../node_modules/@agents-can-communicate/cli/src/managed-runtime/maintenance-worker.mjs";
3
+
4
+ // This private entry has no workspace admission/lease and no inherited stdio.
5
+ // Durable checkpoints remain available to the next acc update after a crash.
6
+ await runMaintenance(process.argv[2], { jobId: process.argv[3] }).catch(() => { process.exitCode = 1; });
@@ -6,9 +6,11 @@
6
6
  // someone's session stops working. Unknown adapter, malformed payload, broken
7
7
  // store, missing binding - all of them end in "allow, exit 0".
8
8
  import { randomBytes } from "node:crypto";
9
+ import { pathToFileURL } from "node:url";
9
10
 
10
11
  import { createId } from "@agents-can-communicate/protocol";
11
12
  import { runHook } from "@agents-can-communicate/hook-runner";
13
+ import { hookEntrypointFor, resolvePinnedGeneration } from "@agents-can-communicate/cli";
12
14
 
13
15
  import { createClaudeCodeAdapter } from "@agents-can-communicate/adapter-claude-code";
14
16
  import { createCodexAdapter } from "@agents-can-communicate/adapter-codex";
@@ -38,15 +40,66 @@ const readStdin = () => new Promise(resolve => {
38
40
 
39
41
  import { completeHookOutput } from "./hook-output.mjs";
40
42
 
41
- export async function main() {
42
- const [adapterId] = process.argv.slice(2);
43
+ // A pin is keyed by harness session id, which only an adapter's own
44
+ // normalisation can find inside a payload. This runs the same normalisation
45
+ // `runHook` will run a moment later - cheap, in-memory, no store touched - so
46
+ // a hook that has no pin to look up pays nothing beyond it. Any adapter or
47
+ // payload that will not yield a session id simply has no pin to find, same as
48
+ // today's no-pin behaviour.
49
+ async function harnessSessionIdFor(adapterId, payload) {
50
+ try {
51
+ const event = await adapters[adapterId]?.normalizeHook(payload);
52
+ return typeof event?.sessionId === "string" ? event.sessionId : null;
53
+ } catch {
54
+ return null;
55
+ }
56
+ }
43
57
 
44
- let payload = null;
58
+ // A pinned generation is only ever another build of this same codebase, but
59
+ // it can still be broken on disk - deleted mid-write, a corrupt install. This
60
+ // tries it and reports failure rather than letting an import error or a
61
+ // throwing `main` escape: the caller then runs the turn on the active
62
+ // generation instead, exactly as if there had been no pin.
63
+ //
64
+ // `delegated` is the circuit breaker on chaining: a hook already running
65
+ // because it was delegated to never looks for a pin of its own. Ordinary
66
+ // resolution already stops itself after one hop - the generation a pin names
67
+ // compares its own pin against the exact root it was just handed, so they
68
+ // match and it returns null - but that self-termination leans on a single
69
+ // pin record staying the value both reads saw. `delegated` does not: it
70
+ // forbids a second hop outright, independent of anything a pin (rewritten
71
+ // mid-resolution by another hook for the same session, or simply wrong)
72
+ // could say. Unbounded delegation would be a hang, worse than any of the
73
+ // failures this file already falls open from.
74
+ async function delegateToPin({ managerRoot, packageRoot, adapterId, payload, delegated }) {
75
+ if (delegated || managerRoot === null || packageRoot === null) return false;
76
+ const harnessSessionId = await harnessSessionIdFor(adapterId, payload);
77
+ if (harnessSessionId === null) return false;
78
+ const pinned = await resolvePinnedGeneration({ root: managerRoot, harnessSessionId, active: packageRoot });
79
+ if (pinned === null) return false;
45
80
  try {
46
- payload = JSON.parse(await readStdin());
81
+ const runtime = await import(pathToFileURL(hookEntrypointFor(pinned)).href);
82
+ await runtime.main({ managerRoot, packageRoot: pinned, payload, delegated: true });
83
+ return true;
47
84
  } catch {
48
- payload = null;
85
+ return false;
49
86
  }
87
+ }
88
+
89
+ export async function main({ managerRoot = null, packageRoot = null, payload, delegated = false } = {}) {
90
+ const [adapterId] = process.argv.slice(2);
91
+
92
+ // A delegating caller already read stdin once for the whole process and
93
+ // hands its parsed payload down; only the outermost call reads it here.
94
+ if (payload === undefined) {
95
+ try {
96
+ payload = JSON.parse(await readStdin());
97
+ } catch {
98
+ payload = null;
99
+ }
100
+ }
101
+
102
+ if (await delegateToPin({ managerRoot, packageRoot, adapterId, payload, delegated })) return;
50
103
 
51
104
  const result = await runHook({ adapterId, payload, adapters,
52
105
  runtime: { clock: { now: () => new Date().toISOString() },
@@ -15,8 +15,10 @@ flowchart LR
15
15
  T -->|reply or acknowledge| C
16
16
  ```
17
17
 
18
- ACC never starts, resumes, interrupts, supervises, or terminates the target client. A
19
- transport that requires owning that lifecycle is outside the product boundary.
18
+ Message delivery never starts, resumes, interrupts, supervises, or terminates the target
19
+ client. A transport that requires owning that lifecycle is outside the product boundary.
20
+ Separately, explicit update maintenance can restart a verified client service after the
21
+ user confirms the disconnection; it does not launch or assign agent tasks.
20
22
 
21
23
  ## Packages and dependency direction
22
24
 
@@ -90,8 +92,8 @@ turn.
90
92
  Claude Code Channel has installed-client evidence on 2.1.258 and 2.1.260; Codex
91
93
  LocalDaemon has it on 0.152.1 and 0.153.4. Both use a captured platform minimum,
92
94
  current probe and exact session handshake. Codex preserves the ordinary client
93
- launch and verifies its registered thread and workspace; ACC owns no vendor daemon
94
- lifecycle. Gemini CLI and Kimi Code have exact-version next-turn evidence only;
95
+ launch and verifies its registered thread and workspace; native delivery owns no vendor
96
+ daemon lifecycle. Gemini CLI and Kimi Code have exact-version next-turn evidence only;
95
97
  Grok and generic MCP use inbox polling.
96
98
 
97
99
  ## Storage and workspace identity
@@ -172,19 +174,29 @@ The CLI owns installation generations under `<dataHome>/acc/runtime`, outside wo
172
174
  All five launch paths select a generation and publish an actual-process lease under one
173
175
  admission mutex before loading workspace-capable code. Immutable launcher modules and
174
176
  runtime directories preserve in-progress imports. Leases survive `main()` returning and
175
- are removed only after confirmed process death. Parsed help, version, and update recovery
176
- remain available when workspace admission is unavailable.
177
+ are removed only after confirmed process death. A session is also pinned to the generation
178
+ it started with: its hooks delegate to that generation while the pin declares the same
179
+ store contract this one does, and run the active generation otherwise. A generation
180
+ directory is reclaimed once no control pointer, live lease, live pin or staging hold names
181
+ it. Parsed help, version, and update recovery remain available when workspace admission is
182
+ unavailable.
177
183
 
178
184
  An independent worker downloads npm packages with lifecycle scripts disabled, checks exact
179
185
  stable package identity and the discovered integrity, and health-checks the staged runtime.
180
186
  Installer detection and planning happen before exclusive admission. The worker then checks
181
- ACC process leases and native binding PIDs, records `activating`, applies every integration,
182
- and only publishes the new active pointer after all applications succeed. Partial refresh
187
+ ACC process leases and native binding PIDs and waits only for those whose declared store
188
+ contract differs from the incoming generation's or is absent, records `activating`, applies
189
+ every integration, and only publishes the new active pointer after all applications succeed. Partial refresh
183
190
  remains fenced and repairs forward, with the old active pointer retained but normal
184
191
  workspace admission unavailable until recovery completes. Native bindings cease holding
185
192
  after observed SessionEnd cleanup or confirmed process death; the vendor daemon may remain
186
193
  running. Unknown PIDs remain holds until lifecycle cleanup. Presence TTL, `acc finish`,
187
- and delivery off alone do not prove native lifecycle end. ACC never manages the daemon.
194
+ and delivery off alone do not prove native lifecycle end. Normal background updates never
195
+ restart a vendor daemon. An explicitly approved maintenance job can do so through the
196
+ adapter lifecycle port: it waits for idle work, validates exact process identity, stops
197
+ the service under the admission fence, refreshes integrations, and restores and verifies
198
+ the service even after a refresh failure. Checkpoints and the detached worker live outside
199
+ repositories. Approved crash recovery never blindly repeats a stop.
188
200
 
189
201
  Lock ownership never expires by age. Retained nonempty tombstones prevent delayed observers
190
202
  from reclaiming a successor. Under an acquired lock, maintenance removes historical
package/docs/CLI.md CHANGED
@@ -232,7 +232,7 @@ external AI client. An addressed handoff requires acknowledgement; a room handof
232
232
  | `acc doctor` | `--home`, `--repair` |
233
233
  | `acc config init` | `--yes`, `--force` |
234
234
  | `acc config validate` | — |
235
- | `acc update` | `--check`, `--auto on\|off`, `--pin VERSION\|none`, `--apply` (alias) |
235
+ | `acc update` | `--check`, `--auto on\|off`, `--pin VERSION\|none`, `--yes`, `--apply` (alias) |
236
236
  | `acc help` | — |
237
237
  | `acc version` | — |
238
238
 
@@ -248,8 +248,8 @@ effective policy off and prints the reason. Claude Code shell activation writes
248
248
  zsh PATH block and a shim that `exec`s the real client; `ACC_BYPASS=1` bypasses that
249
249
  activation. Codex LocalDaemon delivery uses recorded installation consent without changing
250
250
  ordinary launch arguments. Its opt-in remains active when shim variables are absent or
251
- bypassed; `acc install --adapter codex --delivery off` disables new native offers. ACC never
252
- starts or stops the vendor daemon. The install summary names each client's requested policy,
251
+ bypassed; `acc install --adapter codex --delivery off` disables new native offers. Installation
252
+ and message delivery do not start or stop the vendor daemon. The install summary names each client's requested policy,
253
253
  activation state and verified fallback. `doctor` separates protocol readiness, recorded
254
254
  consent and a live channel in the current workspace, with a next step for missing activation.
255
255
  A supported version or an installed plugin alone is not an active delivery channel.
@@ -274,15 +274,24 @@ An initial `acc install` enables automatic updates. Reinstalling preserves an ex
274
274
  `acc update --auto off` choice. A full uninstall pauses updates; reinstalling restores
275
275
  the remembered setting. A background worker checks stable releases
276
276
  at most once a day, downloads and verifies a separate runtime, then refreshes installed
277
- integrations and skills after ACC process leases and native binding holds clear. ACC leases
278
- require confirmed process exit; a native binding can clear on observed SessionEnd even
279
- while its vendor daemon remains alive, or on confirmed process death. Unknown PIDs remain
280
- holds. `finish`, presence TTL, and delivery off are not observed native end. Hooks do not
277
+ integrations and skills once no hold blocks. A runtime lease or native binding blocks only
278
+ while the store contract it declares differs from the incoming version's, or while it
279
+ declares none; records written before 0.5.0 declare none, so the first update after
280
+ upgrading still waits for them. ACC leases end on confirmed process exit; a native binding
281
+ can clear on observed SessionEnd even while its vendor daemon remains alive, or on
282
+ confirmed process death. Unknown PIDs remain holds. `finish`, presence TTL, and delivery off are not observed native end. Hooks do not
281
283
  wait for network work. `ACC_NO_UPDATE_CHECK=1` disables update networking and background
282
284
  scheduling.
283
285
 
284
- `acc update` requests the update immediately; it reports a pending update when a running or
285
- unidentified client prevents activation. `--check` only checks and cannot be combined with
286
+ `acc update` requests the update immediately. If a verified Codex service holds a native
287
+ binding that blocks activation, or serves a version its captured native-delivery contract
288
+ refuses, it asks once to restart that service.
289
+ After confirmation, a detached worker waits for idle work and for any ACC process whose
290
+ declared store contract still holds the update, refreshes integrations, restarts the
291
+ service and verifies the result. Open clients disconnect; use
292
+ `acc doctor` for progress and resume the clients afterward. `--yes` supplies explicit
293
+ noninteractive restart consent. Without consent, or with unknown ownership, the update
294
+ remains pending. See [maintenance limits and recovery](UPGRADING.md#confirmed-client-service-maintenance). `--check` only checks and cannot be combined with
286
295
  settings changes. `--auto off` disables background updates, and `--auto on` enables them.
287
296
  `--pin 0.4.0` holds an exact stable version; `--pin none` follows stable releases. A pin
288
297
  cannot downgrade the active runtime. The old `--apply` flag remains accepted.
@@ -290,7 +299,9 @@ cannot downgrade the active runtime. The old `--apply` flag remains accepted.
290
299
  Failed downloads keep the working runtime. A failed integration refresh exits with code
291
300
  `4`, names the failed adapter and configuration error, and keeps workspace admission closed.
292
301
  Fix the reported configuration problem, then run `acc update` to finish it. `acc doctor`
293
- reports the update policy and pending notice. Native clients may still require hook trust
302
+ reports the update policy and pending notice. During blocked activation, a current launcher
303
+ returns `scope: update` and `workspaceInspection: unavailable_during_update` without opening
304
+ workspace state; `doctor --repair` remains blocked. Native clients may still require hook trust
294
305
  or activation review. See [Upgrading](UPGRADING.md) for the initial 0.3.1 transition and
295
306
  recovery details.
296
307
 
package/docs/CONCEPTS.md CHANGED
@@ -14,7 +14,8 @@ settings, clients, and checkouts. Neither is automatically in charge. Claude can
14
14
  for the endpoint shape; Codex can answer or decline under its own instructions.
15
15
 
16
16
  This resembles coordination among subagents, but the sessions were opened independently by
17
- the user. ACC never launches, assigns, supervises, or closes them.
17
+ the user. ACC does not launch, assign or supervise their work. Separately, an explicit
18
+ update can ask to restart a client service; this disconnects clients and requires user consent.
18
19
 
19
20
  ## Workspace, participant, and session
20
21
 
@@ -139,7 +139,8 @@ reports degraded reachability; it does not rewrite the installed consent.
139
139
 
140
140
  Codex LocalDaemon delivery separately requires macOS arm64, Codex 0.152.1 or newer, a
141
141
  current feature probe, and exact thread, canonical cwd, process, version and protocol
142
- checks. Its daemon must already be running; ACC never starts or stops it. Codex reads
142
+ checks. Its daemon must already be running; installation and delivery do not start or stop it.
143
+ Explicit update maintenance can restart a verified service after separate confirmation. Codex reads
143
144
  consent from the installation record, not a shell-shim variable. Unavailable or ineligible
144
145
  sessions retain durable inbox fallback. Use `acc install --adapter codex --delivery off`
145
146
  to stop new native offers; bypassing a shim does not disable that recorded opt-in.
@@ -15,7 +15,7 @@ pair or session-bound ACC MCP tools. See [CLI ownership](CLI.md#coordinate-from-
15
15
 
16
16
  ACC requires macOS or Linux and Node.js 24 or newer.
17
17
 
18
- Already using ACC? Follow the [upgrade guide](UPGRADING.md) for the 0.4.x → 0.4.3
18
+ Already using ACC? Follow the [upgrade guide](UPGRADING.md) for the 0.4.x → 0.5.0
19
19
  update or the data-format boundary when upgrading from 0.3.1.
20
20
 
21
21
  ```bash
@@ -30,7 +30,9 @@ acc install
30
30
  Initial installation also enables automatic updates; reinstalling keeps an explicit opt-out.
31
31
  ACC downloads releases in the background and
32
32
  refreshes its runtime and skills when active clients have left. Use `acc update` for an
33
- immediate update, or `acc update --auto off` to disable background updates. See
33
+ immediate update; an eligible Codex service restart asks for one confirmation. ACC then
34
+ handles maintenance and reports progress in `acc doctor`; clients disconnect and can be
35
+ resumed afterward. Use `acc update --auto off` to disable background updates. See
34
36
  [update controls](UPGRADING.md#automatic-updates-after-installation).
35
37
 
36
38
  The installer connects only the supported clients it finds. Open a new terminal and
@@ -112,7 +112,8 @@ All recipients have the same durable record, but adapters expose different accel
112
112
  to an independently opened thread. It is experimental, off by default, and can
113
113
  spend tokens. Messages wait for a running turn to finish; a daemon-retained
114
114
  thread can receive them after its terminal exits. ACC adds no launch arguments
115
- and does not manage the vendor daemon.
115
+ and does not manage the vendor daemon during message delivery. Separately,
116
+ [confirmed update maintenance](UPGRADING.md#confirmed-client-service-maintenance) can restart it.
116
117
 
117
118
  Grok, generic MCP, unsupported versions and uncaptured platforms use inbox polling.
118
119
  [Capabilities](CAPABILITIES.md) lists evidence and fallback.
package/docs/PROTOCOL.md CHANGED
@@ -238,6 +238,13 @@ sessionId · generation · adapterId · clientVersion · availableModes
238
238
  livePolicy · opaqueEndpointRef · leaseUntil
239
239
  ```
240
240
 
241
+ `clientVersion` is the version that answered the handshake and was admitted by the
242
+ adapter's captured contract — the process that will serve this binding's live pushes,
243
+ which is not always the version the client's own executable reports. A background
244
+ service that updated under its CLI serves the updated build, and the binding names that
245
+ build. The version the executable reported is recorded separately, beside the session's
246
+ owner record.
247
+
241
248
  The recipient owns `livePolicy` because native push may start a model turn:
242
249
 
243
250
  - `off`: inbox and normal next-turn paths only;
package/docs/RELEASING.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Releasing
2
2
 
3
3
  Use this procedure to build one auditable npm artifact, verify that exact tarball, and keep
4
- its evidence tied to the commit that supplied its bytes. The package is currently `0.4.3`;
4
+ its evidence tied to the commit that supplied its bytes. The package is currently `0.5.0`;
5
5
  the commands derive the version from `package.json` so the filename cannot drift.
6
6
 
7
7
  ```mermaid
@@ -24,9 +24,10 @@ graph LR
24
24
  H["human authority"] --> C
25
25
  ```
26
26
 
27
- ACC does not read raw transcripts, relay permission approvals, or start target clients. A
28
- native delivery path may only offer an attributed peer envelope to an already-running,
29
- user-owned session.
27
+ ACC does not read raw transcripts or relay permission approvals. A native delivery path
28
+ may only offer an attributed peer envelope to an already-running, user-owned session.
29
+ Confirmed update maintenance is a separate service restart operation; a peer message or
30
+ live-delivery opt-in does not authorize it.
30
31
 
31
32
  ## Peer-content boundary
32
33
 
@@ -120,10 +121,18 @@ sha512 integrity against registry metadata, installs with lifecycle scripts disa
120
121
  validates the staged runtime before activation. These checks retain the registry and package
121
122
  author as a software-supply trust boundary; they do not establish that package code is safe.
122
123
 
123
- ACC process leases hold activation until confirmed exit. Native bindings hold until observed
124
- SessionEnd cleanup or confirmed process death; unknown PIDs remain conservative holds.
125
- `acc finish`, presence TTL, and delivery off do not establish native lifecycle end. ACC does
126
- not manage the vendor daemon.
124
+ ACC process leases and native bindings record the store contract they speak, and hold
125
+ activation while that contract differs from the incoming version's or is absent. A lease
126
+ ends on confirmed exit, a native binding on observed SessionEnd cleanup or confirmed process
127
+ death; unknown PIDs and undeclared contracts remain conservative holds.
128
+ `acc finish`, presence TTL, and delivery off do not establish native lifecycle end.
129
+ Normal installation and message delivery do not manage vendor services. Explicit
130
+ `acc update` maintenance requires one separate confirmation (or `--yes`) for the recorded
131
+ candidate and verified service identity. The detached worker retains that approval for
132
+ recovery, rechecks PID/start time, executable, socket, versions and idle state, and preserves
133
+ unrelated or unidentified process holds. The vendor exposes no atomic turn-drain operation:
134
+ a turn arriving between the final check and stop can be interrupted. See
135
+ [confirmed maintenance](UPGRADING.md#confirmed-client-service-maintenance).
127
136
 
128
137
  A failed download leaves the active runtime available. A partial integration refresh retains
129
138
  the old active pointer but fences normal workspace admission in `activating`; it does not
@@ -236,12 +236,19 @@ Next: [Getting started](GETTING_STARTED.md) · [Capabilities](CAPABILITIES.md)
236
236
 
237
237
  ## An automatic update is pending
238
238
 
239
- Run `acc doctor` to see the update policy and pending notice. ACC process leases, including
240
- persistent MCP servers, require confirmed process exit. Native bindings clear on observed
241
- SessionEnd or confirmed process death; a vendor daemon may remain alive after SessionEnd.
242
- Unknown PIDs remain holds until lifecycle cleanup. Close the relevant client sessions and
243
- ACC processes; `finish`, presence TTL, and delivery off do not prove native end. ACC never
244
- manages the daemon or expires safety holds merely by elapsed time.
239
+ Run `acc doctor` to see the update policy and pending notice. A hold keeps an update
240
+ pending only while the store contract it declares differs from the incoming version's or
241
+ is unknown; records written before 0.5.0 declare none, so the first update after upgrading
242
+ still waits for all of them. `acc update` names each remaining hold with its process and
243
+ its declared contract. ACC process leases, including persistent MCP servers, end on
244
+ confirmed process exit. Native bindings clear on observed SessionEnd or confirmed process
245
+ death; a vendor daemon may remain alive after SessionEnd. Unknown PIDs remain holds until
246
+ lifecycle cleanup. Close the client sessions and ACC processes the notice names;
247
+ `finish`, presence TTL, and delivery off do not prove native end.
248
+ `acc update` can offer a confirmed restart of an eligible Codex service. Unknown or
249
+ unrelated holds still require lifecycle cleanup or confirmed process exit; safety holds
250
+ do not expire merely by elapsed time. See
251
+ [maintenance and recovery](UPGRADING.md#confirmed-client-service-maintenance).
245
252
 
246
253
  Use `acc update` to retry a failed download or finish an interrupted integration refresh.
247
254
  A download failure keeps the working version. A partial integration refresh blocks
package/docs/UPGRADING.md CHANGED
@@ -1,13 +1,14 @@
1
- # Upgrading to 0.4.3
1
+ # Upgrading to 0.5.0
2
2
 
3
- ## From 0.4.2, 0.4.1 or 0.4.0
3
+ ## From 0.4.4, 0.4.3, 0.4.2, 0.4.1 or 0.4.0
4
4
 
5
- This patch keeps the existing workspace data format. It fixes outgoing native delivery
6
- from Codex's sandbox, separates permission failures from unavailable recipients, and
7
- shows outgoing setup alongside receiving-channel state in doctor. It also includes the
8
- previous 0.4.x delivery diagnostics, session recovery and client integration fixes.
9
-
10
- Close participating clients and persistent ACC MCP processes, then run:
5
+ This release keeps the existing workspace data format. It changes when an update is
6
+ allowed to take effect: activation is gated on the store contract a running process
7
+ declares rather than on which version it happens to be, sessions finish on the generation
8
+ they started with, unreferenced generation directories are reclaimed, and `acc uninstall`
9
+ retires the holds its own install published. It carries the previous 0.4.x confirmed
10
+ service maintenance, outgoing sandbox permissions, delivery diagnostics, session recovery
11
+ and integration fixes.
11
12
 
12
13
  ```bash
13
14
  acc update
@@ -15,8 +16,8 @@ acc version
15
16
  acc doctor
16
17
  ```
17
18
 
18
- After publication, `acc version` should report 0.4.3. If a pin keeps an older version,
19
- select 0.4.3 or clear it first. A managed update refreshes installed integrations and
19
+ After publication, `acc version` should report 0.5.0. If a pin keeps an older version,
20
+ select 0.5.0 or clear it first. A managed update refreshes installed integrations and
20
21
  skills; use the npm instructions below for unmanaged or pre-0.4 installations. Start
21
22
  clients again and complete any hook/trust review they request. With existing live consent,
22
23
  Codex 0.153.4 or newer on macOS arm64 receives local socket permissions when its workspace
@@ -36,13 +37,106 @@ Claude admitted inbound Channels messages. See [delivery troubleshooting](TROUBL
36
37
  Upgrading preserves delivery consent. If doctor reports native delivery off and you want
37
38
  automatic peer requests, use `acc install --adapter codex --delivery actionable` (or the
38
39
  relevant adapter); this can spend model tokens. Codex can save that consent before its
39
- local service/session becomes available. ACC does not start the vendor daemon, and it
40
+ local service/session becomes available. Installation does not start the vendor daemon; ACC
40
41
  keeps durable inbox access when no verified live channel is bound.
41
42
 
42
43
  In Grok, public status supplies the session's own CLI arguments through the next tool
43
44
  hook. Grok still uses explicit inbox reads; this patch adds no external wake or guards.
44
45
  Start clients in a project directory, rather than a home directory containing ACC state.
45
46
 
47
+ ## What still waits for a process to exit, and what no longer does
48
+
49
+ Earlier releases held a verified update until every live ACC process and every native
50
+ client binding was gone. Each of those holds now states the store contract it speaks, and
51
+ only two kinds keep an update pending:
52
+
53
+ - A hold whose declared store contract differs from the incoming version's. This is the
54
+ case the gate exists for, and a release that changes the store contract still needs
55
+ every live process to exit.
56
+ - A hold that declares no contract, which includes every record written by a release
57
+ before this one. Unknown cannot be compared, so it stays a conservative wait.
58
+
59
+ A hold declaring the same store contract as the incoming version proceeds. Several open
60
+ Claude Code sessions, a Codex daemon and an idle ACC MCP server no longer have to be
61
+ closed together to move between releases that share a contract.
62
+
63
+ The first update after installing this release still waits for every process, because the
64
+ holds it has to judge were written before the contract field existed. Close the relevant
65
+ clients and persistent ACC processes once, or accept the eligible Codex service
66
+ maintenance offer described below. Updates after that do not need it.
67
+
68
+ `acc update` names each remaining hold with its process and its declared contract, so a
69
+ wait now states its reason rather than only the PID. `acc doctor` reports the same
70
+ pending notice.
71
+
72
+ A session that is open while an activation completes keeps running the generation it
73
+ started with, including its hooks, until it ends; it does not get half of one version and
74
+ half of another. A session whose pin names a generation with a different store contract
75
+ runs the active generation instead, which is the same behaviour as having no pin.
76
+
77
+ A restart offer for a client's background service is now made only when the version that
78
+ service is actually running fails that client's captured contract, or when it still holds
79
+ a native binding. A Codex CLI that updated while its daemon kept serving the previous
80
+ build is an ordinary state, and it no longer produces a prompt to disconnect open clients.
81
+
82
+ Generation directories that nothing references are removed after an activation instead of
83
+ accumulating. A directory is kept while any control pointer, live runtime lease, live
84
+ session pin or in-flight staging hold names it, and an unreadable holder postpones the
85
+ whole sweep rather than being assumed dead.
86
+
87
+ `acc uninstall` retires the binding records and session pins its own install published,
88
+ so they stop holding a later activation, when the removal leaves no client installed. It
89
+ never signals or terminates a client process. Removing one client while another stays
90
+ installed retires nothing, because a binding record names the generation that published
91
+ it and no client id. Runtime leases are left in place on purpose: a lease is also what
92
+ protects the generation a running process is executing from, and clearing it would let
93
+ that directory be reclaimed out from under the process. A live ACC process therefore
94
+ keeps holding activation across an uninstall until it exits.
95
+
96
+ ## Confirmed client service maintenance
97
+
98
+ On macOS arm64, `acc update` can ask once to restart a verified Codex service that holds a
99
+ native binding blocking activation, or that is serving a version outside the captured
100
+ native-delivery contract. A serving version that satisfies that contract is left alone,
101
+ even when the installed CLI has moved to a newer build. The captured maintenance contract
102
+ uses Codex CLI 0.154.0 and its `pid` backend, with compatible commands and protocol
103
+ checked again at runtime. The installed CLI and managed executable must already match;
104
+ ACC does not replace vendor binaries or install an operating-system service.
105
+
106
+ After confirmation, a detached ACC worker waits up to 15 minutes for idle Codex turns,
107
+ empty queues, the requesting command to exit, and any other ACC process still holding the
108
+ update. It judges those holds by the same contract rule the activation path uses, so a
109
+ process declaring the incoming version's store contract does not delay the restart, and
110
+ one declaring a differing or unknown contract does. It rechecks the approved candidate, settings,
111
+ PID/start time, executable, socket ownership and versions before stopping the service.
112
+ It refreshes integrations, starts the service again and verifies the result. If refreshing
113
+ integrations fails, it still restores the service and reports the incomplete update.
114
+ A later update worker can resume an already approved recovery without another question.
115
+ `acc doctor --json` exposes `update.maintenance`; ordinary `acc doctor` describes its state.
116
+ A current launcher can use the newer management reader while the old runtime is active.
117
+ When admission is blocked, doctor returns an update-only report without inspecting the
118
+ workspace or repairing it. Older launchers gain this reader after activation, or through
119
+ the one-time launcher bootstrap described below.
120
+
121
+ Open clients disconnect. Resume them afterward and complete any client-owned hook trust
122
+ review. Codex has no atomic idle-check-and-stop operation: a new turn arriving during the
123
+ final check can be interrupted. ACC does not promise that client UIs reconnect themselves
124
+ or that an interrupted turn continues automatically. Unknown ownership, incompatible
125
+ service layouts and unrelated active processes remain visible blockers.
126
+
127
+ For an unattended command, `acc update --yes` explicitly consents to the same restart.
128
+ `acc update --check` stays read-only. Background discovery never grants restart consent.
129
+ Changing the candidate or pin before the stop cancels that approval; idle-wait expiration
130
+ also leaves the service untouched. Delivery consent and automatic-update opt-outs survive
131
+ an update even when a native service or feature probe is temporarily unavailable.
132
+
133
+ An old installation can already be stuck with both a pre-0.4.4 pending runtime and the
134
+ old updater that waits indefinitely. That code cannot discover this fix. Bootstrap the
135
+ new launcher once with `npm install --global agents-can-communicate@0.5.0`, then run
136
+ `acc update`. The new launcher stages its verified runtime and retires only an exactly
137
+ identified obsolete ACC background updater while no integrations are being written.
138
+ This does not terminate an unrelated client or bypass its lifetime hold.
139
+
46
140
  ## From 0.3.1
47
141
 
48
142
  Upgrade all ACC installations participating in a workspace together, then restart their
@@ -64,7 +158,7 @@ restores access; deleting or editing the record is not a remedy.
64
158
  2. Install the released package, then refresh the client integrations:
65
159
 
66
160
  ```bash
67
- npm install --global agents-can-communicate@0.4.3
161
+ npm install --global agents-can-communicate@0.5.0
68
162
  acc version
69
163
  acc install
70
164
  ```
@@ -99,12 +193,15 @@ an independent background process, normally at most once a day, downloads and ve
99
193
  separate runtime copy, and refreshes the installed integrations and skills before switching.
100
194
  The global npm package provides a launcher; the active runtime lives under ACC's data home.
101
195
 
102
- Running ACC processes, including idle MCP servers, hold the current version until
103
- confirmed process exit. Native bindings hold until observed client SessionEnd cleanup or
104
- confirmed process death; the vendor daemon can remain running after that lifecycle event.
105
- Unknown PIDs remain conservative holds until lifecycle cleanup. `acc finish`, presence TTL,
106
- and delivery off alone do not prove native end. Close the relevant client sessions and
107
- persistent ACC processes to release holds; ACC does not manage the vendor daemon.
196
+ Running ACC processes, including idle MCP servers, still publish a hold for as long as they
197
+ live, and native bindings still hold until observed client SessionEnd cleanup or confirmed
198
+ process death; the vendor daemon can remain running after that lifecycle event. What
199
+ changed is which of those holds keeps an update pending: only one whose declared store
200
+ contract differs from the incoming version's, or that declares none at all. Unknown PIDs
201
+ remain conservative holds until lifecycle cleanup. `acc finish`, presence TTL, and delivery
202
+ off alone still do not prove native end. When a hold does block, close the relevant client
203
+ sessions and persistent ACC processes to release it, or accept the eligible Codex service
204
+ maintenance offer in `acc update`. Background updates never request fresh restart consent.
108
205
  Hooks never wait for a network download. If integration refresh temporarily prevents
109
206
  coordination, a hook lets the client continue; its next genuine user turn can restore a
110
207
  missing binding.
@@ -114,7 +211,7 @@ acc update # download and apply, or report what is keeping it
114
211
  acc update --check # check without installing or changing update settings
115
212
  acc update --auto off # disable background updates
116
213
  acc update --auto on # enable them again
117
- acc update --pin 0.4.3 # stay on this exact stable version
214
+ acc update --pin 0.5.0 # stay on this exact stable version
118
215
  acc update --pin none # follow stable releases again
119
216
  ```
120
217
 
@@ -132,9 +229,11 @@ lifecycle scripts. `acc doctor` reports the automatic-update policy and pending
132
229
  A failed download or verification keeps the active runtime. An interrupted integration
133
230
  refresh keeps workspace admission closed until `acc update` finishes the refresh. It does
134
231
  not roll workspace history back. A failed refresh exits with code `4` and reports the adapter
135
- and configuration problem to fix before retrying; a verified update waiting for live clients
136
- remains pending. Previous runtime and plugin cache versions are
137
- retained so existing launch paths survive the change.
232
+ and configuration problem to fix before retrying; a verified update waiting for a blocking
233
+ hold remains pending. A previous runtime version is retained for as long as anything can
234
+ still reach it — a control pointer, a live ACC process, or an open session pinned to it —
235
+ so existing launch paths survive the change; once nothing references it, its directory is
236
+ reclaimed after the next activation instead of accumulating.
138
237
 
139
238
  Client trust is still controlled by the client. Follow any reported activation or hook
140
239
  review steps; copied files do not prove the client has activated them. The initial
package/docs/WHY_ACC.md CHANGED
@@ -46,7 +46,7 @@ actionable before two sessions collide.
46
46
  ## Choose another layer when
47
47
 
48
48
  Choose a managed runtime if you want the system to create agents, assign execution state,
49
- select models, spend token budgets, or control process lifecycle. Choose a tracker when
49
+ select models, spend token budgets, or control ongoing agent execution. Choose a tracker when
50
50
  you need organizational planning. Choose a hosted service when participants must
51
51
  coordinate across machines.
52
52
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agents-can-communicate/adapter-claude-code",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agents-can-communicate/adapter-codex",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {