agents-can-communicate 0.4.3 → 0.4.4
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 +5 -3
- package/bin/acc-maintenance-worker.mjs +6 -0
- package/docs/ARCHITECTURE.md +12 -5
- package/docs/CLI.md +13 -6
- package/docs/CONCEPTS.md +2 -1
- package/docs/CONFIGURATION.md +2 -1
- package/docs/GETTING_STARTED.md +4 -2
- package/docs/HOW_IT_WORKS.md +2 -1
- package/docs/RELEASING.md +1 -1
- package/docs/SECURITY_MODEL.md +12 -5
- package/docs/TROUBLESHOOTING.md +5 -2
- package/docs/UPGRADING.md +54 -13
- package/docs/WHY_ACC.md +1 -1
- package/node_modules/@agents-can-communicate/adapter-claude-code/package.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-codex/package.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-codex/src/adapter.mjs +6 -2
- package/node_modules/@agents-can-communicate/adapter-codex/src/maintenance-host.mjs +120 -0
- package/node_modules/@agents-can-communicate/adapter-codex/src/maintenance-threads.mjs +49 -0
- package/node_modules/@agents-can-communicate/adapter-codex/src/maintenance.mjs +108 -0
- package/node_modules/@agents-can-communicate/adapter-gemini-cli/extension/gemini-extension.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-gemini-cli/package.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-grok/package.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-kimi/package.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-sdk/package.json +1 -1
- package/node_modules/@agents-can-communicate/cli/package.json +1 -1
- package/node_modules/@agents-can-communicate/cli/src/args.mjs +1 -1
- package/node_modules/@agents-can-communicate/cli/src/doctor-command.mjs +3 -4
- package/node_modules/@agents-can-communicate/cli/src/help.mjs +2 -0
- package/node_modules/@agents-can-communicate/cli/src/main.mjs +5 -3
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/activation.mjs +45 -7
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/command.mjs +15 -0
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/diagnostics.mjs +35 -0
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/entry.mjs +40 -8
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/legacy-maintenance.mjs +47 -0
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/maintenance-state.mjs +57 -0
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/maintenance-worker.mjs +110 -0
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/maintenance.mjs +92 -0
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/management-recovery.mjs +71 -0
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/refresh.mjs +6 -7
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/schedule.mjs +4 -2
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/worker.mjs +16 -4
- package/node_modules/@agents-can-communicate/core/package.json +1 -1
- package/node_modules/@agents-can-communicate/delivery-router/package.json +1 -1
- package/node_modules/@agents-can-communicate/hook-runner/package.json +1 -1
- package/node_modules/@agents-can-communicate/installer/package.json +1 -1
- package/node_modules/@agents-can-communicate/installer/src/apply.mjs +2 -2
- package/node_modules/@agents-can-communicate/installer/src/plan.mjs +10 -3
- package/node_modules/@agents-can-communicate/mcp-server/package.json +1 -1
- package/node_modules/@agents-can-communicate/protocol/package.json +1 -1
- package/node_modules/@agents-can-communicate/storage-filesystem/package.json +1 -1
- package/package.json +2 -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.
|
|
83
|
+
0.4.4 update and the data-format boundary when moving from 0.3.1.
|
|
84
84
|
|
|
85
85
|
## When messages arrive
|
|
86
86
|
|
|
@@ -142,8 +142,10 @@ One npm package. ACC needs no separate account, model API key, or hosted service
|
|
|
142
142
|
|
|
143
143
|
Initial installation enables automatic updates. ACC downloads stable releases in the
|
|
144
144
|
background and waits for active clients and ACC processes to exit before switching the
|
|
145
|
-
runtime and refreshing integrations.
|
|
146
|
-
|
|
145
|
+
runtime and refreshing integrations. When a verified Codex service needs a restart,
|
|
146
|
+
`acc update` asks once, then completes maintenance in a separate process. Open clients
|
|
147
|
+
disconnect; `acc doctor` reports progress and the result. See [update and recovery details](docs/UPGRADING.md#confirmed-client-service-maintenance).
|
|
148
|
+
Restart or resume clients afterward and complete any requested hook or plugin trust review.
|
|
147
149
|
|
|
148
150
|
For an immediate update:
|
|
149
151
|
|
|
@@ -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; });
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -15,8 +15,10 @@ flowchart LR
|
|
|
15
15
|
T -->|reply or acknowledge| C
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
|
|
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;
|
|
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
|
|
@@ -184,7 +186,12 @@ remains fenced and repairs forward, with the old active pointer retained but nor
|
|
|
184
186
|
workspace admission unavailable until recovery completes. Native bindings cease holding
|
|
185
187
|
after observed SessionEnd cleanup or confirmed process death; the vendor daemon may remain
|
|
186
188
|
running. Unknown PIDs remain holds until lifecycle cleanup. Presence TTL, `acc finish`,
|
|
187
|
-
and delivery off alone do not prove native lifecycle end.
|
|
189
|
+
and delivery off alone do not prove native lifecycle end. Normal background updates never
|
|
190
|
+
restart a vendor daemon. An explicitly approved maintenance job can do so through the
|
|
191
|
+
adapter lifecycle port: it waits for idle work, validates exact process identity, stops
|
|
192
|
+
the service under the admission fence, refreshes integrations, and restores and verifies
|
|
193
|
+
the service even after a refresh failure. Checkpoints and the detached worker live outside
|
|
194
|
+
repositories. Approved crash recovery never blindly repeats a stop.
|
|
188
195
|
|
|
189
196
|
Lock ownership never expires by age. Retained nonempty tombstones prevent delayed observers
|
|
190
197
|
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.
|
|
252
|
-
|
|
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.
|
|
@@ -281,8 +281,13 @@ holds. `finish`, presence TTL, and delivery off are not observed native end. Hoo
|
|
|
281
281
|
wait for network work. `ACC_NO_UPDATE_CHECK=1` disables update networking and background
|
|
282
282
|
scheduling.
|
|
283
283
|
|
|
284
|
-
`acc update` requests the update immediately
|
|
285
|
-
|
|
284
|
+
`acc update` requests the update immediately. If a verified Codex service blocks activation
|
|
285
|
+
or runs an older version than the installed CLI, it asks once to restart that service.
|
|
286
|
+
After confirmation, a detached worker waits for idle work and other ACC processes, refreshes
|
|
287
|
+
integrations, restarts the service and verifies the result. Open clients disconnect; use
|
|
288
|
+
`acc doctor` for progress and resume the clients afterward. `--yes` supplies explicit
|
|
289
|
+
noninteractive restart consent. Without consent, or with unknown ownership, the update
|
|
290
|
+
remains pending. See [maintenance limits and recovery](UPGRADING.md#confirmed-client-service-maintenance). `--check` only checks and cannot be combined with
|
|
286
291
|
settings changes. `--auto off` disables background updates, and `--auto on` enables them.
|
|
287
292
|
`--pin 0.4.0` holds an exact stable version; `--pin none` follows stable releases. A pin
|
|
288
293
|
cannot downgrade the active runtime. The old `--apply` flag remains accepted.
|
|
@@ -290,7 +295,9 @@ cannot downgrade the active runtime. The old `--apply` flag remains accepted.
|
|
|
290
295
|
Failed downloads keep the working runtime. A failed integration refresh exits with code
|
|
291
296
|
`4`, names the failed adapter and configuration error, and keeps workspace admission closed.
|
|
292
297
|
Fix the reported configuration problem, then run `acc update` to finish it. `acc doctor`
|
|
293
|
-
reports the update policy and pending notice.
|
|
298
|
+
reports the update policy and pending notice. During blocked activation, a current launcher
|
|
299
|
+
returns `scope: update` and `workspaceInspection: unavailable_during_update` without opening
|
|
300
|
+
workspace state; `doctor --repair` remains blocked. Native clients may still require hook trust
|
|
294
301
|
or activation review. See [Upgrading](UPGRADING.md) for the initial 0.3.1 transition and
|
|
295
302
|
recovery details.
|
|
296
303
|
|
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
|
|
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
|
|
package/docs/CONFIGURATION.md
CHANGED
|
@@ -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;
|
|
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.
|
package/docs/GETTING_STARTED.md
CHANGED
|
@@ -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.
|
|
18
|
+
Already using ACC? Follow the [upgrade guide](UPGRADING.md) for the 0.4.x → 0.4.4
|
|
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
|
|
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
|
package/docs/HOW_IT_WORKS.md
CHANGED
|
@@ -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/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.
|
|
4
|
+
its evidence tied to the commit that supplied its bytes. The package is currently `0.4.4`;
|
|
5
5
|
the commands derive the version from `package.json` so the filename cannot drift.
|
|
6
6
|
|
|
7
7
|
```mermaid
|
package/docs/SECURITY_MODEL.md
CHANGED
|
@@ -24,9 +24,10 @@ graph LR
|
|
|
24
24
|
H["human authority"] --> C
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
ACC does not read raw transcripts
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
|
@@ -122,8 +123,14 @@ author as a software-supply trust boundary; they do not establish that package c
|
|
|
122
123
|
|
|
123
124
|
ACC process leases hold activation until confirmed exit. Native bindings hold until observed
|
|
124
125
|
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.
|
|
126
|
-
not manage
|
|
126
|
+
`acc finish`, presence TTL, and delivery off do not establish native lifecycle end.
|
|
127
|
+
Normal installation and message delivery do not manage vendor services. Explicit
|
|
128
|
+
`acc update` maintenance requires one separate confirmation (or `--yes`) for the recorded
|
|
129
|
+
candidate and verified service identity. The detached worker retains that approval for
|
|
130
|
+
recovery, rechecks PID/start time, executable, socket, versions and idle state, and preserves
|
|
131
|
+
unrelated or unidentified process holds. The vendor exposes no atomic turn-drain operation:
|
|
132
|
+
a turn arriving between the final check and stop can be interrupted. See
|
|
133
|
+
[confirmed maintenance](UPGRADING.md#confirmed-client-service-maintenance).
|
|
127
134
|
|
|
128
135
|
A failed download leaves the active runtime available. A partial integration refresh retains
|
|
129
136
|
the old active pointer but fences normal workspace admission in `activating`; it does not
|
package/docs/TROUBLESHOOTING.md
CHANGED
|
@@ -240,8 +240,11 @@ Run `acc doctor` to see the update policy and pending notice. ACC process leases
|
|
|
240
240
|
persistent MCP servers, require confirmed process exit. Native bindings clear on observed
|
|
241
241
|
SessionEnd or confirmed process death; a vendor daemon may remain alive after SessionEnd.
|
|
242
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.
|
|
244
|
-
|
|
243
|
+
ACC processes; `finish`, presence TTL, and delivery off do not prove native end.
|
|
244
|
+
`acc update` can offer a confirmed restart of an eligible Codex service. Unknown or
|
|
245
|
+
unrelated holds still require lifecycle cleanup or confirmed process exit; safety holds
|
|
246
|
+
do not expire merely by elapsed time. See
|
|
247
|
+
[maintenance and recovery](UPGRADING.md#confirmed-client-service-maintenance).
|
|
245
248
|
|
|
246
249
|
Use `acc update` to retry a failed download or finish an interrupted integration refresh.
|
|
247
250
|
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.
|
|
1
|
+
# Upgrading to 0.4.4
|
|
2
2
|
|
|
3
|
-
## From 0.4.2, 0.4.1 or 0.4.0
|
|
3
|
+
## From 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
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
This patch keeps the existing workspace data format. It adds confirmed service maintenance
|
|
6
|
+
to the updater, preserves native delivery setup when readiness probes are unavailable,
|
|
7
|
+
and names the actual processes blocking activation. It includes the previous 0.4.x
|
|
8
|
+
outgoing sandbox permissions, delivery diagnostics, session recovery and integration fixes.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Run the update command; it can offer a confirmed restart for an eligible Codex service.
|
|
11
|
+
Other active clients and persistent ACC MCP processes still need to finish before activation:
|
|
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.
|
|
19
|
-
select 0.4.
|
|
19
|
+
After publication, `acc version` should report 0.4.4. If a pin keeps an older version,
|
|
20
|
+
select 0.4.4 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,52 @@ 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.
|
|
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
|
+
## Confirmed client service maintenance
|
|
48
|
+
|
|
49
|
+
On macOS arm64, `acc update` can ask once to restart a verified Codex service that blocks
|
|
50
|
+
activation or runs a different version from the installed CLI. The captured maintenance
|
|
51
|
+
contract uses Codex CLI 0.154.0 and its `pid` backend, with compatible commands and protocol
|
|
52
|
+
checked again at runtime. The installed CLI and managed executable must already match;
|
|
53
|
+
ACC does not replace vendor binaries or install an operating-system service.
|
|
54
|
+
|
|
55
|
+
After confirmation, a detached ACC worker waits up to 15 minutes for idle Codex turns,
|
|
56
|
+
empty queues and other ACC processes to exit. It rechecks the approved candidate, settings,
|
|
57
|
+
PID/start time, executable, socket ownership and versions before stopping the service.
|
|
58
|
+
It refreshes integrations, starts the service again and verifies the result. If refreshing
|
|
59
|
+
integrations fails, it still restores the service and reports the incomplete update.
|
|
60
|
+
A later update worker can resume an already approved recovery without another question.
|
|
61
|
+
`acc doctor --json` exposes `update.maintenance`; ordinary `acc doctor` describes its state.
|
|
62
|
+
A current launcher can use the newer management reader while the old runtime is active.
|
|
63
|
+
When admission is blocked, doctor returns an update-only report without inspecting the
|
|
64
|
+
workspace or repairing it. Older launchers gain this reader after activation, or through
|
|
65
|
+
the one-time launcher bootstrap described below.
|
|
66
|
+
|
|
67
|
+
Open clients disconnect. Resume them afterward and complete any client-owned hook trust
|
|
68
|
+
review. Codex has no atomic idle-check-and-stop operation: a new turn arriving during the
|
|
69
|
+
final check can be interrupted. ACC does not promise that client UIs reconnect themselves
|
|
70
|
+
or that an interrupted turn continues automatically. Unknown ownership, incompatible
|
|
71
|
+
service layouts and unrelated active processes remain visible blockers.
|
|
72
|
+
|
|
73
|
+
For an unattended command, `acc update --yes` explicitly consents to the same restart.
|
|
74
|
+
`acc update --check` stays read-only. Background discovery never grants restart consent.
|
|
75
|
+
Changing the candidate or pin before the stop cancels that approval; idle-wait expiration
|
|
76
|
+
also leaves the service untouched. Delivery consent and automatic-update opt-outs survive
|
|
77
|
+
an update even when a native service or feature probe is temporarily unavailable.
|
|
78
|
+
|
|
79
|
+
An old installation can already be stuck with both a pre-0.4.4 pending runtime and the
|
|
80
|
+
old updater that waits indefinitely. That code cannot discover this fix. Bootstrap the
|
|
81
|
+
new launcher once with `npm install --global agents-can-communicate@0.4.4`, then run
|
|
82
|
+
`acc update`. The new launcher stages its verified runtime and retires only an exactly
|
|
83
|
+
identified obsolete ACC background updater while no integrations are being written.
|
|
84
|
+
This does not terminate an unrelated client or bypass its lifetime hold.
|
|
85
|
+
|
|
46
86
|
## From 0.3.1
|
|
47
87
|
|
|
48
88
|
Upgrade all ACC installations participating in a workspace together, then restart their
|
|
@@ -64,7 +104,7 @@ restores access; deleting or editing the record is not a remedy.
|
|
|
64
104
|
2. Install the released package, then refresh the client integrations:
|
|
65
105
|
|
|
66
106
|
```bash
|
|
67
|
-
npm install --global agents-can-communicate@0.4.
|
|
107
|
+
npm install --global agents-can-communicate@0.4.4
|
|
68
108
|
acc version
|
|
69
109
|
acc install
|
|
70
110
|
```
|
|
@@ -104,7 +144,8 @@ confirmed process exit. Native bindings hold until observed client SessionEnd cl
|
|
|
104
144
|
confirmed process death; the vendor daemon can remain running after that lifecycle event.
|
|
105
145
|
Unknown PIDs remain conservative holds until lifecycle cleanup. `acc finish`, presence TTL,
|
|
106
146
|
and delivery off alone do not prove native end. Close the relevant client sessions and
|
|
107
|
-
persistent ACC processes to release holds
|
|
147
|
+
persistent ACC processes to release holds, or accept the eligible Codex service maintenance
|
|
148
|
+
offer in `acc update`. Background updates never request fresh restart consent.
|
|
108
149
|
Hooks never wait for a network download. If integration refresh temporarily prevents
|
|
109
150
|
coordination, a hook lets the client continue; its next genuine user turn can restore a
|
|
110
151
|
missing binding.
|
|
@@ -114,7 +155,7 @@ acc update # download and apply, or report what is keeping it
|
|
|
114
155
|
acc update --check # check without installing or changing update settings
|
|
115
156
|
acc update --auto off # disable background updates
|
|
116
157
|
acc update --auto on # enable them again
|
|
117
|
-
acc update --pin 0.4.
|
|
158
|
+
acc update --pin 0.4.4 # stay on this exact stable version
|
|
118
159
|
acc update --pin none # follow stable releases again
|
|
119
160
|
```
|
|
120
161
|
|
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
|
|
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
|
|
|
@@ -2,6 +2,8 @@ import { defineAdapter, projectContext, projectContextResult }
|
|
|
2
2
|
from "@agents-can-communicate/adapter-sdk";
|
|
3
3
|
import { probeNativeDelivery, planNativeActivation, bindNativeSession, refreshNativeSession, retireNativeSession, offerMessage } from "./native-delivery.mjs";
|
|
4
4
|
import certification from "../certification.json" with { type: "json" };
|
|
5
|
+
import { createCodexMaintenance } from "./maintenance.mjs";
|
|
6
|
+
export { sameMaintenanceIdentity } from "./maintenance.mjs";
|
|
5
7
|
|
|
6
8
|
import { PROTOCOL_CONTRACT } from "./app-server-client.mjs";
|
|
7
9
|
import { allowOutcome, denyOutcome, injectOutcome, normalizeCodexHook }
|
|
@@ -16,8 +18,9 @@ export const CODEX_DELIVERY_FALLBACK = Object.freeze({
|
|
|
16
18
|
diagnostic: "Codex native delivery requires codex-cli 0.152.1 or newer on darwin-arm64, "
|
|
17
19
|
+ "recorded recipient consent and a reachable LocalDaemon session with exact thread, cwd, "
|
|
18
20
|
+ "process, version and protocol verification. Embedded or unreachable sessions retain "
|
|
19
|
-
+ "durable messages.
|
|
20
|
-
+ "launch arguments; fallback is exact-certified next-turn delivery or acc inbox"
|
|
21
|
+
+ "durable messages. Native delivery does not start, restart or stop the vendor daemon and adds no "
|
|
22
|
+
+ "launch arguments; fallback is exact-certified next-turn delivery or acc inbox. "
|
|
23
|
+
+ "Explicitly confirmed acc update maintenance has a separate daemon restart check",
|
|
21
24
|
});
|
|
22
25
|
|
|
23
26
|
/**
|
|
@@ -61,6 +64,7 @@ export function createCodexAdapter() {
|
|
|
61
64
|
},
|
|
62
65
|
probeNativeDelivery, planNativeActivation, bindNativeSession,
|
|
63
66
|
refreshNativeSession, retireNativeSession, offerMessage,
|
|
67
|
+
...createCodexMaintenance(),
|
|
64
68
|
startSession: async () => ({ ok: true, changes: [], diagnostics: [] }),
|
|
65
69
|
endSession: async () => ({ ok: true, changes: [], diagnostics: [] }),
|
|
66
70
|
guardWrite: async () => ({ ok: true, changes: [], diagnostics: [] }),
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { constants } from "node:fs";
|
|
3
|
+
import { access, lstat, open, realpath } from "node:fs/promises";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { compareStableVersions, parseStableVersion } from "./app-server-client.mjs";
|
|
7
|
+
|
|
8
|
+
export const MINIMUM_MAINTENANCE_CLI = "0.154.0";
|
|
9
|
+
export const absolute = value => typeof value === "string" && path.isAbsolute(value)
|
|
10
|
+
&& !/[\0\r\n]/.test(value);
|
|
11
|
+
export const failMaintenance = reasonCode => { throw Object.assign(new Error(reasonCode), { reasonCode }); };
|
|
12
|
+
const own = info => typeof process.getuid !== "function" || info.uid === process.getuid();
|
|
13
|
+
export const startTimeValid = value => typeof value === "string"
|
|
14
|
+
&& /^[A-Z][a-z]{2} [A-Z][a-z]{2} [ \d]\d \d\d:\d\d:\d\d \d{4}$/.test(value);
|
|
15
|
+
export const managedExecutablePaths = codexHome => ["bin/codex", "codex"].map(name =>
|
|
16
|
+
path.join(codexHome, "packages/standalone/current", name));
|
|
17
|
+
|
|
18
|
+
export function runMaintenanceCommand(command, args, options) {
|
|
19
|
+
return new Promise(resolve => execFile(command, args,
|
|
20
|
+
{ ...options, timeout: 20_000, maxBuffer: 131_072, windowsHide: true },
|
|
21
|
+
(error, stdout, stderr) => resolve({ status: error ?
|
|
22
|
+
(typeof error.code === "number" ? error.code : null) : 0, stdout, stderr })));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function maintenanceContext(context = {}) {
|
|
26
|
+
const env = context.env ?? process.env;
|
|
27
|
+
const home = context.home ?? env.HOME ?? os.homedir();
|
|
28
|
+
let codexHome = env.CODEX_HOME ?? path.join(home, ".codex");
|
|
29
|
+
if (!absolute(home) || !absolute(codexHome)) failMaintenance("invalid_service_home");
|
|
30
|
+
try { codexHome = await realpath(codexHome); }
|
|
31
|
+
catch (error) { if (error.code !== "ENOENT") throw error; }
|
|
32
|
+
const [binPath, legacyPath] = managedExecutablePaths(codexHome);
|
|
33
|
+
const managedPath = await metadataExists(binPath) ? binPath : legacyPath;
|
|
34
|
+
return { codexHome, socketPath: path.join(codexHome, "app-server-control/app-server-control.sock"),
|
|
35
|
+
pidPath: path.join(codexHome, "app-server-daemon/app-server.pid"),
|
|
36
|
+
managedPath,
|
|
37
|
+
platform: context.platform ?? `${process.platform}-${process.arch}`,
|
|
38
|
+
options: { cwd: codexHome, env: { ...env, HOME: home, CODEX_HOME: codexHome } } };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function metadataExists(file) {
|
|
42
|
+
try { await lstat(file); return true; }
|
|
43
|
+
catch (error) { if (error.code === "ENOENT") return false; throw error; }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function resolveCli(pathEnv) {
|
|
47
|
+
for (const directory of String(pathEnv ?? "").split(path.delimiter)) {
|
|
48
|
+
if (!absolute(directory)) continue;
|
|
49
|
+
const candidate = path.join(directory, "codex");
|
|
50
|
+
try {
|
|
51
|
+
await access(candidate, constants.X_OK);
|
|
52
|
+
const resolved = await realpath(candidate);
|
|
53
|
+
if ((await lstat(resolved)).isFile()) return resolved;
|
|
54
|
+
} catch { /* another PATH entry may be usable */ }
|
|
55
|
+
}
|
|
56
|
+
failMaintenance("maintenance_cli_unavailable");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const cliVersion = response => response.status === 0
|
|
60
|
+
? /^codex-cli (\d+\.\d+\.\d+)\s*$/.exec(response.stdout)?.[1] ?? null : null;
|
|
61
|
+
|
|
62
|
+
export async function probeMaintenanceInstall(paths, run) {
|
|
63
|
+
const cliPath = await resolveCli(paths.options.env.PATH);
|
|
64
|
+
const version = cliVersion(await run(cliPath, ["--version"], paths.options));
|
|
65
|
+
if (!parseStableVersion(version) || compareStableVersions(version, MINIMUM_MAINTENANCE_CLI) < 0) {
|
|
66
|
+
failMaintenance("maintenance_cli_unsupported");
|
|
67
|
+
}
|
|
68
|
+
const help = await run(cliPath, ["app-server", "daemon", "--help"], paths.options);
|
|
69
|
+
if (help.status !== 0 || ["start", "stop", "version"].some(command =>
|
|
70
|
+
!new RegExp(`^\\s+${command}\\s+`, "m").test(help.stdout))) failMaintenance("maintenance_cli_unsupported");
|
|
71
|
+
const managedVersion = cliVersion(await run(paths.managedPath, ["--version"], paths.options));
|
|
72
|
+
if (managedVersion !== version) failMaintenance("managed_binary_mismatch");
|
|
73
|
+
return { cliPath, cliVersion: version, managedVersion };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export async function readMaintenancePid(file) {
|
|
77
|
+
let handle;
|
|
78
|
+
try {
|
|
79
|
+
handle = await open(file, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
80
|
+
const info = await handle.stat();
|
|
81
|
+
if (!info.isFile() || !own(info) || info.size > 4_096 || (info.mode & 0o022) !== 0) {
|
|
82
|
+
failMaintenance("daemon_identity_unavailable");
|
|
83
|
+
}
|
|
84
|
+
const value = JSON.parse(await handle.readFile("utf8"));
|
|
85
|
+
if (!Number.isSafeInteger(value.pid) || value.pid < 2 || !startTimeValid(value.processStartTime)) {
|
|
86
|
+
failMaintenance("daemon_identity_unavailable");
|
|
87
|
+
}
|
|
88
|
+
return { pid: value.pid, processStartTime: value.processStartTime };
|
|
89
|
+
} finally { await handle?.close(); }
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export async function observeMaintenanceProcess(pid, paths, run) {
|
|
93
|
+
const response = await run("/bin/ps", ["-p", String(pid), "-o", "lstart=,command="], paths.options);
|
|
94
|
+
if (response.status === 1 && response.stdout === "" && response.stderr === "") return { state: "dead" };
|
|
95
|
+
if (response.status !== 0) return { state: "unknown" };
|
|
96
|
+
const match = /^(.{24})\s+(.+)$/.exec(response.stdout.trim());
|
|
97
|
+
if (!match || !startTimeValid(match[1])) return { state: "unknown" };
|
|
98
|
+
return { state: "alive", processStartTime: match[1], command: match[2] };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export async function verifyMaintenanceProcess(snapshot, paths, run) {
|
|
102
|
+
const process = await observeMaintenanceProcess(snapshot.pid, paths, run);
|
|
103
|
+
const suffix = " app-server --listen unix://";
|
|
104
|
+
const executable = process.command?.endsWith(suffix) ? process.command.slice(0, -suffix.length) : null;
|
|
105
|
+
if (process.state !== "alive" || process.processStartTime !== snapshot.processStartTime
|
|
106
|
+
|| !managedExecutablePaths(paths.codexHome).includes(executable)
|
|
107
|
+
|| await realpath(executable) !== await realpath(paths.managedPath)) {
|
|
108
|
+
failMaintenance("daemon_identity_unavailable");
|
|
109
|
+
}
|
|
110
|
+
const sockets = await run("/usr/sbin/lsof", ["-n", "-a", "-p", String(snapshot.pid), "-U", "-Fn"], paths.options);
|
|
111
|
+
if (sockets.status !== 0 || !sockets.stdout.split("\n").includes(`n${paths.socketPath}`)) {
|
|
112
|
+
failMaintenance("daemon_socket_unproven");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export async function approvedProcessIsDead(expected, paths, run) {
|
|
117
|
+
const observed = await observeMaintenanceProcess(expected.pid, paths, run);
|
|
118
|
+
return observed.state === "dead" || (observed.state === "alive"
|
|
119
|
+
&& observed.processStartTime !== expected.processStartTime);
|
|
120
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { initializeCodex } from "./app-server-client.mjs";
|
|
2
|
+
import { failMaintenance } from "./maintenance-host.mjs";
|
|
3
|
+
|
|
4
|
+
async function loadedThreads(peer) {
|
|
5
|
+
const ids = [], cursors = new Set();
|
|
6
|
+
let cursor = null;
|
|
7
|
+
for (let page = 0; page < 20; page += 1) {
|
|
8
|
+
const response = await peer.request("thread/loaded/list", { limit: 100, ...(cursor ? { cursor } : {}) });
|
|
9
|
+
if (!Array.isArray(response?.data) || response.data.some(id => typeof id !== "string" || !id)) {
|
|
10
|
+
failMaintenance("maintenance_protocol_unavailable");
|
|
11
|
+
}
|
|
12
|
+
ids.push(...response.data);
|
|
13
|
+
cursor = response.nextCursor ?? null;
|
|
14
|
+
if (cursor === null) {
|
|
15
|
+
if (new Set(ids).size !== ids.length) failMaintenance("maintenance_protocol_unavailable");
|
|
16
|
+
return ids.sort();
|
|
17
|
+
}
|
|
18
|
+
if (typeof cursor !== "string" || !cursor || cursors.has(cursor)) failMaintenance("maintenance_protocol_unavailable");
|
|
19
|
+
cursors.add(cursor);
|
|
20
|
+
}
|
|
21
|
+
failMaintenance("maintenance_protocol_unavailable");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// The caller receives counts only. No thread/list previews, turns, queue bodies,
|
|
25
|
+
// notification history, or vendor errors are retained in maintenance snapshots.
|
|
26
|
+
export async function maintenanceWorkload(snapshot, open) {
|
|
27
|
+
let peer;
|
|
28
|
+
try {
|
|
29
|
+
peer = await open({ socketPath: snapshot.socketPath });
|
|
30
|
+
if (await initializeCodex(peer) !== snapshot.serverVersion) failMaintenance("daemon_version_changed");
|
|
31
|
+
const ids = await loadedThreads(peer);
|
|
32
|
+
let busyThreads = 0, queuedRequests = 0;
|
|
33
|
+
for (const threadId of ids) {
|
|
34
|
+
const response = await peer.request("thread/read", { threadId, includeTurns: false });
|
|
35
|
+
const thread = response?.thread;
|
|
36
|
+
if (thread?.id !== threadId || !Array.isArray(thread.turns) || thread.turns.length !== 0
|
|
37
|
+
|| !["idle", "active"].includes(thread.status?.type)) failMaintenance("maintenance_protocol_unavailable");
|
|
38
|
+
if (thread.status.type === "active") busyThreads += 1;
|
|
39
|
+
const queue = await peer.request("thread/queue/list", { threadId });
|
|
40
|
+
if (!Array.isArray(queue?.data) || queue.nextCursor != null
|
|
41
|
+
|| queue.data.some(entry => typeof entry?.id !== "string" || !entry.id)) {
|
|
42
|
+
failMaintenance("maintenance_protocol_unavailable");
|
|
43
|
+
}
|
|
44
|
+
queuedRequests += queue.data.length;
|
|
45
|
+
}
|
|
46
|
+
if (JSON.stringify(await loadedThreads(peer)) !== JSON.stringify(ids)) failMaintenance("loaded_threads_changed");
|
|
47
|
+
return { busyThreads, queuedRequests };
|
|
48
|
+
} finally { await peer?.close(); }
|
|
49
|
+
}
|