Commit graph

48 commits

Author SHA1 Message Date
iamtoruk
b1e8f121df feat(windows): the dock lays out on the display it was dropped on
The rail was laid out against whichever monitor the window happened to be
on and clamped to that one work area, so it could not be dragged onto a
second display and a relaunch would not have found it there.

A placement now names its display, the way the mac keeps its rail on the
screen it was left on. The name is a hint rather than an address: a
display that is gone falls back to the one the window is on, which is
what unplugging a monitor should do. A drag takes the monitor list once,
at the press, and then picks the display under the pointer by arithmetic;
asking the window for its monitors sixty times a second would be sixty
trips through the event loop, and the mac's own drag does the same
containment test against a captured screen list.

Display changes reach the rail through the cursor thread that is already
running: once a second it compares a fingerprint of the desktop (display
count, virtual screen bounds, primary work area), which costs three
user32 reads and no event loop, and lays the rail out again when it
moves. That is the counterpart of the mac's didChangeScreenParameters.
The new frame is announced, because the page paints into the frame it was
last handed and a window that moves on this side is otherwise invisible
to it.
2026-09-01 21:51:05 -07:00
iamtoruk
69b3762376 feat(windows): a Connect button and footer lines in the dock bubble
The bubble told you a provider needed reconnecting and left you to find
the settings window yourself. It now offers the mac's one recovery:
Connect for a provider the CLI found no credential for, Reconnect for one
that was refused, tinted with the provider's brand colour and opening the
settings window on that provider's own pane, where Retry and the
instructions are. Z.ai and ClinePass say "Add API Key" instead, because
their pane is where a key is pasted.

A provider that is in the dock's set stays on the rail after it drops
out, as it does on the mac. A row that quietly disappeared was the reason
the button had nowhere to appear, and a dashed ring with a Reconnect
button is the more useful answer.

The footer is the mac's: a divider and up to two small lines. The mac
fills them from facts its own adapters return and the CLI's quota output
drops, so the dock tells the two it can still tell honestly: when the
reading was taken, since the rail refreshes every five minutes, and how
many windows the five-row card had no room for.
2026-09-01 21:43:07 -07:00
iamtoruk
37d0f47d62 feat(windows): the dock seeds its provider set from what is connected
An empty provider set meant "nobody has chosen yet", and the rail read it
as "show everything signed in" for as long as nobody ever chose. The mac
instead writes the set down the first time it sees a connection, so the
switches in the settings window start out describing what the dock is
actually doing, and it caps the set at five.

autoSeed is that rule: until manualSelection latches, the set follows the
connected providers, capped, and the resting provider is renormalized so
it always names a row the rail is showing. It runs in the dock page,
which is where the quota answer already arrives, and only once the stored
preferences have been read; acting on the defaults before that would have
overwritten a set the user had chosen.

The resting provider is also normalized on the way out, so a provider
switched off in the settings cannot leave the rail resting on a row that
is no longer there. dock_preferred goes with it: the page reads the
preferred provider out of the preferences with everything else now.
2026-09-01 21:36:49 -07:00
iamtoruk
7b5266af51 feat(windows): a Glass appearance for the Capacity Dock
The second appearance now draws something: a translucent surface inside
the rail's own outline, with a brighter rim than graphite gets, dark
enough at 60 to 74 percent to carry the warm off-white type over any
wallpaper. The mac's Liquid Glass, as far as a shaped window on Windows
can go.

It is painted rather than the acrylic window effect, because that effect
cannot be shaped. Applying it and cutting the window down to the painted
outlines was tried first: a polygon region built from the flattened rail
and bubble paths, handed to SetWindowRgn, which reported success and left
a complex region on the window. The blur was unmoved. DWM draws an accent
backdrop for the whole window rectangle, and the dock's window is a good
deal larger than the rail: it carries the fully expanded rail plus the
bubble's reach, so the appearance was a grey slab a third of the screen
tall with a faint rail inside it. The corner preference does not clip it
either, which package B already found on the popover.

So the setting is called Glass and not Acrylic, since a name that
promises a blur it cannot give is worse than the honest one. The stored
value still reads the old "acrylic" spelling.
2026-09-01 21:31:34 -07:00
iamtoruk
7423b9b73d feat(windows): the squircle gauge shape
The gauge is a path now rather than an SVG circle, so the Gauge shape
setting has something to choose between: CapacityDockGaugePath's circle,
and its continuous rounded rectangle at a 30 percent corner radius.

The continuous corner is what makes a squircle read as one. It reaches
about one and a half radii along each edge and is drawn as a single cubic
pulled 55 percent of that reach toward the corner; a circular quarter-arc
would kink where it meets the straight edge, which is the whole difference
from a circle at this size.

Both shapes start at twelve o'clock and run clockwise, so the usage arc is
trimmed with a dash pattern over a normalized path length rather than a
circumference the squircle does not have, and the mac's compensating
rotation is not needed.
2026-09-01 21:15:12 -07:00
iamtoruk
804f665a84 feat(windows): the Capacity Dock follows the size setting
The rail was fixed at the mac's smallest scale because both halves of its
geometry hard-coded the numbers that scale produces. Now the page and the
Rust side each rebuild every metric from the stored scale, with the mac's
rounding, so the two stay in step at any size between 60 and 120 percent.

dockGeometry.ts exports a cached metrics(scale) instead of a frozen M, and
dock.rs grows a Metrics struct with the same base values. The bubble keeps
the mac's floor of 0.9: below that its type stops being readable, so a
60 percent rail still gets a 315 px card. What a stylesheet rule needs
rather than an element (the row gap, the gauge box, the percent type, the
bubble's spacings) arrives as a --dock-* variable on .dock.

Writing a dock preference now re-reads the geometry in Rust and moves the
window, because the page can only paint inside the window it is given.
The settings section says appearance and gauge shape are still stored and
unread; size no longer is.
2026-09-01 21:09:02 -07:00
iamtoruk
64bf4ce526 fix(windows): drop the daily_budget command the settings window replaced
`daily_budgets` answers with both thresholds, and the hero reads that one
now because the alert follows the display metric. The single-threshold
command had no caller left.
2026-09-01 20:45:51 -07:00
iamtoruk
aacc42b13b feat(windows): usage refresh, terminal and daily budget settings
The last three sections of the mac's General pane, and the pieces of the
app that read them.

Usage Refresh replaces the two hard-coded intervals. Manual never spawns
on a timer, so usage refreshes only when the popover opens or Refresh is
pressed; a chosen cadence applies open or closed, since the reader asked
for that number specifically; Auto keeps what the app already did. The
label says "1m open, 2m closed" rather than the mac's "less on battery",
which is the adaptive refresh that comes with the data-layer work and
would be a promise this build does not keep.

Terminal picks which console Full Report and Optimize open in. It exists
for the same reason as the mac's PreferredTerminal: a user preference must
never become a free-form string in a command line. The stored value parses
back through a closed set, every executable is a compile-time literal
resolved from %SystemRoot% or %LOCALAPPDATA%, and the one case that is
re-parsed by a shell rather than passed as argv, the PowerShell line,
is only built when every token has already passed the argument allowlist.
Anything not installed falls back to the Command Prompt, which always is.

Alerts arm the daily budget the tray flame is judged against. It follows
the display metric: dollars for Cost, millions of tokens for the two token
metrics, with the mac's presets plus Custom. Both thresholds live beside
the currency in the CLI config, because the tray reads them before any
webview exists, and a change reaches the popover and the flame at once
rather than at the next refresh.

The hero follows the metric too, so the popover and the tray can never
disagree about what the day cost: the token metrics put the total in the
headline, and Tokens replaces calls and sessions with the up and down
split, as the mac's hero does.

Also here because the dark theme made it obvious: a native select popup is
painted by the OS in its own colours, so options that only inherited the
select's colour were white on white. Both are stated now.
2026-09-01 20:39:05 -07:00
iamtoruk
9af1384384 feat(windows): the Capacity Dock section in General settings
The dock could only be switched on from the tray and told which provider
to rest on by clicking a row. Its section in General now carries the mac's
whole set: the switch, the resting provider, size from 60 to 120 percent
in fives, appearance, gauge shape, and one switch per provider with the
rule that the last connected one cannot be deselected, so the rail can
never be left with nothing to show.

They live in windows-dock.json beside the rail's placement rather than in
windows-settings.json, because the dock reads that file from Rust before
its page exists. A change emits codeburn://dock-settings-changed, and the
rail follows the resting provider and the provider set the moment either
is changed rather than at its next refresh. An empty provider set means
nobody has chosen yet, which is why it shows everything connected instead
of nothing; the switches latch manualSelection so the auto-seeding that
comes with the dock work will not second-guess a choice.

Size, appearance and gauge shape are stored but not yet read: rebuilding
the rail metrics from a scale, the acrylic surface and the squircle gauge
all belong to the dock itself, and the section says so rather than looking
broken.
2026-09-01 20:21:46 -07:00
iamtoruk
adb36c8c88 fix(windows): build a window from a command that is not holding the main thread
Opening the settings window from the popover's More menu did nothing, and
switching the Capacity Dock off and on from the settings window left the
rail gone until the next launch. Same cause both times: a synchronous
Tauri command runs on the main thread, and building a window from there
waits on the event loop that is already busy running the command, so the
build never completes and the caller never sees an error either. The tray
menu path worked throughout because its handler is the event loop rather
than a command. Both commands that create a window are async now, which
puts them on the async runtime where the build is dispatched and answered.

Two things underneath that made the dock case worse. `hide` closed the
window, which only asks: the window leaves the manager some time later, so
a quick off and on found the dying window still under its label and merely
re-showed it. It is destroyed now. And `show` reset the layout state only
on the branch that built a window, while `relayout` moves the window only
when the frame it computes differs from the stored one, so a reused window
kept a stale frame and sat at its builder size in the corner. The reset
now covers both branches.
2026-09-01 20:21:33 -07:00
iamtoruk
0a0d8ea300 feat(windows): provider panes gain config directories, cadence and API keys
The provider panes could say what the connection was and retry it, which
left the three things the mac lets you do about a connection undone.

Claude gets its Config Directories list, persisted to the CLI's own
claudeConfigDirs so every `codeburn` run aggregates the same set whether
this app spawned it or the user typed it in a terminal. Add Directory
opens the shell's folder browser through SHBrowseForFolderW rather than
pulling in a dialog crate for one button; the modal runs on the thread
that owns the app's windows.

Every pane gets the quota refresh cadence, Manual to fifteen minutes, from
the mac's SubscriptionRefreshCadence. It is deliberately one setting shown
on each pane rather than ten that could disagree: one `codeburn quota` run
answers for every provider, so a per-provider cadence would be a promise
the transport cannot keep, and the copy says so.

Z.ai and ClinePass get a key field, because their adapters are the only
two that read a credential from the environment rather than a file the
provider's own tools wrote. The key is sealed with DPAPI under
%LOCALAPPDATA%\codeburn, which is the Windows counterpart of the mac's
CodeBurn-owned Keychain item: the ciphertext is bound to this user on this
machine. It reaches the CLI as an environment variable on the child
process, never on a command line and never in a log, and it is never read
back into the webview, which only learns whether a key is stored at all.

Cursor, Z.ai, Grok and ClinePass had no provider mark, so the sidebar
listed four dotted circles; their marks come from the same
Resources/ProviderIcons set as the six already here.

windows-sys gains Win32_Security_Cryptography for DPAPI and the Shell and
Com features for the folder browser. No version changes and no new crate.
2026-09-01 20:00:42 -07:00
iamtoruk
22eb785b63 feat(windows): a settings window, with General, About and provider panes
Settings were a panel inside the popover, which put them behind the same
blur-to-dismiss the numbers live under and gave the tray's Settings and
Capacity Dock Settings items nowhere better to land. They now open a real
window (label `settings`, 880x620, resizable, created on demand and
destroyed on close) with the mac's sidebar: General, About, then one row
per provider the CLI has a live quota adapter for, dimmed until it is
connected. The popover keeps only the link.

Three stores, split by who else reads the value. Anything the CLI shares
stays in ~/.config/codeburn/config.json behind the lock the currency write
already took; everything else goes to a new windows-settings.json beside
windows-dock.json. Every write emits codeburn://settings-changed with the
whole object, so the popover retints and the tray refigures without a
reload: the theme, the accent, the tray badge, the display metric, the
menubar period and the scope all move live.

The tray figure follows Display now rather than always quoting today's
cost. Period and Scope give it its own payload key, as the mac keeps a
separate menubar key, and the suffix ("/wk", "/mo", "/6mo") says which span
it is. The mac's fifth metric, Credits (Codex), is not offered: it reads a
payload field the CLI does not emit. Its token metrics both show the total
in the badge, because the 16 px bitmap has room for about four glyphs and
not for the up/down pair.

Two currencies were missing against the mac's nineteen (CNY, RON), and the
stored currency was never read back at startup, so the popover opened in
dollars however it had been set; a `currency` command answers that now for
both windows.
2026-09-01 19:49:37 -07:00
iamtoruk
7390236fdd feat(windows): a fetch-error overlay with Retry, and stuck-load recovery
A failed fetch put an eight-second toast over an empty window and then
took the toast away, leaving a blank popover and no way to try again. The
mac replaces the loading overlay with a retry card whenever the fetch
failed and there is nothing cached to fall back on, and keeps a toast for
the case where numbers are already on screen and the failure is an aside.
Do the same, and clear the error whenever the selection changes or a
fetch succeeds, since an error describes one selection.

Stuck-load recovery is the mac's ladder: while the popover has nothing to
show, retry at 8 s doubling to 60 s, six times, then say "Could not load
X. Check that the codeburn CLI is installed and working." A fetch torn
down across sleep can leave its in-flight mark behind, which would make
every retry bail on the guard, so a mark older than the CLI's own 60 s
timeout is cleared first. A younger one is left alone, so recovery never
races a fetch that is still going to answer.

The toast is anchored to the popover card rather than to the window: the
card now sits inside a transparent gutter, so an absolute offset from the
window is 12 px out.
2026-09-01 19:03:07 -07:00
iamtoruk
5fa0263559 feat(windows): Local and Combined scope, and the Claude config picker
The popover could only ever describe this machine, and could only ever
describe every Claude config at once. Both are the mac's second row under
the period strip.

Combined asks the CLI to pull every paired device; the hero then reports
their totals with a per-device list underneath and "Combined · <period>"
as its caption. Pulling peers is best effort in the CLI, so a combined
request can come back with local numbers and no combined block: the hero
says "Combined unavailable · showing local" rather than pretending. The
daily-budget alert stays out of combined, since the limit was set against
one machine.

The Claude config picker appears only past one config, which is exactly
when the CLI emits the block. The two controls exclude each other by
design, as they do on the mac and as the CLI enforces: combined resets
the provider to All and clears the config, since paired devices report
unfiltered usage; picking a config forces All and local, since a config
scopes Claude on this machine. A multi-day pick falls back to local for
the same reason.

The payload cache key and the fetch arguments grow scope and the config
id alongside the days.
2026-09-01 18:55:32 -07:00
iamtoruk
b090544784 feat(windows): top projects, the costliest session, Pull requests and Tooling
Where the money went, in the three shapes the mac shows it.

Stats gains the mac's top three repositories, each opening onto its own
sessions with calls, token split and the models that ran, and the single
costliest session as a one-line footer. One project is open at a time, so
the block never grows past a screenful.

Pull requests is the top three by attributed spend. It hides when the
payload has no PR block, which covers both an older CLI and a
provider-scoped view, where nothing is attributed.

Tooling is what the agent reached for: tools and MCP servers by call
count, skills and subagents merged into one list by cost. Merged because
from the reader's side they are one question, "what did I delegate to and
what did it cost". It starts collapsed, since it is reference rather than
headline.
2026-09-01 18:49:21 -07:00
iamtoruk
2c1599f3ce feat(windows): the Calendar and Optimize insights
The two insight pills the popover never had.

Calendar is the contribution grid: one column per week, Monday at the top,
shaded against the busiest visible day so it answers "compared with my own
worst day" rather than against some absolute figure. The week count is
measured from the container rather than fixed, so the grid always ends
flush with the right edge whatever the popover is asked to be. Hovering a
day fills the detail strip underneath with its cost, calls and tokens.

Optimize names the spend the CLI can call avoidable. Retry tax is what
re-asking cost; routing waste is what the same edits would have cost on a
cheaper model. They keep separate hues and separate rows because they are
separate decisions, and only the headline adds them up. Each expands to a
per-model breakdown. With nothing to optimize the pill says so rather
than showing two empty sections.

Both read fields `codeburn status` has been emitting all along and the
payload type simply ignored.
2026-09-01 18:41:10 -07:00
iamtoruk
1dd1298c57 feat(windows): a Saved column in Models, and the hero's two notes
Three numbers the payload already carried had nowhere to go.

Models gains the mac's Saved column: what a local model would have cost
at its paid baseline. It only appears when a local-model mapping actually
saved something, otherwise it is an unlabelled column of dashes. The bar
still tracks real cost, so a local model at zero leaves it empty and the
counterfactual is never summed into spend.

The hero gains the same figure as a period total ("Saved $X with local
models") and, on Today, the daily-budget alert the tray flame already
turns yellow for. Both are separate lines under the amount, deliberately,
so the reader cannot add avoided spend to real spend. The budget is read
from the CLI config through a new `daily_budget` command, and re-read
whenever the popover opens, since package C's settings window will be
what writes it.
2026-09-01 18:35:44 -07:00
iamtoruk
1436a8b893 feat(windows): the trend window follows the period
Trend always drew 19 days, so asking for 30 Days or a month showed the
hero for that period above a chart of a different one, and Life showed
19 days of a lifetime. The mac sizes the window to the question: 19 for
today and the week, 30, 31, and up to 90 for the long periods, with the
"vs prior Nd" comparison moving with it. A picked day falls back to 19,
because one day is not a trend.

The bar columns now share the width instead of being pinned at 13 px, as
the mac columns do: 19 land on the same 13 px they always had, 90 simply
get thinner, and past 45 bars the gap drops to 2 px so the bars keep more
of the chart than the gaps do.
2026-09-01 18:30:11 -07:00
iamtoruk
5fca09cd36 feat(windows): 6M and Life periods, and the calendar day picker
The period strip stopped at "All", which the CLI reads as six months, so
there was no way to ask for the whole history and no way to ask about one
particular day. The mac offers six segments plus a calendar button, and
the CLI has taken --day and --days all along.

The strip now carries the mac's labels (Today, 7D, 30D, Month, 6M, Life),
which are short for a reason: six segments and the button share one 360 px
row. The picker collects days into a pending set and only applies them on
Done, so choosing five days costs one CLI run rather than five, and the
caption reads "2 days (2026-08-31 .. 2026-09-01)" as it does on the mac.
A picked day overrides the period without clearing it, so dismissing the
picker returns to whatever segment was live.

The payload cache is now keyed on the whole selection rather than on
period and provider, since two selections that send different arguments
to the CLI are different answers. Rust validates the dates itself: is_safe_arg
would happily pass "2026" or a bare word to --day.
2026-09-01 18:26:56 -07:00
iamtoruk
053ff8c6ce fix(windows): one clean 12 px radius on the popover, with nothing square behind it
The card was drawn rounded but three square things sat behind it: the
acrylic backdrop, which the window effect paints edge to edge and which
DWM's corner preference does not clip; the DWM frame line; and the DWM
drop shadow, whose inner edge is the window rectangle, so it met itself
at a right angle exactly where the card curved away. The result was a
rounded card with square corners showing through, worst at the top left
and along the bottom.

The window now paints nothing at all. The acrylic effect is gone (at 94
percent surface opacity it was contributing a tint, not a blur, and the
surface is simply opaque now), DWM is told not to round and not to draw a
border, and the OS shadow is off. In its place the window is 12 px larger
than the card on every side and the page paints its own drop shadow into
that gutter, so the shadow follows the card radius. The gutter doubles as
the inset the card kept from the work-area edge, so the card lands where
it always did.

Verified at 10x on all four corners in both themes: one antialiased arc,
the desktop behind it, and the shadow curving with it.
2026-09-01 18:15:59 -07:00
iamtoruk
209248f0e7 fix(windows): drop the brand dot from the agent tab chips
Every chip led with a 5 px coloured dot, so a strip of five providers read
as a legend before it read as a row of names, and the dot competed with
the quota capsule underneath it for the same "how is this provider doing"
glance. The name and the cost carry the chip on their own.

The provider colour table stays: the capsule, the hover card and the
settings panes can still ask for a brand colour.
2026-09-01 18:02:26 -07:00
iamtoruk
147ff702fa feat(windows): the mac header, with a flame wordmark and an accent picker
The popover opened with a flat two-tone wordmark and "AI Coding Cost
Tracker", which is a category, not a promise. The mac says "Your AI Bill,
Itemized" under the site's animated flame wordmark, and lets the reader
pick the accent the whole surface is drawn in.

The wordmark is the website's .flame-text verbatim: a 300 percent wide
flame gradient clipped to the letters, swept by flameShift 3s ease
infinite. It pauses while the popover is hidden, the gate the mac added
after measuring 5 to 7 percent idle CPU on an always-running sweep, and
honours prefers-reduced-motion.

The nine presets are ThemeState.swift's, each with its four shades, and
they map one to one onto the accent tokens the stylesheet already
declares on :root. Writing them as an inline style on the same element
outranks both theme blocks, so a single write covers light and dark, and
main.tsx applies the saved preset before the first paint so nothing
renders in ember and then jumps. The dock window reads the same tokens.
2026-09-01 17:57:08 -07:00
iamtoruk
9d4f0ff4f0 fix(windows): hide the Plan pill under All, as the mac does
Plan describes one subscription: a tier, its windows and when they reset.
Under All it stacked a block per connected provider, which reads as a
list of plans rather than an insight and pushed the real content off the
first screen. The mac hides the pill unless a single provider with a live
quota source is selected, so do the same and drop the stacking.
2026-09-01 17:45:21 -07:00
iamtoruk
5a74de5bf9 fix(windows): warn about quota from 70 percent, as the mac does
The header warning row listed every connected provider from 50 percent,
which fires on an ordinary working afternoon and trains the reader to
ignore it. The mac's aggregate status uses 70, the point where the rest
of the window is genuinely at risk. Match it.
2026-09-01 17:45:14 -07:00
iamtoruk
1a6981cfc3 feat(windows): open the settings panel on the section the tray asked for
About CodeBurn in the tray menu now lands on the About group rather than the
top of the panel, and Capacity Dock Settings lands in General, as it does on
the mac until the dock has a pane of its own. The panel takes the section it
should show rather than guessing from what opened it.
2026-09-01 17:28:29 -07:00
iamtoruk
f8fbcc207c feat(windows): tint the tray flame by quota, and fill out its menu
What the tray says without being clicked, brought in line with the mac status
item. The flame takes the worst connected provider's quota severity (yellow,
orange, red; untinted while there is nothing to say), and falls back to yellow
when today's spend is over the daily budget, in that order. The logo is
recoloured in Rust from the embedded artwork, alpha untouched so only the
colour moves; no new dependency, since the tray feature already pulls in a PNG
decoder. The daily budget is read from the CLI's own config.json, where
package C's settings UI will write it; absent or zero means no budget, which
is the default today.

The badge figure and tooltip are written to %LOCALAPPDATA% on every refresh
and put back at startup while under ten minutes old, from the mac's
MenubarStatusCache, so a relaunch no longer blanks the tray for a CLI round
trip. The frontend stopped clearing the badge before its first payload, which
would otherwise wipe what was just restored.

The right-click menu gains the mac's disabled usage row at the top ("Today ·
$X · N calls"), Settings..., Capacity Dock Settings... and About CodeBurn.
The three open the popover on a panel for now; package C turns them into deep
links to the settings window.
2026-09-01 17:28:10 -07:00
iamtoruk
a37c510ccb feat(windows): show Plan for every provider with a live quota source
Plan was Claude only, and its pill was gated on Claude being the single
detected tool, so a machine running two tools lost the view entirely. It now
follows the quota store: the pill appears when the selected provider reports
quota, or when All is selected and at least one does, and All stacks a block
per connected provider with Claude first.

Claude keeps its own path. The tier and last cycle's final reading come from
the credential file through plan_usage, and nothing else can supply them.
Other providers render from the store with the same utilization rows and the
same projection captions, plus the mac's no-credentials and reconnect states.

The CLI reports a window's label and reset time but not its length, which the
projection needs to know how far into the window we are, so the length is read
off the label and an unrecognised one gets no caption rather than a guess.
2026-09-01 17:15:08 -07:00
iamtoruk
fd7bc47547 feat(windows): warn in the header when a provider is running out of quota
A capsule under a tab only speaks when you are looking at that tab. The mac
puts a compact row under the wordmark listing every connected provider at or
over the warning threshold with its worst window, so the answer to "am I about
to hit a wall" is on screen the moment the popover opens.

Ported from QuotaWarningRow in MenuBarContent.swift, including the wording
that reads "Claude over limit (105%)" for a single provider past its cap
rather than the awkward "105% of quota used", and the icon ladder from
info circle through exclamation circle and triangle to the octagon.
2026-09-01 17:10:15 -07:00
iamtoruk
b6f711f1ba feat(windows): live quota in the tab strip, from one shared store
The popover had no idea how much of a subscription was left; only the Capacity
Dock read `codeburn quota`, and it polled on its own. A store in the page now
owns that answer: one CLI spawn every two minutes, single-flight, with the
mac's SubscriptionRefreshBackoff on failure (a failed refresh retries after
30s and doubles back out to the cadence, plus jitter), polling only while a
surface is subscribed. The strip, the warning row and the Plan insight will
all read it rather than each spawning a Node process.

Each tab whose provider reports quota gains AgentTabQuotaBar: a 3px capsule in
the four severity tiers (under 50 green, yellow, orange from 75, red from 90),
solid red when the credential needs reconnecting. Hovering opens the mac's
260px QuotaDetailPopover after 250ms and closes it 150ms after leaving: plan
pill, a row per window with bar, percent and time to reset, and the stale,
retrying, disconnected and reconnect cards with the mac's copy.

The CLI's quota JSON is flatter than the mac's adapters, collapsing the
connection state to `available` plus an optional error, so the six-way
Connection enum is rebuilt from those two fields plus what the store knows
about the refresh in flight.

The severity palette needed a second set of tokens: the mac only ever draws
these colours on a dark material, and plain yellow is illegible on this warm
light surface, so text and icons take a darkened ink in the light theme while
the bars keep the system colours. A third set covers the hover card, whose
surface is deliberately inverted against the theme.
2026-09-01 17:06:42 -07:00
iamtoruk
71bbbec962 feat(windows): build the tab strip from the payload's provider list
The strip was a fixed seven, so a machine running Gemini, Kimi or any of the
other two dozen tools the CLI reports had no way to filter by them. It now
mirrors AgentTabStrip.swift: All first, then every provider the payload says
has activity, dearest first, with the provider's brand mark from the mac's
ProviderFilter.color and the compact cost chip. Provider ids come straight
from the payload, which is what --provider takes, so any tool the CLI grows
appears without a change here.

The known-tool list stays as the fallback for a machine the CLI has not seen
activity on, dimmed and explaining itself on hover, because that copy is the
first-run answer to "what is CodeBurn watching".

Overflow chevrons select the neighbouring tab, as on the mac, rather than
scrolling blindly; both measurements are taken from elements the chevrons do
not resize, so showing them cannot feed back into the overflow decision.
2026-09-01 16:59:30 -07:00
iamtoruk
3551e2177e fix(windows): keep dock rows on the anchored end and the flare on a matching edge
Dropping the rail in the top-right corner left a horizontal rail whose ring sat
at its far left: the rows container kept the stylesheet's left and right of 0,
so an end-anchored horizontal rail only ever set its right and the row slid to
the start. Both orientations now set all four offsets explicitly, and the
stylesheet no longer pins the container.

While dragging, the flare followed the attachment progress of whichever edge
was nearest, so a vertical rail approaching the top wore a right-edge flare in
open space. The flare now only follows an edge of the rail's own orientation;
a perpendicular edge shows the loose pill until the drop, and the settle glide
runs from centre to centre so a change of orientation does not jump.

Adds a corner test and logs the layout inputs in debug builds.
2026-09-01 16:31:41 -07:00
iamtoruk
ad2f2c73ae feat(windows): drag the Capacity Dock to any edge, and a fixed window that never glitches on hover
Hovering used to move and resize the dock window, and WebView2 presents one
stale frame at every window change, which read as the rail drifting and
glitching. One transparent window is now sized once per placement for the
fully expanded rail plus the bubble's reach and never moves on hover. A 60 Hz
cursor poll, the counterpart of the mac's global event monitor, makes the
window click-through everywhere but the painted shapes, synthesizes hover for
the page, and drives dragging.

Drag follows CapacityDockController: the page owns the 3 px threshold and
passes the press point, Rust keeps the rail under the pointer, morphs the
flare away as it leaves an edge, and on release snaps to any edge within
44 px or leaves the rail floating, then hands the page the old rail rect so
it glides into place with the mac's attach and detach curves. Placement
(docked edge, orientation, normalized offsets) persists in windows-dock.json.
Top and bottom give a horizontal rail with the bubble below or above; a
floating rail keeps its orientation and puts the bubble where there is room.
The context menu gains Dock to Edge with all four edges.

The layout stays a pure function with unit tests, and every window metric
stays a whole pixel. windows-sys gains one feature flag for the cursor and
button reads; no versions change.
2026-09-01 16:06:03 -07:00
iamtoruk
a80bee7965 feat(windows): port the Capacity Dock to the macOS design
The Windows dock now mirrors CapacityDockView.swift at the mac's 0.6 default
scale: the graphite gradient surface with the concave edge flare, a provider
glyph inside a recessed ring, severity colours (green, yellow from 50, orange
from 75, red from 90) on ring, percent and bars, warm off-white text, and the
tailed detail bubble with the mac typography. This also settles the open
severity-colour question in favour of the mac behaviour.

Interaction follows CapacityDockController and CapacityDockInteractionState:
the resting rail shows the preferred provider; hovering expands it after 80 ms
and collapses 180 ms after leaving; hovering a row shows its bubble after
180 ms and dismisses it 240 ms after the row unless the pointer is on the
bubble; clicking a row pins the rail and makes that provider the preferred
one, persisted in windows-dock.json; Escape dismisses; right-click opens a
native menu with Refresh and Hide Capacity Dock.

One transparent window hosts both rail and bubble. dock.rs owns the geometry
as a pure layout function with unit tests, applies size and position in a
single SetWindowPos so the rail never flashes between two updates, and
returns window-relative frames the page paints into after measuring the
bubble's natural height. Every window metric stays a whole pixel.

Out of scope for v1, as before: dragging, edge choice and scale.
2026-09-01 15:30:12 -07:00
iamtoruk
004d736f8d fix(windows): warn when launched on a hidden window station
The invisible Capacity Dock was not a rendering bug. The debug exe had been
started through the QEMU guest agent's guest-exec, which runs as a service in
session 0, so the dock window was created on a window station that no desktop
shows. The stderr trace ("window created and shown") was accurate; the window
was simply never visible. Launched from the interactive session, the same
binary docks the rail at the right edge, shows the quiet "--" row without
providers, expands on hover, closes on toggle off and comes back on toggle on.

Debug builds on Windows now check the process window station for WSF_VISIBLE
at startup and print a warning when it is missing, so the next service session
launch explains itself. Verified: fires under a SYSTEM scheduled task, silent
from a terminal. Only a feature flag is added to the existing windows-sys
dependency; no versions change.
2026-09-01 14:59:38 -07:00
iamtoruk
c535a97873 debug(windows): opt-in devtools for the dock window via CODEBURN_DOCK_DEVTOOLS 2026-09-01 14:29:13 -07:00
iamtoruk
db4f282209 fix(windows): surface Capacity Dock show errors instead of discarding them 2026-09-01 14:18:12 -07:00
iamtoruk
7e1acd3715 refactor(windows): drop the unused expanded class from the dock root 2026-09-01 13:52:03 -07:00
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
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
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
iamtoruk
76d77d4ef7 chore: release 0.9.23
Bump all surfaces to 0.9.23 together (CLI, desktop app, Windows menubar +
Tauri/Cargo, Flatpak, README download links) and regenerate the lockfile
version fields. Move the Unreleased changelog into a dated 0.9.23 section
covering the Capacity Dock, OMP/Grok pricing fix, CB-3/CB-4 sync, and the
desktop/TUI/menubar reliability fixes. Credit CodexBar (prior art) in the
README acknowledgements and third-party notices.
2026-08-29 01:22:46 -07:00
iamtoruk
8d27241e0c chore: align app and windows versions with CLI 0.9.22 (installer manifest guard) 2026-08-25 06:42:34 -07:00
iamtoruk
195bb9128e chore: release 0.9.21
Version 0.9.21 across CLI, desktop app, and Windows menubar; refreshed
LiteLLM pricing snapshot and fallback (catches the 2026-08-24 OpenAI
GPT-5.6 cut and DeepSeek v4 repricing mid-rollout, #1134 tracks
re-tightening); CHANGELOG stamped for 0.9.21; README release links to
0.9.21. Snapshot-pinned model tests updated to current catalog truth.
2026-08-24 11:16:55 -07:00
iamtoruk
527e58078d menubar: install and launch the Windows tray app from codeburn menubar
Shares the mac release resolution behind a per-platform spec (tag prefix, asset name, error text), so the Windows path reuses the pinned-version URL, the release-API fallback scan, the retrying download and the sha256 verify unchanged. Windows then runs msiexec out of %SystemRoot%\System32 with /i /passive /norestart, treats 3010 and 1602 as non-failures, and launches the exe named by the product's Uninstall registry key.
2026-08-18 06:55:09 -07:00
iamtoruk
76c63cbfd1 windows: cfg-gate the tray badge so the Linux build has no dead code
The spend badge is a second tray icon carrying the number as its bitmap, which
only the Tauri tray backend provides; Linux runs its own SNI tray and has no
equivalent. The module was compiled there anyway, so every item in it - and the
two tray ids in lib.rs - tripped dead_code under clippy -D warnings on the
ubuntu leg.

- `mod tray_badge` and TRAY_ID / BADGE_TRAY_ID are now cfg(not(linux)), so the
  code is absent on Linux rather than present and unused.
- `set_tray_badge` reports the badge as unsupported on Linux instead of
  returning a success that never happened.
- The frontend hides the control wherever it is unsupported, behind
  TRAY_BADGE_SUPPORTED in lib/platform.ts - one constant, three call sites
  (the settings row, the footer menu item, and the effect that would otherwise
  invoke the command).
- AppState's `linux_tray` field is dropped: it was written and never read, which
  is the same lint one file over. init_tray_linux already owns the handle.

Checked rather than reasoned: `cargo clippy --all-targets -- -D warnings` passes
on macOS, and a scratch copy of the crate with the linux/macos cfg arms swapped
(so a normal macOS clippy selects everything a Linux build would keep, and drops
everything it would drop) also passes. Reinstating the ungated `mod tray_badge`
in that copy reproduces the exact CI failure, so the check is real. It stubs
tray_linux.rs, whose ksni and png deps do not build here - that file is still
only covered by CI's ubuntu leg.
2026-08-18 04:37:27 -07:00
iamtoruk
120747d2fa ci: build and release the Windows menubar
windows-menubar-ci.yml runs on windows/** changes: tsc, clippy with -D warnings,
and cargo test on both windows-latest and ubuntu-latest, plus a release-profile
`tauri build --no-bundle` on Windows. The Linux leg exists because most of the
crate's cfg(windows) code cannot be compiled anywhere else, so the reverse -
keeping the ksni paths and every shared helper clean off Windows - has to be
checked somewhere too.

release-menubar-windows.yml mirrors release-menubar.yml: a `windows-v*` tag (or
a manual dispatch) builds the MSI and publishes it, with a sha256, to a
"Windows Menubar vX" release.

The two release-desktop-*.yml files on the source branch are deliberately not
imported: their tag names and "Desktop" release titles would collide with the
Electron app in app/, which already owns `desktop-v*`.
2026-08-18 04:11:32 -07:00
iamtoruk
7e57fb8d4f windows: fix the security and correctness findings from the import audit
Process spawning (Windows searches the current directory before PATH):

- reg.exe and cmd.exe are now spawned by absolute System32 path via
  cli::system_command, which also carries the CREATE_NO_WINDOW flag the three
  previous copies each set by hand. The tray badge re-ran `reg query` on every
  refresh, so this was the most reliably reachable planted-binary path.
- "Connect Claude" resolves the claude binary itself instead of handing a bare
  name to the console shell.
- CLI lookup ignores empty and relative PATH entries. `;;` or a trailing `;`
  used to yield PathBuf::from("").join("codeburn.cmd"), a current-directory
  lookup, at startup. The filter lives in one place (find_in_dirs) that every
  search - codeburn, claude, and the Linux terminal probe - goes through.
- The Linux terminal path re-validates the whole command against the argument
  allowlist before joining it into the string `bash -lc` parses; anything that
  fails falls through to the argv-only detached spawn.

CLI version gate:

- MIN_CLI_VERSION moves from 0.7.0 to 0.9.9, the first release accepting
  `status --format menubar-json --no-optimize` (every quiet refresh passes it)
  and emitting all the payload fields the popover reads.
- The gate is probed on mount, before the first fetch. It previously only ran
  when a fetch failed with the literal "CLI not found", so an old CLI produced
  a payload whose missing history.daily threw and blanked the popover.
- A successful fetch no longer flips an incompatible CLI to compatible, and the
  settings panel no longer probes on its own - App owns the verdict, so a
  transient probe failure there cannot drop a working app onto the setup screen.
- The payload reads App makes are optional now, so a surprising payload lands on
  an empty state rather than a blank window.

Refresh cadence, mirroring mac RefreshCadence.swift: 60s with optimize findings
while the popover is visible, 120s today/all without them while it is hidden,
and an immediate refresh on show when the visible key is stale. Every hide path
in lib.rs now goes through mark_hidden so the debounce stamp and the frontend
signal cannot drift. Previously it was 60s with optimize regardless of
visibility - about 2880 CLI spawns a day.

Claude quota (plan.rs) stops calling the token refresh endpoint. Claude's
refresh token is single-use and rotates, so spending it invalidated the token
Claude Code itself holds and broke the user's login. Parity with
ClaudeCredentialStore.refreshAfter401: re-read Claude's own store for a token it
has already rotated, and report a transient failure when there is not one yet.

Smaller:

- Snapshot writes refuse a symlinked target and are 0600 on unix, mirroring
  mac SafeFile; no home directory now means no snapshots rather than a file
  dropped in whatever directory the tray was launched from.
- The Windows config lock keeps its file handle open, so the stale sweep can
  only ever unlink a lock whose owner is gone. The doc comment now says what the
  lock actually buys (the CLI never takes it).
- "updated Xs ago" is only stamped by a fetch of the key on screen.
- External links go through tauri-plugin-opener instead of target=_blank.
- The tray badge font is loaded once into a OnceLock instead of read and parsed
  on every render.
- autostart's shared import and constant are cfg-gated so clippy is clean on
  every OS.

Adds unit tests for the PATH filter and the version gate.
2026-08-18 04:10:07 -07:00
iamtoruk
b199af182e windows: import the Tauri tray app as the Windows menubar
Brings the Tauri 2.x tray popover from #1022 onto main as windows/, mirroring
mac/. Product name, bundle identifier, and version line up with the macOS
menubar (org.agentseal.codeburn-menubar, 0.9.20); the crate is renamed off
"desktop" so it no longer collides with the Electron app in app/.

Linux (ksni) stays compiled and dev-usable but is documented as experimental:
gnome/ is the shipping Linux surface.

The five src/ CLI commits on that branch are dropped - they re-implement a
daily-bucketing fix main already carries.
2026-08-18 04:00:59 -07:00