@magpie-community/opencode-workbuddy-auth 0.2.13 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -4
- package/index.mjs +22 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -399,6 +399,14 @@ What is measured, and what is easy to read wrongly:
|
|
|
399
399
|
429 whose named reset is still ahead makes the window full — `used: 100`,
|
|
400
400
|
`resetsAt` the reset the vendor named — whatever the rows add up to. The
|
|
401
401
|
sum carries the window only until the first refusal.
|
|
402
|
+
- **The sum is shown, not routed on.** Until the vendor refuses, the card is
|
|
403
|
+
set aside (`aside: true`): magpie draws it beside the account and never
|
|
404
|
+
counts it as the account's allowance, so an estimate near its cap does not
|
|
405
|
+
stop the model. The refusal's card does (`refused: true`), and magpie's
|
|
406
|
+
gateway rests this model alone on this account until the reset the
|
|
407
|
+
refusal names. Before 0.2.14 the sum stopped the model too, and a paid
|
|
408
|
+
China account read 99% of a cap it had never been refused at, with 2,457
|
|
409
|
+
credits left (plugins#641).
|
|
402
410
|
- **The card names both ids**, `deepseek-v4.1-flash` and
|
|
403
411
|
`deepseek-v4.1-flash-sg`: magpie matches a window's models by exact id
|
|
404
412
|
(only an `@size` suffix folds into the bare id), so one alone would leave
|
|
@@ -435,10 +443,10 @@ exhausted, and the next request opens a fresh one. The China build
|
|
|
435
443
|
(`copilot.tencent.com`) carries the same window: two Free-plan accounts
|
|
436
444
|
refused on 2026-11-02 at 200,389,043 and 200,485,923 tokens, so its cap is
|
|
437
445
|
measured at about 2e8 — and its refusals name the reset in Chinese
|
|
438
|
-
(`将在 … UTC+8 重置`), which reads as an edge the same way. Its card
|
|
439
|
-
|
|
440
|
-
the model before the vendor
|
|
441
|
-
|
|
446
|
+
(`将在 … UTC+8 重置`), which reads as an edge the same way. Its card reads
|
|
447
|
+
against 2e8. In 0.2.12 and 0.2.13 it read against a soft cap of 1.9e8, so
|
|
448
|
+
that routing rested the model before the vendor refused it; with the sum set
|
|
449
|
+
aside that headroom only stopped the model early, so it is gone.
|
|
442
450
|
|
|
443
451
|
## When free models work but a credit model does not
|
|
444
452
|
|
package/index.mjs
CHANGED
|
@@ -2276,6 +2276,17 @@ const compact = (n) => (Number.isInteger(n) ? String(n) : n.toFixed(2).replace(/
|
|
|
2276
2276
|
// full whatever the sum says. That is the one exact signal there is,
|
|
2277
2277
|
// and routing must not pass over it either.
|
|
2278
2278
|
//
|
|
2279
|
+
// So the sum is an estimate, and it is shown, not routed on: its card is set
|
|
2280
|
+
// aside (aside: true), which magpie draws beside the account and never counts
|
|
2281
|
+
// as its allowance. Only a refusal's card stops the model. The estimate used
|
|
2282
|
+
// to stop it as well, and it read a paid China account at 99% of a cap it had
|
|
2283
|
+
// never been refused at, with 2,457 credits left (XiaoFeiyu9, plugins#641):
|
|
2284
|
+
// the cap is two accounts' measurement, the ledger is one machine's, and
|
|
2285
|
+
// neither is the vendor's word for this account. Nothing is lost by waiting
|
|
2286
|
+
// for that word: magpie's gateway reads the refusal's reset ("将在 … 重置",
|
|
2287
|
+
// "reset at …") and its "switch to the other models", and rests this model
|
|
2288
|
+
// alone, on this account alone, until the time the vendor named.
|
|
2289
|
+
//
|
|
2279
2290
|
// The ledger is magpie's own, in magpie's config folder (appdir.Config()):
|
|
2280
2291
|
// the folder the plugin host runs in, which is the portable data folder
|
|
2281
2292
|
// when magpie runs portable, $XDG_CONFIG_HOME/magpie when that is set, and
|
|
@@ -2287,12 +2298,12 @@ const compact = (n) => (Number.isInteger(n) ? String(n) : n.toFixed(2).replace(/
|
|
|
2287
2298
|
// caps: the same phone number can be signed in to both, and their ledgers
|
|
2288
2299
|
// stay apart — one build's spending must not fill the other's window.
|
|
2289
2300
|
//
|
|
2290
|
-
// The China cap is
|
|
2291
|
-
//
|
|
2292
|
-
//
|
|
2293
|
-
//
|
|
2294
|
-
//
|
|
2295
|
-
const FREE_WINDOW_CN = { provider: "workbuddy", cap:
|
|
2301
|
+
// The China cap is the measured one, 2e8 (two accounts refused at 200.39M
|
|
2302
|
+
// and 200.49M). It was a soft 1.9e8 in 0.2.12 and 0.2.13, so that routing
|
|
2303
|
+
// rested the model before the vendor refused it; since the sum is set aside
|
|
2304
|
+
// (freeWindowOf's card), the cap only scales what the card says, and the
|
|
2305
|
+
// headroom bought nothing but a model stopped 10M tokens early (plugins#641).
|
|
2306
|
+
const FREE_WINDOW_CN = { provider: "workbuddy", cap: 2e8, short: "200M" }
|
|
2296
2307
|
const FREE_WINDOW_AI = { provider: "workbuddy-ai", cap: 1e8, short: "100M" }
|
|
2297
2308
|
const FREE_WINDOW_SPAN = 24 * 3600 * 1000
|
|
2298
2309
|
// The lead: how far back of an edge the read goes on. A chain read from a row
|
|
@@ -2438,7 +2449,9 @@ function freeWindowOf(rows, account, now = Date.now(), win = FREE_WINDOW_AI) {
|
|
|
2438
2449
|
resetsAt: new Date(resetsAt).toISOString(),
|
|
2439
2450
|
span: FREE_WINDOW_SPAN / 1000,
|
|
2440
2451
|
models: FREE_WINDOW_MODELS.slice(),
|
|
2441
|
-
|
|
2452
|
+
// the ledger's sum is an estimate, shown and set aside; the vendor's
|
|
2453
|
+
// refusal is the one that stops the model (see the window above)
|
|
2454
|
+
...(refused ? { refused: true } : { aside: true }),
|
|
2442
2455
|
})
|
|
2443
2456
|
|
|
2444
2457
|
// A refusal still in force is exact: the account is spending this window
|
|
@@ -3788,9 +3801,8 @@ function makePlugin(site) {
|
|
|
3788
3801
|
// the free model's own window, which the credit meter above does
|
|
3789
3802
|
// not show: what actually refuses a chat long before 160 credits
|
|
3790
3803
|
// are spent. Both builds: WorkBuddy AI at 1e8 (ten days of
|
|
3791
|
-
// refusals), the China build's
|
|
3792
|
-
//
|
|
3793
|
-
// window definitions above)
|
|
3804
|
+
// refusals), the China build's at about 2e8 (2026-11-02). Set
|
|
3805
|
+
// aside until the vendor refuses (see the window definitions above)
|
|
3794
3806
|
{
|
|
3795
3807
|
const account = a.accountId || a.user || a.uid || ""
|
|
3796
3808
|
const win = site.ai ? FREE_WINDOW_AI : FREE_WINDOW_CN
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magpie-community/opencode-workbuddy-auth",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "OpenCode provider plugins for WorkBuddy's plans: WorkBuddy (CodeBuddy, copilot.tencent.com) and WorkBuddy AI (www.workbuddy.ai)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|