更新
Moltbot 迭代较快(尚未到 “1.0”)。建议把更新当基础设施发布:更新 → 跑检查 → 重启(或用会重启的 moltbot update)→ 验证。
推荐:重新运行官网安装器(原地升级)
首选更新方式是重新运行官网的安装脚本。它会检测已有安装、原地升级,并在需要时执行 moltbot doctor。
curl -fsSL https://molt.bot/install.sh | bash说明:
- 若不想再次运行入门向导,可加
--no-onboard。 - 源码安装请使用:
curl -fsSL https://molt.bot/install.sh | bash -s -- --install-method git --no-onboard安装器仅在仓库工作区干净时执行 git pull --rebase。
- 全局安装时,脚本内部使用
npm install -g moltbot@latest。 - 兼容说明:
moltbot仍作为兼容 shim 提供。
更新前
- 确认安装方式:全局(npm/pnpm)还是源码(git clone)。
- 确认网关运行方式:前台终端还是托管服务(launchd/systemd)。
- 为你的定制做快照:
- 配置:
~/.clawdbot/moltbot.json - 凭据:
~/.clawdbot/credentials/ - 工作区:
~/clawd
- 配置:
更新(全局安装)
全局安装(任选其一):
npm i -g moltbot@latestpnpm add -g moltbot@latest不推荐将 Bun 用于 Gateway 运行时(WhatsApp/Telegram 存在已知问题)。
切换更新频道(git 与 npm 安装均可):
moltbot update --channel beta
moltbot update --channel dev
moltbot update --channel stable使用 --tag <dist-tag|version> 可一次性安装指定 tag/版本。
频道含义与发布说明见 开发频道。
说明:npm 安装时,网关启动会检查当前频道 tag 并输出更新提示。可通过 update.checkOnStart: false 关闭。然后:
moltbot doctor
moltbot gateway restart
moltbot health说明:
- 若网关以服务运行,优先使用
moltbot gateway restart,而不是杀进程。 - 若固定了某一版本,见下文「回滚 / 固定版本」。
更新(moltbot update)
源码安装(git 检出)时推荐:
moltbot update会执行相对安全的更新流程:
- 要求工作区干净。
- 切换到所选频道(tag 或分支)。
- 对配置的上游执行 fetch + rebase(dev 频道)。
- 安装依赖、构建、构建 Control UI,并运行
moltbot doctor。 - 默认会重启网关(加
--no-restart可跳过)。
若通过 npm/pnpm 安装(无 git 元数据),moltbot update 会尝试通过包管理器更新。若无法检测安装方式,请改用「更新(全局安装)」中的方式。
更新(Control UI / RPC)
Control UI 提供 Update & Restart(RPC:update.run)。它会:
- 执行与
moltbot update相同的源码更新流程(仅限 git 检出)。 - 写入带结构化报告的重启哨兵(stdout/stderr 尾部)。
- 重启网关并向最后活跃会话推送该报告。
若 rebase 失败,网关会中止并在不应用更新的情况下重启。
更新(从源码)
在仓库检出中操作。推荐:
moltbot update手动(效果类似):
git pull
pnpm install
pnpm build
pnpm ui:build # 首次运行会自动安装 UI 依赖
moltbot doctor
moltbot health说明:
- 使用打包的
moltbot二进制(moltbot.mjs)或通过 Node 运行dist/时,需要执行pnpm build。 - 若从仓库检出运行且未全局安装,CLI 命令请用
pnpm moltbot ...。 - 若直接运行 TypeScript(
pnpm moltbot ...),通常不必重新构建,但配置迁移仍会执行 → 需运行 doctor。 - 在全局安装与 git 安装间切换很容易:安装另一种方式后执行
moltbot doctor,网关服务入口会更新为当前安装。
务必执行:moltbot doctor
Doctor 是「安全更新」命令,设计上偏保守:修复 + 迁移 + 告警。
说明:若为源码安装(git 检出),moltbot doctor 可能会先提示运行 moltbot update。
常见操作包括:
- 迁移废弃配置项 / 旧配置路径。
- 审计 DM 策略并对有风险的「开放」设置告警。
- 检查网关健康并可提议重启。
- 检测并迁移旧版网关服务(launchd/systemd、旧 schtasks)为当前 Moltbot 服务。
- 在 Linux 上确保 systemd user lingering(使网关在用户登出后仍可运行)。
详见:Doctor
启动 / 停止 / 重启网关
CLI(各平台通用):
moltbot gateway status
moltbot gateway stop
moltbot gateway restart
moltbot gateway --port 18789
moltbot logs --follow若使用托管服务:
- macOS launchd(应用内 LaunchAgent):
launchctl kickstart -k gui/$UID/bot.molt.gateway(使用bot.molt.<profile>;旧版com.clawdbot.*仍可用) - Linux systemd 用户服务:
systemctl --user restart moltbot-gateway[-<profile>].service - Windows (WSL2):
systemctl --user restart moltbot-gateway[-<profile>].service- 仅当服务已安装时
launchctl/systemctl有效;否则先执行moltbot gateway install。
- 仅当服务已安装时
Runbook 与确切服务 label 见:Gateway runbook
回滚 / 固定版本(出问题时)
固定版本(全局安装)
安装已知可用版本(将 <version> 替换为最后可用的版本):
npm i -g moltbot@<version>pnpm add -g moltbot@<version>提示:查看当前已发布版本可运行 npm view moltbot version。然后重启并再次执行 doctor:
moltbot doctor
moltbot gateway restart按日期固定(源码)
选择某日期的提交(示例:「2026-01-01 时的 main」):
git fetch origin
git checkout "$(git rev-list -n 1 --before=\"2026-01-01\" origin/main)"然后重新安装依赖并重启:
pnpm install
pnpm build
moltbot gateway restart若之后想回到最新:
git checkout main
git pull若仍无法解决
- 再次运行
moltbot doctor并仔细看输出(通常会给出修复建议)。 - 参考:故障排查
- 到 Discord 询问:https://channels.discord.gg/clawd