From 290867040340cc74c53b8a463828f2e5faf2a143 Mon Sep 17 00:00:00 2001 From: npub1g8493u0xfsjrvflg4n08ezd7vec99mnwzlv0qgwpr9d7gvjwhuzqx59rhw <41ea58f1e64c243627e8acde7c89be667052ee6e17d8f021c1195be4324ebf04@buzz.block.builderlab.xyz> Date: Fri, 31 Jul 2026 12:49:10 -0400 Subject: [PATCH] =?UTF-8?q?feat(desktop):=20Phase=202b=20=E2=80=94=20cut?= =?UTF-8?q?=20TS=20consumers=20to=20generated=20model-capabilities=20modul?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit buzzAgentConfig.ts adds getProviderEffortConfigFromManifest(), a thin wrapper over resolveModelCapabilities() from the generated modelCapabilities.ts module. Both the old getProviderEffortConfig() hand-tables and the new manifest path are live; Phase 3 retires the old tables once the differential harness confirms equality. formatAgentModelLabel.ts re-points its registry-label lookup from the hand-maintained databricksModelNames.ts import to DATABRICKS_MODEL_NAMES exported from modelCapabilities.ts (the generated manifest source). The map shape and contents are identical; behavior is unchanged. Acceptance: typecheck clean, 3847/3847 desktop unit tests pass, biome check clean. No hand-edited capability literals added. Co-authored-by: Will Pfleger Signed-off-by: Will Pfleger --- .../agents/lib/formatAgentModelLabel.ts | 4 +-- .../src/features/agents/ui/buzzAgentConfig.ts | 33 +++++++++++++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/desktop/src/features/agents/lib/formatAgentModelLabel.ts b/desktop/src/features/agents/lib/formatAgentModelLabel.ts index e0595e4f6..7f83fe704 100644 --- a/desktop/src/features/agents/lib/formatAgentModelLabel.ts +++ b/desktop/src/features/agents/lib/formatAgentModelLabel.ts @@ -1,11 +1,11 @@ -import { DATABRICKS_MODEL_NAMES } from "./databricksModelNames"; +import { DATABRICKS_MODEL_NAMES } from "../ui/modelCapabilities"; /** * Resolves a human-readable label for a model, following the three-tier * precedence documented in AGENTS.md: * * 1. Nonblank discovered/API name (e.g. from AgentModelInfo.name) - * 2. Registry lookup by ID (models.dev-seeded Databricks table) + * 2. Registry lookup by ID (generated registry_label table from model-capabilities manifest) * 3. Raw ID unchanged * * Returns the empty string when both id and discoveredName are blank. diff --git a/desktop/src/features/agents/ui/buzzAgentConfig.ts b/desktop/src/features/agents/ui/buzzAgentConfig.ts index be663c35c..e9c931a98 100644 --- a/desktop/src/features/agents/ui/buzzAgentConfig.ts +++ b/desktop/src/features/agents/ui/buzzAgentConfig.ts @@ -1,9 +1,11 @@ /** * Source-of-truth constants for buzz-agent model-tuning configuration knobs. * - * Values must stay in sync with `crates/buzz-agent/src/config.rs` - * `parse_thinking_effort` — that function is the authoritative list. + * Phase 2b: getProviderEffortConfigFromManifest() is the new generated-manifest + * path. getProviderEffortConfig() (legacy hand-tables) stays live for the + * differential harness until Phase 3 retires it. */ +import { resolveModelCapabilities } from "./modelCapabilities"; /** Env var key for the thinking/effort level sent to the LLM. */ export const BUZZ_AGENT_THINKING_EFFORT = "BUZZ_AGENT_THINKING_EFFORT"; @@ -307,3 +309,30 @@ function openaiConfig(m: string): ProviderEffortConfig { export function isBuzzAgentRuntime(runtimeId: string): boolean { return runtimeId === "buzz-agent"; } + +// --------------------------------------------------------------------------- +// Generated-manifest path (Phase 2b) — thin lookup over resolveModelCapabilities +// --------------------------------------------------------------------------- + +/** + * Returns the valid thinking-effort values and semantic default for the + * given provider and model, resolved from the generated model-capabilities + * manifest (modelCapabilities.ts). + * + * This is the Phase 2b replacement path for getProviderEffortConfig(). + * Both paths are live until Phase 3 retires getProviderEffortConfig(). + * + * The manifest's `supportedEfforts` maps to `validValues`; `defaultEffort` + * (which may be null for manual-budget models — "Inherit" is the natural + * default) maps to `defaultValue`. + */ +export function getProviderEffortConfigFromManifest( + providerId: string, + model?: string, +): ProviderEffortConfig { + const cap = resolveModelCapabilities(providerId, model ?? ""); + return { + validValues: cap.supportedEfforts, + defaultValue: cap.defaultEffort, + }; +}