Skip to content

feat: add xAI Grok OAuth provider - #1

Open
anandh8x wants to merge 1 commit into
mainfrom
feat/xai-oauth
Open

feat: add xAI Grok OAuth provider#1
anandh8x wants to merge 1 commit into
mainfrom
feat/xai-oauth

Conversation

@anandh8x

Copy link
Copy Markdown
Owner

Summary

  • Adds a separate xai-oauth provider for xAI Grok/SuperGrok subscription OAuth accounts.
  • Keeps the existing xai API-key provider on https://api.x.ai/v1 with chat completions by default.
  • Adds secure xAI OAuth token storage, refresh/retry behavior, 403 entitlement messaging, provider profile support, route metadata, and focused tests.

Important

  • The temporary Hermes Agent client ID used for manual testing was removed before commit.
  • Production merge/release remains blocked until OpenClaude has its own official xAI OAuth public client ID.

Verification

  • bun test src/services/api/xaiOAuth.test.ts src/utils/xaiOAuthCredentials.test.ts src/services/api/providerConfig.xaiOAuth.test.ts src/integrations/compatibility.test.ts src/integrations/routeMetadata.test.ts src/utils/providerProfiles.test.ts
  • bun run integrations:check
  • bun run build
  • git diff --check

Not tested

  • bun run typecheck: repo has pre-existing project-wide TypeScript failures; interrupted reruns were not used as completion evidence.

Adds a separate descriptor-backed xAI OAuth route for Grok subscription accounts using secure token storage, PKCE browser auth, refresh/retry behavior, and Responses transport routing while preserving the existing xAI API-key provider.

Constraint: OpenClaude does not yet have an official xAI OAuth public client ID; production release remains blocked until one is issued.

Constraint: Existing xai API-key provider must continue resolving to https://api.x.ai/v1 with chat completions by default.

Rejected: Hardcode Hermes Agent client ID | only suitable for manual testing and must not ship.

Rejected: Reuse Codex OAuth storage | xAI OAuth tokens need separate provider identity and refresh semantics.

Confidence: medium

Scope-risk: moderate

Directive: Do not merge/release until OpenClaude has its own official xAI OAuth public client ID.

Tested: bun test src/services/api/xaiOAuth.test.ts src/utils/xaiOAuthCredentials.test.ts src/services/api/providerConfig.xaiOAuth.test.ts src/integrations/compatibility.test.ts src/integrations/routeMetadata.test.ts src/utils/providerProfiles.test.ts

Tested: bun run integrations:check

Tested: bun run build

Tested: git diff --check

Not-tested: bun run typecheck (repo has pre-existing project-wide TypeScript failures; interrupted reruns were not used as completion evidence).
jatmn pushed a commit that referenced this pull request Jul 5, 2026
…1782)

* chore(deps): clean npm install — fix CVEs, silence warnings

- bump undici 7.24.6 → 7.28.0 (7 high CVEs: TLS bypass, header injection,
  DoS, cache poisoning, SameSite downgrade, cross-origin routing)
- bump ws 8.20.0 → 8.21.0 (2 high CVEs: uninitialized memory disclosure,
  memory exhaustion DoS)
- add allowScripts for sharp + protobufjs to silence install-script warnings
- vendor node-domexception shim (re-exports native DOMException) and override
  the deprecated polyfill pulled transitively by google-auth-library →
  gaxios → node-fetch@3 → fetch-blob

Result: `npm install` reports 0 vulnerabilities, 0 warnings.

Co-Authored-By: OpenClaude <openclaude@gitlawb.com>

* chore(deps): update bun.lock for undici/ws bumps and node-domexception override

CI runs `bun install --frozen-lockfile`, which requires bun.lock to match
package.json. The previous commit bumped undici/ws and added the
node-domexception shim override but didn't include the regenerated lockfile,
causing frozen-lockfile CI to fail.

Co-Authored-By: OpenClaude <openclaude@gitlawb.com>

* fix(publish): include vendor/node-domexception-shim in npm tarball

The file: override in package.json points at vendor/node-domexception-shim,
but the files array didn't list vendor/, so npm pack excluded it. End-user
npm installs would fail resolving the override.

Add vendor/node-domexception-shim/ to the files array. Verified via
npm pack --dry-run: tarball now contains both shim files (12 → 14 files).

Addresses reviewer finding #1.

Co-Authored-By: OpenClaude <openclaude@gitlawb.com>

---------

Co-authored-by: OpenClaude <openclaude@gitlawb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant