feat(grok): add admin oauth and quota support

This commit is contained in:
mayrain
2026-05-16 21:15:38 +08:00
parent cbfe1d378f
commit 936e1ae37b
61 changed files with 4748 additions and 287 deletions
@@ -250,4 +250,19 @@ impl<'a> AdminAppState<'a> {
crate::execution_runtime::execute_execution_runtime_sync_plan(self.app, trace_id, plan)
.await
}
pub(crate) async fn execute_execution_runtime_sync_plan_with_report_context(
&self,
trace_id: Option<&str>,
plan: &aether_contracts::ExecutionPlan,
report_context: Option<&serde_json::Value>,
) -> Result<aether_contracts::ExecutionResult, GatewayError> {
crate::execution_runtime::execute_execution_runtime_sync_plan_with_report_context(
self.app,
trace_id,
plan,
report_context,
)
.await
}
}
@@ -18,8 +18,7 @@ use std::collections::BTreeMap;
use std::io::Read;
use url::Url;
const KIRO_IDC_AMZ_USER_AGENT: &str =
"aws-sdk-js/3.738.0 ua/2.1 os/other lang/js md/browser#unknown_unknown api/sso-oidc#3.738.0 m/E KiroIDE";
const KIRO_IDC_AMZ_USER_AGENT: &str = "aws-sdk-js/3.738.0 ua/2.1 os/other lang/js md/browser#unknown_unknown api/sso-oidc#3.738.0 m/E KiroIDE";
const ADMIN_PROVIDER_OAUTH_TIMEOUT_MS: u64 = 30_000;
const ADMIN_PROVIDER_OAUTH_PROXY_TIMEOUT_MS: u64 = 60_000;
@@ -84,7 +84,7 @@ impl<'a> AdminAppState<'a> {
Json(json!({ "detail": "请求数据验证失败" })),
)
.into_response(),
))
));
}
};
@@ -1197,7 +1197,7 @@ impl<'a> AdminAppState<'a> {
Err(_) => {
return Ok(Err(invalid_request(format!(
"Provider '{provider_name}' 配置格式无效"
))))
))));
}
};
let mut updated = invalid!(
@@ -1230,7 +1230,7 @@ impl<'a> AdminAppState<'a> {
Err(_) => {
return Ok(Err(invalid_request(format!(
"Provider '{provider_name}' 配置格式无效"
))))
))));
}
};
let (mut record, shift_existing_priorities_from) =
@@ -1301,7 +1301,7 @@ impl<'a> AdminAppState<'a> {
Err(_) => {
return Ok(Err(invalid_request(
"Provider Endpoint 配置格式无效",
)))
)));
}
};
let (fields, payload) = patch.into_parts();
@@ -1504,7 +1504,7 @@ impl<'a> AdminAppState<'a> {
) {
Ok(patch) => patch,
Err(_) => {
return Ok(Err(invalid_request("Provider Key 配置格式无效")))
return Ok(Err(invalid_request("Provider Key 配置格式无效")));
}
};
let mut updated = invalid!(
@@ -1985,7 +1985,7 @@ impl<'a> AdminAppState<'a> {
Err(_) => {
return Ok(Err(invalid_request(
"merge_mode 仅支持 skip / overwrite / error",
)))
)));
}
};
let empty = Vec::new();