From b850b4d5d96ee7c3b1cbc81fb3d4382b25cdc0b7 Mon Sep 17 00:00:00 2001 From: Jack Chen Date: Thu, 23 Apr 2026 19:23:52 +0800 Subject: [PATCH] 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). --- src/types.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/types.ts b/src/types.ts index c4e4572..24d3536 100644 --- a/src/types.ts +++ b/src/types.ts @@ -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 /**