Skip to main content

Module identity_handlers

Module identity_handlers 

Source
Expand description

Pre-launch OAuth flow RPC handlers.

Four commands per docs/specs/SPEC_PRE_LAUNCH_OAUTH_FLOW_2026_05_14.md §7 (request types named after that section’s RPCs), plus identity.ensureaccountdir:

  • auth.start — StartProviderAuthReq
  • auth.poll — PollProviderAuthReq
  • auth.submitcallback — SubmitAuthCallbackReq
  • auth.cancel — CancelProviderAuthReq

The spec’s fifth, auth.submitapikey, was removed: it was never built, and API-key accounts are added through account.key.verify and upsertidentityaccount instead.

This module owns the RPC surface and dispatches into crate::identity::auth_session::AuthSessionManager. auth.start also spawns the provider CLI (spawn_auth_cli), which feeds stdout lines into the session via record_line.

Split across four files (module-organization pass, see docs/specs/PLAN_LOGIN_SINGLE_PATH_CONSOLIDATION_2026_07_20.md): this file owns the RPC surface (wire types + register_identity_handlers); identity_auth_spawn owns the subprocess spawn/drain engine (spawn_auth_cli, spawn_auth_cli_pty, confirm_authenticated); identity_auth_dirs owns filesystem/directory provisioning (compute_and_ensure_bundle_dir, compute_and_ensure_account_dir); identity_auth_persist owns IdentityAccount persistence on OAuth success (persist_oauth_direct_account, persist_oauth_success).

Structs§

AckResp
CancelProviderAuthReq
EnsureAccountDirReq
EnsureAccountDirResp
PollProviderAuthReq
StartProviderAuthReq
SubmitAuthCallbackReq

Constants§

COMMAND_AUTH_CANCEL
COMMAND_AUTH_POLL
COMMAND_AUTH_START
COMMAND_AUTH_SUBMIT_CALLBACK
COMMAND_ENSURE_ACCOUNT_DIR
Mints (or reuses) a per-account isolated config dir without spawning any CLI — a standalone entry point onto compute_and_ensure_account_dir for callers that need the dir BEFORE a credential exists in it — today the terminal-login tier, which must know where to point the login before it opens a terminal. (It previously also served seed_provider_auth_from_global, the copy-from-personal-~/.claude path removed 2026-08-31.) See docs/specs/PLAN_LOGIN_SINGLE_PATH_CONSOLIDATION_2026_07_20.md §7 — “single point, not global”: every credential-bearing dir a running agent reads from must belong to a real IdentityAccount row, never the shared default dir.

Functions§

register_identity_handlers