Extract shell-neutral desktop auth core and add GPUI sign-in
Summary
Problem: ANLG-320 Phase 6 (auth). Account parsing, the auth.json migration/path logic, and the Linux Secret-Service persistence rules all live inside tauri-plugin-auth behind tauri::AppHandle, so the GPUI shell could open the sign-in page but its DeepLink::AuthCallback handler only logged a warning — there was no way to install, persist, refresh, or read a session without a Tauri runtime.
Fix: New crate crates/desktop-auth (anlg-desktop-auth) with the shell-neutral pieces moved out of the plugin (the plugin re-exports them; commands, manifest, permissions and js/bindings.gen.ts are unchanged):
pub struct AccountInfo { .. } // specta::Type behind a `specta` feature the plugin enables
pub fn account_info(&HashMap) / access_token(&HashMap)
pub fn storage_key(supabase_url) -> "sb-<ref>-auth-token" // same key supabase-js uses in apps/desktop/src/auth/client.ts
pub mod paths; // resolve_auth_path_from_paths, store.json migration, CLI fallback path (moved from plugins/auth/src/migrate.rs)
pub trait Persistence { load / save / clear }
pub trait SecretStore { read / write / delete }
pub struct LinuxSecurePersistence(Box<dyn SecretStore>, auth_path) // load_linux_auth/persist/clear algorithm, verbatim semantics
pub struct SessionManager { session(), install_tokens(access, refresh), ensure_fresh(skew), sign_out(), account_info() }
SessionManager keeps the AuthStore in-memory-is-truth rule (a failed secure write never rolls back or downgrades to plaintext). install_tokens exchanges the callback's refresh token via AuthClient::refresh_session to get a full session (user, expires_at) and stores it under the web storage key, so a session written by GPUI is readable by supabase-js in the Tauri app and vice versa (dual-run / rollback requirement).
GPUI (apps/desktop-gpui/src/auth.rs): Auth on the Workspace, persistence chosen per platform exactly like the plugin — macOS data_local_dir/<identifier>/auth.json with the same legacy-base migration, Linux Secret Service (auth/supabase-storage through the store2-compatible service/account scheme in secrets.rs), Windows anlg_storage::windows_auth DPAPI. AuthCallback deep links now install the session (with the in-flight / 5 s dedupe from apps/desktop/src/auth/deeplink.ts), dismiss the sign-in instruction and re-render; the settings account section shows name/email + Sign out when signed in. Sessions are refreshed at startup and every 5 minutes; only is_fatal() refresh errors sign out. Supabase URL/anon key come from option_env!("VITE_SUPABASE_URL") / option_env!("VITE_SUPABASE_ANON_KEY") (same names the Tauri frontend uses).
Not in scope: CloudSync reconfiguration on auth change and billing/integration callbacks (next PRs).
Verification
cargo test --locked -p desktop-auth(9: storage key, failed-persistence semantics, path migration leaves an existing new-path file untouched, Linux keyring unreadable/readable/failing-write/CLI-fallback cases), clippy-D warningscargo test --locked -p tauri-plugin-auth(15, incl.command_manifest_is_single_source),git diff --exit-code plugins/auth/jsclean- ubuntu-24.04 container:
cargo test --locked -p desktop-gpui(463 passed),cargo clippy --locked -p desktop-gpui --all-targets --no-deps -- -D warnings - rustfmt /
git diff --check - Not verified: macOS/Windows builds (no native lanes on PRs); the Windows/macOS persistence adapters reuse the existing
anlg_storagecode paths.
Link to Devin session: https://app.devin.ai/sessions/f83ed73d85c648fcbdbd041cd4f15720
Open in Devin Desktop: https://app.devin.ai/desktop/session/f83ed73d85c648fcbdbd041cd4f15720?variant=devin
Requested by: @ComputelessComputer