|
8 | 8 | "os" |
9 | 9 | "os/signal" |
10 | 10 | "regexp" |
| 11 | + "slices" |
11 | 12 | "strings" |
12 | 13 | "time" |
13 | 14 | "unicode/utf8" |
@@ -140,7 +141,7 @@ func init() { |
140 | 141 | rootCmd.AddCommand(runCmd) |
141 | 142 | f := runCmd.Flags() |
142 | 143 | f.StringVar(&runOpts.workspace, "ws", "", "Workspace to run in (default: your only workspace)") |
143 | | - f.StringVar(&runOpts.agent, "agent", "pi", "Agent to run: pi or hermes") |
| 144 | + f.StringVar(&runOpts.agent, "agent", "pi", "Agent to run: pi, pi_gentle (Pi + Gentle Shell) or hermes, if the workspace has it installed") |
144 | 145 | f.StringVar(&runOpts.model, "model", "", "Model for the agent (default: the agent's own)") |
145 | 146 | f.StringVar(&runOpts.cwd, "cwd", "", "Folder in the workspace to run in (default: /home/nan)") |
146 | 147 | f.BoolVar(&runOpts.worktree, "worktree", false, "Always work on a separate branch, nan-run/<id> (fails outside a git repository)") |
@@ -397,9 +398,14 @@ func isTerminal(f *os.File) bool { |
397 | 398 | return err == nil && info.Mode()&os.ModeCharDevice != 0 |
398 | 399 | } |
399 | 400 |
|
| 401 | +// runAgents are the agents a run can use (the platform's runs.agent set): |
| 402 | +// pi_gentle is Pi with gentle-shell. The workspace must have the agent |
| 403 | +// installed; the platform answers agent_not_installed otherwise. |
| 404 | +var runAgents = []string{"pi", "pi_gentle", "hermes"} |
| 405 | + |
400 | 406 | func buildRunRequest(in promptInput, opts runOptions, args []string) (*api.CreateRunRequest, error) { |
401 | | - if opts.agent != "pi" && opts.agent != "hermes" { |
402 | | - return nil, usageErrorf("--agent must be pi or hermes, not %q", opts.agent) |
| 407 | + if !slices.Contains(runAgents, opts.agent) { |
| 408 | + return nil, usageErrorf("--agent must be pi, pi_gentle or hermes, not %q", opts.agent) |
403 | 409 | } |
404 | 410 | if opts.worktree && opts.noWorktree { |
405 | 411 | return nil, usageErrorf("--worktree and --no-worktree contradict each other; pick one") |
|
0 commit comments