feat: add admin state and diagnostics (TASK-WP6-05)
Dada P0-A isolated Windows CI / validate-and-package (push) Successful in 12m4s

This commit is contained in:
suyx
2026-08-04 01:51:35 +08:00
parent 19212cc1b6
commit 5041dc03c3
15 changed files with 1374 additions and 8 deletions
+482
View File
@@ -300,6 +300,125 @@
],
"type": "object"
},
"AdminDiagnosticsResponse": {
"additionalProperties": false,
"properties": {
"diagnostic_text": {
"maxLength": 12000,
"minLength": 1,
"type": "string"
},
"generated_at": {
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\\.[0-9]{3})?Z$",
"type": "string"
},
"services": {
"$ref": "#/components/schemas/AdminServicesStorageResponse"
},
"system": {
"additionalProperties": false,
"properties": {
"api_status": {
"anyOf": [
{
"enum": [
"ready"
],
"type": "string"
},
{
"enum": [
"degraded"
],
"type": "string"
},
{
"enum": [
"unavailable"
],
"type": "string"
}
]
},
"app_version": {
"maxLength": 80,
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$",
"type": "string"
},
"browser_support": {
"items": {
"additionalProperties": false,
"properties": {
"brand": {
"anyOf": [
{
"enum": [
"Google Chrome"
],
"type": "string"
},
{
"enum": [
"Microsoft Edge"
],
"type": "string"
}
]
},
"major": {
"minimum": 1,
"type": "integer"
}
},
"required": [
"brand",
"major"
],
"type": "object"
},
"maxItems": 2,
"type": "array"
},
"worker_status": {
"anyOf": [
{
"enum": [
"ready"
],
"type": "string"
},
{
"enum": [
"degraded"
],
"type": "string"
},
{
"enum": [
"unavailable"
],
"type": "string"
}
]
}
},
"required": [
"api_status",
"app_version",
"browser_support",
"worker_status"
],
"type": "object"
}
},
"required": [
"generated_at",
"diagnostic_text",
"services",
"system"
],
"type": "object"
},
"AdminLoginCompleteRequest": {
"additionalProperties": false,
"properties": {
@@ -696,6 +815,303 @@
],
"type": "object"
},
"AdminServicesStorageResponse": {
"additionalProperties": false,
"properties": {
"generated_at": {
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\\.[0-9]{3})?Z$",
"type": "string"
},
"services": {
"items": {
"additionalProperties": false,
"properties": {
"checked_at": {
"anyOf": [
{
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\\.[0-9]{3})?Z$",
"type": "string"
},
{
"type": "null"
}
]
},
"configured": {
"type": "boolean"
},
"impact_scope": {
"anyOf": [
{
"enum": [
"none"
],
"type": "string"
},
{
"enum": [
"authentication"
],
"type": "string"
},
{
"enum": [
"location"
],
"type": "string"
},
{
"enum": [
"generation"
],
"type": "string"
},
{
"enum": [
"storage"
],
"type": "string"
},
{
"enum": [
"api"
],
"type": "string"
},
{
"enum": [
"model"
],
"type": "string"
},
{
"enum": [
"account"
],
"type": "string"
},
{
"enum": [
"unknown"
],
"type": "string"
}
]
},
"pause_reason": {
"anyOf": [
{
"maxLength": 80,
"pattern": "^[a-z][a-z0-9_]*$",
"type": "string"
},
{
"type": "null"
}
]
},
"service_id": {
"anyOf": [
{
"enum": [
"resend"
],
"type": "string"
},
{
"enum": [
"amap"
],
"type": "string"
},
{
"enum": [
"ai_gateway"
],
"type": "string"
},
{
"enum": [
"worker"
],
"type": "string"
},
{
"enum": [
"api"
],
"type": "string"
},
{
"enum": [
"asset_root"
],
"type": "string"
}
]
},
"status": {
"anyOf": [
{
"enum": [
"active"
],
"type": "string"
},
{
"enum": [
"paused_quota"
],
"type": "string"
},
{
"enum": [
"paused_provider"
],
"type": "string"
},
{
"enum": [
"disabled"
],
"type": "string"
},
{
"enum": [
"degraded"
],
"type": "string"
},
{
"enum": [
"unavailable"
],
"type": "string"
}
]
}
},
"required": [
"checked_at",
"configured",
"impact_scope",
"pause_reason",
"service_id",
"status"
],
"type": "object"
},
"maxItems": 6,
"minItems": 6,
"type": "array"
},
"storage": {
"additionalProperties": false,
"properties": {
"capacity_notice_level": {
"anyOf": [
{
"enum": [
"normal"
],
"type": "string"
},
{
"enum": [
"warning"
],
"type": "string"
},
{
"enum": [
"critical"
],
"type": "string"
}
]
},
"cleanup_pending_count": {
"minimum": 0,
"type": "integer"
},
"data_root_ref": {
"enum": [
"configured_local_data_root"
],
"type": "string"
},
"hard_limit_bytes": {
"minimum": 1,
"type": "integer"
},
"last_measured_at": {
"anyOf": [
{
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\\.[0-9]{3})?Z$",
"type": "string"
},
{
"type": "null"
}
]
},
"managed_content_bytes": {
"minimum": 0,
"type": "integer"
},
"remeasurement_required": {
"type": "boolean"
},
"status": {
"anyOf": [
{
"enum": [
"active"
],
"type": "string"
},
{
"enum": [
"full"
],
"type": "string"
},
{
"enum": [
"unavailable"
],
"type": "string"
}
]
},
"storage_backend": {
"enum": [
"local_filesystem"
],
"type": "string"
}
},
"required": [
"capacity_notice_level",
"cleanup_pending_count",
"data_root_ref",
"hard_limit_bytes",
"last_measured_at",
"managed_content_bytes",
"remeasurement_required",
"status",
"storage_backend"
],
"type": "object"
}
},
"required": [
"generated_at",
"services",
"storage"
],
"type": "object"
},
"AdminSessionResponse": {
"additionalProperties": false,
"properties": {
@@ -5287,6 +5703,39 @@
]
}
},
"/api/v1/admin/diagnostics": {
"get": {
"operationId": "getAdminDiagnostics",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AdminDiagnosticsResponse"
}
}
},
"description": "Default Response"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"503": {
"description": "Default Response"
}
},
"tags": [
"Admin Operations"
]
}
},
"/api/v1/admin/models/configuration": {
"put": {
"operationId": "replaceModelConfiguration",
@@ -8331,6 +8780,39 @@
]
}
},
"/api/v1/admin/services-storage": {
"get": {
"operationId": "getAdminServicesStorage",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AdminServicesStorageResponse"
}
}
},
"description": "Default Response"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"503": {
"description": "Default Response"
}
},
"tags": [
"Admin Operations"
]
}
},
"/api/v1/admin/users/{userId}/credit-adjustments": {
"post": {
"operationId": "adjustAdminUserCredits",