zcode-acp-server 0.11.9 → 0.14.2

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 (113) hide show
  1. package/README.md +144 -32
  2. package/dist/backend/client.d.ts.map +1 -1
  3. package/dist/backend/client.js +10 -0
  4. package/dist/backend/client.js.map +1 -1
  5. package/dist/backend/listener.d.ts +5 -4
  6. package/dist/backend/listener.d.ts.map +1 -1
  7. package/dist/backend/listener.js +11 -9
  8. package/dist/backend/listener.js.map +1 -1
  9. package/dist/backend/resolve.d.ts.map +1 -1
  10. package/dist/backend/resolve.js +35 -1
  11. package/dist/backend/resolve.js.map +1 -1
  12. package/dist/bin/hub.d.ts +3 -3
  13. package/dist/bin/hub.d.ts.map +1 -1
  14. package/dist/bin/hub.js +22 -12
  15. package/dist/bin/hub.js.map +1 -1
  16. package/dist/bin/quota.d.ts +14 -6
  17. package/dist/bin/quota.d.ts.map +1 -1
  18. package/dist/bin/quota.js +27 -19
  19. package/dist/bin/quota.js.map +1 -1
  20. package/dist/cli.d.ts +38 -0
  21. package/dist/cli.d.ts.map +1 -0
  22. package/dist/cli.js +129 -0
  23. package/dist/cli.js.map +1 -0
  24. package/dist/config/runtime-model.d.ts +10 -10
  25. package/dist/config/runtime-model.js +10 -10
  26. package/dist/handlers/account.d.ts +1 -1
  27. package/dist/handlers/account.js +1 -1
  28. package/dist/handlers/dispatch.d.ts.map +1 -1
  29. package/dist/handlers/dispatch.js +42 -36
  30. package/dist/handlers/dispatch.js.map +1 -1
  31. package/dist/handlers/io.d.ts.map +1 -1
  32. package/dist/handlers/io.js +19 -13
  33. package/dist/handlers/io.js.map +1 -1
  34. package/dist/handlers/session.d.ts +58 -4
  35. package/dist/handlers/session.d.ts.map +1 -1
  36. package/dist/handlers/session.js +417 -72
  37. package/dist/handlers/session.js.map +1 -1
  38. package/dist/index.d.ts +4 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +27 -8
  41. package/dist/index.js.map +1 -1
  42. package/dist/interaction/adapter.d.ts +1 -0
  43. package/dist/interaction/adapter.d.ts.map +1 -1
  44. package/dist/interaction/adapter.js +5 -1
  45. package/dist/interaction/adapter.js.map +1 -1
  46. package/dist/quota/color.d.ts +4 -4
  47. package/dist/quota/color.d.ts.map +1 -1
  48. package/dist/quota/color.js +7 -5
  49. package/dist/quota/color.js.map +1 -1
  50. package/dist/quota/combined.d.ts +1 -1
  51. package/dist/quota/combined.js +4 -4
  52. package/dist/quota/combined.js.map +1 -1
  53. package/dist/quota/format.d.ts +1 -1
  54. package/dist/quota/opencode-go/format.d.ts.map +1 -1
  55. package/dist/quota/opencode-go/format.js +5 -1
  56. package/dist/quota/opencode-go/format.js.map +1 -1
  57. package/dist/quota/opencode-go/index.d.ts +1 -1
  58. package/dist/quota/opencode-go/index.js +1 -1
  59. package/dist/quota/opencode-go/types.d.ts +1 -1
  60. package/dist/quota/opencode-go/types.js +1 -1
  61. package/dist/quota/rounding.d.ts +8 -0
  62. package/dist/quota/rounding.d.ts.map +1 -0
  63. package/dist/quota/rounding.js +10 -0
  64. package/dist/quota/rounding.js.map +1 -0
  65. package/dist/remote/config.d.ts +1 -1
  66. package/dist/remote/config.d.ts.map +1 -1
  67. package/dist/remote/config.js +1 -1
  68. package/dist/remote/config.js.map +1 -1
  69. package/dist/remote/endpoint.d.ts +1 -1
  70. package/dist/remote/endpoint.js +1 -1
  71. package/dist/remote/hub-server.d.ts +1 -1
  72. package/dist/remote/hub-server.js +1 -1
  73. package/dist/repl/App.d.ts +108 -0
  74. package/dist/repl/App.d.ts.map +1 -0
  75. package/dist/repl/App.js +706 -0
  76. package/dist/repl/App.js.map +1 -0
  77. package/dist/repl/history.d.ts +25 -0
  78. package/dist/repl/history.d.ts.map +1 -0
  79. package/dist/repl/history.js +73 -0
  80. package/dist/repl/history.js.map +1 -0
  81. package/dist/repl/input-buffer.d.ts +77 -0
  82. package/dist/repl/input-buffer.d.ts.map +1 -0
  83. package/dist/repl/input-buffer.js +174 -0
  84. package/dist/repl/input-buffer.js.map +1 -0
  85. package/dist/repl/model.d.ts +275 -0
  86. package/dist/repl/model.d.ts.map +1 -0
  87. package/dist/repl/model.js +596 -0
  88. package/dist/repl/model.js.map +1 -0
  89. package/dist/repl/mouse.d.ts +49 -0
  90. package/dist/repl/mouse.d.ts.map +1 -0
  91. package/dist/repl/mouse.js +165 -0
  92. package/dist/repl/mouse.js.map +1 -0
  93. package/dist/repl/run.d.ts +12 -0
  94. package/dist/repl/run.d.ts.map +1 -0
  95. package/dist/repl/run.js +902 -0
  96. package/dist/repl/run.js.map +1 -0
  97. package/dist/server.d.ts +18 -0
  98. package/dist/server.d.ts.map +1 -1
  99. package/dist/server.js +31 -3
  100. package/dist/server.js.map +1 -1
  101. package/dist/translators/event-translator.d.ts +2 -0
  102. package/dist/translators/event-translator.d.ts.map +1 -1
  103. package/dist/translators/event-translator.js +47 -38
  104. package/dist/translators/event-translator.js.map +1 -1
  105. package/dist/translators/tool-helpers.d.ts.map +1 -1
  106. package/dist/translators/tool-helpers.js +11 -0
  107. package/dist/translators/tool-helpers.js.map +1 -1
  108. package/docs/ARCHITECTURE.md +13 -2
  109. package/docs/BACKLOG.md +40 -21
  110. package/docs/REMOTE-CLIENTS.md +2 -2
  111. package/docs/TROUBLESHOOTING.md +1 -1
  112. package/docs/adr/0007-unified-cli-entry-and-bin-pruning.md +40 -0
  113. package/package.json +9 -4
package/docs/BACKLOG.md CHANGED
@@ -3,9 +3,15 @@
3
3
  Backend RPC methods and event types exposed by the ZCode CLI (`zcode app-server`)
4
4
  that are **not yet wired into the bridge**, tracked for potential future support.
5
5
 
6
- Last audited against **app-server 0.16.3** (bundled in ZCode desktop 3.8.1,
7
- 2026-08-09). Method names were extracted from the bundled `zcode.cjs` dispatch
8
- switch and verified with live RPC calls.
6
+ Last audited against **app-server 0.16.5** (bundled in ZCode desktop 3.9.2,
7
+ 2026-08-27; the previous audit ran against desktop 3.9.1 / same app-server
8
+ 0.16.5, so this refresh is a re-verification rather than a version bump).
9
+ Method names were extracted from the bundled `zcode.cjs` dispatch switch and
10
+ verified with live RPC calls. Live checks after the 3.9.2 update: `session/
11
+ list`, `session/create`, `session/steer` (still `-32601`), and a full REPL
12
+ smoke (`session/new` + `/sessions`) all behave unchanged. New in the
13
+ enumeration: the reference-catalog family below (either shipped quietly in
14
+ 0.16.x or added by 3.9.2 — the previous audit never listed them).
9
15
 
10
16
  ## Removed upstream in 0.16 (verified live: `-32601`)
11
17
 
@@ -25,15 +31,23 @@ elsewhere.
25
31
  Available in the backend but with no ACP-side counterpart yet. Pick them up
26
32
  when a concrete ACP/editor need appears.
27
33
 
28
- | Method | Purpose | Current bridge behavior |
29
- | ------------------------------------------------------------------------------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
30
- | `session/subagents` | Query the list of sub-agents for a session | Sub-agent info is parsed from the `Agent` tool result (`_meta.subagent`); sufficient for now |
31
- | `session/events` | Pull-mode event history (complement to `session/subscribe`) | Not used; could support event replay/gap-fill |
32
- | `session/usage` | Per-session token usage | Context bar uses `session.updated` usage payload instead |
33
- | `workspace/hooks/trustGrant` | Server→client request: approve hook trust | Auto-errored by the unknown-request fallback (`server-requests.ts` `handleOne`) during turns; `session/send` carries a 15s timeout so nothing hangs. If hook trust ever needs real UX, map it onto ACP `session/request_permission` |
34
- | `interaction/browserList` / `interaction/browserExecute` | Server→client requests: browser automation via the client | Auto-errored by the fallback above; only meaningful once an ACP client has a browser surface |
35
- | `interaction/requestProviderRuntimeHeaders` | Server→client request: provider runtime headers | Auto-errored by the fallback above |
36
- | `workspace/updateInteractionPreferences` / `workspace/updateModelIoPreferences` | Client preference updates | Not used |
34
+ | Method | Purpose | Current bridge behavior |
35
+ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
36
+ | `session/subagents` | Query the list of sub-agents for a session | Sub-agent info is parsed from the `Agent` tool result (`_meta.subagent`); sufficient for now |
37
+ | `session/events` | Pull-mode event history (complement to `session/subscribe`) | Not used; could support event replay/gap-fill |
38
+ | `session/usage` | Per-session token usage | Context bar uses `session.updated` usage payload instead |
39
+ | `workspace/hooks/trustGrant` | Server→client request: approve hook trust | Auto-errored by the unknown-request fallback (`server-requests.ts` `handleOne`) during turns; `session/send` carries a 15s timeout so nothing hangs. If hook trust ever needs real UX, map it onto ACP `session/request_permission` |
40
+ | `interaction/browserList` / `interaction/browserExecute` | Server→client requests: browser automation via the client | Auto-errored by the fallback above; only meaningful once an ACP client has a browser surface |
41
+ | `interaction/requestProviderRuntimeHeaders` | Server→client request: provider runtime headers | Auto-errored by the fallback above |
42
+ | `interaction/requestOfficialMcpAuthHeaders` (0.16.5) | Server→client request: official MCP auth headers | Auto-errored by the fallback above |
43
+ | `session/requestRuntimePreferences` (0.16.5) | Runtime preference negotiation | Auto-errored by the fallback above (same class as trustGrant) |
44
+ | `session/close` (0.16.5) | Actually close a backend session/runtime | Not used — remote close intentionally retires discovery only (ADR-0006, self-healing); backend runtimes idle-evict anyway |
45
+ | `workspace/generateText` / `workspace/cancelGenerateText` (0.16.5) | Workspace-scoped one-shot text generation | Not used; no ACP counterpart |
46
+ | `workspace/readState` (0.16.5) | Read workspace state | Not used |
47
+ | `workspace/setDefaultMode` / `setDefaultModel` / `setDefaultThoughtLevel` (0.16.5) | Workspace-level defaults (bridge uses per-session setters) | Not used |
48
+ | `workspace/upsertModelProvider` / `removeModelProvider` (0.16.5) | Provider registry management | Not used; bridge forwards the client's registry via `updateProviderRegistry` |
49
+ | `workspace/updateInteractionPreferences` / `workspace/updateModelIoPreferences` | Client preference updates | Not used |
50
+ | `skills/referenceCatalog`, `plugins/referenceCatalog`, `plugins/resolveSuggestedReference` (verified live 2026-08-27, params need `workspace.workspaceKey`) | Skill/plugin reference catalog lookup + suggested-reference resolution | Not used — the bridge reads skills and plugin commands from disk (`config/skill-discovery.ts`, `config/plugin-commands.ts`); revisit only if a client needs the backend's catalog view |
37
51
 
38
52
  ### New `session/send` params (0.16+)
39
53
 
@@ -52,15 +66,20 @@ forwarded:
52
66
 
53
67
  ### New event types (undocumented in PROTOCOL.md)
54
68
 
55
- | Event | Notes |
56
- | ---------------------------------------- | -------------------------------------------------------------------------- |
57
- | `checkpoint.created` | Checkpoint lifecycle; pairs with `rewind.triggered` |
58
- | `rewind.triggered` | A rewind happened (e.g. initiated elsewhere) |
59
- | `streamRecovery.updated` | Stream recovery progress potentially useful for the replay/gap-fill path |
60
- | `turn.attachments.resolved` | Attachment resolution telemetry |
61
- | `usage.delta` | Streaming usage updates |
62
- | `turn.steerQueued` / `turn.steerDrained` | Steer lifecycle (queue/drain of steered inputs) |
63
- | `turn.terminal` | Terminal turn lifecycle; bridge relies on `turn.completed`/`turn.failed` |
69
+ | Event | Notes |
70
+ | ---------------------------------------------------------------- | -------------------------------------------------------------------------- |
71
+ | `checkpoint.created` | Checkpoint lifecycle; pairs with `rewind.triggered` |
72
+ | `rewind.triggered` | A rewind happened (e.g. initiated elsewhere) |
73
+ | `rewind.started` / `rewind.failed` / `rewind.completed` (0.16.5) | Full rewind lifecycle; richer than the bare `triggered` |
74
+ | `streamRecovery.updated` | Stream recovery progress — potentially useful for the replay/gap-fill path |
75
+ | `turn.attachments.resolved` | Attachment resolution telemetry |
76
+ | `usage.delta` | Streaming usage updates |
77
+ | `turn.steerQueued` / `turn.steerDrained` | Steer lifecycle (queue/drain of steered inputs) |
78
+ | `turn.terminal` | Terminal turn lifecycle; bridge relies on `turn.completed`/`turn.failed` |
79
+
80
+ Unknown event types fall through the translator's else-chain untranslated and
81
+ silently — new backend events never produce noise or errors, so additions
82
+ here are informational, not blocking.
64
83
 
65
84
  ## v4 protocol family (strategic)
66
85
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  How to attach any out-of-editor client — browser SPA, mobile app, CLI, desktop
4
4
  tool — to bridge sessions over the network. This document IS the contract:
5
- everything here is implemented by `zcode-acp-hub` and the bridge's remote
5
+ everything here is implemented by the hub daemon (`zcode-acp hub`) and the bridge's remote
6
6
  endpoint; anything not written here is not part of the contract.
7
7
 
8
8
  ACP method semantics are defined by the [ACP spec](https://agentclientprotocol.com);
@@ -182,7 +182,7 @@ pull-only request — callable any time after `initialize`, no session required.
182
182
  Fetch once after attach and on demand; quota changes are slow, there is no
183
183
  push.
184
184
 
185
- Both channels return the same payload, mirroring the `zcode-quota` CLI card's
185
+ Both channels return the same payload, mirroring the `zcode-acp quota` CLI card's
186
186
  data model — one GLM section plus one Opencode Go section — so clients can
187
187
  reproduce the CLI layout exactly:
188
188
 
@@ -341,7 +341,7 @@ http://127.0.0.1:<hub-port>/api/health` fails, or `/api/*` returns 401.
341
341
  1. 401 means a token mismatch — `ZCODE_ACP_REMOTE_TOKEN` must be identical in
342
342
  the bridge env, the hub env (if run manually), and the client request.
343
343
  2. A dead hub self-heals: the next bridge heartbeat (≤10s; worst ~1min under
344
- the spawn throttle) re-spawns `zcode-acp-hub`. Retry with backoff rather
344
+ the spawn throttle) re-spawns the hub daemon. Retry with backoff rather
345
345
  than restarting anything by hand.
346
346
  3. Confirm the ports match: the client must reach `ZCODE_ACP_HUB_PORT`
347
347
  (default 8377) through the tunnel, and the tunnel maps exactly that one
@@ -0,0 +1,40 @@
1
+ # Unified CLI entry and bin pruning
2
+
3
+ The package grew three separate bins (`zcode-acp-server`, `zcode-acp-hub`,
4
+ `zcode-quota`) plus a planned terminal chat surface. Installing four sibling
5
+ commands for one tool is noisy, and each new surface would add another. We
6
+ decided to ship one human-facing entry point — the Unified CLI, `zcode-acp` —
7
+ with every surface as a subcommand: `quota`, `hub`, and `server`. Bare
8
+ `zcode-acp` opens the interactive REPL: an Ink-rendered chat UI (the renderer
9
+ Claude Code and Gemini CLI use) speaking ACP to a spawned bridge over stdio,
10
+ with the update pump, permission picker, and turn state machine owned by this
11
+ package. The REPL is written in-house rather than borrowed — no embeddable
12
+ interactive ACP client library exists (acpx is headless-only; the interactive
13
+ clients Toad/Hydra/Nori are external tools or heavyweight daemons), and we
14
+ control both protocol ends already.
15
+
16
+ Bin declarations are pruned to `zcode-acp` and `zcode-acp-server`. The server
17
+ bin stays because it is the command name hardcoded in existing editor configs
18
+ (Zed, JetBrains) across ~2.5k monthly downloads — removing it would break every
19
+ current user at once; it is an editor contract, not a human alias. The
20
+ `zcode-acp-hub` and `zcode-quota` bins are removed in 0.12.0 with a README
21
+ migration note (`zcode-acp hub` / `zcode-acp quota`); the hub's own binary file
22
+ stays in `dist/bin/hub.js` because bridges spawn it by absolute path, not by
23
+ command name, so the remote feature is unaffected.
24
+
25
+ Bin-name detection is `basename(argv[1])`, which works through Unix symlinks
26
+ but not through Windows `.cmd` shims (they spawn `node ...\dist\cli.js`, so
27
+ the bin name never reaches argv). Bare invocation without a TTY therefore
28
+ falls back to the stdio server — the only sensible reading of a piped, no-TTY
29
+ launch, and exactly what a Windows editor spawn needs. The explicit
30
+ `zcode-acp repl` subcommand keeps a hard TTY check and errors instead.
31
+
32
+ We rejected keeping all old bins as silent aliases (five installed commands;
33
+ the redundancy was the original complaint), removing every old bin including
34
+ `zcode-acp-server` (breaks all existing editor configs at once; revisit at
35
+ 1.0), and bundling [acpx](https://github.com/openclaw/acpx) as a `chat`
36
+ passthrough subcommand (evaluated first: its engine is headless-only, so it
37
+ cannot host the interactive REPL that is the actual requirement, and keeping
38
+ it beside the in-house REPL would mean two terminal surfaces, a pre-1.0
39
+ dependency, and an extra Node engine bump for no remaining use — dropped
40
+ before release).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcode-acp-server",
3
- "version": "0.11.9",
3
+ "version": "0.14.2",
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",
@@ -23,9 +23,8 @@
23
23
  "zcode"
24
24
  ],
25
25
  "bin": {
26
- "zcode-acp-server": "dist/index.js",
27
- "zcode-acp-hub": "dist/bin/hub.js",
28
- "zcode-quota": "dist/bin/quota.js"
26
+ "zcode-acp": "dist/cli.js",
27
+ "zcode-acp-server": "dist/cli.js"
29
28
  },
30
29
  "main": "dist/index.js",
31
30
  "types": "dist/index.d.ts",
@@ -37,6 +36,11 @@
37
36
  ],
38
37
  "dependencies": {
39
38
  "@agentclientprotocol/sdk": "^1.3.0",
39
+ "chalk": "^6.0.0",
40
+ "ink": "^7.1.1",
41
+ "ink-spinner": "^5.0.0",
42
+ "react": "^19.2.8",
43
+ "string-width": "^8.2.2",
40
44
  "ws": "^8.21.3"
41
45
  },
42
46
  "peerDependencies": {
@@ -45,6 +49,7 @@
45
49
  "devDependencies": {
46
50
  "@eslint/js": "^9.0.0",
47
51
  "@types/node": "^22.0.0",
52
+ "@types/react": "^19.2.18",
48
53
  "@types/ws": "^8.18.1",
49
54
  "@typescript-eslint/eslint-plugin": "^8.0.0",
50
55
  "@typescript-eslint/parser": "^8.0.0",