Commit graph

1917 commits

Author SHA1 Message Date
iamtoruk
fd9931666d fix(windows): three things that read rough beside the mac
A pass over the popover, the settings window and the dock, in both
themes, looking for what the mac does not do.

The insight pills were clipped by the card edge whenever Plan was there
to make seven of them. The mac keeps that row in a horizontal ScrollView
with no indicator and lets each pill keep its width, so this does the
same; a pixel comes off the pill padding as well, which is what lets the
ordinary six sit inside a 384 px card with the last word whole.

The Capacity Dock size slider drew a white track on the dark theme, the
loudest thing in that window. The track is painted from the tokens now,
ember up to the thumb and a quiet fill after it, in both themes.

And the settings window did not follow a theme or accent changed
anywhere else: the tray's theme item retinted the popover and the dock
and left this window on the old palette until it was reopened. It reads
the same broadcast the other surfaces do now.
2026-09-02 02:09:09 -07:00
iamtoruk
36c7b990aa feat(windows): the popover reads as what it is to a screen reader
An accessibility pass over the surfaces a keyboard or a screen reader
reaches, against what the mac announces.

The period and scope strips are radio groups now, with the pattern in
full: one tab stop each, arrow keys between the segments, aria-checked
rather than aria-pressed. Six tab stops for one choice is what a plain
row of buttons gives, and it is why leaving a control you have already
answered took six presses.

The insight pills already carried tab roles; they gain a name and the
panel they control, so the content below is announced as belonging to the
selected pill rather than as loose text.

Everything painted rather than written gets a label: each day in the
calendar picker announces its date instead of a bare number, and the
heatmap cells and trend columns carry the day and the figure with a role
for that label to attach to, which a bare span does not have.

Focus rings reach the last places they could not: text inputs, and the
accent swatches, where the selected swatch already wears an outline and a
focused one needed its own ring further out.
2026-09-02 01:52:48 -07:00
iamtoruk
85ce84a8bb feat(windows): the tray says when a paired device did not report
Under combined scope the tray figure is the cross-device total, so a peer
that failed to answer makes it smaller than what these machines actually
spent. The mac marks that beside its title with a dimmed
"reachable/total" and says "N of M devices reporting" in the tooltip.

The tooltip and the menu's usage row carry the counts here, in the mac's
words. The badge cannot: it is a 16 px bitmap with room for about four
glyphs, and squeezing "2/3" into it costs the figure its legibility. It
is drawn dimmed instead, half way to the panel behind it, so a reduced
total still reads as incomplete rather than as a glitch, and the words
are one hover away.
2026-09-02 01:39:10 -07:00
iamtoruk
ff97aa7b8f feat(windows): Pulse says what an edit costs on each model
Pulse had the mac's three tiles and not its caption, which is the line
that turns them into a decision: what one accepted edit costs on the
cheapest model of the period, and on the dearest when that is a different
model. The figures come from `current.modelEfficiency`, which the CLI has
emitted all along and the Windows payload type simply did not name.

Three decimals under a cent, as on the mac: a model that costs a tenth of
a cent an edit and one that costs nine of them both read as $0.00
otherwise, and telling those apart is the whole point of the line.
2026-09-02 01:33:27 -07:00
iamtoruk
929bca8019 fix(windows): the rail keeps its edge while the size changes
Dragging the Capacity Dock size slider tore the rail off the screen edge
and left it floating there for as long as the drag lasted. Three things
were wrong.

The window moves from Rust and the page paints inside it, and a size
change moved the window without telling the page. The page found out one
event and one round trip later, so in between it drew a rail sized and
offset for the window it used to have: on a right-docked rail that is a
pill hanging a bubble's width off its own edge. The new size and the
frame it belongs to now travel together in one event, and the page
applies both in a single render.

The rail is also pinned to the edge it is docked to, right or bottom,
rather than positioned from the window's left and top. A docked rail's
outer edge is the window's own edge, because the window is sized from the
rail, so that pin holds through any resize the window is given
underneath it.

And the writes are serialized. `set_dock_prefs` is async, so the several
writes a dragged slider starts were several tasks that could finish in
any order and leave the rail at a size the slider was no longer showing.
One at a time now, with a patch that is still waiting merged into the one
ahead of it, which also costs the drag fewer round trips.
2026-09-02 01:29:53 -07:00
iamtoruk
2b3c106da8 fix(windows): the daily budget lives where the CLI keeps it
The app wrote the spend limit as a top-level dailyBudget in dollars. The
CLI's own config type has never had that key: it reads budget.daily, in
the display currency. So a limit set in the settings window did nothing
for `codeburn report`, and a limit set by the CLI did nothing for the
tray.

The limit is budget.daily now, written as the reader typed it, in
whatever currency they are looking at, which is what the CLI's other
budget tiers already mean. Every comparison converts it back to dollars
against the rate the app already has for the currency, because the
payload is in dollars; the popover re-reads it when the currency changes,
since what a limit is worth in dollars moves with the rate.

An existing dailyBudget is read once more and moved across on the first
read after this build, rate applied, old key removed, so a limit set
before this does not silently switch off. The token budget has no CLI
counterpart and stays exactly where it was.
2026-09-02 00:51:59 -07:00
iamtoruk
ff56796640 feat(windows): a mark for every provider, and the mac's sigil for the rest
The dock, the settings sidebar and the dock's provider switches drew a
dotted circle for anything outside the ten quota providers, so a machine
running Droid or Kilo Code got a placeholder where the mac has a mark.

Seven more of the mac's own marks are ported from
Resources/ProviderIcons: Devin, OpenCode, Kilo Code, Kiro, IBM Bob,
Factory (which the CLI calls droid) and Qwen. Ids that share a mark go
through an alias table seeded with the mac's own bundledVectorAliases,
plus the CLI's spelling of an id the mac's catalogue spells differently
(kilo-code, ibm-bob) and the product aliases CapacityDockProvider.iconName
already implies: Kimi Code draws Kimi, Cursor Agent draws Cursor.

Everything else now gets the mac's generated sigil rather than a dotted
circle: two hooks whose reach, rotation and terminal come from an FNV-1a
hash of the id, drawn around the provider's monogram. Same hash, same
arithmetic, so a provider gets the same sigil here as it does there. The
drawing is mirrored in y and turns the other way because AppKit draws
y-up and SVG y-down.

hasProviderGlyph went with the dotted circle: nothing called it, and
there is no longer a provider without a glyph.
2026-09-02 00:32:53 -07:00
iamtoruk
fee71400cd chore(windows): remove what nothing reads
None of this is reachable, and none of it is caught by the compiler:
tsc's noUnusedLocals only sees a name unused inside its own file, and CSS
has no such check at all.

- --scroll-height, a token no rule ever read.
- DropMenu's danger flag and the .dropmenu-danger rule behind it, which
  no caller has ever set.
- SunMoonIcon and PowerIcon, from a footer that has not looked like that
  for a while. FlameIcon stays: the Stats costliest-session row draws it.
- currentTheme, whose last caller went with the theme cycle, and
  settingsSnapshot, which never had one.
- .segmented, .segment and .segment-active, left behind by the period
  control that now draws its own tabs.
- A SystemTime import in usage_guard that only the tests use, which the
  ordinary build had been warning about since it landed.
2026-09-02 00:23:16 -07:00
iamtoruk
c9502bc7ff feat(windows): export into Downloads and reveal what came out
Export opened a console, ran the CLI in it and left the result in
whatever directory the app happened to be started from, which on this
platform is next to the executable. The mac has always written into
~/Downloads as codeburn-<timestamp> and then revealed the result in
Finder with it selected, so this does the same: no console, a folder of
CSVs or one JSON file with the mac's yyyy-MM-dd-HHmmss stamp, and
Explorer opening on it through /select, which is the Windows counterpart
of activateFileViewerSelecting.

The Downloads folder comes from the known-folder API rather than
%USERPROFILE%\Downloads, since it can be moved. The stamp is formatted in
the page because a local-time format in Rust would cost a dependency or a
hand-rolled timezone; it never reaches a shell, but it does become a
directory name, so Rust checks it is digits and hyphens of the right
length rather than trusting it.
2026-09-02 00:17:50 -07:00
iamtoruk
f021513479 fix(windows): one answer to what CodeBurn watches
The empty state and the tab strip's known-tool fallback both answer the
first-run question "where does this look?", and they answered it
differently: the strip said "Pi session logs" where the empty state said
%USERPROFILE%\.pi, and "OpenCode session storage" against
%USERPROFILE%\.local\share\opencode. Neither Pi spelling was right
either. The CLI reads ~/.pi/agent/sessions.

Both read one table now, lib/watched, whose paths are the roots the CLI's
own providers probe. Cursor and Copilot gain the paths they never had
rather than a description, so all six rows read the same way, and a long
path wraps inside the hover card instead of running past it.
2026-09-02 00:11:17 -07:00
iamtoruk
8a227ef87d feat(windows): the tray theme item cycles System, Light and Dark
The item said "Toggle Dark/Light" and flipped between two states, so a
reader who had ever chosen Light or Dark could not get back to following
the system, which is the only setting the mac has at all. It steps
System, Light, Dark now and names the state it moves to, because a menu
item reads as a verb. The popover's More menu runs the same cycle from
the same wording, so the two can never disagree.

The choice is written to the settings file from Rust rather than asked of
the popover, which means the item works with no popover on screen, and
every window retints from the broadcast that already exists. That made
the resolved-theme state in the popover dead, and the media listener that
kept it, so both are gone.

One bug had to go first. A tray's on_menu_event handler is registered
globally rather than against that tray, so registering it on both the
logo and the badge icon ran every menu item twice: the cycle skipped a
step, and Show Capacity Dock had been toggling itself straight back.
2026-09-02 00:03:52 -07:00
iamtoruk
6ed5b8f2fd feat(windows): the CLI timeout is a silence, not a stopwatch
A flat 60 s wall-clock timeout cannot tell a wedged child from a slow one. It
killed a first parse of a large corpus, which is the run that most needs to
finish, and it waited a full minute on a child that had died on its feet.

Port of CLIWatchdog.swift. Every read spawn now sets CODEBURN_PROGRESS=1,
under which the CLI's parser writes a keepalive line every 10 s for the whole
of a scan, so silence means something: 45 s of it stops the child, with the
mac's ten-minute cold budget until one payload has come back, and a
fifteen-minute ceiling for a child that chatters forever without finishing.
Every byte on either pipe restarts the clock, which is why both are drained in
chunks now rather than read to the end. Progress lines are stripped from
stderr before it can become the error a window shows.

The stop is asked for first: Ctrl+Break to the child's own process group,
which is what a console process has here instead of SIGTERM and which node
delivers as SIGBREAK, so the CLI unlinks its own refresh lock on the way out.
Only a child that ignores it inside five seconds is killed. The kill is
taskkill /T, because what this app spawns is codeburn.cmd and the process
doing the work is node, a generation below: killing the handle we hold ends
the shim and orphans the parse.
2026-09-01 23:44:55 -07:00
iamtoruk
da94b585d5 feat(windows): a background refresh with nothing new to read is skipped
The hidden loop spawned a Node process every two minutes whether or not a
single session file had been written since the last one. On an idle machine
that is the whole cost of the app for nothing.

Port of UsageDataChangeGuard.swift with the Windows spellings of the roots,
taken from each provider's own probeRoots in src/providers: the Claude config
directories and the desktop sessions, Codex, the Copilot store and the VS Code
family, Cursor, Gemini and Antigravity, and the two dozen smaller roots, each
honouring the environment override the CLI reads. Directory roots also stamp
their first level of children, which is where a new session lands; a provider
that keeps one file is watched as that file. It is deliberately not a
recursive scan: a tick must not replace a full Node parse with a full Rust
walk of the same corpus.

The list tracks the CLI's discovery by hand, so a provider missing from it
must degrade to "refreshes every half hour", never to "stale forever". That is
what the thirty-minute ceiling on a skip is for. The anchor is taken after a
payload comes back, never before, and an open popover or a refresh somebody
asked for is never skipped.

Debug builds say which ticks were skipped and why.
2026-09-01 23:27:35 -07:00
iamtoruk
f019b45c85 feat(windows): one quota poll on the cadence, for every window that shows one
The quota store already had the cadence setting and the mac's backoff, but
two things went around it. The Capacity Dock never used the store at all: it
kept its own fetch on a fixed five minutes, so the setting did nothing there.
And every usage tick called the store's refresh directly, which with an open
popover meant a quota spawn every thirty seconds however the cadence was set.

The dock now reads the same store as the popover and the settings window, so
one setting governs all three and a failure backs off with jitter rather than
retrying on the dot. The store reads the cadence itself instead of waiting to
be told, because three windows run their own copy and one that forgot to wire
it would poll at the default forever.

Refreshes are split by who asked. Retry, Refresh Now and a key just saved are
a reader asking and outrank the cadence. A background usage tick only rides
along with a poll the cadence has already earned, and never in Manual. The
popover opening gets an answer the cadence had not earned yet, down to the
mac's thirty-second interactive floor.

Two windows still keep two stores, and their timers fire within a second of
each other, so `dock_quota` in Rust now coalesces: whoever asks second waits
for the run in flight and is answered from it. The cache lives ten seconds,
far below the interactive floor, so a Retry is always a live answer.
2026-09-01 23:26:53 -07:00
iamtoruk
75b1d14423 feat(windows): no background refresh while nobody can see the tray
A locked session or sleeping displays kept the refresh loop spawning a Node
process every two minutes for a figure nobody could look at. The mac stops
on screensDidSleep and refreshes on didWake; this is the Windows half of
that.

The notifications need a window to be delivered to, so there is a hidden one
on a thread of its own with its own message pump, in the shape of the dock's
cursor thread. It registers for session change (lock and unlock), for the
console display state, and for suspend and resume. A message-only window
would not do here: WM_POWERBROADCAST is not delivered to one.

The loop keeps its timer while the machine is unattended and skips the fetch,
so the first tick after the screens come back finds fresh numbers even if a
notification was never delivered. Waking, unlocking or the screens coming
back refreshes at once, in every mode but Manual, as on the mac. An open
popover clears a latched flag on its own, since it is proof the screens are
on.
2026-09-01 23:00:09 -07:00
iamtoruk
8bbdd1c7d2 feat(windows): the usage refresh follows the cadence and the power state
The background loop ran on a fixed 60 s open, 120 s closed, whatever the
Usage refresh setting said beyond Manual, and whatever the machine was
running on. Every tick is a full Node process, so a laptop on battery paid
the same as one on the wall.

The arithmetic is now RefreshCadence.swift's, in Rust where it can be
tested and where the power read belongs: Auto is 30 s while the popover is
open, 120 s hidden on AC, 150 s on battery and 300 s in battery saver
(GetSystemPowerStatus through the windows-sys dependency, one new feature
flag). Manual answers nothing and the loop stops until the popover opens
or Refresh is pressed. A fixed cadence is what it says, except that an open
popover always gets the active one, as on the mac: the reader is looking at
those numbers.

The page asks for a plan on every tick rather than arming one interval,
because the power state changes under a timer that has already been armed.
Debug builds print each plan on stderr.
2026-09-01 22:51:12 -07:00
iamtoruk
2716727993 fix(windows): the secret scrubber cannot panic on multi-byte output
The Bearer check sliced the first six bytes out of the string to compare
them, which panics when those six bytes end inside a multi-byte character.
A CLI printing a path with an accent in it, or any non-ASCII error message,
would have taken the update stage down instead of reporting what went
wrong. The comparison is on bytes now, which also proves the six that
follow are ASCII, so the index after them is a character boundary.
2026-09-01 22:35:31 -07:00
iamtoruk
a81d21df1c docs(windows): the update checker in DEVELOPMENT.md
Where the check lives, what it looks for in a release, why the CSP did not
have to grow a GitHub entry, and the one constant nobody should trip over:
renaming the MSI asset breaks the version lookup in the app as well as in
the CLI's installer.
2026-09-01 22:33:32 -07:00
iamtoruk
3aa58edace fix(windows): a forced update check is not answered by the cached one in flight
Check for Updates from the tray opens the About pane and asks it to check
straight away, and the answer came back stale: the pane mounts, its first
subscriber starts the ordinary cached check, and the forced one that
follows a tick later was coalesced into it. The reader pressed a button and
got whatever the two-day cache already held.

Coalescing is right for two surfaces asking the same question at once and
wrong for a button, so a forced check now waits for the run in flight and
then asks properly.
2026-09-01 22:32:18 -07:00
iamtoruk
3da4bb8dcb feat(windows): Check for Updates in the tray menu and in About
The tray menu was missing the mac's Check for Updates, and the About pane
had the button greyed out with a note saying the check did not exist yet.

The mac answers its menu item with an NSAlert carrying one of three
results. Here the same three belong on the About pane instead: it already
shows the version, and unlike the mac - which sends the reader back to the
menu to install what the check found - the button that installs it can sit
right next to the result. So the menu item opens About and the anchor tells
the pane to check straight away, which is one window rather than a modal
over a window.

Up to date names the version, an available update names the release and,
when the CLI is behind too, both; a failed check says what failed and why,
scrubbed on the Rust side before it gets here. The row's hint says when
GitHub last answered, because a cached answer can be up to two days old and
a reader should be able to see that.
2026-09-01 22:16:39 -07:00
iamtoruk
8de3aad4b9 feat(windows): the update badge and the CLI update banner in the popover
Two surfaces the mac has had and this build did not: the header badge that
says an update is waiting, and the strip under the footer that says the CLI
itself is behind.

Both read one store (src/lib/update.ts), which is the observable half of the
mac's UpdateChecker; the check itself is already in Rust and cached, so
asking on mount costs nothing and the store only offers Rust the chance to
re-check every twelve hours, well inside its own two-day interval.

The badge is the mac's: it appears only when there is an update or a failed
check, its label carries which stage failed, and the click does what the
mac's does - retry a failed check, install an offered update, ask again
otherwise. The banner keeps both of the mac's ways out: Update now, which
runs the same one-click sequence, and the command itself, copyable, for
anyone who would rather watch npm work in their own terminal.

The banner's blue is the mac's Color.blue rather than the brand ember,
deliberately: the star banner sits two rows below it in terracotta, and an
informational strip that borrows the brand colour reads as a second one.
2026-09-01 22:14:54 -07:00
iamtoruk
a68eea089c feat(windows): check GitHub for a newer app and CLI, and install both
The Windows tray app had no way of knowing it was out of date: the macOS
menubar has checked GitHub every two days since 0.9.9, and here the only
signal was the setup screen for a CLI that was missing outright.

This is the port of Data/UpdateChecker.swift onto the Windows release line.
The app ships as an .msi under a windows-v* tag rather than a zip under
mac-v*, so the scan looks for a release carrying both the .msi and the
.sha256 beside it, and skips one missing either, because the installer
verifies that checksum before anything executes. The CLI's own tags are a
bare v*, which is what separates them from both platform lines.

The check runs in Rust rather than in the page. The answer has to survive a
popover that is closed most of the time, so it is cached to
%LOCALAPPDATA%\codeburn-menubar\update.json beside the tray status file and
re-read at startup; and the webview's CSP has no business reaching
api.github.com when the request can be made where the FX and Claude plan
calls already are. So the CSP is unchanged. The request is HTTPS-only
(redirects included), carries a 30 s timeout, and reads the body in chunks
against a cap rather than buffering whatever arrives.

Nothing is downloaded or executed here: `codeburn menubar --force` does the
install, which is what verifies the checksum and hands the file to msiexec.
The CLI is updated first, from the npm beside the launcher, so that
installer is the one that ships with the new CLI. 0.9.21 is the oldest CLI
that can install a Windows app at all (the Windows branch of the installer
landed in 527e5807), which is this platform's counterpart of the mac's
0.9.9 floor: an older one is refused rather than left to download a mac zip.

Each stage gets the mac's 120 s timeout, is killed rather than waited on
past it, and has its stderr capped at 64 KB and scrubbed before any of it
reaches a window: npm and the installer echo environments when they fail,
and this app's children carry provider API keys in theirs.
2026-09-01 22:11:22 -07:00
iamtoruk
dd6bc2453a feat(windows): the rail turns mid-drag when the edge in reach turns
A rail dragged from the right edge to the top stayed a tall pill all the
way there and only became a wide one after the drop, so the drag never
showed what the drop would do. It turns while it is being carried now, as
the mac's dragChanged does: as soon as the edge in reach runs the other
way, the rail is laid out for that orientation and the window is resized
under the pointer.

The grip is what makes that survivable. The drag anchor was the cursor's
offset from the window origin, which means nothing once the rail changes
shape; it is the fraction of the rail the pointer grabbed now, so a
53 by 112 pill that becomes 74 by 64 hangs from the same place in itself.
That is the mac's pointerAnchoredDragFrame, which applies the fractions
from the start frame to whatever size the rail currently has.

The page is handed the new frame with the drag event, since a rail that
has turned lives in a different window and paints a different shape.
2026-09-01 21:55:50 -07:00
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