Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: parse agy 1.1.x Limit Remaining usage rows
[._.]/ Adam Eivy9f6e79366983
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 1f68a3c29a..6858b7a36c 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -11,6 +11,7 @@- **Updated documentation index and feature references.** Added missing feature deep dive links for Quota-burn automation (`QUOTA-BURN.md`), Three.js procedural 3D models (`THREEJS_MODELS.md`), Stacker News stewardship (`stacker-news.md`), and the PortDeck native companion app API contract (`COMPANION_APP_API.md`) across `README.md` and `docs/README.md`. Improved inline JSDoc comments for client and server utility modules.## Fixed+- **The Antigravity card on the Usage page loads quota again after `agy` 1.1.x renamed its limit rows.** The `/usage` panel still groups Gemini / Claude+GPT windows the same way, but each window header grew a trailing "Remaining" (`Weekly Limit Remaining`, `Five Hour Limit Remaining`). The parser required the line to end on bare `Limit`, so it found the groups and returned zero meters — the card looked broken with "No quota data found." Both the new labels and the older bare-`Limit` form parse to the same keys.- **The labels on LoRA training dataset images are readable again.** The source chip ("upload", "generated", "sheet crop", "gallery") and the view label ("front three-quarter") were tinted overlays — 20%-opacity color on top of whatever the training image happened to be — so over a bright photo, or under a light theme, the text all but disappeared. They were also pinned to opposite corners of the thumbnail, so a long view label collided with the source chip in a narrow column and the two printed on top of each other. Both chips now carry their own near-opaque plate with light text, and they share one wrapping row so a long label drops to a second line instead of overlapping.- **The Antigravity code reviewer no longer looks like it isn't installed.** Antigravity's command is `agy`, but every agent prompt named the reviewer by its internal slug, `antigravity` — a command that exists on no machine. A review-loop agent went looking for it, found nothing, concluded there was no reviewer available, reviewed its own work instead, and merged the PR. Prompts now name the actual command, and a reviewer whose command genuinely isn't installed blocks the merge with a note on the PR instead of quietly being replaced by a self-review.- **Pull requests opened by a CoS agent under a "merge when CI is green" policy now actually get merged.** The check that watches those PRs only ran when an app's optional "PR Watcher" scheduled task fired — and that task ships disabled, since its default prompt is a review-and-comment agent most setups don't want. So PortOS was queueing green PRs into a list nothing ever read: they sat open indefinitely, and because the retry counter never advanced, the safety net that gives up and notifies you after a few hours never fired either. The watch now runs on the normal CoS cadence, independent of that task.diff --git a/server/services/providerUsage.js b/server/services/providerUsage.jsindex 983c157cde..a0d954253e 100644--- a/server/services/providerUsage.js+++ b/server/services/providerUsage.js@@ -241,9 +241,10 @@ function agyGroupLabel(header) {.join('/');}-/** `Weekly Limit` → `Weekly`; `Five Hour Limit` → `5-hour`. Pure. */+/** `Weekly Limit` / `Weekly Limit Remaining` → `Weekly`; `Five Hour Limit` → `5-hour`. Pure. */function agyWindowLabel(raw) {- const core = raw.replace(/\s*Limit\s*$/i, '').trim();+ // agy 1.1.x renamed the rows from "… Limit" to "… Limit Remaining"; accept both.+ const core = raw.replace(/\s*Limit(?:\s+Remaining)?\s*$/i, '').trim();return /^five hour$/i.test(core) ? '5-hour' : core;}@@ -267,8 +268,9 @@ export function agyRefreshToIso(text, now = Date.now()) {/*** Parse the Antigravity `/usage` panel text into common-shape limit rows.* The panel groups models (e.g. `GEMINI MODELS`, `CLAUDE AND GPT MODELS`); each- * group has one or more `<window> Limit` rows showing a bar `NN.NN%` that is the- * percent REMAINING (a full bar = full quota), then either+ * group has one or more window rows — `Weekly Limit` / `Five Hour Limit` on+ * older builds, or `… Limit Remaining` on agy 1.1.x+ — showing a bar `NN.NN%`+ * that is the percent REMAINING (a full bar = full quota), then either* `NN% remaining · Refreshes in <dur>` or `Quota available` (full, no reset).* Exported for tests. Pure given `now`.*@@ -288,7 +290,10 @@ export function parseAgyUsage(text, { now = Date.now() } = {}) {const g = line.match(/^([A-Z][A-Z0-9 &/+-]*?MODELS)$/);if (g) { group = agyGroupLabel(g[1]); groups.add(group); continue; }if (!group) continue;- const w = line.match(/^([A-Z][A-Za-z ]{0,24}?Limit)$/);+ // Optional " Remaining" suffix: agy 1.1.x renamed "Weekly Limit" →+ // "Weekly Limit Remaining" (and same for Five Hour). Capture stops at+ // "Limit" so agyWindowLabel stays agnostic of the suffix.+ const w = line.match(/^([A-Z][A-Za-z ]{0,24}?Limit)(?:\s+Remaining)?$/);if (!w) continue;// Look ahead a few lines for the bar percentage + reset/quota-available.let remaining = null;@@ -500,7 +505,7 @@ const FAMILIES = [id: 'agy',label: 'Antigravity',matches: (p) => commandBasename(p.command) === 'agy' || /antigravity/i.test(p.id || ''),- fetch: makeTuiUsageFetcher({ id: 'agy', binary: 'agy', slashCommand: '/usage', label: 'Antigravity', parse: parseAgyUsage, name: 'Antigravity CLI', readyMarker: /Weekly Limit|Five Hour Limit|Models & Quota/i })+ fetch: makeTuiUsageFetcher({ id: 'agy', binary: 'agy', slashCommand: '/usage', label: 'Antigravity', parse: parseAgyUsage, name: 'Antigravity CLI', readyMarker: /Weekly Limit(?:\s+Remaining)?|Five Hour Limit(?:\s+Remaining)?|Models & Quota/i })},{id: 'grok',diff --git a/server/services/providerUsage.test.js b/server/services/providerUsage.test.jsindex 044a46b25d..6ac6f1e803 100644--- a/server/services/providerUsage.test.js+++ b/server/services/providerUsage.test.js@@ -42,8 +42,8 @@ import { getSettings } from './settings.js';import { getImageGenQuota } from './imageGenQuota.js';// Synthetic Antigravity `/usage` panel — invented values, redacted account, in-// the real rendered shape. The bar percentage is percent REMAINING; a full bar-// with "Quota available" has no reset.+// the agy 1.1.x rendered shape (`… Limit Remaining`). The bar percentage is+// percent REMAINING; a full bar with "Quota available" has no reset.const AGY_PANEL = `└ Models & QuotaAccount: [email protected]@@ -51,11 +51,11 @@ const AGY_PANEL = `└ Models & QuotaGEMINI MODELSModels within this group: Gemini Flash, Gemini Pro- Weekly Limit+ Weekly Limit Remaining[█████████████████████████████████████████████████░] 98.99%99% remaining · Refreshes in 167h 57m- Five Hour Limit+ Five Hour Limit Remaining[████████████████████████████████████████░░░░░░░░░░] 80.00%80% remaining · Refreshes in 4h 30m@@ -63,15 +63,21 @@ GEMINI MODELSCLAUDE AND GPT MODELSModels within this group: Claude Opus, Claude Sonnet, GPT-OSS- Weekly Limit+ Weekly Limit Remaining[██████████████████████████████████████████████████] 100.00%Quota available- Five Hour Limit+ Five Hour Limit Remaining[██████████████████████████████████████████████████] 100.00%Quota available`;+// Pre-1.1.x panel: rows ended in bare "Limit" (no " Remaining" suffix). Kept so+// an older agy binary still parses after the 1.1.x rename.+const AGY_PANEL_LEGACY = AGY_PANEL+ .replaceAll('Weekly Limit Remaining', 'Weekly Limit')+ .replaceAll('Five Hour Limit Remaining', 'Five Hour Limit');+// Synthetic Grok `/usage show` output — `Weekly limit: N%` is percent USED.const GROK_PANEL = 'noise noise Weekly limit: 42% Next reset: August 1, 06:07 trailing noise';@@ -277,6 +283,20 @@ describe('parseAgyUsage', () => {expect(gem5h).toMatchObject({ label: 'Gemini · 5-hour', percentUsed: 20, percentRemaining: 80 });});+ it('still parses pre-1.1.x panels that end window rows in bare "Limit"', () => {+ // agy renamed "Weekly Limit" → "Weekly Limit Remaining"; older binaries still+ // emit the bare form, and both must produce the same keys/labels.+ const { limits, groups } = parseAgyUsage(AGY_PANEL_LEGACY, { now: NOW });+ expect(groups).toBe(2);+ expect(limits).toHaveLength(4);+ expect(limits.map((l) => l.key).sort()).toEqual([+ 'claude-gpt-5-hour', 'claude-gpt-weekly', 'gemini-5-hour', 'gemini-weekly',+ ]);+ expect(limits.find((l) => l.key === 'gemini-weekly')).toMatchObject({+ label: 'Gemini · Weekly', percentUsed: 1, percentRemaining: 99,+ });+ });+it('keeps used + remaining summing to 100 on half-percent values', () => {// 98.50% remaining rounds to used 2 / left 99 = 101% if rounded independently.const panel = AGY_PANEL.replace('98.99%', '98.50%').replace('99% remaining', '98% remaining');