feat: add Muse coding-plan provider - #128
Conversation
Track Meta Muse coding-plan quotas (5h prompts + weekly) from the same subscription snapshot 'muse /usage' shows. Meta publishes no aggregate usage endpoint, so each poll sends one minimal streamed probe to POST /v1/responses (input ping, max 16 output tokens) and extracts the inline subscription object. Auth resolves as META_API_KEY, then the muse login file, then the macOS Keychain / Linux keyring entry written by 'muse login'. The Keychain lookup is deadline-bounded (15s) so an unanswered approval dialog can never block daemon startup. Includes: API client + types, credential auto-detect (unix/windows), SQLite store + reset-cycle tracker, polling agent, daemon wiring, 7 web endpoints, dashboard cards + menubar + settings, setup wizard, install.sh/ps1, docs/MUSE_SETUP.md, landing card.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
The usage probe was a full streamed generation on the same Meta API key the TUI uses. That held the HTTP stream until ping finished, 429'd live muse sessions, and looked like Muse/onWatch crashing. - Close the SSE stream as soon as the subscription snapshot arrives - Skip the probe while a `muse` process is running - Treat HTTP 429 as a skipped cycle, not a hard error - Reject nil snapshots on insert - Ad-hoc codesign Darwin builds so taskgated does not SIGKILL unsigned pages Co-authored-by: Grok <grok@x.ai>
|
Follow-up fix on this branch: Cause: the usage probe was a full streamed What changed:
|
|
Thanks for this, it is a clean provider addition. It follows the existing per-provider layout, and everything passes on our side: go vet, go test -race across api, agent, store, tracker and web, 27/27 in tests/test_install.sh, and it rebases onto main with no conflicts. We are keeping the 120s default polling as is. The 5h window is token metered, so a 16 token probe is noise, and we would rather have one polling model across all providers. Two things before we merge:
Optional: a MUSE_BASE_URL override would match ZAI_BASE_URL for proxy setups. |
Track Meta Muse coding-plan quotas (5h prompts + weekly) from the same subscription snapshot
muse /usageshows.Why this shape
Meta publishes no aggregate usage endpoint for the coding plan (probed
/v1/usage,/v1/billing, org usage/costs - all 404). Each poll sends one minimal streamed probe (POST /v1/responseswithstream: true, inputping,max_output_tokens: 16) and extracts the inlinesubscriptionobject. Verified against the live API:{"subscription": {"tier": "pro", "weekly": {"resets_at": "1789344000", "used_percent": "12.5"}, "window": {"resets_at": "1789078632", "used_percent": "34", "window_duration_mins": "300"}}}Auth
Resolves as
META_API_KEY->providers.meta.api_keyin themuselogin file -> macOS Keychain / Linux keyring entry written bymuse login. The Keychain lookup is deadline-bounded (15s + regression test) so an unanswered approval dialog can never block daemon startup.Includes
docs/MUSE_SETUP.md, landing cardVerified
./app.sh --smokegreen on this branch;tests/test_install.sh27/27 (incl. 2 new Muse cases)tools/perf-monitor TestMain_RestartFailureExitsWithErrorhangs in this dev environment because the test helper starts a realonwatch(found via PATH) and blocks forever on its output pipe. It fails identically with and without a repo-local binary, and involves no code touched by this PR.