Skip to content

The agent that grows with you

refactor(auth): trim re-export tuples to names with a caller outside the origin package

Teknium568afa038bdd
diff --git a/hermes_cli/auth.py b/hermes_cli/auth.py
index eb265de54db..1922f8d4b74 100644
--- a/hermes_cli/auth.py
+++ b/hermes_cli/auth.py
@@ -47,19 +47,15 @@ from hermes_cli.auth_zai_kimi import ( # noqa: F401 (re-exported; callers/test
KIMI_CODE_BASE_URL,
ZAI_ENDPOINTS,
_normalize_lmstudio_runtime_base_url,
- _probe_single_zai_endpoint,
_resolve_kimi_base_url,
_resolve_zai_base_url,
detect_zai_endpoint,
)
from hermes_cli.auth_model_picker import ( # noqa: F401 (re-exported; callers/tests use hermes_cli.auth.<name>)
- _ModelPickerRows,
- _confirm_selection_guards,
_prompt_model_selection,
_save_model_choice,
)
from hermes_cli.auth_device_flow import ( # noqa: F401 (re-exported; callers/tests use hermes_cli.auth.<name>)
- _CONSOLE_BROWSER_NAMES,
_can_open_graphical_browser,
_default_verify,
_is_remote_session,
@@ -76,19 +72,9 @@ from hermes_cli.auth_device_flow import ( # noqa: F401 (re-exported; callers/t
_ssh_user_at_host,
)
from hermes_cli.auth_oauth_grants import ( # noqa: F401 (re-exported; callers/tests use hermes_cli.auth.<name>)
- SINGLE_USE_OAUTH_SINGLETON_FILES,
SINGLE_USE_REFRESH_POOL_PROVIDERS,
- _OAUTH_TOKEN_FIELDS,
- _adopt_oauth_material,
- _find_root_counterpart,
- _heal_forked_provider_block,
- _heal_forked_single_use_oauth_grants,
- _is_oauth_pool_payload,
- _oauth_freshness,
_oauth_heal_clean_marks,
_oauth_heal_notices,
- _oauth_identity,
- _singleton_as_row,
consume_oauth_heal_notices,
heal_forked_single_use_oauth_grants,
strip_cloned_single_use_oauth_grants,
@@ -97,55 +83,30 @@ from hermes_cli.auth_nous import ( # noqa: F401 (re-exported; callers/tests us
NOUS_SESSION_TERMINAL,
NOUS_SESSION_UNKNOWN,
NOUS_SESSION_VALID,
- NOUS_SHARED_STORE_FILENAME,
_ALLOWED_NOUS_INFERENCE_HOSTS,
- _NOUS_EFFECTIVE_STATE_IGNORED_KEYS,
- _NOUS_EMPTY_AGENT_KEY_FIELDS,
- _NOUS_SHARED_STATE_KEYS,
- _NOUS_STALE_PORTAL_HOSTS,
- _NousStatePersister,
_agent_key_is_usable,
_apply_nous_refreshed_tokens,
_assert_nous_inference_jwt_usable,
- _clear_shared_nous_state,
_compute_nous_auth_status,
- _empty_nous_auth_status,
_format_nous_entitlement_auth_error,
_healed_nous_inference_url,
- _iso_after,
- _log_nous_invoke_jwt_selected,
_login_nous,
_merge_shared_nous_oauth_state,
_migrate_stale_nous_portal_url,
- _mirror_nous_state_best_effort,
_nous_device_code_login,
- _nous_effective_provider_state,
- _nous_effective_routing,
_nous_inference_env_override,
_nous_invoke_jwt_is_usable,
_nous_invoke_jwt_status,
- _nous_jwt_expires_at,
_nous_portal_env_override,
- _nous_shared_auth_dir,
- _nous_shared_lock_holder,
- _nous_shared_shape,
_nous_shared_store_lock,
_nous_shared_store_path,
- _nous_status_from_state,
- _oauth_trace,
- _oauth_trace_enabled,
- _offer_shared_nous_import,
- _pick_nous_model_after_login,
_pool_first_oauth_status,
_quarantine_nous_oauth_state,
_quarantine_nous_pool_entries,
_read_shared_nous_state,
_refresh_access_token,
_refresh_nous_or_quarantine,
- _scope_values,
_select_nous_invoke_jwt,
- _set_nous_agent_key_from_invoke_jwt,
- _snapshot_nous_pool_status,
_sync_nous_pool_from_auth_store,
_token_fingerprint,
_try_import_shared_nous_state,
@@ -156,18 +117,13 @@ from hermes_cli.auth_nous import ( # noqa: F401 (re-exported; callers/tests us
get_nous_session_validity,
persist_nous_credentials,
refresh_nous_oauth_from_state,
- refresh_nous_oauth_pure,
resolve_nous_runtime_credentials,
step_up_nous_billing_scope,
)
from hermes_cli.auth_minimax import ( # noqa: F401 (re-exported; callers/tests use hermes_cli.auth.<name>)
_MINIMAX_OAUTH_ERROR_BODY_LIMIT,
_login_minimax_oauth,
- _minimax_expired_in_looks_like_unix_ms,
- _minimax_expiry_fields,
- _minimax_fresh_state,
_minimax_oauth_login,
- _minimax_oauth_quarantine_on_terminal_refresh,
_minimax_pkce_pair,
_minimax_poll_token,
_minimax_post_form,
@@ -180,9 +136,7 @@ from hermes_cli.auth_minimax import ( # noqa: F401 (re-exported; callers/tests
resolve_minimax_oauth_runtime_credentials,
)
from hermes_cli.auth_xai import ( # noqa: F401 (re-exported; callers/tests use hermes_cli.auth.<name>)
- _is_xai_origin_host,
_login_xai_oauth,
- _quarantine_xai_oauth_tokens,
_read_xai_oauth_tokens,
_refresh_xai_oauth_tokens,
_save_xai_oauth_tokens,
@@ -190,79 +144,38 @@ from hermes_cli.auth_xai import ( # noqa: F401 (re-exported; callers/tests use
_xai_access_token_is_expiring,
_xai_oauth_device_code_login,
_xai_oauth_discovery,
- _xai_oauth_inference_base_url,
_xai_oauth_poll_device_token,
_xai_oauth_request_device_code,
- _xai_oauth_state_from_store,
- _xai_oauth_state_has_usable_tokens,
_xai_proactive_refresh_skew_seconds,
- _xai_tokens_from_payload,
_xai_validate_inference_base_url,
- _xai_validate_oauth_endpoint,
refresh_xai_oauth_pure,
resolve_xai_oauth_runtime_credentials,
)
from hermes_cli.auth_codex import ( # noqa: F401 (re-exported; callers/tests use hermes_cli.auth.<name>)
- CODEX_QUOTA_PROBE_MIN_INTERVAL_SECONDS,
- _clear_pool_entry_status,
_codex_access_token_is_expiring,
- _codex_base_url,
_codex_device_code_login,
- _codex_exchange_authorization_code,
_codex_http_client,
- _codex_login_rate_limited_error,
- _codex_poll_authorization_code,
_codex_pool_rate_limit_status,
- _codex_quota_exhausted_error,
_codex_quota_probe_cache,
- _codex_quota_probe_lock,
- _codex_refresh_failure_error,
- _codex_request_device_code,
- _codex_runtime_result,
_codex_usage_probe_url,
_import_codex_cli_tokens,
_is_codex_rate_limit_shaped,
- _load_auth_store_maybe_locked,
_login_openai_codex,
- _parse_retry_after_seconds,
- _pool_codex_access_token,
- _pool_entries,
_probe_codex_quota_restored,
_read_codex_tokens,
- _recover_codex_tokens_from_cli,
_refresh_codex_auth_tokens,
- _refresh_payload_access_token,
_save_codex_tokens,
- _sync_codex_pool_entries,
clear_codex_pool_quota_cooldowns,
refresh_codex_oauth_pure,
resolve_codex_runtime_credentials,
)
from hermes_cli.auth_spotify import ( # noqa: F401 (re-exported; callers/tests use hermes_cli.auth.<name>)
- _make_spotify_callback_handler,
_refresh_spotify_oauth_state,
- _spotify_accounts_base_url,
- _spotify_api_base_url,
- _spotify_build_authorize_url,
- _spotify_client_id,
- _spotify_code_challenge,
- _spotify_code_verifier,
- _spotify_exchange_code_for_tokens,
- _spotify_interactive_setup,
- _spotify_redirect_uri,
- _spotify_scope_list,
- _spotify_scope_string,
- _spotify_setting,
- _spotify_token_payload_to_state,
- _spotify_token_post,
- _spotify_validate_redirect_uri,
- _spotify_wait_for_callback,
get_spotify_auth_status,
login_spotify_command,
resolve_spotify_runtime_credentials,
)
from hermes_cli.auth_qwen import ( # noqa: F401 (re-exported; callers/tests use hermes_cli.auth.<name>)
- _mark_qwen_oauth_active,
_qwen_access_token_is_expiring,
_qwen_cli_auth_path,
_read_qwen_cli_tokens,
@@ -278,21 +191,16 @@ from hermes_cli.auth_constants import ( # noqa: F401 (re-exported; callers/tes
DEFAULT_NOUS_PORTAL_URL,
DEFAULT_NOUS_INFERENCE_URL,
DEFAULT_NOUS_CLIENT_ID,
- NOUS_INFERENCE_INVOKE_SCOPE,
NOUS_BILLING_MANAGE_SCOPE,
DEFAULT_NOUS_SCOPE,
NOUS_DEVICE_CODE_SOURCE,
NOUS_AUTH_PATH_INVOKE_JWT,
ACCESS_TOKEN_REFRESH_SKEW_SECONDS,
NOUS_INVOKE_JWT_MIN_TTL_SECONDS,
- DEVICE_AUTH_POLL_INTERVAL_CAP_SECONDS,
- DEVICE_CODE_GRANT_TYPE,
- _FORM_JSON_HEADERS,
DEFAULT_CODEX_BASE_URL,
DEFAULT_XAI_OAUTH_BASE_URL,
MINIMAX_OAUTH_CLIENT_ID,
MINIMAX_OAUTH_SCOPE,
- MINIMAX_OAUTH_GRANT_TYPE,
MINIMAX_OAUTH_GLOBAL_BASE,
MINIMAX_OAUTH_CN_BASE,
MINIMAX_OAUTH_GLOBAL_INFERENCE,
@@ -308,38 +216,21 @@ from hermes_cli.auth_constants import ( # noqa: F401 (re-exported; callers/tes
STEPFUN_STEP_PLAN_CN_BASE_URL,
CODEX_OAUTH_CLIENT_ID,
CODEX_OAUTH_TOKEN_URL,
- _HERMES_CLI_VERSION,
- CODEX_OAUTH_USER_AGENT,
CODEX_ACCESS_TOKEN_REFRESH_SKEW_SECONDS,
- XAI_OAUTH_ISSUER,
- XAI_OAUTH_DISCOVERY_URL,
XAI_OAUTH_CLIENT_ID,
XAI_OAUTH_SCOPE,
- XAI_OAUTH_DEVICE_CODE_URL,
XAI_ACCESS_TOKEN_REFRESH_SKEW_SECONDS,
- QWEN_OAUTH_CLIENT_ID,
- QWEN_OAUTH_TOKEN_URL,
QWEN_ACCESS_TOKEN_REFRESH_SKEW_SECONDS,
DEFAULT_SPOTIFY_ACCOUNTS_BASE_URL,
DEFAULT_SPOTIFY_API_BASE_URL,
- DEFAULT_SPOTIFY_REDIRECT_URI,
SPOTIFY_DOCS_URL,
- SPOTIFY_DASHBOARD_URL,
- SPOTIFY_ACCESS_TOKEN_REFRESH_SKEW_SECONDS,
- OAUTH_OVER_SSH_DOCS_URL,
DEFAULT_SPOTIFY_SCOPE,
SERVICE_PROVIDER_NAMES,
LMSTUDIO_NOAUTH_PLACEHOLDER,
ACTUAL_LOCAL_NOAUTH_PLACEHOLDER,
CODEX_RATE_LIMITED_CODE,
AuthError,
- _provider_error_factory,
_nous_err,
- _xai_err,
- _codex_err,
- _spotify_err,
- _qwen_err,
- _minimax_err,
httpx,
)