Skip to main content

provider_class

Function provider_class 

Source
pub fn provider_class(provider: &str) -> Option<ProviderClass>
Expand description

Classify a provider id. None for unknown providers — the resolver logs and skips them.

reagent P1 on #2263: this used to match only canonical IDs directly, but backend/providers.rs registers aliases (gemini-cli→gemini, copilot-cli/github-copilot→copilot, claude-code→claude, etc.) that get_provider already resolves — meaning provider_class and get_provider could disagree on a definition/link still using an alias ID, silently skipping both the spawn gate and config-dir injection for it. Resolve to the canonical ID first so the two can never drift.

resolve_provider_alias only knows the CLI-tool registry (claude/codex/ gemini/etc.) — it returns "" as a sentinel for anything outside that registry, which includes the api-key-class service identifiers below (“github”/“anthropic”/“openai”/“kimi”/“aws” — a completely different namespace, not CLI tools). Only substitute the resolved value when it’s non-empty; otherwise keep matching on the original id so that namespace is untouched.