Repository navigation
docs: model source registry proposal - #622
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Model IDs can be reused after withdrawal or authentication changes, allowing retained selections to send prompts to a different service instead of failing safely.
1 open issue
What changed in this PR
Adds a docs-only proposal for session-scoped, bring-your-own-key model sources delivered through plugins. It builds on #619 and #543 without changing protocol types or generated clients.
Changes:
- Sketches customization states, an
authenticatetarget, and ID-based model selection. - Defines lifecycle behavior, credential safeguards, and withdrawal rules that prohibit model fallback.
- Documents compatibility, implementation touchpoints, and open design questions.
| File | Description |
|---|---|
docs/proposals/model-source-customizations.md |
Proposes plugin-contributed model sources, authentication, selection, and lifecycle rules. |
Review effort: Balanced
Propose a docs-only design for #619: clients register bring-your-own-key model sources with an agent host. Registrations live in root state with a host-reported status, a sharing policy, and a retention policy. Clients add and remove them with client-dispatchable root actions, deliver keys through `authenticate` with a `modelSource` target, and select their models from #543's agent catalog by `id`. A host-wide registry lets automations and long-running headless sessions keep using a source after its client disconnects, and shows the models before any session exists. No `types/` changes, so no regeneration and no changelog fragment. Refs #619 Co-authored-by: Copilot <[email protected]>
550b354 to
a528f3f
Compare
Implements the host-wide model source registry from the model source registry proposal (#622): - `RootState.modelSourceRegistrations` with `ModelSourceRegistration`, its sharing and retention policies, and the `starting`, `ready`, `authRequired`, and `error` states. - Client-dispatchable `root/modelSourceRegistrationSet` and `root/modelSourceRegistrationRemoved` actions (introduced in 1.2.0) with root reducers in TypeScript and every client. - `AgentCapabilities.modelSourceRegistration` listing the definition formats an agent reads. - A `modelSource` `authenticate` target for delivering a registered source's credential. - Generator registration, reducer and round-trip fixtures, spec and naming docs, and changelog fragments. Refs #619 Co-authored-by: Copilot <[email protected]>
Validate a client-dispatched `Set` on its payload and authorize a `Removed` against the stored registration only, keeping removal of an unknown ID a no-op. The catalog collision check now ignores the entry the host publishes for the same registration, so a ready registration can still be updated or removed. Add a host-issued `credentialNonce` to each registration, echoed in the `modelSource` authenticate target. The host issues a new one whenever it drops the credential because the registration changed, and rejects a stale one with `Conflict`, so a delayed key for an old definition never reaches a new one. Refs #619 Co-authored-by: Copilot <[email protected]>
- The host builds status updates from the current registration, so a late result can't undo a change or bring back a removed source. - Revocation reports `reason: expired`, so no client replays the revoked secret. - A model's upstream identity is its endpoint plus the endpoint's model identifier. Moving the endpoint mints new model IDs. - A client sends a stored secret only when the registration matches its own copy, and the host writes status descriptions and errors itself. - Restored registrations start in `starting`, untargeted model source credentials are rejected, and the credential drop list names every field that drops it. Refs #619 Co-authored-by: Copilot <[email protected]>
- `ModelSourceRegistration.credentialNonce` and the required `ModelSourceAuthenticateTarget.credentialNonce`, so a delayed `authenticate` can't reach a changed definition. The host rejects a stale nonce with `Conflict`. - Specs follow #622: `Removed` is checked only against the stored registration, status updates are built from the current registration, revocation reports `reason: expired`, moving the endpoint mints new model IDs, clients send a stored secret only when the definition matches their copy, and the host writes status text and errors itself. - Untargeted model source credentials are rejected with `InvalidParams`, and `ProtectedResourceMetadata.resource` notes the model source scheme exception. - Renumber the registry round-trip fixtures after main's new fixture, align the Azure fixture's resource with its endpoint, and note the TypeScript `AuthenticateTarget` narrowing in the migration fragment. Refs #619 Co-authored-by: Copilot <[email protected]>
Like MCP servers, registrations have no per-client ownership: any client can use, change, or remove one and supply its credential. Remove the sharing policy, takeover, and permission checks, and keep retention as the one per-registration choice. A registration's `clientId` records who last wrote it. Report status with a host-only `root/modelSourceStateChanged` action, modeled on `session/mcpServerStateChanged`, instead of writing the whole registration back. Its reducer ignores unknown IDs, so a late status can't revive a removed registration or overwrite a newer definition. Issue a new `credentialNonce` on every credential change, including rotation, expiry, and revocation, and ignore failures from requests made with an older key. Refs #619 Co-authored-by: Copilot <[email protected]>
Refs #619 Co-authored-by: Copilot <[email protected]>
Once a registration has been ready, the host keeps its models listed through `starting` and `authRequired`, so a key rotation or expiry doesn't change the catalog or break a selection. It withdraws them on removal, when the contributing client leaves under `contributingClient` retention, on `error`, or when a change mints new model IDs. A turn that starts without a usable credential ends with a resumable error, like a mid-turn credential failure. This settles the open question about the catalog across a re-auth. Refs #619 Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Authentication metadata is unavailable to clients connecting after a source becomes ready, preventing credential revocation, and stale discovery results can incorrectly mark recreated or updated registrations ready.
2 open issues
3 resolved since last review
Review effort: Balanced
Treat `credentialNonce` as the registration's generation. The host issues a new one when a registration is added or its provider, format, or definition changes, even with no credential held, as well as on every credential change. It tags every agent operation with the current nonce and discards any result with an older one, so a late result can't mark a re-registered or reverted registration ready. Move the credential's RFC 9728 metadata from the `authRequired` state to a host-reported `credentialResource` on the registration, kept in every state. A client that connects while a source is ready can then rotate or revoke its credential. `ModelSourceAuthRequirement` keeps `reason` and `description`. Refs #619 Co-authored-by: Copilot <[email protected]>
Address the cross-model review of the registry design: - A registration lists its contributing clients. `Set` adds, joins an unchanged definition without disturbing host-reported fields, or replaces a changed one. A new `root/modelSourceContributorRemoved` withdraws one client's contribution. A `contributingClient` source goes away when its last contributor leaves, and the last explicit withdrawal removes a source whatever its retention. - `credentialId` names the key the host holds, and `credentialOrigins` lists every origin it's sent to. Model sources get their own auth reasons: required, expired, rejected, and revoked. - Clients never cache or replay a credential, and deliver one only in answer to the registration's state. Endpoints resolve on the host, and hosts SHOULD apply an egress policy. - Withdrawal, removal, and revocation stop work at once, and turns on an unavailable source end with a resumable `modelSourceUnavailable` error. `expiresIn` on a static key is a lease. - The capability advertises the contributor grace period and whether the registry is shared across principals. - Model IDs SHOULD be derived deterministically. `modelSourceId` alone doesn't mark a registered source. Rename `name` to `displayName`. - AHP doesn't define, standardize, or name any definition format, and AHP does have host-to-client requests. Refs #619 Co-authored-by: Copilot <[email protected]>
Definitions are compared with numbers by numeric value, so every client's reducer agrees on whether a `Set` joins or replaces. A restart drops a host-retained source's credential rather than the source. Refs #619 Co-authored-by: Copilot <[email protected]>
…istry Implement the reworked registry from #622: - `ModelSourceRegistration.contributingClientIds` replaces `clientId`. `root/modelSourceRegistrationSet` gains `clientId` and adds, joins an unchanged routing (keeping every host-reported field), or replaces a changed one. Definitions compare as JSON values, ignoring key order and comparing numbers by value. The new client-dispatchable `root/modelSourceContributorRemoved` withdraws one contribution. - Host-reported `credentialOrigins` and `credentialId` on the registration and on `root/modelSourceStateChanged`, and an optional `credentialId` on the `modelSource` authenticate target. - `ModelSourceAuthRequiredReason` (required, expired, rejected, revoked) replaces the shared `AuthRequiredReason` for model sources. - `ModelSourceRegistrationCapability` gains `gracePeriod` and `principalPolicy` (`ModelSourcePrincipalPolicy`: shared, isolated). - `ErrorInfo.errorType` documents the well-known `modelSourceUnavailable` value. - Reducers in TypeScript and every client, regenerated fixtures for every branch, and the root channel, authentication, naming, and guide docs. Refs #619 Co-authored-by: Copilot <[email protected]>
Rename `RootState.modelSourceRegistrations` to `modelSources`, the `ModelSourceRegistration` type to `ModelSource`, and the actions to `root/modelSourceSet` and `root/modelSourceRemoved`. Drop client IDs from the registry. The host learns who registered a source from `ActionEnvelope.origin` and tracks contributing clients itself, so `contributingClientIds`, the `clientId` on `Set`, and `root/modelSourceContributorRemoved` go away. Removal applies to every client. Keep the definition out of state. It travels on `root/modelSourceSet`, and the source carries a `nonce` instead, like `ClientPluginCustomization.nonce`. Reducers compare provider, format, and nonce to tell a re-registration from an update, which replaces the JSON comparison of definitions. Clients check where a key goes with the host-reported `credentialOrigins`. Reuse `authenticate`'s existing `accountId` instead of a new `credentialId` target field, and note that host-owned authentication may later supersede it. Suggest recognized `format` values such as `openaiCompatible`, and explain that built-in sources stay agent-declared. Refs #619 Co-authored-by: Copilot <[email protected]>
|
Comment |
Implement #622's response to review: - Rename `RootState.modelSourceRegistrations` to `modelSources`, `ModelSourceRegistration` to `ModelSource`, and the actions to `root/modelSourceSet` and `root/modelSourceRemoved`. - Drop client IDs from the registry: no `contributingClientIds`, no `clientId` on `Set`, and no `root/modelSourceContributorRemoved`. The host tracks contributing clients from `ActionEnvelope.origin`. - `root/modelSourceSet` carries `{ modelSource, definition }`, and the reducer stores the source without the definition. `ModelSource` gains a required `nonce`. Reducers compare provider, format, and nonce to tell a re-registration from an update, replacing the JSON comparison of definitions in TypeScript and every client. - Replace `credentialId` with `authenticate`'s existing `accountId`, published as `ModelSource.accountId`. - Document recognized `format` values (`openaiCompatible`, `anthropic`, `azureOpenai`, `gemini`) and built-in sources. - Regenerate clients, replace the reducer fixtures with one per branch, and update the round-trip fixtures, specs, naming dictionary, guide, and changelog fragments. Refs #619 Co-authored-by: Copilot <[email protected]>
Address the second round of registry review: - Put `definition` back on `ModelSource` so clients can see a source's endpoint, with suggested shapes for each recognized format. `nonce` still versions it for reducers. - Drop `credentialOrigins`; clients check the definition itself. - Drop the host-issued `credentialNonce` and its `Conflict` fencing; the `modelSource` target names only the source, as MCP's does. - Make `formats` a list of `ModelSourceFormatInfo` objects so the capability can grow. - Drop `gracePeriod` and `principalPolicy` from the capability; both stay host policy. Co-authored-by: Copilot <[email protected]>
|
Heads-up: #543 now has a general stable-ID rule, from Connor's review (6199969a). A host SHOULD keep a model's ID across catalog updates and MUST NOT reuse an ID for a different source or upstream model, even after the model leaves This proposal's Reserved model IDs rule in §4.5 already fits it. It's the stricter version for registered sources: it adds host restarts and defines a model's upstream identity. Nothing here needs to change. If you touch the proposal again, two spots could mention the general rule:
|
Implements #622 at f30b11a: - `ModelSource.definition` is back in state, with suggested shapes for the recognized formats documented on it. `root/modelSourceSet` carries only `modelSource`. Reducers still compare `provider`, `format`, and `nonce`. - Remove `credentialNonce` and `credentialOrigins` from `ModelSource`, `root/modelSourceStateChanged`, and the `modelSource` authenticate target. - `ModelSourceRegistrationCapability.formats` lists `ModelSourceFormatInfo` objects. Remove `gracePeriod`, `principalPolicy`, and `ModelSourcePrincipalPolicy`, which are now host policy. Updates the generators, client reducers, fixtures, specs, naming dictionary, and changelog fragment to match. Co-authored-by: Copilot <[email protected]>


Refs #619
Adds
docs/proposals/model-source-registry.md, which lets clients register bring-your-own-key (BYOK) model sources with an agent host, so the host can serve those models to sessions and automations.RootState.modelSources. A client registers one withroot/modelSourceSet. The source carries its definition, so any client can see its endpoint, and anoncethat versions it. Registering an unchanged source again, from another window or device, keeps its status and key.starting,ready,authRequired, orerrorwith a host-only action, likesession/mcpServerStateChanged.authenticateand amodelSourcetarget. The host keeps keys in memory only and sends each one only to the endpoints its source's definition names. Clients never cache or replay a key.id.openaiCompatibleandanthropic, and a definition shape for each, but doesn't validate definitions.Docs only. Builds on #543, and #627 implements it.
History
An earlier revision made each source a session-scoped plugin customization. A host-wide registry also serves automations and headless sessions, and shows models before any session exists. Later reviews added separate auth reasons and rules for an unavailable source, simplified ownership so that state carries no client IDs, and dropped host-issued credential fencing and host policy from the capability.
Validation
npm test(667 passed) andnpm run generate:docs && npm run docs:versions && npx vitepress build docspassed, and both diagrams and every in-page link were checked invitepress preview.