Skip to content

feat(agents): custom CLI agent profiles (#1473)#1479

Open
nwparker wants to merge 1 commit intomainfrom
nwparker/https-github.com-stablyai-orca-issues-1473
Open

feat(agents): custom CLI agent profiles (#1473)#1479
nwparker wants to merge 1 commit intomainfrom
nwparker/https-github.com-stablyai-orca-issues-1473

Conversation

@nwparker
Copy link
Copy Markdown
Contributor

@nwparker nwparker commented May 6, 2026

Closes #1473.

What

Adds user-defined CLI agent profiles — named variants of a built-in TuiAgent with their own launch command and optional env vars. The motivating ask in #1473 was "two Claudes pointed at different provider URLs"; this lands a general mechanism for that and similar workflows (custom Codex with separate OPENAI_API_BASE, Claude with --dangerously-skip-permissions baked in, etc.).

Where it surfaces

  • Settings → Agents — new Custom Agents section with add/edit/delete, base-agent picker, command field, and env key/value pairs. Each profile gets a "Set as default" affordance.
  • Default Agent picker in Settings → Agents and in the workspace composer — custom profiles render as additional pills/items with the base agent's icon plus a wrench overlay.
  • New Workspace composer (full + quick) — the agent combobox lists custom profiles inline; selecting one routes the launch through the profile's command + env.
  • Tab-bar Quick Launch — custom profiles whose baseAgent is detected on PATH appear in the launch dropdown.

How it's wired

  • New CustomAgentProfile = { id, label, baseAgent: TuiAgent, command, env? } in src/shared/types.ts.
  • GlobalSettings.customAgents: CustomAgentProfile[] (default []).
  • GlobalSettings.defaultTuiAgent widens to accept { kind: 'custom', id }. Stale custom defaults fall back to auto, matching how uninstalled built-ins fall back.
  • buildAgentStartupPlan / buildAgentDraftLaunchPlan accept an optional customProfile; when present, the launch base command comes from the profile (with env rendered as a POSIX shell prefix KEY='value' …) instead of cmdOverrides[agent] ?? config.launchCmd. The base agent still drives prompt-injection mode, telemetry kind, and paste-draft logic, so custom agents ride the existing flow with zero downstream changes.
  • Env shell prefix piggybacks on the existing startup-command path (local-pty-shell-ready.ts writes startup commands to the user's interactive shell) — no PTY-spawn changes needed.
  • New helpers: src/shared/custom-agent-profile.ts (env quoting + base command), src/renderer/src/lib/custom-agent-resolve.ts (lookup + default-pref resolver).

Selection model

Composer state stays minimal: tuiAgent: TuiAgent + customAgentId: string | null (parallel slots). When the user selects a custom profile, the picker sets tuiAgent to its baseAgent and records the profile id, so existing call sites that only know about TuiAgent (telemetry, paste-draft, trust preflight) continue to work unchanged.

Tests

  • src/shared/custom-agent-profile.test.ts (new) — POSIX/Windows env quoting, single-quote escaping, command resolution.
  • src/renderer/src/lib/tui-agent-startup.test.ts — added cases for both buildAgentStartupPlan and buildAgentDraftLaunchPlan with a custom profile (incl. that profile command + env override the per-agent cmdOverrides).

npm run typecheck clean. npm run lint clean (0 errors; 7 pre-existing warnings untouched). Vitest passes for everything except the pre-existing better-sqlite3 native-module mismatch in orchestration/runtime tests (failing identically on master).

Notes / out of scope

  • Env shell-prefix uses POSIX quoting; on Windows the settings hint advises wrapping with cmd /c … if env vars matter. A first-class Windows path can come later.
  • Migration: customAgents defaults to []; existing users keep working unchanged until they explicitly pick a custom profile.

Made with Orca 🐋

Adds user-defined CLI agent profiles \u2014 named variants of a built-in
TuiAgent with their own launch command and optional env vars. Surfaced
in the agent picker (new-workspace composer + tab-bar quick launch)
alongside built-ins, and in Settings \u2192 Agents with add/edit/delete.

A profile inherits its baseAgent's prompt-injection mode, icon, trust
preflight, and telemetry kind, so the existing launch flow handles
custom agents without a parallel code path. Env vars render as a POSIX
shell prefix (`KEY='value' \u2026`) on the launch command, leveraging the
existing shell-evaluated startup-command path \u2014 no PTY-spawn changes.

defaultTuiAgent widens to also accept { kind: 'custom', id }; a stale
custom default falls back to auto-pick (matches uninstalled-builtin
behavior). Quick-launch dropdown only surfaces custom profiles whose
baseAgent is detected on PATH so the menu can't recommend a stalled
launch.

Co-authored-by: Orca <help@stably.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Can't add custom cli agent

1 participant