mirror of
https://github.com/NanmiCoder/claude-code-haha.git
synced 2026-10-10 11:53:10 +08:00
dce696fbae
Built-in agents pin their own models — Explore and claude-code-guide run on Haiku, statusline-setup on Sonnet — and there was no way to change that. The only override mechanism was a same-named user agent, which replaces the definition wholesale: AGENT_SLUG_PATTERN is lowercase-only so `Explore` and `Plan` cannot even be created, and a replacement loses the runtime getSystemPrompt and the built-in tool privileges keyed off `source`. CLAUDE_CODE_SUBAGENT_MODEL is the only other lever and forces every subagent onto one model. Add `builtInAgentOverrides` to settings.json, carrying model and effort per agentType. It is applied in getBuiltInAgents(), the single choke point every consumer goes through, so the effective value reaches spawning, `/agents` and the desktop list without any of them knowing an override exists — and `source` stays `built-in`, preserving the prompt and tool privileges. Three constraints are load-bearing rather than stylistic: - `model: "inherit"` is a real value, not a reset. Built-in defaults differ per agent and per build, so clearing means deleting the field; the entry and then the key are removed once empty. - getSystemPrompt is never wrapped. serializeActiveAgent branches on `.length === 0`, and claude-code-guide declares one parameter while the others declare none, so a wrapper makes it destructure undefined. - The settings write is a read-modify-write inside the file lock. updateUserSettings is a top-level shallow merge and would replace the whole record, losing an update when two agents are changed in quick succession. strictPluginOnlyCustomization is enforced when resolving, not only when writing, since settings.json is user-editable by definition. Also surface edit and delete on the agent list rows. Both already existed but were reachable only after opening an agent's detail page. Rows become a div with the primary button and the actions as siblings rather than nested buttons, keep focus-within so the controls are not tabbable while invisible, and stay visible on touch where hover never fires. Built-in rows get the override entry point and no delete. The store's create/update/override paths now share runAgentMutation instead of a third hand-copy of the out-of-order guards; the existing store tests pass unchanged.