Repository navigation
Show cache-read usage and quota pace in Capacity Dock - #1267
Conversation
Main took render revision 6 for `sessionCountBasis` and changed the provider-slice session fold from a sum to a per-day max. Both had to survive the merge, so the resolutions are unions rather than sides: - `addProviderSlice` keeps main's `Math.max` for `sessions` (per-day ticks are not distinct identities) and adds the cache-read sum beside it, with a comment saying why one is additive and the other is not. - `ProviderSliceTotal`, `ProviderCost`, `providerDetails` and the Swift `ProviderDetail` carry both `sessionCountBasis` and `cacheReadTokens`. - The snapshot revision stays 7, which is still the next free number above main's 6. Its doc comment said v6 was PR1265's per-model counts; it is main's `sessionCountBasis`, so the comment now says that. The status-menubar suite hard-codes render revisions. Main's assertion that a rejected v5 snapshot is rewritten as `:render-6:` auto-merged cleanly while this branch moved the current revision to 7, which would have failed silently on the next bump too. Those assertions now derive the tag from `STATUS_SNAPSHOT_RENDER_VERSION`, so the current and previous revisions follow the constant; the deliberately historical `:render-5:` and `:render-2:` plants stay literal.
Ports the two parts of getagentseal#1287 the maintainer asked to keep, expressed through this branch's `QuotaPacePresentation` rather than through `QuotaPace.Verdict`: - Placement: `QuotaDetailRow` in the agent-tab quota hover card becomes a VStack and draws the pace line under the bar, indented past the label column, with the three tones the dock already uses. The card is fitted, so a silent caption collapses there instead of reserving a slot the way the dock's computed frame must. - Wording: the long-window caption drops "est. N% at reset" / "est. out in X" for the plain "Lasts until reset" / "Runs out in X", and the exhausted state becomes "Limit reached". The projected percentage it came from stays in the hover text, which has room for the reasoning. Short windows keep the on-pace / deficit / reserve stage (getagentseal#726), and the freshness, connection and duration gates are untouched. `QuotaPace.inferredWindowSeconds(label:)` is deliberately NOT ported. Grok Build chooses its window label from the distance to the reset, so a monthly cycle passing through the 4-12 day band is labeled "Weekly" and a label round trip paces a month's budget against seven days. The adapter's real `windowSeconds` is the only source here, and a new test pins that shape: 72% used with six days to a monthly reset reads "Lasts until reset", while the same sample against an inferred 7-day window overflows and would have printed "Runs out in 9h 20m". The same test asserts a window with no duration metadata stays silent rather than falling back to its label. Verified with a standalone swiftc harness over QuotaPace, QuotaPacePresentation and QuotaSummary: this host has Command Line Tools only, so `swift test` cannot load the Testing module. Closes getagentseal#1267
getagentseal#1267 lands first, so rebuild this branch on top of it rather than on origin/main. The remaining diff is then only this branch's own contribution: per-model input/output/cache-read counts in the desktop Overview and the macOS menubar Models rows. Conflict resolutions: * src/status-snapshot-semantic.ts — this branch bumped the snapshot render revision from 5 to 6, but main had already taken 6 for sessionCountBasis and getagentseal#1267 has taken 7 for per-provider cacheReadTokens. Move to 8, and bump the single shared constant getagentseal#1267 extracted instead of making a third inline edit in src/main.ts. A revision must be distinct from every other branch's or a snapshot written elsewhere would be accepted here while lacking this change's fields. * src/main.ts — take getagentseal#1267's side: the revision and semantic key now come from statusSnapshotSemanticKey() rather than local constants. * src/usage-aggregator.ts — import-only conflicts, superset of both sides. addProviderSlice keeps main's Math.max session folding and getagentseal#1267's summed cacheReadTokens; neither is reverted. * tests/cli-status-menubar.test.ts — both branches appended a test at the same insertion point and git interleaved them. Reassembled so both blocks survive intact. This branch's own snapshot-invalidation test planted a literal :render-5:. Against a tree that already ships 7, that plant proves nothing — main alone rejects it, so the case passed without this change. Plant the immediately previous revision via getagentseal#1267's derived PREVIOUS_RENDER_TAG instead, and assert the rewritten record carries CURRENT_RENDER_TAG. The deliberately historical :render-5: / :render-2: plants elsewhere stay literal: those name specific pre-field contracts rather than "one revision back".
|
Rebased onto current main (after #1304, #1305, #1308, #1309) and absorbed the worthwhile parts of #1287, which I am closing in favour of this. Ported: the agent-tab hover card's verdict placement and the plainer wording ( Merge notes: render revision 7, and main's tsc clean, full suite 3986 passed / 0 failed, swift build complete. The gates are untouched: connection, ten-minute freshness, validated duration, percent-range and clock-skew rejection, 3% elapsed silence. |
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.
Summary
0; missing or incomplete historical accounting stays unknown. Cache reads are already included in cost, so this adds visibility without changing pricing.The JSON field is optional for compatibility with older clients and histories. Status snapshot revision 7 invalidates older cached payloads without purging daily history. No additional polling is introduced.
Testing
npm test: 3,748 passed, 5 skipped, versus 3,738 passed, 5 skipped on the base revision; zero failures. Covers durable/fresh history, provider/date/config filters, known zero, incomplete legacy data and snapshot invalidation.npm run buildandtsc --noEmitpassed.CapacityDockDetailViewrender harness: 62 checks passed across 0.9×, 1× and 1.25× scales and all four dock edges; rendered layouts inspected visually.swift build --jobs 2passed.Local Swift validation used an isolated copy of the Swift Testing suites because this machine has Command Line Tools without XCTest. macOS CI subsequently passed the full suite: 129 XCTest tests and 457 Swift Testing tests, plus release packaging.
All 18 CI checks passed on
98ad43fe, including Windows tests and packaging (the release-only asset check is skipped).