feat(status): show xAI OAuth login state in hermes status

hermes status listed Nous Portal, OpenAI Codex, Qwen OAuth, and MiniMax
OAuth in the Auth Providers section but omitted xAI OAuth entirely.
Users who authenticated via `hermes auth add xai-oauth` had no way to
verify their session state from the status output.

Add xAI OAuth display using the same field shape as OpenAI Codex:
auth_store (Auth file:), last_refresh (Refreshed:), and error when
not logged in. The import is isolated in its own try/except so an
import failure cannot affect the already-printed rows above it.

Tests cover:
- logged in: check mark, auth_store, last_refresh, error suppressed
- not logged in: login command hint, error shown, error absent = no line
- resilience: import failure, status function raises, returns None
- isolation: xAI import failure does not break Nous/MiniMax display
This commit is contained in:
EloquentBrush0x 2026-05-17 04:01:29 +03:00 committed by Teknium
parent e10bb9dffa
commit 016893f5e4
2 changed files with 244 additions and 0 deletions

View file

@ -259,6 +259,27 @@ def show_status(args):
if minimax_status.get("error") and not minimax_logged_in:
print(f" Error: {minimax_status.get('error')}")
# xAI OAuth — separate try/except so an import failure here cannot
# disrupt the already-printed Nous/Codex/Qwen/MiniMax rows above.
try:
from hermes_cli.auth import get_xai_oauth_auth_status
xai_oauth_status = get_xai_oauth_auth_status() or {}
except Exception:
xai_oauth_status = {}
xai_oauth_logged_in = bool(xai_oauth_status.get("logged_in"))
print(
f" {'xAI OAuth':<12} {check_mark(xai_oauth_logged_in)} "
f"{'logged in' if xai_oauth_logged_in else 'not logged in (run: hermes auth add xai-oauth)'}"
)
xai_auth_file = xai_oauth_status.get("auth_store")
if xai_auth_file:
print(f" Auth file: {xai_auth_file}")
if xai_oauth_status.get("last_refresh"):
print(f" Refreshed: {_format_iso_timestamp(xai_oauth_status.get('last_refresh'))}")
if xai_oauth_status.get("error") and not xai_oauth_logged_in:
print(f" Error: {xai_oauth_status.get('error')}")
# =========================================================================
# Nous Subscription Features
# =========================================================================