Skip to content

docs: model source registry proposal - #622

Open
Logan Ramos (lramos15) wants to merge 7 commits into
mainfrom
lramos15/model-provider-customizations
Open

Logan Ramos (lramos15) wants to merge 7 commits into
mainfrom
lramos15/model-provider-customizations

Conversation

@lramos15

@lramos15 Logan Ramos (lramos15) commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Refs #619

Adds docs/proposals/model-source-registry.md, which lets clients register bring-your-own-key model sources with an agent host:

  • Registrations live in root state (RootState.modelSourceRegistrations). The host reports each one's status (starting, ready, authRequired, error) with a host-only action, like session/mcpServerStateChanged.
  • Clients add and remove them with two client-dispatchable root actions. An agent advertises modelSourceRegistration with the definition formats it reads.
  • A client delivers the key with authenticate and a modelSource target. The host keeps it in memory only.
  • Ready sources and their models join the agent's catalog from models: add model sources to agent catalogs #543, so sessions, new-session pickers, and automations select them by id.
  • Like MCP servers, registrations have no per-client ownership: any connected client can use, change, or remove one. The contributing client chooses only whether a source stays after it disconnects (retention), which defaults to no.

Docs only. No types/ changes. Builds on #543. The implementation in #627 is being updated to match.

Changes from the previous revision

The previous revision made each source a session-scoped plugin customization. Review pointed out that BYOK configuration belongs to the user, not a session, and that automations and long-running headless sessions need sources that outlive one client's session. A host-wide registry covers both and shows the models before any session exists. Rules settled while implementing the previous revision carry over: a required modelSource target, a resumable error when a credential fails mid-turn, reserved model IDs, endpoints in any URL scheme, and best-effort redaction of tool output.

Validation

Command Result
npm test 667 passed
npm run generate:docs && npm run docs:versions && npx vitepress build docs Passed; both diagrams checked in vitepress preview

@lramos15 Logan Ramos (lramos15) changed the title docs: model provider customizations proposal docs: model source customizations proposal Nov 20, 2026
@lramos15
Logan Ramos (lramos15) requested a balanced review from Copilot November 20, 2026 18:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 authenticate target, 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 <223556219+Copilot@users.noreply.github.com>
@lramos15
Logan Ramos (lramos15) force-pushed the lramos15/model-provider-customizations branch from 550b354 to a528f3f Compare November 23, 2026 22:52
@lramos15 Logan Ramos (lramos15) changed the title docs: model source customizations proposal docs: model source registry proposal Nov 23, 2026
Logan Ramos (lramos15) added a commit that referenced this pull request Nov 23, 2026
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 <223556219+Copilot@users.noreply.github.com>
@lramos15
Logan Ramos (lramos15) requested a balanced review from Copilot November 23, 2026 23:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved registration rules can reject valid updates and removals, while stale authentication responses can attach old credentials to a changed definition.

3 open issues
1 resolved since last review

Review effort: Balanced

Comment thread docs/proposals/model-source-registry.md Resolved
Comment thread docs/proposals/model-source-registry.md Resolved
Comment thread docs/proposals/model-source-registry.md Resolved
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 <223556219+Copilot@users.noreply.github.com>
- 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 <223556219+Copilot@users.noreply.github.com>
Logan Ramos (lramos15) added a commit that referenced this pull request Nov 24, 2026
- `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 <223556219+Copilot@users.noreply.github.com>
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 <223556219+Copilot@users.noreply.github.com>
Refs #619

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread docs/proposals/model-source-registry.md Resolved
Comment thread docs/proposals/model-source-registry.md Resolved
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 <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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