a native macOS app for tokenmaxx, with a menu bar item - #31
Open
pedroapfilho wants to merge 1 commit into
Open
pedroapfilho wants to merge 1 commit into
pedroapfilho wants to merge 1 commit into
Conversation
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.
This is a proposal, so tell me whether it's worth doing. It adds a native macOS app for tokenmaxx, built with GPUI (Zed's UI framework) and the GPUI Kit components. The app does everything the terminal dashboard does, and it can also sit in the menu bar.
It's a large diff (+22k lines), but about 19k of that is
gui/Cargo.lockand the JSON test fixtures. The real changes are the daemon changes below and the Rust app ingui/.What the app does
…menu holds the rest: sign in again, spend a Codex reset credit, spill into extra usage at the threshold, and sign out.How it fits with the CLI
The daemon stays the one source of truth. The app is a thin client of the same unix socket (
manager.sock) and the same~/.tokenmaxxstate.tokenmaxx.appcontains abun build --compilecopy of the CLI, so it works without Bun or npm installed.tokenmaxxon the user's PATH is at least as new as the app's copy, the app starts the daemon and runs sign-in through that one. Otherwise it uses its own copy, and Settings offers an Update button, which runsbun add -g tokenmaxx@<version>or the npm equivalent. It also offers to put the bundled copy on the PATH. The app never replaces a daemon newer than the version it would start.tokenmaxx login <cli>and picks up the new account on its next poll.Changes to the existing TypeScript
routing/read,routing/set(codex, claude, pi),account/addApiKey, andversion/latest. The routing logic moved out ofcli.tsintosrc/routing.ts.routingaction to the CLI.--compilesupport. The daemon now starts correctly from a compiled binary;Bun.mainis under/$bunfs/there. A newcompiledBinaryflag makes the update hints point to the app instead ofbun add -g.tokenmaxx --version. New; the app uses it to compare versions.daemon startnow replaces a running daemon of a different version, the same way the other commands already do.healInstalledConfigs. It used to re-apply routing to every routed config using the starting daemon's own port. A daemon started with a differentTOKENMAXX_HOMEandTOKENMAXX_PROXY_PORTwould then point the user's real codex and claude configs at itself. It now only rewrites configs already routed to its own port. A regression test covers this.Trying it
This needs Rust stable and Xcode's command-line tools.
gui/isn't part of CI; the existing workflow still runs only on Ubuntu.When testing, isolate the client configs as well:
CODEX_HOME,CLAUDE_CONFIG_DIR, andPI_CODING_AGENT_DIR, not onlyTOKENMAXX_HOME. Otherwise a routing toggle changes your real configs.Tested
bun run check: 93 tests pass, including the new daemon-method tests and the heal regression test.cargo test: 12 tests pass, covering the formatting ported fromtui/format.ts, the app parsing every TUI fixture, the menu command ids, and version ordering..appagainst a test daemon:tokenmaxx status.Not tested yet:
Open questions
.dmg/.zipfor GitHub Releases, plus a Homebrew cask. That needs a Rubric Labs Apple Developer account.gpui-pre =0.3.6), so expect small API changes whenever we bump it.