mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-21 10:22:18 +00:00
feat(desktop): resolve OAuth status for catalog-only account providers
Accounts-tab cards derived from the unified provider_catalog() carry status_fn=None and had no hardcoded branch in _resolve_provider_status, so any future OAuth/account provider plugin rendered permanently logged-out. Fall through to the canonical hermes_cli.auth.get_auth_status slug dispatcher and adapt its shape, so membership AND status both auto-extend with the hermes model universe.
This commit is contained in:
parent
d91b8d8368
commit
1d59d2dcae
1 changed files with 25 additions and 0 deletions
|
|
@ -5766,6 +5766,31 @@ def _resolve_provider_status(provider_id: str, status_fn) -> Dict[str, Any]:
|
|||
"has_refresh_token": True,
|
||||
"last_refresh": raw.get("last_refresh"),
|
||||
}
|
||||
# No hand-written branch for this provider id: fall through to the
|
||||
# canonical slug-driven dispatcher so accounts-tab providers derived
|
||||
# from the unified catalog (which carry status_fn=None) still reflect
|
||||
# real login state instead of rendering permanently logged-out. This
|
||||
# closes the membership-auto-extends-but-status-doesn't gap: add an
|
||||
# OAuth/account provider plugin and its card shows the right state.
|
||||
raw = hauth.get_auth_status(provider_id)
|
||||
if isinstance(raw, dict) and "logged_in" in raw:
|
||||
return {
|
||||
"logged_in": bool(raw.get("logged_in")),
|
||||
"source": raw.get("source") or raw.get("provider") or provider_id,
|
||||
"source_label": (
|
||||
raw.get("source_label")
|
||||
or raw.get("auth_store")
|
||||
or raw.get("auth_store_path")
|
||||
or raw.get("base_url")
|
||||
or raw.get("name")
|
||||
or ""
|
||||
),
|
||||
"token_preview": _truncate_token(
|
||||
raw.get("access_token") or raw.get("api_key")
|
||||
),
|
||||
"expires_at": raw.get("expires_at") or raw.get("access_expires_at"),
|
||||
"has_refresh_token": bool(raw.get("has_refresh_token")),
|
||||
}
|
||||
except Exception as e:
|
||||
return {"logged_in": False, "error": str(e)}
|
||||
return {"logged_in": False}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue