Commit Graph
15 Commits
Author SHA1 Message Date
yetone 276c806db2 plugins: a plugin's own requests are counted; a provider plugin's options get the editor (plugins#592)
zelong77 asked for two things once Devin 0.1.30's cache keep-alive
worked: its pings were invisible in magpie, and the interval and ping
count could only be edited in plugins.json. The owner decided pings are
shown as counted usage and the two numbers are edited in the GUI.

- host.js gives plugins input.magpie.usage(provider, call) and
  input.magpie.account(provider). usage validates the call (kind
  [a-z0-9_-]{1,40}, a model id, whole-number tokens from 0, status at
  most 999, error clipped to 500) and sends an unasked "usage" event;
  host.go hands it to plugin.OnUsage in the background.
- internal/usage/plugin_calls.go writes each one as a row of agent
  magpie on the plugin's provider (provider.PluginID) and account
  (provider.PluginAccountUser), with its kind. It is counted, priced
  and in every total, not a probe. Kind cache_keepalive is in the
  purpose catalog as "Cache keep-alive" (five languages), so the
  request log names and filters it. The ping itself still goes straight
  to Devin, never through the gateway, which would break the cache.
- /api/plugins reads every plugin's package options example, not only a
  middleware's or request hook's, and the Installed row offers the same
  Options JSON editor for a provider or agent plugin that suggests or
  has options (not while it is off). Clear's confirm no longer calls
  them a middleware's options.
- The Devin mover's min is 0.1.31, which reports each ping and gives
  its two settings' defaults (285 s, 6) to the editor. npm has 0.1.31
  (published 10:03Z); the plugins publish run is red only for
  think-tags' known E404 (plugins#180).
- docs: provider-plugins.md (the API, the options editor),
  gateway-sessions.md (the counted row beside probes).

Run at this tree (rebased on origin/main 85e37162e):
- mote (mote-run): go test -count=1 -timeout 45m ./internal/plugin
  ./internal/usage ./internal/gui ./internal/provider: plugin, usage,
  provider ok; gui red only in TestMainWindowCorners/macOS_26_SDK, the
  macOS 27 red already filed as #3949 (not this change's code).
- mote: GOOS=linux and GOOS=windows go vet of plugin, usage, provider ok;
  gofmt -l clean.
- mote: plugin-provider-options.test.cjs (new, 5 languages, 980/420px,
  Chromium + WebKit), plugin-gateway.test.cjs and i18n-keys.test.cjs:
  28 of 28 pass.
- The whole GUI suite (make test-ui) on WSL magpie-desktop (mote was at
  load ~100 with other sessions' suites, #4125), at the 8f804396f base:
  cut off after 498 test entries, when the session's background jobs
  were killed; 495 ok, 3 red, none on a page this change touches. Run
  again alone at origin/main 85e37162e, the same files are red there
  too: account-eye webkit (#4244), agent-expand-steady webkit 980px
  (#2935), add-button zh's 3000ms waitForFunction (filed #4792). The
  rest of the suite was not run.
Broken by hand (each red, then put back):
- host.go dropping the "usage" event: TestPluginReportsOwnUsage fails.
- plugins.go reading optionsExample for middleware/hooks only:
  TestProviderPluginOptionsExample fails.
- purpose.go without the Cache keep-alive kind:
  TestPluginKeepaliveIsCounted fails (purpose {}).
- plugins.js without ownOpts: plugin-provider-options.test.cjs times
  out waiting for the Options button in every language.
Not tried: a real Devin account's keep-alive ping reported into a real
magpie (needs a live Devin conversation idle for 285 s); a plugin can
report a row for any provider id, as magpie.load can.
2026-11-01 22:14:19 +08:00
yetone 3ee6c2d948 providers: a provider list looks at the stamps, plugin logins, client shapes and accounts once a request
/api/providers took ~25ms of CPU a call with the owner's real config (25
providers, plugins signed in), polled by every open window. Its profile
had file system calls at about half, each repeated for every provider
the list shows:

- StampNow stat'ed providers.json, settings.json and the catalog for every
  provider (KeptListing); under a request's Hold it is looked at once.
- plugin.ListedAt was asked for every plugin provider's Listed(); once a
  request (heldOf "plugin-listed").
- pluginLogins took logins.json's lock, a file opened across magpies,
  for every plugin even with nothing to change. It now settles the list
  as read first, and takes the lock and settles again from a fresh read
  only when something changes.
- clientShape read and parsed client-shapes.json for every relay a list
  shows (TestsAs); parsed once until the file changes (filememo), a copy
  given out.
- Logins(agent) took the same lock for every provider, twice with its
  account models; listed once an agent a request, a copy each, listed
  anew after a write (writePrivate's filememo.Forget).

Run (on mote unless named):
- go test ./internal/provider ./internal/gui -timeout 45m: provider ok
  (102s) with the new tests; gui red on TestMainWindowCorners (macOS 27,
  #3949) and on TestSettingsSaveKeepsWhatItDoesNotSend, red on main since
  b09349d17, fixed by #4514's commit before this one.
- At the pushed head (rebased on e84870f17): go test ./internal/provider
  ok (100.7s), ./internal/plugin ok (102.7s), TestLoginsListedOnceARequest
  -count=5 ok (it now clears the 30s look another test left), gui
  TestSettingsSaveKeepsWhatItDoesNotSend and TestCoreScriptBudget ok;
  GOOS=linux and windows go vet ./internal/provider ok.
  Then rebased onto 3defaf662 (internal/agent dsh.go only); not rerun.
- New tests: TestStampLooksOnceARequest, TestClientShapeParsedOnceUntilWritten,
  TestLoginsListedOnceARequest, and TestAccountListsCopyNoLoginsUnchanged
  now counts the lock. Broken by hand, each goes red: "51 stamps in one
  request looked 51 times, want 1", "30 asks parsed the file 30 times",
  "20 plugin lists with nothing to change took the lock 20 times",
  "20 lists in one request listed 20 times".
- GOOS=linux and windows go vet ./internal/provider: ok. gofmt clean.
- Real config, on this Mac: a copy of the owner's ~/.config/magpie in an
  offline sandbox HOME (proxy :9), 200 GET /api/providers each:
  v0.1.2541 5.04s CPU (25.2ms a call, median 22.5ms wall), this change
  4.55s (22.8ms, median 20.3ms). The profile's stats under StampNow fell
  from 2.17s to 0.34s.

Not run: the full ./... suite; GUI (browser) tests, as nothing the page
gets changed. What is left in the profile: StepFun's sign-in file,
sync.json, plugin icons and agent detection, each read once a request.
2026-11-01 13:32:30 +08:00
yetone 88372a39d8 provider: listing accounts with nothing to change copies none of them
sideLogins and pluginLogins read the saved logins as a copy of the
whole list each time, to change it if a sign-in was new. The Providers
page and the panel list an agent's or a plugin's accounts a dozen times
a poll, and almost always nothing changes: 61 MB of what twenty window
polls allocated with real accounts. They now look at the logins as kept
(sharedLogins, read only), and a list that has a change makes its own
copy (readLogins) before it changes and writes it.

TestAccountListsCopyNoLoginsUnchanged: twenty lists of a side sign-in
and a plugin's accounts with nothing new copy the logins 0 times; a new
plugin account is still written and listed.

Run on mote (macOS 27):
- gofmt, go vet ./internal/provider (darwin, windows, linux): ok
- broken by hand (side_logins back on readLogins): red, "20 lists with
  nothing to change copied the accounts 40 times"
- the new test alone, -count=3: ok
- go test ./internal/provider ./internal/gateway: ok

Not run: the whole suite; internal/provider and the gateway that reads
its accounts are what this reaches.
2026-11-01 04:37:22 +08:00
yetone d95822eb35 provider: a keyless public plugin stays listed with subscription accounts off, and its name isn't blurred (lileo0668)
lileo0668 on Discord (#help): OpenCode Zen Free (plugin 0.1.18, the
public credential) said 已登录 on the Plugins page, the Add sheet had one
blurred row for it, a red line said "<name> 已登录,但 magpie 无法列出它",
and Zen's free models were nowhere.

Cause, reproduced on a sandbox magpie (HOME and XDG dirs under a scratch
folder, :3561, `magpie web` on :3562) built from origin/main 8701eb35e
with the real plugin from npm: with Settings -> Privacy -> Subscription
accounts off (#1535, or MAGPIE_NO_ACCOUNTS), pluginLogins and All()
drop every plugin provider, but PluginAPIKey, the keyless/key route, was
not gated. The sign-in went through, plugin-auth.json held it, the
Plugins page said signed in, and /api/providers listed nothing, so the
GUI showed "signed in, but magpie can't list it". With accounts on it
signs in and lists fine. v0.1.1847 (the reporter's) has the same code.

The blur: /api/plugin-signin answered user = the plugin's name, Hide
accounts takes every answer's user for an account, and spares only
listed providers' names, so "OpenCode Zen Free" was blurred on the card,
the sheet row and the red line.

Fix:
- publicPlugin: a plugin whose every way in is keyless holds no account
  of the user's. With accounts off it is still listed (pluginLogins,
  All, Accounts), served (Sign) and signed in (PluginAPIKey).
- Any other plugin's key is refused with errAccountDiscoveryOff before
  anything is saved, as its browser sign-in already was.
- /api/plugin-signin's key answer no longer names the plugin as a user;
  the GUI names it from subOf. Hide accounts spares every plugin's id
  and name from providers.plugins.
- providers-accounts.md and discovery.go say so.

Run at the rebased head (792f0f286, then fd80ed99c):
- internal/provider TestPublicPluginListedWithAccountsOff,
  TestAccountDiscoveryOffReadsNoSignIn, TestAccountDiscoverySetting,
  TestPluginKeylessSingleIdentity, TestPluginEmptyKeyOnlyKeyless: ok.
- wsl-run go test -tags nogui ./... -timeout 45m: every package ok but
  internal/agent: TestGrokInstalled (#3548) and TestOmpDetectedWithPiDir
  (#4033), the Linux box's known reds; internal/agent isn't touched here.
- go vet nogui ./internal/provider ./internal/gui for linux and windows,
  darwin for provider; gofmt clean.
- GUI (wsl-run, chromium + webkit, en zh zh-TW ja de, 900 and 360 wide):
  plugin-name-unmasked (new), plugin-keyless-signin, account-eye-provider,
  account-eye, account-mask, privacy-hides-accounts, plugin-moved-signin,
  plugin-other-ways, plugin-signin-no-url, plugin-key-hint, i18n*:
  106 of 106 (on 792f0f286); plugin-name-unmasked and
  plugin-keyless-signin 20 of 20 there too.
- Rebased again onto fd80ed99c (mover mins, Picked only, Kimi, usage):
  the provider tests above ok there.
- A first GUI batch on mote timed out on browser launch at load ~90 from
  other sessions' runners; not a code red, rerun on WSL.

Broken by hand:
- the four provider files back to origin/main: the new test fails "Zen
  Free not listed with accounts off: map[]".
- Sign's exemption alone: "Zen Free not served with accounts off".
- All's exemption alone: "not listed ... map[]".
- PluginAPIKey's gate off: Acme's key is not refused (it goes on to the
  plugin host).
- app.js's plugin-name exemption off: plugin-name-unmasked red 5 of 5
  (chromium).

Not tried: the reporter's own computer; that their Subscription accounts
switch is off is inferred, the one route that reproduces it. A real
request through the gateway with the fixed build and accounts off wasn't
sent; the provider test signs Zen's request. The plugin itself is
unchanged (0.1.18 on npm).
2026-10-29 16:50:17 +08:00
yetone 2921471de1 provider: Devin's mover min is 0.1.24 and its "cli" mark is the string OpenCode keeps
The Devin plugin 0.1.24 (plugins #396) stores the CLI sign-in's
metadata.cli as "true", the string OpenCode 1 keeps, because OpenCode
dropped a boolean there and with it the account. The mover now writes
"true", and the back checks (Devin, Command Code) and pluginOwn accept
both true and "true" through cliMarked, so accounts moved before keep
working.

Run at this head:
- go test ./internal/provider -count=1 (skipping
  TestUnreadLoginsWriteErrorsKeepCredentials, #3632's crash): ok 101.9s
- GOOS=linux and GOOS=windows go vet ./internal/provider: ok; gofmt -l clean
- npm view @magpie-community/opencode-devin-auth version --prefer-online: 0.1.24

Broken by hand: the Devin back check put back to md["cli"] == true
makes TestMoveDevin fail; restored.

Not tried: a real Devin account move through OpenCode 1.
2026-10-26 16:27:06 +08:00
yetone 344d11484e provider: Remove takes the account listed, by its slot, not a hidden one of the same name
dev (Discord) couldn't remove a ZCode account. The ZCode app's own
account had been removed in magpie (hidden), and a second one signed in
through magpie had the same name. Two things in the source caused it:

- editSideLogin matched the first saved entry by agent and name, hidden
  ones included, so Forget took the hidden "zcode" slot. It signed out
  the ZCode app's own account and left the listed zcode#l47q19 one.
- pluginLogins applied the own account's name (pluginOwnUser) after
  pluginLabels had added the slot suffix to tell same-name accounts
  apart, so both read "dev@z".

Now:
- pluginLabels applies the own names first and adds the suffix after,
  so the listed names are unique ("dev@z (l47q19)").
- Forget, Switch and On/Off resolve the name against the accounts as
  listed, then edit that saved entry by its slot (Home) or own-ness
  (listedMatch/sameSaved). editSideLogin, which the other callers use
  (chatgpt_api, copilot_lapsed, google, signin_revoked), prefers a shown
  entry over a hidden one of the same name.
- A saved id doesn't help here: it is made from the name, so both
  accounts had the same id (66dbee89c5d33fcd).

Existing data: an account whose name collided with another one is shown
with its slot suffix from the next read on. Nothing is rewritten.

Run:
- go test -tags nogui -timeout 45m ./... in a sandbox HOME: ok, every
  package, at 7edf5b0a3 plus this change.
- gofmt -l is clean; go vet ./..., GOOS=linux go vet -tags nogui ./...
  and GOOS=windows go vet ./... pass; go build for darwin, linux (nogui)
  and windows pass.
- Sandbox repro with real binaries built from origin/main and from this
  change, a sandbox HOME seeded with dev's layout (the hidden zcode slot
  and zcode#l47q19, both dev@z), and the real Bun plugin host, using
  `magpie accounts zcode` and `magpie accounts forget zcode <name>`:
  - old: listed as "dev@z", and forget left plugin-auth with only
    zcode#l47q19 (the wrong one signed out);
  - new: listed as "dev@z (l47q19)", and forget left plugin-auth with
    only zcode and logins.json with the hidden zcode entry.

Broken by hand: the three new tests in same_name_login_test.go fail on
the old code:
- TestRemoveListedAccountLeavesHiddenNamesake: "the account removed is
  still signed in", "the hidden ZCode app's account was signed out in
  its place";
- TestPluginOwnNameKeepsSlotApart: "accounts *dev@z (own),dev@z";
- TestForgetSideLoginTakesTheListedOne: "left [own hidden, magpie's]".

Not tried:
- a real ZCode account;
- clicking Remove in the GUI. The GUI sends {agent, user} as before,
  and the server now resolves it by slot;
- Copilot and Google. Their lists carry no saved entry, so they get the
  prefer-shown fallback only.
2026-10-24 19:40:14 +08:00
yetone c3b2e6109b provider: signing in to a plugin again takes the lapsed mark off when the providers' list is empty too (#2748)
clearPluginLapse cleared an account's "sign in again" mark only through
plugin.Cached(): it looked for the plugin's provider in the list and
cleared nothing when it wasn't there. The list is empty while
checkList reads another magpie's change to plugins.json again
(provCache = nil, before the providers file is written), so a sign-in
finished then left the account lapsed until a request or usage read
went through. TestPluginLoginTakesTheLapseOff (internal/cli) went red
that way on ubuntu CI twice (runs 39216129687 and 39234604936: "signed
in again, but still lapsed").

The mark now goes by the account's agent and key alone
(notePluginLapseOf), with the same sign-in count ordering as before;
only the stale usage reading still needs the provider, and is still
dropped when it is listed.

TestPluginSignInClearsLapseWithoutTheList saves two lapsed plugin
accounts with no plugin listed, signs one in again, and checks its mark
went and the other's stayed. On the old plugin_accounts.go it fails:
  plugin_fetch_lapse_test.go:83: signed in again, but still lapsed:
  "gone@fake's FakeCo sign-in has expired — sign in again"
and passes with the change.

Whether CI's two reds were this empty list and not another path is
inferred from the code, not captured; #2748 stays open until CI has
gone a while without it.

Run on origin/main 9fd80b212 + this change, macOS, load ~170-230:
- gofmt -l internal/provider: clean; go vet ./internal/provider/;
  GOOS=linux and GOOS=windows go vet -tags nogui on internal/provider and
  internal/cli: ok
- go test -timeout 45m -count=1 ./internal/provider/ ./internal/cli/:
  ok provider 552.7s, ok cli 324.7s
- -run 'TestPluginLogin|TestPluginSignIn|Lapse' on both packages, 5
  times: ok every time
- not the full ./... suite: the change is internal/provider's lapse
  clearing, and the two packages that sign plugins in were run whole.
2026-10-19 18:58:42 +08:00
yetone 8c5b9f928d provider, agent, gui: subscription accounts can be turned off, and then no agent's sign-in is read (#1535, MaxHaiCom)
What changed: Settings → Privacy → Subscription accounts (On/Off),
`magpie accounts discovery [on|off]` and MAGPIE_NO_ACCOUNTS=1 turn off
account discovery. It stays on by default. While it is off, magpie reads
none of the agents' sign-ins: ~/.claude/.credentials.json, .claude.json's
account, ~/.codex/auth.json, Copilot's, Cursor's, Devin's, Kiro's,
Gemini's, ZCode's, Command Code's and OpenCode's files. It runs no
`security` / `secret-tool` for the Keychain or Secret Service, and asks no
agent CLI who is signed in. It serves no subscription. API-key providers,
middleware plugins and Pi extensions work as before.

Why: the reporter runs magpie on machines where reading other tools'
credentials isn't wanted. The owner delegated the call.

How: settings.NoAccountDiscovery (kept per computer by KeepOwn) and
settings.AccountDiscoveryOff(). The variable only ever turns discovery
off. The gates sit at every reader (readAccountFile, discoveryOff) and at
every route that reads or writes a sign-in, so a route that skips
Accounts still reads nothing:
- Accounts, All, Logins, usage, renewal, warm-up, session identities,
  check-ins;
- switching, forgetting, SetLoginOn, StartSignIn, the imports;
- moves onto plugins.
The ones that write refuse with an error that names how to turn it back
on. On the agent side, Agent.Source and OpenCode's auth.json are gated,
and Codex wiring goes by magpie's stash instead of auth.json, so a
toggle never rewires Codex. logins.json and plugin-auth.json are left
untouched and serve again when discovery is turned back on. A change
applies at once (ForgetAccounts).

Docs: providers-accounts.md, README (en, zh-CN), and the site's CLI table
(en, zh, ja).

Run:
- TestAccountDiscoveryOffReadsNoSignIn (provider) and
  TestAccountDiscoveryOffAgentsReadNoSignIn (agent). Every credential
  path is a FIFO that records each open, and security, secret-tool,
  claude, codex, cursor-agent, devin, kiro-cli, copilot and grok are fakes
  on PATH. Both fail with the gate removed: they show the opens and
  `security find-generic-password -s Claude Code-credentials`, among
  others. Both pass with the gate in place.
- TestAccountDiscoverySetting and TestAccountsDiscoveryCmd.
- account-discovery.test.cjs: chromium and webkit, 900 and 360 wide,
  en/zh/zh-TW/ja/de, 32/32. The neighbouring privacy, redact,
  settings-sections and i18n-keys GUI tests: 49/49.
- The full `go test -tags nogui ./...`, gofmt -l, and go vet for darwin,
  linux and windows on the touched packages.

Not tried: a real machine under fs_usage, and Linux and Windows at
runtime. The FIFO tests are !windows.
2026-10-11 06:38:40 +08:00
yetone 8c0ffcc640 provider: a plugin account signed in again is read afresh, not answered by the reading kept from the refused sign-in (TestPluginLoginTakesTheLapseOff red after its first run in a process)
clearPluginLapse took the lapsed mark off a plugin account signed in
again, but its usage reading from before stayed in loginUsageCache for a
minute. The next LoginUsage was answered from it: the old sign-in's
"expired" shown for the renewed account, and no plugin asked, so nothing
marked or cleared. TestPluginLoginTakesTheLapseOff hit it from its second
run in one process (-count=3: pass, fail, fail): the run before's last
reading, still under a minute old, answered the "gone" account's read
under the new HOME, and the vendor's refusal never marked it.

A sign-in now drops the account's kept reading (StaleAllowance), on both
paths that finish one (pluginDone and PluginSignedIn).

TestPluginLoginReadsUsageAfresh fails without the change at -count=1
("signed in again, but the usage is the old sign-in's: ... Error:the
FakeCo sign-in has expired"). With it, -run TestPluginLogin passes at
-count=5 and with -race -count=5; go test -tags nogui . ./internal/provider
./internal/plugin pass under a temp HOME with pinned caches; go vet and
GOOS=linux/windows go vet -tags nogui pass on the two packages.
2026-10-08 13:52:50 +08:00
forever 470d1e71a5 provider: a plugin account's usage reading begun before a request was answered no longer overrules the answer, so a 401's lapse mark isn't taken off by a clean reading already out (TestPluginFailover, about 1 run in 90) (waitingsnow) (#1176)
TestPluginFailover failed about 1 run in 90 at "a refused isn't marked".
With notePluginLapse logged, a failing run read: a background reading of
a's allowance (loginReading, after the "stream" round's StaleAllowance)
began at 31.985; the upstream answered a's request 401 at 32.001 and
notePluginSaid marked a lapsed at 32.003; the reading ended clean at
32.011 and notePluginLapse(200) took the mark off; the test read the
logins at 32.042. Users meet the same: a reading of the Usage page or of
routing's allowances that is out when a request is refused clears the
mark the refusal left, and routing goes on trying the refused account;
one that ends refused marks an account a request has just gone through
on.

What plugin accounts' sign-ins are told of is now counted under
loginsMu (pluginSignInTold, pluginSignInSaid). A request's answer, a
sign-in and the plugin's own signIn events are told now and apply as
before. pluginLoginQuota takes the count before plugin.AccountUsage, and
what its reading found applies only when nothing was told of that
account since (notePluginLapseSince), as Allowances leaves out an
account renewed while it read. A count rather than a time: Windows'
clock moves in ticks of up to 15.6ms, and a reading begun just after an
answer would read as begun with it.

TestPluginUsageReadOlderThanAnswer holds the fake plugin's usage on an
httptest server ($FAKE_USAGE, whose 401 the fake now reads as an expired
sign-in) while a request's answer is noted, both ways, and checks that
readings begun afterwards still mark and clear. Each direction fails
without the fix. TestPluginFailover now reads the allowances the
"stream" round left stale before the "gone" round: the fake's usage
doesn't ask the upstream that refuses, so a reading that asks after the
401 finds the sign-in good and rightly takes the mark off. A review
reproduced that with a delay injected before the count is taken.

Left as it is: a reading whose own renewal of the token tells "renewed"
before it asks skips the "expired" it then finds; the next 401 marks the
account. Not tried with a real plugin account.

Under a temp HOME with Go's caches pinned and bun 1.4.2: gofmt, go vet
-tags nogui ./..., builds for darwin, GOOS=linux -tags nogui and
GOOS=windows (and windows vet of provider and gateway) pass; go test
-tags nogui ./... passes; the changed provider tests and
TestPluginSaysSignIn/TestPluginFailover pass with -race -count=20; the
report's `go test -tags nogui -race -cpu 1,2,4 -count=30 -run
'^TestPluginFailover$' ./internal/gateway/` passed 3 rounds (270 runs),
where it failed 3 of about 54 runs before the fix on the same loaded
machine.
2026-10-08 06:48:41 +08:00
yetone 47786c456e plugins: a moved built-in's own account stays the agent's, and Qoder's first goes (插件版…保持一模一样) — the plugin's accounts were listed with no own one, so removing the agent CLI's own account (Devin, Grok, Command Code, Cursor, Kiro, ZCode, WorkBuddy) signed it out of the plugin and its name stayed as signed in at the move; it is now told by the mark each mover leaves on it, named as the CLI is signed in now, only hidden when removed (the CLI stays signed in) and shown again once the CLI or magpie signs in anew, as the built-in's was. Qoder's first account showed Remove and was refused; it now goes, the next put first, as the built-in let it. plugin.UseCached lets a test stand a plugin's provider up without Bun. TestMovedOwnAccount and TestMovedQoderFirstGoes fail without the change. 2026-10-01 04:04:22 +08:00
yetone 566ae09db1 plugins: a moved provider's accounts keep what the built-in's had (你确保插件版的订阅 provider 和内置的一模一样了吗) — each account of a plugin provider has its own plan's models, not the first account's; a move carries each account's plan and a lapsed mark; a usage read that finds the sign-in gone marks the account and a clean one clears it, a network failure shows the last reading; a plugin that fails to load keeps its providers rather than taking them away; Kiro's API key is named and an OAuth account beside it stays off as in the built-in; Command Code Plan keeps its name. TestUnloadedPluginKeepsProviders, TestPluginUsageLapse, TestPluginAccountModels, TestMovedProviderName, TestKiroMover and the move test fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./internal/provider ./internal/plugin ./internal/gateway pass. 2026-10-01 03:27:47 +08:00
yetone ee5b1b7d44 plugins: a plugin's account behaves as its built-in's (the user: 插件版的订阅 provider 和内置的…保持一模一样了吗) — a plugin's failed sign-in now says why ("the sign-in failed: the sign-in page expired") instead of a bare failure; a plugin account the provider refuses with 401 is marked lapsed, "<user>'s <provider> sign-in has expired — sign in again", beside the account and on its usage card as a built-in's is, and the mark goes when it answers again or is signed in anew; a Devin or Command Code account taken from the agent's CLI moves to the plugin marked as the CLI's and back as the agent's own, so the one it follows stays the one the CLI is signed in to. TestPluginProvider (lapsed), TestMoveSideState (cli) and TestPluginSignIn (reason) fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass. 2026-10-01 01:00:07 +08:00
yetone 4a0fbc332c plugins: a built-in moved onto its plugin looks and works as it did (你确保插件版的订阅 provider 和其对应的内置的…都保持一模一样了吗?) — moved onto its plugin, a built-in lost pieces: its tile's name, icon, plans and risk note went to the plugin's own, "Add account" still opened the built-in's sign-in (in the app, on the server and in magpie accounts add), an agent's own sign-in the built-in still found showed a second usage card of the same account, the account's plan badge went, WorkBuddy's daily check-in stopped, the provider's icon and site were the plugin's, WorkBuddy AI's card was named WorkBuddy, and Devin, which had no card of its own, lost the plugin's. Now a moved built-in keeps its tile and risk sheet and signs in through its plugin; its cards take the built-in's place and name, and it has none of its own; the plan the plugin tells stays with the account; WorkBuddy checks in through the plugin, which signs the call; a card is left out only where its built-in's slot showed it. TestMovedBuiltinQuiet, TestWorkBuddyCheckinThroughPlugin, TestMoveToPlugin (Devin-like card) and TestPluginUsage (plan kept) fail without the change. Command Code and Devin moved and back in a sandbox HOME: one card each, plan, name. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; plugin-move, plugin-signin, commandcode-risk, old-webkit pass; click-scroll's WebKit fails the same on origin/main under this load. 2026-10-01 00:40:22 +08:00
yetone b63a0f1fd5 plugins: a plugin's provider takes more than one account, as a built-in subscription does (the user: 插件当然要支持多账号了) — a plugin kept one sign-in per provider, and signing in again replaced it. Now each sign-in goes beside the others: plugin-auth.json keeps the first under the provider's id, as OpenCode does (so what is signed in already stays the first account), the rest under id#slot; logins.json lists them as it lists the built-ins' accounts, so the editor shows them all, one first, the others ticked on behind it or off, any made first, any removed (which signs it out). The host runs every request in its account's scope, so a plugin's getAuth, client.auth.set (a refreshed token), loader and provider.models see that account alone; a sign-in to an account already there (the same id, else the same secret) replaces that one's rather than listing it twice. The gateway spreads and fails over across the accounts on, as for the built-ins. Accounts with no id are told apart by the end of their key ("API key …abcd"), else by their slot. Also on the Devin page: the header shows the plugin's icon, and Cognition's opencode-devin is off the market (its gateway answers 404 model_not_found for models and chat). TestPluginAccounts (plugin: per-account requests and refreshes, dedupe, sign-out; provider: first, on/off, switch, forget, labels), TestPluginProvider (gateway: a 429 on the first account goes on the second) and plugin-signin.test.cjs (add a second account in the editor, make it first; fails without the change) are new. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; plugin-signin, plugin-market, old-webkit, click-scroll pass. 2026-09-30 19:58:22 +08:00