zcode-acp-server 0.87.0 → 0.88.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.
@@ -0,0 +1,112 @@
1
+ # Config Options & Provider Metadata (ACP client guide)
2
+
3
+ How an ACP client renders the bridge's session options and builds a
4
+ provider/model picker **without duplicating bridge internals**. Covers the
5
+ `configOptions` array (`session/new`, `session/load`, `session/resume`,
6
+ `config_option_update`), the model-value encoding, and the `_meta.zcode`
7
+ provider metadata (issue #400).
8
+
9
+ ## The three options
10
+
11
+ | id | category | type | addresses (set_config_option) |
12
+ | --------- | --------------- | -------- | --------------------------------------------------- |
13
+ | `model` | `model` | `select` | provider+model pair |
14
+ | `mode` | `mode` | `select` | ZCode mode (`plan`/`build`/`edit`/`guarded`/`yolo`) |
15
+ | `thought` | `thought_level` | `select` | reasoning effort of the current model |
16
+
17
+ All three are optional per ACP — the `model` option is omitted when the
18
+ session has no resolvable provider identity.
19
+
20
+ ## Model option values
21
+
22
+ **Canonical form (emitted): `providerId\modelId`** — always provider-qualified,
23
+ builtins included. The `\` separator is unambiguous: provider ids (`builtin:`
24
+ slugs, custom UUIDs) and model ids (`/`-separated) never contain it. When two
25
+ providers ship the same model id, labels qualify as `Provider › model`.
26
+
27
+ Two provider-id dialects appear in **values**:
28
+
29
+ - **config dialect** — `builtin:bigmodel-coding-plan`, custom UUIDs. Used by
30
+ the pre-materialization (`session/new`) menu.
31
+ - **registry dialect** — `account:bigmodel-individual-coding-plan`. Used by a
32
+ materialized session's snapshot, because same-named models of colliding
33
+ legacy plans only stay distinct in that spelling. Values keep the dialect
34
+ they were built from; both dialects are accepted inbound.
35
+
36
+ **Accepted inbound spellings** (`session/set_config_option` on `model`):
37
+
38
+ | spelling | meaning |
39
+ | ------------------------------------------ | --------------------------------------------------------------------- |
40
+ | `providerId\modelId` | canonical (recommended for round-tripping) |
41
+ | `modelId` (no `\`) | legacy bare id — resolved to the first enabled builtin provider |
42
+ | `custom:<urlencoded-providerId>:<modelId>` | the 3.12+ agent-definition spelling (provider colons percent-encoded) |
43
+
44
+ The backslash form stays canonical for compatibility — every deployed client
45
+ round-trips it, and switching now would break them. Encode/decode it as an
46
+ opaque string; do not split on `\` in config languages where it is an escape
47
+ character (use the `custom:` form when constructing values yourself).
48
+
49
+ ## Provider metadata: `_meta.zcode`
50
+
51
+ Two surfaces carry the same payload (issue #400):
52
+
53
+ 1. **`session/new` response `_meta.zcode`** — the boot snapshot.
54
+ 2. **The `model` configOption's `_meta.zcode`** — the refresh vehicle. It is
55
+ re-attached on **every** `config_option_update` (model/mode/thought
56
+ switches, credential-change rebuilds), so the provider list stays live for
57
+ the session's whole lifetime. Clients that want updates should read it from
58
+ the option, not cache the boot snapshot.
59
+
60
+ ```json
61
+ {
62
+ "providers": [
63
+ {
64
+ "id": "builtin:bigmodel-coding-plan",
65
+ "name": "BigModel",
66
+ "selectable": true,
67
+ "defaultModel": "GLM-5.3"
68
+ },
69
+ {
70
+ "id": "builtin:bigmodel-start-plan",
71
+ "name": "BigModel Start Plan",
72
+ "selectable": false,
73
+ "unselectableReason": "keyless-builtin"
74
+ }
75
+ ],
76
+ "currentProviderId": "builtin:bigmodel-coding-plan"
77
+ }
78
+ ```
79
+
80
+ - `id` is always the **config dialect** (`builtin:…` / custom UUID), matching
81
+ the other config-sourced fields. `currentProviderId` folds registry
82
+ `account:` refs onto it, so it always matches an entry in `providers`.
83
+ - `selectable` mirrors what the model dropdown offers — derived from the same
84
+ model list the bridge itself advertises, so the two can never disagree.
85
+ `defaultModel` is the model a session started on that provider runs (the
86
+ first entry of its dropdown group).
87
+ - `unselectableReason` (only when `selectable` is false) lets a client render
88
+ an actionable row instead of a silent gap:
89
+
90
+ | reason | meaning | client hint |
91
+ | ------------------- | -------------------------------------------------------- | ------------------------------------------------- |
92
+ | `keyless-builtin` | builtin provider enabled but no credential stored | "link account / enter API key in the desktop app" |
93
+ | `disabled` | provider explicitly disabled (or no entry) | — |
94
+ | `non-local-keyless` | custom remote endpoint with no API key and keys required | "add an API key or use a localhost endpoint" |
95
+
96
+ Providers entitled only through the account ladder (OAuth sign-in, manual
97
+ coding-plan keys) appear as `selectable: true` entries with the models that
98
+ entitlement grants.
99
+
100
+ ## Provider switching and pinning
101
+
102
+ Switching provider within a session is a **model switch**: send
103
+ `session/set_config_option` with a `providerId\modelId` value from any
104
+ selectable provider — no separate provider control exists on the wire.
105
+
106
+ Pinning the credential provider is **process-level** (`ZCODE_PROVIDER` env at
107
+ bridge start): the backend subprocess is spawned once per bridge process with
108
+ the resolved provider's credentials injected, so a session-scoped pin would
109
+ imply a keyed child-process pool that does not exist today. When `ZCODE_PROVIDER`
110
+ is set, both the model dropdown and `_meta.zcode.providers` filter to that
111
+ provider. Clients should treat provider selection as "pick a model" unless
112
+ they also control the bridge's environment.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcode-acp-server",
3
- "version": "0.87.0",
3
+ "version": "0.88.0",
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",