/** * webapi/monitor.ts — 直接 import web 端 monitor.ts (v0.11+ Phase 2) * * 镜像 web/apps/jnpf-web-apps-main/src/api/system/monitor.ts 函数 * (含 getSysMonitor 等) */ import { JnpfClient } from '../core/client.ts' import { loadWebModule } from './_loader.ts' const MONITOR_SRC = '/home/ubuntu/ccWorkDir/web/apps/jnpf-web-apps-main/src/api/system/monitor.ts' let cached: any = null export async function initWebapi(client: JnpfClient): Promise { if (cached) return const { initDefHttpShim } = await import('./_defhttp_shim.ts') initDefHttpShim(client) cached = await loadWebModule(MONITOR_SRC) } export function isWebapiLoaded(): boolean { return cached !== null } export const loadMonitor: any = new Proxy({} as any, { get(_target, prop) { if (!cached) throw new Error('monitor 模块未初始化, 请先 await initWebapi(client)') return cached[prop] }, })