Source the Claude Code model catalog from the t3code manifest - #439
Merged
Merged
Conversation
Replace the hand-written Claude catalog (models, option descriptors, effort special cases, version gates and the [1m]/context-window table) with the t3code model manifest. A verbatim copy is bundled as the offline fallback; `list_models` refreshes it from t3code main at most hourly (5 min back-off, 10 s timeout, 1 MiB cap), caches the last good copy in the data dir, and skips the network when provider update checks are disabled. A bundle newer by `updatedAt` outranks the cache, and invalid data never replaces a usable manifest. The manifest's `effort` id is translated to `reasoningEffort` at the boundary; effortMap drives the --effort flag, modelSuffixes the [1m] suffix, and contextWindowTokens/fixedContextWindowTokens the window a selection resolves to. Upstream data is adopted wholesale, so some defaults change (Fable 5.1 effort medium, Sonnet 5 window 200k, Opus 4.7 and 4.8 fixed 1M without a selector, fastMode on Opus 4.5–4.8 and Opus 5). Also initialises the `title_generating` field in a sidebar test fixture that no longer compiled after #428.
3 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
Claude Code's model catalog is no longer hand-written in
claude.rs. It is resolved from the t3code project'smodel-manifest.json(MIT), which lists each model's slug, name, option descriptors (effort levels with defaults, fast mode, context window), Claude CLI min/max version, and the launch adapter mappings (effortMap,[1m]suffix, context window tokens).crates/agent/src/claude_manifest.rsis the single owner: serde decode of the fields tcode reads, validation (version, unique slugs, profile references, semver bounds, non-empty ids), resolution toModelSpec, and the refresh.claude_model_manifest.json) as the offline fallback. At runtime, under theprocessfeature, the same file is fetched fromraw.githubusercontent.comat most once per hour (5 min back-off after failure, 10 s timeout, 1 MiB cap) and the last good copy is cached in the data dir. A bundle newer byupdatedAtoutranks the cache. Invalid data never replaces a usable catalog; the network never failslist_models.built_in_models,model_available,normalize_claude_cli_effort, the native context-window table and the descriptor builder helpers. Manifesteffortis translated to tcode'sreasoningEffortin one place; everything in the UI is unchanged.list_modelstakes aCatalogRefresh { cache_dir, network }supplied by the runtime's existing provider refresh path.Upstream data is adopted wholesale; there is no local override table.
User-visible differences (from adopting upstream data)
autoCompactWindow200000).<slug>[1m]; verified with claude 2.1.272 that the CLI accepts it and reports the same 1M window.Tests
Synthetic manifest tests cover: descriptor mapping (defaults, boolean, unknown descriptor types dropped), 11 invalid-manifest rejections, install keeps the previous catalog on invalid data, TTL/retry/network-off pacing including a clock moving backwards, disk cache adopted only when not older than the bundle, effortMap application (ultracode→xhigh, ultrathink→no flag, per-profile xhigh→max / max→high, passthrough), min/max version gating,
[1m]suffix andautoCompactWindowsemantics across window profiles.Checks run
cargo fmt --all --check— passcargo clippy --workspace --all-targets --locked -- -D warnings— passcargo build --workspace --locked— passcargo test --workspace --locked— pass (agent 182)cargo machete— no unused dependenciesRUSTFLAGS='-D warnings' cargo check -p tcode-web --target wasm32-unknown-unknown --locked— passcargo run -p agent --example probe -- claude "Reply with exactly: PONG" /tmp/smoke— PONG, context window 1000000; with--effort ultracodethe spawn args areeffort=xhigh settings={"ultracode":true}.Docs:
docs/claude-models.mddescribes the source and cache policy.