Commit graph

2247 commits

Author SHA1 Message Date
iamtoruk
89213cb13b menubar: one set of quota colour bands, 60/70/95, for the flame, popover and dock 2026-09-13 12:50:25 -07:00
Resham Joshi
aacd9cf675
Merge pull request #1354 from getagentseal/feat/kimi-live-sessions
feat(live-sessions): show running Kimi Code sessions in the Capacity Dock
2026-09-13 22:48:10 +03:00
Resham Joshi
a498332bcf
Merge pull request #1353 from getagentseal/fix/dock-drop-pace-caption
menubar: drop the pace caption from the Capacity Dock window cells
2026-09-13 22:48:07 +03:00
iamtoruk
a858014bf7 menubar: drop the pace caption from the popover quota rows and delete the caption builder 2026-09-13 12:39:36 -07:00
iamtoruk
66a1d30422 live-sessions: report running Kimi Code sessions
Scan the Kimi Code stores for session dirs whose agents/*/wire.jsonl was
written inside the liveness window and fold them into the menubar
liveSessions block as provider kimicode, with the project from state.cwd,
the model from the last llm.request in the main wire tail, and sub-agent
wire mtimes as the session's sub-agent activity.
2026-09-13 12:31:22 -07:00
iamtoruk
cb49cc3c2d menubar: Capacity Dock windows share one row up to three, a fourth wraps 2026-09-13 12:29:10 -07:00
iamtoruk
3cb412e388 menubar: drop the pace caption from the Capacity Dock window cells 2026-09-13 12:23:30 -07:00
Resham Joshi
68ce480ec1
Merge pull request #1350 from getagentseal/fix/pr-row-drill-through-1338
fix(app): open the sessions behind a pull request row
2026-09-13 16:57:42 +03:00
ozymandiashh
b294073cfe docs: record the pull request drill-through fix 2026-09-13 06:41:25 -07:00
ozymandiashh
6addfeb4be fix(app): key investigation chips by identity, not by their label
Chips were keyed by the string they display, which truncates a session
id to 12 characters and a project path to its last segment. Two sessions
whose ids share a prefix, or two projects with the same basename on the
same branch, produced one React key for two chips: React warned about
the duplicate and could reconcile or remove the wrong one.

filterChipKey returns the composite identity each dimension is already
normalized and removed by (provider + session id, project + branch), so
chips that read alike stay distinct to React while the display label is
left as short as it was.
2026-09-13 06:41:04 -07:00
ozymandiashh
62c7483aab fix(app): reset sessions pagination where the count is owned
The list reset its visible-row count to the first page whenever the
selection, the sort, the search or the data changed — but it wrote the
internal fallback state, and the app passes visibleCount as a controlled
prop so it can restore the depth from the nav history. The reset was
therefore dead: after Show more, changing the sort or removing a chip
left the reader 240 rows deep in a list that had just been reordered.

The owner now resets it in the same commit as the change it owns, so a
sort or selection change is one history entry rather than two, and no
reset can fire during a Back/Forward restore and discard the depth that
was just restored. The effect keeps serving the uncontrolled wiring and
says so.
2026-09-13 06:41:04 -07:00
ozymandiashh
3a70e9bcb7 fix(app): open the sessions behind a pull request row
The Pull requests section imported the PR selection builder and threaded
the drill-through callback through four component levels, but the row's
only handler was expand/collapse, so neither was ever invoked: every
other aggregate (day, model, category, project) reached the filtered
session list and the one report that names shipped work did not.

An expanded row now carries its own "View sessions for this pull request"
control above the work breakdown, matching the project entry in Spend. It
selects the PR by URL — the aggregation key of the by-PR report — and,
being a control of its own rather than the row, never toggles the
expansion it sits in. Rows with no per-turn detail get it too, and the
section renders no affordance at all when there is no destination wired.
2026-09-13 06:41:04 -07:00
Resham Joshi
c2c4844851
Merge pull request #1349 from getagentseal/fix/quota-warning-row-1343
fix(menubar): make the quota warning legible and name the window it means
2026-09-13 16:40:07 +03:00
iamtoruk
47245dda61 test(menubar): spell the 2d 3h 5m offset as one literal so Swift 6.2 can type-check it 2026-09-13 06:30:25 -07:00
ozymandiashh
8222c734d9 fix(menubar): make the quota warning legible and name the window it means
The popover's quota warning painted its text in the same system yellow,
orange or red as its 12% pill. In light mode that measured 1.23:1 to 1.43:1
for yellow and at best 3.04:1 for red, and dark-mode red fell to 3.33:1. The
pill keeps its hue; the text and its glyph now take a per-appearance
foreground from QuotaWarningPalette that measures at least 5.29:1, and a test
holds every severity at WCAG AA against the pill composited over both ends of
the popover's background in both appearances.

The sentence named no window. AggregateQuotaStatus reduced each provider to
its worst window and kept only the percentage, so "Claude 70% of quota used"
was the 5-hour limit read next to a weekly 34%, and looked wrong. Each warning
now carries the winning window's label and reset, and the row reads
"Claude · 5-hour 71% · resets in 3h 12m" with the Capacity Dock's countdown,
one line per provider. The countdown is left off when there is no reset time
or it has passed, and "over limit" is kept for a window at or past 100%
instead of everything the danger band (90% and up) covers. The windows
compared, the 70% threshold and the flame's severity are unchanged.

"%@ of quota used" has no caller left and is retired; "resets in %@" is added
for en and zh-Hans.
2026-09-13 06:29:21 -07:00
Resham Joshi
9b1f44647d
Merge pull request #1342 from ozymandiashh/fix/1334-opencode-usage-mismatch
fix(opencode): bill session-level reasoning tokens at the output rate
2026-09-13 16:27:42 +03:00
Resham Joshi
9fdfb4be56
Merge pull request #1348 from getagentseal/docs/open-source-badge-dark-fix
Some checks are pending
CI / semgrep (push) Waiting to run
macOS Menubar CI / test (push) Waiting to run
Tests / test (22) (push) Waiting to run
Tests / test (22.13.0) (push) Waiting to run
Tests / test (24) (push) Waiting to run
Tests / test (26) (push) Waiting to run
Tests / test-platforms (macos-latest) (push) Waiting to run
Tests / test-platforms (windows-latest) (push) Waiting to run
Tests / desktop (push) Waiting to run
docs(readme): fix the open-source badge edges on dark backgrounds
2026-09-13 14:43:39 +03:00
AgentSeal
4279f16038 docs(readme): fix the open-source badge edges on dark backgrounds 2026-09-13 14:40:04 +03:00
AgentSeal
38aa4464ac docs(readme): refresh the Codex and Claude open-source-recipient badge 2026-09-13 14:21:41 +03:00
Resham Joshi
b2c66c30d2
Merge pull request #1344 from ozymandiashh/fix/cache-read-test-midnight
test(cli): keep fresh cache-read seeds inside the current UTC day
2026-09-13 09:22:42 +03:00
Resham Joshi
498dcde6c7
Merge pull request #1345 from ozymandiashh/fix/serveconnection-test-flake
test(menubar): make ServeConnection cancellation tests deterministic under load
2026-09-13 09:14:04 +03:00
Resham Joshi
fd8f05cdd9
Merge pull request #1337 from ozymandiashh/fix/1325-1321-redact-payload-identities
fix(mcp,sharing): redact project keys, session ids and branch names in the payload
2026-09-13 08:52:17 +03:00
ozymandiashh
714e1b3a70 test(menubar): make ServeConnection cancellation tests deterministic under load
Three ServeConnectionTests failed on roughly half of all macOS Menubar CI
runs and always passed on re-run. Each one raced a real clock or a real
child process against Swift-side work. A cooperative pool starved by
CPU-heavy suites that swift-testing schedules alongside can delay that work
by seconds.

- "cancelling a hung request returns promptly" asserted a 500 ms wall-clock
  budget, and its fixture child exited after `sleep 1`. When the cancellation
  hop was starved past those exits, the connection retried the request on
  replacement children until the death budget answered ServeUnavailable. The
  timeout path never fired, because the test used the real ten-minute budget.
  The child now stays alive, the timeout comes from the manual clock, and the
  test asserts that the caller sees CancellationError before any timeout fires.
- "a request queued during cancelled hydration completes on the same child"
  read the child's event log as soon as the reply resumed the caller, but the
  child appends "second-replied" only after writing that reply. The test now
  waits for the log line. The manual clock also replaces its timeout recorder,
  which really fired after 5 s.
- "external cancellations keep one child and safely discard late replies" let
  the fixture reply 50 ms after reading, so a delayed cancel lost to the reply.
  The child now holds each reply until the test has observed the cancellation.

Polling is bounded by a 30 s hang guard instead of 2 s. When a guarded await
expires, the guard releases the fixture, so a regression fails its assertions
instead of hanging the run. No production code changes.

Closes #1333
2026-09-13 06:52:39 +03:00
ozymandiashh
5b7686b462 test(cli): keep fresh cache-read seeds inside the current UTC day
cli-cache-read-pipeline seeded its fresh Claude turn at now-10m and now-9m
while computing "today" from the UTC clock. For the first ten minutes after
UTC midnight those timestamps land on the previous day, so the fresh slice
falls outside `--days ...,today` and `--period today`: 1811 becomes 1111 and
4321 becomes 0. A PR run that started at 2026-09-13T00:03Z failed on every
leg while main's 23:32Z run passed on the same code.

Derive every date and timestamp from one `now` and clamp both seeds into
[today's UTC midnight, now], preserving user-before-assistant order, the
same idiom cli-status-menubar already uses. The CLI subprocess has no
injectable clock, so a run that crosses midnight after seeding now skips
with a note instead of failing.

menubar-project-identity had the same bug with a one-minute window (now-1m
against getDateRange('today')); clamp it the same way.

Refs #1216
2026-09-13 06:04:04 +03:00
ozymandiashh
27f46fd73d docs: record the OpenCode reasoning fallback fix 2026-09-13 03:00:37 +03:00
ozymandiashh
4b4fba521a fix(opencode): bill session-level reasoning tokens at the output rate
When none of a session's messages produce a priced call, the SQLite
parser falls back to the totals on OpenCode's session row. That path
passed tokens_output alone to calculateCost and dropped
tokens_reasoning, while still reporting reasoningTokens, so thinking
tokens were shown but never charged. OpenCode bills reasoning at the
output rate and the per-message path already did the same.

Route both the fallback and buildAssistantCall through
billableOutputTokens so they share one rule with the cache-rehydration
path. The per-message change is behaviour-neutral for opencode and
kilo-code; it only removes the hand-rolled sum that let the fallback
drift.

Refs #1334
2026-09-13 03:00:37 +03:00
Resham Joshi
5498818095
Merge pull request #1330 from getagentseal/feat/menubar-i18n
Some checks are pending
CI / semgrep (push) Waiting to run
macOS Menubar CI / test (push) Waiting to run
Tests / test (22) (push) Waiting to run
Tests / test (22.13.0) (push) Waiting to run
Tests / test (24) (push) Waiting to run
Tests / test (26) (push) Waiting to run
Tests / test-platforms (macos-latest) (push) Waiting to run
Tests / test-platforms (windows-latest) (push) Waiting to run
Tests / desktop (push) Waiting to run
feat(menubar): localize the macOS menubar app, ship Simplified Chinese
2026-09-13 02:32:16 +03:00
iamtoruk
f15beceda1 docs(changelog): 628 keys, the picker, and the English date changes 2026-09-12 16:12:12 -07:00
iamtoruk
d4f3d6eb7a feat(menubar): translate the Codex banked-reset copy and the cache-read tooltip
The notification, the Plan-tab detail and the hover-card line #725 added were
composed in a presentation type and shipped English to a zh-Hans user. Each is
one key now. reset_type is vendor data with no fixed vocabulary, so the four
cadence words OpenAI sends are translated and anything else rides through
verbatim inside a translated frame. compactAge stays character-identical with
the TypeScript side in English, which is what the contract was about: en is an
identity table. The dock's cache-read tooltip was bound to a let before its
call site, which is why the scan never saw it.
2026-09-12 16:12:11 -07:00
iamtoruk
e53dca1350 feat(menubar): translate the early-reset notification, band and history
Every sentence #725 added is now one key with placeholders. The window label
keeps its English form in the persisted event and is translated at render
through a lookup on that form, because "weekly limit" -> "weekly" is a suffix
rule only English obeys; a label outside the known set reads through as before.
The 697 existing early-reset expectations pass untouched.
2026-09-12 16:12:11 -07:00
iamtoruk
008aa1ba11 feat(menubar): translate the Capacity Dock pace captions
Every caption and help sentence #1267 added rendered English in a zh-Hans
build: they are composed in a presentation type, not at a view call site, so
neither the catalog diff nor the source scan could see them. Each sentence is
now one key with placeholders. The two stage captions reuse the Plan tab's
existing keys, and the countdown reuses the popover's. English output is
unchanged: the 329 existing pace expectations pass untouched.
2026-09-12 16:12:11 -07:00
iamtoruk
d9b6d1ed77 test(menubar): let the scanner see tooltips and notification titles
.toolTip = and post(title:) are both user-facing and both were invisible to
the scan. Nothing on main is newly flagged.
2026-09-12 16:12:11 -07:00
iamtoruk
b94338a75c feat(menubar): add a language picker to Settings
Settings > General > Language offers System, English and 简体中文. It writes
AppleLanguages into the app's own preferences domain, the same key System
Settings > Language & Region > Applications writes, so the two surfaces are one
setting. The current value is read back from that domain rather than through
UserDefaults.standard, which falls through to the global domain and would
report the system language as CodeBurn's own override: System could then never
show as selected. An inline row offers the relaunch that applies it.
2026-09-12 16:12:11 -07:00
iamtoruk
20f151faa4 fix(menubar): budget the second row by the width it draws
The 24-unit budget was a Character count, so "GitHub Copilot 剩余 12% · 6 小时
2 分" fitted it at 24 Characters while drawing 31 cells: a third wider than
the first row it is not allowed to exceed. abbreviate now measures East Asian
wide and fullwidth scalars as two. All-Latin rows are unchanged.
2026-09-12 16:12:11 -07:00
iamtoruk
82b02faa4f fix(menubar): keep the English weekday row two letters wide
veryShortWeekdaySymbols gives en "M T W T F S S": two ambiguous pairs, and
two duplicate ForEach ids. shortWeekdaySymbols clipped to two units keeps
"Mo Tu We" in English and reads 周一 周二 in zh-Hans, 19.9pt in a 30pt cell.
2026-09-12 16:12:11 -07:00
iamtoruk
f995593f2a fix(menubar): carry the localization catalog onto current main
Rebase resolution for #1289 onto main (#1306, #1313, #1314, #1315, #1328,
#1329). Conflicts kept both intents: main's second-row title composition,
glance-window accessibility actions, cache-read line, host field and merged
Notifications section keep their behaviour and now resolve through L(…).

Adds 14 keys to both tables, drops 4 that no longer have a call site, and
retranslates the two Copilot explanations main rewrote.
2026-09-12 16:12:11 -07:00
ozymandiashh
d8f39cc2db fix(sharing): drop per-branch rows from the shared payload
sanitizeForSharing spread current and emptied only topProjects and
topSessions, so the per-branch rows added with the payload block went out
verbatim: a branch such as exp/extraction-arms reached a peer device as
typed. Branch names encode ticket ids, customer names and feature
codenames, so they get what project and session rows get and leave the
payload entirely. Pseudonymizing was the alternative, but a branch-a1b2c3
row means nothing on another device's dashboard, and no shared surface
reads the block today.

Refs #1321, #1325
2026-09-13 01:42:28 +03:00
ozymandiashh
e04ff869b4 fix(mcp): pseudonymize project keys, session ids and branch names
redactProjectNames rebuilt every row with a spread and replaced only the
fields it knew about, so identities added to the payload later rode
through untouched with include_project_names: false:

- topSessions[].projectKey, the raw sessions-list row key, is a
  dash-encoded absolute working directory (-Users-<user>-Projects-<repo>).
  Hash it with the project pseudonym, the way topProjects[].id already is.
- topSessions[].sessionId and topProjects[].sessionDetails[].sessionId are
  the drill-through identity; a Codex id also carries the rollout
  timestamp this pass blanks out of `date`. Hash them as session-xxxxxx.
  provider stays: it is claude/codex, not identity.
- byBranch[].branch is the raw git branch, which encodes ticket ids,
  customer names and feature codenames. Give each distinct branch a
  stable branch-xxxxxx pseudonym and keep the row's numbers. A null
  branch stays null: that is unbranched spend, not a name.

The new pseudonyms are domain-separated inside the digest so a branch and
a project of the same name do not share a hash; the project pseudonym
itself is unchanged. redactSessionDetails now takes its type from the
payload instead of a hand-copied inline type that had drifted from it,
which is why the leak type-checked. include_project_names: true is
unchanged.

Refs #1325, #1321
2026-09-13 01:42:28 +03:00
ozymandiashh
480ab73b95 test(menubar): fail the build when a string never reaches the catalog
LocalizationCatalogTests diffs en against zh-Hans. That catches a key
translated in one locale and not the other, but it is blind to the failure
that actually happens: a feature ships a bare `Text("Second row")`, the
literal never becomes a key, both tables stay in perfect agreement, and a
zh-Hans build renders English. #1252 and #1243 landed exactly that way, which
is why the previous commit exists at all.

So this suite reads mac/Sources instead of the tables, in three passes that
cover each other:

1. Call sites. The SwiftUI and AppKit surfaces that put a string on screen —
   Text/Button/Toggle/Picker/…, the accessibility modifiers, NSMenuItem,
   NSAlert and window titles — must be handed `L(…)`, not a literal.
2. Display-label properties. `displayName`/`displayLabel`/`settingsLabel` are
   how this codebase names an enum for a picker, and they are not call sites,
   so a new metric case with a bare literal would slip past pass 1.
3. Catalog round-trip. Every key a view asks for has an entry in both
   locales, and every entry has a call site — so a key added to the code but
   not the table, or left behind after a rewording, fails too.

Scoped to avoid false positives rather than by suppressing findings:

- A literal is exempt when, with `\(…)` segments removed, nothing is left but
  figures, symbols, or words in a three-entry vocabulary (`CodeBurn`, `tok`,
  `USD`). That covers `Text("$25")`, `Text("\(count)")` and `Text("— ")`
  without naming a single file, so the exemption cannot go stale.
- Pass 2 only looks at bracket-depth zero, which is what separates the
  property's result (`case .pro: "Pro"`) from machinery it calls
  (`Locale(identifier: "en_US")`).
- The two denylists are documented with reasons and keyed to the declaring
  type, so `PlanType.displayName` being exempt does not exempt every
  `displayName` in the app.

Comments are stripped first, or Localization.swift's own documentation of
`Text("literal")` would read as a violation; strings win over comment markers
so a URL in a literal does not swallow the rest of the file.

The scanner lives in its own file with no `import Testing` so the standalone
swiftc harness can exercise the shipped code rather than a copy of it —
`swift test` cannot run on this host, and a reimplementation would drift.

Mutation-checked: un-routing `Toggle(L("Second row"))` fails pass 1,
un-routing `MenubarSecondRowMetric.settingsLabel` fails pass 2, and dropping
`L("Show %@ usage")` fails pass 3. Writing it also turned up two real bugs in
the scan (`Label(` matching inside `.accessibilityLabel(`, and a nested
`enum PlanType` reporting its outer type), both now covered by a test.

Closes #1289
2026-09-12 15:22:47 -07:00
ozymandiashh
e8ae6cb9c4 feat(menubar): translate the strings the two new menubar features added
and #1286's Copilot host fix all shipped user-facing copy that bypasses the
catalog — neither of the first two PRs' diffs contains a single `L(` call. In a
zh-Hans build those strings render in English.

Sweeping mac/Sources the way the original extraction did brings 18 new keys,
and retires 2 that main reworded (the Copilot help paragraph gained the
GitHub Enterprise Cloud host rule; the connection detail now names the host
that answered rather than hardcoding api.github.com). 533 keys become 551.

Routed here:

- Second row: the Settings toggle, the metric picker and its four option
  names, the help paragraph, and the row text itself — today's cost, today's
  tokens, and the quota row with and without a provider label. The reset
  countdown reuses the popover's own `%lldd %lldh` / `%lldh %lldm` / `%lldm`
  keys rather than minting a second set, so the two countdowns cannot
  disagree in a translated build.
- Capacity Dock glance: the switch hint and the named VoiceOver action.
- Copilot: the reworded help paragraph and the host-aware connection detail.

Kept verbatim, per the rules in the catalog header: provider, model and plan
names; `tok`; the `%.2f` amount and its currency symbol; and the window label
the gauge reports, which is provider data and doubles as the matching needle
in CapacityDockGlanceWindow — translating the generic fallback alone would
make one VoiceOver sentence half-Chinese depending on the provider selected.

Also localizes CodexUsage's credit-limit labels. Those are not new, they were
missed by the original extraction and the guard test in the next commit finds
them; leaving them would mean shipping a test that fails on main.

Verified with a standalone swiftc harness over both tables (`swift test`
cannot run on this host): key parity, no blank values, en identity, and
argument/literal-percent specifier parity, plus the new rows formatting
correctly in both locales.
2026-09-12 15:22:47 -07:00
ozymandiashh
a03cc5ff3f test(menubar): assert the en and zh-Hans catalogs cannot drift apart
A translation catalog rots in ways the compiler cannot see: a key added to a
view but not to zh-Hans shows English in a Chinese UI, a dropped key shows a
raw identifier, and a format specifier that disagrees between the tables is a
wrong number or a crash inside String(format:).

LocalizationCatalogTests reads both tables out of the resource bundle, the same
files L(_:) resolves at runtime, and asserts: the key sets are equal in both
directions; no value is blank; en repeats its key verbatim, which is what makes
the English fallback correct; argument specifiers match in count and order,
because String(format:) binds them positionally; literal `%%` counts match,
while allowing `%%` to move where Chinese word order demands it; no key is only
specifiers, which would leave a translator nothing to work with; and the shipped
localizations agree with L10n.supportedLocalizations, so Package.swift, the two
packaging scripts' CFBundleLocalizations and the Swift constant cannot drift.

Four cases then resolve representative presentation strings in both locales and
check that the English one equals what the presentation struct returns, which is
the link proving the struct reads the catalog rather than a stale hardcoded
string, and that a substituted product name survives translation.

The specifier test caught one bad key while being written: the Capacity Dock
connect button's accessibility label was `L("%@ %@", title, providerName)`,
which has no translatable content at all. It is plain interpolation now, and
both halves were already localized on their own.

CHANGELOG and mac/README document the user-visible part: the language follows
the system, overridable per app in System Settings, plus what adding a third
language requires.

Closes #1219
2026-09-12 15:22:03 -07:00
ozymandiashh
9eebfda627 feat(menubar): add Simplified Chinese (zh-Hans) localization
All 533 catalog keys translated into zh-Hans, so the menubar app now follows
the system language with no setting to find and no third-party library. AppKit
picks the table: `CFBundleLocalizations` in both packaging scripts advertises
`en` and `zh-Hans`, which is also what puts the app under System Settings >
Language & Region so a user can override the language for CodeBurn alone.

Wording follows macOS system apps rather than a literal gloss: 立即刷新,
断开连接, 存储并连接, 载入配额, 再试一次. Product nouns stay as users
already know them: provider, model and plan names (Claude, Codex, Gemini,
Opus, Sonnet, Antigravity), Token, Dock, API, OAuth, shell commands and file
paths, currency codes.

Format specifiers are identical to the English entry in count and argument
order. `%%` is a literal percent sign and not an argument, so it may move where
Chinese word order demands it ("%@ · %@ 达到 100%%"); the argument-consuming
specifiers may not, because String(format:) binds them positionally. The next
commit's test enforces exactly that distinction.

Numbers, dates and currency are untouched: they already went through
NumberFormatter / DateFormatter / asCurrency(), and `L(_:_:)` only substitutes
values those produced.
2026-09-12 15:21:49 -07:00
ozymandiashh
d62857ea4e feat(menubar): route every user-facing string through a strings catalog
Groundwork for #1219. The menubar app hardcoded ~530 English strings across
Views/, the presentation structs, the status-item menu and the update alerts,
so there was nothing for a translator to translate.

Every user-facing literal now goes through `L(_:)` / `L(_:_:)`, which look the
string up in `Localizable.strings` in the SwiftPM target resource bundle. The
key *is* the English copy, so English stays the development language and a
missing translation degrades to correct English instead of a dotted
identifier. `en.lproj` is therefore an identity table; it exists so the bundle
advertises `en` and so a translation can be diffed against it.

Why the lookups are explicit rather than relying on SwiftUI's implicit
`LocalizedStringKey`: SwiftPM emits target resources into a sibling bundle
(`CodeBurnMenubar_CodeBurnMenubar.bundle`) that the packaging scripts copy into
`Contents/Resources`. `Bundle.main` has no `.lproj` at all, so `Text("literal")`
would always miss. Naming `Bundle.module` is the one form that resolves the
same way in `swift run`, in `swift test` and in the packaged `.app`.

Enum raw values that double as identity (`Period`, `MenubarScope`,
`InsightMode`, `AccentPreset`, `ProviderFilter`) keep their raw value and gain
a `displayLabel`, so persistence and cache keys are untouched by translation.

Three display-only date formatters that were pinned to `en_US_POSIX` with fixed
patterns now use `setLocalizedDateFormatFromTemplate`, and the calendar
popover's weekday row comes from the locale's own symbols. The `yyyy-MM-dd`
formatter stays POSIX: it parses and builds data keys, not display text.

Not extracted, deliberately: provider, model and plan names; units; currency
codes; shell commands and paths; quota window labels that policy code matches
on by English substring (`QuotaSummary.headlineWindow`); and anything the
`codeburn` CLI produces.

Also copies the SwiftPM resource bundle into the app in build-local.sh, using
the named-bundle + `[[ -d ]]` pattern package-app.sh already uses. Without it
the assembled app finds no strings table (and already trapped on first icon
load, the resource-bundle half of #1262).
2026-09-12 15:21:49 -07:00
Resham Joshi
5110eb8337
Merge pull request #1329 from getagentseal/feat/early-quota-reset
menubar: detect early quota resets and say so
2026-09-13 01:09:26 +03:00
Resham Joshi
66ea03e46b
Merge pull request #1328 from getagentseal/feat/codex-banked-resets
feat(codex): notify when OpenAI banks a limit reset, and show it everywhere quota is shown
2026-09-13 01:01:53 +03:00
iamtoruk
138ef34280 fix(mac): fold the three notification switches into one section
Updates, Codex banked resets and early quota resets each had their own
one-toggle Section in General. Three sibling headers for three checkboxes
is not an information architecture. One Notifications section, three
toggles, each keeping its own help text and defaults key.

Also assert the early-reset notification identifier does not carry
UpdateChecker's prefix, so the delegate's tap guard cannot install an
update from it.
2026-09-12 14:59:58 -07:00
iamtoruk
cbcd984929 fix(mac): say what a usage-drop early reset actually did
Both early-reset signals shared one sentence, so a window whose counter
the vendor emptied mid-cycle was announced as "reset 18h early" even
though its reset time had not moved and the cycle still ended when it
always would have. Replaying this Mac's own 30 days of snapshots through
the monitor produces exactly that: on 2026-09-01 the weekly counter went
81% to 0% with resets_at still at 2026-09-04T07:00:00Z, and the copy
promised a new window that was not coming.

usageDropped now gets its own title, body, band and help text; the
reset-moved-forward wording is unchanged. lead() rounds to the unit it
prints instead of truncating, so a 1h57m lead reads "2h", not "1h".

Tests pin both, assert a usage-drop event never says "reset early", and
pin the notice expiry and the cycle anchor tolerance by value rather
than by reading the constants back.
2026-09-12 14:58:42 -07:00
ozymandiashh
152e63cf37 test(mac): compare early-reset leads as Double, not Int
swift-testing's `#expect` captures each operand separately, so the literal
`18 * 3600` on the right of a `TimeInterval` comparison was typed as Int
and the equality never resolved as Double == Double. CI reported
`(event?.earlyBySeconds → 64800.0) == (18 * 3600 → 64800)` as a failure
while the two numbers plainly agree. A bare literal in the same position
(`percentBefore == 80`) is inferred as Double and passed, which is why
only the two compound expressions failed.

The lead is now one explicitly typed `TimeInterval` constant, the event is
unwrapped with `#require` so a nil event fails with a clear message rather
than a silently false comparison, and the percent expectations are spelled
as Double literals. The rest of the file was swept for the same shape: the
remaining equalities are Int counts, CGFloat, enums, strings, or already
explicitly typed TimeIntervals.

The standalone swiftc harness could not have caught this — plain Swift
infers the same literal as Double, and the harness does not reproduce the
macro's per-operand capture. It now forces the comparison through a
TimeInterval parameter, which at least pins the type.
2026-09-12 14:58:42 -07:00
ozymandiashh
baf6f9fa39 docs: record early quota reset detection
The Capacity Dock design doc gains the band, the switch and the two new
code boundaries; the Claude provider doc explains what the detection
reads, how the local history is derived from stored reset times, and why
it stays quiet, so the next person changing the snapshot store knows what
depends on it.

Refs #725, rather than Closes: that issue is a five-part epic and this is
one slice of its surfaces, so it should not close on this PR. No issue
tracks early-reset detection on its own.
2026-09-12 14:58:42 -07:00
ozymandiashh
55e4bc643e feat(mac): tell the user when a quota reset came early
Detection rides the refresh lifecycle that already runs: it happens where
each successful Claude fetch is captured into the snapshot store, before
the store is written, so it costs no request. Issue #725 names "no new
network polling loops" a hard non-goal, and this adds none.

Three surfaces, because the user can be looking at any of them. A system
notification names the provider, the window and the lead. The Capacity
Dock carries a band saying the same for twelve hours after the reset was
seen, drawn and reserved exactly like the staleness notice, because the
panel's frame is computed rather than fitted. The quota hover card gains
this Mac's own pattern next to the pace captions.

The state before the fetch decides whether the stored baseline can be
compared against it: a provider coming back from a terminal failure, a
fresh bootstrap or no credentials has a baseline from the far side of a
gap, where stale state looks like a jump. A window the API did not report
this time is passed as absent rather than omitted, so a window that comes
and goes is never read as a reset. Disconnect drops the baseline along
with the snapshots, so a reconnect under another account starts clean.

The Settings switch is on by default, and turning it off withholds only
the notification — the dock band still appears, since it is a caption on
data the user is already looking at rather than an interruption.
2026-09-12 14:58:42 -07:00