Skip to content

feat: add Muse (Meta) provider - #2936

Open
toml0006 wants to merge 20 commits into
steipete:mainfrom
toml0006:feat/muse-provider
Open

feat: add Muse (Meta) provider#2936
toml0006 wants to merge 20 commits into
steipete:mainfrom
toml0006:feat/muse-provider

Conversation

@toml0006

@toml0006 toml0006 commented Aug 14, 2026

Copy link
Copy Markdown

Summary

Adds native Muse (Meta) support to CodexBar — previously un-tracked. Muse's Meta Model API (https://api.meta.ai, model muse-spark-1.1, pricing $1.25/$4.25 per 1M) had no provider; users proxying via OpenRouter paid the 5.5% credit fee and lost direct visibility.

Provider design

  • Auth: API key via MUSE_API_KEY / META_API_KEY / META_MUSE_API_KEY env or ~/.codexbar/config.json (muse apiKey). Projects to MUSE_API_KEY for CLI (codexbar usage --provider muse).
  • Base URL: default https://api.meta.ai, overridable via Settings → Providers → Muse → API base URL or MUSE_API_URL (enables LiteLLM/self-hosted proxies while keeping visibility). Validated via ProviderEndpointOverrideValidator().validatedURLAllowingLoopbackHTTP — requires https://, allows only http://localhost/127.0.0.1/::1 for local proxy, rejects user info (user:pass@host), encoded host delimiters (%2f/%40 etc.), missing/unsafe hosts, before sending Authorization: Bearer. Covered by focused tests.
  • Fetch: MuseAPIFetchStrategy (.api only) → MuseUsageFetcher:
    1. Best-effort billing probe in order: /v1/billing/usage, /v1/me/balance, /v1/billing/subscription, /v1/credits — flexible JSON parser handles available_balance/balance/total_balance (string or number) in root or data envelope. Rejects currency-only payloads (requires numeric balance).
    2. Fallback to GET /v1/models validation — returns API key valid · N models available when billing is not yet exposed. Both paths use Authorization: Bearer <key>, 15s timeout, 404 tries next, 401/403 surfaces as invalid key (models-probe 401 now takes precedence over stale billing lastError). Rejects malformed {} with parseFailed: Models response missing data/models array instead of incorrectly reporting API key valid.
  • Snapshot: balanceOnly: true (identity-only, no rate windows) — pay-as-you-go API, consistent with Moonshot/DeepSeek billing-only providers.
  • UI: Settings fields for API key (secure) + base URL (plain), dashboard link to https://ai.developer.meta.com/. Branding: Meta blue #0064E0, confetti [#0064E0, #0469FF, #7B61FF], icon ProviderIcon-muse.svg. Added museBalanceDisplayText + menuBarDisplayText branch for .muse so balance renders (mirrors moonshot/poe).

Files

  • Sources/CodexBarCore/Providers/Muse/MuseProviderDescriptor.swift — descriptor + MuseAPIFetchStrategy + ProviderConfig.baseURL extension (now public)
  • Sources/CodexBarCore/Providers/Muse/MuseUsageFetcher.swift — HTTP + parsers for balance + models count, shared validator, preserved 401 handling, malformed {} rejection
  • Sources/CodexBarCore/Providers/Muse/MuseSettingsReader.swift — env resolution for keys + base URL
  • Sources/CodexBarCore/Providers/Muse/MuseProviderSettings.swiftMuseProviderSettings + MuseProviderSettingsKey
  • Sources/CodexBar/Providers/Muse/MuseProviderImplementation.swift — UI hooks, availability, settings fields
  • Sources/CodexBar/Providers/Muse/MuseSettingsStore.swiftSettingsStore extension for token + baseURL
  • Sources/CodexBar/Resources/ProviderIcon-muse.svg — icon
  • Sources/CodexBar/StatusItemController+Animation.swiftmuseBalanceDisplayText + menu-bar branch, plus // Provider-specific by design for expanded mistral+kiro+cursor cluster
  • docs/muse.md — provider docs (data sources, endpoints, key files, CLI)
  • docs/providers.md — added Muse row + detailed section (70 providers total)
  • Sources/CodexBarCore/Providers/Providers.swiftcase muse
  • Regenerated: ProviderManifest.swift, ProviderImplementationManifest.swift, ProviderInstanceIDAliases.generated.swift, docs/provider-ids.md via Scripts/regenerate-provider-manifests.sh
  • Updated counts: README.md, docs/social.html, docs/llms.txt, docs/index.html, docs/site-locales.mjs (69->70) per check-site-locales.mjs
  • Tests/CodexBarTests/ProviderArchitectureGatekeeperTests.swift — updated widgetFingerprint/burnDownFingerprint and balanceOnly + allowlisted cluster (mistral@0,kiro@9,cursor@17 at 924)
  • Tests/CodexBarTests/MuseUsageFetcherTests.swift — 15 tests: balance shapes, currency-only rejection, models count, malformed {}, Bearer header, https guard, user-info/encoded/missing-host rejection, http localhost allowed, 401 precedence, balance 200 preferred

Verification

  • make checkPASS (0 violations, 0 serious in 1882 files)
  • swift build — pass
  • swift test --filter ProviderArchitectureGatekeeper38/38 pass
  • swift test --filter MuseUsageFetcherTests15/15 pass
  • Scripts/regenerate-provider-manifests.sh --checkProvider manifests are current (70 providers)

Follow-ups

Meta billing endpoint is not publicly documented in ai.developer.meta.com/docs; parser is intentionally lenient and the models-probe fallback guarantees the provider is useful on day one.

Fixes: adds Muse alongside existing openrouter/litellm options so users no longer need to pay OpenRouter 5.5% just for visibility.

Contribution guide compliance

  • Followed provider authoring guide: UsageProvider case, descriptor in CodexBarCore, implementation in CodexBar, regenerate-provider-manifests.sh, icon, widgetSelectable false, focused tests, docs/muse.md + docs/providers.md entry
  • Ran make check (SwiftFormat + SwiftLint) — 0 violations
  • No Keychain/browser-cookie live probes — offline parser/stub tests only

- Adds UsageProvider.muse with API-key auth (MUSE_API_KEY / META_API_KEY / META_MUSE_API_KEY)
- Balance-only provider with flexible billing probe (billing/usage, me/balance, credits) falling back to /v1/models validation
- Supports custom base URL via MUSE_API_URL or Settings for proxies/self-hosted gateways
- Registers descriptor, fetch strategy, settings UI, icon, and docs/muse.md
- Regenerates manifests (ProviderManifest, ProviderImplementationManifest, provider-ids)

Fixes: Muse API not visible in CodexBar. Pricing is $1.25/4.25 per 1M tokens via api.meta.ai; this provider validates the key and shows balance where the API exposes it.
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

- widgetFingerprint 16873014858015536126 -> 1384715300343528903
- burnDownFingerprint 8686456525451224704 -> 5817880812814024010
- balanceOnly set now includes .muse alongside deepseek/deepinfra/mistral/moonshot/poe
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 14, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3bc93d6c2d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

widgetSelectable: false,
isPrimaryProvider: false,
usesAccountFallback: false,
balanceOnly: true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update the balance-only gatekeeper set

Setting balanceOnly here adds .muse to descriptors.filter(\.metadata.balanceOnly), but ProviderArchitectureGatekeeperTests.swift:196-198 still asserts the exact set without Muse, so the full test suite will deterministically fail. Update that fixture and add focused Muse coverage alongside the new provider.

AGENTS.md reference: AGENTS.md:L20-L24

Useful? React with 👍 / 👎.

Comment on lines +57 to +60
primary: nil,
secondary: nil,
tertiary: nil,
providerCost: nil,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Expose the Muse balance to the menu-bar renderer

When a billing endpoint returns a balance, this snapshot leaves all rate/detail fields nil and stores the value only in identity.loginMethod. StatusItemController.menuBarDisplayText has explicit extraction branches for every existing balance-only provider but none for .muse, so it falls through with no percent window and returns no balance text when Muse is selected in the menu bar. Add a Muse balance extractor or represent the balance in a field consumed by the generic renderer.

Useful? React with 👍 / 👎.

Comment on lines +138 to +140
} catch {
if let last = lastError { throw last }
throw error

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve authentication errors from the models probe

If any speculative billing endpoint first returns a non-404 error or an unparseable 2xx response, lastError is populated; if the authoritative models probe then returns 401/403, this catch discards its explicit “invalid API key” error and reports the stale billing error instead. This misdiagnoses invalid credentials whenever an earlier optional billing probe failed, so authentication errors from the fallback probe should take precedence.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed August 26, 2026, 2:33 AM ET / 06:33 UTC.

ClawSweeper review

What this changes

This PR adds a Meta Muse provider with direct API balance/model checks and optional dev.meta.ai Team-usage retrieval.

Merge readiness

⚠️ Needs maintainer review before merge - 6 items remain

Keep open: the latest commit resolves the prior web-only availability blocker, but API-key users still cannot select the implemented Off mode to prevent automatic browser-session imports.

Priority: P1
Reviewed head: 138c5d8af3fef3b1cecb11e0fb1cb0e7144a7d68

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The real provider trace is strong, but the hidden opt-out creates a merge-blocking browser-session boundary defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): A contributor comment includes redacted live terminal output demonstrating successful Muse web usage retrieval; the latest availability-only change also has focused coverage.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): A contributor comment includes redacted live terminal output demonstrating successful Muse web usage retrieval; the latest availability-only change also has focused coverage.
Evidence reviewed 5 items Prior blocker resolved: The current head now treats configured automatic or manual web mode as available without importing cookies during availability checks.
Automatic web path precedes API fallback: In auto mode the descriptor runs the web strategy before the API strategy; the web strategy can import a Chrome session when no cached header exists.
Off mode is implemented but hidden: The provider has explicit off-mode handling, but its settings picker passes allowsOff: false, leaving Auto and Manual as the only UI choices.
Findings 2 actionable findings [P1] Let API-only users disable automatic cookie imports
[P3] Document the actual automatic-import browser
Security Needs attention Automatic cookie import has no exposed opt-out: Muse supports an Off source internally, but the picker hides it while Auto precedes API fetching; this expands browser-session access beyond users who only configured an API key.

How this fits together

CodexBar turns provider credentials or browser sessions into usage snapshots, then shows those snapshots in the menu bar and provider settings. Muse adds a web-dashboard path plus a direct Meta API fallback to that shared provider pipeline.

flowchart LR
A[Provider settings] --> B[Muse source selection]
B --> C[Dashboard session fetch]
B --> D[Meta API probe]
C --> E[Usage snapshot]
D --> E
E --> F[Menu bar and settings views]
Loading

Before merge

  • Let API-only users disable automatic cookie imports (P1) - This picker exposes only Auto and Manual even though the provider implements .off. In the app's default Auto mode, Muse runs the web strategy before the API strategy and can import Chrome session data, so a user who configured only an API key has no in-product way to keep refreshes API-only. Expose Off here and add picker-level coverage.
  • Document the actual automatic-import browser (P3) - The documentation promises Chrome/Safari automatic import, but the descriptor and focused test restrict Muse automatic import to Chrome. Update this line so Safari users are not directed to a flow the provider does not implement.
  • Resolve security concern: Automatic cookie import has no exposed opt-out - Muse supports an Off source internally, but the picker hides it while Auto precedes API fetching; this expands browser-session access beyond users who only configured an API key.
  • Resolve merge risk (P1) - Until Off is exposed in settings, enabling Muse with an API key can still trigger automatic Chrome-session import on refresh.
  • Resolve merge risk (P1) - GitHub reports the PR head as dirty against its base, so the rebased result needs a fresh review before merge.
  • Complete next step (P2) - The remaining blockers are a narrow settings exposure repair and matching documentation correction.

Findings

  • [P1] Let API-only users disable automatic cookie imports — Sources/CodexBar/Providers/Muse/MuseProviderImplementation.swift:54-56
  • [P3] Document the actual automatic-import browser — docs/muse.md:23
  • [medium] Automatic cookie import has no exposed opt-out — Sources/CodexBar/Providers/Muse/MuseProviderImplementation.swift:55
Agent review details

Security

Needs attention: The PR safely filters imported cookies, but its settings UI does not let API-key users disable automatic browser-session access.

Review metrics

Metric Value Why it matters
Patch scope 26 files, +2,227 / -86 lines This provider addition crosses credential handling, browser-session retrieval, menu rendering, tests, and public docs.

Merge-risk options

Maintainer options:

  1. Make browser-session import optional (recommended)
    Expose the existing Off mode for Muse and cover the API-key-only path before rebasing the PR.
  2. Accept mandatory automatic import
    Keep Auto and Manual as the only settings choices, explicitly accepting that API-key users may also have Chrome session data read during refresh.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Expose Muse's existing Off cookie-source option, add picker-level coverage for API-only mode, correct the browser-import documentation, and rebase before merge.

Technical review

Best possible solution:

Expose an API-only/Off cookie-source choice, keep Chrome import explicitly optional, then rebase and verify both API-only and session-backed refreshes.

Do we have a high-confidence way to reproduce the issue?

Yes (source-reproducible): the settings picker excludes Off while auto mode runs web before API and can import Chrome cookies; no live account access was used in this review.

Is this the best way to solve the issue?

No: the provider already implements Off handling, so exposing that mode is the narrowest way to preserve an API-only flow without redesigning the fetch pipeline.

Full review comments:

  • [P1] Let API-only users disable automatic cookie imports — Sources/CodexBar/Providers/Muse/MuseProviderImplementation.swift:54-56
    This picker exposes only Auto and Manual even though the provider implements .off. In the app's default Auto mode, Muse runs the web strategy before the API strategy and can import Chrome session data, so a user who configured only an API key has no in-product way to keep refreshes API-only. Expose Off here and add picker-level coverage.
    Confidence: 0.97
  • [P3] Document the actual automatic-import browser — docs/muse.md:23
    The documentation promises Chrome/Safari automatic import, but the descriptor and focused test restrict Muse automatic import to Chrome. Update this line so Safari users are not directed to a flow the provider does not implement.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against dfc176cdf945.

Labels

Label changes:

  • add merge-risk: 🚨 security-boundary: Merging preserves a browser-cookie access path without exposing its implemented opt-out control to users.
  • remove merge-risk: 🚨 auth-provider: Current PR review merge-risk labels are merge-risk: 🚨 security-boundary.

Label justifications:

  • P1: The current settings UI prevents API-only users from opting out of automatic browser-session import.
  • merge-risk: 🚨 security-boundary: Merging preserves a browser-cookie access path without exposing its implemented opt-out control to users.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): A contributor comment includes redacted live terminal output demonstrating successful Muse web usage retrieval; the latest availability-only change also has focused coverage.
  • proof: sufficient: Contributor real behavior proof is sufficient. A contributor comment includes redacted live terminal output demonstrating successful Muse web usage retrieval; the latest availability-only change also has focused coverage.

Evidence

Security concerns:

  • [medium] Automatic cookie import has no exposed opt-out — Sources/CodexBar/Providers/Muse/MuseProviderImplementation.swift:55
    Muse supports an Off source internally, but the picker hides it while Auto precedes API fetching; this expands browser-session access beyond users who only configured an API key.
    Confidence: 0.97

Acceptance criteria:

  • [P1] swift test --filter MuseProviderImplementationTests.
  • [P1] swift test --filter MuseCookieImporterTests.
  • [P1] make check.

What I checked:

  • Prior blocker resolved: The current head now treats configured automatic or manual web mode as available without importing cookies during availability checks. (Sources/CodexBar/Providers/Muse/MuseProviderImplementation.swift:30, 138c5d8af3fe)
  • Automatic web path precedes API fallback: In auto mode the descriptor runs the web strategy before the API strategy; the web strategy can import a Chrome session when no cached header exists. (Sources/CodexBarCore/Providers/Muse/MuseProviderDescriptor.swift:82, 138c5d8af3fe)
  • Off mode is implemented but hidden: The provider has explicit off-mode handling, but its settings picker passes allowsOff: false, leaving Auto and Manual as the only UI choices. (Sources/CodexBar/Providers/Muse/MuseProviderImplementation.swift:54, 138c5d8af3fe)
  • Real behavior evidence: The contributor supplied a redacted live terminal transcript showing a successful dev.meta.ai GraphQL-backed Muse web fetch and usage snapshot.
  • Current-main comparison limitation: The local checkout is a promisor clone and resolving the PR base/current-main objects required a GitHub fetch that failed DNS resolution; this review therefore does not claim a complete current-main diff.

Likely related people:

  • steipete: The repository owner is the best available routing point for a new credential-bearing provider; retained local history was insufficient to establish a more specific main-branch area owner. (role: repository owner and likely provider-surface reviewer; confidence: low; files: Sources/CodexBar/ProviderRegistry.swift, Sources/CodexBarCore/Providers/ProviderCredentialAdapter.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Expose the existing Off mode and add picker-level regression coverage.
  • Rebase the dirty head and refresh the focused validation on the merge result.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (19 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-15T13:39:14.740Z sha df97861 :: needs real behavior proof before merge. :: [P1] Filter imported cookies before building the Muse header | [P2] Decode Relay arrays before requiring a dictionary
  • reviewed 2026-08-15T13:45:45.003Z sha 6453493 :: needs real behavior proof before merge. :: [P1] Filter imported cookies before building the Muse header | [P2] Parse Relay array responses before casting the root | [P2] Default automatic imports to Chrome only
  • reviewed 2026-08-15T13:58:27.852Z sha ddc68d3 :: needs real behavior proof before merge. :: [P1] Filter imported cookies before building the Muse header | [P2] Default automatic imports to Chrome only
  • reviewed 2026-08-15T14:09:43.630Z sha d6625fa :: needs real behavior proof before merge. :: [P1] Filter imported cookies before building the Muse header | [P2] Restrict automatic cookie imports to Chrome
  • reviewed 2026-08-15T20:14:24.742Z sha a8a8f31 :: needs changes before merge. :: [P1] Preserve browser cookie isolation | [P2] Default automatic import to Chrome | [P3] Document the implemented GraphQL source
  • reviewed 2026-08-16T13:46:11.215Z sha 05aa359 :: found issues before merge. :: [P1] Preserve browser cookie isolation | [P2] Default automatic Muse imports to Chrome
  • reviewed 2026-08-21T21:50:10.447Z sha 5556c11 :: found issues before merge. :: [P1] Preserve browser cookie scope when building the header | [P1] Remove HAR-derived request state from the GraphQL body
  • reviewed 2026-08-24T22:46:06.506Z sha b284ee8 :: found issues before merge. :: [P1] Allow web-only Muse sessions to enable the provider

…uard

- P1: add museBalanceDisplayText and menuBarDisplayText branch for .muse so balance/probe result from loginMethod is rendered (mirrors moonshot/poe). Fixes empty menu-bar text.
- P2: preserve authoritative 401/403 from /v1/models probe over stale billing lastError.
- P2/security: validate base URL — require https, allow only http://localhost/127.0.0.1/::1 for local proxy, reject insecure hosts before sending Bearer token.
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 14, 2026
- StatusItemController+Animation.swift:923 now clusters mistral+kiro+cursor (3) instead of kiro+cursor (2) after inserting muse branch at 917; add Provider-specific by design comment to justify the expanded window.
- Tests: update AllowedProviderConstruct at 926->923, anchor kiro->mistral, fingerprint [kiro@0,cursor@8]/2 -> [mistral@0,kiro@9,cursor@17]/3. Gatekeeper now 38/38 pass.
@toml0006

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Aug 14, 2026
- parseModelsCount now throws parseFailed when data/models array is missing instead of returning nil and incorrectly reporting 'API key valid'.
- ClawSweeper auth-provider finding: prevents {} from being accepted as successful validation.
- MuseUsageFetcher: require numeric balance for billing success (currency-only now correctly falls through to models probe instead of false 'API key valid'). Fixes P2 at 253-254.
- Tests: add MuseUsageFetcherTests (12 cases) covering balance parsing, empty/currency-only rejection, models count and rejection of {} / missing array, Bearer/Accept/timeout headers, https guard (evil.com blocked, localhost allowed), 401 precedence over 500, balance preferred over fallback, and missing key. Provides controlled-transport coverage for the 319-line fetcher.
- README, docs/providers.md, docs/social.html, docs/llms.txt,
  docs/index.html, docs/site-locales.mjs: 69 -> 70 providers
  after Muse addition (check-site-locales.mjs requires exact count)
- docs/providers.md: add Muse table row + detailed section
- MuseUsageFetcher: refactor Generic decode + fallback scan to
  nil-coalescing to satisfy statement_position lint, fix
  multiline_parameters for fetchBalance
- MuseProviderDescriptor: split noDataMessage for line_length
- MuseSettingsReader: explicit self (redundantSelf)
- MuseUsageFetcherTests: fix encoded delimiter test to use %2F
  (hostHasNoEncodedDelimiters only rejects %2f/%40 etc, not %2e),
  fix fatalError message
- ProviderArchitectureGatekeeperTests: line 923->924 after
  comment wrap (line_length) shifted mistral anchor
- StatusItemController+Animation: comment wrap from swiftformat

make check: PASS (0 violations), swift build PASS,
swift test MuseUsageFetcherTests 15/15 PASS,
ProviderArchitectureGatekeeper 38/38 PASS
@toml0006

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Aug 14, 2026
Replace generic total_tokens search with parseTeamUsage that
sums categorical_data for num_requests/num_prompt_tokens/
num_completion_tokens/usage_billable_cost (amount_with_offset
cents->dollars) per verified 2026-08-15 GraphQL response
(4814 req / 589M prompt / .59). Produces Team usage
snapshot with cost.
@toml0006
toml0006 force-pushed the feat/muse-provider branch from ff10147 to ddc68d3 Compare August 15, 2026 13:53
Manual cookie (llm_sess+datr) harvests no team_id/fb_dtsg
from HTML, causing 1357004. Use verified HAR fallbacks
swTyN9fDdqKU_GTgO9R99v / NAfztM7dBcJpLZ... for GraphQL.
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 15, 2026
@toml0006

Copy link
Copy Markdown
Author

Verified via dev.meta.ai GraphQL (no OpenRouter proxy):

```
$ /tmp/codexbar-work/CodexBar/.build/debug/CodexBarCLI usage --provider muse -v
[muse] fetch strategies:

  • muse.web (web) available == Muse (web) == Cost: 4.8 / 4.8 Plan: Team Usage: 5116 Requests · 625878445 Tokens · $4.80

$ curl https://dev.meta.ai/api/graphql/ -b "datr=...; llm_sess=..." --data-raw "doc_id=27710687895239709&variables={"team_id":"3747295692075251",...}"
→ 9241 bytes {"data":{"team":{"requests_metrics":[{"identifier":"num_requests","categorical_data":[{"category":"2026-08-15","value":243}]}],"input_token_metrics":...,"spend_cost_metrics":[{"identifier":"usage_billable_cost","value":{"amount_with_offset":"32"}}]}}}
→ summed 5116 req / 625M tokens / $4.80 (was 4814 / 593M / $4.59)

$ codexbar config dump --show-secrets | grep muse
→ enabled:true cookieSource:manual cookieHeader:datr=...; llm_sess=FojGt5%2B... (Manual header from HAR, with fallback fb_dtsg=NAfztM7... / lsd=swTyN9fD...)
```

Fallback remains GET https://api.meta.ai/v1/modelsApi Key Valid · 3 Models when no session. Widget snapshot Y5PE65HELJ.com.steipete.codexbar/widget-snapshot.json now muse Team usage with providerCost.

Branch feat/muse-provider at d6625faca (fixes: facebook.com cookieDomains, robust team_id regex, LLMD-C categorical_data parser, fallback DTSG/LSD).

Build dailyPoints from categorical_data (prompt+output tokens
+ cost per day) and expose as ProviderDetailSection Daily
usage table in UsageSnapshot.details for the Muse detail
sheet.
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 15, 2026
Use UsageFormatter.tokenCountString for tokens (623M vs
622576992) and NumberFormatter decimal/currency for requests
and cost per Locale.current. Applies to main snapshot,
fallback parseUsageAPI and daily detail rows.
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 16, 2026
- Cookie isolation: filter imported cookies to dev.meta.ai destination
  URL (domain/path/secure) per RFC 6265, avoiding cross-origin
  forwarding of unrelated facebook.com cookies to dev.meta.ai
- Default automatic import to Chrome only (P2), matching repo policy
  AGENTS.md:48 and other browser-web providers
- Add MuseCookieImporterTests covering P1/P2 regressions

Addresses ClawSweeper P1/P2 on PR steipete#2936 (05aa359)
@toml0006

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

- Scope: filter BrowserCookieRecord by scope before converting to HTTPCookie,
  hostOnly cookies only sent to exact host (dev.meta.ai), domain cookies
  allow suffix. Preserves BrowserCookieRecord.scope per ZoomMate precedent
  and SweetCookieKit 0.5.2. Adds isSendable/isPathApplicable and hostOnly
  regression test.
- Web: remove hard-coded HAR fallback LSD/DTSG and Comet params (av,
  __rev, __hs etc) from MuseWebUsageFetcher GraphQL body. Only use
  tokens extracted from active HTML session; otherwise omit and fall
  back to API probe per review.

Addresses ClawSweeper P1s on PR steipete#2936 (5556c11) - scope + HAR.
@toml0006

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Aug 24, 2026
- isAvailable now checks configured web mode (auto/manual) without
  importing browser cookies, so a user with dev.meta.ai session but
  no API key is not hidden before MuseWebFetchStrategy runs.
- Adds MuseProviderImplementationTests covering auto/manual/off.

Addresses ClawSweeper P1 on PR steipete#2936 (b284ee8) - web-only availability.
@toml0006

Copy link
Copy Markdown
Author

@clawsweeper re-review

fix(muse): allow web-only sessions to enable provider (138c5d8) — isAvailable now respects configured cookie source (auto/manual) without importing browser cookies, so a user with dev.meta.ai session but no API key is not hidden before MuseWebFetchStrategy runs. Added MuseProviderImplementationTests (5 cases). Lint fix (blankLinesBetweenImports). Pushed b284ee8..138c5d8.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. and removed merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. labels Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P1 Urgent regression or broken agent/channel workflow affecting real users now. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants