zot/internal/agent/modes
patriceckhart 755ca7ccdf feat(tui): /login shows current status for each provider
Running /login used to drop straight into the method / provider
pickers with no indication of what's already logged in. Easy to
accidentally log out a working subscription because you
forgot which provider you'd authenticated with last.

The dialog now takes a snapshot of auth.json when Open() runs
and renders it as a two-line header above both the method step
and the provider step:

  login
    \u2713 anthropic: subscription
    \u2713 openai: api key

  choose login method (\u2191/\u2193, enter, esc to cancel):
    api key
    subscription (claude pro/max \u00b7 chatgpt plus/pro)

Logged-in providers get a green check + their method
("api key" or "subscription"); providers with no credentials
get a muted \u2013 dash + "not logged in". When NEITHER provider is
logged in (first-run, fresh box) the status block is
suppressed entirely \u2014 a pair of "not logged in" rows there is
just noise when the user is already seconds away from picking
a method.

On the provider step each row also gets an inline method tag
so picking it implicitly replaces the existing credential:

  login \u00b7 oauth
    \u2713 anthropic: subscription
    \u2713 openai: api key

  choose provider:
    anthropic  (subscription)
    openai     (api key)

Implementation:

  - New d.status map on loginDialog, populated by Open() from
    auth.Credentials.Method(provider) which already returns
    exactly the three states we care about: "apikey", "oauth",
    or "".
  - Open() gained a zotHome string arg so the dialog can
    compute auth.json's path without importing the agent
    package (which would be a cyclic import; modes is inside
    agent). Both callers in interactive.go now pass
    i.cfg.ZotHome.
  - renderStatusLines() centralises the two-row block so
    loginStepMethod and loginStepProvider share it.

Tests: the whole package compiles and vet-clean; go test
./... still passes. No new tests because the dialog is pure
rendering off captured state and the captured-state path is a
one-liner.
2026-04-21 16:56:49 +02:00
..
telegram feat(telegram): mirror tui prompts into telegram thread 2026-04-20 09:33:03 +02:00
btw_dialog.go fix(tui): three cursor/alignment fixes in the editor and /help 2026-04-19 20:25:34 +02:00
changelog_dialog.go feat(tui): show github release notes once after upgrading 2026-04-19 16:12:13 +02:00
confirm_dialog.go fix(cli): load extensions in print and json modes too 2026-04-19 20:00:36 +02:00
dialog_frame.go fix(tui): cell-aware width math for dialog header rules + add /btw 2026-04-19 13:47:39 +02:00
help.go fix(tui): three cursor/alignment fixes in the editor and /help 2026-04-19 20:25:34 +02:00
interactive.go feat(tui): /login shows current status for each provider 2026-04-21 16:56:49 +02:00
json.go feat(tui): live-stream file body during write/edit tool calls 2026-04-20 08:37:14 +02:00
jump_dialog.go tui: /jump to scroll to past turns, render cache for long transcripts 2026-04-18 12:22:16 +02:00
login_dialog.go feat(tui): /login shows current status for each provider 2026-04-21 16:56:49 +02:00
logout_dialog.go feat(auth,tui): dark login pages + /logout picker 2026-04-19 20:14:22 +02:00
model_dialog.go add telegram bot bridge 2026-04-18 09:15:46 +02:00
print.go initial commit 2026-04-17 20:36:38 +02:00
session_dialog.go fix(tui): scroll the /sessions picker when the list overflows 2026-04-20 16:11:49 +02:00
session_ops_dialog.go feat(session): /session export + import with portable .zotsession file 2026-04-20 10:04:33 +02:00
session_tree_dialog.go feat(session): /session fork + /session tree 2026-04-20 11:10:56 +02:00
skills_dialog.go feat: skills — reusable instructions discovered from SKILL.md files 2026-04-19 14:32:30 +02:00
slash_suggest.go feat(tui): /study slash command to prime the agent on the current project 2026-04-21 08:59:53 +02:00
spinner.go tweak(tui): stable spinner phrase per turn 2026-04-20 16:00:10 +02:00
telegram_dialog.go feat(tui): /telegram connect | disconnect | status 2026-04-20 09:18:04 +02:00
update_banner.go tweak(tui): update banner emits the short domain install command 2026-04-20 17:47:58 +02:00
welcome.go tui: show binary version in the welcome banner for 1 second 2026-04-19 13:22:10 +02:00