feat: Dynamically detect if a selected client in the sandbox first run wizard supports oauth
CI / All (ubuntu-latest) (push) Failing after 24s
CI / All (macos-latest) (push) Has been cancelled
CI / All (windows-latest) (push) Has been cancelled

This commit is contained in:
2026-07-24 18:07:30 -06:00
parent 5a1bb569b4
commit 8b0a536f4e
2 changed files with 11 additions and 2 deletions
+9
View File
@@ -38,6 +38,15 @@ register_client!(
(bedrock, "bedrock", BedrockConfig, BedrockClient),
);
pub fn client_type_supports_oauth(type_str: &str) -> bool {
matches!(
type_str,
ClaudeClient::NAME | OpenAIClient::NAME | GeminiClient::NAME
) || ALL_PROVIDER_MODELS
.iter()
.any(|pm| pm.provider == type_str && pm.oauth.is_some())
}
pub const OPENAI_COMPATIBLE_PROVIDERS: [(&str, &str); 18] = [
("ai21", "https://api.ai21.com/studio/v1"),
(
+2 -2
View File
@@ -44,7 +44,7 @@ pub use self::skill_policy::SkillPolicy;
pub use self::skill_registry::SkillRegistry;
pub use self::update::run_self_update;
use crate::client::{
ClientConfig, MessageContentToolCalls, Model, ModelType, OPENAI_COMPATIBLE_PROVIDERS,
self, ClientConfig, MessageContentToolCalls, Model, ModelType, OPENAI_COMPATIBLE_PROVIDERS,
ProviderModels, create_client_config, list_client_types, oauth, set_client_models_config,
};
use crate::function::{FunctionDeclaration, Functions};
@@ -830,7 +830,7 @@ async fn create_config_file_sandbox(config_path: &Path) -> Result<()> {
let mut client_config = serde_json::json!({ "type": client });
if matches!(client, "claude" | "openai" | "gemini") {
if client::client_type_supports_oauth(client) {
let use_oauth = Confirm::new("Use OAuth authentication instead?")
.with_default(false)
.prompt()?;