@magpie-community/opencode-workbuddy-auth 0.2.15 → 0.2.16
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 +11 -7
- package/index.mjs +27 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -349,15 +349,19 @@ midnight on every account. magpie's smart routing spends the account whose
|
|
|
349
349
|
credits run out first.
|
|
350
350
|
|
|
351
351
|
The plan's own credits and the rest are two windows. "Credits" is the
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
352
|
+
plan's base credits: what the subscription grants each cycle (Pro monthly
|
|
353
|
+
or yearly, youth, advanced, flagship, the Pro trials, the free plan's
|
|
354
|
+
monthly base, or the subscription the summary names), with the plan's
|
|
355
|
+
cycle, so its pace line is the month's. "Extra credits" is every other
|
|
356
|
+
kind WorkBuddy's own usage panel lists: the plan's bonus, top-ups (bought
|
|
357
|
+
credit packs) and platform rewards (gifted and activity credits,
|
|
358
|
+
赠送积分). The summary's CreditGroups say which is which (plan_base
|
|
359
|
+
against plan_bonus, addon and benefit); a summary without them is split
|
|
360
|
+
by package code as WorkBuddy's client does. Only one of the two stops the
|
|
358
361
|
account, since WorkBuddy serves it while any credits are left: the extra
|
|
359
362
|
window is set aside until the plan's credits are spent. A summary with
|
|
360
|
-
only one kind keeps the one "Credits" window (akic404 on Discord
|
|
363
|
+
only one kind keeps the one "Credits" window (akic404 on Discord; since
|
|
364
|
+
0.2.16 the plan's bonus is extra too, Jiabubu on Discord).
|
|
361
365
|
|
|
362
366
|
An enterprise (team) account's resource summary lists no packages. Its
|
|
363
367
|
credits are read from the enterprise meter
|
package/index.mjs
CHANGED
|
@@ -2868,12 +2868,15 @@ function pinning() {
|
|
|
2868
2868
|
// The plan's own credits and the rest are two windows (akic404 on
|
|
2869
2869
|
// Discord): summed, the gifted and activity packages' credits used long
|
|
2870
2870
|
// ago put the card at most of its allowance on the first day of the
|
|
2871
|
-
// month, and the plan's pace line said nothing. "Credits" is the
|
|
2872
|
-
//
|
|
2873
|
-
//
|
|
2874
|
-
//
|
|
2875
|
-
//
|
|
2876
|
-
//
|
|
2871
|
+
// month, and the plan's pace line said nothing. "Credits" is the plan's
|
|
2872
|
+
// base credits and "Extra credits" every other kind, as WorkBuddy's own
|
|
2873
|
+
// usage panel breaks them down (Jiabubu on Discord: a plan's bonus and
|
|
2874
|
+
// bought credits were nowhere on the card). The summary's CreditGroups
|
|
2875
|
+
// say it in WorkBuddy's words: plan_base ("Plan Base Credits") is the
|
|
2876
|
+
// plan's, plan_bonus, addon ("Top-up Credits") and benefit ("Platform
|
|
2877
|
+
// Reward Credits") are extra. A summary without them is split by code as
|
|
2878
|
+
// the client's resolveCreditGroup does (PLAN_CODES, see planCodes). A
|
|
2879
|
+
// summary with only one kind keeps the one "Credits" window, as before.
|
|
2877
2880
|
//
|
|
2878
2881
|
// Only one of the two stops the account at a time: WorkBuddy serves it
|
|
2879
2882
|
// while any credits are left, so the one set aside is the one whose
|
|
@@ -2884,12 +2887,13 @@ function usageOf(sum, plan, site) {
|
|
|
2884
2887
|
const ofPlan = planCodes(sum, site)
|
|
2885
2888
|
const kinds = { plan: { total: 0, used: 0 }, extra: { total: 0, used: 0 } }
|
|
2886
2889
|
let left = 0, bags = 0
|
|
2890
|
+
const hasTotal = (p) => p?.CycleTotalCapacity != null && p.CycleTotalCapacity !== ""
|
|
2891
|
+
const add = (k, p) => ((k.total += capacity(p.CycleTotalCapacity)), (k.used += capacity(p?.CycleUsedCapacity)))
|
|
2892
|
+
const groups = (Array.isArray(sum?.CreditGroups) ? sum.CreditGroups : []).filter(hasTotal)
|
|
2893
|
+
for (const g of groups) add(kinds[g?.Kind === "plan_base" ? "plan" : "extra"], g)
|
|
2887
2894
|
for (const p of sum?.Packages ?? []) {
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
const k = kinds[ofPlan(p?.PackageCode) ? "plan" : "extra"]
|
|
2891
|
-
k.total += capacity(p.CycleTotalCapacity)
|
|
2892
|
-
k.used += capacity(p?.CycleUsedCapacity)
|
|
2895
|
+
if (hasTotal(p)) {
|
|
2896
|
+
if (!groups.length) add(kinds[ofPlan(p?.PackageCode) ? "plan" : "extra"], p)
|
|
2893
2897
|
} else if (p?.CycleRemainCapacity != null && p.CycleRemainCapacity !== "") {
|
|
2894
2898
|
left += capacity(p.CycleRemainCapacity)
|
|
2895
2899
|
bags++
|
|
@@ -2953,7 +2957,7 @@ async function spareFree(site, a, windows) {
|
|
|
2953
2957
|
// detail list without them (10001 "PackageCodes required").
|
|
2954
2958
|
const CODE = (n, s) => `TCACA_code_${n}_${s}`
|
|
2955
2959
|
const PAID_CODES = [CODE("002", "AkiJS3ZHF5"), CODE("005", "maRGyrHhw1"), CODE("003", "FAnt7lcmRT"), CODE("023", "4xbGhMrE6q"),
|
|
2956
|
-
CODE("026", "BaESVICNoi"), CODE("027", "0FCGVA6vSa"), CODE("009", "0XmEQc2xOf"), CODE("038", "OhvqZtiPKr"), CODE("036", "lupO5WgNdG")]
|
|
2960
|
+
CODE("026", "BaESVICNoi"), CODE("027", "0FCGVA6vSa"), CODE("043", "6oIkxT7Z0S"), CODE("009", "0XmEQc2xOf"), CODE("038", "OhvqZtiPKr"), CODE("036", "lupO5WgNdG")]
|
|
2957
2961
|
const DAILY_CODE = CODE("001", "PqouKr6QWV")
|
|
2958
2962
|
const FREE_CODES = [DAILY_CODE, CODE("008", "cfWoLwvjU4"), CODE("035", "ArVxJcGDsm"), CODE("006", "DbXS0lrypC"), CODE("039", "KRcQj7wUat"),
|
|
2959
2963
|
CODE("040", "mi9rCYg46x"), CODE("007", "nzdH5h4Nl0"), CODE("028", "NtpWi0jzXs"), CODE("037", "WxOD3MpI2o"), CODE("029", "6wCGEWquYy"),
|
|
@@ -2962,17 +2966,18 @@ const FREE_CODES = [DAILY_CODE, CODE("008", "cfWoLwvjU4"), CODE("035", "ArVxJcGD
|
|
|
2962
2966
|
// lost at the same midnight on every account, so they tell none apart
|
|
2963
2967
|
const SLICE = "4"
|
|
2964
2968
|
|
|
2965
|
-
// PLAN_CODES are the
|
|
2966
|
-
//
|
|
2967
|
-
// Pro monthly plus, Pro yearly, youth, advanced,
|
|
2968
|
-
//
|
|
2969
|
-
//
|
|
2970
|
-
//
|
|
2971
|
-
//
|
|
2972
|
-
//
|
|
2969
|
+
// PLAN_CODES are the plan's base credits, as WorkBuddy's client (WorkBuddy
|
|
2970
|
+
// AI 5.9.4) groups them in its usage panel (resolveCreditGroup's
|
|
2971
|
+
// planBase): Pro monthly, Pro monthly plus, Pro yearly, youth, advanced,
|
|
2972
|
+
// flagship, buddyOneVip, the international free plan (freeMonIntl), the
|
|
2973
|
+
// Pro trials, and on the China build alone the free plan's monthly base
|
|
2974
|
+
// (freeMon, 套餐基础积分). The plan's bonus (bonus28; bonusIntl, "Plan
|
|
2975
|
+
// Bonus Quota") comes back each cycle too, but the client says it apart
|
|
2976
|
+
// (planBonus), as it does the credit packs (009, 036, 038: addon) and
|
|
2977
|
+
// activity, bonus29/30 and gift (benefit).
|
|
2973
2978
|
const PLAN_CODES = [CODE("002", "AkiJS3ZHF5"), CODE("005", "maRGyrHhw1"), CODE("003", "FAnt7lcmRT"), CODE("023", "4xbGhMrE6q"),
|
|
2974
|
-
CODE("026", "BaESVICNoi"), CODE("027", "0FCGVA6vSa"), CODE("
|
|
2975
|
-
CODE("039", "KRcQj7wUat"), CODE("040", "mi9rCYg46x")
|
|
2979
|
+
CODE("026", "BaESVICNoi"), CODE("027", "0FCGVA6vSa"), CODE("043", "6oIkxT7Z0S"), CODE("035", "ArVxJcGDsm"),
|
|
2980
|
+
CODE("039", "KRcQj7wUat"), CODE("040", "mi9rCYg46x")]
|
|
2976
2981
|
const FREE_MON = CODE("008", "cfWoLwvjU4")
|
|
2977
2982
|
|
|
2978
2983
|
// planCodes says whether a package of the summary is the plan's own: one
|
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.16",
|
|
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",
|