WorkBuddy AI's /v3/config gives some models' credits with a unit:
"x0.34 credits", "x0.59 credits", "x3.31 credits" (fast-model,
balanced-model, primary-model). creditsOf passed "0.34 credits" to Number,
got NaN, and so treated a known rate as unknown. It now strips a trailing
whitespace-separated "credit"/"credits" before the same strict conversion.
Any other trailing text ("x0.34 bananas"), "credits" alone, "x-1 credits",
"xNaN credits", "xInfinity credits" and "" stay unknown, never free.
Reviewed at head 2dda6eb5d42e271e948e4fb5aef6d3e5db7627b5, merged with
origin/main 5a83674 (clean):
- Real catalog: read www.workbuddy.ai/v3/config with the owner's WorkBuddy
AI sign-in (config read only, no inference). Its cli models carry exactly
"x0.34 credits", "x0.59 credits", "x3.31 credits", default-model "" and
the rest "x0.77"-style. main's creditsOf parses the three as unknown;
this one as 0.34 / 0.59 / 3.31, default-model unknown. CN WorkBuddy's
config has no unit strings and parses the same on both.
- packages/workbuddy: HOME=<tmp> bun test, 99 pass 0 fail.
- Full repo: HOME=<tmp> bun test, 1802 pass 2 fail; bun scripts/check.mjs ok.
The 2 reds are packages/cursor, untouched here, under load average ~400:
latency.test "events never show in time" (#210) and stepusage.test
"finds the Run's event ... once" (null at line 88: three polls at 10ms
don't fit its 200ms window under load). Both pass in reruns of the
cursor package.
- Broke it by hand: without the strip, both new tests red; with the strip
widened to any trailing word, the unknown-values test red.