Skip to content

feat: add Muse (Meta) provider - #2936

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

feat: add Muse (Meta) provider#2936
toml0006 wants to merge 19 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: found issues before merge. Reviewed August 24, 2026, 6:46 PM ET / 22:46 UTC.

ClawSweeper review

What this changes

Adds a Meta Muse provider with API-key balance/model checks and optional dev.meta.ai Team-usage retrieval from browser-session cookies.

Merge readiness

⚠️ Needs maintainer review before merge - 5 items remain

Keep open: the web-only setup described by this PR is blocked by the app availability gate, so an enabled Muse provider with a valid dev.meta.ai session but no API key is hidden before its web strategy can run. The feature also needs a maintainer decision on retaining the undocumented dashboard path.

Priority: P1
Reviewed head: b284ee82152bee1462feb823d2596c06ed423a6f
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The branch has credible live evidence and careful credential-boundary work, but the cookie-only UI path is currently broken.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The contributor supplied redacted terminal output from a direct Meta dashboard fetch with observed Team-usage results; redact cookies and session identifiers in any further evidence.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The contributor supplied redacted terminal output from a direct Meta dashboard fetch with observed Team-usage results; redact cookies and session identifiers in any further evidence.
Evidence reviewed 7 items Web-only availability defect: The Muse implementation reports unavailable unless an API key is present, despite the configured manual/automatic cookie-backed web flow.
Activation path: Enabled providers are filtered through isProviderAvailable, so the false result prevents refresh of the web strategy.
Documented web path: The descriptor selects the web strategy in auto/web mode before the API strategy, and that strategy accepts manual or automatically imported cookies.
Findings 1 actionable finding [P1] Allow web-only Muse sessions to enable the provider
Security None None.

How this fits together

CodexBar provider implementations decide whether configured providers are enabled, then fetch usage snapshots for the menu bar. Muse adds both API-key requests and a cookie-backed Meta dashboard request to that flow.

flowchart LR
A[API key or browser session] --> B[Muse provider]
B --> C[Availability gate]
C --> D[Meta API or dashboard fetch]
D --> E[Usage snapshot]
E --> F[Menu bar display]
Loading

Decision needed

Question Recommendation
Should CodexBar adopt the full dual-source Muse provider, including the reverse-engineered dev.meta.ai Team-usage probe, or limit the feature to API-key support? Sponsor the dual-source provider: Keep both API and dashboard paths, after fixing cookie-only availability and resolving the current merge conflict.

Why: The API path is conventional, but the dashboard path relies on an undocumented browser-session request and materially expands the provider’s long-term support boundary.

Before merge

  • Allow web-only Muse sessions to enable the provider (P1) - UsageStore.isEnabled filters enabled providers through this method, but this method only accepts an API key. A user following the documented Auto/Manual dev.meta.ai setup without an API key therefore never reaches MuseWebFetchStrategy; treat the configured web mode as available and add a regression test.
  • Resolve merge risk (P1) - Cookie-only Muse users cannot use the documented Team-usage path until the availability gate accepts the web authentication mode.
  • Resolve merge risk (P1) - GitHub currently reports the branch as dirty against main, so it needs a rebase/conflict-resolution review before landing.
  • Complete next step (P2) - The P1 repair is clear, but the maintainer must choose the long-term dashboard-support boundary and the current branch is dirty against main.

Findings

  • [P1] Allow web-only Muse sessions to enable the provider — Sources/CodexBar/Providers/Muse/MuseProviderImplementation.swift:30-35
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Change size 25 files affected; production/docs +1,692/-78, tests +400/-8 The new provider spans UI, credentials, web transport, generated registries, documentation, and focused tests.

Merge-risk options

Maintainer options:

  1. Enable valid web-session setups (recommended)
    Treat the configured Muse web mode as available and add coverage proving an enabled cookie-only provider reaches the web strategy.
  2. Reduce to API-only support
    Remove the dashboard session path if maintainers do not want to support its undocumented authentication contract.

Technical review

Best possible solution:

Make availability reflect the configured web mode without reading browser cookies during the check, add a regression test for a cookie-only setup, then rebase after a maintainer decides whether the undocumented dashboard integration belongs in the product.

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

Yes, source-reproducible: enable Muse with a manual or automatic dev.meta.ai session but no API key; the availability override returns false and UsageStore hides the provider before web fetching.

Is this the best way to solve the issue?

No: the current implementation contradicts its web-first design. Availability should accept the configured web mode without triggering a browser import, with a focused regression test.

Full review comments:

  • [P1] Allow web-only Muse sessions to enable the provider — Sources/CodexBar/Providers/Muse/MuseProviderImplementation.swift:30-35
    UsageStore.isEnabled filters enabled providers through this method, but this method only accepts an API key. A user following the documented Auto/Manual dev.meta.ai setup without an API key therefore never reaches MuseWebFetchStrategy; treat the configured web mode as available and add a regression test.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review merge-risk labels are merge-risk: 🚨 auth-provider.

Label justifications:

  • P1: A valid cookie-only configuration is hidden before the documented web usage path can run.
  • merge-risk: 🚨 auth-provider: The PR introduces both API-key and browser-session authentication paths, and the current availability gate rejects one supported path.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The contributor supplied redacted terminal output from a direct Meta dashboard fetch with observed Team-usage results; redact cookies and session identifiers in any further evidence.
  • proof: sufficient: Contributor real behavior proof is sufficient. The contributor supplied redacted terminal output from a direct Meta dashboard fetch with observed Team-usage results; redact cookies and session identifiers in any further evidence.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Feature-history sampling shows the strongest contribution history across the provider implementation and availability framework used by this change. (role: long-running app/core contributor; confidence: medium; commits: 061593ca15d9; files: Sources/CodexBar/UsageStore.swift, Sources/CodexBar/Providers/Shared/ProviderImplementation.swift)

Rank-up moves

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

  • Fix the availability gate and add a cookie-only regression test.
  • Rebase and resolve the reported conflict against current main after the product decision.

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 (18 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-15T04:51:17.960Z sha 2cb9413 :: needs real behavior proof before merge. :: [P1] Filter imported cookies to the target dashboard | [P2] Prefer Chrome for automatic Muse cookie imports | [P2] Decode Relay array payloads before requiring a dictionary | [P2] Restrict request extraction to request-count fields
  • 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

…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
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. labels Aug 15, 2026
Safari legacy cookie stages but HTML has teamId as integer
or URL-encoded without quotes. Expand extractTeamId patterns
to cover "teamId":374..., teamId%3D, and bare numeric
team_id/teamId with 10+ digits.
@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 15, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. 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