Files
magpie/internal/plugin/withdrawn.go
T
yetone 256910f174 plugin: Antigravity's plugin keeps serving whoever has it, and is given to nobody new
The owner (11-15): "正在使用的继续正常,加个提示,新用户不让下载". Google
suspends accounts it sees on Code Assist through Antigravity's own client,
so 9cd5f3652 retired the plugin outright (0.2.0 answered every request with
a 410). Now its users keep it working and are told the risk; nobody new
gets it.

- internal/plugin/withdrawn.go: a list of withdrawn packages (Antigravity's,
  pointing to agy-cli). plugin.Add, the one place the CLI, the GUI,
  Discover and import links install through, turns a withdrawn package
  away unless this magpie has it listed already (on or off), and says
  what to use instead. Upgrade and AddExact (backup, sync) are not gated:
  they act on a plugin the user has.
- The mover installs it for the user's own accounts (move,
  keepMovedCurrent) under plugin.KeepWithdrawn; Adopt, which brings no
  accounts, is a new user and is turned away. Antigravity's min is 0.2.1,
  plugins c0c625ac: the 0.1.18 plugin restored, out of the registry.
- /api/providers lists the withdrawn plugins kept in `withdrawn`, and the
  Providers page draws a line over the list: the risk, why, and "Use
  Antigravity (local agy CLI)", which opens Plugins on "agy". New strings
  in zh, zh-TW, ja and de. depLine() now draws all three kinds of
  Providers line (discovery off, unmoved, this one), which keeps app.js
  inside its budget without a raise.
- AGENTS.md, provider-plugins.md and the site's subscriptions docs (en,
  zh, ja, search index) say the plugin keeps working for its users and
  is withdrawn for anyone new.

Run on mote at this tree (base 52e83f7b5). After the rebase onto
500f39886 (testenv, qianfan, LESSONS upstream), again at this head: go vet
and go test -count=1 of internal/plugin, internal/provider, internal/gui,
internal/testenv and the root package, all ok. Before it:
- go vet, GOOS=linux go vet -tags nogui and GOOS=windows go vet of
  internal/plugin, internal/provider and internal/gui: ok. gofmt -l clean.
- go test -count=1 ./internal/plugin ./internal/provider ./internal/gui
  (whole packages, TestCoreScriptBudget and the i18n guards in them): ok.
- node --test providers-withdrawn (new; chromium and webkit, en zh
  zh-TW ja de, 1100 and 420), deprecation-notice, plugin-move,
  plugin-move-overflow, retired-move, deprecated-subscriptions, i18n-keys,
  providers-discovery-off, plugin-movable-review, providers-off-fold: ok.
  plugin-move-unserved's 'Try again takes the models unticked' is red 4 of
  4, the same at origin/main 500f39886 alone: #4410.
- Broken by hand: without RefuseWithdrawn in Add,
  TestWithdrawnGivenToNobodyNew goes red (Add goes on to install); without
  KeepWithdrawn in move, TestWithdrawnPluginKeptForItsUsers goes red (the
  user's own move is turned away).
- Plugins: bun scripts/check.mjs all and bun test packages/antigravity
  packages/agy-cli scripts, 195 pass; dist index.json has 0.2.1.

Not tried: a real Antigravity account through 0.2.1 (it is 0.1.18's code,
which served until 11-15), and the CLI/TUI show no notice beyond Add's
refusal.
2026-11-16 03:00:18 +08:00

72 lines
2.4 KiB
Go

package plugin
import (
"context"
"fmt"
"slices"
)
// Withdrawal is an official package magpie gives to nobody new: a user
// who has it keeps it, updated as before, and is told the risk and what
// to use instead; everyone else is turned away at Add.
type Withdrawal struct {
// ID and Name are the provider the package serves
ID string `json:"id"`
Name string `json:"name"`
// Instead is the provider to use in its place, and Package its plugin
Instead string `json:"instead"`
Package string `json:"package"`
}
// withdrawn, by package name.
var withdrawn = map[string]Withdrawal{
// Google suspends accounts it sees calling Code Assist through
// Antigravity's own client, as this plugin does (the owner, 11-15:
// 正在使用的继续正常,加个提示,新用户不让下载)
"@magpie-community/opencode-antigravity-auth": {ID: "antigravity", Name: "Antigravity", Instead: "Antigravity (local agy CLI)", Package: "@magpie-community/opencode-agy-cli-auth"},
}
// WithdrawnOf is the withdrawal of the package name, if it is withdrawn.
func WithdrawnOf(name string) (Withdrawal, bool) {
w, ok := withdrawn[name]
return w, ok
}
// WithdrawnKept are the withdrawn packages this magpie still has listed,
// on or off: their users, who are told the risk.
func WithdrawnKept() []Withdrawal {
var out []Withdrawal
for _, e := range Load().Plugins {
if w, ok := withdrawn[PackageName(e.Spec)]; ok && !slices.Contains(out, w) {
out = append(out, w)
}
}
return out
}
type keepWithdrawnKey struct{}
// KeepWithdrawn lets an Add under ctx install a withdrawn package: the
// move of the user's own accounts onto it, or keeping a moved user's
// plugin current.
func KeepWithdrawn(ctx context.Context) context.Context {
return context.WithValue(ctx, keepWithdrawnKey{}, true)
}
// RefuseWithdrawn turns away an add of a withdrawn package that this
// magpie doesn't have listed already.
func RefuseWithdrawn(ctx context.Context, spec string) error {
if IsPath(spec) || ctx.Value(keepWithdrawnKey{}) != nil {
return nil
}
name := PackageName(spec)
w, ok := withdrawn[name]
if !ok {
return nil
}
if slices.ContainsFunc(Load().Plugins, func(e Entry) bool { return PackageName(e.Spec) == name }) {
return nil
}
return fmt.Errorf("%s is no longer installed: its vendor suspends accounts it sees used this way. Use %s instead: magpie plugin add %s", name, w.Instead, w.Package)
}