MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / build_token_completeness_metadata

Function build_token_completeness_metadata

src/core/register.py:50–77  ·  view source on GitHub ↗

构建统一的 token 完整度元数据。

(
    access_token: str = "",
    refresh_token: str = "",
    id_token: str = "",
    account_id: str = "",
)

Source from the content-addressed store, hash-verified

48
49
50def build_token_completeness_metadata(
51 access_token: str = "",
52 refresh_token: str = "",
53 id_token: str = "",
54 account_id: str = "",
55) -> Dict[str, Any]:
56 """构建统一的 token 完整度元数据。"""
57 has_access_token = bool(str(access_token or "").strip())
58 has_refresh_token = bool(str(refresh_token or "").strip())
59 has_id_token = bool(str(id_token or "").strip())
60 has_account_id = bool(str(account_id or "").strip())
61
62 if not has_access_token:
63 token_completeness = TOKEN_COMPLETENESS_MISSING_ACCESS
64 elif has_refresh_token and has_id_token and has_account_id:
65 token_completeness = TOKEN_COMPLETENESS_COMPLETE
66 elif not has_refresh_token:
67 token_completeness = TOKEN_COMPLETENESS_ONLY_ACCESS
68 else:
69 token_completeness = TOKEN_COMPLETENESS_PARTIAL
70
71 return {
72 "has_access_token": has_access_token,
73 "has_refresh_token": has_refresh_token,
74 "has_id_token": has_id_token,
75 "has_account_id": has_account_id,
76 "token_completeness": token_completeness,
77 }
78
79
80class RegistrationCancelled(Exception):

Calls

no outgoing calls