cdredfox: with several WorkBuddy accounts in one smart routing group, the account whose credits expire soonest should be used first. WorkBuddy's own client lists each package with its end (the billing page's paid and free package lists); the plugin now reads them too. - /billing/meter/get-user-resource-paid-packages and -free-packages, asked as the client asks: PageSize 200 up to 10 pages, Status [0,3], its COMMODITY_CODES (without them the API answers 10001 "PackageCodes required"), NeedRenewInfo / today's SlicePeriod (UTC+8). - A package's end is DeductionEndTime, else ExpiredTime, else CycleEndTime read as UTC+8 (the API's own DeductionEndTime for the same package says so). Only packages the summary counts, with credits left; the daily Free Plan slice (CapacityType 4, code 001) is left out, since it ends at the same midnight on every account. - The soonest end goes on the Credits window as runsOutAt (RFC 3339) and the credits lost then as runsOut. A list that can't be read leaves both out; the card stands as before. Run: HOME=<tmp> bun test in packages/workbuddy, 63 pass (3 new); with index.mjs back at 0.1.13, 2 of the 3 new go red. Tried live on a real WorkBuddy AI account: packagesOf + runsOutOf gave the Bonus Pack's 232.4 credits ending 2026-10-12T16:39:27Z, before Pro's 10-28T16:40:52Z, with the Free Plan slice left out. Not tried on a CN workbuddy account (its stored token here is stale); the paths and body are the same on both.
13 lines
566 B
JSON
13 lines
566 B
JSON
{
|
|
"name": "@magpie-community/opencode-workbuddy-auth",
|
|
"version": "0.1.14",
|
|
"description": "OpenCode provider plugins for WorkBuddy's plans: WorkBuddy (CodeBuddy, copilot.tencent.com) and WorkBuddy AI (www.workbuddy.ai)",
|
|
"type": "module",
|
|
"main": "./index.mjs",
|
|
"exports": "./index.mjs",
|
|
"files": ["index.mjs", "README.md"],
|
|
"keywords": ["opencode", "opencode-plugin", "workbuddy", "codebuddy"],
|
|
"license": "MIT",
|
|
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/workbuddy" }
|
|
}
|