Commit graph

1852 commits

Author SHA1 Message Date
iamtoruk
672196bb8f feat(windows): Capacity Dock, an edge-docked quota rail
A slim always-on-top rail on the right screen edge showing one capacity ring
per signed-in provider, the Windows twin of the macOS Capacity Dock.

The window is created on demand and closed when the dock is switched off, so
a disabled dock leaves no webview resident. Hovering widens the same window
to reveal a detail panel with each quota window, its used percent, plan and
reset countdown; the panel unmounts on collapse rather than lingering hidden.

Data comes from `codeburn quota --format json` through the existing cli.rs
spawn plumbing. A CLI without that subcommand exits with `unknown command`,
which the rail reports as a quiet update-needed state instead of an error.

Metrics are the mac dock's whole-point values at its default 0.6 scale.
2026-09-01 13:50:56 -07:00
iamtoruk
bbc0e222c8 Merge remote-tracking branch 'origin/feat/cli-quota-command' into feat/windows-capacity-dock 2026-09-01 13:42:22 -07:00
iamtoruk
e593d2e0cc feat(cli): codeburn quota command reading provider capacity from the CLI 2026-09-01 12:48:58 -07:00
iamtoruk
54263810c9 fix(windows): let Quit actually exit and enforce a single tray instance
Quit CodeBurn in the tray menu called app.exit(0), but ExitRequested
was unconditionally prevented in the run loop, so the process never
actually exited. Only prevent exit when code is None (the popover
window closing on its own), letting an explicit app.exit(..) through.

Launching the menubar app twice left two processes running, each
registering its own flame + spend-badge tray icon pair, so the
notification area showed four icons for one app. Add
tauri-plugin-single-instance, registered first in the builder chain,
so a second launch just refocuses the running instance's popover.
2026-09-01 12:42:30 -07:00
Resham Joshi
41f44edc7f
Merge pull request #1224 from getagentseal/ci/snap-upload-manual-review
Some checks failed
CI / semgrep (push) Has been cancelled
macOS Menubar CI / test (push) Has been cancelled
Tests / test (22) (push) Has been cancelled
Tests / test (22.13.0) (push) Has been cancelled
Tests / desktop (push) Has been cancelled
Windows Menubar CI / check (ubuntu-latest) (push) Has been cancelled
Windows Menubar CI / check (windows-latest) (push) Has been cancelled
ci(snap): treat the store's manual-review queue as a successful upload
2026-09-01 10:25:10 -07:00
iamtoruk
cad365610b ci(snap): treat the store's manual-review queue as a successful upload 2026-09-01 10:18:22 -07:00
Resham Joshi
cacc4e797d
Merge pull request #1223 from getagentseal/snap/narrow-session-grants
snap: narrow session-log grants to what the parsers read and drop the Copilot credential root
2026-09-01 10:02:37 -07:00
iamtoruk
a5289c2731 snap: narrow session-log grants to what the parsers read and drop the Copilot credential root 2026-09-01 09:56:03 -07:00
Resham Joshi
10f5564cc5
Merge pull request #1222 from avs-io/codex/grok-provider
feat(menubar): add native Grok Build quota provider
2026-09-01 06:54:42 -07:00
Aditya Vikram Singh
3664152d37 feat(mac): add native Grok Build provider 2026-09-01 18:46:02 +05:30
Resham Joshi
7d5bcd4d9a
Merge pull request #1216 from MiguelMachado-dev/fix/budget-test-future-timestamp
test(budget): seed current-month spend in the past, not at noon UTC
2026-09-01 05:11:26 -07:00
iamtoruk
56c34f7512 test(budget): compute the month start in UTC to match the CLI child
The fixture clamped to a local-time month start while the child is pinned
to TZ=UTC, so the clamp only worked at offset zero and the flake survived
the first minutes of each month everywhere else.
2026-09-01 05:11:00 -07:00
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
eae2b95fdf
Merge pull request #1213 from MiguelMachado-dev/fix/hermes-recorded-cost-fallback
fix(hermes): don't trust a $0 estimated cost — calculate from tokens
2026-09-01 05:07:30 -07:00
iamtoruk
12b20a2900 fix(app): let the Providers pane read hasUsage so token-only providers stay listed
The Electron Settings pane still filtered on cost, the exact gap this
change exists to close; it now reads the hasUsage field the payload
carries, falling back to cost for older CLIs.
2026-09-01 05:07:05 -07:00
iamtoruk
2620cbb2bc fix(hermes): bump the parse version so cached zero-estimate sessions re-cost
The cost rule changed, so sessions whose state.db fingerprint has not
moved must be re-parsed or they keep serving the stale placeholder zero.
2026-09-01 05:06:20 -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
Resham Joshi
e4602260a8
Merge pull request #1210 from getagentseal/fix/dock-integral-metrics
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
fix(menubar): round Capacity Dock metrics to whole points to stop perpetual relayout
2026-09-01 01:36:47 -07:00
Miguel Machado
a9d9065747 test(budget): seed current-month spend in the past, not at noon UTC
currentMonthTimestamp seeded at today 12:00 UTC, which is in the future
for the 12 hours before it. Rows timestamped in the future don't surface
in the overview, so every CI run between 00:00 and 12:00 UTC failed
'keeps overview budget lines only on unfiltered overviews' with
'No usage found'.

Seed five minutes back, pinned to month start on the 1st so the row
can't slip into the previous month.
2026-08-31 23:39:09 -03: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
c114424519 fix(hermes): don't trust a $0 estimated cost — calculate from tokens
Hermes writes estimated_cost_usd = 0.0 (not NULL) when cost_status is
'unknown' (no pricing data) or 'included' (flat subscription, e.g. Codex
plan). resolveHermesCost treated any non-null estimate as a recorded
amount, so every subscription-backed Hermes session reported $0.00 with
real token counts underneath.

Only trust positive estimates now; $0 falls through to the token-based
calculateCost. An explicit $0 actual_cost_usd (a real invoice amount)
still wins, and genuinely free models still land on $0 since litellm
prices them at 0.
2026-08-31 22:41:18 -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
Resham Joshi
f4e9ece5bc
Merge pull request #1209 from getagentseal/fix/dock-size-60
Some checks are pending
CI / semgrep (push) Waiting to run
macOS Menubar CI / test (push) Waiting to run
Tests / desktop (push) Waiting to run
Tests / test (22) (push) Waiting to run
Tests / test (22.13.0) (push) Waiting to run
feat(menubar): let the Capacity Dock size go down to 60 percent
2026-08-31 10:58:47 -07:00
iamtoruk
23aa2a2033 test(menubar): default-scale expectation follows the 60 percent default 2026-08-31 10:57:35 -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
Resham Joshi
4907094af9
Merge pull request #1205 from MiguelMachado-dev/fix/capacity-dock-hover-drift
fix(mac): stop Capacity Dock hover drift
2026-08-31 10:48:15 -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
Resham Joshi
10598498f6
Merge pull request #1201 from getagentseal/fix/copilot-credit-estimate
fix(plan): estimate Copilot AI credits from tokens and say when the total is incomplete (#1199)
2026-08-31 09:44:11 -07:00
Resham Joshi
9ef77a15a5
Merge pull request #1200 from getagentseal/fix/copilot-credential-discovery
fix(menubar): find Copilot credentials beyond the legacy plugin files (#1198)
2026-08-31 09:44:07 -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
71bd7607f3 docs(plan): calibrate the Copilot credit estimate wording against real session-store rows (#1199) 2026-08-31 03:13:04 -07:00
iamtoruk
616a1fada2 fix(plan): move the Copilot credits bar onto the estimate and print whole credits (#1199) 2026-08-31 03:10:29 -07:00
iamtoruk
d879d6590b fix(plan): estimate Copilot AI credits from tokens and say when the total is incomplete (#1199)
Only Copilot CLI session-store rows carry total_nano_aiu, so a typical user
has a handful of exactly rated requests and hundreds of unrated ones, and
codeburn plan showed the exact-only sum as if it were the whole bill.

Price every unrated request from its tokens at listed API rates (1 credit =
$0.01) and carry that as estimatedCredits alongside creditRatedCalls /
creditUnratedCalls. A session that already carries an exact figure is never
estimated on top of: total_nano_aiu bills that request's whole token set,
JSONL twin included. spentCredits, the bar and percentUsed stay on GitHub's
exact figures. The plan headline, and status JSON via creditsNote, now say
how much of the total is estimated.
2026-08-31 03:07:38 -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
iamtoruk
25c1218874 fix(menubar): find Copilot credentials from the Copilot CLI keychain, gh, env, and a pasted token (#1198)
Modern Copilot clients no longer write ~/.config/github-copilot/hosts.json or
apps.json, so the menubar reported "No GitHub Copilot credentials found" even
after signing in through VS Code and the Copilot CLI.

Discovery now walks an ordered read-only chain, first hit wins, every rung
tolerating an absent, locked, or malformed source: the legacy plugin files,
the Copilot CLI keychain item (service copilot-cli, read via /usr/bin/security
so no partition-list prompt can fire), ~/.copilot/config.json and
settings.json, COPILOT_GITHUB_TOKEN / GH_TOKEN / GITHUB_TOKEN, `gh auth token`,
and finally a token pasted into Settings. The two subprocess rungs are cached
for five minutes so eligibility checks and the 30s refresh cadence never spawn
per call, and hasCredential stays spawn-free.

VS Code's encrypted secret storage is deliberately untouched.

The no-credentials message now says usage tracking still works and names every
way to connect, and the Copilot settings pane gains a token field.
2026-08-31 02:05:03 -07:00
iamtoruk
286c1daf0d fix(menubar): poll the pointer so Capacity Dock hover works over any frontmost app
The #1170 hover synthesis rides on a global .mouseMoved monitor, but
macOS only delivers global mouse-moved events while the frontmost app
itself requests them. Chrome does, so hover appeared fixed there;
Finder and Terminal do not, so the dock went hover-dead over the
desktop and most native apps.

Add a 10 Hz pointer poll feeding the same passthrough + hover sync
path. A same-position diff guard makes idle ticks free, and the timer
lives and dies with the existing monitor lifecycle.
2026-08-30 15:12:20 -07:00
Resham Joshi
6a3fa2d0ce
Merge pull request #1196 from getagentseal/fix/atomic-heartbeat-rewrite
Some checks failed
Tests / test (22) (push) Has been cancelled
Tests / test (22.13.0) (push) Has been cancelled
Tests / desktop (push) Has been cancelled
CI / semgrep (push) Has been cancelled
fix(lock): atomic heartbeat rewrite ends the #904 torn-read flake
2026-08-30 03:33:16 -07:00
Resham Joshi
b74db73e3d
Merge pull request #1195 from getagentseal/snap/split-claude-credentials-plug
fix(snap): separate Claude credentials plug, narrow cline grant
2026-08-30 03:30:22 -07:00
iamtoruk
bc451ed1b6 fix(lock): heartbeat replaces the lock body atomically instead of truncating in place
The heartbeat rewrote session-refresh.lock with a plain writeFile,
which truncates before it writes, so any reader could observe an empty
or partial body for the width of the write. observe() tolerated that
window with retries, but every plain reader (the lock tests included)
raced it, which is the JSON parse flake behind #904.

The rewrite now lands next to the lock and renames over it, so a
reader sees the previous body or the next one, never a torn one. A
refused replace on Windows skips the tick, which staleness absorbs at
nine heartbeats per staleMs. observe() keeps its tolerance because
older codeburn versions sharing the cache dir still rewrite in place.

The new regression test hammers plain reads against a 1ms heartbeat:
it failed 5 of 5 runs against the old rewrite and passes 10 of 10
serial lock-suite runs with this change.
2026-08-30 03:29:01 -07:00