Files
gemini-cli/packages
Sri Pasumarthi b378111cd3 feat(cli): implement quiet custom auth/status endpoint for Xcode ACP client
Adds a custom `auth/status` JSON-RPC method specifically tailored for
the Xcode ACP sidecar client. This allows the editor to quietly query
and probe the background authentication state to trigger user logins
without disruptive browser popups.

- Implement the `extMethod` hook on `GeminiAgent` to route custom, non-spec JSON-RPC protocol extensions.
- Export core `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` constants from `packages/core` to be shared with the CLI dispatcher, establishing a single source of truth for native desktop credentials.
- Implement background personal profile validation via a standalone, quiet `OAuth2Client` instance that checks cached tokens without launching interactive web browsers during status queries.
- Implement a robust background environment check for Application Default Credentials (`COMPUTE_ADC`) that reads `process.env.GOOGLE_APPLICATION_CREDENTIALS` paths and uses a standalone `Compute` client gated by a 1-second `Promise.race` timeout to fast-probe GCE metadata servers quietly.
- Restrict the endpoint exclusively to Xcode clients via `getClientName()` and `XCODE_VERSION_ACTUAL` checks, safely throwing a `Method not found` error (code -32601) to hide the option from other IDEs.
- Define a strict `OAuthCredentialsPayload` interface for type-safe JSON contract parsing, throwing a strict JSON-RPC `Internal error` exception (code -32603) if internal credential stores are corrupted.
- Adhere fully to project `strict-development-rules.md` guidelines by refactoring test spies from `// @ts-ignore` to type-safe `vi.mocked()` and injecting `vi.restoreAllMocks()` for robust environment isolation.
- Pass all 24 unit tests, lint checks, and TypeScript strict index-signature (TS4111) compilation checks.
2026-05-04 17:43:09 -07:00
..