feat: push OpenClaw metadata to Monitor bridge periodically

- MonitorBridgeClient gains pushOpenClawMeta() method for POST /openclaw
- OpenClawMeta interface defines version/plugin_version/agents payload
- Plugin pushes metadata on gateway_start (delayed 2s) and periodically
- Interval aligns with reportIntervalSec (default 30s)
- Pushes are non-fatal — plugin continues if Monitor is unreachable
- Interval cleanup on gateway_stop
- Updated monitor-server-connector-plan.md with new architecture
This commit is contained in:
zhi
2026-03-22 01:37:21 +00:00
parent 27b8b74d39
commit e7ba982128
7 changed files with 146 additions and 26 deletions

View File

@@ -50,6 +50,30 @@ export class MonitorBridgeClient {
return this.fetchJson<MonitorTelemetryResponse>('/telemetry');
}
/**
* POST OpenClaw metadata to the Monitor bridge so it can enrich
* its heartbeat uploads with OpenClaw version, plugin version,
* and agent information.
*/
async pushOpenClawMeta(meta: OpenClawMeta): Promise<boolean> {
try {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
const response = await fetch(`${this.baseUrl}/openclaw`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(meta),
signal: controller.signal,
});
clearTimeout(timeout);
return response.ok;
} catch {
return false;
}
}
private async fetchJson<T>(path: string): Promise<T | null> {
try {
const controller = new AbortController();
@@ -67,3 +91,12 @@ export class MonitorBridgeClient {
}
}
}
/**
* OpenClaw metadata payload sent to the Monitor bridge.
*/
export interface OpenClawMeta {
version: string;
plugin_version: string;
agents?: any[];
}