feat: expose signed platform health status

This commit is contained in:
Codex Local
2026-08-26 21:15:03 +08:00
parent 1e12d329dc
commit 47ef596d3b
30 changed files with 811 additions and 26 deletions
+3
View File
@@ -52,6 +52,7 @@ export type AlertIncident = components["schemas"]["AlertIncident"];
export type AlertSilence = components["schemas"]["AlertSilence"];
export type OpsDiagnosticRecord = components["schemas"]["OpsDiagnosticRecord"];
export type OpsExternalDependency = components["schemas"]["OpsExternalDependency"];
export type PlatformHealthSnapshot = components["schemas"]["PlatformHealthSnapshot"];
export type OpsDiagnosticAction = components["schemas"]["OpsDiagnosticAction"];
export type OpsDiagnosticJob = components["schemas"]["OpsDiagnosticJob"];
export type OpsDiagnosticBundle = components["schemas"]["OpsDiagnosticBundle"];
@@ -206,6 +207,8 @@ export const platformApi = {
authenticatedJSON<Envelope<{ items: OpsDiagnosticRecord[] }>>("GET", `/api/v1/ops/diagnostics/search?field=${encodeURIComponent(field)}&value=${encodeURIComponent(value)}`, accessToken, undefined, undefined, { "X-Tenant-Id": tenantID }),
opsExternalDependencies: (tenantID: string, accessToken: string, signal?: AbortSignal) =>
authenticatedJSON<Envelope<{ items: OpsExternalDependency[] }>>("GET", "/api/v1/ops/diagnostics/external-dependencies", accessToken, signal, undefined, { "X-Tenant-Id": tenantID }),
opsPlatformHealth: (tenantID: string, accessToken: string, signal?: AbortSignal) =>
authenticatedJSON<Envelope<PlatformHealthSnapshot>>("GET", "/api/v1/ops/diagnostics/platform-health", accessToken, signal, undefined, { "X-Tenant-Id": tenantID }),
stopOpsDiagnosticConversation: (tenantID: string, conversationID: string, reason: string, accessToken: string) =>
authenticatedJSON<Envelope<OpsDiagnosticAction>>("POST", `/api/v1/ops/diagnostics/conversations/${conversationID}/stop`, accessToken, undefined, { reason }, { "X-Tenant-Id": tenantID, "Idempotency-Key": `ops-diagnostic-stop-${crypto.randomUUID()}` }),
reconcileOpsDiagnosticConversation: (tenantID: string, conversationID: string, reason: string, accessToken: string) =>
+159
View File
@@ -189,6 +189,23 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/v1/ops/diagnostics/platform-health": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/** @description 查询云端主机最近一次签名健康快照;仅返回脱敏检查名、状态和短值,不返回密钥、证书正文或业务数据。 */
get: operations["getOpsPlatformHealth"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/ops/diagnostics/jobs": {
parameters: {
query?: never;
@@ -2145,6 +2162,23 @@ export interface paths {
patch?: never;
trace?: never;
};
"/callbacks/v1/platform-health": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** @description 接收云端主机五分钟一次的脱敏健康快照;Unix时间戳和原始正文使用独立HMAC-SHA256密钥签名,完全重复的正文幂等返回原记录。 */
post: operations["receivePlatformHealthReport"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
}
export type webhooks = Record<string, never>;
export interface components {
@@ -2535,6 +2569,49 @@ export interface components {
request_id: string;
data: components["schemas"]["OpsExternalDependencyListData"];
};
PlatformHealthCheck: {
name: string;
/** @enum {string} */
status: "healthy" | "warning" | "critical";
value: string;
};
PlatformHealthReport: {
/** @constant */
schema: "platform-server-health-v1";
/** @enum {string} */
status: "healthy" | "warning" | "critical";
/** Format: date-time */
observed_at: string;
checks: components["schemas"]["PlatformHealthCheck"][];
};
PlatformHealthSnapshot: {
/** Format: uuid */
id: string;
/** @constant */
schema: "platform-server-health-v1";
/** @enum {string} */
status: "healthy" | "warning" | "critical";
/** Format: date-time */
observed_at: string;
/** Format: date-time */
received_at: string;
checks: components["schemas"]["PlatformHealthCheck"][];
};
PlatformHealthSnapshotResponse: {
request_id: string;
data: components["schemas"]["PlatformHealthSnapshot"];
};
PlatformHealthReceipt: {
/** Format: uuid */
id: string;
/** @enum {string} */
status: "healthy" | "warning" | "critical";
duplicate: boolean;
};
PlatformHealthReceiptResponse: {
request_id: string;
data: components["schemas"]["PlatformHealthReceipt"];
};
OpsDiagnosticAction: {
/** @enum {string} */
action: "stop_conversation" | "reconcile_conversation" | "refresh_config" | "revoke_device" | "retry_job";
@@ -5585,6 +5662,8 @@ export interface components {
OpsAccessGrantHeader: string;
ProviderTimestampHeader: string;
ProviderSignatureHeader: string;
PlatformTimestampHeader: string;
PlatformSignatureHeader: string;
};
requestBodies: never;
headers: {
@@ -6084,6 +6163,31 @@ export interface operations {
403: components["responses"]["AccessDeniedError"];
};
};
getOpsPlatformHealth: {
parameters: {
query?: never;
header: {
/** @description 待创建资源所属的公开客户组织编号,不能是数据库内部主键。 */
"X-Tenant-Id": components["parameters"]["RequiredTenantSelectionHeader"];
};
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description 云端主机最新健康快照 */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["PlatformHealthSnapshotResponse"];
};
};
403: components["responses"]["AccessDeniedError"];
404: components["responses"]["NotFoundError"];
};
};
listOpsDiagnosticJobs: {
parameters: {
query?: never;
@@ -11004,4 +11108,59 @@ export interface operations {
};
};
};
receivePlatformHealthReport: {
parameters: {
query?: never;
header: {
"X-Platform-Timestamp": components["parameters"]["PlatformTimestampHeader"];
"X-Platform-Signature": components["parameters"]["PlatformSignatureHeader"];
};
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["PlatformHealthReport"];
};
};
responses: {
/** @description 完全重复的健康快照已幂等确认 */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["PlatformHealthReceiptResponse"];
};
};
/** @description 新健康快照已保存 */
201: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["PlatformHealthReceiptResponse"];
};
};
400: components["responses"]["ValidationError"];
/** @description 签名无效或时间窗已过 */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ErrorResponse"];
};
};
/** @description 健康快照暂时无法保存 */
503: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ErrorResponse"];
};
};
};
};
}