pi-muse-tether 0.2.0 → 0.2.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.1
4
+
5
+ - Follow the official auto-updating Muse client; unknown builds run sequential Pi tools instead of refusing all turns. Parallel tools use qualification records, negotiated rawLog and runtime schema checks.
6
+ - Add per-feature typed degradation/refusal, private-prompt append fallback and actionable catalogue-disabled diagnostics.
7
+ - Add `/muse-doctor qualify [build] [--live]`, isolated conformance/explicit live suites and hash-bound qualification records.
8
+ - Isolate Vitest, node:test and native proofs from production client/state/ledger; stamp ledger origin and package version; guard full test/proof runs with before/after hashes, including qualification records.
9
+ - Wait for session-MCP readiness in official echo conformance before asserting request configuration. Run both test phases even if one fails, retaining per-test output; version-only diagnostic probes use temporary HOME/XDG roots.
10
+ - Ledger origin/version stamps distinguish isolated tests from production observations; historical fixture counts are not evidence of production failures.
11
+
3
12
  ## 0.2.0
4
13
 
5
14
  - Long or redacted tool results no longer kill the turn: complete `[REDACTED]` lines and Muse's 64 KiB view truncation (including one-line results) are reconciled against Pi's original result. Unsupported vendor transformations still stop safely.
package/README.md CHANGED
@@ -23,13 +23,13 @@ pi install npm:pi-muse-tether
23
23
  PI_MUSE_TETHER_LIVE=1 pi --provider pi-muse-tether --model muse-spark-1.3
24
24
  ```
25
25
 
26
- Keep `PI_MUSE_TETHER_LIVE=1` set whenever you want to use Muse. Without it you only get an offline test model. If it worked, the Muse models your account can use appear under `pi-muse-tether` in `/model`, and `/muse-doctor` shows the local versions it found.
26
+ Keep `PI_MUSE_TETHER_LIVE=1` set whenever you want to use Muse. Without it you only get an offline test model and a typed catalogue-disabled notice. If it worked, the Muse models your account can use appear under `pi-muse-tether` in `/model`, and `/muse-doctor` shows the local versions it found.
27
27
 
28
28
  ## Muse Code version policy
29
29
 
30
- The minimum client is **1.4.14**, the oldest version qualified for the tether’s private-XDG prompt/isolation recipe. The tested ceiling is **1.4.15**. Older or unparseable clients are refused. Newer clients warn once per version per Pi process and continue, **not yet qualified**, including private-settings prompt delivery. Set `PI_MUSE_TETHER_STRICT_VERSION=1` to refuse clients above the tested ceiling instead. `/muse-doctor` reports the range and whether the installed client exceeds it. This policy never updates your client.
30
+ The minimum client is **1.4.14**, the oldest version qualified for the tether’s private-XDG prompt/isolation recipe. The tested ceiling is **1.4.15**. Older or unparseable clients are refused. Newer clients warn once per version per Pi process and continue, **not yet qualified**, including private-settings prompt delivery. Set `PI_MUSE_TETHER_STRICT_VERSION=1` to refuse clients above the tested ceiling instead. `/muse-doctor` reports the range and whether the installed client exceeds it. Meta’s official launcher owns updates; production leaves its default update behaviour enabled. Tests, proofs and qualification disable updates in isolated homes.
31
31
 
32
- The SDK remains independently pinned to **`@muse-code/sdk` 1.4.14**; it need not equal the client version. This permits forward client use, not a claim of SDK/client compatibility qualification. The experimental `rawLog`/committed-tool-batch protocol is different: its payload is qualified per exact build, currently **1.4.14-R7309.1** and **1.4.15-R8339.1**, so it refuses every other build even when catalogue discovery and non-batch sessions are allowed with a warning. **Shipped live coding sessions use this batch protocol by default**, so on an unqualified newer build the picker can populate but live coding still refuses before submission. There is no silent single-tool fallback.
32
+ The SDK remains independently pinned to **`@muse-code/sdk` 1.4.14**; it need not equal the client version. Unknown builds run **sequential Pi tools**, with one typed notice, rather than refusing a turn. Parallel tools require qualification evidence matching the executable and schema, a granted `rawLog` capability, and runtime validation of each committed batch. Historical 1.4.14/1.4.15 evidence is retained as data. `/muse-doctor qualify [build]` writes offline results; explicit `--live` plus confirmation runs the live suite. Only complete qualification enables parallel tools. No code change or client store is needed. Missing private replacement degrades to appended developer instructions with a notice; missing session MCP refuses with the build and cause because Pi must own tools. See [client lifecycle](docs/CLIENT-LIFECYCLE.md) and [qualification](docs/CLIENT-QUALIFICATION.md).
33
33
 
34
34
  Muse 1.4.15 changed two things the tether now handles. It starts session tool servers after `session/start` returns, so the tether waits (via `mcpServer/readInventory`) until its tool server is connected with every Pi tool before the first turn; a withheld or failed server stops before any model request. It also starts session tool servers only in a trusted workspace. The tether names an empty, private, tether-owned workspace and trusts only that one; it never trusts your project, because a trusted project also loads its rules files (for example `AGENTS.md`) into the model. Pi still owns the working directory and every tool path.
35
35
 
@@ -0,0 +1,202 @@
1
+ {
2
+ "sources": [
3
+ {
4
+ "build": "v1414",
5
+ "sha256": "a9368639efe1dbd3a52d1816b99a36b7fd151088cdfbb2b5f0c4e2a3e7e9c50d"
6
+ },
7
+ {
8
+ "build": "v1415",
9
+ "sha256": "087aa69cf3f8b709ee97ba19f8583532400cbfe9013128a2da8d209359442172"
10
+ }
11
+ ],
12
+ "schemas": [
13
+ {
14
+ "$defs": {
15
+ "LogRecordParams": {
16
+ "properties": {
17
+ "record": {
18
+ "properties": {},
19
+ "type": "object"
20
+ },
21
+ "subscriptionId": {
22
+ "type": "integer"
23
+ }
24
+ },
25
+ "required": [
26
+ "record",
27
+ "subscriptionId"
28
+ ],
29
+ "type": "object",
30
+ "x-msp-descriptor": "log/record",
31
+ "x-msp-stability": "experimental"
32
+ },
33
+ "RawLogRecordEnvelope": {
34
+ "properties": {
35
+ "causation_id": {
36
+ "type": [
37
+ "string",
38
+ "null"
39
+ ]
40
+ },
41
+ "durability": {
42
+ "type": "string"
43
+ },
44
+ "id": {
45
+ "type": "string"
46
+ },
47
+ "payload": {
48
+ "properties": {},
49
+ "type": "object"
50
+ },
51
+ "payload_schema_version": {
52
+ "type": "integer"
53
+ },
54
+ "payload_type": {
55
+ "type": "string"
56
+ },
57
+ "record_type": {
58
+ "type": "string"
59
+ },
60
+ "recorded_at": {
61
+ "type": "integer"
62
+ },
63
+ "schema_version": {
64
+ "type": "integer"
65
+ },
66
+ "sequence": {
67
+ "type": "integer"
68
+ },
69
+ "stream": {
70
+ "$ref": "#/$defs/StreamRef"
71
+ }
72
+ },
73
+ "required": [
74
+ "causation_id",
75
+ "durability",
76
+ "id",
77
+ "payload",
78
+ "payload_schema_version",
79
+ "payload_type",
80
+ "record_type",
81
+ "recorded_at",
82
+ "schema_version",
83
+ "sequence",
84
+ "stream"
85
+ ],
86
+ "type": "object",
87
+ "x-msp-descriptor": "log/page",
88
+ "x-msp-stability": "experimental"
89
+ },
90
+ "StreamRef": {
91
+ "properties": {
92
+ "id": {
93
+ "type": "string"
94
+ },
95
+ "kind": {
96
+ "type": "string"
97
+ }
98
+ },
99
+ "required": [
100
+ "id",
101
+ "kind"
102
+ ],
103
+ "type": "object"
104
+ }
105
+ }
106
+ },
107
+ {
108
+ "$defs": {
109
+ "LogRecordParams": {
110
+ "properties": {
111
+ "record": {
112
+ "properties": {},
113
+ "type": "object"
114
+ },
115
+ "subscriptionId": {
116
+ "type": "integer"
117
+ }
118
+ },
119
+ "required": [
120
+ "record",
121
+ "subscriptionId"
122
+ ],
123
+ "type": "object",
124
+ "x-msp-descriptor": "log/record",
125
+ "x-msp-stability": "experimental"
126
+ },
127
+ "RawLogRecordEnvelope": {
128
+ "properties": {
129
+ "causation_id": {
130
+ "type": [
131
+ "string",
132
+ "null"
133
+ ]
134
+ },
135
+ "durability": {
136
+ "type": "string"
137
+ },
138
+ "id": {
139
+ "type": "string"
140
+ },
141
+ "payload": {
142
+ "properties": {},
143
+ "type": "object"
144
+ },
145
+ "payload_schema_version": {
146
+ "type": "integer"
147
+ },
148
+ "payload_type": {
149
+ "type": "string"
150
+ },
151
+ "record_type": {
152
+ "type": "string"
153
+ },
154
+ "recorded_at": {
155
+ "type": "integer"
156
+ },
157
+ "schema_version": {
158
+ "type": "integer"
159
+ },
160
+ "sequence": {
161
+ "type": "integer"
162
+ },
163
+ "stream": {
164
+ "$ref": "#/$defs/StreamRef"
165
+ }
166
+ },
167
+ "required": [
168
+ "causation_id",
169
+ "durability",
170
+ "id",
171
+ "payload",
172
+ "payload_schema_version",
173
+ "payload_type",
174
+ "record_type",
175
+ "recorded_at",
176
+ "schema_version",
177
+ "sequence",
178
+ "stream"
179
+ ],
180
+ "type": "object",
181
+ "x-msp-descriptor": "log/page",
182
+ "x-msp-stability": "experimental"
183
+ },
184
+ "StreamRef": {
185
+ "properties": {
186
+ "id": {
187
+ "type": "string"
188
+ },
189
+ "kind": {
190
+ "type": "string"
191
+ }
192
+ },
193
+ "required": [
194
+ "id",
195
+ "kind"
196
+ ],
197
+ "type": "object"
198
+ }
199
+ }
200
+ }
201
+ ]
202
+ }
@@ -0,0 +1,24 @@
1
+ [
2
+ {
3
+ "build": "1.4.14-R7309.1",
4
+ "sha256": "0809aac7cb58d18f5022b6d05e02aa1974683c0ec430e5f04d25b60ed17de2da",
5
+ "schemaHash": "a9368639efe1dbd3a52d1816b99a36b7fd151088cdfbb2b5f0c4e2a3e7e9c50d",
6
+ "qualified": true,
7
+ "results": {
8
+ "legacy": true,
9
+ "source": "pre-existing live qualification, 2026-11-10 and original 1.4.14",
10
+ "sha256Coverage": "retained official bytes; matches retained offline-client manifest"
11
+ }
12
+ },
13
+ {
14
+ "build": "1.4.15-R8339.1",
15
+ "sha256": "abe0a72878c62b570c6eed6c17c5fc3c520a990ecf040511741c00092312a3d5",
16
+ "schemaHash": "087aa69cf3f8b709ee97ba19f8583532400cbfe9013128a2da8d209359442172",
17
+ "qualified": true,
18
+ "results": {
19
+ "legacy": true,
20
+ "source": "pre-existing live qualification, 2026-11-10 and original 1.4.14",
21
+ "sha256Coverage": "retained official bytes"
22
+ }
23
+ }
24
+ ]
@@ -0,0 +1,107 @@
1
+ # Official client lifecycle and qualification
2
+
3
+ ## Decision implemented
4
+
5
+ The revised delivery follows the user's official Muse launcher, like the Claude
6
+ Code tether. Meta owns updates; the tether owns capability negotiation and
7
+ runtime validation. `PI_MUSE_TETHER_BINARY` remains an explicit absolute-path
8
+ override. Production does not force `MUSE_NO_AUTO_UPDATE`; development, tests,
9
+ qualification and proofs set it to `1`. `PI_MUSE_TETHER_STRICT_VERSION=1` remains
10
+ an explicit refusal above the tested range. Otherwise newer builds warn and run.
11
+
12
+ The originally proposed pinned-client store was rejected and is not shipped.
13
+ The emergency binary override is not an alternate automatic installation route.
14
+
15
+ ## What the launcher actually does
16
+
17
+ Read on 2026-11-16: launcher version 3 from the existing installation. It resolves
18
+ its own directory, supports `muse-stable`/`muse-canary` channel heads only, and
19
+ has **no historical-build selector**. `MUSE_LAUNCHER_INSTALL=1` installs beside
20
+ the copied launcher, checking the channel manifest, release version, artifact
21
+ size and SHA-256. After a successful installation it deletes **all sibling
22
+ `muse-bin-*` builds except the selected one**. A pinned store therefore
23
+ would have needed separate staging to avoid pruning retained builds. No such
24
+ store or installer is managed by the tether.
25
+
26
+ A plain launcher invocation may update even for `--version`. Tests and proofs
27
+ must therefore never invoke it without `MUSE_NO_AUTO_UPDATE=1`. Version cache
28
+ entries bind launcher/selector/executable metadata and are invalidated by any
29
+ observed identity change; unknown override launchers are probed each time.
30
+
31
+ ## Identity and login (unchanged)
32
+
33
+ The existing official launcher resolves login to `MUSE_AUTH_PATH`, else
34
+ `$XDG_CONFIG_HOME/muse/auth.json`, else `$HOME/.config/muse/auth.json`.
35
+ On this node, metadata-only inspection found the existing login at
36
+ `~/.config/muse/auth.json` (regular file, mode 0600); no token contents were
37
+ read, copied or printed. The official binary installed by the copied launcher
38
+ has SHA-256 `3685b023d45a1a07c8c559da00088bdf59564920b13a85adad11e13ad6f4d181`
39
+ for build `1.4.20-R8619.1`. Installation did not sign in again.
40
+
41
+ `settings.ts:linkHostLogin` is unchanged: each private-prompt host writes its
42
+ own isolated settings/trust files and symlinks only `config/muse/auth.json` to
43
+ the existing login. It stats the real file before/after, verifies that the
44
+ symlink still points to the same destination, and stops if the client replaces
45
+ that symlink. Legitimate rotation of the real destination is recorded as
46
+ metadata, not copied or repaired. Explicit `MUSE_AUTH_PATH` is inherited by the
47
+ official client. There is no impersonation, second credential store, or API-key
48
+ fallback; `META_API_KEY` is excluded from the model host environment.
49
+
50
+ ## Batching is a capability, not a build string
51
+
52
+ A new build is not denied for lacking qualification evidence: it runs sequential
53
+ tools. Batch eligibility comes from records matching executable/schema identity,
54
+ plus the two historical seed records, rather than a hand-edited admission
55
+ constant. Explicit live qualification can certify a new build without editing
56
+ code. The host additionally requests `rawLog`, requires the ordinary session-MCP
57
+ protocol, and validates
58
+ committed batch frames against retained v1.4.14/v1.4.15 envelope definitions in
59
+ `assets/batch-boundary-schemas.json`. Their original whole-schema SHA-256s are
60
+ retained in that file. **Those upstream schemas explicitly declare the payload
61
+ unstable and free-form**. The tether additionally checks every consumed event
62
+ and tool-call field; it does not claim the upstream envelope schema attests the
63
+ payload vocabulary.
64
+
65
+ Absent grant/stream/boundary, log gaps or a shape mismatch disable batching for
66
+ that host with one visible notice. Approved MCP calls are then surfaced and
67
+ verified one at a time; concurrent native calls queue rather than being rejected
68
+ or replayed. Foreign turn identities, conflicting duplicate calls, failed
69
+ authentication and incompatible base protocols still refuse. A server-required
70
+ upgrade is surfaced as `MUSE_UPGRADE_REQUIRED`, never silently retried on a
71
+ different client.
72
+
73
+ ## Offline conformance and isolation evidence
74
+
75
+ The official echo probe waits for `mcpServer/readInventory` to report its fixture
76
+ server connected with the exact supplied tools before starting the turn. On
77
+ current clients, starting a turn earlier can expose an empty toolset or fail
78
+ before a `model_request_configured` event exists. The test still requires that
79
+ real event, exact named tools, absence of false read-only policy, the negative
80
+ policy control, and rejection of a missing tool. It uses no version-specific
81
+ waiver and does not treat a missing event as success.
82
+
83
+ `npm test` runs both Vitest and node:test even when either phase fails; the
84
+ combined result fails if either does. Both phases print individual test names.
85
+ The guard snapshots the launcher, installed binaries, selector, qualification
86
+ homes and request ledger before and after, including newly added/removed files.
87
+ Version-only diagnostic probes also use fresh HOME/XDG roots, never the user's
88
+ ordinary configuration home. There is no client-store environment or pin state.
89
+
90
+ ## Shared tether-core contract (proposed for adoption)
91
+
92
+ A vendor tether must separate: (1) official executable identity/update ownership,
93
+ (2) protocol capability negotiation, (3) schema-checked optional accelerations,
94
+ and (4) qualification evidence. A version warning is not evidence that optional
95
+ capabilities work, and an unknown optional capability must not deny a basic turn.
96
+ No vendor tether may silently switch identities, create another login, replay an
97
+ unknown request, or write test/proof telemetry to the user's live ledger.
98
+ Qualification records bind exact executable SHA-256 and schema hash, with named
99
+ check results; they enable optional accelerations, not whole-turn admission.
100
+ The private replacement requires experimental negotiation; if withheld, the
101
+ isolated host is reopened before any model request with supported
102
+ `run.developer_prompt` instructions appended to Muse's own prompt. A typed
103
+ notice names that reduced guarantee. Missing session MCP refuses with build and
104
+ cause; there is no fallback to vendor-owned tools.
105
+
106
+ This document specifies the shared contract; it does not claim the separate
107
+ `pi-tether-core` or Claude/agy repositories were changed in this PR.
@@ -0,0 +1,97 @@
1
+ # Client qualification
2
+
3
+ The official Muse launcher owns updates. The tether does **not** install, pin,
4
+ retain or promote vendor clients. Qualification is evidence about particular
5
+ executable bytes, not a build-string permission to run ordinary turns.
6
+ `PI_MUSE_TETHER_BINARY` remains an emergency explicit official-binary override.
7
+
8
+ ## Command and integration
9
+
10
+ ```text
11
+ /muse-doctor qualify [build] # offline only; no model request
12
+ /muse-doctor qualify [build] --live # explicit gate AND interactive confirmation
13
+ ```
14
+
15
+ The doctor calls `await qualifyClient(build?, live = false)` from
16
+ `src/qualification.ts`. Before passing `true`, it must obtain UI confirmation.
17
+ The function additionally requires `PI_MUSE_TETHER_LIVE=1`; setting that variable
18
+ alone does not run the live suite. A requested build must equal the selected
19
+ client's reported build. The official launcher cannot install historical builds;
20
+ qualification never tries to do so.
21
+
22
+ Qualification uses the owning `src/qualification-records.ts` helpers, not a
23
+ client store. It writes `{build, sha256, schemaHash, results, qualified}` under
24
+ `qualificationHome()` (override: `PI_MUSE_TETHER_QUALIFICATION_HOME`).
25
+ `results.offline` is a boolean. `results.live` contains individual status/detail
26
+ objects for `batchBoundary`, `privatePrompt`, `sessionMcp`, `resume`, and `image`.
27
+ `qualified` is true **only when offline conformance and all five live checks
28
+ pass**. Offline success alone never enables full qualification. An offline recheck preserves existing live evidence only when both executable
29
+ SHA-256 and schema hash match exactly; it does not rerun or renew that live
30
+ proof. A changed identity gets fresh incomplete results. Successful/failed live
31
+ runs retain their isolated result location in `results.liveEvidence`. A complete
32
+ matching record enables optional batching on subsequent hosts, still subject to
33
+ negotiation and runtime validation. No installation or client update is implicit.
34
+
35
+ ## Offline conformance
36
+
37
+ 1. Resolve the selected official executable and hash its bytes, not the launcher.
38
+ 2. Inspect `schema --help` and `schema generate-json-schema --help`.
39
+ 3. Run the advertised `schema generate-json-schema --experimental --out <temp>`
40
+ and hash the actual `msp.schema.json` bytes.
41
+ 4. Compare the reachable `LogRecordParams` and `RawLogRecordEnvelope` contracts
42
+ against the retained v1414/v1415 schema fixtures in
43
+ `assets/batch-boundary-schemas.json`. Their original source hashes are retained
44
+ in that asset. Descriptions/titles/comments do not affect compatibility;
45
+ changed wire shapes or unresolved references fail conservatively for review.
46
+ 5. Recheck the executable hash before writing the record. An identity race refuses
47
+ the write rather than attaching evidence to different bytes.
48
+
49
+ Every qualification CLI invocation has `MUSE_NO_AUTO_UPDATE=1`. Schema operations
50
+ use a fresh HOME/XDG workspace and are cleaned up. No token is read or copied.
51
+ The free-form committed event payload is **not** proven by schema equality:
52
+ `committedCalls` runtime validation and an actual live batch event remain needed.
53
+ Offline checks do not certify exhaustive private-prompt isolation or session MCP.
54
+
55
+ ## Explicit live suite (never part of ordinary tests)
56
+
57
+ Select a Muse model in Pi, then authorize the doctor command above. Outside a
58
+ Muse picker context, set `PI_MUSE_TETHER_QUALIFICATION_MODEL` to an explicit
59
+ official `model/list` ID. The runner does not guess a model.
60
+ It verifies its catalogue limits and `none` effort before submitting any turn.
61
+ Each scenario runs once; failure stops subsequent scenarios, without replay.
62
+
63
+ A subprocess owns a unique HOME, all four XDG roots, ledger and Pi session
64
+ journal. It resolves Jiti through the installed Pi package to load the TypeScript
65
+ module. It links the existing login by metadata-only `linkHostLogin`, never copies
66
+ or reads credentials, and verifies the symlink metadata after cleanup. The
67
+ original login is the only deliberately shared account state; normal official
68
+ login refresh may still change its metadata. The worker home and synthetic
69
+ journal are retained under `qualificationHome()/live-*` for review, including
70
+ failed/unknown outcomes. Do not blindly re-run an interrupted worker.
71
+
72
+ The worker uses the real provider, Agent, MCP broker and official host:
73
+
74
+ | Check | Required observation |
75
+ | --- | --- |
76
+ | Private prompt | Exact randomized token supplied only in the private system prompt is returned. This tests prompt delivery, not exhaustive suppression of every foreign rule. |
77
+ | Session MCP | Pi actually executes both synthetic `qualification_read` invocations and the final answer contains both randomized outputs. |
78
+ | Batch boundary | One actual `tool-batch` host event contains both fixture keys. Timing overlap or two separate calls does not count. |
79
+ | Resume | Retire the real ephemeral host, restore messages from the Pi journal, and recall the earlier randomized tool output without tools. This is Pi history replay, **not native Muse session resume**. |
80
+ | Image | Submit real PNG bytes for a randomized red/blue swatch through Pi image input and check the answer. This is not proof of tool-result image receipt parity. |
81
+
82
+ The worker passes `qualificationProbe:true` to the host under its isolated-worker
83
+ marker so a new candidate can exercise batches before it has a successful record.
84
+ This bypasses only the prior-record gate: rawLog negotiation and runtime frame
85
+ validation still apply. Ordinary runtime must not use this probe option.
86
+
87
+ No missing check is treated as a pass. Exceptions, failed assertions, incomplete
88
+ workers and login verification failures leave `qualified:false`. This module
89
+ never auto-promotes or auto-updates anything, and its live runner is not a
90
+ substitute for the root-owned single authorized end-to-end production proof.
91
+
92
+ ## Verification performed during implementation
93
+
94
+ `tests/qualification.test.ts` exercises fake read-only executable commands,
95
+ retained schema compatibility, hash-bound records, explicit live gates, build
96
+ mismatch refusal and failure records. It does not call a model. The live suite
97
+ is implemented but **was not run** during this implementation.
package/docs/DETAILS.md CHANGED
@@ -4,7 +4,7 @@ Use Muse Code models in [Pi](https://github.com/earendil-works/pi) through the o
4
4
 
5
5
  ## Install and first use
6
6
 
7
- Requires Node.js 24+, Pi 1.5.0, the official Muse Code client, and an account entitled to the selected model. Qualified builds are 1.4.14-R7309.1 and 1.4.15-R8339.1 for private prompt settings, session MCP and experimental rawLog committed tool batches. The 1.4.15 qualification includes asynchronous MCP readiness and an Ember tool-batch workload; it does not establish equal workload coverage for every model. The adapter independently pins `@muse-code/sdk` 1.4.14. Newer ordinary clients warn (strict mode refuses); experimental batches remain exact-build gated.
7
+ Requires Node.js 24+, Pi 1.5.0, the official Muse Code client, and an account entitled to the selected model. Qualified builds are 1.4.14-R7309.1 and 1.4.15-R8339.1 for private prompt settings, session MCP and experimental rawLog committed tool batches. The 1.4.15 qualification includes asynchronous MCP readiness and an Ember tool-batch workload; it does not establish equal workload coverage for every model. The adapter independently pins `@muse-code/sdk` 1.4.14. Newer clients warn (strict mode refuses only when explicitly enabled). Unqualified builds run sequential tools; parallel-tool qualification is hash-bound data plus capability negotiation and runtime schema validation, not a whole-turn exact-build gate.
8
8
 
9
9
  ```sh
10
10
  pi install npm:pi-muse-tether
@@ -39,7 +39,7 @@ Contributor mode is a **model choice**, not an integration caveat. Select it in
39
39
  | `PI_MUSE_TETHER_SYSTEM_PROMPT=none` | Legacy no-Pi-prompt mode; disables raw summaries |
40
40
  | `XDG_STATE_HOME` | Base directory for best-effort metadata ledger diagnostics |
41
41
 
42
- Append prompt mode is unsupported. Prompt replacement uses a version-qualified private settings route with explicit workspaceRoot, not a public per-turn prompt API. Only the current Pi MCP toolset is enabled; inventory-derived skills, named reminders and workflow triggers are disabled. Configuration failures never fall back to vendor defaults. Developer workspace, permissions and memory context remain: this is **not a vendor-free prompt**. Universal reminder suppression lacks an enabled-reminder positive control.
42
+ Prompt replacement uses private settings with explicit workspaceRoot, not a public per-turn prompt API. If experimental replacement is not negotiated, the host reopens before submitting a turn with the supported `run.developer_prompt` mechanism: Pi’s instructions are appended to Muse’s, not replacing them, with a typed notice. Only the current Pi MCP toolset is enabled; inventory-derived skills, named reminders and workflow triggers are disabled. Missing session MCP refuses with build and cause; there is no vendor-tool fallback. Developer workspace, permissions and memory context remain: this is **not a vendor-free prompt**. Universal reminder suppression lacks an enabled-reminder positive control.
43
43
 
44
44
  Muse sees names such as `mcp__pi__read`; Pi's actual names, schemas and execution remain unchanged. The private configuration requests Ask-me permissions and verifies human-reviewer readback, avoiding an extra automatic approval-judge request. This does not make Pi tools read-only.
45
45
 
@@ -57,7 +57,7 @@ For a desired 450,000-token compaction boundary, calculate `reserveTokens = actu
57
57
 
58
58
  ### Parallel tools, long tools, abort and steering
59
59
 
60
- Coding requires the pinned experimental `rawLog` capability, `session.live` subscription and complete `assistant_tool_calls_committed` boundary. Missing support fails before inference, without timers or single-call fallbacks. One Pi assistant contains the ordered tool batch; Pi validates/coerces its original arguments and journals validation errors or execution results before native approvals are released for exact receipt retrieval. Invalid arguments therefore produce the normal Pi validation message, not an opaque native approval denial. Native/MCP identity still binds the unchanged original arguments, including when Pi coerces them for execution. Raw records are consumed in memory, not logged wholesale.
60
+ Parallel coding requires matching qualification evidence, the experimental `rawLog` grant, a `session.live` subscription and schema-checked `assistant_tool_calls_committed` boundaries. Unknown builds, missing support, gaps or shape mismatches degrade to sequential tools with one notice, without timers, replay or client substitution. Concurrent native MCP calls queue and are verified one at a time. A degradation also releases approvals waiting on a lost boundary, so fallback cannot strand the turn. One Pi assistant contains the ordered tool batch; Pi validates/coerces its original arguments and journals validation errors or execution results before native approvals are released for exact receipt retrieval. Invalid arguments therefore produce the normal Pi validation message, not an opaque native approval denial. Native/MCP identity still binds the unchanged original arguments, including when Pi coerces them for execution. Raw records are consumed in memory, not logged wholesale.
61
61
 
62
62
  **Long-tool limit:** a historical native MCP task timed out around 300 seconds while Pi was still running. Approval holding now avoids opening that native call during Pi execution. One synthetic 301-second live tool passed with the native MCP call open only briefly. That establishes the measured interval, **not unlimited approval patience or arbitrary long-build support**. No vendor no-deadline control is qualified. A late denial, timeout or host death can leave a real Pi side effect without a verified native receipt. Fencing cannot undo it or silently kill Pi's executor. Inspect uncertain effects before a new request; unknown work is never automatically replayed.
63
63
 
package/index.ts CHANGED
@@ -5,6 +5,8 @@ import { registerApiDispatch } from "pi-tether-core/register";
5
5
  import { streamViaMuse, retireAll, setSessionManager, rawCompletionQualified, committedCompaction } from "./src/provider.js";
6
6
 
7
7
  import { discoverMuseCatalog } from "./src/host.js";
8
+ import { featureNotice } from "./src/features.js";
9
+ import { clientStatus, clientBuildLabel } from "./src/qualification-records.js";
8
10
  import { museDoctor } from "./src/doctor.js";
9
11
  import { setQuotaListener, quotaStatusLine } from "./src/rate-limit.js";
10
12
  import { setRetryStatusListener } from "./src/retry-status.js";
@@ -59,8 +61,17 @@ export async function registerMuseExtension(pi: ExtensionAPI, provider = {stream
59
61
  catalogue = next;
60
62
  if (changed) registerProvider();
61
63
  });
62
- pi.registerCommand("muse-doctor", {description:"Local Muse version, recipe and telemetry diagnostic (no model/account request)",handler:async(_args,ctx)=>{ctx.ui.notify(JSON.stringify({...JSON.parse(await museDoctor(ctx.model?.id)),catalogue:catalogue.diagnostics},null,2),"info");}});
64
+ pi.registerCommand("muse-doctor", {description:"Muse client and qualification diagnostic; qualify [build] [--live]",handler:async(args,ctx)=>{
65
+ if (args.split(/\s+/).includes("--live") && !await ctx.ui.confirm("Live Muse qualification", "Runs model requests (batch, private prompt, MCP, resume, image) in isolated state using your existing login. Proceed?")) return;
66
+ try { ctx.ui.notify(JSON.stringify({...JSON.parse(await museDoctor(ctx.model?.id, args)),catalogue:catalogue.diagnostics},null,2),"info"); }
67
+ catch(error) { ctx.ui.notify(error instanceof Error ? error.message : String(error), "error"); }
68
+ }});
63
69
  pi.on("session_start", async (_event, ctx) => {
70
+ if (process.env.PI_MUSE_TETHER_LIVE !== "1") ctx.ui.notify(featureNotice(clientBuildLabel(),"catalogue","PI_MUSE_TETHER_LIVE is unset","empty live catalogue; set PI_MUSE_TETHER_LIVE=1 to enable official discovery"),"warning");
71
+ if (process.env.PI_MUSE_TETHER_LIVE === "1") {
72
+ try { const status=clientStatus(false); ctx.ui.notify(`[pi-muse-tether] ${JSON.stringify(status)}; vendor updates are governed by capability/schema checks.`, "info"); }
73
+ catch(error) { ctx.ui.notify(String(error), "error"); }
74
+ }
64
75
  setQuotaListener(payload=>ctx.ui.setStatus("muse-rate-limit",quotaStatusLine(payload)));
65
76
  setRetryStatusListener(status=>ctx.ui.setStatus("muse-retry",status));
66
77
  await retireAll("session_start");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-muse-tether",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "Use your Muse Code subscription in Pi through the official client",
6
6
  "license": "MIT",
@@ -9,7 +9,7 @@
9
9
  "homepage": "https://github.com/kyraneth/pi-muse-tether#readme",
10
10
  "bugs": {"url": "https://github.com/kyraneth/pi-muse-tether/issues"},
11
11
  "engines": {"node": ">=24"},
12
- "files": ["index.ts", "src/", "README.md", "CHANGELOG.md", "LICENSE", "assets/", "docs/DETAILS.md"],
12
+ "files": ["index.ts", "src/", "README.md", "CHANGELOG.md", "LICENSE", "assets/", "docs/DETAILS.md", "docs/CLIENT-LIFECYCLE.md", "docs/CLIENT-QUALIFICATION.md"],
13
13
  "dependencies": {
14
14
  "@muse-code/sdk": "1.4.14",
15
15
  "pi-tether-core": "0.1.1"
@@ -33,7 +33,9 @@
33
33
  "typescript": "^5"
34
34
  },
35
35
  "scripts": {
36
- "test": "vitest run tests --exclude tests/host.test.ts --testTimeout=0 --hookTimeout=0 && node --import tsx --test tests/host.test.ts tests/catalog-entry.node.ts",
36
+ "test": "node scripts/test-guard.mjs",
37
+ "typecheck": "tsc --noEmit --target ES2023 --module NodeNext --moduleResolution NodeNext --allowImportingTsExtensions --skipLibCheck index.ts src/*.ts",
38
+ "test:proof": "node scripts/test-guard.mjs --proof -- node --import tsx",
37
39
  "dev:install-core": "node scripts/install-core-main.mjs",
38
40
  "scan:public": "node scripts/check-public-tree.mjs",
39
41
  "export:manifest": "node scripts/export-manifest"
@@ -0,0 +1,33 @@
1
+ import { readFileSync } from "node:fs";
2
+ /** Retained structural schema definitions (documentation descriptions stripped
3
+ * from this distributable projection), not a version-string allowlist. Meta's
4
+ * envelope explicitly declares payload unstable/free-form: the consumed event
5
+ * shape below is additionally checked from the two observed batch fixtures. */
6
+ const recorded = JSON.parse(readFileSync(new URL("../assets/batch-boundary-schemas.json", import.meta.url), "utf8"));
7
+ export const BATCH_SCHEMA_SOURCES: Array<{build:string;sha256:string}> = recorded.sources;
8
+ function matches(value: any, schema: any, defs: any): boolean {
9
+ if (schema.$ref) return matches(value, defs[schema.$ref.split("/").at(-1)], defs);
10
+ if (Array.isArray(schema.type)) return schema.type.some((type: string) => matches(value, {...schema,type}, defs));
11
+ if (schema.type === "null") return value === null;
12
+ if (schema.type === "integer") return Number.isSafeInteger(value);
13
+ if (schema.type === "string") return typeof value === "string";
14
+ if (schema.type === "object") {
15
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
16
+ if (schema.required?.some((key: string) => !(key in value))) return false;
17
+ return Object.entries(schema.properties ?? {}).every(([key, child]) => !(key in value) || matches(value[key], child, defs));
18
+ }
19
+ return false; // Fail closed on schema constructs this owning subset does not use.
20
+ }
21
+ export function batchBoundarySchemaMatches(params: unknown): boolean {
22
+ return recorded.schemas.some(({ $defs }: any) => matches(params, $defs.LogRecordParams, $defs) && matches((params as any).record, $defs.RawLogRecordEnvelope, $defs));
23
+ }
24
+ export function committedCalls(params: any): Array<{callId:string;name:string;args:Record<string,unknown>}> {
25
+ if (!batchBoundarySchemaMatches(params)) throw new Error("Batch envelope schema mismatch");
26
+ const payload=params.record.payload, event=payload?.event;
27
+ if (payload?.kind !== "run" || typeof payload.run_id !== "string" || event?.kind !== "assistant_tool_calls_committed" || !Array.isArray(event.tool_calls) || !event.tool_calls.length) throw new Error("Batch payload schema mismatch");
28
+ return event.tool_calls.map((call: any) => {
29
+ const args=typeof call.args === "string" ? JSON.parse(call.args) : call.args;
30
+ if (typeof call.call_id !== "string" || !call.call_id || typeof call.name !== "string" || !call.name || !args || typeof args !== "object" || Array.isArray(args)) throw new Error("Batch tool-call schema mismatch");
31
+ return {callId:call.call_id,name:call.name,args};
32
+ });
33
+ }
package/src/catalog.ts CHANGED
@@ -24,7 +24,7 @@ export function museCatalogAssessment(catalog: any) {
24
24
  Number.isSafeInteger(m.outputLimit) && m.outputLimit > 0 &&
25
25
  Array.isArray(m.variants) && m.variants.length &&
26
26
  m.variants.every((tier: unknown) => typeof tier === "string" &&
27
- Object.values(museThinkingLevelMap([tier])).includes(tier)) &&
27
+ Object.values(museThinkingLevelMap([tier])).some(value => value === tier)) &&
28
28
  m.variants.includes(m.defaultReasoningEffort));
29
29
  return { valid, diagnostics: { source: catalog?.source ?? null, providerId: catalog?.providerId ?? null,
30
30
  profileId: catalog?.profileId ?? null,