Model access is vendor-agnostic: rename provider→vendor, add adapter seam (Phase A)

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
This commit is contained in:
2026-09-06 23:49:12 +02:00
parent 671fb4f8f3
commit ddb41baaf4
6 changed files with 245 additions and 25 deletions
+5 -5
View File
@@ -47,9 +47,9 @@ func licenceAdd(ctx context.Context, args []string) error {
return err
}
if len(positionals) != 2 {
return errors.New(`licence add <provider> <name> [--serves '{"model":"..."}']`)
return errors.New(`licence add <vendor> <name> [--serves '{"model":"..."}']`)
}
provider, name := positionals[0], positionals[1]
vendor, name := positionals[0], positionals[1]
values := map[string]any{}
if strings.TrimSpace(*serves) != "" {
@@ -63,11 +63,11 @@ func licenceAdd(ctx context.Context, args []string) error {
return err
}
defer held.Close()
if err := held.Add(ctx, name, provider, values); err != nil {
if err := held.Add(ctx, name, vendor, values); err != nil {
return err
}
fmt.Printf("%s (%s) recorded. Nothing uses it yet, and it has no key:\n"+
" licence use %s <node> <module>\n licence key %s\n", name, provider, name, name)
" licence use %s <node> <module>\n licence key %s\n", name, vendor, name, name)
return nil
}
@@ -92,7 +92,7 @@ func licenceList(ctx context.Context) error {
if err != nil {
return err
}
fmt.Printf("%s (%s)\n", one.Name, one.Provider)
fmt.Printf("%s (%s)\n", one.Name, one.Vendor)
if len(holders) == 0 {
fmt.Printf(" nobody uses it\n")
}