feat(login): /login opens the provider picker with green connected badges

/login previously fired the resolved method's flow immediately — there was
no way to see providers or their status. It now lands on the provider
picker; already-connected providers show a green 'connected' badge in the
key column.

Shell: initialize() probes stored credentials once (primary session flag,
auth.json oauth/<provider> scopes, resolved platform keys env>auth.json>
config) and stamps _meta.connected on each advertised method
(connected_method_ids + stamp_connected_meta, pure and unit-tested).
Display state only — never an authorization input.

TUI:
- PendingMenuItem::connected() reads the badge from method meta; the
  picker renders it green (accent_success), replacing the shortcut hint.
- New Action::OpenLoginPicker: /login shows the picker; mid-session it
  stashes the view like dispatch_login, and starts no flow by itself.
- Mid-session picker: last row reads 'Cancel' and dispatches CancelLogin
  (clicking it must not exit the app); Esc also returns to the session.
- After a successful login, the just-authenticated method is stamped
  connected in the TUI's advertised-methods copy (auth_in_flight_method →
  AuthComplete), so a later /login shows the badge without re-initialize.

Verified: kigi-shell 5256 + kigi-tui 6870 tests green, clippy clean.
This commit is contained in:
ZacharyZhang-NY committed 2026-07-22 16:14:42 -04:00
1 parent 1e57cd9225
commit fc7c2a1b9b
11 files changed
+384 -15

No files matched your search

@@ -567,6 +567,10 @@ pub enum Action {
/// first interactive method, which sent every provider row to the Kimi
/// device flow.
LoginWith(acp::AuthMethodId),
/// `/login`: show the provider picker (with connected badges) instead of
/// auto-starting a flow. The user picks a row; `LoginWith` / key entry
/// take it from there.
OpenLoginPicker,
/// Cancel an in-progress login that was started from inside a session
/// (`/login` or a 401 re-auth prompt) and return to the previous view.
/// Distinct from `Quit`: abandoning a mid-session re-auth must not exit