Commit Graph
3 Commits
Author SHA1 Message Date
yetone 1fa21850a3 plugins: a plugin can say its sign-in renewed, and what a usage read means for it (要保证插件跟内置的所有逻辑都要一模一样) — a built-in whose sign-in renewed took the lapse mark off whatever the request then met, and a plugin could only clear it with a success: X-Magpie-Sign-In: renewed now clears it on any status. A usage read marked a plugin account whenever its error said to sign in again and cleared it on any clean read, where Qoder's, Kiro's and others' built-ins marked none from usage: auth.usage may now say signIn: expired, kept or renewed, taken as the header is; one that doesn't say keeps the old reading. TestPluginSaysSignIn and TestPluginUsageLapse fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./internal/gateway ./internal/provider ./internal/plugin pass. 2026-10-01 04:46:24 +08:00
yetone c9d2015e5d plugins: a plugin says apart what its answer means for the sign-in, so it can fail with its built-in's status (当然要做,要保证插件跟内置的所有逻辑都要一模一样) — magpie took a plugin account for lapsed on a 401 alone, so a plugin had to choose between the built-in's status and its lapse mark: Factory's and MiMo's refused renewals were 401s where the built-in answered 502 and marked the account, and Qoder's 403, Zed's retried 401, Kiro's unreachable refresh and Cursor's expired plan answered other than the built-in so as not to mark one it didn't. An answer's X-Magpie-Sign-In now says: expired marks the account lapsed whatever the status, kept leaves it be; without it a 401 marks it and a success clears it, as before. The agent never sees the header. TestPluginSaysSignIn fails without the change. 2026-10-01 04:36:42 +08:00
yetone 4e63e98359 gateway: a plugin's provider with several accounts fails over as a built-in's subscription does (别忘了同时添加多个账号、设置路由组、自动故障转移、额度不够时的转移、显示额度) — a test of it end to end, through the plugin host and a fake vendor: three accounts signed in in magpie, all on; one answering a quota 429, a quota error in the stream before any content, or a 401 hands the request to the next and rests, the 401 marking it lapsed; one whose five hours are used up for a model, as the plugin's usage says, is weighed last for that model even while in use, and first for a model its window doesn't count; a routing group of the plugin's model and another provider's answers from the other when every account of the plugin is out. It fails with the account's allowance asked of any agent but the plugin's provider's. 2026-10-01 03:54:19 +08:00