feat(agents): custom CLI agent profiles (#1473)#1479
Open
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 🐋