Skip to content

refactor: one remote seam - #185

Merged
viztor merged 276 commits into
mainfrom
claude/vigilant-mendel-bctz9n-p9
Nov 16, 2026
Merged

viztor merged 276 commits into
mainfrom
claude/vigilant-mendel-bctz9n-p9

Conversation

@viztor

@viztor viztor commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Phase P9 of docs/improvement-plan.md, stacked on #184.

Before this change, each of the three remote contracts (usage, purge, store inspection) had its own hand-written descriptor literal. Each host service also wrote its own remote-methods marker, and each of the four client callers unwrapped the answer in its own way. Every copy was slightly different. P9 replaces them with one seam.

What changed

Item Change
Contract builder New src/contracts/remote.ts. remoteValue(type, parse) builds a codec the way the old literals did. defineRemote(namespace, methods) derives every descriptor: the id, invocation, service, and parameters with acceptsUndefined set only when a parameter is optional. The result is still a TypertRemoteContribution and still satisfies RemoteContract. The module is client-safe and held at 100% coverage.
Contracts move usage-contract.ts, purge-contract.ts and opencode-store-contract.ts move to src/contracts/{usage,purge,store}.ts with no shim, and each builds its *Remote with defineRemote. REMOTE_CONTRACTS in src/contracts/all.ts is now the only list the client's patchRemote is built from.
Host marker markRemote(Service, contract) in src/host/remote.ts is now the only place the marker key is written. It takes the method list from the contract, and its types require the class to implement every contract method. installRemoteService is unchanged.
Client unwrap src/settings-remote.ts gains findRemoteCall, unwrapRemote and callRemote. All four callers unwrap through unwrapRemote. The purge and store rows call through callRemote. The settings summary and the meter keep their arity retry (callUsageRead) between finding the call and unwrapping it. The callers' return types are unchanged, so no rendering module changes.
Usage reading isGoUsage is deleted. USAGE_NAMESPACE is added, replacing four bare "opencodeGoUsage" literals. parseUsageReading is added: it accepts everything the vendor whitelist (parseGoUsage) accepts, plus the fields the service attaches after parsing (allowance, quotaUnavailable, session.planeCostFormatted, session.planeSpendUsd). Without it, the allowance row and the overflow floor would be lost.
Contract test test/remote-contract.test.ts reads the contracts and the mounted services instead of matching source text with a regex. New tests: test/remote-define.test.ts covers the builder and test/remote-seam.test.ts covers the seam end to end, including the real ModelPurgeService.
Client tripwire CLIENT_BUDGET goes from 140 to 146 KiB. The client bundle measures 146953 bytes, up from 143074 on the base. The growth is our own source: the builder, the unwrap and the reading parser. The bundle depends on nothing new.
Docs AGENTS.md gets an entry for the seam, including the exception for the two usage callers. docs/improvement-plan.md P9 rows are set to in review. L14's loopback guard is recorded as a no-op because no webServer route appeared.

Behaviour changes

None on the wire. This is a pinning phase: every existing assertion in the purge, store, usage and settings-page tests is unchanged, apart from import paths for the moved modules. The meter still passes an unparseable answer through unchanged.

The host's client face only ever answers { ok: true, value } | { ok: false, error: RemoteError }. The differences below are all on answer shapes outside that type, and each one is pinned by a new test:

  • Store row: an envelope-level message or a string error is now shown instead of the default sentence.
  • Purge row: a refusal nested inside value is no longer read.
  • Settings summary: shows the whitelisted copy of a reading, and checks its windows as parseGoUsage does (finite non-negative percent, parseable resetsAt). An invalid payload inside an envelope now also logs the "not a usage shape" line.
  • Meter: a valid reading is the whitelisted copy, and a bare { value: X } is unwrapped.
  • Usage result codec: its parser is now parseUsageReading. This has no wire effect, because the host only encodes and decodes results and never parses them.
  • remote getter that throws: when the ctx.get lookup finds nothing, a throwing getter now makes purge, store and the meter answer "unavailable" instead of throwing. There is a caller-level test for each of the three.

Review

Round Found Upheld Fixed
1 14 12 (1 medium, 11 low) 12
2 2 2 (low) 2
3 1 1 (low) 1

Round 1 asked for:

  • the purge cases to run the real purge service instead of hand-built results
  • a markRemote re-mark case that passes when run on its own
  • a per-contract mount check that the methods exist
  • the eager remote read moved after the ctx.get path
  • the unused RemoteValueOf export dropped
  • room restored under the client tripwire
  • the AGENTS.md and plan wording corrected

Round 2 asked for caller tests of the throwing-getter guard and an accurate header for remote-seam.test.ts. Round 3 asked for the matching caller-level test on the meter. That test fails if the guard is bypassed: I checked by planting an unguarded read, and only that case failed.

Verification

Node Step Result
26 pnpm run check 0 errors, 12 warnings (304 files)
26 unit, alpha channel 149 files, 2486 passed, 1 skipped
26 unit, shuffled (seeds 1 and 42) 149 files, 2486 passed, 1 skipped
26 mock suite 9 files, 120 passed
26 unit and mock, rc channel (dsh-llm-pi-ai 0.2.2-rc.2, cordis 4.1.0) 2486 passed, 1 skipped; 120 passed; switching back to alpha left nothing behind
26 pnpm run build and scripts/check.ts check passed; lib/client.js 146953 bytes, under the 149504 tripwire; packed tarball installed with plain npm
26 coverage statements 98.7%, branches 96.67%, functions 98.83%, lines 98.7%; thresholds pass
24 unit, shuffled (seed 7), and mock suite 2486 passed, 1 skipped; 120 passed
24 host binary e2e, alpha and rc cells 15 passed, 2 skipped each (the file's two declared host limitations)
26 landing re-run after merging the moved base check 0 errors, 12 warnings; unit 2486 passed; mock 120 passed; build and scripts/check.ts passed
n/a local-path and credential grep over the full diff and untracked files 0 hits; a known positive matches

The base had gained a merge of main's squashed P7 since this branch was cut. Merging it changed only history; the tree is identical. For this diff, scripts/freshness-scope.ts answers report for all three freshness checks.


Generated by Claude Code

claude added 30 commits October 24, 2026 15:17
A measurement phase: the default endpoint family stays `modern`, so no
plugin behaviour changes and no characterization row flips.

- Name the default in one constant, AUTO_ENDPOINT_FAMILY in
  src/utils/plane-model.ts, which is what `auto` resolves to, and pin
  it in test/endpoint-family.test.ts.
- Extend the keyless matrix to three URL shapes (legacy, root, modern)
  over four protocols and two planes, add LEGACY_DISPATCH, and add one
  keyless free-model probe with its own pure classifier.
- Add minimal keyed probes (pure test/support/keyed-probes.ts and its
  e2e): one tiny request per plane, protocol and shape, sent with the
  plane's own key and the plugin's identity from one shared constant,
  PROBE_IDENTITY. Only the cells the default sends to are asserted;
  the rest are recorded.
- Gate the live job by tier with OPENCODE_E2E_KEYED (none, probes,
  full; unset means full). CI arms `probes` on a pull request that
  touches what the probes send, `full` nightly and on dispatch, and
  passes the secrets only when the tier is not `none`.
- Write a dated endpoint-family record from both live suites to the
  run summary and an `endpoint-families` artifact, and add §13 to
  docs/redirect-planes.md with every cell pending the first CI run.

The live part runs in CI only; no live result is invented here. A
failing keyed modern cell in CI is the evidence for a later `fix:`
that flips the default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
For the opencode and opencode-go routes, the Settings model list now
shows pi-ai's own rows first, in pi's order, and then every model the
plane's catalog can serve that pi does not list and the catalog has
not retired. Ids that pi's registry has retired are dropped, a field a
row lacks is filled from the catalog, and every row is cut down to the
five fields the host's discovery contract accepts, with absent values
omitted rather than set to undefined.

While pi-ai restarts and its discovery is withdrawn (NO_DISCOVERY),
the list answers the catalog rows alone instead of the error.

This rewrites the existing discoverModels wrapper rather than adding a
second one. Other routes keep today's enrich-only merge, because pi-ai
serves them and cannot serve an id it does not list. The plugin's own
model-discovery namespaces, which Settings never asked, are deleted
with their lifecycle tests, and RouteClaim gains a claiming() seam.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Phase P-T2 of docs/improvement-plan.md. Test-only: no source file
changes and no behaviour changes.

- Every socket-bound case is in the mock suite. The nine unit files
  that booted the mock gateway through testing-kit.ts are merged into
  test/mock/request-shapes.mock.ts and a new protocol-endpoints.mock.ts
  table. The two offline e2e files that bind a port
  (patched-fetch-headers, refusal-classification) moved there too. The
  device-login routes left the gateway mock.
- createMockContext, HarnessSimulator and the rest of testing-kit.ts
  are gone. Services are built on a real cordis Context, and
  lifecycle.test.ts mounts the plugin the way the Loader does
  (test/support/composition.ts). degradedHost remains only for the
  degraded-composition diagnostics.
- 43 cases that tested only the harness or the mock gateway are
  deleted. 33 duplicated cases are merged and 16 restatements are
  deleted; the plan names each one.
- Hard-coded catalog counts and vendor ids are now invariants, or a
  row picked by shape, so a vendor catalog refresh no longer breaks
  the suite by construction.
- The seven largest test files are split by subject, the live suites
  read their environment through test/support/e2e-env.ts, and the
  duplicated helpers and hard-coded ses_ ids are removed.
- src/utils/session-id.ts, src/opencode-store-contract.ts and the e2e
  environment reader have their own tests, and src/lifecycle.ts,
  src/stream-hook.ts and src/fetch-patch.ts have per-file coverage
  floors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The vendor renamed the Go plane's one Gemini model (dropping its
contributor suffix, halving its price and publishing an allowance for
it where the limits table had none) and added a free model with no
SDK, so `catalog freshness` went red on every branch of this stack.
This takes the two generated files exactly as the nightly refresh
produced them (#111), with no hand edits, and follows them:

- the Go Gemini fixtures in six test files (attachment-services,
  catalog, go-google, go-google-prepare, models-discovery,
  responses-routes) now name the renamed id, since each means "the
  Go Gemini model the catalog serves";
- the usage panel test built its unknown allowance from the table's
  one unpriced row, which the vendor has now priced, so it builds the
  `Number.NaN` allowance the generator emits itself;
- the Go shim count in catalog.test.ts (29 -> 30);
- redirect-planes.md: Go 29 -> 30 served, the no-SDK Go cell
  18 -> 19, and "0 of 29" -> "0 of 30" in the prose;
- both READMEs: the renamed Gemini id, and the new model in the Go
  completions list, since it declares no SDK.

The listed half of "30 served / 34 listed" is models.dev's count,
inferred from one rename (no change) and one addition (+1), because
models.dev cannot be reached from here. The dated S0 measurement row
in improvement-plan.md keeps the id it was measured with.

It no-ops once main carries #111.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The live routing suite picks its free-tier subjects from the catalog by
asking the gateway, but it counted "400 Upstream request failed: Model
is unavailable" as an observable answer. The upstream withdrew
nemotron-3-ultra-free while the catalog still lists it, so the picker
chose it and two cases asserted on a model the gateway no longer
serves; the reachability case also failed on a 429 throttle.

A withdrawn model (that 400, or a 410) is now skipped like a throttled
one. The free-tier routing case only accepts a candidate whose answer
is the free-tier gate it asserts, so an unmetered model cannot become
its subject, and the reachability walk moves past gated, withdrawn and
throttled candidates before it reports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The review ran three rounds through the correctness, rules and matrix
lenses. What it found, and what changed:

- The binary e2e's beforeAll budget was smaller than the blocking
  subprocess deadlines it serializes. Each plugin install now has its
  own deadline, the hook's budget is derived from the installs and the
  boot, and afterAll stops a host a failed hook left running.
- providerWithApiKey claimed to be a line-for-line restatement but
  skipped upstream's credentialRef(ref) check. It now throws the same
  TypeError for a ref outside the grammar (a host-editor-contracts
  case pins it), and its comment names the deliberate differences.
- The pinned e2e-host cell let cordis and the loader float at patch
  level. The overrides now force both, the cache key includes them,
  and the job asserts them against HOST_VERSIONS.
- The pi-ai-first characterization asserted every facet under one
  KNOWN_DEFECT title. Each apply order now generates one test per row
  and facet, titled with that order's own tags.
- CONTRIBUTING said the contract tests pin F11-F20, and the plan said
  P-T1 pins every fact. Both now give the same accounting: which facts
  are pinned by number, which P-R1 exercises first, and why F9 and F17
  are not pinned.
- CONTRIBUTING put the e2e's dummy keys in the profile's credentials
  file; they are in the temporary home's credentials document.
- F5 had no real-host pin: host-shapes now pins that a route-level api
  and baseURL collapse pi's protocols onto one. F6 is recorded as first
  exercised by P-R1.
- The credential-mapping row pinned only the api-key branch of
  toPiCredential. host-credentials now covers all three branches, and
  the env branch is asserted through pi's Models.getAuth, so the case
  fails without it.
- The plan's reason for restating hasProviderApiKey was inaccurate; it
  now says no installed copy reaches the function.
- The new credential cases cited toPiCredential at the wrong lines;
  they now cite auth.ts:74-84.
- F4's listing and dispatch halves were pinned only by KNOWN_DEFECT
  rows P-R1 flips. A plugin-less tier-A case in host-shapes now pins
  that an id pi cannot place is not listed and that a turn on it is
  INVALID_CONFIG with no request; the save and deferred-read halves
  are tagged F4 too.
- The one facet that depends on the apply order lost its tag when the
  pi-ai-first block was split. The fixture case now checks only
  structure (the facets whose value moves are the facets whose tag
  moves), and the exact pin is its own KNOWN_DEFECT case that boots no
  host. CONTRIBUTING and the plan say P-R1 drops todayRowsFor's
  override and turns that case into a BASELINE check in the same diff.

Nothing under src/ changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The vendor renamed the Go plane's Gemini model from
gemini-4-argon-contributor to gemini-4-argon. The tier-B fixtures
(S0_PROFILE, S0_TODAY, CHARACTERIZED_PROFILE through S0, and
todayRowsFor's pi-ai-first override) declared the old id as the Go gap
id: one the plugin's catalog describes and pi 1.1.0 cannot place. After
the refresh the catalog no longer described it. They now name the
renamed id, which still plays that role because pi 1.1.0's opencode-go
table has no gemini-4-argon either. The host-shapes and editor-contract
cases follow the same fixture. The pi 1.3.0 note in mount-protocols
names that pi's own row, so it stays as it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
What the review found, and what changed:

- rewrapOnAdaptersUpdated reinstalls its site inside the plugin's own
  teardown and on every foreign registry change. Its JSDoc in
  src/host/patch-method.ts now says so, counts the reinstalls a release
  causes, says a caller disposes it before releasing its adapters, and
  notes that a throw from a reinstall is logged by the host.
- The plan of record said all three P-H edge changes are unreachable on
  the real host for one reason; the third (the live-reload listing) is
  unreachable for a different one. docs/improvement-plan.md now gives
  each its reason.
- The tier-A reload cases for the listing and discovery sites proved the
  row only structurally. test/reload.test.ts now gives every site a
  tier-A probe whose decorated answer must differ from the host's own,
  so "survivor still decorates" and "last dispose restores" can fail.
- "patchMethod is the only way the plugin wraps a host method" was
  asserted in docs and enforced by nothing. test/architecture.test.ts
  now has a textual tripwire over everything apply() reaches, with a
  self-check of planted violations, and the apply()-twice reload case
  requires a patch record on every own function apply() leaves on the
  stand-in.
- The tripwire missed several write forms (Object.assign,
  Object.defineProperty/defineProperties, Reflect.setPrototypeOf,
  Object.setPrototypeOf, and an Object.* target reached through a
  property path such as registration?.adapter or this.llm). The
  patterns now catch them, and the self-check plants each one (17
  planted, up from 13). Nothing new in src/ matches.
- The docs said "any Reflect.* write" where the pattern matches a fixed
  set. The test docstring, AGENTS.md and the plan's P-H section now
  name the four Reflect and four Object methods matched, and why a
  prototype swap is listed.

No runtime behaviour changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The refreshed Go catalog serves its Gemini model as gemini-4-argon, so the
plane-dispatch mock, the plane-model cases and the binary e2e's probe
expectations name the new id; the Go Google base they assert is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The review ran three rounds (found 20, 5 and 8; upheld 19, 4 and 8).
What it found and what changed:

- A completions model whose effort list names none lost its Off.
  utils/model-metadata.ts now offers Off with none as its wire value
  on completions, as pi 1.1.0's own entries do; Responses unchanged.
  Pinned in model-metadata, plane-model and a new mock-gateway case.
- A Go entry with no apiKeyEnv authenticates with OPENCODE_API_KEY
  (pi's lookup, D20), and nothing said so. README "Changed in 1.x" and
  step 3 now name it; host-planes.test.ts pins both cases.
- A Settings save of a plane was refused as "cannot be validated yet"
  while the host modules were unloaded. host/route-claim.ts now judges
  it with the last modules that loaded; route-claim.test.ts pins it.
- Fiber.update(config) with noSave false would persist the stripped
  config and drop both planes. Recorded as a constraint in
  route-claim.ts and the plan; no caller does it today.
- Stale text: cordis-context.ts comments (stream redirect, isolate,
  root inject), deep-dive.md (pi's Go lookup, who answers Fetch),
  CONTRIBUTING (field count, the host-modules floor), and historical
  banners on opencode-parity-plan.md and upstream-findings.md.
- The mock body-shape row asserted only body.model. It now checks each
  protocol's required fields and that the gateway answered 200, or
  the vendor's 404 for the unknown id.
- Route-set rows: removing the last plane now pins replace([]) on the
  live handle, and "booting with none" waits for the plugin's row to
  be active instead of sleeping 50 ms.
- The live protocol-routing suite now sends paid models through the
  plane adapter on a tier-A host, not only raw probes.
- README's credential-isolation claim was false: the Go meter can send
  the Zen key. README.md, README.zh-CN.md, deep-dive.md,
  credentials.md and redirect-planes.md now give the real order and
  the 403 remedies; readme-parity.test.ts keeps both READMEs in step.
- The keySource hint described Automatic backwards. settings-copy.ts
  (en and zh) now gives literal key, captured key, then reference.
- The live adapter blocks dropped a protocol whose model was
  withdrawn. They now walk up to three candidates per protocol
  (support/live-walk.ts), pass a "model is unavailable" turn only when
  a raw probe confirms it (support/live-probe.ts), and skip naming a
  protocol no candidate reached.
- A mock comment claimed a body passed shape checks the mock lacks.

Declined: a toggle beside an effort list still offers no Off, which
moves baseline facets and needs the owner's decision; the Models
store's join stays a documented restatement rather than importing a
client UI package; the PR description is edited outside the tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The vendor moves its model catalog, its Go limits page and its CLI
version almost daily. Each move turned every open pull request red,
although none of them caused it: vendor drift is not a regression of
the change under test.

A pull request now fails a freshness check only when its diff changes
that check's generator code: the script, every local module it loads,
transitively, and the pinned version file for the CLI check.
scripts/freshness-scope.ts derives those inputs from the sources and
makes the call, so a new import moves them without a list to edit.
Any other pull request reports drift as a warning, as a push to main
already did. The offline check that every copy of the CLI version
agrees with the pin still gates every pull request, since only the
repository can break it. The gates fail closed: a lost scope answer
gates rather than skips.

The nightly run still regenerates the two tables and proposes the
refresh as its own pull request, and warns on the CLI version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The vendor retired `deepseek-v4-flash` from the Zen plane (it stays on
Go). This pull request changes the catalog generator's own code, so
under the freshness scoping it carries the refresh itself. This takes
`src/catalog-data.ts` exactly as the nightly refresh produced it (#111),
with no hand edits; `src/go-limits-data.ts` did not change. It then
updates the counts that still hard-code the catalog's size:

- the Zen shim count in catalog.test.ts (82 -> 81);
- redirect-planes.md: Zen served 82 -> 81, the no-SDK Zen cell 25 -> 24,
  and "0 of 82" -> "0 of 81" in the prose;
- protocol-routing-and-merge.md: the per-protocol shares now read "of 81",
  with completions at 24;
- both READMEs: the no-SDK row is 24 and the active total is 81. The
  Chinese table had read 27 before this change, and now matches the
  English one.

"127 listed" is unchanged, because the vendor retires a model by marking
it `status: "deprecated"`, which keeps it listed. This could not be
confirmed against models.dev, which cannot be reached from here.

It no-ops once main carries #111.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…nt-mendel-bctz9n-p-t1b

# Conflicts:
#	CONTRIBUTING.md
The walk's fixture held the text `await import("../src/lazy.ts")`. The
test tree's own architecture gate, which starts on the next branch of
this stack, reads a dynamic `src` import anywhere in a test file's text,
including inside a string. It counted that fixture line as a test
bypassing `test/support/src.ts`, so every branch above this one failed
the gate once this pull request was merged into it.

The case is about the dynamic form, not about `src`, so the import now
names `./lazy.ts` beside the script. The walk resolves it from the
importing file's own directory, which is the same rule, and the expected
inputs follow it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
claude and others added 28 commits November 16, 2026 02:41
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The plan said P5's pin additions landed first in their own `test:` commit
and that the change commit left them untouched. The phase is one commit,
which adds the pins itself. The sentence now says so, in P-R2's form, and
records the base run: both cases applied to fd3a6bc pass there, and a
control that expects the store service absent after a reload fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
No file conflicted. Resolutions, file by file:

- test/freshness-scope.test.ts: auto-merged; main's new es-module-lexer 3
  case ("reads a file off every loading form...") sits beside this
  branch's rewritten cases, both kept.
- scripts/freshness-scope.ts: main's es-module-lexer 3 port taken as is
  (this branch does not touch the file).
- package.json, pnpm-lock.yaml, channels/rc/pnpm-lock.yaml,
  pnpm-workspace.yaml: main's, unchanged (#177).
- src/catalog-data.ts, src/go-limits-data.ts: main's generated tables,
  unchanged (#178).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Brings in p-t3's merge of main: the #177 toolchain bump (vite-plus 1.5.0
with vitest 5.1.0 and the dev-dependency group, the es-module-lexer 3
port of scripts/freshness-scope.ts and test/freshness-scope.test.ts)
and the #178 refresh of the generated catalog and limits tables.

No file conflicted: p-r3's own change touches none of the files p-t3
changed, so every file merged automatically.

- package.json, pnpm-lock.yaml, channels/rc/pnpm-lock.yaml,
  pnpm-workspace.yaml: taken from p-t3 (main's #177) unchanged; p-r3
  does not touch them.
- scripts/freshness-scope.ts, test/freshness-scope.test.ts: taken from
  p-t3 unchanged (#177's es-module-lexer 3 port).
- src/catalog-data.ts, src/go-limits-data.ts: taken from p-t3 (main's
  #178) exactly; generated, never hand-edited.

The merged tree is p-r3's own change (its diff against 9911b30) on top
of the new parent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The merge applied without conflicts: p5's own change (src/host/remote.ts,
src/lifecycle.ts and its tests, docs, vite.config.ts, scripts/check.ts)
touches none of the files the new p-r3 head changes, so each file was
taken as git merged it:

- package.json, pnpm-workspace.yaml, pnpm-lock.yaml and
  channels/rc/pnpm-lock.yaml (#177): p-r3's, unchanged.
- scripts/freshness-scope.ts and test/freshness-scope.test.ts (#177's
  es-module-lexer 3 port): p-r3's, unchanged.
- src/catalog-data.ts and src/go-limits-data.ts (#178): p-r3's (main's),
  unchanged.

The merged tree is p5's own diff against its former parent applied on
top of the new p-r3 head, byte for byte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The plane adapter hands pi-ai's prepareHeaders the plugin's per-call
headers and runs the host's llm-pi-ai/request-headers waterfall on the
planes. That seam first shipped in 0.2.2-alpha.3 and 0.2.2-rc.1, so the
@deepseek-ai/dsh-typert-protocol peer becomes >=0.2.2-alpha.3 <0.3.0.
The registry read re-run at landing found the seam in 0.2.2-alpha.3 and
0.2.2-rc.3 and not in 0.2.2-alpha.2.

This is an owner call at landing (plan design item 14) and lands as its
own commit so it can be reverted alone. The code detects the seam by
behaviour and still runs on a host without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Credential handling in the fetch patch goes through one resolver.
src/utils/credential-policy.ts holds the pure decisions: one placeholder
filter applied at every decider's exit, the fill and meter orders per
keySource, the capture gate and the refusal count. src/credentials.ts is
the effect half: a capture store per root that the fill and the meter
share, and the one place the fill reads the process environment.

A key is now captured only from a request of a turn the stream hook
decorated, and a request on neither plane is filled only with a key its
own route sent there. A plane's key no longer reaches an arbitrary
provider-claimed URL, and a relay route's key never fills a plane
request or the meter. A captured key is dropped after a second
well-formed 401 in a row on its plane, counted only on decorated turns,
and is recorded again only after a decorated request carrying it is
accepted.

The global fetch install moves to src/host/global-fetch.ts. It reads
the original inside the effect and unwinds through disposed links, so
any disposal order ends at the fetch that was there, and both
KNOWN_DEFECT P6 assertions flip. The plane adapter sets the plane
headers per call through pi-ai's prepareHeaders and runs the host's
llm-pi-ai/request-headers waterfall on the planes, as pi-ai's own routes
do. The marker read moves to src/utils/request-shape.ts.

A parity pin over the four credential deciders was written and run
against the base before any source change. The tests, the docs, the
README pair and the plan record the change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…README

Reverts bf1b3b8: @deepseek-ai/dsh-typert-protocol keeps
>=0.2.1-alpha.1 <0.3.0 || >=0.2.2-0 <0.3.0. OC11 is met by stating the
llm-pi-ai/request-headers seam's floor (0.2.2-alpha.3, 0.2.2-rc.1) in the
README pair, with what a host without it does, not by the peer:

- #163 deliberately kept the optional cordis peer admitting the 0.2.1
  hosts' core;
- D26: host gaps are feature-detected, never compared by version;
- the plane adapter detects the seam by behaviour, and on a host without
  it the fetch patch still writes the plugin's session, origin and project
  headers (no turn is marked per call); only other plugins' contributors
  do not run on the planes there. Refusing those hosts at install buys
  nothing at runtime.

harness-channel keeps the registry's rc.3 facts under the old range, and
fetch-patch gains the OC11 case that performs that fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…6 row

The P6 status row credited the owner with keeping the old typert peer
range, while design item 14 records the same decision as taken for the
owner. The row now says what the design item says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…recorded

Design item 14's OC11 bullet said #163 "deliberately kept" the optional
cordis peer admitting the 0.2.1 hosts' core. #163's record does not
support the intent: it widened the peer to the 4.1 line for the rc
channel, verified 0.2.2-alpha.3 and 0.2.2-rc.2 only, and left the
existing 4.0.4/4.0.5 clauses in place without discussing 0.2.1. The
bullet now states that fact, matching the OC11 row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Several rules were written out more than once and had started to
drift. Each now has one home in src/utils/, with no behaviour change:

- Route to plane: PLANE_OF_ROUTE in src/utils/planes.ts, with the
  exact planeOfPlaneRoute and the relay-inclusive planeForRoute, and
  planeForUrl beside isGoPlaneUrl. The copies in the stream hook,
  usage, key capture, discovery, route claim, plane provider, purge
  service and credentials read it.
- Dollars: one formatUsd in src/utils/usd.ts with two named styles,
  allowance and metered, each rendering exactly as before.
- Spec lookup: specOn and specFor in src/models-catalog.ts replace
  three inline copies; liveCatalogOn names the plane-only read.
- Level names: the last capitalised copy reads effortName.
- L6: src/utils/client-generation.ts records the 1.x and 2.x client
  generations; the plugin emulates 1.x and reads only that row.
- L11: src/utils/context-windows.ts, a measured-window table shipped
  empty, consulted ahead of the catalog's window.
- The Mistral routing rationale now cites the plugin's own rule
  instead of pi's catalog.

Caller pins (plane table, dollar formats, level names, User-Agent,
per-plane purge, credential edges, the meter's refusal per route)
were green on the base and land unchanged. Source scans keep the
route table and the level names from being copied again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The nightly refresh (#182) added hy4-flash-free to both planes (Zen 88 -> 89, Go 32 -> 34 with qwen4-max on @ai-sdk/anthropic) and qwen4-max to the Go limits (29 -> 30). test/catalog-docs.test.ts held five doc counts to the old catalog; the docs follow it:

- README.md, README.zh-CN.md: the per-SDK routing table's no-SDK row 27 -> 28, the stated total 88 -> 89 (twice) and its date 2026-11-16; the Go plane's Chat Completions list gains hy4-flash-free and its Anthropic Messages list gains qwen4-max, so the lists stay the whole Go catalog. Kept in step for the docs-pairing gate.
- docs/protocol-routing-and-merge.md: every "N of 88" becomes "of 89", the no-SDK row 27 -> 28, the count date 2026-11-16, and the refresh history names #182.
- docs/redirect-planes.md: the served halves 88 -> 89 (Zen) and 32 -> 34 (Go); the shapes table's no-SDK row 27/21 -> 28/22 and Go Anthropic 5 -> 6; "0 of 89 on Zen, 0 of 34 on Go"; the Go non-completions sentence 11 -> 12; both count dates and histories name #182. The listed halves stay the ones #156 recorded, since the registry was not re-read.

No test pins a count any more (the catalog tests assert invariants), the Go limits count appears in no document, and no fixture names a moved row, so no test changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The catalog refresh added hy4-flash-free and qwen4-max to Go, and the
newest host cell's pi lacks both, so Settings' fetch on Go now appends
them there too. Three test comments still described an empty Go gap on
the newest cell; they now say what holds on every refresh. The phase
record in docs/improvement-plan.md keeps its statement, marked as true
at the time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The parenthetical beside the per-plane gap assertion said the newest
cell's pi lacks the catalog's newest ids. Nothing asserts that, and it
moves with pi's releases, so it now says only that which ids a cell's pi
lacks moves with the catalog and with pi.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…claude/vigilant-mendel-bctz9n-p-t3

No file conflicted. Twelve files came in from the parent; P-T3 had touched
two of them, in hunks git merged on its own:

- docs/redirect-planes.md: P-T3 rewrote the section 7 paragraph on the
  OPENCODE_E2E_KEYED tiers (a dispatch's `keyed` input, the composite setup
  action); the refresh moved the section 1 and 2 counts (Zen 89, Go 34, the
  no-SDK row 28/22, Go Anthropic 6, Go non-completions 12) and their #182
  stamp. Both kept: P-T3's paragraph, the parent's counts.
- docs/improvement-plan.md: P-T3 rewrote the phase table and its own P-T3
  entries; the refresh reworded one P-PD1 restack bullet (the newest cell's
  pi then listed every Go catalog model). Both kept.

Taken from the parent unchanged, P-T3 did not touch them: README.md,
README.zh-CN.md, docs/protocol-routing-and-merge.md, pnpm-workspace.yaml
(vite-plus and vite-plus-core 1.6.0), pnpm-lock.yaml and
channels/rc/pnpm-lock.yaml, src/catalog-data.ts and src/go-limits-data.ts
(generated), test/host-discovery.test.ts, test/host-planes-foreign.test.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…to claude/vigilant-mendel-bctz9n-p-r3

Brings in the parent's merge of main's toolchain bump (#181: vite-plus
and vite-plus-core 1.6.0, oxlint 1.93, oxfmt 0.78, both lockfiles
relocked, two test helpers moved to .then().catch()) and the nightly
refresh (#182: Zen 89 and Go 34 catalog models with hy4-flash-free and
qwen4-max, Go limits 30), followed through the README pair, the
protocol, redirect-planes and improvement-plan docs and two host tests.

No conflicts. README.md, README.zh-CN.md, docs/improvement-plan.md and
docs/redirect-planes.md were changed on both sides and merged cleanly in
separate hunks: this branch's refusal reporting rows and plan entries
beside the parent's catalog counts. The merged tree is this branch's own
change (ef74a26..0f97615) applied unchanged on top of the parent
(f36e849); the lockfiles and pnpm-workspace.yaml are the parent's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
…to claude/vigilant-mendel-bctz9n-p5

P-R3 now carries main's #181 (vite-plus 1.5.0 -> 1.6.0, oxlint 1.93,
both lockfiles relocked, two helpers moved to .then().catch()) and the
#182 catalog refresh (Zen 89, Go 34, Go limits 30) with its README pair,
routing and redirect-planes counts and the test subjects that moved.

No conflicts. README.md, README.zh-CN.md and docs/improvement-plan.md
auto-merged: P5 adds the usage-settings bullet to the README pair and
its P5 rows and sections to the plan; P-R3 changes the model counts and
lists in the README pair and one P-R2 restack sentence in the plan.
Each side's hunks are kept as written. The merged tree is P5's own
change (0f97615..6c599a5) on top of 71316be, line for line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
… claude/vigilant-mendel-bctz9n-p6

The new parent carries main's #181 (vite-plus and vite-plus-core 1.6.0,
oxlint 1.93, oxfmt 0.78, both lockfiles relocked, two test helpers
rewritten as .then().catch()) and the catalog refresh #182 (Zen 89, Go 34,
Go limits 30 models) with its follow-through in the README pair, the
protocol-routing and redirect-planes docs and two host tests.

No conflicts. README.md, README.zh-CN.md, docs/improvement-plan.md,
docs/redirect-planes.md and test/host-planes-foreign.test.ts merged
automatically: P6 and the parent touched different hunks of each. Both
lockfiles and pnpm-workspace.yaml come from the parent unchanged, since
P6 changes no dependency. The merged tree is P6's own change
(6c599a5..c424b21) on top of the parent, hunk for hunk; only a line
offset in test/host-planes-foreign.test.ts moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
… claude/vigilant-mendel-bctz9n-p7

One file conflicted:

- docs/protocol-routing-and-merge.md, the section 1 shape table: the
  parent recounted every row for the refresh (27 -> 28 of 89 for the
  default completions row, and 88 -> 89 in every denominator), while P7
  relabelled the @ai-sdk/mistral row from "as pi files it" to "the
  plugin's own rule". Kept P7's label and took the refresh's counts, so
  the row reads "(the plugin's own rule) ... 1 of 89".

Auto-merged without conflict, checked to differ from the parent by P7's
own change only: README.md and README.zh-CN.md (P7's mistral cell beside
the refresh's 89 and 2026-11-16), docs/redirect-planes.md (P7's mistral
rationale beside the refresh's counts and lists), and
docs/improvement-plan.md. The lockfiles and pnpm-workspace.yaml are the
parent's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
History only: main's tree equals the p6 tree (0834b63) this branch already contains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Every setting now lives in one table, src/settings-table.ts: a row per
key with its kind, default, choice values, volatility and card group
(SETTINGS), and the host-only prose beside it (SETTING_PROSE), which the
client bundle never carries. config.ts derives the schema, resolver,
types, defaults and config-only list from it, settings-fields.ts the
card specs, settings-copy.ts checks its copy keys against it, and a
manifest test holds cordis.patch.yml's header to it by order, type
label, stated default and choice values. Before, these were four
hand-kept copies that could drift apart.

The schema, resolver and card were pinned on the untouched tree first
and land unchanged but for the named edits. Fifteen copy keys that
nothing read and the meter's unused modelMarkers prop are deleted, and
the zh README now names the card by the package's own title. The card
says once above its controls that its settings apply when the plugin is
applied again, as both READMEs do, and a real-host test performs that
in both host channels. The catalog's lastError on the card is carried
to P10b.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
History only: main's tree equals the p7 tree (121bd6d) this branch already contains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
The three remote contracts (usage, purge, store inspection) each carried
a hand-written descriptor literal, each host service a hand-written
remote-methods marker, and each of the four client callers its own
unwrap of the answer. Every copy differed a little.

- src/contracts/remote.ts adds defineRemote, which derives each
  descriptor and codec from a namespace and its methods. The three
  contract modules move into src/contracts/, and REMOTE_CONTRACTS in
  src/contracts/all.ts is the one list the client mounts.
- markRemote in src/host/remote.ts writes a service's marker from its
  contract, so the marker key has one copy and a class must implement
  every contract method.
- src/settings-remote.ts gains findRemoteCall, unwrapRemote and
  callRemote. unwrapRemote is the one unwrap of all four callers; the
  purge and store rows go through callRemote, and the settings summary
  and the meter keep their arity retry between the find and the unwrap.
  Caller return types are unchanged, so no rendering module changes.
- isGoUsage is deleted; USAGE_NAMESPACE and parseUsageReading (a
  superset of the vendor whitelist that keeps the fields the service
  attaches) are added.
- remote-contract reads the contracts and the mounted services instead
  of matching source text.

The differences that remain are on answer shapes the host's RemoteResult
cannot carry, each pinned by a case: the store row shows an
envelope-level message or a string error, purge no longer reads a
refusal nested in a value, the summary and the meter keep the
whitelisted copy of a valid reading, and a throwing remote getter on a
lookup miss answers "unavailable" instead of throwing. No webServer
route appeared, so the loopback guard planned for this phase is not
built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
History only: main's tree equals the p8 tree (7e54c1b) this branch already contains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141fKp5k6hiaJcP5ovhGtSD
@viztor
viztor changed the base branch from claude/vigilant-mendel-bctz9n-p8 to main November 16, 2026 22:15
@viztor
viztor merged commit 854b67a into main Nov 16, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants