agent page: show resolved model as the model badge's tooltip

mara: 'i cannot see if sonnet became claude-sonnet-5 or something
else.' /api/state now carries resolved_model (bus.last_resolved_model(),
already used by serve_common.rs's turn-stats rollup for the same
alias-vs-actual reason) and the model badge shows it as a title
tooltip, same pattern as the ctx/cost badges.
This commit is contained in:
iris 2026-08-30 14:23:41 +02:00 committed by mara
commit c73ce03244
4 changed files with 26 additions and 1 deletions

View file

@ -36,6 +36,13 @@ pub(super) async fn api_state(State(state): State<AppState>) -> axum::Json<State
let inbox = recent_inbox(&state.socket).await;
let (turn_state, turn_state_since) = state.bus.state_snapshot();
let model = state.bus.model();
// The alias the operator selected (e.g. "sonnet") vs. what the last
// turn actually ran on (e.g. "claude-sonnet-4-5-20260805") — mara:
// "i cannot see if sonnet became claude-sonnet-5 or something else".
// `None` until the first turn completes (no assistant event to
// resolve from yet); same source `serve_common.rs`'s turn-stats
// rollup already prefers over the requested alias.
let resolved_model = state.bus.last_resolved_model();
let context_window_tokens = state.bus.effective_context_window(&model);
let ctx_usage = state.bus.last_ctx_usage();
let cost_usage = state.bus.last_cost_usage();
@ -51,6 +58,7 @@ pub(super) async fn api_state(State(state): State<AppState>) -> axum::Json<State
turn_state,
turn_state_since,
model,
resolved_model,
context_window_tokens,
ctx_usage,
cost_usage,
@ -135,6 +143,12 @@ pub(super) struct StateSnapshot {
/// the operator can see what they just switched to (and what's
/// in flight). Mutable at runtime via `POST /api/model`.
model: String,
/// The concrete model id the most recent completed turn actually
/// ran on (e.g. `"claude-sonnet-4-5-20260805"`), resolved from that
/// turn's assistant events — `model` above is the alias the
/// operator picked, which claude itself maps to a specific dated
/// snapshot. `None` before any turn has completed.
resolved_model: Option<String>,
/// Effective context-window token budget for the current model.
/// Primary source: API-reported `modelUsage.*.contextWindow` from
/// the last result event (authoritative per-inference active window).