cost-bubble 0.4.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,105 +1,80 @@
1
1
  # Cost Bubble
2
2
 
3
- **Live session cost and context monitoring for Codex, Claude Code, and Antigravity on macOS.**
4
-
5
- Cost Bubble sits as a lightweight native floating pill right beside your AI coding app’s sidebar—keeping the open session’s estimated spend, context-window fill, and active background chats visible at a glance without breaking your flow.
3
+ A lightweight floating pill that shows live session cost and context fill right beside your **Codex**, **Claude Code**, or **Antigravity** sidebar—on **macOS**, **Windows**, and **Linux**.
6
4
 
7
5
  <p align="center">
8
- <img src="docs/demo.gif" alt="Cost Bubble follows sample Codex chats, expands to show today’s sessions, and reveals the context window split, hourly burn chart, cost drivers, and clickable subagents on hover" width="840" />
6
+ <img src="docs/demo.gif" alt="Cost Bubble following Codex chats, expanding on hover, and opening context and cost breakdowns on click" width="840" />
9
7
  </p>
10
8
 
11
- ## What It Shows
12
-
13
- - **Live session pulse** — Automatically follows your open chat (`▸`) in **Codex**, **Claude Code**, or **Antigravity Desktop**, plus up to two other chats ranked by recent spend, weighted with a 150-second half-life.
14
- - **Input token gauge** — Four bars show the latest request’s input size. Their color changes at 50k, 100k, 200k and 300k tokens. Hover for a segmented cached/fresh context bar, headroom, and pricing-tier status. Purple dots underneath mark active subagents.
15
- - **Instant cost breakdown** — Hover or click any price for 5-minute, hourly, daily, and lifetime spend, spend mix with cache-hit efficiency and estimated cache-miss overhead, a 1-hour stacked burn chart, top cost drivers with timestamps, and clickable Codex subagents.
16
- - **Recent sessions on hover** — Hover the pill to compare recent chats, see today’s spend, sort by recent activity, daily cost or recency, or click any title to switch chats. Click outside or `×` to dismiss pinned popups.
17
- - **Native & unobtrusive** — Built in Swift/AppKit. Drag or resize per app; stays quietly available on New Chat screens in Codex, Claude Code, and Antigravity while hiding on ordinary non-Code Claude chats.
9
+ - **Live spend & context at a glance** — Follows your active chat automatically, with a 4-bar input gauge (color-coded up to 300k+ tokens) and purple dots for active subagents.
10
+ - **Click for breakdowns** — Click any **price** for 5-min / 1-hr / daily / lifetime spend, cache efficiency, hourly burn chart, cost drivers, and clickable subagents. Click the **signal bars** for cached vs. fresh context and headroom.
11
+ - **Switch chats from the pill** — Hover to compare today’s sessions and daily total, sort by activity or cost, or click any title to jump straight to that chat.
18
12
 
19
13
  ---
20
14
 
21
15
  ## Install
22
16
 
23
- Requires **macOS 14+**, **Node.js 18+**, and **Python 3.8+**.
17
+ ### macOS
24
18
 
25
19
  ```sh
26
- npx cost-bubble@latest install
20
+ curl -fsSL https://raw.githubusercontent.com/anopows/cost-bubble/main/scripts/install.sh | bash
27
21
  ```
28
22
 
29
- This installs **Cost Bubble.app** and enables its login item for your Mac account. No API keys or external pricing CLIs are required.
23
+ Or `npx cost-bubble@latest install`, or download **[Cost-Bubble-macOS.zip](https://github.com/anopows/cost-bubble/releases/latest/download/Cost-Bubble-macOS.zip)**.
30
24
 
31
- ### Enable Accessibility
25
+ > **First run:** Enable **Cost Bubble** in **System Settings → Privacy & Security → Accessibility** (or click the menu bar gauge icon → *Open Accessibility Settings…*).
32
26
 
33
- Cost Bubble uses macOS Accessibility to detect the active chat, align beside the sidebar, and jump to a chat when clicked.
27
+ ### Windows
34
28
 
35
- 1. Click the gauge icon in the macOS menu bar and choose **Open Accessibility Settings…** (or open **System Settings → Privacy & Security → Accessibility**).
36
- 2. Turn on **Cost Bubble**. If it isn’t listed, click **+**, press **⌘⇧G**, enter `~/Applications/Cost Bubble.app`, and click **Open**.
37
- 3. Open an existing chat in **Codex**, the **Code** section of **Claude Desktop**, or **Antigravity Desktop** to see the pill appear beside the sidebar.
38
-
39
- ---
29
+ ```powershell
30
+ irm https://raw.githubusercontent.com/anopows/cost-bubble/main/scripts/install.ps1 | iex
31
+ ```
40
32
 
41
- ## Using the Pill
33
+ Or download the installer: **[x64](https://github.com/anopows/cost-bubble/releases/latest/download/Cost-Bubble-Windows-x64-setup.exe)** · **[ARM64](https://github.com/anopows/cost-bubble/releases/latest/download/Cost-Bubble-Windows-arm64-setup.exe)**.
42
34
 
43
- | Action | What happens |
44
- | --- | --- |
45
- | **Hover the pill** | Expands to show the current chat (`▸`) plus other chats active today (from your 12 most recent). |
46
- | **Hover the signal bars** | Shows the latest request’s cached/fresh context split, headroom, and pricing tier. **Click** to pin it open (click outside or `×` to close). |
47
- | **Hover a price** | Opens the full cost breakdown: 5-min / 1-hr / today / lifetime spend, spend mix & cache-miss overhead, 1-hour stacked burn chart, top cost drivers, and clickable Codex subagents. **Click** to pin it open. |
48
- | **Click a chat title** | Switches directly to that chat in the active desktop app. *(Antigravity leaves its picker open if multiple titles match.)* |
49
- | **Read the header total** | Shows today’s combined spend across this app’s chats. Lifetime estimates appear in each chat’s price breakdown. |
50
- | **Click `⇅`** | Cycles row order between **Decay**, **Cost**, and **Recent**. |
51
- | **Drag the left edge, pinch, or `−` / `+`** | Moves or resizes the pill—each desktop app remembers its own position. Use **`≡`** for pin, auto-fit, 12-chat history, and reset options. |
35
+ ### Linux
52
36
 
53
- ---
54
-
55
- ## How Estimates Work
37
+ ```sh
38
+ curl -fsSL https://raw.githubusercontent.com/anopows/cost-bubble/main/scripts/install.sh | bash
39
+ ```
56
40
 
57
- - **Direct local pricing:** Reads your local session logs directly and prices token usage against [LiteLLM](https://github.com/BerriAI/litellm)’s public pricing catalog (refreshed daily to a local cache, with a bundled offline fallback). A **`—`** means pricing is unavailable; sessions with incomplete pricing show the sum of their priced requests. Estimates may differ from subscription invoices or API bills.
58
- - **Input token bars:** Mint, cyan, yellow, orange and red mark progressively larger input sizes including cached input. Hover for the exact token count and the context-window share when recorded.
59
- - **Subagents & auto-reviewers:** Up to four purple dots underneath the signal bars indicate ordinary subagents. Automatic reviewers are separated into their own row in the cost breakdown and included in totals when priced.
60
- - **Per-request vs. per-turn rates:** Latest, average, and peak figures measure individual requests in Codex and Antigravity, or turns in Claude Code. If a refresh fails, the pill retains its last successful reading and continues aging spend out of the 5-minute window.
61
- - **Local-only readers:** All three apps share the same Swift UI, while lightweight Python readers normalize each app’s local storage with incremental file-identity caching. Custom `CODEX_HOME` and `CLAUDE_CONFIG_DIR` paths are preserved at install time.
41
+ Or download **[AppImage (x86_64)](https://github.com/anopows/cost-bubble/releases/latest/download/Cost-Bubble-Linux-x86_64.AppImage)** · **[AppImage (ARM64)](https://github.com/anopows/cost-bubble/releases/latest/download/Cost-Bubble-Linux-aarch64.AppImage)** · **[.deb packages](https://github.com/anopows/cost-bubble/releases/latest)**. *(Floating pill uses X11; Wayland shows spend in the tray.)*
62
42
 
63
43
  ---
64
44
 
65
- ## Update & Uninstall
66
-
67
- - **Update:** Re-run `npx cost-bubble@latest install`.
68
- - **Quit temporarily:** Click the menu bar gauge icon and choose **Quit Cost Bubble**.
69
- - **Uninstall:** Unload the login agent, move the items below to the Trash, and optionally remove **Cost Bubble** from Accessibility Settings.
45
+ ## Controls
70
46
 
71
- ```sh
72
- launchctl bootout "gui/$(id -u)/io.github.anopows.cost-bubble"
73
- ```
74
-
75
- - `~/Applications/Cost Bubble.app`
76
- - `~/Library/LaunchAgents/io.github.anopows.cost-bubble.plist`
77
- - `~/Library/Caches/io.github.anopows.cost-bubble/` *(optional pricing and scan cache)*
47
+ | Action | Result |
48
+ | --- | --- |
49
+ | **Hover pill** | Expand today’s sessions and daily total |
50
+ | **Click price** | Toggle cost breakdown (hourly burn, spend mix, drivers, subagents) |
51
+ | **Click signal bars** | Toggle context window & cache breakdown |
52
+ | **Click chat title** | Jump to that chat |
53
+ | **Click outside / `Esc` / `×`** | Close open breakdown |
54
+ | **Drag, left edge, `−` / `+`, `⇅`, `≡`** | Move, resize, zoom, sort, or change theme & options per app |
78
55
 
79
56
  ---
80
57
 
81
- ## Development
82
-
83
- Building from source requires **Apple Command Line Tools** (`xcode-select --install`).
58
+ ## How Estimates Work
84
59
 
85
- ```sh
86
- # Install from a local checkout
87
- ./install.sh
60
+ Cost Bubble reads your local session logs directly and prices token usage against [LiteLLM](https://github.com/BerriAI/litellm)’s public pricing catalog. Everything stays on your machine; estimates may differ from API or subscription bills.
88
61
 
89
- # Build without installing and verify the bundled reader loads
90
- ./build.sh "/absolute/path/Cost Bubble.app"
91
- "/absolute/path/Cost Bubble.app/Contents/MacOS/SessionHUD" --check-bundle
62
+ <details>
63
+ <summary>Pricing, update & uninstall details</summary>
92
64
 
93
- # Run session-reader unit tests
94
- PYTHONPATH=Sources/Readers python3 -B -m unittest discover -s Tests/Readers -v
95
- ```
65
+ - **Fast & priority tiers:** Codex and Claude fast/priority/ultrafast requests use their recorded speed tier when priced; unrecognized premium tiers display as unpriced (`—`).
66
+ - **Subagents & reviewers:** Purple dots mark active subagents; automatic reviewers appear in their own breakdown row and are included in totals.
67
+ - **Custom config paths:** `CODEX_HOME` and `CLAUDE_CONFIG_DIR` are respected automatically.
68
+ - **Update:** Re-run your platform’s install command above.
69
+ - **Uninstall:**
70
+ - **Windows:** Remove **Cost Bubble** from **Settings → Apps → Installed Apps**.
71
+ - **Linux:** `sudo apt remove cost-bubble` (for `.deb`), or delete `~/.local/bin/cost-bubble` and `~/.local/share/applications/cost-bubble.desktop`.
72
+ - **macOS:** Run `launchctl bootout "gui/$(id -u)/io.github.anopows.cost-bubble"` and delete `~/Applications/Cost Bubble.app`, `~/Library/LaunchAgents/io.github.anopows.cost-bubble.plist`, and optionally `~/Library/Caches/io.github.anopows.cost-bubble/`.
96
73
 
97
- If a local rebuild stops recognizing chats while Accessibility is enabled, remove and re-add `~/Applications/Cost Bubble.app` in Accessibility Settings, then restart the helper if needed:
74
+ </details>
98
75
 
99
- ```sh
100
- launchctl kickstart -k "gui/$(id -u)/io.github.anopows.cost-bubble"
101
- ```
76
+ ---
102
77
 
103
- See [Publishing a signed macOS release](docs/signed-releases.md) for signing, notarization, npm packaging, and upgrade verification.
78
+ ## Development
104
79
 
105
- Released under the [MIT License](LICENSE).
80
+ See [v1/README.md](v1/README.md) to build and test from source, or [docs/signed-releases.md](docs/signed-releases.md) for macOS signing. Released under the [MIT License](LICENSE).
package/docs/demo.gif CHANGED
Binary file
package/install.sh CHANGED
@@ -17,28 +17,6 @@ case "${1:-}" in
17
17
  --signed|"") ;;
18
18
  *) echo "Usage: ./install.sh" >&2; exit 1 ;;
19
19
  esac
20
- if [[ "${1:-}" != "--signed" ]] && ! xcrun --find swiftc >/dev/null 2>&1; then
21
- echo "Building from source requires Apple's Command Line Tools (xcode-select --install)." >&2
22
- exit 1
23
- fi
24
- python=""
25
- clt_installed=0
26
- if xcode-select -p >/dev/null 2>&1; then clt_installed=1; fi
27
- for candidate in "${PYTHON_BIN:-}" /opt/homebrew/bin/python3 /usr/local/bin/python3 "$(command -v python3 || true)" /usr/bin/python3; do
28
- if [[ "$candidate" == "/usr/bin/python3" && "$clt_installed" -eq 0 ]]; then continue; fi
29
- if [[ "$candidate" == /* && -x "$candidate" ]]; then
30
- resolved="$("$candidate" -c 'import plistlib, sqlite3, sys; assert sys.version_info >= (3, 8); print(sys.executable)' 2>/dev/null || true)"
31
- if [[ "$resolved" == /* && -x "$resolved" ]]; then
32
- python="$resolved"
33
- break
34
- fi
35
- fi
36
- done
37
- if [[ -z "$python" ]]; then
38
- echo "Python 3.8+ with sqlite3 is required (install via Homebrew or xcode-select --install), then run this installer again." >&2
39
- exit 1
40
- fi
41
- export PYTHON_BIN="$python"
42
20
  if [[ -e "$app" ]] && [[ "$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$app/Contents/Info.plist" 2>/dev/null || true)" != "$label" ]]; then
43
21
  echo "An unrelated app already exists at $app. Choose a different location for it first." >&2
44
22
  exit 1
@@ -86,24 +64,19 @@ if [[ "${1:-}" == "--signed" ]]; then
86
64
  else
87
65
  ./build.sh "$stage/$name.app"
88
66
  fi
89
- node_bin="$(command -v node || true)"
90
- "$python" - "$stage/agent.plist" "$label" "$app" "$python" "$node_bin" <<'PY'
91
- import os, plistlib, sys
92
- from pathlib import Path
93
- destination, label, app, python, node_bin = sys.argv[1:]
94
- bins = [str(Path(python).parent)]
95
- if node_bin.startswith("/"):
96
- bins.append(str(Path(node_bin).parent))
97
- bins.extend(["/opt/homebrew/bin", "/usr/local/bin", "/usr/bin", "/bin"])
98
- env = {"PATH": os.pathsep.join(dict.fromkeys(bins)), "PYTHON_BIN": python}
99
- for key in ("CODEX_HOME", "CLAUDE_CONFIG_DIR"):
100
- if os.environ.get(key):
101
- env[key] = str(Path(os.environ[key]).expanduser().resolve())
102
- with open(destination, "wb") as stream:
103
- plistlib.dump({"Label": label, "ProgramArguments": [str(Path(app) / "Contents/MacOS/SessionHUD")],
104
- "EnvironmentVariables": env, "RunAtLoad": True, "LimitLoadToSessionType": "Aqua",
105
- "KeepAlive": {"SuccessfulExit": False}}, stream)
106
- PY
67
+ /usr/bin/plutil -create xml1 "$stage/agent.plist"
68
+ /usr/bin/plutil -insert Label -string "$label" "$stage/agent.plist"
69
+ /usr/bin/plutil -insert ProgramArguments -json '[]' "$stage/agent.plist"
70
+ /usr/bin/plutil -insert ProgramArguments.0 -string "$app/Contents/MacOS/cost-bubble" "$stage/agent.plist"
71
+ /usr/bin/plutil -insert RunAtLoad -bool YES "$stage/agent.plist"
72
+ /usr/bin/plutil -insert LimitLoadToSessionType -string Aqua "$stage/agent.plist"
73
+ /usr/bin/plutil -insert KeepAlive -json '{"SuccessfulExit":false}' "$stage/agent.plist"
74
+ /usr/bin/plutil -insert EnvironmentVariables -json '{}' "$stage/agent.plist"
75
+ for key in CODEX_HOME CLAUDE_CONFIG_DIR; do
76
+ if [[ -n "${!key:-}" ]]; then
77
+ /usr/bin/plutil -insert "EnvironmentVariables.$key" -string "${!key}" "$stage/agent.plist"
78
+ fi
79
+ done
107
80
  plutil -lint "$stage/agent.plist"
108
81
  if launchctl print "$job" >/dev/null 2>&1; then
109
82
  launchctl bootout "$job"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cost-bubble",
3
- "version": "0.4.0",
4
- "description": "A macOS cost HUD for Codex, Claude Code and Antigravity.",
3
+ "version": "1.0.1",
4
+ "description": "macOS installer for the Cost Bubble cross-platform desktop HUD.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.4.0",
2
+ "version": "1.0.1",
3
3
  "teamID": "4YJ6CF8CRP",
4
- "sha256": "4bed090a01a0a3e4070e39af4f9bc7002d76f8d243be0aa65341ac6bfd70a421"
4
+ "sha256": "c43aae675d79493eeeb7d5b48ffea1619c946d451754477cab2c9c0978d6a63e"
5
5
  }
@@ -12,4 +12,4 @@ actual=$(/usr/bin/shasum -a 256 "$archive")
12
12
  app="$destination/Cost Bubble.app"
13
13
  "$(dirname "$0")/verify-release-app.sh" "$app" "$team" "$version"
14
14
  /usr/sbin/spctl --assess --type execute "$app"
15
- "$app/Contents/MacOS/SessionHUD" --check-bundle
15
+ "$app/Contents/MacOS/cost-bubble" --check-bundle
@@ -10,7 +10,7 @@ requirement="identifier \"io.github.anopows.cost-bubble\" and anchor apple gener
10
10
  [[ "$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$app/Contents/Info.plist")" == "$version" ]] || {
11
11
  echo "The signed app does not match the requested release version." >&2; exit 1;
12
12
  }
13
- arch_info=$(/usr/bin/file -b "$app/Contents/MacOS/SessionHUD")
13
+ arch_info=$(/usr/bin/file -b "$app/Contents/MacOS/cost-bubble")
14
14
  [[ "$arch_info" == *"(for architecture arm64):"* && "$arch_info" == *"(for architecture x86_64):"* ]] || {
15
15
  echo "The signed app is not a universal arm64/x86_64 binary." >&2; exit 1;
16
16
  }