Files
orca/src/shared
NeilandShemYu 1712936c29 feat(usage): show Muse subscription quota in the status bar (#38907)
* feat(usage): show Muse subscription quota in the status bar

Reads `muse usage --json` (Muse Code 1.4.13+), which reports the
subscription allowance without a model turn, and maps `allowance.window`
to the five-hour session meter and `allowance.weekly` to the weekly meter.
`rateLimits.muse` now appears in `orca account list --json`.

- Gate on `muse --help` listing `usage`: older builds treat an unknown
  subcommand as a prompt, so Orca never sends `usage` to them.
- Run with MUSE_NO_AUTO_UPDATE=1 and MUSE_LOGIN=0 so a background poll
  never self-updates the launcher or starts a device sign-in.
- Missing CLI, signed out, API-key login / no allowance, non-JSON output,
  and timeouts each map to an explicit unavailable/error snapshot.
- Hidden meters skip the spawn, and Muse publishes after the sibling batch
  so a slow CLI cannot delay Grok/Cursor/ZCode/Antigravity.
- Default-on status-bar item with a one-shot migration, CLI-detection
  gating, visibility menu and Settings toggle, remote-owner mapping.

Based on the design in #34232 by ShemYu.

Co-authored-by: ShemYu <11490047+ShemYu@users.noreply.github.com>

* fix(usage): cap Muse usedPercent and date readings by fetch time

Muse can report over-quota usage above 100; clamp to the 0-100 meter
contract like the other providers. Use the fetch time for updatedAt so a
cached older asOfMs cannot make every window focus trigger a refresh.

* fix(usage): prevent Muse launcher installation during polling

* fix(usage): gate Muse on its version file and run the active build directly

- Read the launcher's `.muse-version` and require 1.4.13 or newer (the
  release that added `muse usage`); only installs without that file fall
  back to `muse --help`, cached by launcher path, mtime and size.
- Execute `muse-bin-<version>` directly when it exists, so the launcher's
  update, sign-in and install paths never run; the env guards stay for
  the launcher fallback. A version change during the call discards the
  reading as stale.
- Start the Muse fetch at the beginning of the full cycle and cap it near
  8s (6s usage, 2s help), so a slow CLI holds the shared queue far less.

---------

Co-authored-by: ShemYu <11490047+ShemYu@users.noreply.github.com>
2026-11-06 20:53:57 -08:00
..
…