import type { Adapter } from "./adapter.js"; import { type MetricsCollector } from "./metrics.js"; import type { Router } from "./router.js"; import type { RuntimeOperation } from "./runtime-operation.js"; export interface RuntimeProcessIdentity { instanceId: string; startedAt: string; } /** 返回当前进程内所有 BaseApp 共享的稳定运行时身份。 */ export declare function getRuntimeProcessIdentity(): Readonly; interface ObservableApp { readonly router: Router; readonly adapters: ReadonlyMap; readonly isStarted: boolean; readonly isReloading: boolean; /** 当前应用的 HTTP 性能指标;旧的单全局宿主可省略。 */ readonly metrics?: MetricsCollector; /** 当前撤销 readiness 的运行态操作;嵌入式宿主可省略并得到 unknown。 */ readonly runtimeOperation?: RuntimeOperation; /** OneBots 主应用提供磁盘配置状态;嵌入式 BaseApp 可不跟踪。 */ readonly runtimeConfigState?: { status: string; }; /** 主应用可提供不包含原始路径或参数的启动契约摘要。 */ readonly runtimeContractId?: string; /** 主应用显式选择可公开的 WebSocket 容量标签,避免枚举第三方路径。 */ readonly webSocketCapacity?: readonly WebSocketCapacityMetric[]; } export interface WebSocketCapacityMetric { name: string; activeConnections: number; maxConnections?: number; capacityRejections: number; } export interface ApplicationIdentity { name: string; version: string; } export interface RuntimeIdentity extends ApplicationIdentity { coreVersion: string; } interface ProtocolReadinessCounts { ready: number; unavailable: number; total: number; } interface AdapterReadinessCounts { online: number; offline: number; total: number; accounts_without_protocols: number; protocols: ProtocolReadinessCounts; } export interface ReadinessSnapshot { ready: boolean; timestamp: string; server: boolean; reloading: boolean; runtime_operation: RuntimeOperation; configured: boolean; config: { status: "in_sync" | "drifted" | "unavailable" | "untracked"; in_sync: boolean; }; adapters: Record; summary: { total_adapters: number; total_accounts: number; online_accounts: number; total_protocols: number; ready_protocols: number; accounts_without_protocols: number; }; } export interface ReadinessResponse extends ReadinessSnapshot { application: string; version: string; core_version: string; instance_id: string; started_at: string; runtime_contract_id?: string; } /** 生成与 HTTP 无关的就绪快照,便于部署探针和测试共享同一判定。 */ export declare function getReadinessSnapshot(app: ObservableApp): ReadinessSnapshot; export declare function formatProtocolReadinessMetrics(snapshot: ReadinessSnapshot): string[]; export declare function formatWebSocketCapacityMetrics(routes: readonly WebSocketCapacityMetric[]): string[]; /** 注册不依赖管理端鉴权的存活、就绪与 Prometheus 端点。 */ export declare function registerObservabilityEndpoints(app: ObservableApp, identity: RuntimeIdentity): void; export {};