zcode-acp-server 0.81.0 → 0.82.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.
- package/README.md +1 -1
- package/dist/backend/client.d.ts +9 -0
- package/dist/backend/client.d.ts.map +1 -1
- package/dist/backend/client.js +17 -0
- package/dist/backend/client.js.map +1 -1
- package/dist/backend/index.d.ts +1 -1
- package/dist/backend/index.d.ts.map +1 -1
- package/dist/backend/types.d.ts +18 -0
- package/dist/backend/types.d.ts.map +1 -1
- package/dist/code-fingerprint.json +1 -1
- package/dist/handlers/background-tasks.d.ts.map +1 -1
- package/dist/handlers/background-tasks.js +17 -0
- package/dist/handlers/background-tasks.js.map +1 -1
- package/dist/handlers/io.d.ts +16 -0
- package/dist/handlers/io.d.ts.map +1 -1
- package/dist/handlers/io.js +48 -0
- package/dist/handlers/io.js.map +1 -1
- package/dist/handlers/session.d.ts.map +1 -1
- package/dist/handlers/session.js +77 -1
- package/dist/handlers/session.js.map +1 -1
- package/dist/handlers/steering.d.ts +5 -1
- package/dist/handlers/steering.d.ts.map +1 -1
- package/dist/handlers/steering.js +14 -2
- package/dist/handlers/steering.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/remote/broadcast.d.ts +10 -0
- package/dist/remote/broadcast.d.ts.map +1 -1
- package/dist/remote/broadcast.js +17 -0
- package/dist/remote/broadcast.js.map +1 -1
- package/dist/server.d.ts +41 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +73 -0
- package/dist/server.js.map +1 -1
- package/docs/BACKLOG.md +43 -23
- package/docs/PROTOCOL.md +27 -5
- package/package.json +1 -1
package/docs/BACKLOG.md
CHANGED
|
@@ -178,18 +178,38 @@ exactly the bridge's existing override-over-verdict rule (local
|
|
|
178
178
|
moved toward the bridge; nothing to change.
|
|
179
179
|
|
|
180
180
|
**3.17.1 audit (2026-11-02, commit `a60ba6a7` / source `73158b64` — one
|
|
181
|
-
bridge fix)**: the desktop moved 3.16.3 → 3.17.1 and its `zcode.cjs`
|
|
181
|
+
bridge fix + the lifecycle alignment)**: the desktop moved 3.16.3 → 3.17.1 and its `zcode.cjs`
|
|
182
182
|
self-reports CLI `0.17.1` — the checkout's exact CLI (root `3.17.1`,
|
|
183
183
|
`apps/zcode-cli` `0.17.1`), so for the first time since 3.16.2 the public
|
|
184
184
|
tree IS the running backend with no unseen delta. Protocol schema diff
|
|
185
185
|
`packages/shared/src/zcode-protocol/index.ts` +160/−11, additive from the
|
|
186
186
|
bridge's seat: new `session/lifecycle/{changed,getState,ensureReady,stop,
|
|
187
|
-
restart}` family (runtime-instance lifecycle, `SessionLifecycleController
|
|
188
|
-
|
|
189
|
-
`session
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
187
|
+
restart}` family (runtime-instance lifecycle, `SessionLifecycleController`;
|
|
188
|
+
**alignment landed the same day** — the bridge consumes exactly getState +
|
|
189
|
+
changed: `ensureBackendResident` (handlers/session.ts) probes getState when a
|
|
190
|
+
backend-loaded stamp goes stale, `ready` refreshes the stamp and skips the
|
|
191
|
+
blind full-resume reload, "Session not found: <sid>" throws the evicted error
|
|
192
|
+
before any reload, everything else keeps the reload — whose resume carries
|
|
193
|
+
mcpServers #193 + toolDenylist #340, which is why `ensureReady` must NOT
|
|
194
|
+
replace it — and on a still-resident session that reload was always a config
|
|
195
|
+
no-op anyway (upstream `activateSessionRuntime` early-returns the existing
|
|
196
|
+
record without re-applying resume params); the standalone `changed`
|
|
197
|
+
NOTIFICATION (full snapshot payload,
|
|
198
|
+
not a session/event) is routed at `ZcodeBackend.onLifecycleChanged` into
|
|
199
|
+
`applyLifecycleSnapshot` (server.ts) as INVALIDATION only — any non-`ready`
|
|
200
|
+
transition (starting/stopping/unloaded/faulted) voids the stamps of ALL ACP
|
|
201
|
+
aliases of the backend session, so resident-pool evictions surface immediately
|
|
202
|
+
instead of at the 5-min TTL boundary, while `ready` deliberately never
|
|
203
|
+
re-stamps (instance-ready ≠ projection-applied upstream, and a foreign
|
|
204
|
+
activation — the v4 gateway's cold-resume behind renameSession, an automation
|
|
205
|
+
wake — rebuilds the runtime without the bridge's per-load config; blessing it
|
|
206
|
+
would let session/load skip its resume flight + settle and replay a possibly
|
|
207
|
+
mid-hydration prefix — the replay-race hole); the
|
|
208
|
+
availability verdict is pinned per generation (`server.backendLifecycleApi`,
|
|
209
|
+
reset on respawn — pre-0.17.1 builds answer -32601 once and never again);
|
|
210
|
+
`stop`/`restart` stay unused, the bridge's own close/reload semantics are
|
|
211
|
+
already correct). Other additive surface: `workspace/mcp/trust` +
|
|
212
|
+
`workspaceTrust` on mcp status snapshots
|
|
193
213
|
(the bridge injects servers explicitly on create/resume = trusted, no
|
|
194
214
|
impact), `automation/pause`, `turn.started` payload + `automationId`/
|
|
195
215
|
`offPeakTaskId`/`offPeakRunType` (bridge ignores unknown payload fields),
|
|
@@ -305,7 +325,7 @@ when a concrete ACP/editor need appears. Ranked shortlist in
|
|
|
305
325
|
| `workflows/*` family (NEW 0.16.9: `list/get/updateMeta/delete/runs/move`, `index.ts:2685-2937, 3618-3625`) | Session-less management of saved dynamic workflows (`<cwd>/.zcode/workflows/`, project+global scopes), run history with `artifacts`, cross-cwd runs query | **WIRED (2026-09-24, ADR-0029)**: proxied under `/settings/workflows*` + the local `/workflows` slash listing; availability is the remote `/client/configs` verdict (`src/config/workflow-gate.ts`), and `v4/command startSavedWorkflow`/`resumeWorkflowRun` + the `workflowRun*` queries are wired with it (see the v4 section below) |
|
|
306
326
|
| `provider/testModelConnectivity` (3.12.3) | Probe a provider/model endpoint | Not used; model availability comes from the `session/create` response |
|
|
307
327
|
| `runtime/capabilities` (3.12.3; returns `{independentPlanState:true}`) | Trivial capability handshake | Not used; cheap preflight for a `zcode-acp doctor` command |
|
|
308
|
-
| `interaction/providerRuntimeHeadersCancelled` notification (`index.ts:336, 2396-2406`) | Backend cancels a pending runtime-headers refresh (workspace/session/requestId scoped) |
|
|
328
|
+
| `interaction/providerRuntimeHeadersCancelled` notification (`index.ts:336, 2396-2406`) | Backend cancels a pending runtime-headers refresh (workspace/session/requestId scoped) | Moot by design: the bridge answers the ask at frame ARRIVAL (`providerRuntimeHeadersResponder`), so nothing is ever pending to cancel — received, logged, acknowledged (client.ts) |
|
|
309
329
|
| `workspace/generateText` / `workspace/cancelGenerateText` (0.16.5) | Workspace-scoped one-shot text generation | Not used; no ACP counterpart |
|
|
310
330
|
| `workspace/updateInteractionPreferences` / `workspace/updateModelIoPreferences` | Client preference updates | Not used |
|
|
311
331
|
| `offPeak/{create,list}`, `workspace/updateOffPeakToolPolicy` (3.12.3) | Off-peak (discounted-hours) task family | Not used; `session/send` carries the matching `offPeakTaskId`/`offPeakRunType` params — candidate if a client wants to schedule discounted-hours runs. Off-peak tools are fail-closed at the protocol layer with three unlock channels (per-session param OR'd, process policy method, `offPeakPort` injection) |
|
|
@@ -346,21 +366,21 @@ options:{reasoningLevel?}}` (`packages/shared/src/model-selection.ts`); the
|
|
|
346
366
|
|
|
347
367
|
Notes per type (the ones with known bridge relevance):
|
|
348
368
|
|
|
349
|
-
| Event | Notes
|
|
350
|
-
| ------------------------------------------------------------------------ |
|
|
351
|
-
| `session.titleUpdated` | **Wired** — `SessionTitleListener` adopts `generated`/`custom` pushes
|
|
352
|
-
| `message.upserted` / `message.removed` | Message-granular upsert/remove; the projection differ reconciles instead
|
|
353
|
-
| `part.started` / `part.delta` / `part.upserted` / `part.removed` | Message-PART granular streaming (the v4 conversation model on the v3 envelope)
|
|
354
|
-
| `permission.requested` / `permission.resolved` | Interaction lifecycle OBSERVER events; the bridge serves the request methods
|
|
355
|
-
| `userInput.requested` / `userInput.resolved` | Same, for user-input interactions
|
|
356
|
-
| `checkpoint.created` / `rewind.triggered` | Checkpoint + rewind lifecycle (rewinds initiated elsewhere are observable)
|
|
357
|
-
| `streamRecovery.updated` | Stream recovery progress — payload is an untyped `jsonObjectSchema` upstream; useful for the replay/gap-fill path
|
|
358
|
-
| `turn.started` payload extras (`index.ts:1168-1186`) | `executionKind:"agent"\|"controlOnly"` (controlOnly = no model turn — the bridge's own boot-resume ack could be classified by this instead of text-matching), `foregroundExecutionId` (feeds the precise v4 stop), `backgroundSource`, `intent`, `originMeta`
|
|
359
|
-
| `turn.steerQueued` / `turn.steerDrained` payloads (`index.ts:1191-1229`) | Queue length, `commandKind`, `delivery`, `targetTurnId`, drained `injectedMessageIds
|
|
360
|
-
| `turn.completed` `resultType` + `cacheStats` (`index.ts:1230-1261`) | `resultType: success\|cancelled\|error_max_turns\|error_max_budget\|error_during_execution\|error_max_tool_calls`; `cacheStats{totalMessages, cachedMessages, lastCacheHit, cacheReadTokens?}` — rich terminal lines + cache-health visibility
|
|
361
|
-
| `turn.failed` `turnPhase` (`index.ts:1262-1269`) | Failure phase string for better triage
|
|
362
|
-
| `model.streaming` kinds (`index.ts:987-1014`) | 13 kinds incl. `reasoning_*` deltas — relevant if thinking streams are ever surfaced directly
|
|
363
|
-
| `session.updated` with `state.updated` mutation reasons | Compact terminal state IS observable here: `session_compacted` / `session_compact_cancelled` / `session_compact_failed` (source: `server-operations.ts:2082-2119`) — the bridge
|
|
369
|
+
| Event | Notes |
|
|
370
|
+
| ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
371
|
+
| `session.titleUpdated` | **Wired** — `SessionTitleListener` adopts `generated`/`custom` pushes |
|
|
372
|
+
| `message.upserted` / `message.removed` | Message-granular upsert/remove; the projection differ reconciles instead |
|
|
373
|
+
| `part.started` / `part.delta` / `part.upserted` / `part.removed` | Message-PART granular streaming (the v4 conversation model on the v3 envelope) |
|
|
374
|
+
| `permission.requested` / `permission.resolved` | Interaction lifecycle OBSERVER events; the bridge serves the request methods |
|
|
375
|
+
| `userInput.requested` / `userInput.resolved` | Same, for user-input interactions |
|
|
376
|
+
| `checkpoint.created` / `rewind.triggered` | Checkpoint + rewind lifecycle (rewinds initiated elsewhere are observable) |
|
|
377
|
+
| `streamRecovery.updated` | Stream recovery progress — payload is an untyped `jsonObjectSchema` upstream; useful for the replay/gap-fill path |
|
|
378
|
+
| `turn.started` payload extras (`index.ts:1168-1186`) | `executionKind:"agent"\|"controlOnly"` (controlOnly = no model turn — the bridge's own boot-resume ack could be classified by this instead of text-matching), `foregroundExecutionId` (feeds the precise v4 stop), `backgroundSource`, `intent`, `originMeta` |
|
|
379
|
+
| `turn.steerQueued` / `turn.steerDrained` payloads (`index.ts:1191-1229`) | Queue length, `commandKind`, `delivery`, `targetTurnId`, drained `injectedMessageIds`. Steer is REACHABLE again since `_session/steering` (#352, `v4/command` sendText). **Drain echo WIRED (2026-11-02)**: `turn.steerDrained` mirrors every drained input (a persisted USER message upstream, `persistUserPrompt` at drain) to the clients as `user_message_chunk` (`echoSteeredInputs`, io.ts) — from the turn loop while live, from BackgroundTaskListener in the no-turn-loop window (pendingTurns-gated so the two paths never double-echo), EXCLUDING steering clients (`steerEchoSuppressedRoots`: martty's Send Now cell renders the text locally — verified in martty source, `steer_ext_deferred` keeps the cell on injected/startedNewTurn — an unconditional echo would double-render there). Residual: `turn.steerQueued` still only feeds the steer-swallow guard — no live "queued behind running turn, position N" indicator |
|
|
380
|
+
| `turn.completed` `resultType` + `cacheStats` (`index.ts:1230-1261`) | `resultType: success\|cancelled\|error_max_turns\|error_max_budget\|error_during_execution\|error_max_tool_calls`; `cacheStats{totalMessages, cachedMessages, lastCacheHit, cacheReadTokens?}` — rich terminal lines + cache-health visibility |
|
|
381
|
+
| `turn.failed` `turnPhase` (`index.ts:1262-1269`) | Failure phase string for better triage |
|
|
382
|
+
| `model.streaming` kinds (`index.ts:987-1014`) | 13 kinds incl. `reasoning_*` deltas — relevant if thinking streams are ever surfaced directly |
|
|
383
|
+
| `session.updated` with `state.updated` mutation reasons | Compact terminal state IS observable here: `session_compacted` / `session_compact_cancelled` / `session_compact_failed` (source: `server-operations.ts:2082-2119`) — WIRED: the bridge records the reason (`onCompactOutcome`) and `compact()` reports real failure instead of assuming success from the RPC ack |
|
|
364
384
|
|
|
365
385
|
**Corrected 2026-09-21 (source)**: `rewind.started` / `rewind.failed` /
|
|
366
386
|
`rewind.completed`, `turn.attachments.resolved`, `usage.delta`, and
|
package/docs/PROTOCOL.md
CHANGED
|
@@ -468,21 +468,43 @@ Session state update (usage, etc.).
|
|
|
468
468
|
### Steer lifecycle events
|
|
469
469
|
|
|
470
470
|
When a user input is steered into (queued behind) a running turn, the backend
|
|
471
|
-
emits a pair of lifecycle events (app-server 0.15.2+).
|
|
472
|
-
|
|
473
|
-
|
|
471
|
+
emits a pair of lifecycle events (app-server 0.15.2+). Every drained input is
|
|
472
|
+
a persisted USER message upstream, so the bridge mirrors
|
|
473
|
+
`turn.steerDrained`'s `drainedInputs[].text` to the clients as
|
|
474
|
+
`user_message_chunk` notifications (`echoSteeredInputs`): from the turn loop
|
|
475
|
+
while one is live, and from the session-scoped background listener otherwise
|
|
476
|
+
(gated on `pendingTurns`, so the two paths never double-echo). Clients that
|
|
477
|
+
STEERED via `_session/steering` are excluded from the echo
|
|
478
|
+
(`steerEchoSuppressedRoots` — they render the injected text locally, e.g.
|
|
479
|
+
martty keeps its Send Now cell, and would see it twice); backend-internal
|
|
480
|
+
guides (plan-approval feedback, workflow refine) have no steering client and
|
|
481
|
+
echo to everyone. `turn.steerQueued`
|
|
482
|
+
feeds the steer-swallow guard (a send accepted mid-generation is queued and
|
|
483
|
+
silently dropped when the turn ends — reported to the user at once) but has no
|
|
484
|
+
live "queued" indicator yet (see [`BACKLOG.md`](./BACKLOG.md)).
|
|
474
485
|
|
|
475
486
|
```json
|
|
476
487
|
{
|
|
477
488
|
"type": "turn.steerQueued",
|
|
478
|
-
"payload": {
|
|
489
|
+
"payload": {
|
|
490
|
+
"pendingInputId": "…",
|
|
491
|
+
"inputPreview": "…",
|
|
492
|
+
"delivery": "queue",
|
|
493
|
+
"targetTurnId": "…",
|
|
494
|
+
"queueLength": 1
|
|
495
|
+
}
|
|
479
496
|
}
|
|
480
497
|
```
|
|
481
498
|
|
|
482
499
|
```json
|
|
483
500
|
{
|
|
484
501
|
"type": "turn.steerDrained",
|
|
485
|
-
"payload": {
|
|
502
|
+
"payload": {
|
|
503
|
+
"pendingInputIds": ["…"],
|
|
504
|
+
"targetTurnId": "…",
|
|
505
|
+
"injectedMessageIds": ["…"],
|
|
506
|
+
"drainedInputs": [{ "pendingInputId": "…", "messageId": "…", "text": "…" }]
|
|
507
|
+
}
|
|
486
508
|
}
|
|
487
509
|
```
|
|
488
510
|
|