Skip to content

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

feat: show subscription plan name on provider usage cards

[._.]/ Adam Eivy9c84c06737cc
diff --git a/client/src/pages/UsagePage.test.jsx b/client/src/pages/UsagePage.test.jsx
index 3aa9454fba..35b72e4012 100644
--- a/client/src/pages/UsagePage.test.jsx
+++ b/client/src/pages/UsagePage.test.jsx
@@ -217,6 +217,23 @@ describe('UsagePage federated quota readings', () => {
},
};
+ it('shows the subscription plan name on the quota card when the reading named a tier', async () => {
+ api.getProviderUsage.mockResolvedValue({
+ providers: [{
+ family: 'grok',
+ label: 'Grok',
+ supported: true,
+ plan: 'SuperGrok',
+ limits: [{ key: 'week', label: 'Weekly', percentUsed: 8, percentRemaining: 92 }],
+ activity: [],
+ approximate: true,
+ fetchedAt: '2026-09-03T11:00:00.000Z',
+ }],
+ });
+ render(<MemoryRouter><UsagePage /></MemoryRouter>);
+ expect(await screen.findByText('SuperGrok')).toBeInTheDocument();
+ });
+
it('says the card spans instances and names which ones', async () => {
api.getProviderUsage.mockResolvedValue({ providers: [fleetCard] });
render(<MemoryRouter><UsagePage /></MemoryRouter>);
diff --git a/server/lib/fleetQuotas.js b/server/lib/fleetQuotas.js
index 45c53f97cc..2466bb7876 100644
--- a/server/lib/fleetQuotas.js
+++ b/server/lib/fleetQuotas.js
@@ -188,6 +188,16 @@ export function mergeQuotaCard(local, peerCards = []) {
const limits = unifyLimits(contributions);
const activity = unifyActivity(contributions);
+ // Plan/tier is account-wide, same as the meters: take the freshest named
+ // reading so a card this machine could not label still shows SuperGrok/Pro
+ // when a peer's scrape (or a later local one) named it.
+ const planReadings = [
+ { plan: local.plan, fetchedAt: local.fetchedAt },
+ ...peerCards.map((c) => ({ plan: c.plan, fetchedAt: c.fetchedAt })),
+ ].filter((c) => isNonBlankStr(c.plan) && c.plan !== 'unknown');
+ const plan = planReadings.length
+ ? planReadings.reduce((best, c) => (compareNewerWins(c.fetchedAt, best.fetchedAt) ? c : best)).plan
+ : local.plan;
const fleet = {
instances: contributions.map(({ instanceId, name, self, fetchedAt }) => ({ instanceId, name, self, fetchedAt })),
// Which machines are represented, for a UI that wants to age the reading
@@ -196,6 +206,7 @@ export function mergeQuotaCard(local, peerCards = []) {
};
return {
...local,
+ plan,
limits,
activity,
fleet,
diff --git a/server/lib/fleetQuotas.test.js b/server/lib/fleetQuotas.test.js
index b6089c7c8f..a8cd906457 100644
--- a/server/lib/fleetQuotas.test.js
+++ b/server/lib/fleetQuotas.test.js
@@ -127,6 +127,14 @@ describe('mergeQuotaCard', () => {
expect(merged.note).toBe('Across 2 federated instances (this machine, Example Box) — meters show the freshest reading across them.');
});
+ it('takes the freshest named plan when this machine has not labeled the tier', () => {
+ const merged = mergeFleetQuotaCards(
+ [localCard({ plan: null, limits: [], activity: [], pending: true })],
+ [peerEntry({ quotas: [{ ...peerEntry().quotas[0], family: 'claude', plan: 'Max 20x', fetchedAt: '2026-09-03T11:00:00.000Z' }] })],
+ )[0];
+ expect(merged.plan).toBe('Max 20x');
+ });
+
it('collapses the name list past three instances', () => {
const peers = ['a', 'b', 'c', 'd'].map((id) => peerEntry({ instanceId: id, name: id.toUpperCase() }));
expect(mergeFleetQuotaCards([localCard()], peers)[0].note)
diff --git a/server/services/providerUsage.js b/server/services/providerUsage.js
index adc6619fcb..6617f0b85e 100644
--- a/server/services/providerUsage.js
+++ b/server/services/providerUsage.js
@@ -573,7 +573,7 @@ const GROK_WINDOWS = {
* localize it. `timezone` is the zone the TUI rendered in — the fetcher forces
* the machine's zone on the child, so it passes the same one back in.
*
- * @returns {{ limits: Array }}
+ * @returns {{ limits: Array, plan: string|null }}
*/
export function parseGrokUsage(text, { now = Date.now(), timezone } = {}) {
const str = String(text || '');
@@ -581,11 +581,16 @@ export function parseGrokUsage(text, { now = Date.now(), timezone } = {}) {
// of the newer one, so keep the LAST value seen per window (freshest frame) —
// same repaint hazard as parseAgyUsage.
const byWindow = new Map();
+ // Grok 1.0 names the subscription in the window header:
+ // `Weekly limit (SuperGrok)`. Last named frame wins on a repaint.
+ let plan = null;
- const matches = [...str.matchAll(/(weekly|monthly)\s+limit(?:\s*\([^)]+\))?:?/gi)];
+ const matches = [...str.matchAll(/(weekly|monthly)\s+limit(?:\s*\(([^)]+)\))?:?/gi)];
for (let idx = 0; idx < matches.length; idx++) {
const m = matches[idx];
const window = m[1].toLowerCase();
+ const named = m[2]?.trim();
+ if (named) plan = named.slice(0, 60);
if (!GROK_WINDOWS[window]) continue;
const startPos = m.index + m[0].length;
@@ -607,7 +612,7 @@ export function parseGrokUsage(text, { now = Date.now(), timezone } = {}) {
}
}
- if (!byWindow.size) return { limits: [] };
+ if (!byWindow.size) return { limits: [], plan };
const resets = [...str.matchAll(/(?:next reset|resets):\s*([A-Za-z0-9 ,:]+?)(?:\s{2,}|│|$|\n)/gi)];
const resetsAt = resets.length ? parseHumanReset(resets[resets.length - 1][1], { now, timezone }) : null;
@@ -623,7 +628,7 @@ export function parseGrokUsage(text, { now = Date.now(), timezone } = {}) {
resetsAt,
timezone: null,
}));
- return { limits };
+ return { limits, plan };
}
/**
@@ -685,9 +690,10 @@ function makeTuiUsageFetcher({ id, binary, slashCommand, label, parse, name, rea
const text = await scrapeTuiUsage({ command, args, slashCommand, env, readyMarker });
// The panel's reset is relative (agy) or zone-less (grok) — both resolve
// against the read's own clock and the zone the child rendered in.
- const { limits } = parse(text, { now: Date.now(), timezone: tz });
+ const { limits, plan } = parse(text, { now: Date.now(), timezone: tz });
+ const namedPlan = typeof plan === 'string' && plan.trim() && plan !== 'unknown' ? plan.trim() : null;
return limits.length
- ? { ...base, supported: true, limits, note: `Scraped from the ${name} /usage panel — local, approximate.` }
+ ? { ...base, supported: true, limits, ...(namedPlan ? { plan: namedPlan } : {}), note: `Scraped from the ${name} /usage panel — local, approximate.` }
: { ...base, supported: true, limits: [], error: `No quota data found in the ${name} /usage panel.` };
}, { wait });
return card === PENDING ? pendingCard(base, name) : card;
diff --git a/server/services/providerUsage.test.js b/server/services/providerUsage.test.js
index a620c392ca..eca4be8bbd 100644
--- a/server/services/providerUsage.test.js
+++ b/server/services/providerUsage.test.js
@@ -559,8 +559,9 @@ describe('parseGrokUsage', () => {
██░░░░░░░░░░░░░░░░░░░░░░░░░░░░8%│
Resets: August 1, 06:07│
`;
- const { limits } = parseGrokUsage(boxPanel, opts);
+ const { limits, plan } = parseGrokUsage(boxPanel, opts);
expect(limits).toHaveLength(1);
+ expect(plan).toBe('SuperGrok');
expect(limits[0]).toMatchObject({
key: 'weekly',
label: 'Weekly',
@@ -569,6 +570,10 @@ describe('parseGrokUsage', () => {
resetsAt: '2026-08-01T06:07:00.000Z',
});
});
+
+ it('leaves plan null when the window header names no tier', () => {
+ expect(parseGrokUsage('Weekly limit: 42%', opts).plan).toBeNull();
+ });
});
describe('TUI usage fetchers (via getProviderQuotas)', () => {
@@ -645,6 +650,14 @@ describe('TUI usage fetchers (via getProviderQuotas)', () => {
expect(scrapeTuiUsage).toHaveBeenCalledTimes(2);
});
+ it('puts the Grok plan name on the quota card when the panel names a tier', async () => {
+ getAllProviders.mockResolvedValueOnce({ activeProvider: 'grok', providers: [{ id: 'grok-tui', enabled: true, type: 'tui', command: 'grok' }] });
+ scrapeTuiUsage.mockResolvedValueOnce('Weekly limit (SuperGrok)\n8%\nResets: August 1, 06:07');
+ const [card] = await getProviderQuotas();
+ expect(card).toMatchObject({ family: 'grok', supported: true, plan: 'SuperGrok' });
+ expect(card.limits).toHaveLength(1);
+ });
+
it('surfaces a supported-but-error card when a CLI provider scrape yields no parseable data', async () => {
getAllProviders.mockResolvedValueOnce({ activeProvider: 'grok', providers: [{ id: 'grok-tui', enabled: true, type: 'tui', command: 'grok' }] });
scrapeTuiUsage.mockResolvedValueOnce('unrecognized banner, no usage line');