Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
plugin: the update check asks npm now, not what it said within the hour
yetonef4a575954b74
diff --git a/internal/plugin/market.go b/internal/plugin/market.goindex ba6951bba..5044ec5ce 100644--- a/internal/plugin/market.go+++ b/internal/plugin/market.go@@ -310,6 +310,12 @@ func npmPath(name string) string { return strings.Replace(url.PathEscape(name),// its answer, when it comes, is kept for the next time. A package npm// doesn't have has no Version.func Info(ctx context.Context, names []string) map[string]NPM {+ return infoWithin(ctx, names, time.Hour)+}++// infoWithin is Info asking npm of each package it last answered for over+// age ago; 0 asks of every one.+func infoWithin(ctx context.Context, names []string, age time.Duration) map[string]NPM {out := map[string]NPM{}var mu sync.Mutexvar wg sync.WaitGroup@@ -330,7 +336,7 @@ func Info(ctx context.Context, names []string) map[string]NPM {e, hit := cache[n]if hit {out[n] = e.Info // what it said last, until it says otherwise- if time.Since(e.At) < time.Hour {+ if time.Since(e.At) < age {continue}}diff --git a/internal/plugin/market_npm_test.go b/internal/plugin/market_npm_test.goindex bece7045c..56dfceca6 100644--- a/internal/plugin/market_npm_test.go+++ b/internal/plugin/market_npm_test.go@@ -183,3 +183,30 @@ func TestNPMInfoGivesIcon(t *testing.T) {}}}++// The update check asks npm now, not what it said within the hour: a+// community fix published a few minutes after the page last asked reaches+// a magpie started since at its first look (ysm119 on Discord).+func TestUpdateCheckAsksNPMNow(t *testing.T) {+ var version atomic.Value+ version.Store("1.2.3")+ fakeNPM(t, func(w http.ResponseWriter, r *http.Request) {+ if strings.HasPrefix(r.URL.Path, "/downloads/") {+ w.Write([]byte(`{"downloads":1}`))+ return+ }+ w.Write([]byte(`{"version":"` + version.Load().(string) + `"}`))+ })+ ctx := context.Background()+ pkg := "@magpie-community/opencode-x-auth"+ if got := Info(ctx, []string{pkg})[pkg].Version; got != "1.2.3" {+ t.Fatalf("first ask: %q", got)+ }+ version.Store("1.2.4")+ if got := Info(ctx, []string{pkg})[pkg].Version; got != "1.2.3" {+ t.Fatalf("the page within the hour: %q, want what npm said last", got)+ }+ if got := latestOf(ctx, []string{pkg})[pkg]; got != "1.2.4" {+ t.Fatalf("the update check: %q, want npm's version now", got)+ }+}diff --git a/internal/plugin/updates.go b/internal/plugin/updates.goindex 396ba8062..21d22bea1 100644--- a/internal/plugin/updates.go+++ b/internal/plugin/updates.go@@ -89,11 +89,15 @@ func Pinned(spec string) bool {var (updatesMu sync.Mutex- // latestOf is the version npm has of each package, "" for one it- // didn't tell (tests stub it)+ // latestOf is the version npm has of each package, asked now, "" for+ // one it never told (tests stub it). Not Info's answer of up to an+ // hour ago: a magpie started after a community fix was published, or+ // the hourly look, found the version before it and updated nothing+ // for another hour (ysm119 on Discord: Cursor's 0.2.25 a quarter of an+ // hour after it was published, on a magpie started since).latestOf = func(ctx context.Context, names []string) map[string]string {out := map[string]string{}- for n, i := range Info(ctx, names) {+ for n, i := range infoWithin(ctx, names, 0) {out[n] = i.Version}return out