Repository navigation
Conversation
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>
|
PR closer pass: leaving this open and unmerged.\n\nCurrent evidence:\n- GitHub reports this PR as dirty, and |
|
Hey @nwparker, I really liked this feature so I rebased it onto current main (it was ~3k commits behind), fixed up the spots that had drifted in the integration, and also wired custom agents into Automations. It's on my fork at |
|
Thanks for this work — we took inspiration from it and will land the custom-agent implementation in #8337. Closing this PR in favor of that work. |
Closes #1473.
What
Adds user-defined CLI agent profiles — named variants of a built-in
TuiAgentwith 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 separateOPENAI_API_BASE, Claude with--dangerously-skip-permissionsbaked in, etc.).Where it surfaces
baseAgentis detected on PATH appear in the launch dropdown.How it's wired
CustomAgentProfile = { id, label, baseAgent: TuiAgent, command, env? }insrc/shared/types.ts.GlobalSettings.customAgents: CustomAgentProfile[](default[]).GlobalSettings.defaultTuiAgentwidens to accept{ kind: 'custom', id }. Stale custom defaults fall back to auto, matching how uninstalled built-ins fall back.buildAgentStartupPlan/buildAgentDraftLaunchPlanaccept an optionalcustomProfile; when present, the launch base command comes from the profile (with env rendered as a POSIX shell prefixKEY='value' …) instead ofcmdOverrides[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.local-pty-shell-ready.tswrites startup commands to the user's interactive shell) — no PTY-spawn changes needed.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 setstuiAgentto itsbaseAgentand records the profile id, so existing call sites that only know aboutTuiAgent(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 bothbuildAgentStartupPlanandbuildAgentDraftLaunchPlanwith a custom profile (incl. that profile command + env override the per-agentcmdOverrides).npm run typecheckclean.npm run lintclean (0 errors; 7 pre-existing warnings untouched). Vitest passes for everything except the pre-existingbetter-sqlite3native-module mismatch in orchestration/runtime tests (failing identically on master).Notes / out of scope
cmd /c …if env vars matter. A first-class Windows path can come later.customAgentsdefaults to[]; existing users keep working unchanged until they explicitly pick a custom profile.Made with Orca 🐋
Risk: high
Historic risk metadata backfill based on the existing
risk:highlabel.