After signing in to Trae CN (a plugin's subscription), Pi's models.json
kept the list it had before the sign-in, so Pi's picker had no trae-cn/*
model while settings.json named one. A plugin's sign-in change
(plugin.OnChange) only dropped what the gateway held; catalog.Changed
(SyncCatalog), which a provider saved runs, never ran for a plugin. Now
plugin.OnChange and a new plugin.OnListed (told when the host lists
providers/models other than the list kept, also across a restart) call
catalog.Touched, so every connected agent's own model list follows, Pi's
models.json among them, and a sign-out takes the models out again.
Not reproduced: the report's GUI pick leaving models.json's mtime
unchanged. GUI and CLI picks go through the same Agent.Pick, which writes
models.json in-process here. With this change the file is rewritten when
the plugin lists its models, not only on a pick. PiCode's providers.json
isn't wired by magpie at all; unchanged.
Tests:
- TestPluginSignInReachesPiModels (internal/agent): pick a model, sign
Trae CN in, models.json lists trae-cn/kimi-k3-max; sign out, gone.
Broken by hand (hold.go back to plugin.OnChange(Changed)): FAIL
"models.json hasn't Trae CN's models after its sign-in".
- TestNewListIsTold (internal/plugin): a new list is told once, the same
list or the one kept on disk is not. Broken by hand (listed() not
called): FAIL "the first list: told 0 times, want 1".
Run at origin/main 9d97fd073 + this change and the #2373/#2372/#2374 commits beside it (one tree), -tags nogui -count=1
-timeout 45m: internal/plugin, provider, agent, catalog, gui,
gateway ok. gofmt -l clean; go vet -tags nogui ./... for GOOS darwin,
linux, windows clean.
Full suite: SUITE_LINE