feat(providers): expand OAuth account management

Add Claude Code manual and cookie authorization, including redacted batch tasks. Harden OAuth imports, duplicate replacement, provider dialogs, and related account-management tests.
This commit is contained in:
elky
2026-07-27 15:53:28 +08:00
parent 531cf11025
commit 550cc36760
55 changed files with 4957 additions and 403 deletions
@@ -72,6 +72,13 @@ pub fn build_provider_oauth_batch_task_status_payload(
"submitted" | "processing" | "completed" | "failed" => raw_status,
_ => "failed",
};
let import_kind = match state.get("import_kind").and_then(serde_json::Value::as_str) {
Some("oauth_batch" | "agent_identity" | "cookie_authorize") => state
.get("import_kind")
.and_then(serde_json::Value::as_str)
.unwrap_or_default(),
_ => "",
};
let error_samples = state
.get("error_samples")
.and_then(serde_json::Value::as_array)
@@ -94,6 +101,7 @@ pub fn build_provider_oauth_batch_task_status_payload(
.get("provider_type")
.and_then(serde_json::Value::as_str)
.unwrap_or_default(),
"import_kind": import_kind,
"status": normalized_status,
"total": state.get("total").and_then(serde_json::Value::as_i64).unwrap_or(0),
"processed": state.get("processed").and_then(serde_json::Value::as_i64).unwrap_or(0),
@@ -169,6 +177,7 @@ mod tests {
let input = json!({
"task_id": "task-123",
"provider_type": "codex",
"import_kind": "oauth_batch",
"status": "weird",
"total": 4,
"processed": 2,
@@ -194,6 +203,10 @@ mod tests {
payload.get("provider_id").and_then(|v| v.as_str()),
Some("provider-123")
);
assert_eq!(
payload.get("import_kind").and_then(|v| v.as_str()),
Some("oauth_batch")
);
assert_eq!(
payload.get("status").and_then(|v| v.as_str()),
Some("failed")