feat(desktop): first-class Oh My Pi (OMP) support — registration + model/plan controls

Merged
KI
3mo ago
+875-57

What

Combines two community PRs into one branch that gives Oh My Pi (OMP) first-class support in Superset, plus two gap fixes found during verification:

  • #5375 (@werkamsus, Nick Raziborsky): first-class OMP registration — builtin/default terminal preset, agent-wrappers-omp extension writer, omp-extension lifecycle-hook template, preset icon, and agent-setup targets.
  • #6804 (@monoclonalAb, Eric Zheng): OMP model/plan/effort launch controls — resolveAgentLaunchPresetId virtual omp resolution from the executable (kept off legacy pi), --model / --thinking / --plan-yolo argv support, and the New Workspace UI mode preference.

Both PRs were deep-verified working individually before combining. They touch disjoint files; the only conflicts were #5375's staleness against main's agent-setup package refactor.

Conflict resolution (#5375 vs main)

Main moved agent setup from apps/desktop/src/main/lib/agent-setup/ into packages/agent-setup/ after #5375 was cut. Resolution was a union:

  • agent-wrappers-omp.ts and omp-extension.template.ts relocated into packages/agent-setup/ (template now resolved via getTemplatePath, matching pi).
  • OMP registered in AGENT_SETUP_TARGETS and AGENT_SETUP_DEFINITIONS (the successors of the deleted desktop-agent-capabilities.ts / desktop-agent-setup.ts).
  • README agent table, preset-icons index, and the default-v2-terminal-presets test resolved by keeping main's newer entries (kimi, grok, vibe, hermes, …) and adding OMP alongside them.

Gap fixes

  1. OMP teardown — pi gained removePiExtension in a refactor but OMP had no equivalent, so disabling OMP hooks left ~/.omp/agent/extensions/superset-hooks.ts on disk. Added removeOmpExtension (signature-gated, mirrors pi) and wired it as OMP's teardown in AGENT_SETUP_DEFINITIONS. Tests cover removal, no-op on absence, and preserving user-authored files.
  2. Env-var collision — OMP honored PI_CODING_AGENT_DIR (which pi itself no longer reads), so PI_CODING_AGENT_DIR=~/.pi/agent made pi and OMP fight over one superset-hooks.ts. OMP now resolves its extension dir from its own OMP_CODING_AGENT_DIR, defaulting to ~/.omp/agent, and ignores PI_CODING_AGENT_DIR. A test proves pi and OMP resolve to distinct trees even with PI_CODING_AGENT_DIR set.

Review nits folded in

  • Executable lowercased before compare in resolveAgentLaunchPresetId (from #6804, kept).
  • Test suite saves/restores OMP_CODING_AGENT_DIR and PI_CODING_AGENT_DIR instead of unconditionally deleting.
  • alt text on the README OMP icon row (matches the table's descriptive-alt convention).
  • EXTERNAL_FILES.md documents the full OMP lifecycle-hook set (session_start, agent_start, before_agent_start, tool_execution_end, agent_end, session_end, session_shutdown) and the OMP_CODING_AGENT_DIR override.

Skipped (scope): adding "omp"/"oh my pi" keywords to settings-search, and an OMP entry in the agent icon picker — neither PR touched those and OMP reuses the pi icon via presetId.

Verification

  • bun run typecheck — exit 0.
  • bun run lint:fix (biome 2.4.2) — 6327 files checked, no fixes needed.
  • packages/agent-setup full suite: 263 pass / 0 fail (12 files) — includes agent-wrappers (67 pass) with the new OMP teardown + env-var tests.
  • packages/shared agent-models + agent-command + agent-settings: 80 pass / 0 fail.
  • host-service agent-configs + agents router: 63 pass / 0 fail.
  • host-service workspace-creation + workspaces routers: 170 pass / 0 fail.
  • desktop default-v2-terminal-presets: 4 pass / 0 fail.

Desktop app behavior for both PRs was already verified end-to-end upstream; this branch was validated statically + via unit tests.

Supersedes #5375 and #6804; closes #6801.

Co-authored with Eric Zheng (@monoclonalAb) and Nick Raziborsky (@werkamsus) — thank you both!

https://claude.ai/code/session_01YbC49AqamkRtURuMiepkqz


Summary by cubic

Adds first-class Oh My Pi (OMP) as a separate built-in terminal agent with model/effort/plan controls and a Superset-managed OMP lifecycle extension, so OMP no longer piggybacks on pi and the UI shows accurate working/completion state. Capabilities are resolved from the configured executable, and Superset Chat v3 gating remains unchanged.

  • Adds built-in omp preset (command omp) to default terminal presets; keeps legacy pi; reuses the pi icon.
  • Installs an OMP lifecycle extension at ~/.omp/agent/extensions/superset-hooks.ts (honors OMP_CODING_AGENT_DIR); teardown removes only Superset-owned files.
  • Adds launch options: --model, --thinking, and plan-first --plan-yolo; UI exposes model/effort/mode pickers and persists preferences per preset.
  • Validates mode/effort server-side and builds args/env only when supported; TRPC now accepts an optional mode.
  • Resolves capabilities by executable via resolveAgentLaunchPresetId, so OMP controls appear when the command resolves to omp (works with absolute paths or extra args); retains Chat v3 flag gating in useV2AgentChoices.

Migration

  • OMP now resolves its extension dir from OMP_CODING_AGENT_DIR and ignores PI_CODING_AGENT_DIR.
  • If you set PI_CODING_AGENT_DIR for OMP, set OMP_CODING_AGENT_DIR instead.

Summary by CodeRabbit

  • New Features

    • Added Oh My Pi as a supported built-in terminal agent with default setup and branding.
    • Added model, effort, and “Plan first” mode options for Oh My Pi.
    • Workspace creation now supports selecting and remembering agent modes per preset.
    • Added lifecycle notifications for Oh My Pi sessions running in Superset terminals.
  • Documentation

    • Documented Oh My Pi support and its lifecycle hook configuration files.