Expand description
In-memory manager for pre-launch OAuth sessions.
See docs/specs/SPEC_PRE_LAUNCH_OAUTH_FLOW_2026_05_14.md §7.
Each session represents one user-initiated “Connect with OAuth”
attempt. The frontend creates a session via start_session,
polls via poll_session, optionally pastes a callback URL via
submit_callback_url, and cancels via cancel_session.
PR A scope: the session-state machine + per-line stdout
interpretation + lifecycle (timeout, cancel, cleanup). The
actual CLI spawn lives in the handler (so it can use AppState’s
CLI resolver) but emits frames into this module via
record_line / record_exit. That keeps this module pure and
testable.
Structs§
- Auth
Session Manager - Poll
Session Result - Snapshot returned by
poll_session. MirrorsAuthSessionStatusplus the provider id for renderer dispatch. - Process
Refs 🔒 - Per-session “process refs” — the join handle for the drain task
and the stdin sender for the callback-paste-back path. Held
outside the
sessionsMutex so cancellation can.abort()/ drop without holding the state lock across an await. - Session 🔒
- Start
Session Result - Public-facing handle returned by
start_session. The handler owns the spawned CLI’s child handle (so it can stdin-inject the pasted callback URL and kill on cancel); this manager owns the session state.
Enums§
Constants§
- SESSION_
TIMEOUT_ 🔒SECS - Wall-clock cap on a single auth session. Past this, the session
transitions to
Failed { reason: "timeout" }and the spawned CLI (if any) is killed by the handler that owns the join handle.
Functions§
- kill_
pid 🔒 - Platform-specific best-effort kill of a child process by PID.
Mirror of the cef-side helper in
agentmux-cef::commands::platform.