feat(desktop): Phase 2b — cut TS consumers to generated model-capabilities module

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 <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
npub1g8493u0xfsjrvflg4n08ezd7vec99mnwzlv0qgwpr9d7gvjwhuzqx59rhw
2026-07-31 12:49:10 -04:00
co-authored by Will Pfleger
parent 4d47f48143
commit 2908670403
2 changed files with 33 additions and 4 deletions
@@ -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.
@@ -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,
};
}