feat: combine token usage from a remote Mac over SSH - #315
Open
yourconscience wants to merge 1 commit into
Open
yourconscience wants to merge 1 commit into
yourconscience 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.
Summary
Adds pull-based cross-machine usage aggregation: a user can register a second Mac by SSH target under Settings → Advanced → Remote Macs, and PokeTokenBar imports that machine's local agent logs (Pi, omp, Claude Code, Codex, Gemini, Antigravity, OpenCode, Hermes, Cursor, Grok, Copilot, Kiro, Aside) and folds them into the combined today/week/month totals and companion progression.
How it works:
~/.ssh/configoruser@host), and the remote home (~by default). New machines track all registered providers; Import/Remove and an enable toggle are on each row, with a status line showing the last import time or error.RemoteUsageImportermirrors each remote provider's log roots locally under Application Support (RemoteUsage/<machine>/<provider>/root-N/) using/usr/bin/rsyncover the existing SSH credentials (batch mode, keepalives, no password prompts).--delete; remote files are never written, modified, or deleted. A failed or unreachable remote keeps the last imported snapshot and surfaces a status line instead of dropping usage to zero.CustomScanRoots.providerUnion, so the existing parsers, blob caches, and global dedup handle remote data with no per-provider changes to the readers.$HOMEinside double quotes (macOS openrsync does not expand~inside single quotes — observed on a real machine), and rsync gets a 600s timeout with one retry, because a first import mirrors the remote's whole history while later runs are incremental deltas.state.db, Cursorstate.vscdb, Copilotsession-store.db) import only that file, so a multi-GB runtime tree on the remote is neither walked nor transferred.Extensibility notes: this follows the provider-extension conventions — provider-specific remote root lists live in one switch (
RemoteUsage.remoteRoots), generic aggregation is untouched, and there are no newproviderIDbranches on generic paths. Not related to #257 (that issue is about syncing the companion save; this PR aggregates usage logs and never uploads anything).Validated on a real two-machine setup (M4 local + M1 over SSH): adding the remote raised today's combined total from 28.5M to 98.1M tokens and surfaced an omp tab from the imported logs, without changing the local-only numbers when the machine is disabled.
swift test: 1086 tests, 11 skipped, 0 failures.Type of change
UI changes
Settings → Advanced gains a "Remote Macs" block between the limit-token row and Additional scan folders.
The popover itself is unchanged: totals simply become combined when a remote is enabled. The canonical
assets/screenshots are regenerated at release, so none are updated here.Checklist
swift buildandswift testpass locally