Repository navigation
Conversation
…no#205) New `mistral` provider polling api.mistral.ai for both the Vibe CLI and Mistral Studio (La Plateforme): - Credentials: MISTRAL_API_KEY environment variable, then the `mistral:vibe-api-key` generic credential in Windows Credential Manager. - Session row: x-ratelimit-* headers from GET /v1/models. - Long row: calendar-month spend in EUR from GET /v1/billing/usage against monthly_budget from GET /v1/billing/subscription, labelled 30d and resetting at midnight UTC on the 1st. Billing routes the key cannot read (403/404) are skipped without failing the poll. - Wiring: provider descriptor (native menu command 69), poller registration, show_mistral setting key, context-menu entry, translations for the 14 bundled locales, brand mark at U+F008 in brand-marks.ttf (Simple Icons, CC0-1.0), and Mistral layers in the three bundled themes. Checks not run here: cargo fmt/test/build require Windows. The build.rs locale validation was replicated in Python (key parity, placeholders), themes were revalidated as JSON, and every exhaustive match on ProviderId was audited by grep. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
…pectations (CodeZeno#205) - Build the UsageData with an early return instead of matching on (bool, Option), which did not type-check. - Drop a u64 -> u64 cast flagged by clippy in days_from_civil. - Update classic theme expectations for the eighth provider: widget width with all providers 725 -> 815, tray-icon surface count 8 -> 9, and the long-window-only segment layers 30 -> 32 in the round-trip test. - Recolour the Mistral tray fill in classic-vertical to the same Mistral orange used in the other bundled themes so the tray roots match the starter theme. - Apply cargo fmt. Verified with cargo fmt --check, cargo check/clippy --target x86_64-pc-windows-gnu --all-targets, and the full test suite (631 tests) run under wine: 620 pass; the 5 remaining failures are identical on unpatched main and are wine environment limits (Segoe UI metrics, shim execution, window lifecycle, winsqlite3 stub). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
|
Checks run locally (Linux sandbox, cross-compiled to
Not run here: |
|
Closing this: after probing the live API with a standard Mistral API key, there is no usage data the monitor can read reliably.
The remaining options are either the Enterprise-only Admin API (response fields not documented) or the undocumented console endpoint behind a browser session cookie. Neither is a good fit for a provider that should work out of the box, so I'm dropping this rather than shipping a provider that shows nothing. Happy to revisit if Mistral exposes usage to standard API keys or to the Vibe CLI login. |
Summary
Implements the new Mistral provider requested in #205, covering both the Vibe CLI and Mistral Studio (La Plateforme console) with one API key.
MISTRAL_API_KEYenvironment variable first, then amistral:vibe-api-keygeneric credential in Windows Credential Manager — the secret never lands insettings.json. Keys are header-safety-checked and only ever logged as hashes (credential watch).x-ratelimit-*headers fromGET https://api.mistral.ai/v1/models(requests, falling back to tokens), withx-ratelimit-reset-*parsed as seconds or a duration string for the reset time.30d): calendar-month spend in EUR summed fromGET /v1/billing/usage(data[].total_cost, filtered to entries overlapping the current UTC month), measured againstmonthly_budgetfromGET /v1/billing/subscription; resets at midnight UTC on the 1st. Billing routes the key cannot read (403/404) are skipped so the rate-limit window still shows.ProviderId::Mistraldescriptor (keymistral, native menu command 69), poller registration inPROVIDER_POLLERS,show_mistralsettings key, classic context-menu entry, translations for all 14 bundled locales, brand mark at U+F008 inbrand-marks.ttf(Mistral AI mark from Simple Icons, CC0-1.0, geometry per the documented 958-unit convention), and Mistral layers cloned into the three bundled themes with Mistral orange accents (tray fill, pool segments, vertical titles with >= 4.5:1 contrast).src/poller/mistral.rsfor month-boundary spend summing, budget percentage and year-wrapping reset, rate-limit header mapping, reset-duration parsing, key header-safety, and the civil-date algorithms. Existing exhaustive matches (ProviderId::ALLarms in poller/theme tests, settings round-trip, context-menu contents, vertical-theme height rule) were updated.Testing
cargo test --lockedrequires a Windows host (the crate targets Win32/MSVC) and none was available for this change — please run the test suite on Windows or let CI do it before merging.cargo build --locked --releaseand the Windows VM scripts (tests/windows-vm) were not run either; they also need a real Windows host.x86_64-pc-windows-gnu):cargo fmt --all -- --check,cargo check --all-targets --locked,cargo clippy --all-targets --locked,cargo audit --file Cargo.lock,cargo deny --locked check— all clean, no new warnings.build.rslocale validation in Python across all 14 locales (key parity, non-empty values, placeholder parity — passes); themes revalidated as JSON with the copilot layers byte-identical to HEAD and everymistral.*binding matching the copilot binding set; all exhaustivematches onProviderIdaudited by grep; brand-mark font re-parsed with fontTools (cmap U+F008 -> uniF008, advance 1000, non-blank outline).Checklist