feat: 扩展 Rust gateway 全功能模块,新增 billing/crypto/wallet crate 及完整数据层

- 新增 aether-billing、aether-crypto、aether-wallet 独立 crate
- aether-data 扩展 repository 层:announcements、auth_modules、billing、
  candidate_selection、gemini_file_mappings、global_models、management_tokens、
  oauth_providers、proxy_nodes、quota、users、wallet 等模块
- aether-gateway 新增 api/auth/billing/control/middleware/scheduler/usage/
  video_tasks/hooks/maintenance/model_fetch/provider_transport 等功能模块
- 重构 executor decision 和 gateway state 为模块目录结构
- 新增 gateway router、frontdoor 路由层及对应测试
- Python 侧 API 路由重构,新增 compat/support 模块
- 前端 Logo 组件更新及 Provider 管理页面调整
This commit is contained in:
fawney19
2026-03-31 19:19:04 +08:00
parent b5a0070023
commit ddf18fed9a
690 changed files with 235085 additions and 16299 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,102 @@
use super::{
classified, is_claude_cli_request, is_gemini_cli_request, is_gemini_models_route,
is_gemini_operation_route, ClassifiedRoute,
};
pub(super) fn classify_ai_public_route(
method: &http::Method,
normalized_path: &str,
headers: &http::HeaderMap,
) -> Option<ClassifiedRoute> {
if method == http::Method::POST && normalized_path == "/v1/chat/completions" {
Some(classified(
"ai_public",
"openai",
"chat",
"openai:chat",
true,
))
} else if method == http::Method::POST
&& matches!(normalized_path, "/v1/responses" | "/v1/responses/compact")
{
if normalized_path.ends_with("/compact") {
Some(classified(
"ai_public",
"openai",
"compact",
"openai:compact",
true,
))
} else {
Some(classified("ai_public", "openai", "cli", "openai:cli", true))
}
} else if method == http::Method::POST && normalized_path == "/v1/messages/count_tokens" {
Some(classified(
"ai_public",
"claude",
"count_tokens",
"claude:chat",
false,
))
} else if method == http::Method::POST && normalized_path == "/v1/messages" {
if is_claude_cli_request(headers) {
Some(classified("ai_public", "claude", "cli", "claude:cli", true))
} else {
Some(classified(
"ai_public",
"claude",
"chat",
"claude:chat",
true,
))
}
} else if normalized_path.starts_with("/v1/videos") {
Some(classified(
"ai_public",
"openai",
"video",
"openai:video",
true,
))
} else if is_gemini_models_route(normalized_path) {
if normalized_path.ends_with(":predictLongRunning") {
Some(classified(
"ai_public",
"gemini",
"video",
"gemini:video",
true,
))
} else if is_gemini_cli_request(headers) {
Some(classified("ai_public", "gemini", "cli", "gemini:cli", true))
} else {
Some(classified(
"ai_public",
"gemini",
"chat",
"gemini:chat",
true,
))
}
} else if is_gemini_operation_route(normalized_path) {
Some(classified(
"ai_public",
"gemini",
"video",
"gemini:video",
true,
))
} else if (method == http::Method::POST && normalized_path == "/upload/v1beta/files")
|| normalized_path.starts_with("/v1beta/files")
{
Some(classified(
"ai_public",
"gemini",
"files",
"gemini:chat",
true,
))
} else {
None
}
}
@@ -0,0 +1,48 @@
use super::{classified, ClassifiedRoute};
pub(super) fn classify_internal_route(
method: &http::Method,
normalized_path: &str,
) -> Option<ClassifiedRoute> {
if method == http::Method::POST && normalized_path.starts_with("/api/internal/gateway/") {
let route_kind = match normalized_path {
"/api/internal/gateway/resolve" => "resolve",
"/api/internal/gateway/auth-context" => "auth_context",
"/api/internal/gateway/decision-sync" => "decision_sync",
"/api/internal/gateway/decision-stream" => "decision_stream",
"/api/internal/gateway/plan-sync" => "plan_sync",
"/api/internal/gateway/plan-stream" => "plan_stream",
"/api/internal/gateway/report-sync" => "report_sync",
"/api/internal/gateway/report-stream" => "report_stream",
"/api/internal/gateway/finalize-sync" => "finalize_sync",
"/api/internal/gateway/execute-sync" => "execute_sync",
"/api/internal/gateway/execute-stream" => "execute_stream",
_ => "legacy_gateway",
};
Some(classified(
"internal_proxy",
"gateway_legacy",
route_kind,
"",
false,
))
} else if method == http::Method::POST && normalized_path == "/api/internal/hub/heartbeat" {
Some(classified(
"internal_proxy",
"hub_manage",
"heartbeat",
"",
false,
))
} else if method == http::Method::POST && normalized_path == "/api/internal/hub/node-status" {
Some(classified(
"internal_proxy",
"hub_manage",
"node_status",
"",
false,
))
} else {
None
}
}
@@ -0,0 +1,278 @@
use super::{classified, ClassifiedRoute};
pub(super) fn classify_oauth_route(
method: &http::Method,
normalized_path: &str,
) -> Option<ClassifiedRoute> {
if method == http::Method::GET && normalized_path == "/api/oauth/providers" {
Some(classified(
"public_support",
"oauth_public_legacy",
"providers",
"",
false,
))
} else if method == http::Method::GET && normalized_path.starts_with("/api/oauth/") {
if normalized_path.ends_with("/authorize") {
Some(classified(
"public_support",
"oauth_public_legacy",
"authorize",
"",
false,
))
} else if normalized_path.ends_with("/callback") {
Some(classified(
"public_support",
"oauth_public_legacy",
"callback",
"",
false,
))
} else {
None
}
} else if method == http::Method::GET && normalized_path == "/api/user/oauth/bindable-providers"
{
Some(classified(
"public_support",
"oauth_user_legacy",
"bindable_providers",
"",
false,
))
} else if method == http::Method::GET && normalized_path == "/api/user/oauth/links" {
Some(classified(
"public_support",
"oauth_user_legacy",
"links",
"",
false,
))
} else if method == http::Method::POST
&& normalized_path.starts_with("/api/user/oauth/")
&& normalized_path.ends_with("/bind-token")
{
Some(classified(
"public_support",
"oauth_user_legacy",
"bind_token",
"",
false,
))
} else if method == http::Method::GET
&& normalized_path.starts_with("/api/user/oauth/")
&& normalized_path.ends_with("/bind")
{
Some(classified(
"public_support",
"oauth_user_legacy",
"bind",
"",
false,
))
} else if method == http::Method::DELETE && normalized_path.starts_with("/api/user/oauth/") {
Some(classified(
"public_support",
"oauth_user_legacy",
"unbind",
"",
false,
))
} else if method == http::Method::GET && normalized_path == "/api/admin/oauth/supported-types" {
Some(classified(
"admin_proxy",
"oauth_manage",
"supported_types",
"admin:oauth",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/admin/oauth/providers" | "/api/admin/oauth/providers/"
)
{
Some(classified(
"admin_proxy",
"oauth_manage",
"list_providers",
"admin:oauth",
false,
))
} else if method == http::Method::POST
&& normalized_path.starts_with("/api/admin/oauth/providers/")
&& normalized_path.ends_with("/test")
{
Some(classified(
"admin_proxy",
"oauth_manage",
"test_provider",
"admin:oauth",
false,
))
} else if method == http::Method::GET
&& normalized_path.starts_with("/api/admin/oauth/providers/")
{
Some(classified(
"admin_proxy",
"oauth_manage",
"get_provider",
"admin:oauth",
false,
))
} else if method == http::Method::PUT
&& normalized_path.starts_with("/api/admin/oauth/providers/")
{
Some(classified(
"admin_proxy",
"oauth_manage",
"upsert_provider",
"admin:oauth",
false,
))
} else if method == http::Method::DELETE
&& normalized_path.starts_with("/api/admin/oauth/providers/")
{
Some(classified(
"admin_proxy",
"oauth_manage",
"delete_provider",
"admin:oauth",
false,
))
} else if method == http::Method::GET
&& normalized_path == "/api/admin/provider-oauth/supported-types"
{
Some(classified(
"admin_proxy",
"provider_oauth_manage",
"supported_types",
"admin:provider_oauth",
false,
))
} else if method == http::Method::POST
&& normalized_path.starts_with("/api/admin/provider-oauth/keys/")
&& normalized_path.ends_with("/start")
{
Some(classified(
"admin_proxy",
"provider_oauth_manage",
"start_key_oauth",
"admin:provider_oauth",
false,
))
} else if method == http::Method::POST
&& normalized_path.starts_with("/api/admin/provider-oauth/providers/")
&& normalized_path.ends_with("/start")
{
Some(classified(
"admin_proxy",
"provider_oauth_manage",
"start_provider_oauth",
"admin:provider_oauth",
false,
))
} else if method == http::Method::POST
&& normalized_path.starts_with("/api/admin/provider-oauth/keys/")
&& normalized_path.ends_with("/complete")
{
Some(classified(
"admin_proxy",
"provider_oauth_manage",
"complete_key_oauth",
"admin:provider_oauth",
false,
))
} else if method == http::Method::POST
&& normalized_path.starts_with("/api/admin/provider-oauth/keys/")
&& normalized_path.ends_with("/refresh")
{
Some(classified(
"admin_proxy",
"provider_oauth_manage",
"refresh_key_oauth",
"admin:provider_oauth",
false,
))
} else if method == http::Method::POST
&& normalized_path.starts_with("/api/admin/provider-oauth/providers/")
&& normalized_path.ends_with("/complete")
{
Some(classified(
"admin_proxy",
"provider_oauth_manage",
"complete_provider_oauth",
"admin:provider_oauth",
false,
))
} else if method == http::Method::POST
&& normalized_path.starts_with("/api/admin/provider-oauth/providers/")
&& normalized_path.ends_with("/import-refresh-token")
{
Some(classified(
"admin_proxy",
"provider_oauth_manage",
"import_refresh_token",
"admin:provider_oauth",
false,
))
} else if method == http::Method::POST
&& normalized_path.starts_with("/api/admin/provider-oauth/providers/")
&& normalized_path.ends_with("/batch-import")
{
Some(classified(
"admin_proxy",
"provider_oauth_manage",
"batch_import_oauth",
"admin:provider_oauth",
false,
))
} else if method == http::Method::POST
&& normalized_path.starts_with("/api/admin/provider-oauth/providers/")
&& normalized_path.ends_with("/batch-import/tasks")
{
Some(classified(
"admin_proxy",
"provider_oauth_manage",
"start_batch_import_oauth_task",
"admin:provider_oauth",
false,
))
} else if method == http::Method::GET
&& normalized_path.starts_with("/api/admin/provider-oauth/providers/")
&& normalized_path.contains("/batch-import/tasks/")
{
Some(classified(
"admin_proxy",
"provider_oauth_manage",
"get_batch_import_task_status",
"admin:provider_oauth",
false,
))
} else if method == http::Method::POST
&& normalized_path.starts_with("/api/admin/provider-oauth/providers/")
&& normalized_path.ends_with("/device-authorize")
{
Some(classified(
"admin_proxy",
"provider_oauth_manage",
"device_authorize",
"admin:provider_oauth",
false,
))
} else if method == http::Method::POST
&& normalized_path.starts_with("/api/admin/provider-oauth/providers/")
&& normalized_path.ends_with("/device-poll")
{
Some(classified(
"admin_proxy",
"provider_oauth_manage",
"device_poll",
"admin:provider_oauth",
false,
))
} else {
None
}
}
@@ -0,0 +1,635 @@
use super::{classified, is_gemini_models_route, is_gemini_operation_route, ClassifiedRoute};
pub(super) fn classify_public_support_route(
method: &http::Method,
normalized_path: &str,
public_models_auth_signature: &str,
) -> Option<ClassifiedRoute> {
if method == http::Method::GET && normalized_path == "/v1/models" {
Some(classified(
"public_support",
"models",
"list",
public_models_auth_signature,
false,
))
} else if method == http::Method::GET
&& normalized_path.starts_with("/v1/models/")
&& !is_gemini_models_route(normalized_path)
&& !is_gemini_operation_route(normalized_path)
{
Some(classified(
"public_support",
"models",
"detail",
public_models_auth_signature,
false,
))
} else if method == http::Method::GET && normalized_path == "/v1beta/models" {
Some(classified(
"public_support",
"models",
"list",
public_models_auth_signature,
false,
))
} else if method == http::Method::GET
&& normalized_path.starts_with("/v1beta/models/")
&& !is_gemini_models_route(normalized_path)
&& !is_gemini_operation_route(normalized_path)
{
Some(classified(
"public_support",
"models",
"detail",
public_models_auth_signature,
false,
))
} else if method == http::Method::POST
&& matches!(
normalized_path,
"/api/announcements" | "/api/announcements/"
)
{
Some(classified(
"admin_proxy",
"announcements_manage",
"create_announcement",
"admin:announcements",
false,
))
} else if method == http::Method::PUT
&& normalized_path.starts_with("/api/announcements/")
&& normalized_path != "/api/announcements/active"
&& normalized_path != "/api/announcements/users/me/unread-count"
&& normalized_path != "/api/announcements/users/me/unread-count/"
&& !normalized_path.ends_with("/read-status")
{
Some(classified(
"admin_proxy",
"announcements_manage",
"update_announcement",
"admin:announcements",
false,
))
} else if method == http::Method::DELETE
&& normalized_path.starts_with("/api/announcements/")
&& normalized_path != "/api/announcements/active"
&& normalized_path != "/api/announcements/users/me/unread-count"
&& normalized_path != "/api/announcements/users/me/unread-count/"
&& !normalized_path.ends_with("/read-status")
{
Some(classified(
"admin_proxy",
"announcements_manage",
"delete_announcement",
"admin:announcements",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/announcements" | "/api/announcements/"
)
{
Some(classified(
"public_support",
"announcements",
"list",
"public:announcements",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/announcements/active" | "/api/announcements/active/"
)
{
Some(classified(
"public_support",
"announcements",
"active",
"public:announcements",
false,
))
} else if method == http::Method::GET
&& normalized_path.starts_with("/api/announcements/")
&& normalized_path != "/api/announcements/active"
&& normalized_path != "/api/announcements/users/me/unread-count"
&& normalized_path != "/api/announcements/users/me/unread-count/"
&& !normalized_path.ends_with("/read-status")
{
Some(classified(
"public_support",
"announcements",
"detail",
"public:announcements",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/public/site-info"
| "/api/public/providers"
| "/api/public/models"
| "/api/public/search/models"
| "/api/public/stats"
| "/api/public/global-models"
| "/api/public/health/api-formats"
)
{
let route_kind = match normalized_path {
"/api/public/site-info" => "site_info",
"/api/public/providers" => "providers",
"/api/public/models" => "models",
"/api/public/search/models" => "search_models",
"/api/public/stats" => "stats",
"/api/public/global-models" => "global_models",
"/api/public/health/api-formats" => "health_api_formats",
_ => "site_info",
};
Some(classified(
"public_support",
"public_catalog",
route_kind,
"public:catalog",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/auth/registration-settings" | "/api/auth/settings"
)
{
let route_kind = match normalized_path {
"/api/auth/registration-settings" => "registration_settings",
"/api/auth/settings" => "settings",
_ => "settings",
};
Some(classified(
"public_support",
"auth_public",
route_kind,
"public:auth",
false,
))
} else if matches!(method, &http::Method::GET | &http::Method::POST)
&& matches!(
normalized_path,
"/api/auth/login"
| "/api/auth/refresh"
| "/api/auth/register"
| "/api/auth/me"
| "/api/auth/logout"
| "/api/auth/send-verification-code"
| "/api/auth/verify-email"
| "/api/auth/verification-status"
)
{
let route_kind = match normalized_path {
"/api/auth/login" => "login",
"/api/auth/refresh" => "refresh",
"/api/auth/register" => "register",
"/api/auth/me" => "me",
"/api/auth/logout" => "logout",
"/api/auth/send-verification-code" => "send_verification_code",
"/api/auth/verify-email" => "verify_email",
"/api/auth/verification-status" => "verification_status",
_ => "login",
};
Some(classified(
"public_support",
"auth_legacy",
route_kind,
"user:auth",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/dashboard/stats"
| "/api/dashboard/recent-requests"
| "/api/dashboard/provider-status"
| "/api/dashboard/daily-stats"
)
{
let route_kind = match normalized_path {
"/api/dashboard/stats" => "stats",
"/api/dashboard/recent-requests" => "recent_requests",
"/api/dashboard/provider-status" => "provider_status",
"/api/dashboard/daily-stats" => "daily_stats",
_ => "stats",
};
Some(classified(
"public_support",
"dashboard_legacy",
route_kind,
"user:dashboard",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/monitoring/my-audit-logs" | "/api/monitoring/rate-limit-status"
)
{
let route_kind = match normalized_path {
"/api/monitoring/my-audit-logs" => "audit_logs",
"/api/monitoring/rate-limit-status" => "rate_limit_status",
_ => "audit_logs",
};
Some(classified(
"public_support",
"monitoring_user_legacy",
route_kind,
"user:monitoring",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/announcements/users/me/unread-count"
| "/api/announcements/users/me/unread-count/"
)
{
Some(classified(
"public_support",
"announcement_user_legacy",
"unread_count",
"user:announcements",
false,
))
} else if method == http::Method::POST
&& matches!(
normalized_path,
"/api/announcements/read-all" | "/api/announcements/read-all/"
)
{
Some(classified(
"public_support",
"announcement_user_legacy",
"read_all",
"user:announcements",
false,
))
} else if method == http::Method::PATCH
&& normalized_path.starts_with("/api/announcements/")
&& (normalized_path.ends_with("/read-status") || normalized_path.ends_with("/read-status/"))
{
Some(classified(
"public_support",
"announcement_user_legacy",
"read_status",
"user:announcements",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/wallet/balance"
| "/api/wallet/transactions"
| "/api/wallet/flow"
| "/api/wallet/today-cost"
| "/api/wallet/recharge"
| "/api/wallet/refunds"
)
{
let route_kind = match normalized_path {
"/api/wallet/balance" => "balance",
"/api/wallet/transactions" => "transactions",
"/api/wallet/flow" => "flow",
"/api/wallet/today-cost" => "today_cost",
"/api/wallet/recharge" => "list_recharge_orders",
"/api/wallet/refunds" => "list_refunds",
_ => "balance",
};
Some(classified(
"public_support",
"wallet_legacy",
route_kind,
"user:wallet",
false,
))
} else if method == http::Method::GET && normalized_path.starts_with("/api/wallet/recharge/") {
Some(classified(
"public_support",
"wallet_legacy",
"recharge_detail",
"user:wallet",
false,
))
} else if method == http::Method::GET && normalized_path.starts_with("/api/wallet/refunds/") {
Some(classified(
"public_support",
"wallet_legacy",
"refund_detail",
"user:wallet",
false,
))
} else if method == http::Method::POST
&& matches!(
normalized_path,
"/api/wallet/recharge" | "/api/wallet/refunds"
)
{
let route_kind = match normalized_path {
"/api/wallet/recharge" => "create_recharge_order",
"/api/wallet/refunds" => "create_refund",
_ => "create_recharge_order",
};
Some(classified(
"public_support",
"wallet_legacy",
route_kind,
"user:wallet",
false,
))
} else if method == http::Method::POST && normalized_path.starts_with("/api/payment/callback/")
{
Some(classified(
"public_support",
"payment_callback_legacy",
"callback",
"public:payment",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/users/me"
| "/api/users/me/sessions"
| "/api/users/me/api-keys"
| "/api/users/me/usage"
| "/api/users/me/usage/active"
| "/api/users/me/usage/interval-timeline"
| "/api/users/me/usage/heatmap"
| "/api/users/me/providers"
| "/api/users/me/available-models"
| "/api/users/me/endpoint-status"
| "/api/users/me/preferences"
| "/api/users/me/model-capabilities"
)
{
let route_kind = match normalized_path {
"/api/users/me" => "detail",
"/api/users/me/sessions" => "sessions",
"/api/users/me/api-keys" => "api_keys_list",
"/api/users/me/usage" => "usage",
"/api/users/me/usage/active" => "usage_active",
"/api/users/me/usage/interval-timeline" => "usage_interval_timeline",
"/api/users/me/usage/heatmap" => "usage_heatmap",
"/api/users/me/providers" => "providers",
"/api/users/me/available-models" => "available_models",
"/api/users/me/endpoint-status" => "endpoint_status",
"/api/users/me/preferences" => "preferences",
"/api/users/me/model-capabilities" => "model_capabilities",
_ => "detail",
};
Some(classified(
"public_support",
"users_me_legacy",
route_kind,
"user:self",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/me/management-tokens" | "/api/me/management-tokens/"
)
{
Some(classified(
"public_support",
"users_me_legacy",
"management_tokens_list",
"user:self",
false,
))
} else if method == http::Method::PUT
&& matches!(
normalized_path,
"/api/users/me" | "/api/users/me/preferences" | "/api/users/me/model-capabilities"
)
{
let route_kind = match normalized_path {
"/api/users/me" => "update_detail",
"/api/users/me/preferences" => "preferences_update",
"/api/users/me/model-capabilities" => "model_capabilities_update",
_ => "update_detail",
};
Some(classified(
"public_support",
"users_me_legacy",
route_kind,
"user:self",
false,
))
} else if method == http::Method::POST
&& matches!(
normalized_path,
"/api/me/management-tokens" | "/api/me/management-tokens/"
)
{
Some(classified(
"public_support",
"users_me_legacy",
"management_tokens_create",
"user:self",
false,
))
} else if method == http::Method::POST
&& normalized_path.starts_with("/api/me/management-tokens/")
&& normalized_path.ends_with("/regenerate")
{
Some(classified(
"public_support",
"users_me_legacy",
"management_token_regenerate",
"user:self",
false,
))
} else if method == http::Method::PATCH && normalized_path == "/api/users/me/password" {
Some(classified(
"public_support",
"users_me_legacy",
"password",
"user:self",
false,
))
} else if method == http::Method::PATCH
&& normalized_path.starts_with("/api/me/management-tokens/")
&& normalized_path.ends_with("/status")
{
Some(classified(
"public_support",
"users_me_legacy",
"management_token_toggle",
"user:self",
false,
))
} else if method == http::Method::DELETE && normalized_path == "/api/users/me/sessions/others" {
Some(classified(
"public_support",
"users_me_legacy",
"sessions_others_delete",
"user:self",
false,
))
} else if matches!(method, &http::Method::PATCH | &http::Method::DELETE)
&& normalized_path.starts_with("/api/users/me/sessions/")
{
let route_kind = if method == http::Method::PATCH {
"session_update"
} else {
"session_delete"
};
Some(classified(
"public_support",
"users_me_legacy",
route_kind,
"user:self",
false,
))
} else if matches!(method, &http::Method::GET | &http::Method::POST)
&& normalized_path == "/api/users/me/api-keys"
{
let route_kind = if method == http::Method::GET {
"api_keys_list"
} else {
"api_keys_create"
};
Some(classified(
"public_support",
"users_me_legacy",
route_kind,
"user:self",
false,
))
} else if method == http::Method::PUT
&& (normalized_path.ends_with("/providers") || normalized_path.ends_with("/capabilities"))
&& normalized_path.starts_with("/api/users/me/api-keys/")
{
let route_kind = if normalized_path.ends_with("/providers") {
"api_key_providers_update"
} else {
"api_key_capabilities_update"
};
Some(classified(
"public_support",
"users_me_legacy",
route_kind,
"user:self",
false,
))
} else if matches!(
method,
&http::Method::GET | &http::Method::PUT | &http::Method::PATCH | &http::Method::DELETE
) && normalized_path.starts_with("/api/users/me/api-keys/")
{
let route_kind = match *method {
http::Method::GET => "api_key_detail",
http::Method::PUT => "api_key_update",
http::Method::PATCH => "api_key_patch",
http::Method::DELETE => "api_key_delete",
_ => "api_key_detail",
};
Some(classified(
"public_support",
"users_me_legacy",
route_kind,
"user:self",
false,
))
} else if matches!(
method,
&http::Method::GET | &http::Method::PUT | &http::Method::DELETE
) && normalized_path.starts_with("/api/me/management-tokens/")
{
let route_kind = match *method {
http::Method::GET => "management_token_detail",
http::Method::PUT => "management_token_update",
http::Method::DELETE => "management_token_delete",
_ => "management_token_detail",
};
Some(classified(
"public_support",
"users_me_legacy",
route_kind,
"user:self",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/api/capabilities" | "/api/capabilities/user-configurable"
)
{
let route_kind = match normalized_path {
"/api/capabilities" => "list",
"/api/capabilities/user-configurable" => "user_configurable",
_ => "list",
};
Some(classified(
"public_support",
"capabilities",
route_kind,
"public:capabilities",
false,
))
} else if method == http::Method::GET && normalized_path.starts_with("/api/capabilities/model/")
{
Some(classified(
"public_support",
"capabilities",
"model",
"public:capabilities",
false,
))
} else if method == http::Method::GET && normalized_path == "/api/modules/auth-status" {
Some(classified(
"public_support",
"modules",
"auth_status",
"public:modules",
false,
))
} else if method == http::Method::GET
&& matches!(
normalized_path,
"/" | "/health" | "/v1/health" | "/v1/providers" | "/v1/test-connection"
)
{
let route_kind = match normalized_path {
"/" => "root",
"/health" | "/v1/health" => "health",
"/v1/providers" => "providers",
"/v1/test-connection" => "test_connection",
_ => "root",
};
Some(classified(
"public_support",
"system_catalog",
route_kind,
"public:system_catalog",
false,
))
} else if method == http::Method::GET && normalized_path.starts_with("/v1/providers/") {
Some(classified(
"public_support",
"system_catalog",
"provider_detail",
"public:system_catalog",
false,
))
} else if method == http::Method::GET && normalized_path == "/test-connection" {
Some(classified(
"public_support",
"system_catalog",
"test_connection",
"public:system_catalog",
false,
))
} else {
None
}
}