Files
magpie/AGENTS.md
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

131 lines
6.9 KiB
Markdown

# Notes for coding agents
## Subsystem design and review
Before changing a documented subsystem, read its
[design reference](docs/subsystems/README.md) and verify the linked source.
When preparing or reviewing a PR, follow the same page's documentation update,
semantic change description, and review rules.
## Code standards
Write and review changes against the [code standards](docs/code-standards.md).
## Community PRs
Before reviewing a community PR, read [contributors](docs/contributors.md):
what stops a review for possible harm, what is closed unreviewed, and the
authors whose PRs are closed on sight.
## Lessons
Before changing code, read [LESSONS.md](LESSONS.md): what recent merged
work got wrong and the rule that would have caught it.
## Built-in subscriptions that a plugin serves
These built-in subscriptions are retired. Reaching them can break their
vendors' terms, so they moved out of magpie into community OpenCode plugins,
which keeps magpie itself from being banned. Each one has a plugin that does
the same job:
| Subscription | id | Plugin (npm) | Mover |
| --- | --- | --- | --- |
| Antigravity | `antigravity` | `@magpie-community/opencode-antigravity-auth` | `internal/provider/migrate_antigravity.go` |
| Command Code | `commandcode-plan` | `@magpie-community/opencode-commandcode-auth` | `internal/provider/migrate_side.go` |
| Cursor | `cursor` | `@magpie-community/opencode-cursor-auth` | `internal/provider/migrate_side.go` |
| Devin | `devin` | `@magpie-community/opencode-devin-auth` | `internal/provider/migrate_side.go` |
| Factory | `factory` | `@magpie-community/opencode-factory-auth` | `internal/provider/migrate_factory.go` |
| Grok | `grok` | `@magpie-community/opencode-grok-auth` | `internal/provider/migrate_side.go` |
| Kiro | `kiro` | `@magpie-community/opencode-kiro-auth` | `internal/provider/migrate_kiro.go` |
| Xiaomi MiMo | `mimo-app` | `@magpie-community/opencode-mimo-auth` | `internal/provider/migrate_mimo.go` |
| Qoder, Qoder CN | `qoder`, `qoder-cn` | `@magpie-community/opencode-qoder-auth` | `internal/provider/migrate_qoder.go` |
| WorkBuddy, WorkBuddy AI | `workbuddy`, `workbuddy-ai` | `@magpie-community/opencode-workbuddy-auth` | `internal/provider/migrate_workbuddy.go` |
| ZCode | `zcode` | `@magpie-community/opencode-zcode-auth` | `internal/provider/migrate_zcode.go` |
| Zed | `zed` | `@magpie-community/opencode-zed-auth` | `internal/provider/migrate_zed.go` |
The `movers` map in `internal/provider/migrate*.go` is the source of truth.
`TestMovedBuiltinsSayTheirPlugin` fails when a mover has no notice in its
code.
### Which code actually runs
Two cases decide it:
- **Moved:** the user moved the subscription onto its plugin, from the
editor's "Move to plugin" (or `provider.Adopt`). Its `migrations.json`
state is `plugin` (`provider.Moved(id)`). A new user never sees a
deprecated built-in: the Add sheet leaves one with no account out
(`unusedSub` in app.js), so it is installed from the Plugins page. A user
who installs the plugin themselves is moved too
(`provider.HandOver`): at once when the built-in has no accounts, from the
gateway's hourly loop (`KeepRetiringMoved`) when it has, unless the
plugin is signed in under its own `-plugin` id already. Until
then the Add sheet shows the plugin's tile only (`replacedSub` in app.js).
Since 10-16 the built-ins are being retired: the hourly loop's
`MoveRetiring` moves every subscription with a mover that still has
built-in accounts, a user who moved back included, and there is no way
back. Turning the plugin off turns the subscription off with it; removing
it records `removed` (accounts kept with the plugin's sign-ins), and
installing it again gives the subscription back.
- **Not moved:** the user still has accounts from the built-in: the move
hasn't run yet, or it failed (tried again after six hours). Nothing
serves them until it runs.
- **Retired:** the built-in's code is gone (`retiredBuiltins` in
`internal/provider/migrate.go`; `provider.BuiltinRetired(id)`). The
plugin serves it, moved or not. Accounts not moved yet are served by
nothing; a line over the Providers list says so, with why and a Move
(`providers.unmoved`, `unmovedLine` in app.js). With no row of its own,
the Add sheet leaves it to the Plugins page (`unusedSub`). Every
subscription in the table above is retired (10-17; Antigravity 11-15);
gates ask `provider.PluginServes(id)` (moved or retired). Gemini CLI
(`gemini`) and the agy agent stay built in.
- **Antigravity's plugin is withdrawn for anyone new** (the owner, 11-15:
正在使用的继续正常,加个提示,新用户不让下载): Google bans accounts it
sees on Code Assist through Antigravity's own client. The built-in's code
is still in the tree, but `googleLogins` lists nothing once the plugin
serves it, so it asks Google for nothing; the mover reads
`googleSavedLogins`. The plugin (0.2.1, the mover's min) serves as
before for whoever has it, and the Providers page tells them the risk
and points to Antigravity (local agy CLI),
`@magpie-community/opencode-agy-cli-auth`, which runs the user's own agy
over ACP (`withdrawn` in `/api/providers`). `plugin.Add` turns it away
for anyone who doesn't have it listed (`plugin.RefuseWithdrawn`); the
mover installs it for the user's own accounts under
`plugin.KeepWithdrawn`, and it left the registry. Don't offer it to
anyone new. The built-in route's tests serve it again through
`provider.AntigravityBuiltinForTest()` until its code is taken out
(#6723).
The plugin does everything: sign-in, refresh, models, requests, usage and
errors. It runs in the plugin host (`internal/plugin`). The built-ins'
sign-in, models, usage and gateway translators are gone. What is left of
them in `internal/provider` (and `internal/qoder/endpoints.go`) reads the
built-in's saved accounts so the mover can carry them over. The gateway
sends every request to the plugin's fetch.
So a bug report about one of these subscriptions is usually about the
plugin:
1. Check whether the user's subscription is moved. A moved provider's row in
`/api/providers` has `move.state == "plugin"`; the provider id is in
`onPlugins`.
2. Fix the plugin in the community repo,
[magpie-community/plugins](https://github.com/magpie-community/plugins)
(`packages/<name>`, provider id = the built-in's id; checked out locally
at `~/workspace/projects/magpie-commuity-plugins`). Publish a new version.
3. Raise the mover's `min` to that version. `keepMovedCurrent` then updates
every moved user's plugin.
This magpie-side code still runs for moved subscriptions:
- the plugin host: `internal/plugin`, `host.js`;
- `internal/provider/plugins.go`, `plugin_usage.go` (`movedCards`) and
`pluginsignin.go`;
- the move itself: `internal/provider/migrate*.go`;
- the GUI's plugin paths in `internal/gui/assets/app.js`: `subOf`,
`pluginSubs` and `startPluginSignIn`.
The parity tests, `internal/gateway/plugin_*_test.go`, hold each plugin to
what its built-in did.