fix: widen provider type to SupportedProvider on AgentConfig/CoordinatorConfig/OrchestratorConfig (#158)

`AgentConfig.provider`, `CoordinatorConfig.provider`, and
`OrchestratorConfig.defaultProvider` were typed as a narrow 5-provider
union (anthropic/copilot/grok/openai/gemini) while `createAdapter()`
already accepts the full 8-provider `SupportedProvider` union (adds
azure-openai/deepseek/minimax). This forced users to cast when passing
valid providers.

Widens the three fields to reference `SupportedProvider` directly. Fully
additive: no narrowing of previously valid usage.

Surfaced in #153 review (Engram integration example used
`as AgentProvider` to work around the narrow type).
This commit is contained in:
Jack Chen 2026-04-23 19:23:52 +08:00 committed by GitHub
parent 4fefaa8a78
commit b850b4d5d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -6,6 +6,7 @@
*/
import type { ZodSchema } from 'zod'
import type { SupportedProvider } from './llm/adapter.js'
// ---------------------------------------------------------------------------
// Content blocks
@ -269,7 +270,7 @@ export interface BeforeRunHookContext {
export interface AgentConfig {
readonly name: string
readonly model: string
readonly provider?: 'anthropic' | 'copilot' | 'grok' | 'openai' | 'gemini'
readonly provider?: SupportedProvider
/**
* Custom base URL for OpenAI-compatible APIs (Ollama, vLLM, LM Studio, etc.).
* Note: local servers that don't require auth still need `apiKey` set to a
@ -550,7 +551,7 @@ export interface OrchestratorConfig {
/** Maximum cumulative tokens (input + output) allowed per orchestrator run. */
readonly maxTokenBudget?: number
readonly defaultModel?: string
readonly defaultProvider?: 'anthropic' | 'copilot' | 'grok' | 'openai' | 'gemini'
readonly defaultProvider?: SupportedProvider
readonly defaultBaseURL?: string
readonly defaultApiKey?: string
readonly onProgress?: (event: OrchestratorEvent) => void
@ -583,7 +584,7 @@ export interface OrchestratorConfig {
export interface CoordinatorConfig {
/** Coordinator model. Defaults to `OrchestratorConfig.defaultModel`. */
readonly model?: string
readonly provider?: 'anthropic' | 'copilot' | 'grok' | 'openai' | 'gemini'
readonly provider?: SupportedProvider
readonly baseURL?: string
readonly apiKey?: string
/**