diff options
| author | Adam Malczewski <[email protected]> | 2026-06-02 13:02:08 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-02 13:02:08 +0900 |
| commit | 2503eba38b7885ab92a9c0e4f082323d1b3a8679 (patch) | |
| tree | cc9ccc2184510d93c601a98ed08a05fdeb146a6f /packages/core/src/agents | |
| parent | 3f629a8469fe483243671e1ca15582a111e96541 (diff) | |
| download | dispatch-2503eba38b7885ab92a9c0e4f082323d1b3a8679.tar.gz dispatch-2503eba38b7885ab92a9c0e4f082323d1b3a8679.zip | |
feat(agents): per-model reasoning effort level
Add a per-model/key reasoning effort setting to agent definitions,
surfaced and editable in the Agent Settings page and displayed at a
glance in the model selector views.
- core: single source of truth for effort levels (REASONING_EFFORTS,
DEFAULT_REASONING_EFFORT='high', labels, isReasoningEffort guard);
add 'xhigh' level; AgentModelEntry.effort; xhigh budget=24000 for
classic-thinking Claude; default floor 'high'. Persist/parse effort
in the agent TOML loader.
- api: thread effort through the fallback chain with per-model -> per-tab
-> default precedence; validate /chat + agentModels effort from the
canonical list.
- frontend: effort <select> per model row in AgentBuilder; effort badges
in ModelSelector (agent + subagent chains); Thinking dropdown sourced
from canonical list; per-tab default raised to 'high'.
- tests: +15 (loader round-trip, agent xhigh budget, canonical list +
guard, api precedence, route validation).
Diffstat (limited to 'packages/core/src/agents')
| -rw-r--r-- | packages/core/src/agents/loader.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/core/src/agents/loader.ts b/packages/core/src/agents/loader.ts index f4a6c5a..9971803 100644 --- a/packages/core/src/agents/loader.ts +++ b/packages/core/src/agents/loader.ts @@ -2,7 +2,7 @@ import * as fs from "node:fs"; import * as os from "node:os"; import * as path from "node:path"; import { parse as parseTOML, stringify as stringifyTOML } from "smol-toml"; -import type { AgentDefinition, AgentModelEntry } from "../types/index.js"; +import { type AgentDefinition, type AgentModelEntry, isReasoningEffort } from "../types/index.js"; // ─── Helpers ───────────────────────────────────────────────────── @@ -192,6 +192,7 @@ export function saveAgent(agent: AgentDefinition): void { tomlContent.models = agent.models.map((m) => ({ key_id: m.key_id, model_id: m.model_id, + ...(m.effort ? { effort: m.effort } : {}), })); } @@ -246,9 +247,14 @@ function loadAgentsFromDir(dir: string, scope: string): AgentDefinition[] { if (Array.isArray(parsed.models)) { for (const m of parsed.models) { if (m && typeof m === "object" && "key_id" in m && "model_id" in m) { + const rawEffort = (m as Record<string, unknown>).effort; models.push({ key_id: String((m as Record<string, unknown>).key_id), model_id: String((m as Record<string, unknown>).model_id), + // Only carry `effort` when it's a recognised level; an + // unset or invalid value falls back to the per-tab / + // default effort at the call site. + ...(isReasoningEffort(rawEffort) ? { effort: rawEffort } : {}), }); } } |
