feat(desktop): add OMP model and plan controls

Closed
MO
2mo ago
+425-35

What & why

Fixes #6801.

Superset only exposed OMP's reasoning effort in the new-workspace flow. This adds executable-aware OMP launch capabilities without applying OMP-only flags to the legacy pi CLI:

  • model choices for configured OMP roles and current Anthropic/OpenAI Codex selectors;
  • a persisted Direct mode / Plan first picker;
  • end-to-end mode propagation through workspace/session creation and direct agent launches;
  • host-side validation and argv construction for --model, --thinking, and --plan-yolo;
  • per-capability local preference persistence for both new-workspace surfaces.

Existing configs that retain the Pi preset/icon but override the executable to omp are detected from the command. A true pi executable keeps the legacy Pi capability surface.

How I tested it

  • bun run lint
  • bun run typecheck — 37/37 tasks passed
  • bun test packages/shared/src/agent-models.test.ts packages/host-service/src/trpc/router/agents/agents.test.ts — 72 pass, 0 fail
  • Desktop CDP flow against the local dev app:
    1. configured the Pi preset to execute omp;
    2. selected Oh My Pi in New Workspace;
    3. confirmed configured-role and exact-model choices, including GPT-5.6 Sol;
    4. selected Configured plan model and Plan first;
    5. closed and reopened the modal and confirmed both preferences persisted;
    6. captured the rendered modal and confirmed all four selectors fit without clipping.

bun run test was also attempted. It finished with 3 failures in packages/host-service/test/integration/terminal.integration.test.ts (real-daemon session disposal/reaper/restart timeouts); the changed focused suites above passed.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (CI fails on lint warnings too)
  • Allow edits from maintainers is enabled on this fork PR

Summary by cubic

Adds executable-aware Oh My Pi (OMP) model selection and a Plan-first mode across desktop workspace creation and direct agent launches. Previously only reasoning effort was exposed; now model, effort, and mode propagate end-to-end with safe defaults, while a true Pi executable keeps the legacy Pi surface.

  • UI: adds a mode picker backed by useAgentModePreference (per-preset, localStorage); renders when getAgentModeSupport exists. Agent selection now exposes a launchPresetId so OMP controls appear when the preset runs omp.
  • Shared (@superset/shared/agent-models): introduces AGENT_MODE_SUPPORT, getAgentModeSupport, buildAgentModeArgs, and resolveAgentLaunchPresetId; adds OMP model catalog and reuses Pi thinking levels for OMP.
  • Host: validates mode via validateAgentModeSelection and consolidates checks in validateAgentLaunchOptions; TRPC inputs accept mode; argv construction includes --model, --thinking, and --plan-yolo for OMP.
  • Rollout: existing Pi presets that point to an omp executable automatically gain OMP controls; real pi keeps Pi behavior. Stale stored mode ids are ignored; no migrations required.

Summary by CodeRabbit

  • New Features

    • Added launch-mode selection when creating a workspace, including Direct and Plan modes where supported.
    • Remembers the last selected mode for each agent preset.
    • Added Open Model Protocol (OMP) support with model, effort, and plan-mode options.
    • Applies selected modes when launching agents and supports executable-based preset detection.
  • Bug Fixes

    • Validates unsupported launch modes before starting agents and ensures consistent handling across workspace creation flows.