Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
532a605e58 | ||
|
|
149620dc1a | ||
|
|
ba3ef27766 | ||
|
|
373d8bda27 | ||
|
|
d7274f6c88 | ||
|
|
f9375ebf89 | ||
|
|
79fa8b35ca | ||
|
|
3bd82c5892 | ||
|
|
18b1b9529b | ||
|
|
428e92baa6 | ||
|
|
e08c782559 | ||
|
|
8e9b07a01e | ||
|
|
8c20735ff5 | ||
|
|
25d8b94209 | ||
|
|
45e63f7440 | ||
|
|
bd5c3f32ca | ||
|
|
f1bdf702ad | ||
|
|
78cb04931d | ||
|
|
8a4169ac83 | ||
|
|
4fd70438b8 | ||
|
|
1680834ab2 | ||
|
|
b0c707b74a | ||
|
|
6fe2e2bd3a | ||
|
|
cedade141b | ||
|
|
154b863f78 | ||
|
|
07d816053f | ||
|
|
6346ea2748 | ||
|
|
69269963d0 | ||
|
|
c6150d117b | ||
|
|
8eb9801f0f | ||
|
|
1f5f92ba36 | ||
|
|
c8629f8670 | ||
|
|
e2f4e88a7a | ||
|
|
089ff8986a | ||
|
|
d57d26471f | ||
|
|
8699b2355d | ||
|
|
e38f91ec4a | ||
|
|
6cca232e9e | ||
|
|
d479116b9f | ||
|
|
1f8d808dc5 |
@@ -1,7 +1,292 @@
|
|||||||
# OpenClaw Manager — 开发日志
|
# OpenClaw Manager — 开发日志
|
||||||
|
|
||||||
> 最后更新:2026-02-24
|
> 最后更新:2026-02-27
|
||||||
> 当前版本:v0.5.0
|
> 当前版本:v0.7.1
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v0.7.1 更新日志(2026-02-27)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
**Dashboard Guidance Block (Telegram-first usage + safety)**
|
||||||
|
- Added a concise guidance card under Dashboard explaining OCM's intended Telegram workflow
|
||||||
|
- Clarifies prerequisites: users should already have basic OpenClaw CLI experience
|
||||||
|
- Clarifies purpose: OCM mainly helps visualize and update `openclaw.json` for easier main-agent/sub-agent management and multi-tree structures
|
||||||
|
- Added explicit Telegram security checklist:
|
||||||
|
- BotFather `Allow Groups = ON`
|
||||||
|
- BotFather `Group Privacy = OFF`
|
||||||
|
- Keep each group private (only you + agent/sub-agents), do not invite others
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
**Model Dropdown Source — only `openclaw models list`**
|
||||||
|
- Model dropdown options are now sourced from real CLI output (`openclaw models list`) instead of built-in/static lists or config-only additions
|
||||||
|
- Applies to all relevant selectors: agent/sub-agent creation forms, agent inline model switcher, primary model selector, and fallback picker
|
||||||
|
- Added warning message when model list loading/parsing fails
|
||||||
|
|
||||||
|
### Technical Notes
|
||||||
|
|
||||||
|
- Added model ID parser for CLI output and short-term cache for model list fetches
|
||||||
|
- `GET /api/models` now returns:
|
||||||
|
- `knownModels` from CLI
|
||||||
|
- `modelListError` for UI warning display
|
||||||
|
- Startup script banners updated to `v0.7.1` (`start.sh` / `start.bat`)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v0.7.0 更新日志(2026-02-27)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
**Dashboard Redesign — Circular Gauge System Health**
|
||||||
|
- CPU%, RAM%, DISK% displayed as SVG circular gauges with colour-coded arcs (green < 70%, amber < 90%, red ≥ 90%)
|
||||||
|
- System info card: hostname, OS, Node.js, CPU model, cores, uptime, load average (1/5/15 min)
|
||||||
|
- Agent overview: separate main agent count and sub-agent count (plus total)
|
||||||
|
- Auto-refresh toggle: when enabled, dashboard polls `/api/dashboard` every 10 seconds
|
||||||
|
- Backend now measures CPU usage via `os.cpus()` delta sampling (200ms interval) and returns `loadAvg` from `os.loadavg()`
|
||||||
|
|
||||||
|
**Sub-Agent Creation Flow — Step-by-Step Guide Rewrite**
|
||||||
|
- Expanded from 3 steps to 5 detailed steps covering the full BotFather → Telegram Group → OCM workflow
|
||||||
|
- Step 1: Create new Bot via `/newbot` in BotFather
|
||||||
|
- Step 2: Disable Group Privacy via `/mybots` → Bot Settings → Group Privacy → Turn off
|
||||||
|
- Step 3: Create Telegram group, add Bot (with security warning)
|
||||||
|
- Step 4: Get Group ID from gateway logs
|
||||||
|
- Step 5: Fill in the form
|
||||||
|
- New "Your Telegram User ID" input field — auto-writes to `channels.telegram.allowFrom` whitelist on creation
|
||||||
|
- Security warning banner: "Do NOT add other people to this group" with explanation about API cost risks
|
||||||
|
|
||||||
|
**Setup Page — English Localization**
|
||||||
|
- All Chinese text in the initial directory selection page translated to English
|
||||||
|
- Includes: title, description, labels, placeholders, error messages, button text
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
**Agent tree: sub-agents not grouped under main (old config format)**
|
||||||
|
- **Symptom**: On machines with openclaw.json created before OCM v0.6 multi-bot support, all sub-agents displayed as independent cards instead of nested under main
|
||||||
|
- **Root cause**: Old-format bindings lack `accountId` field in sub-agent entries. The tree builder relied on `parentAccountId` to match sub-agents to roots, but old bindings only had `channel` + `peer` — no `accountId`. So `parentAccountId` was null and no parent match was found
|
||||||
|
- **Fix**: Fallback inference — if a sub-agent has a peer binding but no `accountId`, automatically infer `parentAccountId` from main's binding (`accountId`) or fall back to `'default'`
|
||||||
|
|
||||||
|
### Technical Notes
|
||||||
|
|
||||||
|
- **CPU usage measurement:** Two `os.cpus()` snapshots 200ms apart, calculating idle-to-total ratio across all cores
|
||||||
|
- **Gauge rendering:** Pure SVG arcs with `stroke-dasharray` animation, no external libraries. 270° arc (gap at bottom), colour transitions via `gaugeColor()` function
|
||||||
|
- **allowFrom auto-config:** `POST /api/agents` now accepts optional `telegramUserId` field (numeric string), appends to `channels.telegram.allowFrom[]` if not already present
|
||||||
|
- **Old-config compatibility:** Sub-agent bindings without `accountId` are now auto-assigned to the main agent's bot, maintaining backward compatibility with configs created before multi-bot support
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v0.6.6 更新日志(2026-02-27)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
**Agent tree: main agent not detected as root**
|
||||||
|
- **Symptom**: Sub-agents displayed as independent agents instead of under their parent. All agents appeared as orphan roots.
|
||||||
|
- **Root cause**: `main` agent in OpenClaw is the default catch-all and typically has NO explicit binding in `openclaw.json`. The `hasOwnBot` detection required an explicit binding with `accountId && !peer`, so `main` was classified as a non-root. Without `main` being a root, sub-agents' `parentAccountId` had no matching root to link to.
|
||||||
|
- **Fix**:
|
||||||
|
- `main` is now always treated as a root agent regardless of binding existence
|
||||||
|
- `main`'s `accountId` is inferred from `channels.telegram.accounts`: first unclaimed account (not explicitly bound to another agent), or first account as fallback
|
||||||
|
- Sub-agents with `parentAccountId` matching `main`'s inferred `accountId` now correctly appear under `main` in the tree
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v0.6.5 更新日志(2026-02-26)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
**Dashboard Tab (🏠 Dashboard)**
|
||||||
|
- New default landing tab showing system overview at a glance
|
||||||
|
- **System card**: hostname, OS, Node.js version, CPU model/cores, uptime, memory usage with progress bar
|
||||||
|
- **Gateway card**: process status indicator (running/stopped/unknown) with coloured dot, port, PID, HTTP ping reachability
|
||||||
|
- **Agents card**: total agent count, last session activity timestamp (Brisbane time), OCM version, server time
|
||||||
|
- **Storage card**: OpenClaw dir size, disk usage with progress bar, free space
|
||||||
|
- New `GET /api/dashboard` endpoint aggregates all info (ps grep + curl ping + fs stat)
|
||||||
|
- Lazy-loaded on tab switch; auto-loaded on first page load
|
||||||
|
|
||||||
|
**Cache-Control + Version-Based Cache Busting**
|
||||||
|
- All HTTP responses now include `Cache-Control: no-store, no-cache, must-revalidate`
|
||||||
|
- HTML responses include `ETag: "ocm-<version>"` for version-based cache validation
|
||||||
|
- All responses include `X-OCM-Version` header
|
||||||
|
- Browser `api()` function checks `X-OCM-Version` against client version; shows toast notification when server has been updated, prompting user to refresh
|
||||||
|
- Prevents stale frontend from calling deleted/changed API endpoints after update
|
||||||
|
|
||||||
|
### Cleanup
|
||||||
|
|
||||||
|
**Old `/api/agents/main` endpoint fully removed** (confirmed via code search — no residual references)
|
||||||
|
|
||||||
|
### Technical Notes
|
||||||
|
|
||||||
|
- Dashboard gateway detection: `ps aux | grep openclaw.*gateway` for process status, `curl --max-time 2 http://127.0.0.1:<port>` for HTTP ping
|
||||||
|
- Disk usage: `df -k` for filesystem stats, `du -sk` for OpenClaw dir size
|
||||||
|
- Agent last activity: scans `~/.openclaw/agents/*/sessions/*.jsonl` mtime
|
||||||
|
- Version cache busting: `OCM_CLIENT_VERSION` is injected into browser script via template literal `${APP_VERSION}`, compared against `X-OCM-Version` response header on every API call
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v0.6.0 更新日志(2026-02-26)
|
||||||
|
|
||||||
|
### 重大 Bug 修复
|
||||||
|
|
||||||
|
**Add Agent 覆盖已有 Bot Token(数据破坏性 Bug)**
|
||||||
|
- **症状**:通过 Add Agent 表单添加新 agent 时,直接覆盖 `channels.telegram.botToken`,导致所有已有 agent(包括 sub-agent)全部失效
|
||||||
|
- **根本原因**:`POST /api/agents/main` 端点无条件覆盖 `channels.telegram.botToken` 字段,没有保护已有配置
|
||||||
|
- **修复**:
|
||||||
|
- 彻底删除 `POST /api/agents/main` 端点
|
||||||
|
- 新建 `POST /api/agents/bot` 端点,使用 OpenClaw 的 `channels.telegram.accounts` 多 bot 结构
|
||||||
|
- 每个新 agent 获得独立的 `accountId` 和 `botToken`,绝不覆盖已有 token
|
||||||
|
- 自动迁移:首次添加新 bot 时,自动将旧格式(顶层 `botToken`)迁移到 `accounts.default`
|
||||||
|
- **数据恢复**:程序在修改前自动创建 `openclaw.json.create.*` 备份,可通过 `cp` 恢复
|
||||||
|
|
||||||
|
**浏览器 Popover API 命名冲突**
|
||||||
|
- **症状**:点击 "+ Add Agent" / "+ Add Sub-Agent" 按钮报错 `NotSupportedError: Failed to execute 'togglePopover' on 'HTMLElement'`
|
||||||
|
- **根本原因**:自定义函数 `togglePopover()` 与浏览器原生 Popover API 的 `HTMLElement.togglePopover()` 方法冲突
|
||||||
|
- **修复**:函数重命名为 `showConfigPop()`
|
||||||
|
|
||||||
|
### 架构变更
|
||||||
|
|
||||||
|
**多 Bot 支持(Multi-Account)**
|
||||||
|
- 支持 OpenClaw 的 `channels.telegram.accounts` 结构,每个主 agent 可绑定独立的 Telegram bot
|
||||||
|
- 配置格式:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"channels": { "telegram": { "accounts": {
|
||||||
|
"default": { "botToken": "TOKEN_A" },
|
||||||
|
"research": { "botToken": "TOKEN_B" }
|
||||||
|
}}}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- `GET /api/agents` 返回 `hasOwnBot` 字段,标识 agent 是否拥有独立 bot
|
||||||
|
- Sub-Agent 表单新增 "Parent Agent" 下拉,选择共享哪个 bot(不再硬编码 "main")
|
||||||
|
|
||||||
|
**去除 Landing Page,直接进入主程序**
|
||||||
|
- 移除模式选择首页(Sub-agent / Multi-agent 二选一)
|
||||||
|
- 启动后直接进入 Agent 管理页面
|
||||||
|
- 移除 landing page 相关 HTML、CSS、JS、i18n keys
|
||||||
|
|
||||||
|
**Agent 页面重设计(popover 配置窗口)**
|
||||||
|
- 不再使用左右分屏布局
|
||||||
|
- "+ Add Agent" / "+ Add Sub-Agent" 按钮居中显示在 agent 树上方
|
||||||
|
- 点击按钮弹出浮动配置窗口(popover),包含引导步骤和表单
|
||||||
|
- Agent 树宽度限制 720px 居中,多个 agent 树纵向排列
|
||||||
|
|
||||||
|
### 功能改进
|
||||||
|
|
||||||
|
**Stats 重写 — 从 session JSONL 文件解析真实用量**
|
||||||
|
- 不再从 `gateway.log` 解析(之前一直是 0 数据)
|
||||||
|
- 改为扫描 `~/.openclaw/agents/*/sessions/*.jsonl`
|
||||||
|
- 解析 `type: "message"` + `role: "assistant"` 的 `message.usage` 字段
|
||||||
|
- 新增维度:By Agent(每个 agent 的用量)、Cache Read tokens
|
||||||
|
- 测试验证:成功解析出 990 条请求、6 个 agent、10 个模型的真实数据
|
||||||
|
|
||||||
|
**Model 下拉 — 只显示已注册模型**
|
||||||
|
- 不再使用硬编码的 KNOWN_MODELS 列表
|
||||||
|
- 改为从 `openclaw.json` 的 `agents.defaults.models` 读取实际注册的模型
|
||||||
|
|
||||||
|
**Agent 树事件委托**
|
||||||
|
- `renderAgents()` 中的按钮不再使用 `onclick="func('escaped-string')"` 内联写法
|
||||||
|
- 改用 `data-action` / `data-id` 属性 + 事件委托(`agentTreeAction`),避免 template literal 转义问题
|
||||||
|
|
||||||
|
**响应式布局**
|
||||||
|
- `main` 容器改为 `max-width:100%`,适配不同屏幕宽度
|
||||||
|
- 新增 `@media (max-width: 600px)` 断点:侧边导航折叠、按钮纵向排列
|
||||||
|
|
||||||
|
**备份时间戳改为 Brisbane 时区**
|
||||||
|
- `brisbaneTimestamp()` 函数,所有备份文件名使用 `Australia/Brisbane` 时区
|
||||||
|
- 重要:系统所有时间显示统一按 Brisbane 处理
|
||||||
|
|
||||||
|
**启动脚本全面重写**
|
||||||
|
- `start.sh` / `start.bat` 全部英文
|
||||||
|
- 端口冲突时自动 kill 旧进程,而非报错退出
|
||||||
|
- 支持 `--host` 参数
|
||||||
|
|
||||||
|
**README 重写**
|
||||||
|
- 移除所有空的 screenshot 占位符(含敏感 ID 的截图已删除)
|
||||||
|
- 更新功能描述匹配 v0.6
|
||||||
|
- 精简结构,保留中英文双语
|
||||||
|
|
||||||
|
### 新功能 i18n 策略
|
||||||
|
|
||||||
|
- v0.6 新增的所有 UI 文案仅提供英文
|
||||||
|
- 中文翻译推迟到 v1.0 正式版
|
||||||
|
|
||||||
|
### 技术备忘
|
||||||
|
|
||||||
|
- **Template literal 转义规则**:MAIN_HTML_SCRIPT 是反引号模板字符串
|
||||||
|
- `\n` → 真实换行(浏览器 JS 字符串跨行 → SyntaxError),必须写 `\\n`
|
||||||
|
- `\'` → `'`(无法用于 onclick 里的引号转义),改用 data 属性 + 事件委托
|
||||||
|
- `\`` → `` ` ``(嵌套模板字符串在 evaluated output 中正常工作)
|
||||||
|
- **`assertBrowserScriptSyntax()`** 在启动时检查 MAIN_HTML_SCRIPT 的 evaluated 值
|
||||||
|
- **OpenClaw config 多 bot 格式**:`channels.telegram.accounts.<id>.botToken`,binding 用 `accountId` 路由
|
||||||
|
|
||||||
|
### 下一步(v0.7+)
|
||||||
|
|
||||||
|
- [x] Dashboard 首页 tab(系统信息 + OpenClaw health 状态)— done in v0.6.5
|
||||||
|
- [x] HTTP 响应加 `Cache-Control: no-store` + version-based cache busting — done in v0.6.5
|
||||||
|
- [x] 彻底删除旧 `/api/agents/main` 端点残留(确认已清除)— confirmed in v0.6.5
|
||||||
|
- [x] Agent tree: independent roots per bot + side-by-side layout — done in v0.6.5
|
||||||
|
- [x] Agent tree: expand/collapse toggle for sub-agents — done in v0.6.5
|
||||||
|
- [x] Add Agent: creates `agents/<id>/sessions/` runtime dirs + SOUL.md personality — done in v0.6.5
|
||||||
|
- [x] Agent tree: main agent always root with inferred accountId — done in v0.6.6
|
||||||
|
- [ ] Dashboard: auto-refresh every 30s when tab is active
|
||||||
|
- [ ] Dashboard: OpenClaw version display (from `openclaw --version`)
|
||||||
|
- [ ] Agent page: edit agent name, purpose, personality inline
|
||||||
|
- [ ] Agent page: restart gateway button with status feedback
|
||||||
|
- [ ] Settings tab: edit openclaw.json key fields via form (model, workspace defaults)
|
||||||
|
- [ ] Telegram bot connectivity test button (ping bot API from server)
|
||||||
|
- [ ] DEVLOG.md 中文 → 逐步迁移为英文
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v0.5.2 更新日志(2026-02-25)
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
|
||||||
|
**远程访问无法连接(ERR_CONNECTION_REFUSED)**
|
||||||
|
- `server.listen` 原来绑定 `127.0.0.1`(仅本机),远程通过 `http://<IP>:3333` 访问时被直接拒绝
|
||||||
|
- 改为默认绑定 `0.0.0.0`(所有网卡),远程设备可通过局域网 IP 访问
|
||||||
|
- 新增 `--host` 命令行参数:需要限制仅本机访问时可用 `--host 127.0.0.1` 覆盖
|
||||||
|
- 新增 `getLanIP()` 工具函数,自动检测第一个非内部 IPv4 地址
|
||||||
|
|
||||||
|
### 改进
|
||||||
|
|
||||||
|
**启动日志改为英文**
|
||||||
|
- 终端启动信息(目录、地址、提示、错误)全部改为英文
|
||||||
|
- 绑定 `0.0.0.0` 时自动显示局域网地址,方便远程复制:`🌐 LAN: http://192.168.x.x:3333`
|
||||||
|
- 端口占用、启动失败等错误提示同步改为英文
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v0.5.1 更新日志(2026-02-25)
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
|
||||||
|
**Action 菜单英文模式残留中文**
|
||||||
|
- 修复 Action 菜单下多处弹窗在 EN 模式仍显示中文的问题(日志、回滚、目录切换、命令输出)
|
||||||
|
- 统一接入 i18n:标题、按钮、说明文案、加载态、空态、确认框、toast 文案
|
||||||
|
- 菜单项触发后的交互文案现在与语言切换保持一致
|
||||||
|
|
||||||
|
### 工程改进
|
||||||
|
|
||||||
|
**1) 嵌入脚本转义/语法防护**
|
||||||
|
- 新增启动时预检:对前端嵌入脚本执行 `node --check` 语法校验
|
||||||
|
- 若语法异常(常见为 `MAIN_HTML` 内 `\n` 转义写错),启动阶段直接报错并给出修复提示,避免浏览器白屏后才发现问题
|
||||||
|
|
||||||
|
**2) 单文件结构化重构(保持零依赖)**
|
||||||
|
- 将主页面模板从单一超长 `MAIN_HTML` 拆分为三段常量:
|
||||||
|
- `MAIN_HTML_CSS`
|
||||||
|
- `MAIN_HTML_BODY`
|
||||||
|
- `MAIN_HTML_SCRIPT`
|
||||||
|
- 最终由 `MAIN_HTML` 组合输出,保持“单文件 + 零依赖”不变,同时降低维护复杂度
|
||||||
|
- 修复拆分过程中的脚本模板转义问题:`MAIN_HTML_SCRIPT` 使用普通模板字符串(非 `String.raw`),确保前端脚本内的反引号模板语法可被正确还原
|
||||||
|
|
||||||
|
### 其他
|
||||||
|
|
||||||
|
- 程序头部版本与启动日志版本更新为 `v0.5.1`
|
||||||
|
- `start.sh` / `start.bat` 启动横幅版本号同步更新为 `v0.5.1`
|
||||||
|
- `README` 补充 Git 安装/更新流程(`git clone` / `git pull --ff-only`),并精简中英文功能介绍
|
||||||
|
- `README` 首屏改版:增加「1 分钟上手」命令区(安装/更新/运行同屏),并将开场介绍改为精简版
|
||||||
|
- `README` 去重:移除中部重复的安装/更新/运行段落,统一引用首屏快速上手
|
||||||
|
- `README` 截图区改为首屏精简展示(3 张)+ 折叠更多截图(`<details>`)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>com.openclaw.manager</string>
|
<string>com.openclaw.manager</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>0.5.0</string>
|
<string>0.7.1</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.5.0</string>
|
<string>0.7.1</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
|
|||||||
@@ -1,115 +1,113 @@
|
|||||||
# OpenClaw Manager (OCM)
|
# OpenClaw Manager (OCM)
|
||||||
|
|
||||||
> A zero-dependency, single-file web UI for managing [OpenClaw](https://github.com/anthropics/openclaw) AI agents locally.
|
A zero-dependency, single-file web dashboard for [OpenClaw](https://github.com/anthropics/openclaw). Manage agents, monitor token usage, and run commands — all from your browser, no `npm install` required.
|
||||||
|
|
||||||
[中文说明](#中文说明)
|
[中文说明](#中文说明) · [中文使用说明(含截图)](docs/USAGE_GUIDE.zh-CN.md) · [English Guide (with screenshots)](docs/USAGE_GUIDE.en.md)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## What is this?
|
|
||||||
|
|
||||||
OpenClaw Manager is a lightweight local web dashboard that lets you visually manage your OpenClaw AI agents, models, auth, cron jobs, and more — without editing JSON files by hand.
|
|
||||||
|
|
||||||
Everything ships as **a single `.js` file** with zero npm dependencies. Just need Node.js 18+.
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
|
|
||||||
### Landing Page
|
|
||||||
Choose between Sub-agent mode and Multi-agent mode. Switch language (EN / 中文) anytime.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Agent Management
|
|
||||||
View all agents (main + sub-agents) at a glance. Each card shows model, group binding, and workspace path. Switch models inline, browse files, or delete with auto-backup.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### New Subagent Wizard
|
|
||||||
4-step guided wizard to create a sub-agent: basic info → model → personality & memory → confirm. Fully bilingual.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Model Selector
|
|
||||||
Rich model dropdown grouped by provider — GitHub Copilot, Anthropic, OpenAI, Google, DeepSeek, Kimi, Groq, Mistral, Together, plus your custom models.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Actions Menu
|
|
||||||
Quick access to gateway operations, backups, health checks, and directory management. Use **"Switch OpenClaw Dir"** to point OCM to your OpenClaw config on first setup.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Cron Job Management
|
|
||||||
View, add, enable/disable, and manually trigger openclaw-related cron tasks. Integrates with NAS backup schedules.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Built-in CLI Terminal
|
|
||||||
Run any openclaw command with real-time streaming output. The terminal panel sits at the bottom of the page and expands on demand.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Preset command menu with built-in commands and your personal favorites — one click to run.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Command output streams in real-time. Star frequently used commands for quick access, or use the Manage button to organize favorites.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- **Agent Management** — Create sub-agents (with wizard), switch models inline, browse & edit workspace files, delete with auto-backup
|
|
||||||
- **Model Selection** — Change global primary model, edit fallback chain
|
|
||||||
- **Auth Guide** — Step-by-step instructions for configuring each provider (Anthropic, OpenAI, DeepSeek, Google, GitHub Copilot, etc.)
|
|
||||||
- **Token Usage Stats** — Parse `gateway.log` for token usage, view cost breakdown by model and day
|
|
||||||
- **Cron Job Management** — View, add, enable/disable, and trigger openclaw-related cron tasks
|
|
||||||
- **Workspace File Browser** — Browse all agent workspace files, read-only by default, editable on demand
|
|
||||||
- **Backup & Rollback** — Auto-backup before every write, one-click restore from any snapshot
|
|
||||||
- **NAS Backup** — SFTP/rsync backup to NAS with legacy SSH cipher compatibility
|
|
||||||
- **Built-in CLI Terminal** — Run openclaw commands with real-time streaming output, presets, tab completion
|
|
||||||
- **Health Badge** — Auto-run `openclaw doctor` and show warnings in the header
|
|
||||||
- **Bilingual UI** — English / 中文, switchable at runtime
|
|
||||||
- **Cross-platform** — macOS / Linux / Windows
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
- Node.js >= 18 ([download](https://nodejs.org/))
|
|
||||||
- A working [OpenClaw](https://github.com/anthropics/openclaw) installation
|
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Clone
|
||||||
git clone https://github.com/dtzp555-max/ocm.git
|
git clone https://github.com/dtzp555-max/ocm.git
|
||||||
cd ocm
|
cd ocm
|
||||||
# No npm install needed
|
|
||||||
|
|
||||||
# macOS / Linux
|
# Run (no npm install needed)
|
||||||
bash start.sh
|
bash start.sh # macOS / Linux
|
||||||
|
start.bat # Windows
|
||||||
|
|
||||||
# Windows
|
# Update
|
||||||
start.bat
|
git pull --ff-only
|
||||||
```
|
```
|
||||||
|
|
||||||
Then open http://localhost:3333 in your browser.
|
Open [http://localhost:3333](http://localhost:3333) in your browser. For remote access, use `bash start.sh --host 0.0.0.0`.
|
||||||
|
## Docs
|
||||||
|
|
||||||
### First Run
|
- English guide: docs/USAGE_GUIDE.en.md
|
||||||
|
- 中文使用说明: docs/USAGE_GUIDE.zh-CN.md
|
||||||
|
- FAQ: docs/FAQ.md
|
||||||
|
- Security notes: docs/SECURITY.md
|
||||||
|
- Changelog: docs/CHANGELOG.md
|
||||||
|
|
||||||
On first launch, the start script auto-detects `~/.openclaw` and creates a `manager-config.json` for you. If your OpenClaw config is elsewhere, use **Actions → Switch OpenClaw Dir** in the UI to point to the correct path.
|
|
||||||
|
|
||||||
### macOS Double-click
|
## Features
|
||||||
|
|
||||||
Double-click `OpenClaw Manager.app` in Finder. On first launch, you may need to allow it in System Settings → Privacy & Security.
|
**Screenshots** — Redacted UI walkthrough (no personal paths, no Telegram IDs):
|
||||||
|
|
||||||
### Custom Port
|

|
||||||
|
|
||||||
```bash
|

|
||||||
bash start.sh --port 8080
|
|
||||||
```
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
**Agent Management** — Add main agents and sub-agents through a guided setup flow. View all agents in a tree structure with model selection, workspace browsing, and inline configuration.
|
||||||
|
|
||||||
|
**Usage Statistics** — Real token usage data parsed directly from OpenClaw session files. Breakdown by model, agent, and day with a visual chart.
|
||||||
|
|
||||||
|
**Model & Auth** — Configure models from your registered provider list. Follow built-in guides for provider authentication setup.
|
||||||
|
|
||||||
|
**Built-in CLI** — Available from any page (top-right **Terminal** + bottom dock). Run OpenClaw commands with **real-time streaming output**, **Tab completion**, built-in presets, and your own saved favorites (no more memorizing commands).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**Ops Panel** — Restart gateway, view logs, run health checks, manage backups (local + NAS via SFTP/rsync), and handle cron tasks.
|
||||||
|
|
||||||
|
**Bilingual UI** — English and Chinese interface with one-click language switching.
|
||||||
|
|
||||||
|
## What's New (v0.7.x)
|
||||||
|
|
||||||
|
- **Dashboard redesign**: circular CPU/RAM/DISK gauges + system/gateway/agent overview, with optional auto-refresh.
|
||||||
|
- **Sub-agent creation flow**: step-by-step Telegram guide (BotFather → group → get group ID → fill form), with explicit safety warnings.
|
||||||
|
- **Telegram allowlist helper**: optional “Your Telegram User ID” field can auto-append to `channels.telegram.allowFrom`.
|
||||||
|
- **Model dropdown = real CLI output**: selectors are sourced from `openclaw models list` (with a warning if parsing fails).
|
||||||
|
- **Cache-busting**: response headers + version checks help prevent stale frontend after updates.
|
||||||
|
- **Setup page EN localization**: first-run directory selection page is fully bilingual.
|
||||||
|
|
||||||
|
|
||||||
|
## Telegram Workflow & Safety
|
||||||
|
|
||||||
|
OCM is designed primarily for **Telegram-based OpenClaw workflows**:
|
||||||
|
|
||||||
|
- Bind Telegram groups to one or more main agents, then create sub-agents under each tree
|
||||||
|
- Keep each agent's context isolated via independent `workspace`, `SOUL.md`, and `MEMORY.md`
|
||||||
|
- OCM mainly helps you **safely update `openclaw.json`** via UI instead of manual editing
|
||||||
|
- Recommended for users who already have basic OpenClaw CLI experience (`onboard`, auth, gateway logs)
|
||||||
|
|
||||||
|
Critical Telegram settings:
|
||||||
|
|
||||||
|
- In BotFather, keep **Allow Groups = ON**
|
||||||
|
- In BotFather, set **Group Privacy = OFF**
|
||||||
|
- For each agent group, keep it private: **only you + that agent/sub-agents**
|
||||||
|
- Do **not** invite other people to these groups (cost and security risk)
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Node.js 18+ ([download](https://nodejs.org/))
|
||||||
|
- A working [OpenClaw](https://github.com/anthropics/openclaw) installation
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
The app locates your OpenClaw config directory in this order:
|
On first launch, OCM auto-detects `~/.openclaw` and creates a local `manager-config.json`. If your OpenClaw config is elsewhere, use **Actions → Switch OpenClaw Dir** or specify it directly:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash start.sh --dir /path/to/.openclaw --port 8080
|
||||||
|
```
|
||||||
|
|
||||||
|
Detection priority:
|
||||||
|
|
||||||
| Priority | Method |
|
| Priority | Method |
|
||||||
|----------|--------|
|
|----------|--------|
|
||||||
@@ -124,9 +122,17 @@ You can also create `manager-config.json` manually:
|
|||||||
{ "dir": "~/.openclaw" }
|
{ "dir": "~/.openclaw" }
|
||||||
```
|
```
|
||||||
|
|
||||||
`~` expands to your home directory on all platforms. `manager-config.json` is in `.gitignore` and won't be committed.
|
`manager-config.json` is gitignored and won't be committed.
|
||||||
|
|
||||||
## Optional: Shell Alias
|
## Remote Access
|
||||||
|
|
||||||
|
By default OCM binds to `0.0.0.0` (all interfaces). Access it from another device on your LAN using the IP shown at startup. To restrict to localhost only:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash start.sh --host 127.0.0.1
|
||||||
|
```
|
||||||
|
|
||||||
|
## Shell Alias (Optional)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Add to ~/.zshrc or ~/.bashrc
|
# Add to ~/.zshrc or ~/.bashrc
|
||||||
@@ -137,14 +143,12 @@ alias ocm="bash ~/path/to/ocm/start.sh"
|
|||||||
|
|
||||||
```
|
```
|
||||||
ocm/
|
ocm/
|
||||||
├── openclaw-manager.js ← The entire app (server + frontend, single file)
|
├── openclaw-manager.js ← Entire app (server + frontend, single file)
|
||||||
├── start.sh ← macOS/Linux start script (auto-detect Node, port, config)
|
├── start.sh ← macOS/Linux launcher (auto-detect, port conflict handling)
|
||||||
├── start.bat ← Windows start script
|
├── start.bat ← Windows launcher
|
||||||
├── OpenClaw Manager.app/ ← macOS Finder double-click launcher
|
├── OpenClaw Manager.app/ ← macOS Finder double-click launcher
|
||||||
├── screenshots/ ← README screenshots
|
├── manager-config.json ← Local config (gitignored)
|
||||||
├── manager-config.json ← Local config (gitignored)
|
├── DEVLOG.md ← Development log
|
||||||
├── package.json
|
|
||||||
├── DEVLOG.md ← Development log
|
|
||||||
└── README.md
|
└── README.md
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -162,89 +166,54 @@ MIT
|
|||||||
|
|
||||||
## 中文说明
|
## 中文说明
|
||||||
|
|
||||||
### 简介
|
OpenClaw Manager 是一个零依赖的本地 Web 管理界面,用于可视化管理 [OpenClaw](https://github.com/anthropics/openclaw) AI 智能体。所有代码在一个 `.js` 文件中,只需 Node.js 18+,不需要 `npm install`。
|
||||||
|
|
||||||
OpenClaw Manager 是一个零依赖的本地 Web 管理界面,用于可视化管理 [OpenClaw](https://github.com/anthropics/openclaw) AI 智能体。所有代码合并在一个 `.js` 文件中,只需要 Node.js 18+,不需要 `npm install`。
|
|
||||||
|
|
||||||
### 界面预览
|
|
||||||
|
|
||||||
#### 模式选择
|
|
||||||

|
|
||||||
|
|
||||||
#### Agent 管理 & 新建向导
|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
#### 模型选择 & 操作菜单
|
|
||||||
首次安装后,通过 **Actions → Switch OpenClaw Dir** 指向你的 OpenClaw 配置目录即可开始使用。
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
#### Cron 定时任务
|
|
||||||

|
|
||||||
|
|
||||||
#### 内置 CLI 终端
|
|
||||||
底部终端面板,支持实时流式输出、预设命令、收藏夹、Tab 补全。
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
### 功能一览
|
|
||||||
|
|
||||||
- **Agent 管理** — 新建子智能体(含向导)、内联切换模型、查看/编辑工作区文件、删除(自动备份)
|
|
||||||
- **模型选择** — 修改全局主模型、编辑 Fallback 链
|
|
||||||
- **认证引导** — 各 Provider 分步操作指引 + 一键复制 CLI 命令
|
|
||||||
- **Token 用量统计** — 解析网关日志,按模型/天汇总 Token 和费用
|
|
||||||
- **Cron 任务管理** — 查看、添加、启用/禁用、手动触发 openclaw 相关定时任务
|
|
||||||
- **Workspace 文件浏览器** — 查看所有工作区文件,默认只读,可切换编辑
|
|
||||||
- **备份 & 回滚** — 每次写入前自动备份,一键回滚
|
|
||||||
- **NAS 备份** — SFTP/rsync 远程备份,兼容老设备 SSH 加密
|
|
||||||
- **内置 CLI 终端** — 实时流式输出、预设命令、Tab 补全
|
|
||||||
- **健康检查** — 自动运行 `openclaw doctor`,Header 显示状态徽章
|
|
||||||
- **中英双语** — 运行时随时切换
|
|
||||||
- **跨平台** — macOS / Linux / Windows
|
|
||||||
|
|
||||||
### 快速开始
|
### 快速开始
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/dtzp555-max/ocm.git
|
git clone https://github.com/dtzp555-max/ocm.git
|
||||||
cd ocm
|
cd ocm
|
||||||
|
bash start.sh # macOS / Linux
|
||||||
# macOS / Linux
|
start.bat # Windows
|
||||||
bash start.sh
|
|
||||||
|
|
||||||
# Windows
|
|
||||||
start.bat
|
|
||||||
```
|
```
|
||||||
|
|
||||||
访问 http://localhost:3333
|
访问 [http://localhost:3333](http://localhost:3333)。远程访问请使用 `bash start.sh --host 0.0.0.0`。
|
||||||
|
|
||||||
### 首次运行
|
### 功能
|
||||||
|
|
||||||
启动脚本会自动检测 `~/.openclaw` 目录并创建 `manager-config.json`。如果你的 OpenClaw 配置在其他位置,进入界面后点击 **Actions → Switch OpenClaw Dir** 切换即可。
|
- **Agent 管理** — 添加主 Agent 和子 Agent,树状结构查看,内联切换模型,浏览工作区文件
|
||||||
|
- **使用统计** — 从 OpenClaw 会话文件解析真实 Token 用量,按模型/Agent/日期维度展示
|
||||||
|
- **模型与认证** — 管理注册模型列表,内置 Provider 认证引导
|
||||||
|
- **内置终端** — 实时流式输出,预设命令,收藏夹,Tab 补全
|
||||||
|
- **运维面板** — 重启网关、查看日志、健康检查、本地/NAS 备份、Cron 任务管理
|
||||||
|
- **双语界面** — 中英文一键切换
|
||||||
|
|
||||||
### 指定 OpenClaw 目录
|
### Telegram 场景与安全提示
|
||||||
|
|
||||||
程序按以下优先级查找配置:
|
OCM 主要面向 **Telegram 场景**:
|
||||||
|
|
||||||
1. `--dir` 命令行参数
|
- 通过群组绑定主 Agent,并在每条树下管理多个 Sub-Agent
|
||||||
2. `OPENCLAW_DIR` 环境变量
|
- 让每个 Agent 拥有独立 `workspace`、`SOUL.md`、`MEMORY.md`
|
||||||
3. 同目录下的 `manager-config.json`
|
- 通过可视化方式更新 `openclaw.json`,减少手动改配置风险
|
||||||
4. `~/.openclaw`(默认)
|
- 建议使用者已具备基础 OpenClaw CLI 操作经验(如 `onboard`、认证、查看网关日志)
|
||||||
|
|
||||||
也可以手动创建 `manager-config.json`:
|
关键安全设置(务必确认):
|
||||||
|
|
||||||
|
- BotFather 里 **Allow Groups = ON**
|
||||||
|
- BotFather 里 **Group Privacy = OFF**
|
||||||
|
- 每个 Agent 群组只保留“你自己 + 对应 Agent/Sub-Agent”
|
||||||
|
- 不要邀请其他人进组(会带来安全和 API 费用风险)
|
||||||
|
|
||||||
|
### 配置
|
||||||
|
|
||||||
|
启动脚本自动检测 `~/.openclaw` 目录。如需指定其他路径:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash start.sh --dir /path/to/.openclaw --port 8080
|
||||||
|
```
|
||||||
|
|
||||||
|
也可手动创建 `manager-config.json`:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{ "dir": "~/.openclaw" }
|
{ "dir": "~/.openclaw" }
|
||||||
```
|
```
|
||||||
|
|
||||||
`~` 在所有平台自动展开为用户主目录。
|
|
||||||
|
|
||||||
### Shell 别名(可选)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 加到 ~/.zshrc 或 ~/.bashrc
|
|
||||||
alias ocm="bash ~/path/to/ocm/start.sh"
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
This is a user-facing summary derived from `DEVLOG.md`.
|
||||||
|
|
||||||
|
## v0.7.6
|
||||||
|
- Docs: annotated screenshots with arrows for key UI controls.
|
||||||
|
|
||||||
|
## v0.7.5
|
||||||
|
- Docs: built-in CLI terminal instructions + screenshot (tab completion, favorites, streaming output).
|
||||||
|
|
||||||
|
## v0.7.4
|
||||||
|
- Docs: English + Chinese usage guides with redacted screenshots.
|
||||||
|
|
||||||
|
## v0.7.1
|
||||||
|
- Dashboard guidance block for Telegram-first workflow + safety checklist.
|
||||||
|
- Model dropdown options sourced from `openclaw models list`.
|
||||||
|
|
||||||
|
## v0.7.0
|
||||||
|
- Dashboard redesign with circular CPU/RAM/DISK gauges and auto-refresh.
|
||||||
|
- Sub-agent creation flow rewritten (BotFather → group → group id → form) including allowlist helper.
|
||||||
|
|
||||||
|
## v0.6.6
|
||||||
|
- Fix: sub-agents correctly grouped under main for older config formats.
|
||||||
|
|
||||||
|
## v0.6.5
|
||||||
|
- New Dashboard tab + cache-busting headers and version checks.
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
# OCM FAQ
|
||||||
|
|
||||||
|
## Q: Telegram 群里经常显示 typing,但不回消息?
|
||||||
|
|
||||||
|
Most common cause is **BotFather Group Privacy** being ON.
|
||||||
|
|
||||||
|
Fix:
|
||||||
|
- BotFather → Your bot → Bot Settings → **Group Privacy** → **Turn off**
|
||||||
|
|
||||||
|
Also check:
|
||||||
|
- `openclaw status` (gateway healthy?)
|
||||||
|
- provider auth/rate limits (OCM → Auth page, and gateway logs)
|
||||||
|
|
||||||
|
## Q: 如何获取 Telegram Group ID(Peer ID / -100...)?
|
||||||
|
|
||||||
|
Typical workflow:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
openclaw gateway logs --follow
|
||||||
|
```
|
||||||
|
|
||||||
|
Send a message in the target group; the gateway logs usually contain the peer id.
|
||||||
|
|
||||||
|
## Q: 模型下拉列表为什么没有我想要的模型?
|
||||||
|
|
||||||
|
OCM sources model options from the real CLI output:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
openclaw models list
|
||||||
|
```
|
||||||
|
|
||||||
|
So if it doesn't show up in OCM, make sure it's registered/available in your OpenClaw environment.
|
||||||
|
|
||||||
|
## Q: Dashboard 里 Gateway HTTP Ping 显示 Unreachable?
|
||||||
|
|
||||||
|
Common reasons:
|
||||||
|
- Gateway not running
|
||||||
|
- Gateway binds to a different interface/port than OCM expects
|
||||||
|
- Local firewall/proxy interference
|
||||||
|
|
||||||
|
Try:
|
||||||
|
- `openclaw status`
|
||||||
|
- `openclaw gateway restart`
|
||||||
|
|
||||||
|
## Q: OCM 会把我的 token/个人信息上传出去吗?
|
||||||
|
|
||||||
|
OCM is designed as a **local** dashboard.
|
||||||
|
|
||||||
|
That said, your local OpenClaw config contains sensitive information. Follow the safety guidance:
|
||||||
|
- keep agent Telegram groups private
|
||||||
|
- don't share raw screenshots without redaction
|
||||||
|
|
||||||
|
See: `docs/SECURITY.md`.
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# Security Notes
|
||||||
|
|
||||||
|
OCM is a **local web UI** for managing OpenClaw. Security depends heavily on how you run OpenClaw and how you use Telegram.
|
||||||
|
|
||||||
|
## Recommended defaults
|
||||||
|
|
||||||
|
- **Run locally** and restrict host binding unless you intentionally expose it.
|
||||||
|
- Treat OpenClaw config as secrets: tokens, provider keys, account ids.
|
||||||
|
- Prefer separate workspaces for each agent/sub-agent.
|
||||||
|
|
||||||
|
## Telegram safety
|
||||||
|
|
||||||
|
Strongly recommended:
|
||||||
|
|
||||||
|
- **One Telegram group = one agent boundary** (context + purpose + workspace)
|
||||||
|
- Keep each agent group **private**: only you + the bot (and optionally your second account)
|
||||||
|
- Do **not** invite other people (cost + security risk)
|
||||||
|
|
||||||
|
Critical BotFather settings:
|
||||||
|
- Allow Groups = ON
|
||||||
|
- Group Privacy = OFF
|
||||||
|
|
||||||
|
## Sharing screenshots
|
||||||
|
|
||||||
|
If you share screenshots publicly:
|
||||||
|
- blur personal paths (e.g. `/Users/<name>/...`)
|
||||||
|
- blur Telegram group/peer IDs (e.g. `-100xxxxxxxxxx`)
|
||||||
|
- blur any tokens/keys if visible
|
||||||
|
|
||||||
|
This repo contains **redacted + annotated** screenshots under `docs/annotated-screenshots/`.
|
||||||
@@ -0,0 +1,291 @@
|
|||||||
|
# OCM Usage Guide (with screenshots)
|
||||||
|
|
||||||
|
> Audience: People who already have OpenClaw running locally (you can run `openclaw status` and read `openclaw gateway logs`).
|
||||||
|
>
|
||||||
|
> Goal: Use **OpenClaw Manager (OCM)** to make agent/sub-agent setup and day-to-day ops **visual, safer, and easier to audit**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 0) The pain: why OCM exists
|
||||||
|
|
||||||
|
Creating and maintaining OpenClaw agents is powerful, but the “default workflow” is often messy:
|
||||||
|
|
||||||
|
1) **Editing `openclaw.json` is risky**
|
||||||
|
- Deep/nested config, many fields.
|
||||||
|
- One accidental overwrite can break multiple agents (tokens, bindings, accountIds).
|
||||||
|
|
||||||
|
2) **Sub-agent topology is hard to see**
|
||||||
|
- With multiple bots + multiple groups, it’s not obvious which agent is bound to which Telegram peer.
|
||||||
|
|
||||||
|
3) **Model IDs are easy to misconfigure**
|
||||||
|
- A wrong `provider/model-id` can silently degrade performance, cause timeouts, or produce “typing…” with no reply.
|
||||||
|
|
||||||
|
4) **Usage and troubleshooting take time**
|
||||||
|
- Without tooling, you’re digging through JSONL sessions and gateway logs to answer: “who used tokens?”, “what failed?”, “which provider?”
|
||||||
|
|
||||||
|
OCM’s role: **a zero-dependency local UI** that helps you view and update OpenClaw configuration safely, keep changes auditable, and centralize common ops.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1) Why Telegram groups are the best way to build sub-agents
|
||||||
|
|
||||||
|
Think of it as:
|
||||||
|
|
||||||
|
> **One Telegram group = one agent boundary** (context + purpose + workspace).
|
||||||
|
|
||||||
|
### Benefits
|
||||||
|
|
||||||
|
1) **Clear isolation**
|
||||||
|
- Each agent speaks only inside its own group.
|
||||||
|
- Less cross-contamination between tasks.
|
||||||
|
|
||||||
|
2) **Controllable context**
|
||||||
|
- The group chat is the agent’s input stream.
|
||||||
|
- You can keep an agent “clean” by keeping the group focused.
|
||||||
|
|
||||||
|
3) **Natural delegation**
|
||||||
|
- A main agent can coordinate; sub-agents can specialize (tech / travel / finance / translation, etc.).
|
||||||
|
|
||||||
|
4) **Auditable**
|
||||||
|
- You can see exactly which message triggered which response.
|
||||||
|
|
||||||
|
### Safety / cost: keep groups private
|
||||||
|
|
||||||
|
Recommended rule:
|
||||||
|
|
||||||
|
- **Each agent group should contain only you + the bot** (and optionally your second account).
|
||||||
|
- Don’t invite other people:
|
||||||
|
- cost: anyone can trigger token usage
|
||||||
|
- safety: higher risk of prompt-injection / accidental tool actions
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2) Start OCM (macOS)
|
||||||
|
|
||||||
|
From the repo directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash start.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Then open: <http://localhost:3333>
|
||||||
|
|
||||||
|
Restrict to localhost only:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash start.sh --host 127.0.0.1
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3) Dashboard: check health first
|
||||||
|
|
||||||
|
The Dashboard is your “sanity check”:
|
||||||
|
|
||||||
|
- CPU / RAM / Disk
|
||||||
|
- gateway running status
|
||||||
|
- agent counts
|
||||||
|
|
||||||
|
Screenshot:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4) Create a main agent (with its own Telegram bot)
|
||||||
|
|
||||||
|
> Your `main` agent usually exists already. This section is for creating an additional **root agent** that owns its own Telegram bot/account.
|
||||||
|
|
||||||
|
### 4.1 BotFather prerequisites
|
||||||
|
|
||||||
|
1) Create a bot
|
||||||
|
- In Telegram, open **BotFather**
|
||||||
|
- Run `/newbot` → follow prompts → copy the bot token
|
||||||
|
|
||||||
|
2) Allow groups
|
||||||
|
- BotFather → your bot → Bot Settings
|
||||||
|
- **Allow Groups = ON**
|
||||||
|
|
||||||
|
3) Disable group privacy (critical)
|
||||||
|
- BotFather → your bot → Bot Settings → Group Privacy
|
||||||
|
- **Group Privacy = OFF**
|
||||||
|
|
||||||
|
If group privacy is ON, the bot can’t see normal group messages. The symptom often looks like:
|
||||||
|
- slow replies
|
||||||
|
- “typing…” appears frequently
|
||||||
|
- sometimes no response at all
|
||||||
|
|
||||||
|
### 4.2 Add the agent in OCM
|
||||||
|
|
||||||
|
Go to **Agents**:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Click `+ Add Agent` and fill:
|
||||||
|
|
||||||
|
- agent id / name
|
||||||
|
- workspace path (recommended: separate folder per agent)
|
||||||
|
- model (dropdown is sourced from `openclaw models list`)
|
||||||
|
- the BotFather token
|
||||||
|
|
||||||
|
OCM writes the agent + Telegram account/binding into `openclaw.json`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5) Create a sub-agent (recommended workflow)
|
||||||
|
|
||||||
|
### 5.1 Why a new group per sub-agent
|
||||||
|
|
||||||
|
- clean context isolation
|
||||||
|
- easier debugging
|
||||||
|
- easy to “turn off” by muting a group
|
||||||
|
|
||||||
|
### 5.2 Step-by-step
|
||||||
|
|
||||||
|
In **Agents** → `+ Add Sub-Agent`:
|
||||||
|
|
||||||
|
**Step 1 — Create a Telegram group**
|
||||||
|
- private group
|
||||||
|
- add only: you + the bot
|
||||||
|
|
||||||
|
**Step 2 — Get the Group ID (peer id)**
|
||||||
|
|
||||||
|
Use gateway logs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
openclaw gateway logs --follow
|
||||||
|
```
|
||||||
|
|
||||||
|
Send a message in the new group. In logs you should see something like:
|
||||||
|
|
||||||
|
- `-100xxxxxxxxxx` (Telegram group id)
|
||||||
|
|
||||||
|
**Step 3 — Fill the sub-agent form**
|
||||||
|
- choose the Parent Agent (which bot/account to share)
|
||||||
|
- paste the Group ID
|
||||||
|
- set workspace (recommended: its own folder)
|
||||||
|
- choose model
|
||||||
|
|
||||||
|
**Step 4 — Allowlist (optional but recommended)**
|
||||||
|
|
||||||
|
If you use `channels.telegram.allowFrom`, OCM can take “Your Telegram User ID” and append it automatically to the allowlist.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6) Verify bindings (Channels)
|
||||||
|
|
||||||
|
Go to **Channels**:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Here you can quickly validate:
|
||||||
|
- which agent is bound to which Telegram peer
|
||||||
|
- whether `main` has the catch-all binding (if you use that pattern)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7) Model settings (Models)
|
||||||
|
|
||||||
|
Go to **Models**:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Key idea:
|
||||||
|
- OCM uses the real CLI model list (`openclaw models list`) for dropdowns.
|
||||||
|
- This reduces “invalid model-id” mistakes.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8) Credentials (Auth)
|
||||||
|
|
||||||
|
Go to **Auth**:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Use this page to:
|
||||||
|
- see which provider profiles exist
|
||||||
|
- troubleshoot expired/missing tokens
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9) Usage stats (Stats)
|
||||||
|
|
||||||
|
Go to **Stats**:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can break down usage by:
|
||||||
|
- model
|
||||||
|
- agent
|
||||||
|
- time window
|
||||||
|
|
||||||
|
OCM parses usage from OpenClaw session JSONL files.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 10) Actions menu (ops shortcuts)
|
||||||
|
|
||||||
|
The **⚡ Actions** dropdown in the top-right provides common operational shortcuts:
|
||||||
|
- Restart Gateway
|
||||||
|
- Live Logs
|
||||||
|
- Manual Backup / Backups & Rollback
|
||||||
|
- NAS Backup Setup
|
||||||
|
- Health Check
|
||||||
|
- Open Config Dir / Switch OpenClaw Dir
|
||||||
|
|
||||||
|
Screenshot:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 10) Cron jobs (Cron)
|
||||||
|
|
||||||
|
Go to **Cron**:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can:
|
||||||
|
- see scheduled tasks (backup / update / health)
|
||||||
|
- run tasks manually
|
||||||
|
- enable/disable entries
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 11) Built-in CLI Terminal
|
||||||
|
|
||||||
|
OCM includes a built-in terminal panel to run OpenClaw CLI commands directly (for example: `openclaw status`, `openclaw gateway logs --follow`, `openclaw doctor`).
|
||||||
|
|
||||||
|
How to open: click **⌨️ Terminal** in the top navigation, or use the bottom CLI panel.
|
||||||
|
|
||||||
|
Highlights:
|
||||||
|
- **Tab completion** while typing commands
|
||||||
|
- **Common commands** dropdown to insert templates quickly
|
||||||
|
- **Favorites**: save frequently used commands and run them with one click
|
||||||
|
- **Streaming output** (stdout/stderr) for faster debugging
|
||||||
|
|
||||||
|
Screenshot:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 11) Fast troubleshooting
|
||||||
|
|
||||||
|
### “Typing…” but no reply in a Telegram group
|
||||||
|
|
||||||
|
Check (in order):
|
||||||
|
|
||||||
|
1) BotFather: **Group Privacy = OFF**
|
||||||
|
2) `openclaw status` (gateway healthy?)
|
||||||
|
3) provider auth / rate limit issues (Auth page + gateway logs)
|
||||||
|
|
||||||
|
### Model dropdown doesn’t show a model you expect
|
||||||
|
|
||||||
|
- dropdown comes from `openclaw models list`
|
||||||
|
- ensure the model is registered/visible in your OpenClaw environment
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Notes about screenshots
|
||||||
|
|
||||||
|
All screenshots in this guide are **redacted** (no personal paths, no Telegram IDs).
|
||||||
|
They live under `docs/redacted-screenshots/`.
|
||||||
@@ -0,0 +1,283 @@
|
|||||||
|
# OCM 功能使用说明(含截图)
|
||||||
|
|
||||||
|
> 面向:已经在本机安装并跑通 OpenClaw 的用户(至少会用 `openclaw status` / `openclaw gateway logs`)
|
||||||
|
>
|
||||||
|
> 目标:用 **OpenClaw Manager (OCM)** 把“创建 Agent / Sub-Agent、绑定 Telegram 群、管理模型/认证、看用量、看 cron”这套流程做成可视化、可回溯、低风险。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 0) 先说痛点:为什么要用 OCM
|
||||||
|
|
||||||
|
### 0.1 创建/维护 Agent 的典型痛点
|
||||||
|
|
||||||
|
1. **改 `openclaw.json` 容易改错**
|
||||||
|
- 字段多、层级深、容易手滑覆盖 token / accountId / bindings。
|
||||||
|
- 一次写错可能导致多个 Agent 全挂。
|
||||||
|
|
||||||
|
2. **Sub-Agent 的边界和“谁在用哪个 bot token”不直观**
|
||||||
|
- 多 Bot / 多 agent / 多群组绑定时,光靠肉眼看 JSON 很难确认拓扑结构是否正确。
|
||||||
|
|
||||||
|
3. **模型选择很容易“写了一个不存在的 model-id”**
|
||||||
|
- provider/model-id 拼错、或 provider 侧不支持,最后表现就是 Agent 变慢/报错/一直 typing。
|
||||||
|
|
||||||
|
4. **统计用量和排查问题耗时**
|
||||||
|
- 需要翻 session JSONL / gateway logs 才能知道谁在烧 token、哪里失败。
|
||||||
|
|
||||||
|
OCM 的定位:**把配置变更“可视化 + 可检查 + 可回滚(配合备份)”,并把常用运维入口集中起来。**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1) 为什么用 Telegram group 来建 Sub-Agent 最合适
|
||||||
|
|
||||||
|
> 这里讨论的是 OpenClaw 的一种非常实用的工作方式:**“一个 Telegram 群 = 一个 Agent 的工作空间/人格/上下文边界”**。
|
||||||
|
|
||||||
|
### 1.1 Telegram group 方案的优势
|
||||||
|
|
||||||
|
1. **边界天然清晰**
|
||||||
|
- 每个 Agent 只在自己的群里说话,和其他 Agent 隔离。
|
||||||
|
|
||||||
|
2. **上下文可控**
|
||||||
|
- 一个群的聊天记录就是该 Agent 的输入流;不会和别的任务混在一起。
|
||||||
|
|
||||||
|
3. **并发与分工自然**
|
||||||
|
- 主 Agent 负责总控/派工,Sub-Agent 负责专项:技术宅/旅行/理财/翻译……
|
||||||
|
|
||||||
|
4. **可审计**
|
||||||
|
- 群里发生了什么一眼可见;出问题也能定位是哪条消息触发。
|
||||||
|
|
||||||
|
### 1.2 为什么“群必须私密”(安全与成本)
|
||||||
|
|
||||||
|
- 强烈建议:**每个 Agent 群只留你自己 + 对应 bot(+ 必要时的另一个你自己的账号)**。
|
||||||
|
- 不要拉别人进来:
|
||||||
|
- 成本:别人一句话就触发 token 消耗
|
||||||
|
- 安全:可能诱导泄露信息/触发危险操作
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2) 启动与进入 OCM
|
||||||
|
|
||||||
|
### 2.1 启动(macOS)
|
||||||
|
|
||||||
|
在 OCM 目录:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash start.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
默认访问:<http://localhost:3333>
|
||||||
|
|
||||||
|
> 需要限制只能本机访问:`bash start.sh --host 127.0.0.1`
|
||||||
|
|
||||||
|
### 2.2 Dashboard(先看健康状态)
|
||||||
|
|
||||||
|
建议第一步先看 Dashboard,确认:
|
||||||
|
- 机器资源(CPU/RAM/DISK)
|
||||||
|
- OpenClaw gateway 是否 Running
|
||||||
|
- Agents 数量
|
||||||
|
|
||||||
|
截图示例:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3) 创建主 Agent(Main Agent / 独立 Bot)
|
||||||
|
|
||||||
|
> 你的 `main` 一般是默认存在的;这里重点讲“新增一个 **拥有独立 Telegram bot 的主 Agent**”。
|
||||||
|
|
||||||
|
### 3.1 BotFather 侧准备(必须)
|
||||||
|
|
||||||
|
1) 创建 bot
|
||||||
|
- 在 Telegram 找 **BotFather**
|
||||||
|
- 发送 `/newbot` → 按提示创建 → 拿到 bot token
|
||||||
|
|
||||||
|
2) 允许加群
|
||||||
|
- BotFather → 你的 bot → Bot Settings
|
||||||
|
- **Allow Groups = ON**
|
||||||
|
|
||||||
|
3) 关闭群隐私(非常关键)
|
||||||
|
- BotFather → 你的 bot → Bot Settings → Group Privacy
|
||||||
|
- **Group Privacy = OFF**
|
||||||
|
|
||||||
|
> 如果 Group Privacy 没关,bot 在群里看不到普通消息,会表现成“经常 typing 但没输出 / 没反应”。
|
||||||
|
|
||||||
|
### 3.2 在 OCM 添加主 Agent
|
||||||
|
|
||||||
|
进入 **Agents** 页面:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
点击 `+ Add Agent`,按表单填写:
|
||||||
|
- Agent id / name
|
||||||
|
- workspace 路径(建议独立目录)
|
||||||
|
- 选择模型(下拉来自 `openclaw models list`,更不容易选错)
|
||||||
|
- 填入刚拿到的 bot token
|
||||||
|
|
||||||
|
保存后,OCM 会把这颗主 Agent 写进 `openclaw.json`,并把 bot token 绑定到对应 `accountId`。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4) 创建 Sub-Agent(最常用)
|
||||||
|
|
||||||
|
### 4.1 为什么 Sub-Agent 要用“新群”
|
||||||
|
|
||||||
|
- 让每个 Sub-Agent 有自己独立的对话上下文、任务边界
|
||||||
|
- 出问题直接在该群排查,不污染主 Agent 的对话
|
||||||
|
|
||||||
|
### 4.2 Sub-Agent 创建流程(逐步)
|
||||||
|
|
||||||
|
进入 **Agents** 页面 → 点击 `+ Add Sub-Agent`,按引导做:
|
||||||
|
|
||||||
|
#### Step 1:建 Telegram 群
|
||||||
|
- 新建群(私密)
|
||||||
|
- 群里只加:你自己 + 对应的 bot
|
||||||
|
|
||||||
|
#### Step 2:拿到群 ID(Peer ID / Group ID)
|
||||||
|
OpenClaw 通常会在 gateway 日志里打印群的 peer id。
|
||||||
|
|
||||||
|
常见拿法:
|
||||||
|
```bash
|
||||||
|
openclaw gateway logs --follow
|
||||||
|
```
|
||||||
|
然后在 Telegram 群里随便发一句话,观察日志。
|
||||||
|
|
||||||
|
> 你会看到类似 `-100xxxxxxxxxx` 这样的 group id。
|
||||||
|
|
||||||
|
#### Step 3:回到 OCM 填表
|
||||||
|
- Parent Agent(选择共享哪个 bot/account)
|
||||||
|
- 填 Group ID
|
||||||
|
- workspace(建议单独目录)
|
||||||
|
- 选择模型
|
||||||
|
|
||||||
|
#### Step 4:写 allowlist(推荐)
|
||||||
|
如果你启用了 Telegram 的 allowlist(例如 `channels.telegram.allowFrom`),
|
||||||
|
OCM 的表单里可以填 “Your Telegram User ID”,让它自动把你的 user id 加进去,避免 DM/群消息被拒。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5) 绑定检查(Channels 页)
|
||||||
|
|
||||||
|
进入 **Channels**:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
这里能一眼看到:
|
||||||
|
- 哪个 agent 绑定了哪个 Telegram peer(群)
|
||||||
|
- main 的“兜底绑定”(any)是否存在
|
||||||
|
|
||||||
|
> 如果某个 Sub-Agent 绑定错群/丢 binding,最直观的就是在这里对不上。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6) 模型管理(Models 页)
|
||||||
|
|
||||||
|
进入 **模型**:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
关键点:
|
||||||
|
- 主模型(primary)和 fallback 链
|
||||||
|
- 下拉列表来自 `openclaw models list`(能减少“选了不存在模型”的问题)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7) 认证管理(Auth 页)
|
||||||
|
|
||||||
|
进入 **认证**:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
这里主要用来:
|
||||||
|
- 看当前有哪些 provider profile
|
||||||
|
- 排查某个 provider 是否过期/缺 token
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8) 用量统计(Stats 页)
|
||||||
|
|
||||||
|
进入 **Stats**:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
你可以按:
|
||||||
|
- 按模型聚合
|
||||||
|
- 按 Agent 聚合
|
||||||
|
- 按天趋势
|
||||||
|
|
||||||
|
> OCM 是从 OpenClaw 的 session JSONL 里解析真实 usage(比“看日志猜”靠谱)。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9) CLI 终端(内置)
|
||||||
|
|
||||||
|
OCM 内置一个 CLI 面板,用来直接运行 OpenClaw 命令(例如:`openclaw status`、`openclaw gateway logs --follow`、`openclaw doctor`)。
|
||||||
|
|
||||||
|
入口:点击顶部导航栏的 **⌨️ 终端**,或使用页面底部的 CLI 区域。
|
||||||
|
|
||||||
|
功能要点:
|
||||||
|
- **Tab 补全**:输入命令时按 Tab 进行补全/提示(适合 `openclaw ...` 子命令)
|
||||||
|
- **常用命令**:可从下拉选择,一键填充常用命令模板
|
||||||
|
- **收藏(Favorites)**:把常用命令保存为收藏,后续一键执行
|
||||||
|
- **实时输出**:执行后会流式显示 stdout/stderr,方便排错
|
||||||
|
|
||||||
|
截图示例:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 9) Actions 菜单(运维快捷入口)
|
||||||
|
|
||||||
|
右上角 **⚡ Actions** 下拉菜单提供常用运维操作:
|
||||||
|
- Restart Gateway(重启网关)
|
||||||
|
- Live Logs(实时日志)
|
||||||
|
- Manual Backup / Backups & Rollback(备份/回滚)
|
||||||
|
- NAS Backup Setup(NAS 备份配置)
|
||||||
|
- Health Check(健康检查)
|
||||||
|
- Open Config Dir / Switch OpenClaw Dir(打开/切换配置目录)
|
||||||
|
|
||||||
|
截图示例:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 9) Cron(定时任务)
|
||||||
|
|
||||||
|
进入 **Cron**:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
用途:
|
||||||
|
- 查看有哪些健康检查/更新/备份任务
|
||||||
|
- 手动运行
|
||||||
|
- 观察启用/禁用状态
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 10) 常见故障排查(快速)
|
||||||
|
|
||||||
|
### 10.1 Telegram 群里“一直 typing 但不回”
|
||||||
|
|
||||||
|
优先检查:
|
||||||
|
1) BotFather 的 **Group Privacy 是否 OFF**
|
||||||
|
2) OpenClaw gateway 是否健康(`openclaw status`)
|
||||||
|
3) provider 是否限流/超时(Auth 页 + gateway logs)
|
||||||
|
|
||||||
|
### 10.2 模型下拉没有你想要的模型
|
||||||
|
|
||||||
|
- 现在下拉是 `openclaw models list` 的真实输出。
|
||||||
|
- 先确保你在 OpenClaw 里已经注册/可见该模型。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 11) 推荐的“最佳实践”
|
||||||
|
|
||||||
|
- 每个 Agent 都用独立 workspace(隔离文件/记忆)
|
||||||
|
- 每个 Sub-Agent 都用独立 Telegram 群(隔离上下文)
|
||||||
|
- 群里不要加第三方(成本 + 安全)
|
||||||
|
- 任何“改配置的大动作”尽量先备份(OCM/脚本/手工都行)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 附:截图说明
|
||||||
|
|
||||||
|
本文截图来自 `docs/redacted-screenshots/`,已做脱敏(路径用户名、Telegram 绑定 ID 等均已模糊处理)。
|
||||||
|
After Width: | Height: | Size: 242 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 162 KiB |
|
After Width: | Height: | Size: 137 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 226 KiB |
|
After Width: | Height: | Size: 129 KiB |
|
After Width: | Height: | Size: 207 KiB |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "openclaw-manager",
|
"name": "openclaw-manager",
|
||||||
"version": "0.5.0",
|
"version": "0.7.1",
|
||||||
"description": "A local web UI for managing OpenClaw AI agents — no npm install required",
|
"description": "A local web UI for managing OpenClaw AI agents — no npm install required",
|
||||||
"main": "openclaw-manager.js",
|
"main": "openclaw-manager.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
@echo off
|
@echo off
|
||||||
:: ================================================================
|
:: ================================================================
|
||||||
:: OpenClaw Manager v0.5 — Windows 启动脚本
|
:: OpenClaw Manager v0.7.1 — Start Script (Windows)
|
||||||
::
|
::
|
||||||
:: 特性:
|
:: Features:
|
||||||
:: * 自动检测 Node.js,未安装时给出安装指引(winget/scoop/官网)
|
:: * Auto-detect Node.js, show install instructions if missing
|
||||||
:: * 自动检测 %USERPROFILE%\.openclaw 目录
|
:: * Auto-detect %USERPROFILE%\.openclaw directory
|
||||||
:: * 首次运行自动创建 manager-config.json
|
:: * Auto-create manager-config.json on first run
|
||||||
:: * 自动检测端口占用并建议替代端口
|
:: * Auto-kill previous OCM process if port is in use
|
||||||
:: * 支持 --dir / --port / --help 参数
|
:: * Supports --dir / --port / --host / --help
|
||||||
:: ================================================================
|
:: ================================================================
|
||||||
setlocal enabledelayedexpansion
|
setlocal enabledelayedexpansion
|
||||||
chcp 65001 >nul 2>&1
|
chcp 65001 >nul 2>&1
|
||||||
@@ -19,48 +19,47 @@ set "MIN_NODE_MAJOR=18"
|
|||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ===================================
|
echo ===================================
|
||||||
echo OpenClaw Manager v0.5
|
echo OpenClaw Manager v0.7.1
|
||||||
echo -----------------------------------
|
echo -----------------------------------
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
:: ── 检查主文件 ────────────────────────────────────────────────
|
:: ── Check main file ─────────────────────────────────────────
|
||||||
if not exist "%MANAGER_JS%" (
|
if not exist "%MANAGER_JS%" (
|
||||||
echo [X] 找不到 openclaw-manager.js
|
echo [X] Cannot find openclaw-manager.js
|
||||||
echo 期望路径: %MANAGER_JS%
|
echo Expected: %MANAGER_JS%
|
||||||
echo.
|
echo.
|
||||||
pause
|
pause
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
|
||||||
:: ── 检查 Node.js ─────────────────────────────────────────────
|
:: ── Check Node.js ───────────────────────────────────────────
|
||||||
where node >nul 2>&1
|
where node >nul 2>&1
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo [X] 未找到 Node.js
|
echo [X] Node.js not found
|
||||||
echo.
|
echo.
|
||||||
echo 安装方式(选一种即可):
|
echo Install Node.js (pick one):
|
||||||
echo.
|
echo.
|
||||||
echo 1^) winget: winget install OpenJS.NodeJS.LTS
|
echo 1^) winget: winget install OpenJS.NodeJS.LTS
|
||||||
echo 2^) scoop: scoop install nodejs-lts
|
echo 2^) scoop: scoop install nodejs-lts
|
||||||
echo 3^) 官网下载: https://nodejs.org/
|
echo 3^) Official: https://nodejs.org/
|
||||||
echo 4^) nvm-windows: https://github.com/coreybutler/nvm-windows
|
echo 4^) nvm-windows: https://github.com/coreybutler/nvm-windows
|
||||||
echo.
|
echo.
|
||||||
pause
|
pause
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
|
||||||
:: 获取主版本号并检查
|
|
||||||
for /f "tokens=1 delims=." %%v in ('node -e "process.stdout.write(process.versions.node)"') do (
|
for /f "tokens=1 delims=." %%v in ('node -e "process.stdout.write(process.versions.node)"') do (
|
||||||
set "NODE_MAJOR=%%v"
|
set "NODE_MAJOR=%%v"
|
||||||
)
|
)
|
||||||
|
|
||||||
if !NODE_MAJOR! LSS %MIN_NODE_MAJOR% (
|
if !NODE_MAJOR! LSS %MIN_NODE_MAJOR% (
|
||||||
echo [!] Node.js 版本过低(需要 ^>= v%MIN_NODE_MAJOR%)
|
echo [!] Node.js too old (need ^>= v%MIN_NODE_MAJOR%)
|
||||||
echo.
|
echo.
|
||||||
echo 安装方式(选一种即可):
|
echo Install Node.js (pick one):
|
||||||
echo.
|
echo.
|
||||||
echo 1^) winget: winget install OpenJS.NodeJS.LTS
|
echo 1^) winget: winget install OpenJS.NodeJS.LTS
|
||||||
echo 2^) scoop: scoop install nodejs-lts
|
echo 2^) scoop: scoop install nodejs-lts
|
||||||
echo 3^) 官网下载: https://nodejs.org/
|
echo 3^) Official: https://nodejs.org/
|
||||||
echo.
|
echo.
|
||||||
pause
|
pause
|
||||||
exit /b 1
|
exit /b 1
|
||||||
@@ -70,9 +69,10 @@ for /f "tokens=*" %%v in ('node -e "process.stdout.write('v'+process.versions.no
|
|||||||
echo [OK] Node.js %%v
|
echo [OK] Node.js %%v
|
||||||
)
|
)
|
||||||
|
|
||||||
:: ── 解析参数 ─────────────────────────────────────────────────
|
:: ── Parse arguments ─────────────────────────────────────────
|
||||||
set "DIR_ARG="
|
set "DIR_ARG="
|
||||||
set "PORT_ARG="
|
set "PORT_ARG="
|
||||||
|
set "HOST_ARG="
|
||||||
set "EXTRA_ARGS="
|
set "EXTRA_ARGS="
|
||||||
|
|
||||||
:parse_args
|
:parse_args
|
||||||
@@ -89,23 +89,29 @@ if /i "%~1"=="--port" (
|
|||||||
shift & shift
|
shift & shift
|
||||||
goto :parse_args
|
goto :parse_args
|
||||||
)
|
)
|
||||||
|
if /i "%~1"=="--host" (
|
||||||
|
set "HOST_ARG=%~2"
|
||||||
|
shift & shift
|
||||||
|
goto :parse_args
|
||||||
|
)
|
||||||
set "EXTRA_ARGS=!EXTRA_ARGS! %~1"
|
set "EXTRA_ARGS=!EXTRA_ARGS! %~1"
|
||||||
shift
|
shift
|
||||||
goto :parse_args
|
goto :parse_args
|
||||||
|
|
||||||
:show_help
|
:show_help
|
||||||
echo 用法: start.bat [选项]
|
echo Usage: start.bat [options]
|
||||||
echo.
|
echo.
|
||||||
echo 选项:
|
echo Options:
|
||||||
echo --dir ^<路径^> OpenClaw 配置目录(默认 %%USERPROFILE%%\.openclaw)
|
echo --dir ^<path^> OpenClaw config directory (default: %%USERPROFILE%%\.openclaw)
|
||||||
echo --port ^<端口^> 监听端口(默认 3333)
|
echo --port ^<port^> Listen port (default: 3333)
|
||||||
echo --help 显示帮助
|
echo --host ^<addr^> Bind address (default: 0.0.0.0)
|
||||||
|
echo --help Show this help
|
||||||
echo.
|
echo.
|
||||||
exit /b 0
|
exit /b 0
|
||||||
|
|
||||||
:after_args
|
:after_args
|
||||||
|
|
||||||
:: ── 检测 OpenClaw 配置目录 ───────────────────────────────────
|
:: ── Detect OpenClaw config directory ────────────────────────
|
||||||
set "OPENCLAW_DIR="
|
set "OPENCLAW_DIR="
|
||||||
if defined DIR_ARG (
|
if defined DIR_ARG (
|
||||||
set "OPENCLAW_DIR=!DIR_ARG!"
|
set "OPENCLAW_DIR=!DIR_ARG!"
|
||||||
@@ -117,54 +123,48 @@ if defined DIR_ARG (
|
|||||||
if not defined OPENCLAW_DIR set "OPENCLAW_DIR=%USERPROFILE%\.openclaw"
|
if not defined OPENCLAW_DIR set "OPENCLAW_DIR=%USERPROFILE%\.openclaw"
|
||||||
|
|
||||||
if exist "!OPENCLAW_DIR!" (
|
if exist "!OPENCLAW_DIR!" (
|
||||||
echo [OK] 配置目录: !OPENCLAW_DIR!
|
echo [OK] Config dir: !OPENCLAW_DIR!
|
||||||
) else (
|
) else (
|
||||||
echo [!] 配置目录不存在: !OPENCLAW_DIR!
|
echo [!] Config dir not found: !OPENCLAW_DIR!
|
||||||
echo 首次使用?请先运行 openclaw onboard 初始化。
|
echo First time? Run: openclaw onboard
|
||||||
)
|
)
|
||||||
|
|
||||||
:: ── 首次运行:自动创建 manager-config.json ────────────────────
|
:: ── First run: auto-create manager-config.json ──────────────
|
||||||
if not exist "%CONFIG_JSON%" (
|
if not exist "%CONFIG_JSON%" (
|
||||||
echo [-^>] 首次运行,创建 manager-config.json
|
echo [-^>] First run, creating manager-config.json
|
||||||
node -e "require('fs').writeFileSync('%CONFIG_JSON%',JSON.stringify({dir:'~/.openclaw'},null,2))"
|
node -e "require('fs').writeFileSync('%CONFIG_JSON%',JSON.stringify({dir:'~/.openclaw'},null,2))"
|
||||||
)
|
)
|
||||||
|
|
||||||
:: ── 检查端口可用性 ───────────────────────────────────────────
|
:: ── Port handling: kill old process if occupied ─────────────
|
||||||
set "PORT=3333"
|
set "PORT=3333"
|
||||||
if defined PORT_ARG set "PORT=!PORT_ARG!"
|
if defined PORT_ARG set "PORT=!PORT_ARG!"
|
||||||
|
|
||||||
netstat -an 2>nul | findstr /r ":%PORT% .*LISTENING" >nul 2>&1
|
:: Find PID using the port and kill it
|
||||||
if not errorlevel 1 (
|
for /f "tokens=5" %%p in ('netstat -ano 2^>nul ^| findstr /r ":!PORT! .*LISTENING"') do (
|
||||||
echo [!] 端口 !PORT! 已被占用
|
echo [!] Port !PORT! in use (PID %%p), stopping old process...
|
||||||
for %%p in (3334 3335 3336 8080 8888) do (
|
taskkill /PID %%p /F >nul 2>&1
|
||||||
netstat -an 2>nul | findstr /r ":%%p .*LISTENING" >nul 2>&1
|
timeout /t 1 /nobreak >nul 2>&1
|
||||||
if errorlevel 1 (
|
echo [OK] Old process stopped
|
||||||
echo 尝试备用端口 %%p...
|
|
||||||
set "PORT=%%p"
|
|
||||||
set "PORT_ARG=%%p"
|
|
||||||
goto :port_ok
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
:port_ok
|
|
||||||
|
|
||||||
:: ── 构建启动命令 ─────────────────────────────────────────────
|
:: ── Build launch command ────────────────────────────────────
|
||||||
set "CMD_ARGS="
|
set "CMD_ARGS="
|
||||||
if defined DIR_ARG set "CMD_ARGS=!CMD_ARGS! --dir "!DIR_ARG!""
|
if defined DIR_ARG set "CMD_ARGS=!CMD_ARGS! --dir "!DIR_ARG!""
|
||||||
if defined PORT_ARG set "CMD_ARGS=!CMD_ARGS! --port !PORT_ARG!"
|
if defined PORT_ARG set "CMD_ARGS=!CMD_ARGS! --port !PORT_ARG!"
|
||||||
|
if defined HOST_ARG set "CMD_ARGS=!CMD_ARGS! --host !HOST_ARG!"
|
||||||
if defined EXTRA_ARGS set "CMD_ARGS=!CMD_ARGS! !EXTRA_ARGS!"
|
if defined EXTRA_ARGS set "CMD_ARGS=!CMD_ARGS! !EXTRA_ARGS!"
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo [^>] 启动中 -^> http://localhost:!PORT!
|
echo [^>] Starting -^> http://localhost:!PORT!
|
||||||
echo Ctrl+C 停止
|
echo Ctrl+C to stop
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
:: ── 启动 ─────────────────────────────────────────────────────
|
:: ── Launch ──────────────────────────────────────────────────
|
||||||
node "%MANAGER_JS%"!CMD_ARGS!
|
node "%MANAGER_JS%"!CMD_ARGS!
|
||||||
|
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo.
|
echo.
|
||||||
echo [X] 启动失败,请检查上方错误信息。
|
echo [X] Failed to start. Check errors above.
|
||||||
pause
|
pause
|
||||||
)
|
)
|
||||||
endlocal
|
endlocal
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# ================================================================
|
# ================================================================
|
||||||
# OpenClaw Manager v0.5 — 跨平台启动脚本 (macOS / Linux)
|
# OpenClaw Manager v0.7.1 — Start Script (macOS / Linux)
|
||||||
#
|
#
|
||||||
# 特性:
|
# Features:
|
||||||
# • 自动检测 Node.js,未安装时给出安装指引
|
# - Auto-detect Node.js, show install instructions if missing
|
||||||
# • 自动检测 ~/.openclaw 目录,不存在时提示
|
# - Auto-detect ~/.openclaw directory
|
||||||
# • 首次运行自动创建 manager-config.json
|
# - Auto-create manager-config.json on first run
|
||||||
# • 自动检测端口占用并建议替代端口
|
# - Auto-kill previous OCM process if port is in use
|
||||||
# • 支持 --dir / --port / --help 参数
|
# - Supports --dir / --port / --host / --help
|
||||||
# ================================================================
|
# ================================================================
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -16,62 +16,63 @@ MANAGER_JS="$SCRIPT_DIR/openclaw-manager.js"
|
|||||||
CONFIG_JSON="$SCRIPT_DIR/manager-config.json"
|
CONFIG_JSON="$SCRIPT_DIR/manager-config.json"
|
||||||
MIN_NODE_MAJOR=18
|
MIN_NODE_MAJOR=18
|
||||||
|
|
||||||
# ── 颜色 ─────────────────────────────────────────────────────
|
# ── Colors ────────────────────────────────────────────────────
|
||||||
RED='\033[0;31m'; YELLOW='\033[1;33m'; GREEN='\033[0;32m'
|
RED='\033[0;31m'; YELLOW='\033[1;33m'; GREEN='\033[0;32m'
|
||||||
CYAN='\033[0;36m'; BOLD='\033[1m'; DIM='\033[2m'; RESET='\033[0m'
|
CYAN='\033[0;36m'; BOLD='\033[1m'; DIM='\033[2m'; RESET='\033[0m'
|
||||||
|
|
||||||
banner() {
|
banner() {
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${CYAN}${BOLD} 🦀 OpenClaw Manager v0.5${RESET}"
|
echo -e "${CYAN}${BOLD} 🦀 OpenClaw Manager v0.7.1${RESET}"
|
||||||
echo -e "${DIM} ─────────────────────────────${RESET}"
|
echo -e "${DIM} ─────────────────────────────${RESET}"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
banner
|
banner
|
||||||
|
|
||||||
# ── 检查主文件 ────────────────────────────────────────────────
|
# ── Check main file ──────────────────────────────────────────
|
||||||
if [ ! -f "$MANAGER_JS" ]; then
|
if [ ! -f "$MANAGER_JS" ]; then
|
||||||
echo -e "${RED}✗ 找不到 openclaw-manager.js${RESET}"
|
echo -e "${RED}✗ Cannot find openclaw-manager.js${RESET}"
|
||||||
echo -e " 期望路径: ${DIM}$MANAGER_JS${RESET}"
|
echo -e " Expected: ${DIM}$MANAGER_JS${RESET}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── 检查 Node.js ─────────────────────────────────────────────
|
# ── Check Node.js ────────────────────────────────────────────
|
||||||
install_node_hint() {
|
install_node_hint() {
|
||||||
echo ""
|
echo ""
|
||||||
echo -e " ${BOLD}安装方式(选一种即可):${RESET}"
|
echo -e " ${BOLD}Install Node.js (pick one):${RESET}"
|
||||||
echo ""
|
echo ""
|
||||||
if [[ "$(uname)" == "Darwin" ]]; then
|
if [[ "$(uname)" == "Darwin" ]]; then
|
||||||
echo -e " ${GREEN}1)${RESET} Homebrew: ${CYAN}brew install node${RESET}"
|
echo -e " ${GREEN}1)${RESET} Homebrew: ${CYAN}brew install node${RESET}"
|
||||||
echo -e " ${GREEN}2)${RESET} 官网下载: ${CYAN}https://nodejs.org/${RESET}"
|
echo -e " ${GREEN}2)${RESET} Official: ${CYAN}https://nodejs.org/${RESET}"
|
||||||
echo -e " ${GREEN}3)${RESET} nvm: ${CYAN}curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash${RESET}"
|
echo -e " ${GREEN}3)${RESET} nvm: ${CYAN}curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash${RESET}"
|
||||||
echo -e " ${DIM}然后 nvm install --lts${RESET}"
|
echo -e " ${DIM}then: nvm install --lts${RESET}"
|
||||||
else
|
else
|
||||||
echo -e " ${GREEN}1)${RESET} apt: ${CYAN}sudo apt install -y nodejs npm${RESET}"
|
echo -e " ${GREEN}1)${RESET} apt: ${CYAN}sudo apt install -y nodejs npm${RESET}"
|
||||||
echo -e " ${GREEN}2)${RESET} 官网下载: ${CYAN}https://nodejs.org/${RESET}"
|
echo -e " ${GREEN}2)${RESET} Official: ${CYAN}https://nodejs.org/${RESET}"
|
||||||
echo -e " ${GREEN}3)${RESET} nvm: ${CYAN}curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash${RESET}"
|
echo -e " ${GREEN}3)${RESET} nvm: ${CYAN}curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash${RESET}"
|
||||||
echo -e " ${DIM}然后 nvm install --lts${RESET}"
|
echo -e " ${DIM}then: nvm install --lts${RESET}"
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! command -v node &>/dev/null; then
|
if ! command -v node &>/dev/null; then
|
||||||
echo -e "${RED}✗ 未找到 Node.js${RESET}"
|
echo -e "${RED}✗ Node.js not found${RESET}"
|
||||||
install_node_hint
|
install_node_hint
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NODE_VER=$(node -e "process.stdout.write(String(process.versions.node.split('.')[0]))")
|
NODE_VER=$(node -e "process.stdout.write(String(process.versions.node.split('.')[0]))")
|
||||||
if [ "$NODE_VER" -lt "$MIN_NODE_MAJOR" ]; then
|
if [ "$NODE_VER" -lt "$MIN_NODE_MAJOR" ]; then
|
||||||
echo -e "${YELLOW}⚠ Node.js 版本过低(当前 v$(node -v),需要 >= v${MIN_NODE_MAJOR})${RESET}"
|
echo -e "${YELLOW}⚠ Node.js too old (current $(node -v), need >= v${MIN_NODE_MAJOR})${RESET}"
|
||||||
install_node_hint
|
install_node_hint
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo -e " ${GREEN}✓${RESET} Node.js $(node -v)"
|
echo -e " ${GREEN}✓${RESET} Node.js $(node -v)"
|
||||||
|
|
||||||
# ── 解析参数 ─────────────────────────────────────────────────
|
# ── Parse arguments ──────────────────────────────────────────
|
||||||
DIR_ARG=""
|
DIR_ARG=""
|
||||||
PORT_ARG=""
|
PORT_ARG=""
|
||||||
|
HOST_ARG=""
|
||||||
EXTRA_ARGS=()
|
EXTRA_ARGS=()
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
@@ -80,20 +81,22 @@ while [[ $# -gt 0 ]]; do
|
|||||||
--dir=*) DIR_ARG="${1#*=}"; shift;;
|
--dir=*) DIR_ARG="${1#*=}"; shift;;
|
||||||
--port) PORT_ARG="$2"; shift 2;;
|
--port) PORT_ARG="$2"; shift 2;;
|
||||||
--port=*) PORT_ARG="${1#*=}"; shift;;
|
--port=*) PORT_ARG="${1#*=}"; shift;;
|
||||||
|
--host) HOST_ARG="$2"; shift 2;;
|
||||||
|
--host=*) HOST_ARG="${1#*=}"; shift;;
|
||||||
--help|-h)
|
--help|-h)
|
||||||
echo "用法: $0 [选项]"
|
echo "Usage: $0 [options]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "选项:"
|
echo "Options:"
|
||||||
echo " --dir <路径> OpenClaw 配置目录(默认 ~/.openclaw)"
|
echo " --dir <path> OpenClaw config directory (default: ~/.openclaw)"
|
||||||
echo " --port <端口> 监听端口(默认 3333)"
|
echo " --port <port> Listen port (default: 3333)"
|
||||||
echo " --help 显示帮助"
|
echo " --host <addr> Bind address (default: 0.0.0.0)"
|
||||||
|
echo " --help Show this help"
|
||||||
exit 0;;
|
exit 0;;
|
||||||
*) EXTRA_ARGS+=("$1"); shift;;
|
*) EXTRA_ARGS+=("$1"); shift;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# ── 检测 OpenClaw 配置目录 ───────────────────────────────────
|
# ── Detect OpenClaw config directory ─────────────────────────
|
||||||
# 优先级: --dir 参数 > manager-config.json > 环境变量 > 默认
|
|
||||||
OPENCLAW_DIR=""
|
OPENCLAW_DIR=""
|
||||||
if [ -n "$DIR_ARG" ]; then
|
if [ -n "$DIR_ARG" ]; then
|
||||||
OPENCLAW_DIR="${DIR_ARG/#\~/$HOME}"
|
OPENCLAW_DIR="${DIR_ARG/#\~/$HOME}"
|
||||||
@@ -106,55 +109,53 @@ fi
|
|||||||
[ -z "$OPENCLAW_DIR" ] && OPENCLAW_DIR="$HOME/.openclaw"
|
[ -z "$OPENCLAW_DIR" ] && OPENCLAW_DIR="$HOME/.openclaw"
|
||||||
|
|
||||||
if [ -d "$OPENCLAW_DIR" ]; then
|
if [ -d "$OPENCLAW_DIR" ]; then
|
||||||
echo -e " ${GREEN}✓${RESET} 配置目录: ${DIM}$OPENCLAW_DIR${RESET}"
|
echo -e " ${GREEN}✓${RESET} Config dir: ${DIM}$OPENCLAW_DIR${RESET}"
|
||||||
else
|
else
|
||||||
echo -e " ${YELLOW}⚠${RESET} 配置目录不存在: ${DIM}$OPENCLAW_DIR${RESET}"
|
echo -e " ${YELLOW}⚠${RESET} Config dir not found: ${DIM}$OPENCLAW_DIR${RESET}"
|
||||||
echo -e " ${DIM}首次使用?请先运行 openclaw onboard 初始化。${RESET}"
|
echo -e " ${DIM}First time? Run: openclaw onboard${RESET}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── 首次运行:自动创建 manager-config.json ────────────────────
|
# ── First run: auto-create manager-config.json ───────────────
|
||||||
if [ ! -f "$CONFIG_JSON" ]; then
|
if [ ! -f "$CONFIG_JSON" ]; then
|
||||||
echo -e " ${CYAN}→${RESET} 首次运行,创建 ${DIM}manager-config.json${RESET}"
|
echo -e " ${CYAN}→${RESET} First run, creating ${DIM}manager-config.json${RESET}"
|
||||||
node -e "require('fs').writeFileSync('$CONFIG_JSON',JSON.stringify({dir:'~/.openclaw'},null,2))"
|
node -e "require('fs').writeFileSync('$CONFIG_JSON',JSON.stringify({dir:'~/.openclaw'},null,2))"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── 检查端口可用性 ───────────────────────────────────────────
|
# ── Port handling: kill old process if occupied ──────────────
|
||||||
PORT="${PORT_ARG:-3333}"
|
PORT="${PORT_ARG:-3333}"
|
||||||
|
|
||||||
check_port() {
|
get_port_pid() {
|
||||||
if command -v lsof &>/dev/null; then
|
if command -v lsof &>/dev/null; then
|
||||||
lsof -i :"$1" -sTCP:LISTEN >/dev/null 2>&1 && return 1
|
lsof -ti :"$1" -sTCP:LISTEN 2>/dev/null || true
|
||||||
elif command -v ss &>/dev/null; then
|
elif command -v ss &>/dev/null; then
|
||||||
ss -tlnp 2>/dev/null | grep -q ":$1 " && return 1
|
ss -tlnp 2>/dev/null | grep ":$1 " | grep -oP 'pid=\K[0-9]+' || true
|
||||||
elif command -v netstat &>/dev/null; then
|
|
||||||
netstat -tlnp 2>/dev/null | grep -q ":$1 " && return 1
|
|
||||||
fi
|
fi
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! check_port "$PORT"; then
|
PORT_PID=$(get_port_pid "$PORT")
|
||||||
echo -e " ${YELLOW}⚠${RESET} 端口 ${PORT} 已被占用"
|
if [ -n "$PORT_PID" ]; then
|
||||||
# 尝试找一个可用端口
|
echo -e " ${YELLOW}⚠${RESET} Port ${PORT} in use (PID ${PORT_PID}), stopping old process..."
|
||||||
for ALT in 3334 3335 3336 8080 8888; do
|
kill "$PORT_PID" 2>/dev/null || true
|
||||||
if check_port "$ALT"; then
|
sleep 1
|
||||||
echo -e " ${DIM}尝试备用端口 ${ALT}...${RESET}"
|
# Force kill if still alive
|
||||||
PORT="$ALT"
|
if kill -0 "$PORT_PID" 2>/dev/null; then
|
||||||
PORT_ARG="$ALT"
|
kill -9 "$PORT_PID" 2>/dev/null || true
|
||||||
break
|
sleep 0.5
|
||||||
fi
|
fi
|
||||||
done
|
echo -e " ${GREEN}✓${RESET} Old process stopped"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── 构建启动命令 ─────────────────────────────────────────────
|
# ── Build launch command ─────────────────────────────────────
|
||||||
CMD_ARGS=()
|
CMD_ARGS=()
|
||||||
[ -n "$DIR_ARG" ] && CMD_ARGS+=(--dir "$DIR_ARG")
|
[ -n "$DIR_ARG" ] && CMD_ARGS+=(--dir "$DIR_ARG")
|
||||||
[ -n "$PORT_ARG" ] && CMD_ARGS+=(--port "$PORT_ARG")
|
[ -n "$PORT_ARG" ] && CMD_ARGS+=(--port "$PORT_ARG")
|
||||||
|
[ -n "$HOST_ARG" ] && CMD_ARGS+=(--host "$HOST_ARG")
|
||||||
CMD_ARGS+=("${EXTRA_ARGS[@]}")
|
CMD_ARGS+=("${EXTRA_ARGS[@]}")
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e " ${CYAN}▶${RESET} 启动中 → ${BOLD}http://localhost:${PORT}${RESET}"
|
echo -e " ${CYAN}▶${RESET} Starting → ${BOLD}http://localhost:${PORT}${RESET}"
|
||||||
echo -e " ${DIM}Ctrl+C 停止${RESET}"
|
echo -e " ${DIM}Ctrl+C to stop${RESET}"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# ── 启动 ─────────────────────────────────────────────────────
|
# ── Launch ───────────────────────────────────────────────────
|
||||||
exec node "$MANAGER_JS" "${CMD_ARGS[@]}"
|
exec node "$MANAGER_JS" "${CMD_ARGS[@]}"
|
||||||
|
|||||||