From 3f8859424c0f1f0ae4723863f403fb059a660323 Mon Sep 17 00:00:00 2001 From: orion Date: Sat, 4 Apr 2026 08:05:50 +0000 Subject: [PATCH] refactor: remove monitor legacy compatibility --- README.md | 8 +++++--- plugin/index.ts | 7 +++---- scripts/install.mjs | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 41ed680..27fc914 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,12 @@ HarborForge.OpenclawPlugin/ │ ├── openclaw.plugin.json │ ├── index.ts │ ├── core/ -│ │ ├── live-config.ts +│ │ ├── config.ts +│ │ ├── managed-monitor.ts │ │ └── monitor-bridge.ts +│ ├── hooks/ +│ │ ├── gateway-start.ts +│ │ └── gateway-stop.ts │ └── package.json ├── skills/ │ └── hf/ @@ -98,8 +102,6 @@ node scripts/install.mjs --uninstall } ``` -> 说明:`monitor_port` 是当前主字段;为兼容旧配置,插件仍接受 `monitorPort`。 - 然后重启: ```bash diff --git a/plugin/index.ts b/plugin/index.ts index 864f3ee..62c69d4 100644 --- a/plugin/index.ts +++ b/plugin/index.ts @@ -63,11 +63,10 @@ export default { /** * Get the monitor bridge client if monitor_port is configured. - * Legacy alias monitorPort is still accepted. */ function getBridgeClient(): MonitorBridgeClient | null { - const live = resolveConfig() as any; - const port = live.monitor_port ?? live.monitorPort; + const live = resolveConfig(); + const port = live.monitor_port; if (!port || port <= 0) return null; return new MonitorBridgeClient(port); } @@ -349,7 +348,7 @@ export default { config: { backendUrl: live.backendUrl, identifier: live.identifier || hostname(), - monitorPort: (live as any).monitor_port ?? (live as any).monitorPort ?? null, + monitorPort: live.monitor_port ?? null, reportIntervalSec: live.reportIntervalSec, hasApiKey: Boolean(live.apiKey), }, diff --git a/scripts/install.mjs b/scripts/install.mjs index 1f6a703..68e83cc 100644 --- a/scripts/install.mjs +++ b/scripts/install.mjs @@ -403,7 +403,7 @@ function summary() { log('Next steps:', 'blue'); log(' 1. Register server in HarborForge Monitor to get apiKey', 'cyan'); log(' 2. Edit ~/.openclaw/openclaw.json under plugins.entries.harbor-forge.config:', 'cyan'); - log(' (prefer monitor_port; legacy monitorPort is still accepted)', 'cyan'); + log(' (monitor_port is required for the local monitor bridge)', 'cyan'); log(' {', 'cyan'); log(' "plugins": {', 'cyan'); log(' "entries": {', 'cyan');