zcode-acp-server 0.84.1 → 0.84.3

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 (44) hide show
  1. package/README.md +1 -1
  2. package/dist/code-fingerprint.json +1 -1
  3. package/dist/config/user-config.d.ts +20 -0
  4. package/dist/config/user-config.d.ts.map +1 -1
  5. package/dist/config/user-config.js +24 -0
  6. package/dist/config/user-config.js.map +1 -1
  7. package/dist/handlers/background-tasks.d.ts +34 -0
  8. package/dist/handlers/background-tasks.d.ts.map +1 -1
  9. package/dist/handlers/background-tasks.js +69 -1
  10. package/dist/handlers/background-tasks.js.map +1 -1
  11. package/dist/handlers/io.d.ts +6 -3
  12. package/dist/handlers/io.d.ts.map +1 -1
  13. package/dist/handlers/io.js +6 -3
  14. package/dist/handlers/io.js.map +1 -1
  15. package/dist/handlers/session.d.ts.map +1 -1
  16. package/dist/handlers/session.js +54 -9
  17. package/dist/handlers/session.js.map +1 -1
  18. package/dist/remote/hub-server.d.ts.map +1 -1
  19. package/dist/remote/hub-server.js +139 -3
  20. package/dist/remote/hub-server.js.map +1 -1
  21. package/dist/remote/session-close-endpoint.d.ts.map +1 -1
  22. package/dist/remote/session-close-endpoint.js +5 -0
  23. package/dist/remote/session-close-endpoint.js.map +1 -1
  24. package/dist/remote/session-delete-endpoint.d.ts +15 -5
  25. package/dist/remote/session-delete-endpoint.d.ts.map +1 -1
  26. package/dist/remote/session-delete-endpoint.js +146 -11
  27. package/dist/remote/session-delete-endpoint.js.map +1 -1
  28. package/dist/remote/status-endpoint.d.ts +4 -1
  29. package/dist/remote/status-endpoint.d.ts.map +1 -1
  30. package/dist/remote/status-endpoint.js +6 -1
  31. package/dist/remote/status-endpoint.js.map +1 -1
  32. package/dist/server.d.ts +54 -0
  33. package/dist/server.d.ts.map +1 -1
  34. package/dist/server.js +145 -1
  35. package/dist/server.js.map +1 -1
  36. package/dist/tasks-index.d.ts +46 -1
  37. package/dist/tasks-index.d.ts.map +1 -1
  38. package/dist/tasks-index.js +136 -2
  39. package/dist/tasks-index.js.map +1 -1
  40. package/docs/ARCHITECTURE.md +1 -1
  41. package/docs/REMOTE-CLIENTS.md +58 -0
  42. package/docs/REMOTE.md +7 -0
  43. package/docs/REPLAY-GUIDE.md +8 -0
  44. package/package.json +1 -1
@@ -1008,6 +1008,64 @@ this bridge, `502` bridge unreachable, `503` tasks index unavailable
1008
1008
  (session delete only — never a silent success). Project delete is idempotent:
1009
1009
  an unknown or already-deleted project answers `200` with `deletedTasks: 0`.
1010
1010
 
1011
+ ### Opt-in physical purge (`{"purge": true}`)
1012
+
1013
+ Both delete endpoints accept a `{"purge": true}` body to **physically destroy
1014
+ the conversation bytes** through the upstream 3.18+ v4 deletion face
1015
+ (`storage/sessionData/deletionPreview` → `deletionExecute`, with its own
1016
+ busy/in-use guards and revision check). This is destructive and irreversible,
1017
+ so it needs BOTH the per-request flag and a machine-level arming switch:
1018
+
1019
+ ```json
1020
+ // ~/.config/zcode-acp/config.json
1021
+ { "delete": { "purge": true } }
1022
+ ```
1023
+
1024
+ (or env `ZCODE_ACP_DELETE_PURGE=1`). A purge request on an unarmed machine
1025
+ answers `403` and deletes nothing — a stolen token must not be able to
1026
+ destroy bytes.
1027
+
1028
+ ```text
1029
+ POST {hub}/api/instances/{id}/sessions/{sid}/delete
1030
+ body: { "purge": true } → 200 { "ok": true, "deleted": true, "purged": true }
1031
+
1032
+ POST {hub}/api/projects/delete
1033
+ body: { "workspacePath": "...", "purge": true }
1034
+ → 200 { "ok": true, "deletedTasks": 12,
1035
+ "purged": ["sess_a", "sess_c"],
1036
+ "skipped": [{ "id": "sess_b", "reason": "running" }] }
1037
+ ```
1038
+
1039
+ Semantics:
1040
+
1041
+ - The **tombstone is written first** — any purge failure degrades to the soft
1042
+ delete (200 with `purged: false` and a `reason`), never a half state.
1043
+ - Upstream guards map to `409` with the reason (`running`, `in-use`,
1044
+ `changed`); a session the backend answers `not-found` for (already
1045
+ physically deleted, or soft-deleted upstream — resume refuses both) gets its
1046
+ tombstone **retired** (hidden for good, never revived) and answers
1047
+ `200 { purged: false, reason: "not-found" }`.
1048
+ - A completed purge also removes the tasks-index row (its bytes are gone).
1049
+ - Project purge relays each session through the workspace's serve bridge (≤4
1050
+ concurrent, ≤200 sessions per request — the overflow is reported in
1051
+ `skipped` with a cap reason, never silently dropped; re-issue to continue);
1052
+ with no serve bridge reachable the tombstones still apply and the answer
1053
+ carries a `warning` plus per-id `skipped` entries.
1054
+
1055
+ ### Tombstone retirement (sessions whose bytes are gone)
1056
+
1057
+ A session physically deleted from the desktop App (3.18+ v4 face), or
1058
+ soft-deleted upstream (`time_deleted` — upstream resume refuses those with
1059
+ `Session not found`), can no longer be resumed through any bridge path. Its
1060
+ tombstone therefore **retires** instead of reviving: the row keeps `deleted=1`
1061
+ and gains `archived=1`, hidden from every listing forever. Retirement happens
1062
+ lazily — the first resume attempt that fails as gone — and proactively, before
1063
+ any project-wide mass revival (`session/list`'s batch id query is the liveness
1064
+ oracle; on backends without it, per-id `session/lifecycle/getState`). A probe
1065
+ failure never retires anything: no verdict means the old blind-revival
1066
+ behavior. Bridge-tombstoned sessions (deleted through THIS API, no upstream
1067
+ `time_deleted`) keep the full self-heal contract above.
1068
+
1011
1069
  ## Hub self-upgrade
1012
1070
 
1013
1071
  ```text
package/docs/REMOTE.md CHANGED
@@ -195,6 +195,13 @@ anything: live conversations are refused (`409`), tombstoned resume ids get
195
195
  `404`, and deletes are self-healing — opening the project anywhere (the CLI's
196
196
  `/resume` picker, an editor tab) or using any session again cancels the hide;
197
197
  a fully deleted project comes back whole the moment it is reopened.
198
+ Tombstones for sessions whose bytes are gone upstream (physically deleted via
199
+ the 3.18+ v4 face, or `time_deleted` — resume refuses both) RETIRE instead of
200
+ reviving (`archived=1` on top of `deleted=1`, hidden forever). Both endpoints
201
+ also take `{"purge": true}` (machine-armed via `delete.purge` in the user
202
+ config or `ZCODE_ACP_DELETE_PURGE=1`) to physically destroy bytes through the
203
+ upstream v4 deletion face — tombstone first, failures degrade to the soft
204
+ delete, `403` when unarmed.
198
205
  See `docs/REMOTE-CLIENTS.md` ("Deleting a project or session").
199
206
 
200
207
  `sessions` lists the project's **currently running** conversations (live
@@ -148,6 +148,14 @@ prompted). Two signals cover it:
148
148
  new prompt interrupts an in-flight one) the old turn's exit reports
149
149
  `running: true`: the preempting turn took over, so the session is still busy.
150
150
 
151
+ "Any turn" includes turns the BACKEND started on its own, with no client
152
+ prompt at all — a background sub-agent's completion wake
153
+ (`inputSource:"background_task"`), a `subagent_message` turn, a control-only
154
+ turn. These stream messages into the conversation while no bridge turn loop
155
+ exists; the bridge tracks them the same way upstream's taskActivityTracker
156
+ keys its running-session set off `turn.started` / `turn.terminal` regardless
157
+ of origin, and `GET /status` reports them `running` too.
158
+
151
159
  The notification is **dual-emitted under two names** (#311): the deprecated
152
160
  `$/zcode/turnState` (LSP-style prefix) and the spec-compliant
153
161
  `_zcode/turnState` (ACP reserves `_`-prefixed names for extension
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcode-acp-server",
3
- "version": "0.84.1",
3
+ "version": "0.84.3",
4
4
  "description": "Agent Client Protocol (ACP) server bridging headless ZCode to editors like Zed and JetBrains.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",