feat(shared,desktop): Fable model + reasoning-effort support for agent launches

Merged
KI
5mo ago
+300-4

Summary

  • Add { id: "fable", label: "Fable" } to the claude preset in AGENT_MODEL_SUPPORT, so the workspace-create model picker offers Fable for Claude Code and launches pass --model fable.
  • Add reasoning-effort support across the builtin CLI agents: a new AGENT_EFFORT_SUPPORT catalog + buildAgentEffortArgs in packages/shared/src/agent-models.ts, threaded through workspaces.create → agents.run on the host service, with an effort picker (persisted per preset, same contract as the model picker) in the workspace-create form.

How It Works

  • Effort flags were verified against each installed CLI (--help output / binary validators):
    • claude --effort (low, medium, high, xhigh, max)
    • amp --effort (none, minimal, low, medium, high, xhigh, max)
    • copilot --effort (low, medium, high, xhigh)
    • pi --thinking (off, minimal, low, medium, high, xhigh)
    • mastracode --thinking-level (off, low, medium, high, xhigh)
    • codex has no dedicated flag; effort rides a config override -c model_reasoning_effort=<v> via the entry's effortValuePrefix
    • gemini, opencode, cursor-agent, and droid expose no effort control on their interactive launch commands (droid only has it on droid exec), so they have no entry and render no picker.
  • buildAgentEffortArgs has the same degrade-to-default contract as buildAgentModelArgs: unknown preset or effort id → [] → CLI default, never a broken launch.
  • The renderer reuses AgentModelSelect for the effort dropdown and persists the last selection per preset under a new localStorage key (useAgentEffortPreference, mirroring useAgentModelPreference).

Manual QA Checklist

  • claude --model fable --effort low -p … accepted both flags; response self-identified as Claude Fable 5 (claude-fable-5)
  • Workspace-create form shows the effort picker only for presets with an entry (claude, amp, codex, mastracode, pi, copilot)
  • Effort selection persists across modal reopen and host switches
  • Launch with "Default" effort omits the flag entirely

Testing

  • bun test agent-models in packages/shared — 20 pass (new suites for AGENT_EFFORT_SUPPORT, getAgentEffortSupport, buildAgentEffortArgs incl. the codex prefix shape, plus a fable registry assertion)
  • bun turbo run typecheck --filter=@superset/shared --filter=@superset/host-service --filter=@superset/desktop — clean
  • biome check on all changed files — clean
  • Live CLI test of the exact argv Superset generates for Claude Code (see QA above)

Notes

  • fable is the short alias the Claude Code CLI accepts after --model, matching the existing opus/sonnet/haiku entries. Listed first as the most capable tier.
  • The superset chat agent has no effort entry — chat metadata carries only a model id today.
  • codex does not validate model_reasoning_effort client-side (a bogus value is echoed into the session header), so the curated list is the only guard on that path — same as for models.

Summary by CodeRabbit

  • New Features
    • Expanded the Claude preset model picker with an additional option.
    • Added “reasoning effort” selection for supported v2 agents in the new workspace flow, including persistence of the last choice.
  • Changes
    • Workspace and agent run requests now accept an optional reasoning effort value and apply it during execution.
  • Bug Fixes
    • Improved validation so only supported effort values are used.
  • Tests
    • Added/extended coverage for effort support and argument building.