diff --git a/internal/agent/claude_login_test.go b/internal/agent/claude_login_test.go index c85320d22..09488bc64 100644 --- a/internal/agent/claude_login_test.go +++ b/internal/agent/claude_login_test.go @@ -321,3 +321,37 @@ func TestClaudeAtAnOlderGatewayAddress(t *testing.T) { } } } + +// A stopped distro's Claude Code offers a tier's effort, and the +// subagents', the levels of its model as a running one does, not +// magpie's models: picking one of those as an effort is refused (cybercaius). +func TestWSLClaudeStoppedEfforts(t *testing.T) { + root, _ := claudeDistroHome(t, `{}`) + saveDeepseek(t) + d := distro{Name: "Stopped", Root: root, Home: "/home/me", Has: map[string]bool{"dir:.claude": true}, Gateway: "172.20.0.1"} + k := wslKindOf("claude") + a := asleep(wslAgent(k, d), k, d) + cur := map[string]string{"model": "deepseek/pro"} + for _, key := range []string{"opus_effort", "sonnet_effort", "haiku_effort", "subagent_effort"} { + f := a.Field(key) + if f == nil { + t.Fatalf("no %s", key) + } + for _, o := range f.Options(cur) { + if !contains(provider.MemberEfforts, o.Value) { + t.Fatalf("%s offers %q, not an effort: %v", key, o.Value, f.Options(cur)) + } + } + } + if f := a.Field("ultracode"); f != nil { + for _, o := range f.Options(cur) { + if o.Value != "on" { + t.Fatalf("ultracode offers %q", o.Value) + } + } + } + // a tier still offers magpie's models + if len(a.Field("opus").Options(cur)) == 0 { + t.Fatal("opus offers no model") + } +} diff --git a/internal/agent/wsl.go b/internal/agent/wsl.go index f060b89f8..6411056d0 100644 --- a/internal/agent/wsl.go +++ b/internal/agent/wsl.go @@ -2,6 +2,7 @@ package agent import ( "bufio" + "cmp" "context" "encoding/json" "fmt" @@ -365,7 +366,8 @@ var wslKinds = []wslKind{ return func(cur map[string]string) []Option { return append(group("Claude Code", claudeOwn(cur["model"], nil, catalog.Provider("anthropic"))), claudeViaMagpie(false)...) } - case "effort": + case "effort", "ultracode": + // their own options read only what was last seen return nil case "login": // its sign-in, while the model last seen is magpie's @@ -376,7 +378,18 @@ var wslKinds = []wslKind{ return claudeSignIns() } } - // a tier: magpie's models while the model last seen is one + // a tier's effort or the subagents': the levels of the model it + // was last seen on, as when running, not a model to pick + if tier, ok := strings.CutSuffix(key, "_effort"); ok { + return func(cur map[string]string) []Option { + if !isMagpie(cur["model"]) { + return nil + } + return static(tierEfforts(cmp.Or(cur[tier], cur["model"]))...) + } + } + // a tier, the subagents or auto mode: magpie's models while the + // model last seen is one return func(cur map[string]string) []Option { if !isMagpie(cur["model"]) { return nil