Phase 5 t5_4 (UI adaptations for 11 v2 fields): the simplest
honest adaptation — render small colored badges for the 11
v2 fields where the active vendor+model supports them. Each
badge has a tooltip showing the field name.
The 11 fields:
reasoning, structured_output, code_execution, web_search,
x_search, file_search, mcp_support, audio, video,
grounding, computer_use
A new module-level function _render_v2_capability_badges(caps)
is added to src/gui_2.py (per the HARD RULE on no new
src/<thing>.py files). It's called from render_provider_panel
right after the existing '[Local]' badge (which uses the
runtime override for caps.local).
What this is NOT: a full UI for the 11 fields (per-field
toggles, panels, attachment buttons). Those are design-heavy
work and need their own track. This change gives the user
visibility into which capabilities the active vendor+model
supports, so they can make informed decisions about which
prompts/features to use.
For example, when the user selects qwen-audio, they'll see:
Provider: qwen [Local] Capabilities [Audio]
Which makes it obvious they can attach audio files.
Tests:
- 2 new tests in tests/test_vendor_capabilities.py:
* All 11 v2 fields are present in the helper (drift guard)
* Helper is a no-op on empty caps (no fields True)
- 118/118 vendor+tool+provider+import-isolation tests pass
(no regressions; +2 new tests this commit)
- 3 audit scripts pass
Updates per-model registry entries to populate the 12 v2
fields where the capability is genuinely supported:
minimax-M2.5/M2.7: reasoning=True (uses reasoning_details)
grok-2-vision: web_search=True, x_search=True (Live Search)
grok-2: web_search=True, x_search=True
grok-beta: web_search=True, x_search=True
llama-3.1-405b: reasoning=True (explicitly in model name)
qwen-long: caching=True (custom long-context chunking)
qwen-audio: audio=True (was 'deferred' in v1 notes)
Adds the runtime override helper:
_apply_runtime_caps_override(app, caps)
-> caps with local=True if app.current_provider=='llama'
AND _llama_base_url contains 'localhost' or '127.0.0.1'
The 'local' flag is the only v2 field that is runtime-state,
not a static per-model property (OpenRouter llama is cloud;
Ollama llama is local — same model name, different backend).
The override uses dataclasses.replace() to mutate the
frozen dataclass. Implemented in src/gui_2.py (per the
HARD RULE on no new src/*.py files).
The override is wired into App._get_active_capabilities()
so the GUI sees caps.local=True when the active backend
is Ollama and caps.local=False otherwise.
Also: cost panel in src/gui_2.py (per-tier + session-total
columns) now renders 'Free (local)' when caps.local=True
(both the per-tier cost column and the session-total line).
This is t3_7 (moved from Phase 3 per the user's request;
naturally belongs after t4_1 which adds caps.local).
Tests:
- 3 new tests in tests/test_vendor_capabilities.py:
* per-model population (reasoning, audio, caching, vision)
* runtime override for llama+localhost
* runtime override does NOT touch other vendors
- 107/107 vendor+tool+provider+import-isolation tests pass
(no regressions; +4 new tests this commit)
- 3 audit scripts pass
Green phase: src/vendor_capabilities.py now exists and all 3 Red-phase
tests in tests/test_vendor_capabilities.py pass.
Implementation:
- VendorCapabilities frozen dataclass with 12 fields (vendor, model, vision,
tool_calling, caching, streaming, model_discovery, context_window,
cost_tracking, cost_input_per_mtok, cost_output_per_mtok, notes)
- Module-level _REGISTRY dict keyed by (vendor, model)
- register() inserts/overwrites entries
- get_capabilities() returns specific entry if present, else vendor '*'
default, else raises KeyError with 'No capabilities registered' message
- list_models_for_vendor() returns sorted model names for a vendor
(excludes '*' wildcard)
Initial population (22 entries at module load):
- 1 minimax wildcard (cost: 0.20/0.20 per Mtok)
- 4 grok (1 wildcard + 3 models; grok-2-vision has vision=True)
- 9 llama (1 wildcard + 8 models; 11b/90b vision variants have vision=True)
- 8 qwen (1 wildcard + 7 models; qwen-vl-plus/max have vision=True;
qwen-audio has notes='Text-only in v1; audio input deferred')
The plan's Task 1.3 listed 22 entries but included one impossible entry
(vendor='minimax', model='grok-2-latest'). Omitted; 21 entries shipped.
Test fix: test_fallback_to_vendor_default previously used model name
'llama-3.3-70b-specdec' which IS in the registry, so the specific entry
was returned (with default cost_tracking=True), not the wildcard. Fixed
by changing to 'llama-3.3-future-unregistered' (not in registry, so
fallback fires correctly).
3 failing tests in tests/test_vendor_capabilities.py that establish the
core behaviors of the new VendorCapability matrix:
1. test_registry_lookup_known_model: registering and looking up a specific
(vendor, model) entry returns the registered entry
2. test_fallback_to_vendor_default: looking up an unregistered model returns
the vendor's '*' default entry
3. test_unknown_vendor_raises: looking up a vendor with no entries raises
KeyError with a 'No capabilities registered' message
All 3 tests fail with ModuleNotFoundError: No module named
'src.vendor_capabilities' (confirmed via pytest). The implementation file
will be created in the next commit (Green phase).
The autouse _clean_registry fixture snapshots src.vendor_capabilities._REGISTRY
before each test and restores it after, providing test isolation for the
module-level state.