fix(provider): 隐藏 Windsurf refresh token 刷新入口

This commit is contained in:
Entropy.Xu
2026-05-18 19:12:36 +08:00
parent 208c77a062
commit 0a0a8b31c7
5 changed files with 39 additions and 7 deletions

View File

@@ -50,6 +50,7 @@ pub(crate) struct ProviderKeyAuthSemantics {
credential_kind: ProviderKeyCredentialKind,
runtime_auth_kind: ProviderKeyRuntimeAuthKind,
oauth_managed: bool,
can_refresh_oauth: bool,
}
impl ProviderKeyAuthSemantics {
@@ -66,7 +67,7 @@ impl ProviderKeyAuthSemantics {
}
pub(crate) const fn can_refresh_oauth(self) -> bool {
self.oauth_managed
self.can_refresh_oauth
}
pub(crate) const fn can_export_oauth(self) -> bool {
@@ -179,10 +180,12 @@ pub(crate) fn provider_key_auth_semantics(
}
};
let provider_type_normalized = provider_type.trim().to_ascii_lowercase();
ProviderKeyAuthSemantics {
credential_kind,
runtime_auth_kind,
oauth_managed,
can_refresh_oauth: oauth_managed && provider_type_normalized != "windsurf",
}
}
@@ -341,6 +344,7 @@ mod tests {
let semantics = provider_key_auth_semantics(&sample_key("oauth"), "windsurf");
assert!(semantics.oauth_managed());
assert!(!semantics.can_refresh_oauth());
assert_eq!(
semantics.credential_kind(),
ProviderKeyCredentialKind::OAuthSession