model-access A: provider→vendor + adapter dispatch + static-key (ADR 0050 foundation) #13

Merged
jschoubben merged 1 commits from feat/model-access-vendor into main 2026-09-06 22:02:28 +00:00
Owner

Phase A of vendor-agnostic model access (ADR 0050): the foundation the Anthropic, OpenAI and local adapters all ride.

  • provider→vendor on the licence's vendor field only (the unrelated provider-pin stays "provider"): Go structs/columns/CLI, the consolidated 0001 schema and a new guarded incremental 0002-vendor-not-provider.sql (the project's dual-write rule; no-op on a fresh DB, renames an existing one).
  • Adapter abstraction (internal/licences/adapters): an Adapter with Vendor()/Shape()/Accept()/Deliver(), a static-key impl (accept = the existing seal, deliver = identity — today's behaviour byte-for-byte), and optional capability interfaces Refresher/Identifier/UsageReader as the seam for Phase B (refreshable-grant) and ADR 0054 (usage). Dispatch by vendor via a registry; unknown vendor refused clearly.
  • The licence layer now Accepts and KeyFors through the adapter selected by the licence's vendor.

go build/go vet/make check (real Postgres, applies 0001+0002, exercises Accept→adapter and KeyFor→Deliver) all green. The in-mesh model-access bed (mesh.test.ts) needs no edits and is byte-identical for static-key; full end-to-end re-verification runs at Phase C with the real Anthropic adapter.

https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF

Phase A of vendor-agnostic model access (ADR 0050): the foundation the Anthropic, OpenAI and local adapters all ride. - **`provider`→`vendor`** on the licence's vendor field only (the unrelated provider-pin stays "provider"): Go structs/columns/CLI, the consolidated `0001` schema **and** a new guarded incremental `0002-vendor-not-provider.sql` (the project's dual-write rule; no-op on a fresh DB, renames an existing one). - **Adapter abstraction** (`internal/licences/adapters`): an `Adapter` with `Vendor()`/`Shape()`/`Accept()`/`Deliver()`, a `static-key` impl (accept = the existing seal, deliver = identity — today's behaviour byte-for-byte), and **optional capability interfaces** `Refresher`/`Identifier`/`UsageReader` as the seam for Phase B (refreshable-grant) and ADR 0054 (usage). Dispatch by `vendor` via a registry; unknown vendor refused clearly. - The licence layer now `Accept`s and `KeyFor`s through the adapter selected by the licence's vendor. `go build`/`go vet`/`make check` (real Postgres, applies 0001+0002, exercises Accept→adapter and KeyFor→Deliver) all green. The in-mesh model-access bed (mesh.test.ts) needs no edits and is byte-identical for static-key; full end-to-end re-verification runs at Phase C with the real Anthropic adapter. https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF
jschoubben added 1 commit 2026-09-06 22:02:22 +00:00
ADR 0050 Phase A. Rename the licence's `provider` field to `vendor` — the
inventory already uses "provider" for which node answers a brokered provision,
and one word must not carry two facts — and route the licence layer's sealing
and delivery through a per-vendor adapter selected by that field.

The rename touches the Go struct/params/SQL in internal/licences, the operator
CLI, and the schema: 0001 (the consolidated schema) now creates the column as
`vendor`; a new guarded 0002 renames it on a database that predates the change,
and is a no-op on a fresh one.

The adapter (internal/licences/adapters) has a `shape` and the two verbs a
static-key vendor needs — accept (the generic anonymous-box seal) and deliver
(the sealed blob unchanged). refresh/identity/usage are named as optional
capability interfaces so the refreshable-grant seam exists before its code.
A registry maps vendor→shape (anthropic→static-key for now, with a Phase-B
TODO to swap it to refreshable-grant); an unknown vendor is refused clearly.

Behaviour is unchanged from the operator's view except the field name.

Claude-Session: https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF
jschoubben merged commit 163200c4dd into main 2026-09-06 22:02:28 +00:00
jschoubben deleted branch feat/model-access-vendor 2026-09-06 22:02:28 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: novox/mesh-controller#13