feat(agent-core): ModelProvider interface and SingleModelProvider - #167
Conversation
🦋 Changeset detectedLatest commit: 2fa39d1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ModelProvider interface and SingleModelProvider
ModelProvider interface and SingleModelProviderModelProvider interface and SingleModelProvider
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4620122725
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| resolveProviderConfig(model: string): ResolvedRuntimeProvider { | ||
| if (model !== this.providerConfig.model) { | ||
| throw new Error(`Model "${model}" is not supported by SingleModelProvider.`); |
There was a problem hiding this comment.
Return a KimiError for unsupported standalone models
When a standalone agent uses SingleModelProvider and the caller selects any other model (for example via setModel), this plain Error crosses the RPC boundary as ErrorCodes.INTERNAL instead of the model-configuration error that the ProviderManager path returns. That makes a simple unsupported-model selection look like an internal failure to SDK/TUI callers. Please throw a KimiError with the appropriate config/model code here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0680d4012d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Summary
Decouple
AgentfromProviderManagerby introducing aModelProviderinterface, so thatAgentcan be constructed independently of a fullSession/ProviderManagerlifecycle.What changed
ModelProviderinterface – abstracts model resolution and optional auth away fromProviderManager.SingleModelProvider– a lightweight implementation for single-model scenarios (e.g. headless tests or standalone agents).ProviderManagernow implementsModelProvider– existing session-based behavior is preserved.Agentconstructor updates:providerManager→modelProvider(type changed toModelProvider).skillsis nowSkillManager | nullinstead ofSkillManager | undefined.cronSessionDiroption.modelNamefromResolvedRuntimeProvider– callers already have the alias, so the field was redundant.createAuthResolverForModel→resolveAuthonModelProvider.modelProviderfield.Why
Previously
Agentrequired aProviderManagerinstance, which in turn needs a fullSessionsetup. This made it impossible to construct a usableAgentoutside of a session. WithModelProvider,Agentbecomes independently constructable – useful for testing, sub-agents, and future headless modes.