Skip to content

Show the Claude plan on the usage tile - #19

Merged
fdussert merged 2 commits into
fdussert:mainfrom
FlorianBruniaux:codex/claude-account-identity
Oct 15, 2026
Merged

fdussert merged 2 commits into
fdussert:mainfrom
FlorianBruniaux:codex/claude-account-identity

Conversation

@FlorianBruniaux

@FlorianBruniaux FlorianBruniaux commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

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-identity subscription 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), and pnpm build passed on 58a969b.
  • The widget script tests cover known, stale and absent plan states.
  • git diff --check passed.
  • The 16×4 histogram layout received the requested CSS fix. A native 640×160 render of this final rebased head remains unverified.

@fdussert fdussert left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@fdussert

Copy link
Copy Markdown
Owner

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 ~/.local/bin/claude, publishes loggedIn and the plan, and nothing private leaks. The profile cache is gone, the badge only shows when the plan is known, and the docs and changelog are where they should be.

A few small things left:

  1. Compact label. Thanks for putting "Claude" back. The style changed, though: .clabel (muted, small caps) became .compact-label (bold, --on-surface, larger). Could you restore the original class and CSS so the compact bar looks exactly as on main? The comment above it still mentions a "service mark" and can go.
  2. authMethod. It is published as a free string. Please map it through a closed list (e.g. claude.ai, api-key, otherwise null) or drop it, since the widget only needs to know whether it is claude.ai.
  3. Height. At 16×4 with the histogram visible, the content is 3 px taller than the tile (163/160; main fits exactly), so the bottom gets clipped. Keeping the note line at the note's own line height should be enough.
  4. History. The first commit (feat(claude): show account identity…) still carries the email, the drawn logo and docs/claude-account.md. Could you squash everything into one commit with an imperative subject, such as "Show the Claude plan on the usage tile"?
  5. Nits. Some tests in claude-identity.test.ts are still packed one-liners, there is a double blank line in claude-usage-widget.test.ts, and a trailing newline was added to index.html.

Once privacy.showAccountEmail lands, adding the email through a small server-side helper should be a few lines here. Thanks again!

@FlorianBruniaux
FlorianBruniaux force-pushed the codex/claude-account-identity branch from 30ce956 to 60533ba Compare October 15, 2026 15:35
@fdussert

Copy link
Copy Markdown
Owner

Thanks for the quick turnaround, Florian! The closed authMethod list, the squash and the nits are all in, and the provider works end to end here (it finds the CLI with the helper's minimal PATH and publishes only the expected fields). A few small things are left:

  1. Removing the "service mark" comment also took out main's original "A label in front…" comment above .clabel; please put that back so the compact bar has no diff at all.
  2. At 16×4 with the histogram, the tile is still 1 px too tall (161/160), and the "account usage off" note now shows where main hid it. On main, .note has overflow: hidden and shrinks to zero when the histogram shows, but .note-line can't shrink, so overflow: hidden (or min-height: 0) on .note-line should fix both.
  3. The PR title and description still talk about the account email, the profile cache and the logo; please update them (something like "Show the Claude plan on the usage tile") and mark the PR ready for review. A line in docs/writing-widgets.md (around L282) is also over 100 characters.

Thanks again!

@FlorianBruniaux
FlorianBruniaux force-pushed the codex/claude-account-identity branch 2 times, most recently from aad53ae to 58a969b Compare October 15, 2026 16:23
@FlorianBruniaux FlorianBruniaux changed the title Show Claude account on the usage tile Show the Claude plan on the usage tile Oct 15, 2026
@FlorianBruniaux
FlorianBruniaux marked this pull request as ready for review October 15, 2026 16:23
fdussert added a commit that referenced this pull request Oct 15, 2026
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>
@fdussert

Copy link
Copy Markdown
Owner

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 .note-line, the overflow: hidden fix now hides it at the default 16×4 size (160 px) whenever today's histogram shows, so in practice it only appears at 132 px or on idle days. Could the badge move somewhere that stays visible at the default size, e.g. the foot line or next to the "5 h" label? That's the last thing before merging. Thanks!

@fdussert

Copy link
Copy Markdown
Owner

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 app.ts imports (keep createCodexProvider/createLocalChatValidator and your createClaudeIdentityProvider), the privacy paragraph in docs/claude-code.md (keep both paragraphs) and the channel list in docs/writing-widgets.md (keep both entries). Then it's good to merge.

FlorianBruniaux and others added 2 commits October 15, 2026 19:59
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>
@fdussert
fdussert force-pushed the codex/claude-account-identity branch from 2cf9516 to 7d251d8 Compare October 15, 2026 18:01

@fdussert fdussert left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@fdussert
fdussert merged commit 5142754 into fdussert:main Oct 15, 2026
1 check passed
@fdussert

Copy link
Copy Markdown
Owner

Follow-up idea, if you'd like to pick it up, Florian: privacy.showAccountEmail landed with #25, so the Claude tile can now show the account e-mail when the user opts in. In server/src/claude/identity.ts, keep email from claude auth status --json and publish it with withAccountEmail(email, show()) (show = () => store.get().privacy.showAccountEmail), pass every returned snapshot — the error path included — through gateAccountEmail, and set publishesAccountEmail: true so unticking clears it at once (see the "account's e-mail address" section in docs/connections.md). On the tile, show it next to the plan badge without changing the 16×4 height, with tests for ticked and unticked. A small separate PR would be perfect; no rush.

@fdussert fdussert mentioned this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants