Conversation
caniko
marked this pull request as draft
September 20, 2026 16:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Muse Code subscription OAuth via the existing device-code framework.
Status: device flow + execution path unit-verified; dashboard live demo pending
Device authorization, browser approval, key exchange, and model discovery against live Meta endpoints are verified (see below). Route-level discovery config, Chat-to-Responses format resolution, golden translate-path, persist/reload/restart, reconnect, disconnect, and redaction are covered by mocked tests. Not yet demonstrated: dashboard login and gateway inference against a running instance.
What
muse-codeOAuth provider (src/lib/oauth/providers/muse-code.ts): RFC 8628 device authorization againstauth.meta.com(bounded timeouts, no redirects, strict URL validation), server-side polling through the generic device tail with an allowlisted error-code set, then a key exchange atapi.meta.ai/muse-code/key(onboard: true) for the subscription inference key.accessToken— the default executor prefers it for OAuth connections). The device account token authorizes the exchange and is discarded, never persisted. No refresh-token grant exists: reconnect replaces the stored key (dedup by persistedaccountId, mirroring the Codex rule).baseUrl https://api.meta.ai/v1+/responsessuffix (shared by OAuth and existing API-key connections), livemodelsUrlfor entitled Spark discovery, and static Spark entries (1.1–1.3, base + Contributor) taggedopenai-responsesso Chat callers translate correctly; live discovery stays authoritative so unentitled ids are rejected.client_idembedded viaresolvePublicCred("muse_id")perdocs/security/PUBLIC_CREDS.md(no literal in source).muse-codeconnections are untouched.Verification
muse-code-oauth.test.ts), persist→reload→restart→discovery-URL→headers→reconnect→disconnect with redaction (muse-code-oauth-persistence.test.ts), Spark targetFormat + discovery config (muse-code-spark-targetformat.test.ts).oauth-providers-config.test.ts,publicCreds.test.ts, translate-path golden (muse-code URLs now resolve to the Responses endpoint)./v1/modelsincludingmuse-spark-1.3-contributor. No secrets printed or persisted.typecheck:coreclean; changed files lint/format clean.Still to demonstrate