* 0.9.25: correctness + provider fixes, energy guard, logo, default DMG CLI/engine fixes: local-model savings count reasoning; ZCode reasoning billed; codex-credits version-boundary tiering; GLM alias repointed to z.ai discounted rate; openclaw/pi/qwen timestamp mtime fallback; hermes delta timestamp; sqlite/warp/hermes busy+permission reclassified as failed (no sealed empty); codex-cache dev+ino; cursor-cache WAL; antigravity server TTL; quota timeout+ grokbot footer+claude near-expiry; serve RSS guard env+hysteresis; CSV export subfolder; providers pane fixed window; Warp credit-based cost. Desktop/menubar: unified flame logo; default DMG; docs signed+notarized. * menubar: one running instance, self-relaunch on language change The single-instance guard only retired strictly older copies, so two login items starting in the same instant both survived, and a copy whose bundle identity did not survive install was never seen at all. The decision is now total (newest launch wins, ties break on pid) and peers are matched on bundle id or executable name. --keep-both opts one launch out. Language changes no longer have the desktop app quit and reopen the menu bar, which made macOS attribute the new process to the desktop app and re-ask for the data-access grant. The menu bar relaunches itself via the existing remote command key; older menu bars that do not watch the key fall back to the old path after 5s. * desktop: export toast shows the saved path; resource buckets on app_close The export toast showed the folder that was picked, not the dated subfolder the files land in. The handler already parsed the CLI's saved line; it now returns that path and the toast uses it. app_close carries cpu/mem (and serveCpu/serveMem when serve reported) as bucket labels, sampled on the existing flush interval. serve adds cpuSec and peak rssMb to its answer frames. Unmeasured figures are omitted, never sent as zero. * menubar guard never leaves zero instances; installer replaces in place; JSON export into folder Guard: an unreadable launch date on either side could make two copies retire each other. Unreadable peers now count only when their pid is lower, and a copy that cannot read its own date retires lower pids only, so a disagreement keeps at least one instance. Installer: an existing bundle in /Applications or ~/Applications is replaced where it lives instead of a second copy being added. The old bundle is moved aside and restored on any failure; a cross-volume move falls back to a copy that is re-verified with codesign. An unwritable location is never escalated: the install goes to ~/Applications and the leftover is named. Export: -o pointing at an existing folder writes the JSON inside it. Short sessions omit the cpu buckets. setLanguage reopens the menu bar if its own relaunch never comes back. AppRelaunch passes the bundle path as an argument. * menubar guard orders by kernel start time; installer opens the copy that exists and recovers a killed install Guard: launch dates could be unreadable and pid order can disagree with start order after pid reuse, so two copies could still retire each other. Ordering now uses the kernel-reported process start time, which both sides read identically. A copy whose start time cannot be read is left out, so the worst case is two menu bars, never none. Installer: with the only copy in an unwritable /Applications, a plain run tried to open a path that did not exist. It now opens the installed copy. A placement killed mid-way is recovered on the next run, a concurrent install is refused, and a failed restore names where the previous bundle is. Process matching uses the exact executable name. Export: a trailing separator names a folder. Telemetry cpu is measured from telemetry start. * installer: a recycled pid can no longer block installs; language change waits for the replacement process An aside left by an earlier install counted as an active install whenever its pid was live, so once that pid was reused every install was refused for good. It now also has to be recent (ctime within 10 minutes), a pid we may not signal is not ours, the refusal names the file, and an orphan that cannot be cleared is reported instead of aborting the install. setLanguage confirmed the relaunch with a matcher the dying process still satisfied, so the reopen fallback never fired. It now waits for a pid that was not running before. * desktop: only the headline refreshes live; act, yield and the optimize scan move to slower tiers An open window ran act report (a fresh CLI process each time), yield and an optimize scan on every refresh. The headline poll now passes --no-optimize and takes the snapshot path; act report refreshes on mount, on manual refresh and every 10 minutes, yield every 5. The optimize scan runs at most once a day per query scope, is stored in userData with its time, and is forced fresh by the Optimize page or a manual refresh. Figures that are not live show their age, and no stored scan means no savings clause rather than a zero. On battery the live interval doubles; the chosen cadence stays the base. * desktop: a stored optimize scan is only valid on the day it was computed; cadence changes no longer refetch The scan cache is keyed on the argv, which says 'today' or '30days', not a date, so yesterday's scan was served as today's. It is now reused only on the same local day. Stored findings in Signals carry their age, a failed scan shows the error instead of scanning forever, and the cold-boot label uses the time the app received the payload. usePolled fetched immediately whenever its interval changed, so every power transition (and launching on battery) refetched every live hook and could spawn an extra act report. Fetching and timer arming are now separate effects. Optimize's yield is on the same 5 minute tier as Overview. * desktop: re-ask for the optimize scan on the first render of a new local day An app left open across midnight kept yesterday's stored savings under Today, because the scan was only requested on mount, scope change or manual refresh. The local day is now one of the hook's triggers; the previous day's figure is dropped while the new scan runs. * serve: a menubar poll is never answered from the status snapshot Inside its settle window the status snapshot returns the pre-change payload on purpose. The resident serve process then memoized that answer as clean, so after a single write followed by quiet the headline stayed on the old figure until the next write or the five minute memo cap. The snapshot is for one-shot runs; the resident process already holds the parsed state, so it now skips it. * tests stop writing the real serve pid file; superseded caches are swept; installer notes reach the desktop card ServeConnection takes its pid file as a parameter, so the Swift tests no longer share ~/.cache/codeburn/menubar-serve.pid with a running menu bar, and the reaper only signals a record that is a serve --stdio command. Superseded session-cache, codex-results and cursor-results files (100MB+ each) are removed once untouched for 14 days, at most once a day. daily-cache and the hermes ledger are never swept: they carry sealed days a version bump adopts. The menu bar installer's leftover-copy advice is emitted as a marked line under CODEBURN_PROGRESS and shown on the desktop card. The skipped-refresh NSLog is debug only. The app's vitest workers turn off Node's built-in web storage. * menubar: anonymous usage statistics, under the same consent as the desktop and the Windows tray The Swift menu bar sent nothing, so every codeburn-menubar row was a Windows tray. It now follows the desktop's telemetry.v1.json when that exists (read only: same install id, same on/off, onboarded required) and otherwise keeps its own state with the same region default (off in EU/EEA/UK/CH and when the region is unknown). Settings gains one Privacy toggle, disabled when the desktop owns the choice. Events use the tray's names; the daily usage snapshot is the CLI's block passed through a sanitizer and is left to the desktop when it is the consent source. Debug builds never send. A resident CLI that gets disabled for the run now says so in the log. * menubar statistics: private network session, abandoned batch on opt-out, a desktop No survives the desktop going away The sender used URLSession.shared, so a server or CDN cookie and the default User-Agent rode along and would have outlived an opt-out. It now owns an ephemeral session with no cookies, no cache, a fixed agent string and no redirects. A batch that is out when the toggle goes off is dropped rather than re-queued under the fresh id. The desktop's answer is recorded locally, so a missing or damaged state file never falls back to the region default, and the standalone id is persisted when minted. The toggle stays usable as a local off switch under desktop consent. Copy states what this app actually sends. * vercel gateway spend is shown on its own row and kept out of totals by default The gateway reports daily aggregates per model, with nothing to match against the local tools that were pointed at it, so every headline counted that traffic twice. Totals now leave the gateway slice out when all providers are shown; the row keeps its full amount and is marked not in total, --provider vercel-gateway is unchanged, and codeburn gateway-totals include folds it back in. The daily cache still stores the slice, so the choice applies retroactively. Reports with no gateway credential are byte-identical. The gateway's request_count now feeds the call count instead of each daily row counting as one call. Hermes: a mid-session price change lands on the day it is observed and sealed days are never rewritten; stated in the code and changelog. * gateway exclusion applies to every report through the parse, and the detail panels follow the headline The first pass narrowed only the day totals, so By tool, top models, top projects, activities, status json projects and any project-filtered table still carried gateway spend next to a headline that did not, and By tool shares could pass 100%. The rule now lives in parseAllSessions: with all providers in scope and the opt-in off, aggregate-only sessions are dropped after the memo, and the callers that derive cached days opt out so stored slices are unchanged. day.projects is reduced like models. The gateway stays visible once, as a labelled not-in-total row with no share, and standalone reports note the excluded amount on stderr so machine output is unchanged. * dashboard: the background history index follows the gateway exclusion too The index keeps the whole corpus so it can fill the daily cache, but its per-period projection handed that unfiltered list to the project, model and activity panels, so they regained gateway spend once the index landed. * ci: a hung lock suite fails in 90s and retries once with a warning; slow Windows tests get measured limits The cache-lock step failed 6 of the last 60 runs with no output for five minutes after the vitest banner; passing runs take 12-18s on every Node version. Each attempt is now capped at 90s and retried once, with a warning whenever that happens. On windows-latest a single CLI spawn takes 1.4-12s, so the four-spawn status snapshot test and the c6 parser suite get limits taken from those runs, each with its reason. Both test jobs print their ten slowest cases. * desktop: Privacy & data uses the same rows as the rest of Settings The pane mixed two static claims with two controls in its own layout. It now uses the about-row pattern every other pane uses: title and hint on the left, one control on the right. The claims became the subtitle. Rows: anonymous usage statistics (toggle, link to what is sent), device sharing state with Manage, local report snapshots with Clear, export with Open export. * desktop: Privacy & data keeps one bounded column and rows that never squeeze The card stretched with the window, stranding each control hundreds of pixels from its text. This pane's heading, subtitle and card now share a 760px column and one text measure. Rows stack on their own width, because the window can never be narrow enough for the old viewport rule to fire; row buttons do not wrap. The what-is-sent link sits on its own line, and the snapshot and export descriptions fit their measure and say this machine. * menubar tests clean up their scratch defaults and leave the real Keychain alone Four test files never removed their UserDefaults suites and the rest removed the domain but left the plist, so thousands of files piled up in ~/Library/Preferences. A shared helper forgets a suite and deletes its file, and every test that makes a suite now uses it. cfprefsd still rewrites an empty plist when the test process exits, so a run leaves about a hundred 42-byte files with no test data in them. The real-Keychain round trip only runs with CODEBURN_TEST_REAL_KEYCHAIN=1. * desktop: the resident parser retires after 15 idle minutes and restarts on demand The renderer stops polling while the window is hidden, but the serve child stayed resident with its parsed cache, one to two GB on a large corpus. After 15 minutes without a request it is stopped the way a settings restart stops it, without spending the unexpected-death budget, and the next request starts a new resident through the existing lazy path, never a one-shot. CODEBURN_SERVE_IDLE_MS tunes or disables it. * desktop: every settings pane keeps a bounded column, and dark buttons have an edge Cards stretched with the window, so on a wide display controls sat up to 1300px from their labels and intro lines ran past 140 characters. All panes now share one left-aligned column (760px, 980px for projects, aliases and pricing, which hold wide rows) and one text measure. Rows stack on their own width instead of a viewport rule the 900px minimum window could never reach, and a long path in Projects no longer overflows the pane. In dark mode the secondary button matched or sat below its surface, and was invisible on the plugin install dialog. It gets a face and a border from two new tokens; light is unchanged. The onboarding consent label matches Settings. * desktop: this device shows its fingerprint on its own line The local name and the fingerprint are two adjacent inline spans, so they read as one run of text. * menubar: the resident parser retires after 15 idle minutes and restarts on demand The menu bar kept its serve child, and the parsed cache with it, for the whole run, even with the popover closed and nothing changing. After 15 minutes without a request the child is retired without counting as a death, and the next request starts a new resident through ensureStarted, never the one-shot fallback, whose snapshot settle window would make the figure lag a whole tick. The window sits above the longest gap between real requests, so a child stays warm while work is happening. CodeBurnServeIdleSeconds tunes or disables it. * serve: a poll re-checks only what the watcher saw change, and shard writes are coalesced With a session being written, every poll re-listed about 2,400 directories and re-fingerprinted about 6,000 transcripts, then rewrote the whole current-month shard (49MB on a large corpus) and read it back on the next poll. The resident process now reuses the previous listing and fingerprints for paths its root watcher proves untouched, and falls back to the full sweep whenever the watcher is missing, unhealthy, overflowed, armed after the sweep, does not cover the path, the memo is older than 4.5 minutes, or the process was suspended. Shard publication is held for up to 90s and flushed when stdin closes; a held write is dropped rather than written over something another process published. One-shot runs are unchanged. Active poll cost 0.71 to 0.33 CPU-s at a 30s cadence; time-to-reflect unchanged at about 1.2s across append, new dir, new file, delete, rename-over, in-flight, watcher overflow and unhealthy watcher. Changelog: state the telemetry default as it is in this version. * a retired parser gets to publish its held shards, and durable providers are never held Both apps retired the serve child with SIGTERM before its stdin-close flush could run, so every retire discarded the coalesced window. They now close stdin, give the child a bounded grace to publish and exit, and signal it only if it is still running; a settings restart does the same. Measured: flushed 0/5 before, 5/5 after, for both clients. copilot's cache entries are the only record once Copilot prunes its own files, so a held window that was dropped (retire, crash, kill -9) before the source was pruned lost that spend for good. A window that a durable provider dirtied is published on the poll that parsed it, as before coalescing existed. The RSS guard publishes a held window before it clears the caches instead of discarding it. * serve: release the lifetime parse after the fill, and make the collection real The RSS guard dropped its memos and then called globalThis.gc, which exists only under --expose-gc; no launcher passes it, so the collection had never run and the freed pages never went back. On a cold start the resident idled at 2.2GB with 364MB of live heap: clearing every memo moved RSS by 0MB, a collection alone by 700MB. After the background fill has sealed its summaries the process now publishes any held shard window, drops the memos it can re-read from disk (the cold start had loaded the cache with scope 'all', which then served every later poll), and collects; it collects again a minute later for as long as a pass returns 64MB, at most four times. Cold idle 2198MB to 700MB, warm 900MB to 781MB. Reports are leaf-identical cold and warm, time-to-reflect unchanged, a released month scope reloads in 0.3-0.5s. * warp: the billed cost reaches reports and survives the cache The provider derived a dollar cost from Warp's own billing record (provider cents, charged usage, or credits), but warp was missing from the reported-cost pass-through, so the cached call kept no cost and every report, cold or warm, priced the conversation from its tokens. A fixture billed at $1.22 reported $0.15. A call whose cost came from a billing record now keeps it; a call that only has the token floor stores none and is still re-priced when prices change. Warp entries re-parse once (provider parse version), and the daily cache moves to v34 so days whose Warp source still exists re-derive; call counts do not move, so nothing is double counted or dropped. * openclaw and pi: a reported cost survives the cache like every other reported cost Both providers read the cost their tool recorded for a message, and both were missing from the reported-cost pass-through, so reports priced every call from tokens instead. Fixtures reported $0.011 against $0.056 (openclaw) and $0.013 against $0.410 (pi). A call with a reported cost now keeps it; a call with none, or an explicit zero, stores none and is still re-priced when prices change. omp had been added to the list in #1150 and pi, the same parser, was never revisited. The provider list is one named set, the unreachable providerCallToTurn is gone, and both providers re-parse once; the v34 daily cache re-derives their days with call counts unchanged. * test: pin parse count per report and per resident poll
31 KiB
Distributing CodeBurn Desktop
This document describes how to produce distributable macOS, Windows, and Linux
builds of the Electron desktop app. Release macOS builds are signed with a
Developer ID Application certificate and notarized by Apple (see "macOS code
signing and notarization" below); the Windows and Linux builds are
unsigned. Windows NSIS packages are built and checked by the
Build Windows installer GitHub Actions workflow; the other desktop packages
are still produced by hand. All three targets are produced by
electron-builder.
The bundled CLI (no install prerequisite)
The packaged app ships its own copy of the codeburn CLI and needs nothing
installed on the target machine. Packaging stages a self-contained copy of the
root repo's CLI into app/build/cli (see scripts/stage-cli.mjs) — the tsup
bundle (dist/main.js), its Node-version launcher (dist/cli.js), the root
package.json (the bundle reads its version), plus the CLI's production
node_modules closure. An afterPack hook (scripts/after-pack.cjs) copies
that tree into the app at Contents/Resources/cli/ after packaging and before
signing, so it lands inside the code signature.
At runtime a packaged build spawns the bundled CLI with Electron's own binary
acting as Node (ELECTRON_RUN_AS_NODE=1), so no Node install is required —
the app is version-matched to itself. main.ts sets CODEBURN_BUNDLED_CLI to
Resources/cli/dist/launch.js (a small shim that preserves the argument shape
expected by the resident and one-shot CLI paths, then hands off to main.js),
and electron/cli.ts
resolves it ahead of any persisted path or PATH lookup.
A user-installed CLI is only consulted outside a packaged build (dev via the
Vite dev server) or when explicitly overridden — CODEBURN_BIN=/abs/path, or a
persisted path file (Application Support/CodeBurn/codeburn-cli-path.v1). The
full resolution order in electron/cli.ts is: CODEBURN_BIN → dev repo CLI
(Vite) → bundled CLI → persisted path → PATH/Homebrew/nvm/volta/asdf.
Freshness
Packaging always rebuilds the root CLI before staging: the app stage-cli
script runs the root build:cli (tsup only — no dashboard build, no network
bundle-litellm fetch), so dist/main.js and dist/cli.js are regenerated
from current src/ on every package* run. A stale global codeburn can never
ship, and the app can never be older than the JSON surfaces it calls. The
bundled CLI's deps are pure JS (no native bindings), so the same staged tree is
valid for every arch.
Why afterPack, not extraResources
electron-builder routes every node_modules directory it copies through its
production-dependency filter, which keeps only the app's own deps — so the
bundled CLI's dependency tree gets stripped out of an extraResources copy
(filter: ["**/*"] does not defeat this). afterPack copies the staged tree
in verbatim, which is the electron-builder-recommended mechanism for adding
unpacked files that must not be ASAR-archived.
The bundled tray app and Capacity Dock (Windows only)
The Windows desktop app also carries the Tauri tray app from windows/, so
installing the desktop app gives the user the tray icon and the Capacity Dock
without their having to know that codeburn menubar exists. Two switches in the
sidebar's bottom-left corner turn each surface off ("Menu bar" is the tray
process, "Sidebar" is the dock rail); both default on, and neither appears on
macOS or Linux, or in a build with nothing staged.
scripts/stage-menubar.mjs puts the tray app into app/build/menubar, which
build.win.extraResources ships as resources/menubar. It copies rather than
downloads, exactly like stage-cli.mjs: with no --from it takes the local
windows/src-tauri/target/release output, and CI downloads the windows-v*
release assets in its own step and passes --from <dir>.
The two routes need different things staged, which is why there are two scripts:
npm run stage-menubar(run bypackage:win) stagesCodeBurn.Menubar_<version>_x64_en-US.msiand its.sha256. The digest is copied from the release when it is there and computed when it is not, so a localcargo tauri buildstages the same shape a release does.npm run stage-menubar:store(run bypackage:store) stagescodeburn-menubar.exeitself, plus any sidecar DLL beside it.
The staged tray app is not the released one, even at the same version.
build-windows-installer.yml runs npm run tauri build itself and stages the
MSI that run produced. release-menubar-windows.yml runs its own
npm run tauri build on a windows-v* tag and uploads that MSI as the release
asset. Two builds, two binaries: a Tauri MSI is not byte-reproducible (build
timestamps, the package GUID and the PDB signature differ per run), so the
CodeBurn.Menubar_<version>_x64_en-US.msi inside a desktop installer and the
windows-v<version> release asset of the same name are different files with
different .sha256 digests, even off the same commit.
Nothing in the install path depends on them matching: the CLI's installer
verifies the digest of the file it was handed, and the upgrade rules go by the
DisplayVersion in the uninstall registry rather than by a hash. What it does
mean is that a version number is not a statement about which binary is on a
machine, and the release asset is not a way to reproduce or verify what a
desktop installer carries. So cut both from one commit when releasing, and say
"built by the desktop installer" or "the windows-v asset" rather than treating
the version as an identifier for either.
The NSIS route: install through the CLI, never downgrade
app/electron/menubar.ts runs at every launch (which is also what covers a
desktop-app update, since the staged MSI travels with the app) and hands the
staged file to the CLI's own Windows installer by spawning
codeburn menubar --staged-msi <absolute path>. The path is an argument of the
command rather than an environment variable, so nothing a variable in the
inherited environment happens to name can reach msiexec; the
CODEBURN_MENUBAR_MSI variable this replaced is now rejected by the CLI. The
install itself is not reimplemented on the Electron side:
src/menubar-installer.ts owns the uninstall-registry read, the checksum
verification, the msiexec /i ... /passive /norestart call and the rules that
go with a bundled copy. It prints one CODEBURN_MENUBAR_RESULT <json> line that
the desktop app reads.
The spawn itself is not made at every launch. msiexec /passive puts an admin
prompt in front of the user, so companion.v1.json records the version of the
tray app that is on disk and the version of any staged MSI whose install the
user declined at that prompt (exit 1602). A launch skips the probe when the
recorded tray app is the staged version and is still there, and skips it when
this exact staged version was already refused. A newer staged version is always
offered, and so is turning the "Menu bar" switch on by hand, which clears the
refusal.
Only a refusal is remembered. A spawn that timed out, a CLI that was not there and a run that died before printing its result are all transient, so nothing is written down and the install is attempted again at the next launch; recording them would turn one bad launch into a tray app that is never installed.
When msiexec exits 3010 the install is real but unfinished: Windows could not
replace a file that was in use and has deferred it to the next restart, so the
binary on disk is still the previous tray app while the uninstall registry
already reports the new version. The desktop app starts nothing in that state
and the sidebar corner says "Restart Windows to finish installing the menu bar
app." instead. BundledInstallResult carries no field for this, so the desktop
side reads the installer's own notice line; the optional rebootRequired in
MenubarInstallResult is believed first, for when the CLI starts sending it.
Two of those rules matter here:
- Deduplication. The MSI carries a fixed WiX upgrade code
(
windows/src-tauri/tauri.conf.json,bundle.windows.wix.upgradeCode), which is the value Tauri already derived from the product name, so installing the bundled copy over a manualcodeburn menubarinstall is an in-place upgrade rather than a second entry in Programs and Features. - Never downgrade. If the installed
DisplayVersionis newer than the bundled one, nothing is installed and the existing app is left alone.
The marker. The installer writes
%LOCALAPPDATA%\codeburn-menubar\installed-by.json, crediting desktop only
when it installed onto a machine that had no tray app, and manual when it
upgraded one that was already there. An existing marker's verdict is never
rewritten. build/installer.nsh (wired as nsis.include) reads it in the
uninstaller and removes the tray app only when the marker says desktop, so a
tray app the user installed by hand survives an uninstall of the desktop app.
Launch at login on this route is a single HKCU\...\CurrentVersion\Run value
named CodeBurn, the same value the tray app's own settings toggle writes
(windows/src-tauri/src/autostart.rs), so the two can never leave two entries.
The Store route: no msiexec
A packaged app cannot run msiexec and would be fighting the package manager if
it could, so the AppX build ships codeburn-menubar.exe inside the package and
launches it from app\resources\menubar\. Launch at login is a
windows.startupTask extension (build/appx-extensions.xml, wired as
appx.customExtensionsPath), which also lets the user turn it off in
Settings > Apps > Startup; no Run value is written. The tray app detects the
package with GetCurrentPackageFullName and skips its own update checker
entirely, since Store updates cover it.
That is why the Store is the recommended Windows install: it is the only Windows route with a signed artifact (Microsoft signs the package at submission) and a real update path. The GitHub downloads stay a developer preview, unsigned and without self-update, until an Authenticode certificate exists.
The startup task is Windows' to set, not this app's: reaching one would take the
WinRT Windows.ApplicationModel.StartupTask API, which Electron has no binding
for and which this app ships no native code to reach, and a Run value written
beside it would start the tray app twice. So trayPrefs() reports
launchAtLoginManaged: true on this route and the Menu bar pane renders that row
as text plus a button that opens ms-settings:startupapps, rather than a switch
that would silently move nothing. That URL is the one exception in the main
process's external-open guard, which is otherwise http(s) only.
Talking to a running tray app
The tray app has no window of its own, so its argv is the control channel: the
Tauri single-instance plugin hands a running instance whatever a second launch
was started with (windows/src-tauri/src/lib.rs). --quit exits and
--reload-settings re-reads the preference files. Turning "Sidebar" off writes
enabled: false into ~/.config/codeburn/windows-dock.json and then sends
--reload-settings, so a running rail disappears at once rather than at the next
launch.
Versioning
app/package.json's version tracks the CLI's version (root
package.json) — one CodeBurn version across CLI, menubar, and desktop.
Bump it in the same change that bumps the root version; the splash, the
About dialog, and the artifact filenames all read it from there.
Build
npm --prefix app install
npm --prefix app run package # macOS, both arm64 and x64
npm --prefix app run package:arm64 # macOS arm64 only (faster on Apple Silicon)
npm --prefix app run package:x64 # macOS x64 only
npm --prefix app run package:win # Windows NSIS installer, x64
npm --prefix app run package:store # Microsoft Store AppX, x64 (Windows host only)
npm --prefix app run package:linux # Linux AppImage, x64
The Linux targets and arches can be widened by calling electron-builder
directly, all from the same macOS host:
cd app
npx electron-builder --linux AppImage deb # x64 AppImage + deb
npx electron-builder --linux AppImage deb --x64 # force x64 on an arm64 mac
npx electron-builder --linux AppImage deb --arm64
npx electron-builder --linux rpm --x64 # rpm; needs `brew install rpm` (rpmbuild)
The rpm target is the only one with an extra prerequisite — fpm (bundled by
electron-builder) shells out to rpmbuild, so brew install rpm must be present
or the build fails with "executable rpmbuild is required". It emits
codeburn-desktop-<version>.x86_64.rpm, the name the website's Fedora/RHEL
download links.
package runs npm run stage-cli (rebuilds the root CLI and stages the
self-contained bundle into app/build/cli; see "The bundled CLI" above), then
npm run build (compiles electron/ with tsc, builds the renderer with
vite), then electron-builder --mac (whose afterPack hook copies the
staged CLI into the app). package:win and package:linux mirror it exactly,
swapping the final flag for electron-builder --win and electron-builder --linux. Developers can run all three locally on the same macOS host —
electron-builder downloads the NSIS and AppImage tooling on first use. Release
Windows installers are built by the windows-latest workflow described below.
Artifacts
electron-builder writes to app/release/ (gitignored, like dist/):
CodeBurn-<version>-arm64.dmg,CodeBurn-<version>.dmg— installer imagesCodeBurn-<version>-arm64-mac.zip,CodeBurn-<version>-mac.zip— zipped.appbundlesrelease/mac-arm64/CodeBurn.app,release/mac/CodeBurn.app— the raw unpacked bundles (arm64 and x64 respectively).blockmapfiles alongside each zip/dmg (used by electron-builder's differential-update mechanism; unused since this app has no auto-updater yet)
Both dmg and zip targets are built for both arm64 and x64 — four
artifacts total, not a universal binary. This keeps each download roughly
half the size of a universal build. Pick the zip if you just want to unpack
and drag to /Applications; the dmg gives users the familiar drag-to-Applications
installer window.
Build configuration
The build block lives in app/package.json (small enough not to warrant a
separate electron-builder.yml):
appId: "org.agentseal.codeburn-desktop"— reuses theorg.agentseal.*prefix from the menubar app's bundle id (org.agentseal.codeburn-menubar, seemac/Scripts/package-app.sh); there is nocom.codeburn.*bundle id anywhere in the codebase, soorg.agentseal.*is the actual house convention.productName: "CodeBurn".files: onlydist/electron/**/*,dist/renderer/**/*, andpackage.json. The Electron main process has no npm runtime dependencies (only Node/Electron builtins — seeapp/electron/cli.tsandapp/electron/quota/*.ts), and the renderer is a single Vite bundle, so the app's ownnode_modulesdoes not need to ship at all. (The bundled CLI has its ownnode_modules, added toResources/cli/by theafterPackhook — see "The bundled CLI" above.)afterPack: "./scripts/after-pack.cjs"— copies the staged CLI bundle (app/build/cli) intoContents/Resources/cliafter packaging and before signing.mac.identity: "-"— forces ad-hoc signing by default.identity: nulldoes NOT ad-hoc sign — it skips signing entirely, which produces a bundle with a broken/absent seal (codesign --verify --deep --strictfails withcode has no resources but signature indicates they must be present, and Apple Silicon refuses to run it at all)."-"is the same ad-hoc identitymac/Scripts/package-app.shfalls back to for the menubar app's local/CI builds. This is the local/dev default; signed release builds pass the real Developer ID identity as a CLI override instead of changing this file (see "macOS code signing and notarization" below) — worth baking intobuild.macdirectly so a release can't accidentally ship ad-hoc.mac.hardenedRuntime: false— matches the ad-hoc default above (hardened runtime needs a Developer ID signature). Signed release builds turn this on via the same CLI override.mac.gatekeeperAssess: false— skips electron-builder's post-signspctlcheck, which always fails for an ad-hoc/unnotarized build. A signed, notarized release build passes Gatekeeper's real check regardless of this setting.icon: build/icon.png— a pre-existing 1024x1024 PNG atapp/build/icon.png. No.icnsexists in the repo; electron-builder generates one from the PNG at build time. This is the same source PNG used for the app icon; the menubar app has its own separate icon (assets/menubar-logo.png, converted to.icnsinpackage-app.sh).directories.output: "release"— electron-builder's default output dir isdist, which collides with this app's existingtsc/vitebuild output (app/dist/electron,app/dist/renderer) thatfilesreads from. Using a separaterelease/directory keeps build inputs and packaging outputs apart.
Windows and Linux builds
Developers can cross-build both locally from the same macOS host used for the
mac build — no Windows or Linux machine, and no wine, is required.
Release-authoritative Windows NSIS installers are instead built by the Build Windows installer workflow on windows-latest. electron-builder 26 embeds the
Windows executable's icon/version resources natively and downloads the NSIS and
AppImage tooling on first run.
Windows (package:win)
electron-builder --win produces a single installer in app/release/:
CodeBurn-Setup-0.9.15.exe— the NSIS installer (the version number trackspackage.json). A.exe.blockmapis written alongside it (differential-update metadata, unused — no auto-updater yet).
Config (build.win + build.nsis):
win.target: nsis,arch: x64.win.icon: build/icon.png— electron-builder converts the 1024x1024 PNG to a multi-resolution.icoat build time (same source PNG as the mac icon).win.extraResources: build/menubar -> menubar: the staged tray app (see "The bundled tray app and Capacity Dock" above). Nonode_modulesis involved, so unlike the CLI this one can useextraResources.nsis.include: build/installer.nsh: the uninstall macro that removes the tray app only when the marker says the desktop app installed it.nsis.oneClick: false— an assisted installer with a wizard, so users get an install-directory choice instead of a silent one-click install.nsis.perMachine: false— installs per-user (into the user'sAppData), so no administrator/UAC elevation is needed.
The build is UNSIGNED (no Authenticode certificate). electron-builder logs
signing with signtool.exe, but with no certificate configured that step is a
no-op — the .exe ships without a signature. On first run, Windows SmartScreen
shows "Windows protected your PC". Users click "More info" → "Run
anyway" to launch it. This is expected for an unsigned build; the only fix is
a purchased code-signing (Authenticode/EV) certificate.
ARM64 builds. npm --prefix app run package:win:arm64 builds the installer for ARM64
Windows. It sets ELECTRON_BUILDER_7Z_FILTER=BCJ, and that is not optional: 7-Zip
compresses ARM64 executables with its ARM64 branch filter by default, the 7-Zip decoder
inside the NSIS installer predates that filter, and the installer then silently drops
every .exe and .dll while the data files land, leaving an install with no program in it.
The x64 build is unaffected because its default filter is one the decoder knows. The
per-architecture archives inside a universal installer get the same treatment, so an
installer built with both --x64 and --arm64 needs the variable too.
The ARM64 installer carries the x64 tray app. package:win:arm64 runs the same
npm run stage-menubar as package:win, and there is no ARM64 tray app for it to stage:
tauri buildbuilds for the host, so an ARM64 Windows machine producesCodeBurn Menubar_<version>_arm64_en-US.msi, andstage-menubar.mjsmatches onlyCodeBurn[ .]Menubar_<version>_x64_en-US.msi. Staging on an ARM64 host therefore fails outright withno CodeBurn.Menubar_<version>_x64_en-US.msirather than staging the arm64 bundle. Whatpackage:win:arm64actually ships is the x64 MSI, from an x64 host build or from thewindows-v*release assets passed with--from.- Teaching the staging script the arm64 name would not help on its own. The CLI is what runs
the install, and
src/menubar-installer.tsaccepts only the x64 name: its release-asset pattern,parseWindowsMsiVersionand the staged-install path all require_x64_en-US.msi, and a file named anything else is rejected before msiexec sees it. An ARM64 tray app would need a matching change there and in the tray's own updater, which is a larger piece of work than the packaging script. - What it means in practice: on ARM64 Windows the desktop app installs the x64 tray app, and Windows runs it under x64 emulation. It works, and it is slower and heavier than a native build would be. Nothing misreports its architecture, because the tray app's version and the uninstall-registry entry are both the x64 MSI's own.
build-windows-installer.yml builds package:win on windows-latest only, so no released
artifact is affected: package:win:arm64 is a local build today.
Distribution policy. The Microsoft Store build (Store ID 9P0R4ZL5XMB8) is
the recommended Windows install. This NSIS setup .exe and the tray .msi
under the windows-v* releases are a developer preview: unsigned, SmartScreen
warns on first run, and neither route updates itself. The tray app still
reports that a newer version exists and points at the GitHub release; taking it
means re-running codeburn menubar --force or downloading the build by hand.
One-click updating comes back once an Authenticode certificate signs the
artifacts.
Microsoft Store (package:store)
The Store build is a separate AppX target so the GitHub NSIS installer remains
unchanged. AppX packaging requires Windows 10 or newer and is built by the
manual Build Windows Store package GitHub Actions workflow on
windows-latest. Download its CodeBurn-Microsoft-Store workflow artifact and
upload the contained CodeBurn-Store-<version>-x64.appx file in Partner Center.
The manifest identity must exactly match the reserved Partner Center product:
- Identity name:
Codeburn.CodeBurn - Publisher:
CN=3EFA3336-87E1-46F2-9DFA-2EB5A7693F89 - Publisher display name:
Codeburn - Store ID:
9P0R4ZL5XMB8
The Store package is intentionally unsigned: Microsoft signs it during Store
submission. Direct sideloading requires a separate trusted or development
certificate. The AppX declares runFullTrust (electron-builder's required
default for Electron apps), so CodeBurn retains access to the user's local
provider session files rather than running in a UWP application sandbox.
The tray app ships inside this package too (app\resources\menubar\), with a
windows.startupTask extension for launch at login. msiexec is never run on
this route. See "The Store route" above.
Linux (package:linux)
electron-builder --linux produces a single artifact in app/release/:
CodeBurn-0.9.15.AppImage— a self-contained AppImage (no install step, no package manager).
Config (build.linux):
linux.target: AppImage,arch: x64.linux.category: "Development"— the freedesktop menu category.linux.icon: build/icon.png— reuses the same source PNG.linux.maintainer: "AgentSeal <hello@agentseal.org>"— matches the rootpackage.jsonauthor.linux.executableName: "codeburn"— the binary name inside the AppImage (lowercase, no spaces), distinct from theCodeBurnproduct name.
After downloading, the AppImage must be made executable before it will run:
chmod +x CodeBurn-0.9.15.AppImage
./CodeBurn-0.9.15.AppImage
The build logs one benign warning — desktopName is not set — which only
affects how some desktop environments group the app's windows in the
taskbar/dock; it does not affect packaging or launch.
Releases
When a maintainer cuts a desktop release, the GitHub tag convention is:
desktop-v<version> # e.g. desktop-v0.9.15
This mirrors the menubar's mac-v<version> convention (see ../RELEASING.md)
and keeps the desktop app's tags in their own namespace, separate from the CLI
(v<version>) and the menubar (mac-v<version>).
Pushing a desktop-v<version> tag runs the Build Windows installer workflow
on windows-latest. The workflow requires the tag version, root package
version, and app package version to agree, and it fails unless the build emits
exactly one CodeBurn-Setup-<version>.exe and one matching
.exe.blockmap at the top level of app/release/. It uploads those exact
top-level filenames as the CodeBurn-Windows-Installer
Actions artifact. The workflow has read-only repository permissions and does
not publish release assets automatically. Artifacts are retained for 30 days.
Before publishing the GitHub Release, the release owner must download that
workflow artifact and manually upload both Windows files along with the four
macOS .dmg/.zip files, CodeBurn-<version>.AppImage,
codeburn-desktop_<version>_amd64.deb, and
codeburn-desktop-<version>.x86_64.rpm. Confirm the live release contains
every required platform asset before announcing it. The
website's download links pin that tag in their URLs, so a release with a
missing installer is broken even when another Windows distribution channel is
available. The Windows installer uses an explicit nsis.artifactName of
CodeBurn-Setup-${version}.${ext}.
Publishing the Release triggers a read-only live-asset check. If the files are
uploaded afterward, rerun the workflow manually with release_tag set to the
existing desktop-v<version> tag and require the verification job to pass.
Verifying a build
codesign -dv --verbose=2 app/release/mac-arm64/CodeBurn.app
codesign --verify --deep --strict app/release/mac-arm64/CodeBurn.app
spctl --assess --type execute --verbose app/release/mac-arm64/CodeBurn.app
A local ad-hoc build shows Signature=adhoc; a signed release build shows
Authority=Developer ID Application: Resham Joshi (XRVP7P7F9M) and spctl
reports source=Notarized Developer ID once the notarization ticket is
stapled. Either way expect a real Identifier=org.agentseal.codeburn-desktop
and Sealed Resources present, and the deep-verify command should exit 0.
To smoke-test that the packaged renderer actually loads (the classic failure
is a white screen from a wrong loadFile path once assets are behind
app.asar), launch the built binary directly and confirm the process tree
stays up and the main process logs no did-fail-load errors:
"app/release/mac-arm64/CodeBurn.app/Contents/MacOS/CodeBurn" --user-data-dir=/tmp/codeburn-smoke
A healthy launch spawns CodeBurn, CodeBurn Helper (gpu-process),
CodeBurn Helper (utility/network), and CodeBurn Helper (Renderer)
processes and keeps running with no stderr output. main.ts's
did-fail-load handler (console.error('Renderer failed to load ...'))
prints to that same stderr if the packaged loadFile(path.join(__dirname, '..', 'renderer', 'index.html')) path is ever wrong.
macOS code signing and notarization
Release macOS builds — the desktop .dmg/.zip files and the
CodeBurnMenubar-<version>.zip menubar app — are signed with the Developer
ID Application certificate "Developer ID Application: Resham Joshi
(XRVP7P7F9M)" (team XRVP7P7F9M), built with hardened runtime on, and
notarized by Apple via xcrun notarytool (using the codeburn-notary
keychain profile), then stapled. spctl --assess reports
source=Notarized Developer ID, and the app opens with no Gatekeeper
warning at all — no right-click → Open, no quarantine removal, no
"unidentified developer" dialog.
Entitlements
Hardened runtime needs a handful of entitlements or Electron's JIT-compiled renderer fails to start:
com.apple.security.cs.allow-jitcom.apple.security.cs.allow-unsigned-executable-memorycom.apple.security.cs.allow-dyld-environment-variablescom.apple.security.cs.disable-library-validation
Two gotchas
- electron-builder rejects the
Developer ID Application:prefix in the identity argument. Pass the bare certificate common name —"Resham Joshi (XRVP7P7F9M)"— not the full"Developer ID Application: Resham Joshi (XRVP7P7F9M)"stringcodesignitself accepts. - electron-builder notarizes the
.app, not the.dmg. Onceelectron-builder --macfinishes signing and notarizing the app bundle, the.dmgit produces around that app still needs its own codesign + notarize + staple pass:
(repeat for thecodesign --force --sign "Resham Joshi (XRVP7P7F9M)" CodeBurn-<version>-arm64.dmg xcrun notarytool submit CodeBurn-<version>-arm64.dmg --keychain-profile codeburn-notary --wait xcrun stapler staple CodeBurn-<version>-arm64.dmgx64dmg).
Release builds vs. the committed config
app/package.json's committed build.mac still declares identity: "-"
and hardenedRuntime: false — the ad-hoc/local-dev default described in
"Build configuration" above. A signed release build passes the real
Developer ID settings as electron-builder CLI overrides instead of
changing that file:
npx electron-builder --mac \
-c.mac.identity="Resham Joshi (XRVP7P7F9M)" \
-c.mac.hardenedRuntime=true \
-c.mac.entitlements=build/entitlements.mac.plist \
-c.mac.entitlementsInherit=build/entitlements.mac.plist \
-c.mac.gatekeeperAssess=true
This works, but it is easy to forget on a manual release — baking these
settings into build.mac directly (falling back to ad-hoc only when no
Developer ID identity is present in the keychain) would remove the risk of a
release accidentally shipping unsigned.
The menubar app (mac/Scripts/package-app.sh) picks up the same identity
through its existing CODESIGN_IDENTITY environment variable — set
CODESIGN_IDENTITY="Resham Joshi (XRVP7P7F9M)" before running it — and then
needs the same notarize-and-staple pass as the dmg above, run against the
built .app before it is zipped.
Ad-hoc is still the fallback
Building locally with no Developer ID identity in the keychain (or in CI,
where none is configured) falls back to ad-hoc signing, same as before:
enough to satisfy the kernel's code-signing check on Apple Silicon, but not
Gatekeeper. A quarantined ad-hoc build still shows the "Apple could not
verify..." / "is damaged and can't be opened" dialogs, and stripping the
quarantine attribute (xattr -cr /Applications/CodeBurn.app) is still the
workaround for a build tested this way. This path is for local development
only — the distributed release builds are signed and notarized and never
hit it.
Folder-access prompts
CodeBurn requests access to folders like Documents, Desktop, and Downloads
(via mac.extendInfo in app/package.json) to read local AI coding tool
session logs. Signed release builds use the stable Developer ID identity
above, so macOS TCC treats every release build as the same app and folder
grants persist across updates. This only regresses for an ad-hoc/local-dev
build: with no stable Developer ID, TCC treats each rebuild as a new app
identity and re-prompts for folder access every time.