summaryrefslogtreecommitdiffhomepage
path: root/packages/api/src/routes
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-02 13:02:08 +0900
committerAdam Malczewski <[email protected]>2026-06-02 13:02:08 +0900
commit2503eba38b7885ab92a9c0e4f082323d1b3a8679 (patch)
treecc9ccc2184510d93c601a98ed08a05fdeb146a6f /packages/api/src/routes
parent3f629a8469fe483243671e1ca15582a111e96541 (diff)
downloaddispatch-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/api/src/routes')
-rw-r--r--packages/api/src/routes/agents.ts15
1 files changed, 13 insertions, 2 deletions
diff --git a/packages/api/src/routes/agents.ts b/packages/api/src/routes/agents.ts
index 1627674..10ca714 100644
--- a/packages/api/src/routes/agents.ts
+++ b/packages/api/src/routes/agents.ts
@@ -2,7 +2,13 @@ import * as fs from "node:fs";
import * as os from "node:os";
import * as path from "node:path";
import type { AgentDefinition } from "@dispatch/core";
-import { deleteAgent, getAgentDirs, loadAgents, saveAgent } from "@dispatch/core";
+import {
+ deleteAgent,
+ getAgentDirs,
+ isReasoningEffort,
+ loadAgents,
+ saveAgent,
+} from "@dispatch/core";
import { Hono } from "hono";
const SAFE_SLUG_RE = /^[a-zA-Z0-9_-]+$/;
@@ -52,7 +58,12 @@ agentsRoutes.post("/", async (c) => {
description: body.description || "",
skills: body.skills || [],
tools: body.tools || [],
- models: body.models || [],
+ models: (body.models || []).map((m) => ({
+ key_id: m.key_id,
+ model_id: m.model_id,
+ // Keep `effort` only when it's a recognised level; drop anything else.
+ ...(isReasoningEffort(m.effort) ? { effort: m.effort } : {}),
+ })),
scope: body.scope,
slug: body.slug,
...(body.cwd ? { cwd: body.cwd } : {}),