Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(claude): refresh Sonnet 5 model catalog (#805)
Call White83d6a1d45e13
diff --git a/modules/agents/opencode/utils.py b/modules/agents/opencode/utils.pyindex eff0b8846..7680ed24b 100644--- a/modules/agents/opencode/utils.py+++ b/modules/agents/opencode/utils.py@@ -442,6 +442,8 @@ def build_reasoning_effort_options(_CODEX_REASONING_EFFORTS = ["minimal", "low", "medium", "high", "xhigh"]_CLAUDE_REASONING_EFFORTS = ["low", "medium", "high"]_CLAUDE_1M_CONTEXT_LABEL = "[1M]"+_CLAUDE_OPUS_ALIASES = {"opus", "opus[1m]"}+_CLAUDE_SONNET_ALIASES = {"sonnet", "sonnet[1m]"}def _supports_claude_xhigh_reasoning(target_model: Optional[str]) -> bool:@@ -449,9 +451,11 @@ def _supports_claude_xhigh_reasoning(target_model: Optional[str]) -> bool:if not normalized_model:return Falsereturn (- normalized_model in {"opus", "opus[1m]"}+ normalized_model in _CLAUDE_OPUS_ALIASES+ or normalized_model in _CLAUDE_SONNET_ALIASESor normalized_model.startswith("claude-opus-4-7")or normalized_model.startswith("claude-opus-4-8")+ or normalized_model.startswith("claude-sonnet-5")or normalized_model.startswith("claude-fable-5"))@@ -461,10 +465,12 @@ def _supports_claude_max_reasoning(target_model: Optional[str]) -> bool:if not normalized_model:return Falsereturn (- normalized_model in {"opus", "opus[1m]"}+ normalized_model in _CLAUDE_OPUS_ALIASES+ or normalized_model in _CLAUDE_SONNET_ALIASESor normalized_model.startswith("claude-opus-4-6")or normalized_model.startswith("claude-opus-4-7")or normalized_model.startswith("claude-opus-4-8")+ or normalized_model.startswith("claude-sonnet-5")or normalized_model.startswith("claude-sonnet-4-6")or normalized_model.startswith("claude-fable-5"))@@ -475,10 +481,12 @@ def supports_claude_1m_context(target_model: Optional[str]) -> bool:if not normalized_model:return Falsereturn (- normalized_model in {"opus", "opus[1m]", "sonnet", "sonnet[1m]"}+ normalized_model in _CLAUDE_OPUS_ALIASES+ or normalized_model in _CLAUDE_SONNET_ALIASESor normalized_model.startswith("claude-opus-4-6")or normalized_model.startswith("claude-opus-4-7")or normalized_model.startswith("claude-opus-4-8")+ or normalized_model.startswith("claude-sonnet-5")or normalized_model.startswith("claude-sonnet-4-6")or normalized_model.startswith("claude-fable-5"))@@ -515,8 +523,8 @@ def build_claude_reasoning_options(target_model: Optional[str]) -> List[Dict[str"""Return the canonical Claude reasoning-effort option list for a model.Claude currently supports `low` / `medium` / `high` broadly. Newer- Opus 4.7 and 4.8 models add `xhigh`; Opus 4.8, 4.7, 4.6, and- Sonnet 4.6 also support `max`.+ Opus 4.7, Opus 4.8, and Sonnet 5 models add `xhigh`; Opus 4.8,+ 4.7, 4.6, Sonnet 5, and Sonnet 4.6 also support `max`."""efforts = list(_CLAUDE_REASONING_EFFORTS)diff --git a/tests/test_claude_model_catalog.py b/tests/test_claude_model_catalog.pyindex 4a91f9ccb..bf2d233d7 100644--- a/tests/test_claude_model_catalog.py+++ b/tests/test_claude_model_catalog.py@@ -13,6 +13,20 @@ def test_fable_is_tracked_in_catalog_and_fallback():assert "claude-fable-5" in FALLBACK_CLAUDE_MODELS+def test_sonnet_5_is_tracked_in_catalog_and_fallback():+ assert "claude-sonnet-5" in load_catalog_models()+ assert "claude-sonnet-5" in FALLBACK_CLAUDE_MODELS+++def test_catalog_excludes_dated_4_6_and_later_internal_ids():+ models = load_catalog_models()++ assert "claude-opus-4-6-20251101" not in models+ assert "claude-sonnet-4-6-20251114" not in models+ assert "claude-sonnet-5-20260630" not in sort_catalog_models(["claude-sonnet-5-20260630"])+ assert "claude-fable-5-20260609" not in sort_catalog_models(["claude-fable-5-20260609"])++def test_fable_sorts_above_other_families():ordered = sort_catalog_models([@@ -30,12 +44,21 @@ def test_fable_sorts_above_other_families():def test_bundle_inference_detects_fable_and_skips_mythos_preview(tmp_path):bundle = tmp_path / "cli.js"bundle.write_bytes(- b'pick("claude-fable-5");fallback="claude-opus-4-8";"claude-mythos-preview"'+ b'pick("claude-fable-5");fallback="claude-opus-4-8";'+ b'"claude-sonnet-5";"claude-opus-4-6-20251101";'+ b'"claude-sonnet-4-6-20251114";"claude-sonnet-5-20260630";'+ b'"claude-fable-5-20260609";"claude-mythos-preview"')models = infer_models_from_bundle(bundle)- assert models == ["claude-fable-5", "claude-opus-4-8"]+ assert models == ["claude-fable-5", "claude-opus-4-8", "claude-sonnet-5"]# `claude-mythos-preview` carries no version segment and is not a publicly# callable model, so it must not leak into the catalog.assert "claude-mythos-preview" not in models+ # Claude 4.6+ public IDs are dateless. Claude Code bundles may contain+ # dated internal identifiers, but Avibe must not surface them as choices.+ assert "claude-opus-4-6-20251101" not in models+ assert "claude-sonnet-4-6-20251114" not in models+ assert "claude-sonnet-5-20260630" not in models+ assert "claude-fable-5-20260609" not in modelsdiff --git a/tests/test_claude_reasoning_options.py b/tests/test_claude_reasoning_options.pyindex 06d3eb98a..b3d7a38da 100644--- a/tests/test_claude_reasoning_options.py+++ b/tests/test_claude_reasoning_options.py@@ -46,6 +46,19 @@ def test_claude_reasoning_options_add_xhigh_and_max_for_fable_5() -> None:assert [item["value"] for item in options] == ["__default__", "low", "medium", "high", "xhigh", "max"]+def test_claude_reasoning_options_add_xhigh_and_max_for_sonnet_5() -> None:+ options = build_claude_reasoning_options("claude-sonnet-5")++ assert [item["value"] for item in options] == ["__default__", "low", "medium", "high", "xhigh", "max"]+++def test_claude_reasoning_options_add_xhigh_and_max_for_sonnet_aliases() -> None:+ expected = ["__default__", "low", "medium", "high", "xhigh", "max"]++ assert [item["value"] for item in build_claude_reasoning_options("sonnet")] == expected+ assert [item["value"] for item in build_claude_reasoning_options("sonnet[1m]")] == expected++def test_claude_reasoning_options_add_max_for_opus_46() -> None:options = build_claude_reasoning_options("claude-opus-4-6")@@ -85,6 +98,12 @@ def test_normalize_claude_reasoning_effort_drops_invalid_efforts() -> None:assert normalize_claude_reasoning_effort("claude-opus-4-8", "xhigh") == "xhigh"assert normalize_claude_reasoning_effort("claude-opus-4-8", "max") == "max"assert normalize_claude_reasoning_effort("claude-opus-4-6", "max") == "max"+ assert normalize_claude_reasoning_effort("claude-sonnet-5", "xhigh") == "xhigh"+ assert normalize_claude_reasoning_effort("claude-sonnet-5", "max") == "max"+ assert normalize_claude_reasoning_effort("sonnet", "xhigh") == "xhigh"+ assert normalize_claude_reasoning_effort("sonnet", "max") == "max"+ assert normalize_claude_reasoning_effort("sonnet[1m]", "xhigh") == "xhigh"+ assert normalize_claude_reasoning_effort("sonnet[1m]", "max") == "max"assert normalize_claude_reasoning_effort("claude-sonnet-4-6", "max") == "max"assert normalize_claude_reasoning_effort("claude-fable-5", "xhigh") == "xhigh"assert normalize_claude_reasoning_effort("claude-fable-5", "max") == "max"@@ -96,6 +115,7 @@ def test_claude_1m_context_labels() -> None:assert format_claude_model_label("claude-opus-4-8") == "claude-opus-4-8 [1M]"assert format_claude_model_label("claude-opus-4-7") == "claude-opus-4-7 [1M]"assert format_claude_model_label("claude-opus-4-6") == "claude-opus-4-6 [1M]"+ assert format_claude_model_label("claude-sonnet-5") == "claude-sonnet-5 [1M]"assert format_claude_model_label("claude-sonnet-4-6") == "claude-sonnet-4-6 [1M]"assert format_claude_model_label("claude-fable-5") == "claude-fable-5 [1M]"assert format_claude_model_label("opus[1m]") == "opus[1m] [1M]"diff --git a/vibe/claude_model_catalog.py b/vibe/claude_model_catalog.pyindex 7acdae93d..537b1d28e 100644--- a/vibe/claude_model_catalog.py+++ b/vibe/claude_model_catalog.py@@ -12,6 +12,7 @@ FALLBACK_CLAUDE_MODELS: tuple[str, ...] = ("claude-opus-4-8","claude-opus-4-7","claude-opus-4-6",+ "claude-sonnet-5","claude-sonnet-4-6","claude-haiku-4-5","claude-opus-4-5",@@ -72,12 +73,14 @@ def infer_models_from_bundle(bundle_path: Path) -> list[str]:matches: set[str] = set()with bundle_path.open("rb") as handle, mmap.mmap(handle.fileno(), 0, access=mmap.ACCESS_READ) as mapped:for match in _CLAUDE_MODEL_PATTERN.finditer(mapped):- matches.add(match.group(0).decode("utf-8"))+ model = match.group(0).decode("utf-8")+ if _is_public_catalog_model(model):+ matches.add(model)return sort_catalog_models(matches)def sort_catalog_models(models: Iterable[str]) -> list[str]:- normalized = _dedupe_str_values(models)+ normalized = [model for model in _dedupe_str_values(models) if _is_public_catalog_model(model)]def sort_key(model: str) -> tuple[int, tuple[int, ...], str]:parts = model.split("-")@@ -114,3 +117,22 @@ def _dedupe_str_values(values: Iterable[str]) -> list[str]:seen.add(candidate)normalized.append(candidate)return normalized+++def _is_public_catalog_model(model: str) -> bool:+ parts = model.split("-")+ if len(parts) >= 4 and parts[-1].isdigit() and len(parts[-1]) == 8:+ major = _int_or_none(parts[2])+ minor = _int_or_none(parts[3]) if len(parts) >= 5 else None+ if major is not None and major >= 5:+ return False+ if major is not None and minor is not None and (major, minor) >= (4, 6):+ return False+ return True+++def _int_or_none(value: str) -> int | None:+ try:+ return int(value)+ except ValueError:+ return Nonediff --git a/vibe/data/claude_models.json b/vibe/data/claude_models.jsonindex 5f164c338..3430e83ed 100644--- a/vibe/data/claude_models.json+++ b/vibe/data/claude_models.json@@ -6,18 +6,17 @@"claude-opus-4-8","claude-opus-4-7","claude-opus-4-6",- "claude-opus-4-6-20251101","claude-opus-4-5","claude-opus-4-5-20251101","claude-opus-4-1","claude-opus-4-1-20250805","claude-opus-4-0",+ "claude-sonnet-5","claude-sonnet-4","claude-sonnet-4-20250514","claude-sonnet-4-6","claude-sonnet-4-5","claude-sonnet-4-5-20250929",- "claude-sonnet-4-5-20250514","claude-sonnet-4-0","claude-sonnet-3-7","claude-haiku-4",