Conversation
Month heat maps, the details block, the day tip and the reload icon, on the start screen's own type scale, plus the AI_CHAT_USAGE_* strings they need.
The headline and Activity stats wrap instead of running past the card, the range chip trims with an ellipsis, and the reload and Details controls keep their width.
The details' page row (last 30 days or an earlier calendar month) and its arrow titles; the "last 3 months" label goes with the 90-day row.
Async.retry runs an operation again after a failure: attempts, per-retry delays (a number or a list whose last value repeats), jitter, a per-attempt timeout, a shouldRetry gate, an onRetry hook and an AbortSignal. The defaults are one quick retry then longer waits, about two minutes in all, for network blips and service restarts. Always returns a native Promise.
The usage tips now serve two kinds: the day under the pointer on the start-screen card, and a token split by kind, on the card's tokens figure or under a turn line. Both live on the body so neither the card's overflow nor the scrolling messages can clip them. The tokens that open a split carry a dotted underline. The usage line under an answer loses its 14px indent and sits flush with the answer and its label.
| function waitFor(retryIndex) { | ||
| const base = delays[Math.min(retryIndex, delays.length - 1)]; | ||
| const spread = base * jitter; | ||
| return Math.max(0, Math.round(base + (Math.random() * 2 - 1) * spread)); |
The current month's grid now draws every day; the days after today get their own faint, never-coloured cell.
The minified bundle is now 12.09 MB, past the 12 MB limit. Raise it by 1 MB to restore the margin the size policy asks for.
The spend figure and the header chip say a Claude subscription includes the spend at no extra cost, with no charge to Phoenix Pro. Dotted underlines mark the spend and token figures as hoverable.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




What kind of change does this PR introduce?
Core side of the AI panel's usage card. The card itself, the usage ledger and the cloud sync live in phoenix-pro (companion PR: https://github.com/phcode-dev/phoenix-pro/pull/275); this PR carries what they need from core:
Async.retryinsrc/utils/Async.js: retries a promise-returning operation with configurable attempts, delays, jitter, per-attempt timeout, ashouldRetryfilter, anonRetryhook and an abort signal. The usage ledger uses it for its automatic pushes.tracking-repos.jsonpoints at the matching phoenix-pro commit.Does this PR introduce a breaking change?
Tests done
test/spec/Async-test.jscovers the retry helper (attempts, delays, jitter, timeout, shouldRetry, onRetry, abort).integration:AI Usage Ledger13/13,integration:AI Usage Calendar12/12,integration:AI Usage Meter6/6.brackets.less.Checklist
Other information
Proposed changelog: "The AI panel's start screen now shows your AI usage: a calendar of the days you used it, the last 30 days' spend and tokens, and details by month and model. Hover the tokens to see how they split into input, output and cache."
Why: users of the built-in chat had no view of what it was costing them beyond the current session; the card gives a month-by-month picture, kept on each machine and synced across the account's machines once the accounts service is deployed.