Commit graph

262 commits

Author SHA1 Message Date
iamtoruk
bc9460951a fix(mac): scope Grok's omitted-percent-is-zero rule to unified billing; finish the fixture scrub
An omitted creditUsagePercent inside an open billing window was read as 0%
for every Grok account. That contract only holds for unified-billing users;
for anyone else it now stays unknown instead of showing a fabricated 0%.

The wireframe mockup still carried the one device name #1250 replaced
everywhere else.
2026-09-04 01:38:08 -07:00
Resham Joshi
7307b080cd
Merge pull request #1242 from mh7whmyz6z-alt/fix/grok-unified-billing-omitted-percent
fix(mac): treat omitted Grok credit percent as 0% in an active window
2026-09-03 13:46:59 -07:00
iamtoruk
eb992ff62c fix(dock): a tile can stand for more than one provider row
The glance's Today row was scoped to the hovered provider by matching one
catalog id against one payload row. Cursor read $0.00 with 14 calls
recorded, because the CLI splits that one subscription into `cursor` for
the editor and `cursor-agent` for the agent, and the tile saw only the
first. Droid read zero for a plainer reason: the tile carries the account's
id, `factory`, while the CLI records the product, `droid`.

A tile now maps to a list of payload rows and sums them: Cursor over both
its surfaces, ClinePass over `cline` and `cline-cli`, Droid onto `droid`.
Every other tile still stands for exactly one row, and no row belongs to
two tiles, so the per-tile figures still reconcile to the machine total.

A summed tile keeps a token field absent unless some row reports it, so an
older CLI that sends no per-provider tokens still reads as "no breakdown"
rather than as a zero the account did not earn.

Checked every one of the 69 tiles against the provider registry by id and
by display name; these three were the only mismatches. Mistral and Qwen
Cloud look similar but are not confirmed to be the same account as the
CLI's `mistral-vibe` and `qwen`, so they are left alone deliberately.
2026-09-03 09:21:23 -07:00
iamtoruk
8cfaa358ac fix(dock): scope the glance Today row to the hovered provider
The Capacity Dock's glance popover rendered the machine-wide Today block in
every provider's card, so hovering Claude showed the total across every
provider as if it were Claude's.

CLI (add-only): ProviderCost and providerDetails now carry optional
inputTokens, outputTokens and sessions, summed per provider in all three
branches that build the provider list. They stay ABSENT when no day in the
period reported a breakdown, so a consumer can tell "no data" from zero.
STATUS_SNAPSHOT_RENDER_VERSION 4 -> 5, since a v4 snapshot's payload predates
the new fields; the daily cache already holds the tokens, so its version is
untouched.

App: the Today row reads the hovered provider's row out of providerDetails
(matched on the CLI provider id, which the dock's kimi entry bridges to
kimicode). Against a CLI that omits per-provider tokens the arrows drop out
rather than falling back to the global pair; a provider absent from a
breakdown that IS present reads as a real $0.00. The row keeps its fixed
frame, so the panel's computed height is unchanged either way.
2026-09-03 08:32:20 -07:00
iamtoruk
7e74dcd426 Merge remote-tracking branch 'origin/main' into fix/glance-notice-section 2026-09-03 07:32:50 -07:00
iamtoruk
393b160688 fix(mac): give the glance's staleness line a section of its own
The line reading "Last known usage · refreshing" sat crammed against the
header with the blocks below pushed into it. Its height was reserved, but
only as 16 points: a bare 10pt line box with no padding, no side inset of
its own and no separator, while every other block in the glance carries
8 or 10 points of padding and a 16 point inset.

It is a section now, with the same inset, its own padding and a divider,
and the reservation grows from 16 to 27 to match so nothing below is
squeezed. Only the two in-progress states change; disconnected and
reconnect keep their own blocks with the action button.

The new test pins both halves: the reservation equals the band's height
for every in-progress connection, and the total stays whole at every
scale, since a fractional panel height re-runs the window's layout at
display cadence for as long as the dock is up.
2026-09-03 07:19:35 -07:00
iamtoruk
95abfde791 Merge main into fix/dock-detail-integral-height
The glance popover replaced the row-counted one while this branch was
parked, so `detailHeight` grew three parameters and this branch's copy of
the old body went with main's. The branch's assertion that the popover's
height is whole is now covered better by CapacityDockGlanceTests, across
every scale and against the new signature, so it goes rather than being
ported.

What the branch's remaining test caught is a live regression on main. Every
dock metric must be a whole number of points: a fractional panel length
re-runs the window's layout at display cadence for as long as the dock is
up, which is the drain #1210 fixed. `points` still rounds each base metric,
but the eased flare compensation added afterwards put the fraction straight
back, so the rail padding measured 30.6 and the panel 111.2 and 225.2
through the whole attach animation. Round the sum, not the base.

Nothing on main tests this; the parked branch is the only guard, which is
how the regression reached the release candidate unseen.
2026-09-03 06:36:15 -07:00
iamtoruk
a1cc32663f fix(mac): the Capacity Dock popover appears inside a full-screen space
Every window belongs to a set of spaces. The rail belongs to all of them;
the detail panel had been reduced to the desktop space alone, so hovering a
pill inside a full-screen app positioned the popover, faded it in and
ordered it front exactly as it does on the desktop, in a space the user was
not looking at. Measured on a running instance: the rail reported
spaces=[3, 63, 24, 137] with 137 active, the panel reported spaces=[3].

The membership is written once in init and never again. The window server
drops it across a display sleep or a display reconfiguration, and the rail
survives only because it is never ordered out. Re-assert it in showDetail,
the one funnel every presentation passes through. It has to be written, not
read and compared: assigning collectionBehavior is what re-registers the
window, and it must happen while the window is ordered out.

Also drop a duplicate `isFloatingPanel = true` that ran after the shielding
level was set. NSPanel.isFloatingPanel writes level = .floating, so the
second assignment silently discarded the level the comment above it asks
for: the dock measured at layer 3 instead of 2147483628, low enough for any
floating window to cover it. Both panels now report the shielding level.
2026-09-03 06:07:45 -07:00
mh7whmyz6z-alt
7122c70732 fix(mac): treat omitted Grok credit percent as 0% in an active window
SuperGrok Heavy unified billing drops creditUsagePercent after a weekly
reset. That matches grok.com (proto3 default 0), not a parse failure.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-02 15:06:17 -07:00
Resham Joshi
500412aa88
Merge pull request #1235 from avs-io/codex/provider-reconciliation-races
Some checks are pending
CI / semgrep (push) Waiting to run
macOS Menubar CI / test (push) Waiting to run
Tests / test (22) (push) Waiting to run
Tests / test (22.13.0) (push) Waiting to run
Tests / desktop (push) Waiting to run
Join provider refreshes and prevent scoped false zeros
2026-09-02 11:51:30 -07:00
Resham Joshi
3376d764e6
Merge pull request #1234 from avs-io/codex/provider-core-contract-repair
Repair provider usage and Hermes cost contracts
2026-09-02 11:50:56 -07:00
iamtoruk
f0f0ed8874 fix(menubar): keep the wordmark filled under the shimmer and slow the sweep
The letters were only visible through the animated gradient's mask, so any
frame where the mask or gradient was not laid out yet blanked the name at
random. The text now carries a static flame fill under the sweep, which can
only brighten it, and the sweep runs 4 s each way instead of 1.5 s.
2026-09-02 10:34:11 -07:00
iamtoruk
58c6cce6db fix(menubar): the selection fallback showed another provider's totals under the selected tab
Switching providers stashed the outgoing payload and rendered it under the new
tab until that tab's own fetch landed. That is not continuity, it is a wrong
number: opening the Hermes tab printed the all-provider total, and the test
suite pinned that behaviour by asserting $12 under Hermes and $12.34 under
Cursor.

The fallback is gone. With no cached data for the selection, `payload` is
empty, `hasCachedData` is false, and the popover renders the loading state it
already has for a cold key, so no dollar figure is shown for a provider whose
data has not arrived. AgentTabStrip and MenuBarContent take the same
hasCachedData gate for the same reason.
2026-09-02 07:55:43 -07:00
iamtoruk
cd7de30bc4 fix(menubar): a twice-contradicting scoped payload threw instead of being served
When a scoped payload disagreed with its all-provider slice, the code re-ran
the fetch bypassing the resident child and, if it STILL disagreed, threw. That
verified payload is what the CLI actually reports for the provider, so
throwing traded a real number for an error banner and left the tab with
nothing at all.

The payload is now cached with a contradictsAll flag on CachedPayload
(add-only) and served, and the popover carries one subdued secondary line
saying the total may be incomplete. The refresh paths treat an
already-verified contradiction as usable, so a poll cannot re-run the one-shot
parse forever.
2026-09-02 07:54:55 -07:00
iamtoruk
68f6d1ced3 fix(menubar): the all-provider and scoped fetches were serialized on every tab click
To guarantee the all-provider slice was cached before a scoped result could be
accepted, the code simply awaited the all-provider fetch BEFORE starting the
scoped one. That is two full parses back to back on every tab click, and the
ordering it bought is only needed at acceptance time, not at start time.

Both fetches now start together. fetchPayload awaits the all-provider task
after its own fetch has already returned and before the consistency check
reads it, so the evidence is still present when the scoped result is judged.

The resident-bypassing cold fetch was already conditional on a contradiction
actually being detected; it is unchanged.
2026-09-02 07:54:03 -07:00
iamtoruk
6eab24960c fix(menubar): an evicted in-flight fetch cleared its successor's slot
inFlightKeys held only a timestamp, so the slot had no notion of WHICH fetch
owned it. The watchdog and the display-sleep reset both evict an occupant, and
a later fetch then legitimately claims the same key. When the evicted fetch
finally returned, its defer cleared the new owner's slot and resumed every
task parked on it, so a waiter woke on an empty cache and reported failure
while the real fetch was still running.

The slot now carries a token. A fetch releases it only if it still owns it;
the watchdog and the resets take an explicit force path, because they are
declaring the slot dead rather than reporting a fetch that ended.
2026-09-02 07:53:03 -07:00
iamtoruk
216ead74ae fix(menubar): refresh(key:) reported failure instead of joining an in-flight fetch
The interactive refresh path bailed with false whenever the key was already
being fetched. recoverFromStuckLoading() reads that return value, so a healthy
fetch that was simply still running was announced as a failed recovery, and a
second interactive refresh threw away a result that was moments from landing.

Join the in-flight fetch and report on its outcome, which is what the quiet
path already did.

Adds a DataClient fetch hook under DEBUG: slot ownership and acceptance
ordering are only observable when two REAL fetches overlap, which needs a
fetch whose completion the test controls rather than a spawned CLI.
2026-09-02 07:52:18 -07:00
iamtoruk
b0ee9cc7d4 Merge branch 'wt1234' into wt1235 2026-09-02 07:33:03 -07:00
iamtoruk
9c432bb105 fix(menubar,app): absent hasUsage hid every provider with no period spend
hasUsage is a new payload field, so every RELEASED CLI omits it. Both decoders
treated the absent case as "derive from cost", which is the strict reading of
a field that is not there: a provider with $0 spend in the period vanished
from the picker even though the user has it and is actively using it on an
included subscription.

Absent now means visible on both surfaces. The strict signal still applies
wherever the CLI actually emits the field, so an explicit false still hides an
idle discovery row. Settings.tsx carried the same fallback and is fixed with
it.
2026-09-02 07:32:02 -07:00
iamtoruk
6fa5dfbeb7 Merge remote-tracking branch 'origin/main' into wt1234 2026-09-02 07:06:47 -07:00
Aditya Vikram Singh
c9c5bc00f8 join provider evidence refreshes 2026-09-02 19:16:08 +05:30
Aditya Vikram Singh
5ef7387a33 close provider reconciliation races 2026-09-02 19:16:08 +05:30
Aditya Vikram Singh
e9a55bb2f8 prevent provider-scoped false zeros 2026-09-02 19:16:08 +05:30
iamtoruk
53c5c7b370 feat(dock): glance popover with hero window, sessions and today strip
The Capacity Dock hover panel becomes a glance: a provider header, the
sessions running right now as pills with their context rings, a Today
strip, and a row of quota-window percentages, separated by hairlines.
Window percentages stay plain text until 70 percent so a healthy row
reads as text rather than a wall of colour. The panel stays 350pt wide;
every block height is a whole point and is summed into the panel frame,
since the hosting view does not size itself.

Running sessions are new CLI surface. `liveSessions` is add-only on the
menubar payload: sessions whose transcript was appended inside a 120s
window, carrying the branch, the model that answered last, and the
context that turn reported. Absence means "unknown", so the section
hides rather than claiming nothing is running. The block names projects
and branches, so sharing and MCP output strip it.

Today's totals needed no CLI change; the app simply was not decoding the
cache token counts the payload already carried.
2026-09-02 06:09:06 -07:00
Aditya Vikram Singh
38e6e19f29 harden provider period and cache contracts 2026-09-02 16:18:05 +05:30
Aditya Vikram Singh
7106db2c0e fix menubar provider usage contracts 2026-09-02 16:17:28 +05:30
Aditya Vikram Singh
3664152d37 feat(mac): add native Grok Build provider 2026-09-01 18:46:02 +05:30
Resham Joshi
043ffd4822
Merge pull request #1214 from MiguelMachado-dev/feat/zero-cost-provider-visibility
feat(menubar): keep token-only and flat-rate providers visible in agent tabs
2026-09-01 05:08:32 -07:00
Resham Joshi
fecbcd6e1c
Merge pull request #1212 from MiguelMachado-dev/fix/menubar-presence-deadlock
fix(mac): avoid provider presence deadlock
2026-09-01 04:58:38 -07:00
iamtoruk
c436787239 fix(mac): document the main-queue serialization and harden the deadlock test cleanup
The lock no longer covers the defaults write, so the main-queue hop is
what keeps the read-modify-write atomic; say so where the next reader
would be tempted to make it async. The regression test now cleans up its
observer and defaults domain on every exit and waits up to 5 seconds, so
a loaded runner cannot fake a deadlock.
2026-09-01 04:58:16 -07:00
Aditya Vikram Singh
5fee00ab9c Fix Capacity Dock pointer coalescing and dismissal 2026-09-01 16:51:00 +05:30
iamtoruk
fdd18e7bb4 fix(menubar): rebuild the popover content on every open and drop it on close
A popover content view that outlived its window kept re-laying itself out
at display cadence once the popover had been shown during the first load
(loading overlay 520pt tall, then the real height): 6 to 7 percent idle
CPU until relaunch, reproduced on demand. Limiting the hosting controller
to preferredContentSize was not enough on its own. Building the 360pt view
fresh per open and releasing it on close removes the survivor entirely;
the dock's hidden bubble panel gets the same treatment.

Reproduction on the same machine (minute logs, popover opened during the
first load and closed): before 6.1 to 7.1 percent sustained; after 0.1
percent sustained through the data load.
2026-09-01 02:49:01 -07:00
iamtoruk
80330ca03e fix(menubar): round the docked flare padding so the rail length stays integral
At 60 percent the docked pad was 12 + 18.6 points, putting the rail body at
111.2 against a 111 point panel; the same fractional mismatch as #1210,
hidden inside the attachment compensation instead of the base metrics.
2026-09-01 02:00:01 -07:00
iamtoruk
926fe640ba fix(menubar): round the Capacity Dock bubble height to whole points
The detail panel is created on the first hover and kept alive hidden, and
its height was the one dock dimension still fractional (186 at 60 percent
is 111.6), so from the first hover on it re-laid itself out at display
cadence forever: 0.1 percent idle CPU before the hover, 5.7 to 6.1 percent
after, measured on the release build. Same bug as #1210, second window.
2026-09-01 01:43:56 -07:00
Miguel Machado
fee0f63fd0 feat(menubar): keep token-only and flat-rate providers visible in agent tabs
Agent tabs filtered strictly on cost > 0, so a provider whose sessions
carry tokens but no recorded dollar cost (Hermes on a flat subscription,
free-tier models, unpriced models) vanished from the strip entirely.

The menubar payload now carries an activity signal per provider, and the
strip keys visibility off it: providers with real usage stay listed, while
providers merely discovered on disk stay hidden. Older payloads without
the signal keep the previous detected-provider behavior.

Applies consistently across the mac menubar, the Electron renderer, and
the Windows payload types.
2026-08-31 22:43:13 -03:00
Miguel Machado
da20fd0f42 fix(mac): avoid provider presence deadlock
A background credential read held the provider-presence lock while UserDefaults synchronously notified SwiftUI. SwiftUI could re-read presence while holding its own update lock, leaving each thread waiting on the other. Serialize presence writes on the main queue and release the presence lock before publishing defaults changes.
2026-08-31 22:40:50 -03:00
iamtoruk
1a74f0d3ac fix(menubar): round Capacity Dock metrics to whole points to stop perpetual relayout
At any scale except 100% the dock's dimensions were fractional (85% of 88
is 74.8), so SwiftUI's fitted content never agreed with the pixel-aligned
panel frame and the hosting view re-laid itself out at display cadence
forever: 5 to 7 percent idle CPU and hundreds of wakeups a second once
quota data existed, on every release since the dock shipped. Measured on
the same machine: 60% and 85% scale held 5 to 6 percent for an hour;
100% scale idled at 0.1 to 0.2 percent. Rounding every scaled metric to a
whole point makes all scales behave like 100%.
2026-08-31 17:57:04 -07:00
iamtoruk
86f9d6c065 feat(menubar): default the Capacity Dock size to 60 percent 2026-08-31 10:56:59 -07:00
iamtoruk
6100fce4af feat(menubar): let the Capacity Dock size go down to 60 percent 2026-08-31 10:52:59 -07:00
Resham Joshi
764326438a
Merge pull request #1208 from getagentseal/fix/menubar-idle-render
fix(menubar): stop rendering the closed popover around the clock
2026-08-31 10:48:19 -07:00
iamtoruk
c19d5621e3 fix(menubar): stop rendering the closed popover around the clock
The status-item popover's hosting view is created once and lives for the
app's lifetime, and the flame wordmark inside it ran a repeat-forever
shimmer, so SwiftUI re-rendered the closed popover at display cadence
continuously: 5 to 7 percent idle CPU and roughly 650 wakeups a second
(Activity Monitor showed a 12-hour energy figure near two thirds of
Chrome's). The wordmark sweep and the loading flame pulse now start and
stop with popover visibility via a store flag set by the popover
delegate.
2026-08-31 10:46:37 -07:00
Miguel Machado
1416cdd4c1 fix(mac): stop Capacity Dock hover drift 2026-08-31 14:22:20 -03:00
Resham Joshi
f54329e686
Merge pull request #1204 from MiguelMachado-dev/fix/zai-body-auth-errors
fix(mac): map Z.ai body authentication errors
2026-08-31 09:59:49 -07:00
Resham Joshi
7b79a4ba5e
Merge pull request #1197 from getagentseal/fix/dock-hover-any-frontmost
fix(menubar): Capacity Dock hover works over any frontmost app
2026-08-31 09:56:46 -07:00
Miguel Machado
b39133941f fix(mac): map Z.ai body auth errors 2026-08-31 13:51:46 -03:00
Resham Joshi
0c71cdcf31
Merge pull request #1202 from MiguelMachado-dev/feat/zai-menubar-quota
feat(mac): add Z.ai Coding Plan quota
2026-08-31 09:44:15 -07:00
Miguel Machado
069a163e26 feat(mac): add Z.ai quota provider 2026-08-31 12:11:55 -03:00
iamtoruk
ac6cfc045f fix(quota): skip zero-entitlement and unlimited Copilot windows instead of showing 100% used
A Free or Individual plan reports premium_interactions with entitlement 0
and 0% remaining, which both the menubar and the desktop decoder turned
into a full 100% used ring. Verified against a live quota payload.
2026-08-31 03:26:19 -07:00
iamtoruk
c2524308bf fix(menubar): drop the copilot-cli Keychain rung from Copilot discovery (#1198)
The Copilot CLI's Keychain item is written by a Node keyring library, so
/usr/bin/security is not in its partition list. Unlike the Claude Code item,
every read would raise the macOS "allow access?" dialog, and with the probe
cache a user who clicks Deny would be asked again every five minutes.

`gh auth token` already reaches the same users, because the Copilot CLI itself
falls back to gh, so the rung was risk without benefit.

The chain is now legacy plugin files, ~/.copilot/config.json and settings.json,
the environment variables, `gh auth token`, and a pasted token. No `security`
subprocess remains in the adapter, and the probe cache collapses to the single
gh answer.
2026-08-31 02:09:44 -07:00
iamtoruk
7e37d33acc fix(menubar): keep the Copilot credential chain private to the adapter 2026-08-31 02:05:38 -07:00