Expand description
Provider + model resolution. Mirrors the Anthropic-only slice of the TS
packages/coding-agent/src/core/model-resolver.ts (resolveCliModel +
the provider/id[:thinking] parsing in crate::args).
v1 is Anthropic-only (plan §5.16: “OAuth/Copilot skipped v1; API-key auth
only”). The TS ModelRuntime/ModelRegistry multi-provider machinery is
not ported; this module builds a single AnthropicProvider from an API
key and resolves a Model + ThinkingLevel against its fixed catalog.
§Resolution precedence (mirrors resolveCliModel)
--modelmay carryprovider/id[:thinking]. If the prefix before the first/is the provider (anthropic), strip it and parse the rest asid[:thinking].- Otherwise treat
--modelasid[:thinking]: if a trailing:levelis a valid thinking level, strip it and apply it (overriding--thinking); else the whole string is the id. - A
--providerthat isn’tanthropicis a hard error (v1 has no other provider).--provider anthropicis accepted and just confirms the default. - The model id is matched exactly, case-insensitively against the
catalog. The TS resolver additionally does fuzzy/partial matching; v1
keeps it exact to avoid surprising model picks (partial match is a common
source of “got the wrong model” bugs — documented as a divergence in
docs/m6-cli-open-questions.md). - No
--model⇒ the default (DEFAULT_MODEL_ID=claude-sonnet-5), mirroring the TS per-provider default.
Structs§
- Resolved
Model - The resolved run configuration: the provider handle, the chosen model, and
the effective thinking level (after
--thinking/:level/ model-clamp).
Enums§
- Resolve
Error - A resolution error. The TS resolver returns
{ error, warning }; v1 folds both into a single enum since the CLI treats them the same (print + non-zero exit) exceptNoApiKey, which prints guidance then exits.
Constants§
- ANTHROPIC_
API_ KEY_ ENV - The env var consulted for the API key. Mirrors TS
ANTHROPIC_API_KEY. - DEFAULT_
MODEL_ ID - The v1-default model id when
--modelis absent. Mirrors the TSdefaultModelPerProvider["anthropic"](the first current-generation reasoning model in the catalog). - DEFAULT_
THINKING_ LEVEL - The default thinking level when neither
--thinkingnor a:levelsuffix is present. Mirrors the TSDEFAULT_THINKING_LEVEL("medium", clamped to model capabilities by the harness’s provider build_params).
Functions§
- resolve
- Resolve the provider + model + thinking level from the CLI flags + env.