Files
magpie/internal/gui/paseo_state_test.go
T
yetone 85e6ec5406 agent: Paseo's Claude model picker lists magpie's models (@TheMist016 on X)
Paseo (getpaseo/paseo) starts the same Claude Code, but builds its own model
list: first-party models plus settings.json's `model` and a few
ANTHROPIC_*_MODEL variables (providers/claude/models.ts). It never reads
Claude Code's modelPicker, where magpie writes every model, so the rest were
not selectable in Paseo. Paseo's own ~/.paseo/config.json takes
agents.providers.claude.additionalModels ([{id,label,description}], checked
against protocol/src/provider-config.ts) and passes each id to Claude Code as
written.

New agent "Paseo" (detected by ~/.paseo or PASEO_HOME): its switch writes the
models Claude Code's /model lists (same ids, [1m] marks, names; only the ones
picked for it) there, marked "via magpie" in the description; the user's own
entries and keys stay, off takes out only magpie's, a sync refreshes when on.
Claude Code must be connected to magpie as well.

Run (mote-run, sandbox HOME in tests): TestPaseoAdditionalModels,
TestStateListsPaseo, internal/agentenv, internal/gui full package ok;
internal/agent full run red only on TestPiGroupEntryKeepsItsMembers, which is
red the same on origin/main 12cd456f2 (passes alone; filed). gofmt clean,
vet darwin, windows and linux nogui on internal/agent. Broken by hand: Set
writing no models goes red.
Not tried: a real Paseo daemon reading the file (checked against its schema
source only); GUI browser suites.
2026-11-11 23:08:39 +08:00

34 lines
726 B
Go

package gui
import (
"os"
"path/filepath"
"testing"
)
// Paseo is on the page once ~/.paseo is there, with magpie to put in its
// Claude model picker (@TheMist016 on X).
func TestStateListsPaseo(t *testing.T) {
home := sandboxHome(t)
t.Setenv("PASEO_HOME", "")
find := func() *agentJSON {
for _, a := range state().Agents {
if a.ID == "paseo" {
return &a
}
}
return nil
}
if find() != nil {
t.Fatal("listed with no ~/.paseo")
}
os.MkdirAll(filepath.Join(home, ".paseo"), 0o755)
a := find()
if a == nil {
t.Fatal("Paseo not listed")
}
if a.Name != "Paseo" || len(a.Fields) != 1 || a.Fields[0].Key != "provider" || a.Fields[0].Options[0].Value != "magpie" {
t.Fatalf("Paseo: %+v", a)
}
}