feat: expose institutional architecture and runtime state

This commit is contained in:
2026-08-01 17:48:37 +02:00
parent 05ce4dc8ec
commit c241085806
10 changed files with 906 additions and 10 deletions
+120
View File
@@ -37,6 +37,91 @@ export type OpsGovernanceModule = {
access_control_count: number;
search_provider_count: number;
migration_managed: boolean;
architecture?: {
contract_version: string;
layer: string;
kind: string;
maturity: string;
known_limits: string[];
supported_authority_modes: string[];
owned_concepts: string[];
non_owned_concepts: string[];
evidence: Array<{ kind: string; reference: string; summary: string }>;
} | null;
external_provider_count: number;
external_providers: Array<{
id: string;
label: string;
maturity: string;
authority_modes: string[];
operations: string[];
behavior: { outage?: string | null };
runtime_state?: {
configured: boolean;
active: boolean;
authority_mode?: string | null;
authority_modes?: string[];
health: string;
freshness: string;
conflict: string;
recovery: string;
observed_at: string;
last_success_at?: string | null;
bindings?: Array<{
binding_ref: string;
authority_mode: string;
active: boolean;
health: string;
freshness: string;
conflict: string;
recovery: string;
}>;
} | null;
}>;
};
export type OpsRuntimeNode = {
node_id: string;
incarnation: string;
role: string;
software_version: string;
composition_hash: string;
queues: string[];
state: "active" | "draining" | "stopped" | string;
started_at: string;
last_heartbeat_at: string;
drain_requested_at?: string | null;
drain_reason?: string | null;
stopped_at?: string | null;
stale: boolean;
};
export type OpsRecoveryOperation = {
id: string;
module_id: string;
operation_type: string;
resource_type?: string | null;
resource_id?: string | null;
mode: string;
status: string;
checkpoint_count: number;
evidence_head_sha256?: string | null;
failure_summary?: string | null;
updated_at: string;
};
export type OpsRuntimeCluster = {
available: boolean;
detail: string;
installation_id?: string;
state_profile: string;
expected?: { api: number; worker: number };
active?: { api: number; worker: number };
nodes: OpsRuntimeNode[];
recovery: {
operations: OpsRecoveryOperation[];
requires_attention: number;
};
};
export type OpsStatus = {
@@ -62,6 +147,8 @@ export type OpsStatus = {
queue_depths?: Record<string, number>;
};
operational_probe_count: number;
runtime_node_count: number;
recovery_required_count: number;
};
readiness: {
ready: boolean;
@@ -85,11 +172,17 @@ export type OpsStatus = {
access_control_count: number;
search_provider_count: number;
migration_module_count: number;
architecture_declared_module_count: number;
external_provider_count: number;
configured_external_provider_count: number;
provider_attention_count: number;
supported_module_count: number;
};
modules: OpsGovernanceModule[];
};
deployment_profiles: OpsDeploymentProfile[];
sizing: OpsSizingAssumption[];
runtime_cluster: OpsRuntimeCluster;
};
export function fetchOpsStatus(settings: ApiSettings): Promise<OpsStatus> {
@@ -99,3 +192,30 @@ export function fetchOpsStatus(settings: ApiSettings): Promise<OpsStatus> {
export function runOpsChecks(settings: ApiSettings): Promise<OpsStatus> {
return apiFetch(settings, "/api/v1/ops/checks/run", { method: "POST" });
}
export function drainRuntimeNode(
settings: ApiSettings,
nodeId: string,
reason = "operator request"
): Promise<{ node_id: string; state: string; drain_reason: string }> {
return apiFetch(
settings,
`/api/v1/ops/runtime/nodes/${encodeURIComponent(nodeId)}/drain`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ reason })
}
);
}
export function cancelRuntimeNodeDrain(
settings: ApiSettings,
nodeId: string
): Promise<{ node_id: string; state: string }> {
return apiFetch(
settings,
`/api/v1/ops/runtime/nodes/${encodeURIComponent(nodeId)}/drain`,
{ method: "DELETE" }
);
}