Repository navigation
Show the Claude plan on the usage tile - #19
Conversation
fdussert
left a comment
There was a problem hiding this comment.
Thanks a lot for this, Florian, and for being upfront that you could not test it with a logged-in CLI. I ran it on a machine that has one, and found a few things to sort out before it can land.
1. The CLI is looked up through PATH, which fails under the helper. execFile('claude', …) (server/src/claude/identity.ts:37) resolves through PATH. The native installer puts the binary in ~/.local/bin/claude, and the PATH the helper gives the server (native/Sources/FremkitHelper/ServerProcess.swift) does not include that folder. With that PATH, the provider returns {loggedIn: null, stale: true, error: "offline"} forever, so the tile reads "Claude account: unknown · stale data". Please resolve an absolute path from a closed list (~/.local/bin/claude, /opt/homebrew/bin/claude, /usr/local/bin/claude) and run that. The rest of the invocation is good: an argument list, shell: false, a timeout, a bounded buffer and a filtered environment.
2. The profile cache is no longer needed. On the current CLI (2.1.x), claude auth status --json already returns email and subscriptionType (e.g. "max"). Please drop readProfile and the .claude.json parsing entirely, and map subscriptionType through a closed list. That removes our dependence on an undocumented file, along with the issues it brings: CLAUDE_CONFIG_DIR is ignored, symlinks are followed, a large .claude.json silently goes over the 2 MB cap, and an email that fails .email() also loses the plan.
3. The account email. As it stands, the email is published on claude-identity to any widget that subscribes, and shown on the desk screen of everyone who already has the usage tile, with nothing to turn it off. We're settling on one rule for every account provider (the same one I just described on #14): Fremkit gets a privacy setting, privacy.showAccountEmail, off by default, with a checkbox in the Screen inspector. We'll add it on our side in a separate PR. When it's off, the provider must not publish the email at all (checked on the server, since any widget subscribed to the channel receives what is published); when it's on, the email can be published. The plan (Max/Pro) doesn't depend on it.
So for this PR: please publish only the login state and the plan. Once the setting lands, adding the email behind store.get().privacy.showAccountEmail (read on each poll) is welcome, here after a rebase or as a small follow-up.
4. The mark in the compact bar. Please put the "Claude" text label back instead of the hand-drawn sunburst in a hard-coded #d97757 (widgets/claude-usage/index.html). We would rather not ship an imitation of Anthropic's logo, and the fixed colour and size also ignore accent-fill/on-light and --h. The | separator between gauges is a separate visual change; please leave it out of this PR.
5. Layout. The extra heading and identity line push a 4-row tile into overflow-y: auto, which puts a scrollbar on a screen that is read at a glance. A single plan badge next to the existing content, shown only when it is known, would fit without one. Please don't show "account: unknown" when there is nothing to say.
6. Readability. Could you format the CSS, the identity expression in render() and the new widget tests (server/test/claude-usage-widget.test.ts) like the surrounding code? Please also revert the manifest reformatting, so the diff is only the version bump and the new subscription.
7. Docs and changelog. Rather than a new unlinked docs/claude-account.md, a short paragraph in the "Rate limits" section of docs/claude-code.md would do. Please add claude-identity to the channel list in docs/writing-widgets.md. The CHANGELOG line belongs under ### Added, with a bold lead like its neighbours, for example "The Claude limits tile shows your plan. …". The repository uses imperative commit subjects ("Show the Claude plan on the usage tile") rather than feat(scope):.
The tests that check nothing private leaks and the generation guard on stop() are nice touches; please keep them. Thanks again!
|
Thanks for the quick turnaround, Florian! I ran the new version end to end against a logged-in CLI with the helper's minimal PATH: it finds A few small things left:
Once |
30ce956 to
60533ba
Compare
|
Thanks for the quick turnaround, Florian! The closed
Thanks again! |
aad53ae to
58a969b
Compare
Two gaps found reviewing #19. A provider that answers a failure with its last good snapshot ({ ...last, error }) would keep publishing an address fetched while the box was ticked; gateAccountEmail() drops it from any existing snapshot, and the contract now says every returned snapshot goes through it. And unticking only took effect at the provider's next poll, five minutes for an account endpoint, while the hub kept replaying the old value to new subscribers. A provider now declares publishesAccountEmail, and a change of the setting has the registry poll those providers at once (or straight after a poll in flight, which may have read the old value) and drop the cached value of a channel nobody watches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks Florian, all three points are in and the 16×4 tile now matches main pixel for pixel. One thing I noticed while re-rendering: since the plan badge lives in |
|
Thanks Florian, the plan badge now sits at the start of the footer and stays visible at 160 px with the histogram, and the compact bar is unchanged. Could you rebase on main? #14 and #25 touched the |
Read only the local CLI auth status. Publish a known plan without account email, preserve the compact bar style, and keep the badge inside the tile. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
2cf9516 to
7d251d8
Compare
fdussert
left a comment
There was a problem hiding this comment.
Thanks Florian — the plan badge stays visible at 16×4 with the histogram, nothing private is published, and the compact bar is unchanged. Approving. I rebased this on main myself to get it into 0.3.0: conflicts only, both sides kept, no change to your code, and you stay the author of every commit. If you push to this branch again, please git pull --rebase first. Thanks!
|
Follow-up idea, if you'd like to pick it up, Florian: |
What this changes
Shows the connected Claude plan on the full Claude usage tile when the local CLI reports a known subscription. A read-only identity provider publishes login state, auth method and plan; it does not publish the account email. Missing or stale identity keeps the badge hidden, and logout clears it. The compact bar keeps its original Claude label and styling.
This adds the
claude-identitysubscription to the widget, documents the channel and keeps the existing usage gauges and histogram intact. A connected CLI was verified by François on his machine. This branch has not been installed on the user's XENEON.Checks
pnpm typecheck,pnpm test(1,401 server and 385 UI tests), andpnpm buildpassed on58a969b.git diff --checkpassed.