agent: a look at the via-magpie options shares the kept list

viaMagpie handed every caller its own copy of the options list it keeps
per stamp, and a window poll asks for it from most agents' fields and
pickers. In a real-account sandbox (abr.sh, 20 polls of drift, state and
providers on v0.1.2463) those copies were 33.7 MB of slices.Clone, plus
~8 MB more on the way, of the 713 MB the polls allocated.

viaMagpieShared returns the kept list itself, clipped, so an append
makes the caller's own array. The 58 callers that only read it, or
append onto it, now take it; viaMagpie (a copy) stays for the ones that
change it.

TestKeptListSharedWithoutACopy checks that 20 shared looks return the
kept array, and that an append onto a shared look and a write into
get's copy leave the kept list as it was.

Run on mote at this tree:
- gofmt, go vet (darwin, GOOS=windows, GOOS=linux with gateway),
  go build ./...: ok.
- Broken by hand (shared returns slices.Clone): the test is red, "a
  shared look copies the kept list".
- go test -count=1 ./internal/agent: ok (480s).

Not run: internal/gateway and internal/gui packages on this tree.
This commit is contained in:
yetone
2026-11-01 04:25:59 +08:00
parent 544b91ca87
commit dd7442f283
40 changed files with 115 additions and 59 deletions
+4 -4
View File
@@ -979,7 +979,7 @@ func openCodeLike(at place, id, name, icon, bin, dir, auth string, ua []string,
provider := openCodeKept(path, func() any { return magpieProviderJSONAt("opencode", id, at.gw()) })
opts := func(key string) func(map[string]string) []Option {
return func(cur map[string]string) []Option {
return append(ownOptions(auth, cur[key]), viaMagpie(id, magpieID+"/")...)
return append(ownOptions(auth, cur[key]), viaMagpieShared(id, magpieID+"/")...)
}
}
get := func(k string) string { v, _ := edit.GetJSON(path, k); return v }
@@ -1395,7 +1395,7 @@ func piLikeKeyed(at place, id, name, dir string, key func() string) *Agent {
return piScopeWith(path, v)
},
Options: func(cur map[string]string) []Option {
return append(ownOptionsFrom(piRegistry(id), auth, cur["model"]), viaMagpie(id, magpieID+"/")...)
return append(ownOptionsFrom(piRegistry(id), auth, cur["model"]), viaMagpieShared(id, magpieID+"/")...)
},
},
{
@@ -1515,7 +1515,7 @@ func gooseIn(at place, cfg string) *Agent {
// only the native providers this goose is set up with (#987:
// every one of four was listed, OpenRouter's hundreds of
// models on a goose that had only magpie)
return append(ownOptions("", cur["model"], gooseConfigured(path, keyEnv)...), viaMagpie("goose", gooseProviderID+"/")...)
return append(ownOptions("", cur["model"], gooseConfigured(path, keyEnv)...), viaMagpieShared("goose", gooseProviderID+"/")...)
},
}, {
// GOOSE_THINKING_EFFORT, the effort goose asks of a model that
@@ -1733,7 +1733,7 @@ func crushAt(at place, path, data string) *Agent {
}
}
}
return append(ownOptions("", cur[key], extra...), viaMagpie("crush", magpieID+"/")...)
return append(ownOptions("", cur[key], extra...), viaMagpieShared("crush", magpieID+"/")...)
}
}
// replacePick puts v in place of the whole models.<type> object in the
+1 -1
View File
@@ -391,7 +391,7 @@ func agyIn(at place) *Agent {
if c := cur["model"]; c != "" && !usesMagpie(c) && custom[c] == nil {
own = append([]Option{{Value: c, Icon: modelIcon("", c), Direct: "Google"}}, own...)
}
return append(group("Antigravity CLI", own), viaMagpie("agy", magpieID+"/")...)
return append(group("Antigravity CLI", own), viaMagpieShared("agy", magpieID+"/")...)
},
}},
}
+1 -1
View File
@@ -757,7 +757,7 @@ func alma() *Agent {
Get: almaGet,
Set: almaSet,
Options: func(map[string]string) []Option {
return append(almaOwn(), viaMagpie("alma", magpieID+"/")...)
return append(almaOwn(), viaMagpieShared("alma", magpieID+"/")...)
},
}},
}
+1 -1
View File
@@ -54,7 +54,7 @@ func asideIn(at place) *Agent {
}
return opts
}
return append(asideOwnOptions(c.models, cur[key]), viaMagpie("aside", "magpie/")...)
return append(asideOwnOptions(c.models, cur[key]), viaMagpieShared("aside", "magpie/")...)
}
a.Fields = append(a.Fields, f)
}
+1 -1
View File
@@ -302,7 +302,7 @@ func astrbotAt(at place) *Agent {
return setPick(v)
},
Options: func(cur map[string]string) []Option {
return append(astrbotOwn(path, cur["model"]), viaMagpie("astrbot", magpieID+"/")...)
return append(astrbotOwn(path, cur["model"]), viaMagpieShared("astrbot", magpieID+"/")...)
},
}},
}, path)
+1 -1
View File
@@ -221,7 +221,7 @@ func atomcodeIn(at place) *Agent {
return nil
},
Options: func(c map[string]string) []Option {
return append(atomcodeOwnModels(path, c["model"]), viaMagpie("atomcode", magpieID+"/")...)
return append(atomcodeOwnModels(path, c["model"]), viaMagpieShared("atomcode", magpieID+"/")...)
},
}, {
// the current model table's reasoning_effort, sent with every
+2 -2
View File
@@ -992,7 +992,7 @@ func claudeIn(at place) *Agent {
// provider the label already says is left "via magpie".
labels := listLabels("claude")
rows := []any{}
for _, o := range viaMagpie("claude", "") {
for _, o := range viaMagpieShared("claude", "") {
if slices.ContainsFunc(onTier, func(v string) bool { return claudeSameModel(v, o.Value) }) {
continue
}
@@ -1039,7 +1039,7 @@ func claudeIn(at place) *Agent {
}
mark1M := claude1M()
var refs []string
for _, o := range viaMagpie("claude", "") {
for _, o := range viaMagpieShared("claude", "") {
refs = append(refs, mark1M(o.Value))
}
return refs
+1 -1
View File
@@ -254,7 +254,7 @@ func clineIn(at place) *Agent {
edit.KV{Path: "providers." + p + ".settings.model", Value: v})
},
Options: func(cur map[string]string) []Option {
return append(ownOptions("", cur["model"]), viaMagpie("cline", magpieID+"/")...)
return append(ownOptions("", cur["model"]), viaMagpieShared("cline", magpieID+"/")...)
},
}, {
// the reasoning of the provider in use, what Cline's --thinking
+1 -1
View File
@@ -104,7 +104,7 @@ func codebuddyIn(at place) *Agent {
if v := cur["model"]; v != "" && !usesMagpie(v) {
out = append(out, Option{Value: v, Icon: modelIcon("", v)})
}
return append(out, viaMagpie("codebuddy", magpieID+"/")...)
return append(out, viaMagpieShared("codebuddy", magpieID+"/")...)
},
}},
}
+2 -2
View File
@@ -1265,7 +1265,7 @@ func codexIn(at place) *Agent {
// models direct only). Routed, Codex's own say via magpie already.
onSignIn := (p == "" || p == "openai" || isCCSwitchMirror(p)) && chatGPT()
if !through && (!onSignIn || codexFailover()) {
return append(own, viaMagpie("codex", "")...)
return append(own, viaMagpieShared("codex", "")...)
}
return append(own, codexViaMagpieFor(own)...)
}
@@ -2194,7 +2194,7 @@ func codexViaMagpieFor(own []Option) []Option {
}
}
var hidden, out []Option
for _, o := range viaMagpie("codex", "") {
for _, o := range viaMagpieShared("codex", "") {
if !strings.HasPrefix(o.Value, "codex/") {
out = append(out, o)
} else if !in[codexOwnOf(o.Value)] {
+1 -1
View File
@@ -98,7 +98,7 @@ func commandCodeIn(at place) *Agent {
if v := cur["model"]; v != "" && !usesMagpie(v) {
out = append(out, Option{Value: v, Icon: modelIcon("", v)})
}
return append(out, viaMagpie("commandcode", magpieID+"/")...)
return append(out, viaMagpieShared("commandcode", magpieID+"/")...)
},
}, {
// settings.json's reasoningEffort keeps an effort for each model
+1 -1
View File
@@ -450,7 +450,7 @@ func droidIn(at place) *Agent {
if c := cur["model"]; c != "" && !usesMagpie(c) && !seen[c] {
own = append([]Option{{Value: c, Icon: modelIcon("", c)}}, own...)
}
return append(group("Droid", own), viaMagpie("droid", magpieID+"/")...)
return append(group("Droid", own), viaMagpieShared("droid", magpieID+"/")...)
},
}},
}
+1 -1
View File
@@ -225,7 +225,7 @@ func dshAt(at place) *Agent {
own[i].Direct = "DeepSeek"
}
}
return append(own, viaMagpie("dsh", magpieID+"/")...)
return append(own, viaMagpieShared("dsh", magpieID+"/")...)
},
}, {
// the thinking effort sessions start with: agent-default-model's
+1 -1
View File
@@ -170,7 +170,7 @@ func empryoAt(at place) *Agent {
_, id, _ := strings.Cut(c, "/")
own = append(own, Option{Value: c, Icon: modelIcon("", id)})
}
return append(group("Empryo", own), viaMagpie("empryo", magpieID+"/")...)
return append(group("Empryo", own), viaMagpieShared("empryo", magpieID+"/")...)
},
}},
}, path)
+1 -1
View File
@@ -118,7 +118,7 @@ func fxIn(at place) *Agent {
if v := cur["model"]; v != "" && !usesMagpie(v) {
out = append(out, Option{Value: v, Icon: modelIcon("", v)})
}
return append(out, viaMagpie("fx", magpieID+"/")...)
return append(out, viaMagpieShared("fx", magpieID+"/")...)
},
}},
}
+1 -1
View File
@@ -261,7 +261,7 @@ func geminiIn(at place) *Agent {
}
}
own := group("Gemini CLI", options(ms, ""))
return append(own, viaMagpie("gemini", "")...)
return append(own, viaMagpieShared("gemini", "")...)
},
},
},
+1 -1
View File
@@ -412,7 +412,7 @@ func grokApp(home string) *Agent {
return setDefault(v)
},
Options: func(cur map[string]string) []Option {
return append(grokAppOwn(path, keyDefault, cur["model"]), viaMagpie("grok-app", magpieID+"/")...)
return append(grokAppOwn(path, keyDefault, cur["model"]), viaMagpieShared("grok-app", magpieID+"/")...)
},
}},
}, path)
+1 -1
View File
@@ -169,7 +169,7 @@ func hanako(home string) *Agent {
return hanakoChat(dir, agent, v)
},
Options: func(cur map[string]string) []Option {
return append(hanakoOwn(dir, cur["model"]), viaMagpie("hanako", magpieID+"/")...)
return append(hanakoOwn(dir, cur["model"]), viaMagpieShared("hanako", magpieID+"/")...)
},
}},
}
+2 -2
View File
@@ -222,7 +222,7 @@ func hermesIn(at place) *Agent {
return edit.SetYAML(path, edit.KV{Path: "model.default", Value: v})
},
Options: func(cur map[string]string) []Option {
return append(ownOptions("", cur["model"]), viaMagpie("hermes", magpieID+"/")...)
return append(ownOptions("", cur["model"]), viaMagpieShared("hermes", magpieID+"/")...)
},
}, {
// agent.reasoning_effort, which Hermes's /reasoning saves; none
@@ -323,7 +323,7 @@ func hermesProfileFields(at place, dir string, provider func(string) any) []Fiel
return edit.SetYAML(p, edit.KV{Path: "model.default", Value: v})
},
Options: func(cur map[string]string) []Option {
return append(ownOptions("", cur[hermesProfileKey+name]), viaMagpie("hermes", magpieID+"/")...)
return append(ownOptions("", cur[hermesProfileKey+name]), viaMagpieShared("hermes", magpieID+"/")...)
},
})
}
+1 -1
View File
@@ -353,7 +353,7 @@ func jcodeAt(at place) *Agent {
return setPick(jcodePick{c.Provider.DefaultProvider, v})
},
Options: func(cur map[string]string) []Option {
return append(jcodeOwn(path, keyPick, cur["model"]), viaMagpie("jcode", magpieID+"/")...)
return append(jcodeOwn(path, keyPick, cur["model"]), viaMagpieShared("jcode", magpieID+"/")...)
},
}},
}, path)
+1 -1
View File
@@ -361,7 +361,7 @@ func kimiIn(at place) *Agent {
return dropMagpie()
},
Options: func(cur map[string]string) []Option {
return append(kimiOwnOptions(path, cur["model"]), viaMagpie("kimi", magpieID+"/")...)
return append(kimiOwnOptions(path, cur["model"]), viaMagpieShared("kimi", magpieID+"/")...)
},
}},
}, path)
+1 -1
View File
@@ -189,7 +189,7 @@ func miniMaxAt(at place, dir string) *Agent {
return nil
},
Options: func(cur map[string]string) []Option {
return append(miniMaxOwnOptions(path, cur["model"]), viaMagpie("minimax-code", magpieID+"/")...)
return append(miniMaxOwnOptions(path, cur["model"]), viaMagpieShared("minimax-code", magpieID+"/")...)
},
}},
}, path)
+1 -1
View File
@@ -153,7 +153,7 @@ func morphIn(at place) *Agent {
return edit.SetYAML(path, edit.KV{Path: "llm.model", Value: v})
},
Options: func(cur map[string]string) []Option {
return append(ownOptions("", cur["model"]), viaMagpie("morph", magpieID+"/")...)
return append(ownOptions("", cur["model"]), viaMagpieShared("morph", magpieID+"/")...)
},
}, {
// llm.reasoning_effort; unset, morph sends none
+1 -1
View File
@@ -119,7 +119,7 @@ func mothxIn(at place) *Agent {
return pair(v)
},
Options: func(cur map[string]string) []Option {
return append(mothxOwn(path, cur["model"]), viaMagpie("mothx", magpieID+"/")...)
return append(mothxOwn(path, cur["model"]), viaMagpieShared("mothx", magpieID+"/")...)
},
},
{
+1 -1
View File
@@ -153,7 +153,7 @@ func museAt(at place, cfg string) *Agent {
if c := cur["model"]; c != "" && !usesMagpie(c) {
own = append(own, Option{Value: c, Icon: museIcon(c)})
}
return append(group("Muse Code", own), viaMagpie("muse", magpieID+"/")...)
return append(group("Muse Code", own), viaMagpieShared("muse", magpieID+"/")...)
},
}},
}, path)
+1 -1
View File
@@ -342,7 +342,7 @@ func ompAt(at place, dir string, entry func() ompProviderEntry) *Agent {
return dropMagpie()
},
Options: func(cur map[string]string) []Option {
opts := append(ompOwnOptions(pick("models"), cur[key]), viaMagpie("omp", magpieID+"/")...)
opts := append(ompOwnOptions(pick("models"), cur[key]), viaMagpieShared("omp", magpieID+"/")...)
// a catalog model with a thinking level is offered as it
// reads, beside the model: that keeps the level, the model
// alone clears it
+1 -1
View File
@@ -167,7 +167,7 @@ func openChamber(home, cfg string) *Agent {
provider := openCodeKept(ocPath, func() any { return magpieProviderJSONFor("opencode", "opencode") })
opts := func(key string) func(map[string]string) []Option {
return func(cur map[string]string) []Option {
return append(ownOptions(auth, cur[key]), viaMagpie("opencode", magpieID+"/")...)
return append(ownOptions(auth, cur[key]), viaMagpieShared("opencode", magpieID+"/")...)
}
}
// stepped off magpie: its provider goes too, when nothing else in the
+1 -1
View File
@@ -478,7 +478,7 @@ func openClawAt(at place) *Agent {
return patch([]edit.KV{{Path: openClawModel, Value: v}}, nil)
},
Options: func(cur map[string]string) []Option {
return append(openClawOwn(keyWas, cur["model"]), viaMagpie("openclaw", magpieID+"/")...)
return append(openClawOwn(keyWas, cur["model"]), viaMagpieShared("openclaw", magpieID+"/")...)
},
}},
}, path)
+1 -1
View File
@@ -289,7 +289,7 @@ func penguinIn(at place) *Agent {
return dropMagpie()
},
Options: func(cur map[string]string) []Option {
return append(penguinOwnOptions(path, cur["model"]), viaMagpie("penguin", magpieID+"/")...)
return append(penguinOwnOptions(path, cur["model"]), viaMagpieShared("penguin", magpieID+"/")...)
},
}},
}, path)
+1 -1
View File
@@ -420,7 +420,7 @@ func plugged(home string, p *agentplug.Agent) *Agent {
return f.set([]edit.KV{{Path: d.Model, Value: v}})
},
Options: func(cur map[string]string) []Option {
return append(ownOptions("", cur["model"]), viaMagpie(id, magpieID+"/")...)
return append(ownOptions("", cur["model"]), viaMagpieShared(id, magpieID+"/")...)
},
}},
// the catalog changed: what connect writes for the model may too
+1 -1
View File
@@ -189,7 +189,7 @@ func qoderAt(at place, b qoderBuild) *Agent {
return edit.SetJSON(path, edit.KV{Path: "model.name", Value: v})
},
Options: func(cur map[string]string) []Option {
return append(ownOptions("", cur["model"]), viaMagpie(b.id, magpieID+"/")...)
return append(ownOptions("", cur["model"]), viaMagpieShared(b.id, magpieID+"/")...)
},
}, {
// the effort of the model in use, in its model.preferences
+1 -1
View File
@@ -406,7 +406,7 @@ func qwenIn(at place) *Agent {
return setProviders(false)
},
Options: func(cur map[string]string) []Option {
return append(qwenOwnOptions(path, cur["model"]), viaMagpie("qwen", magpieID+"/")...)
return append(qwenOwnOptions(path, cur["model"]), viaMagpieShared("qwen", magpieID+"/")...)
},
}},
}, path)
+1 -1
View File
@@ -393,7 +393,7 @@ func reasonixIn(at place) *Agent {
addNative(*state.Default)
}
addNative(cur["model"])
return append(group("Reasonix Studio", own), viaMagpie("reasonix", magpieID+"/")...)
return append(group("Reasonix Studio", own), viaMagpieShared("reasonix", magpieID+"/")...)
},
},
{Key: "effort", Label: "effort", Quiet: true,
+15 -2
View File
@@ -30,7 +30,15 @@ const RoutingGroups = "Routing groups"
// provider. Built again only when provider.StampNow moved, or
// magpieModelsFor after it was; each caller is given its own copy.
func viaMagpie(agent, prefix string) []Option {
return builtOptions.get(agent+"\x00"+prefix, func() []Option { return buildVia(agent, prefix) })
return slices.Clone(viaMagpieShared(agent, prefix))
}
// viaMagpieShared is viaMagpie without a copy of its own, for a caller
// that only reads it or appends it onto a list of its own: a copy for each
// of an agent's fields was 42 MB of what twenty window polls allocated.
// An append onto it makes a copy, but its Options are never written into.
func viaMagpieShared(agent, prefix string) []Option {
return builtOptions.shared(agent+"\x00"+prefix, func() []Option { return buildVia(agent, prefix) })
}
// builtOptions is what viaMagpie built last, per agent and prefix. Each
@@ -223,6 +231,11 @@ type stampedList[T any] struct {
}
func (s *stampedLists[T]) get(key string, build func() []T) []T {
return slices.Clone(s.shared(key, build))
}
// shared is get without the caller's own copy: the list kept, read only.
func (s *stampedLists[T]) shared(key string, build func() []T) []T {
s.Lock()
b, ok := s.m[key]
s.Unlock()
@@ -238,7 +251,7 @@ func (s *stampedLists[T]) get(key string, build func() []T) []T {
s.m[key] = b
s.Unlock()
}
return slices.Clone(b.list)
return slices.Clip(b.list)
}
// magpieModelsFor is how long a list is kept while provider.StampNow says
+1 -1
View File
@@ -339,7 +339,7 @@ func snowIn(at place) *Agent {
return leave(to)
},
Options: func(cur map[string]string) []Option {
return append(snowOwnOptions(profiles, cur["model"]), viaMagpie("snow", magpieID+"/")...)
return append(snowOwnOptions(profiles, cur["model"]), viaMagpieShared("snow", magpieID+"/")...)
},
}, {
// basicModel, the light model Snow's summaries, compaction and
+1 -1
View File
@@ -626,7 +626,7 @@ func stepcodeIn(at place) *Agent {
return nil
},
Options: func(cur map[string]string) []Option {
return append(ownOptions(authPath, cur["model"]), viaMagpie("stepcode", magpieID+"/")...)
return append(ownOptions(authPath, cur["model"]), viaMagpieShared("stepcode", magpieID+"/")...)
},
},
},
+43
View File
@@ -0,0 +1,43 @@
package agent
import (
"reflect"
"slices"
"strconv"
"testing"
)
// A look that only reads a kept list, or appends it onto one of its own,
// shares the list: a copy for each look was 42 MB of what twenty window
// polls allocated. get still hands each caller a copy of its own, and an
// append onto the shared list never writes into what is kept.
func TestKeptListSharedWithoutACopy(t *testing.T) {
var s stampedLists[Option]
build := func() []Option {
out := make([]Option, 500)
for i := range out {
out[i] = Option{Value: "p/m" + strconv.Itoa(i), Note: "via magpie"}
}
return out
}
want := slices.Clone(s.shared("k", build))
for range 20 {
// the kept array itself, not a copy of it (~100 KB for 500); a
// change of the stamp while the package's tests run builds it
// again, and that one is kept
got := s.shared("k", build)
s.Lock()
kept := s.m["k"].list
s.Unlock()
if &got[0] != &kept[0] {
t.Fatal("a shared look copies the kept list")
}
}
grown := append(s.shared("k", build), Option{Value: "mine"})
grown[0].Value = "changed"
own := s.get("k", build)
own[1].Value = "changed too"
if got := s.shared("k", build); !reflect.DeepEqual(got, want) {
t.Fatalf("the kept list was written into: %q, %q", got[0].Value, got[1].Value)
}
}
+1 -1
View File
@@ -380,7 +380,7 @@ func vscodeKindAt(k vscodeKind, dir string) *Agent {
if v := cur["model"]; v != "" && v != "auto" && !usesMagpie(v) {
own = append(own, Option{Value: v, Icon: modelIcon("", v)})
}
return append(group(k.name, own), viaMagpie(k.id, magpieID+"/")...)
return append(group(k.name, own), viaMagpieShared(k.id, magpieID+"/")...)
},
}},
}, path, models, stashPath())
+14 -14
View File
@@ -441,7 +441,7 @@ var wslKinds = []wslKind{
// over several accounts magpie routes, so they are
// offered via magpie too, as on a live Codex (#1603)
if codexFailover() {
return append(group("OpenAI", options(ownCodex(), "")), viaMagpie("codex", "")...)
return append(group("OpenAI", options(ownCodex(), "")), viaMagpieShared("codex", "")...)
}
own := codexInMagpie(group("OpenAI", options(ownCodex(), "")))
return append(own, codexViaMagpieFor(own)...)
@@ -471,7 +471,7 @@ var wslKinds = []wslKind{
if key == "model" {
// the providers of its auth.json are the distro's files
return func(cur map[string]string) []Option {
return append(ownOptions("", cur["model"]), viaMagpie("pi", magpieID+"/")...)
return append(ownOptions("", cur["model"]), viaMagpieShared("pi", magpieID+"/")...)
}
}
return nil
@@ -482,7 +482,7 @@ var wslKinds = []wslKind{
asleep: func(key string) func(map[string]string) []Option {
if key == "model" {
return func(cur map[string]string) []Option {
return append(ownOptions("", cur["model"]), viaMagpie("omo", magpieID+"/")...)
return append(ownOptions("", cur["model"]), viaMagpieShared("omo", magpieID+"/")...)
}
}
return nil
@@ -493,7 +493,7 @@ var wslKinds = []wslKind{
asleep: func(key string) func(map[string]string) []Option {
if key == "model" {
return func(cur map[string]string) []Option {
return append(ownOptions("", cur["model"]), viaMagpie("prime-agent", magpieID+"/")...)
return append(ownOptions("", cur["model"]), viaMagpieShared("prime-agent", magpieID+"/")...)
}
}
return nil
@@ -560,7 +560,7 @@ var wslKinds = []wslKind{
return nil
}
return func(cur map[string]string) []Option {
return append(kimiOwnOptions("", cur["model"]), viaMagpie("kimi", magpieID+"/")...)
return append(kimiOwnOptions("", cur["model"]), viaMagpieShared("kimi", magpieID+"/")...)
}
}},
// Qwen Code's ~/.qwen, one settings.json of the same shape as this
@@ -572,7 +572,7 @@ var wslKinds = []wslKind{
return nil
}
return func(cur map[string]string) []Option {
return append(qwenOwnOptions("", cur["model"]), viaMagpie("qwen", magpieID+"/")...)
return append(qwenOwnOptions("", cur["model"]), viaMagpieShared("qwen", magpieID+"/")...)
}
}},
{id: "omp", name: "omp", dir: ".omp", bin: "omp", in: ompIn, version: true,
@@ -582,7 +582,7 @@ var wslKinds = []wslKind{
return nil
}
return func(cur map[string]string) []Option {
return append(ompOwnOptions("", cur[key]), viaMagpie("omp", magpieID+"/")...)
return append(ompOwnOptions("", cur[key]), viaMagpieShared("omp", magpieID+"/")...)
}
}},
{id: "crush", name: "Crush", dir: ".config/crush", bin: "crush", in: crushIn,
@@ -620,7 +620,7 @@ var wslKinds = []wslKind{
if c := cur["model"]; c != "" && !usesMagpie(c) {
own = append(own, Option{Value: c, Icon: modelIcon("", c)})
}
return append(group("Droid", own), viaMagpie("droid", magpieID+"/")...)
return append(group("Droid", own), viaMagpieShared("droid", magpieID+"/")...)
}
}},
// no bin: fx is also the JSON viewer's name
@@ -635,7 +635,7 @@ var wslKinds = []wslKind{
return nil
}
return func(cur map[string]string) []Option {
return append(miniMaxOwnOptions("", cur["model"]), viaMagpie("minimax-code", magpieID+"/")...)
return append(miniMaxOwnOptions("", cur["model"]), viaMagpieShared("minimax-code", magpieID+"/")...)
}
}},
// version: a dsh with no profile yet is told from one before profiles
@@ -651,7 +651,7 @@ var wslKinds = []wslKind{
for i := range own {
own[i].Direct = "DeepSeek"
}
return append(own, viaMagpie("dsh", magpieID+"/")...)
return append(own, viaMagpieShared("dsh", magpieID+"/")...)
}
}
if key != "effort" {
@@ -692,7 +692,7 @@ var wslKinds = []wslKind{
}
// the models of its config.toml are the distro's files
return func(cur map[string]string) []Option {
return append(atomcodeOwnModels("", cur["model"]), viaMagpie("atomcode", magpieID+"/")...)
return append(atomcodeOwnModels("", cur["model"]), viaMagpieShared("atomcode", magpieID+"/")...)
}
}},
// Snow CLI's ~/.snow, its profiles the distro's own; a stopped
@@ -737,7 +737,7 @@ var wslKinds = []wslKind{
if c := cur["model"]; c != "" && !usesMagpie(c) {
own = append(own, Option{Value: c, Icon: modelIcon("", c), Direct: "Google"})
}
return append(group("Antigravity CLI", own), viaMagpie("agy", magpieID+"/")...)
return append(group("Antigravity CLI", own), viaMagpieShared("agy", magpieID+"/")...)
}
}},
// Block's goose, by its folder alone: a goose command may be pressly's
@@ -766,7 +766,7 @@ var wslKinds = []wslKind{
switch key {
case "model", "planner":
return func(cur map[string]string) []Option {
out := append(ownOptions("", cur[key]), viaMagpie("reasonix", magpieID+"/")...)
out := append(ownOptions("", cur[key]), viaMagpieShared("reasonix", magpieID+"/")...)
if key == "planner" {
out = append([]Option{{Value: "off", Label: "off", Note: "Disable the separate planner"}}, out...)
}
@@ -799,7 +799,7 @@ func wslOwnAsleep(id string, keys ...string) func(string) func(map[string]string
return nil
}
return func(cur map[string]string) []Option {
return append(ownOptions("", cur[key]), viaMagpie(id, magpieID+"/")...)
return append(ownOptions("", cur[key]), viaMagpieShared(id, magpieID+"/")...)
}
}
}
+1 -1
View File
@@ -128,7 +128,7 @@ func zedAtWith(dir, bin string, processes []string) *Agent {
if v := cur["model"]; v != "" && !usesMagpie(v) {
own = append(own, Option{Value: v, Icon: modelIcon("", v)})
}
return append(group("Zed", own), viaMagpie("zed", magpieID+"/")...)
return append(group("Zed", own), viaMagpieShared("zed", magpieID+"/")...)
},
}},
}, path, stashPath())