zhi 14ed887ce3 refactor(telemetry): read agents via [
{
    "id": "main",
    "identityName": "霓光 (Neon)",
    "identityEmoji": "",
    "identitySource": "identity",
    "workspace": "/root/.openclaw/workspace",
    "agentDir": "/root/.openclaw/agents/main/agent",
    "model": "minimax-portal/MiniMax-M2.5",
    "bindings": 1,
    "isDefault": true,
    "routes": [
      "default (no explicit rules)"
    ]
  },
  {
    "id": "developer",
    "name": "developer",
    "identityName": "小智 (Zhi)",
    "identityEmoji": "👋",
    "identitySource": "identity",
    "workspace": "/root/.openclaw/workspace/workspace-developer",
    "agentDir": "/root/.openclaw/agents/developer/agent",
    "model": "anthropic/claude-opus-4-6",
    "bindings": 1,
    "isDefault": false
  },
  {
    "id": "dispatcher",
    "name": "dispatcher",
    "workspace": "/root/.openclaw/workspace/workspace-dispatcher",
    "agentDir": "/root/.openclaw/agents/dispatcher/agent",
    "model": "minimax-portal/MiniMax-M2.5",
    "bindings": 0,
    "isDefault": false
  },
  {
    "id": "operator",
    "name": "operator",
    "identityName": "晨曦 (Orion)",
    "identityEmoji": "",
    "identitySource": "identity",
    "workspace": "/root/.openclaw/workspace/workspace-operator",
    "agentDir": "/root/.openclaw/agents/operator/agent",
    "model": "openai-codex/gpt-5.2-codex",
    "bindings": 1,
    "isDefault": false
  },
  {
    "id": "manager",
    "name": "manager",
    "identityName": "指南(Nav)",
    "identityEmoji": "🧭",
    "identitySource": "identity",
    "workspace": "/root/.openclaw/workspace/workspace-manager",
    "agentDir": "/root/.openclaw/agents/manager/agent",
    "model": "openai-codex/gpt-5.2-codex",
    "bindings": 1,
    "isDefault": false
  },
  {
    "id": "mentor",
    "name": "mentor",
    "identityName": "霖 (Lyn)",
    "identityEmoji": "🪶",
    "identitySource": "identity",
    "workspace": "/root/.openclaw/workspace/workspace-mentor",
    "agentDir": "/root/.openclaw/agents/mentor/agent",
    "model": "minimax-portal/MiniMax-M2.1",
    "bindings": 1,
    "isDefault": false
  },
  {
    "id": "recruiter",
    "name": "recruiter",
    "identityName": "沐川(Evan)",
    "identityEmoji": "🧩",
    "identitySource": "identity",
    "workspace": "/root/.openclaw/workspace/workspace-recruiter",
    "agentDir": "/root/.openclaw/agents/recruiter/agent",
    "model": "minimax-portal/MiniMax-M2.5",
    "bindings": 0,
    "isDefault": false
  },
  {
    "id": "administrative-secretary",
    "name": "administrative-secretary",
    "identityName": "映秘(Mirror)",
    "identityEmoji": "🪞",
    "identitySource": "identity",
    "workspace": "/root/.openclaw/workspace/workspace-administrative-secretary",
    "agentDir": "/root/.openclaw/agents/administrative-secretary/agent",
    "model": "minimax-portal/MiniMax-M2.5",
    "bindings": 1,
    "isDefault": false
  },
  {
    "id": "agent-resource-director",
    "name": "agent-resource-director",
    "identityName": "影织(Sherlock)",
    "identityEmoji": "🕸️",
    "identitySource": "identity",
    "workspace": "/root/.openclaw/workspace/workspace-agent-resource-director",
    "agentDir": "/root/.openclaw/agents/agent-resource-director/agent",
    "model": "kimi-coding/kimi-k2-thinking",
    "bindings": 1,
    "isDefault": false
  }
]
[plugins] memory-lancedb-pro@1.1.0-beta.6: plugin registered (db: /root/.openclaw/memory/lancedb-pro, model: jina-embeddings-v5-text-small)
[plugins] memory-lancedb-pro: diagnostic build tag loaded (memory-lancedb-pro-diag-20260308-0058)
[plugins] self-improvement: integrated hooks registered (agent:bootstrap, command:new, command:reset)
[plugins] session-strategy: using systemSessionMemory (plugin memory-reflection hooks disabled)
[plugins] PaddedCell plugin initializing...
[plugins] PaddedCell plugin initialized
[plugins] dirigent: pluginDir resolved from import.meta.url: /root/.openclaw/plugins/dirigent
[plugins] hook runner initialized with 3 registered hooks
[plugins] hook runner initialized with 3 registered hooks
[plugins] hook runner initialized with 3 registered hooks
[plugins] hook runner initialized with 3 registered hooks

- Prefer OpenClaw CLI as source of truth for agent list
- Parse JSON prefix defensively when plugin logs trail output
- Keep file/directory discovery only as fallback
2026-03-20 08:12:58 +00:00

HarborForge OpenClaw Plugin

OpenClaw 插件,将服务器遥测数据流式传输到 HarborForge Monitor。

项目结构

HarborForge.OpenclawPlugin/
├── package.json                 # 根 package.json
├── README.md                    # 本文档
├── plugin/                      # OpenClaw 插件代码
│   ├── openclaw.plugin.json     # 插件定义
│   ├── index.ts                 # 插件入口
│   ├── package.json             # 插件依赖
│   └── tsconfig.json            # TypeScript 配置
├── server/                      # Sidecar 服务器
│   └── telemetry.mjs            # 遥测数据收集和发送
├── skills/                      # OpenClaw 技能
│   └── (技能文件)
└── scripts/
    └── install.mjs              # 安装脚本

架构

┌─────────────────────────────────────────────────┐
│  OpenClaw Gateway                               │
│  ┌───────────────────────────────────────────┐  │
│  │  HarborForge.OpenclawPlugin/plugin/       │  │
│  │  - 生命周期管理 (启动/停止)                 │  │
│  │  - 配置管理                                │  │
│  └───────────────────────────────────────────┘  │
│              │                                   │
│              ▼ 启动 telemetry server             │
│  ┌───────────────────────────────────────────┐  │
│  │  HarborForge.OpenclawPlugin/server/       │  │
│  │  - 独立 Node 进程                          │  │
│  │  - 收集系统指标                            │  │
│  │  - 收集 OpenClaw 状态                      │  │
│  │  - 发送到 HarborForge Monitor              │  │
│  └───────────────────────────────────────────┘  │
└─────────────────────────────────────────────────┘
                        │
                        ▼ HTTP
              ┌─────────────────────┐
              │ HarborForge Monitor │
              └─────────────────────┘

安装

快速安装

# 克隆仓库
git clone https://git.hangman-lab.top/zhi/HarborForge.OpenclawPlugin.git
cd HarborForge.OpenclawPlugin

# 运行安装脚本
node scripts/install.mjs

开发安装

# 仅构建不安装
node scripts/install.mjs --build-only

# 指定 OpenClaw 路径
node scripts/install.mjs --openclaw-profile-path /custom/path/.openclaw

# 详细输出
node scripts/install.mjs --verbose

配置

  1. 在 HarborForge Monitor 中注册服务器,并生成 apiKey

  2. 编辑 ~/.openclaw/openclaw.json:

{
  "plugins": {
    "entries": {
      "harborforge-monitor": {
        "enabled": true,
        "config": {
          "enabled": true,
          "backendUrl": "https://monitor.hangman-lab.top",
          "identifier": "my-server-01",
          "apiKey": "your-api-key-here",
          "reportIntervalSec": 30,
          "httpFallbackIntervalSec": 60,
          "logLevel": "info"
        }
      }
    }
  }
}
  1. 重启 OpenClaw Gateway:
openclaw gateway restart

配置选项

选项 类型 默认值 说明
enabled boolean true 是否启用插件
backendUrl string https://monitor.hangman-lab.top Monitor 后端地址
identifier string 自动检测 hostname 服务器标识符
apiKey string 必填 HarborForge Monitor 生成的服务器 API Key
reportIntervalSec number 30 报告间隔(秒)
httpFallbackIntervalSec number 60 HTTP 回退间隔(秒)
logLevel string "info" 日志级别: debug/info/warn/error

收集的指标

系统指标

  • CPU 使用率 (%)
  • 内存使用率 (%)、已用/总量 (MB)
  • 磁盘使用率 (%)、已用/总量 (GB)
  • 交换分区使用率 (%)
  • 系统运行时间 (秒)
  • 1分钟平均负载
  • 平台 (linux/darwin/win32)
  • 主机名

OpenClaw 指标

  • OpenClaw 版本
  • Agent 数量
  • Agent 列表 (id, name, status)

卸载

node scripts/install.mjs --uninstall

开发

构建插件

cd plugin
npm install
npm run build

本地测试 telemetry server

cd server
HF_MONITOR_API_KEY=test-api-key \
HF_MONITOR_BACKEND_URL=http://localhost:8000 \
HF_MONITOR_LOG_LEVEL=debug \
node telemetry.mjs

依赖

  • Node.js 18+
  • OpenClaw Gateway

文档

Description
No description provided
Readme 5 MiB
Languages
TypeScript 80.8%
JavaScript 19.2%