feat(mistral): add subscription allowance and PAYG tracking for Mistral Vibe. - #138
Conversation
Track included API and Vibe Code allowances alongside separate pay-as-you-go spend. Support automatic browser-session import and manual cookies, with browser-folder access through the macOS menu bar. Add dashboard and menu bar reporting, configurable PAYG visibility, source-partitioned history, retention, and stale-data indicators. Handle partial endpoint failures without interrupting working allowance polling, and apply SQLite pragmas to pooled connections. Include regression tests and setup documentation.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
There are a few intentional differences between this implementation and the existing providers.
The browser-cookie importer is compiled into the binary, so enabling Mistral does not install anything. Manual-cookie mode avoids browser-profile and credential-store access. Let me know if any of this is an issue. Automatic Chrome import and both allowance values have been tested on macOS. Live non-zero PAYG reporting is still unverified because the billing endpoint returned HTTP 500 even in an authenticated browser session. Other platforms and the native Nix build still need testing. |
|
Thanks for this, it's a really careful piece of work. The fail-closed parsing, the cookie scoping to mistral.ai, and the notes on intentional differences made it easy to review. Tests pass locally with One small change before we merge: A possible approach: the tray already fetches a Everything else looks good. We'll mark Mistral as beta in the docs after merge until more people have tried it on other platforms. |
Codecov flagged 0% coverage on readMistralSafariScopes, the hand-rolled Cookies.binarycookies parser, and on the Mistral tracker's Process/onReset path. Adds a synthetic binary-cookie fixture builder to exercise the parser's bounds checks (truncated/malformed input must fail closed with ErrMistralAuth) plus tracker, MistralCycleOverview, and CookieNames tests.
watchBrowserAccess listed Chrome/Edge/Firefox data folders every 2 minutes and could show "Grant Browser Access..." for every tray user, regardless of whether Mistral was enabled. Adds an explicit mistral_enabled flag to the menubar snapshot (a provider card only appears there after its first successful poll, so checking for a mistral card would hide the grant item exactly when it's needed) and gates the probe on it.
# Conflicts: # README.md
|
Thanks ! Went with the explicit mistral_enabled flag - confirmed the provider card doesn't appear in the snapshot until the first successful poll, so the base_provider check would've hidden the grant item exactly when it's needed, as you suspected. watchBrowserAccess now skips the folder probe and keeps the item hidden until the flag is set, and it re-checks live so it picks up Mistral being enabled without a tray restart. Also merged in main to pick up #136 and resolved the resulting README conflict. |
prakersh
left a comment
There was a problem hiding this comment.
Thanks, the explicit mistral_enabled flag is the right call. Approving.
Track included API and Vibe Code allowances (from subscription), alongside separate pay-as-you-go spend.
Support automatic browser-session import and manual cookies, with browser-folder access through the macOS menu bar.
Add dashboard and menu bar reporting, configurable PAYG visibility, source-partitioned history, retention, and stale-data indicators.
Handle partial endpoint failures without interrupting working allowance polling, and apply SQLite pragmas to pooled connections.
Include regression tests and setup documentation.