跳到主要内容

更新与卸载

更新

使用一条命令更新到最新版本:

hermes update

这会拉取最新代码、更新依赖,并提示你配置自上次更新以来添加的任何新选项。

提示

hermes update 自动检测新配置选项并提示你添加它们。如果你跳过了该提示,可以手动运行 hermes config check 查看缺失的选项,然后 hermes config migrate 交互式添加它们。

更新期间会发生什么

当你运行 hermes update 时,会执行以下步骤:

  1. Git pull — 从 main 分支拉取最新代码并更新子模块
  2. 依赖安装 — 运行 uv pip install -e ".[all]" 以获取新的或更改的依赖
  3. 配置迁移 — 检测自你的版本以来添加的新配置选项,并提示你设置它们
  4. 网关自动重启 — 如果网关服务正在运行(Linux 上的 systemd,macOS 上的 launchd),它在更新完成后自动重启,以便新代码立即生效

预期输出如下:

$ hermes update
Updating Hermes Agent...
📥 Pulling latest code...
Already up to date. (或者:Updating abc1234..def5678)
📦 Updating dependencies...
✅ Dependencies updated
🔍 Checking for new config options...
✅ Config is up to date (或者:Found 2 new options — running migration...)
🔄 Restarting gateway service...
✅ Gateway restarted
✅ Hermes Agent updated successfully!

推荐的更新后验证

hermes update 处理主要更新路径,但快速验证可以确认一切正常落地:

  1. git status --short — 如果树意外地不干净,在继续之前检查
  2. hermes doctor — 检查配置、依赖和服务健康
  3. hermes --version — 确认版本按预期更新
  4. 如果你使用网关:hermes gateway status
  5. 如果 doctor 报告 npm 审计问题:在标记的目录中运行 npm audit fix
更新后工作树不干净

如果 git status --shorthermes update 后显示意外更改,停下来检查它们。这通常意味着本地修改被重新应用到更新后的代码之上,或者依赖步骤刷新了锁文件。

检查当前版本

hermes version

GitHub releases 页面 上的最新版本比较,或检查可用更新:

hermes update --check

从消息平台更新

你也可以通过 Telegram、Discord、Slack 或 WhatsApp 直接更新,发送:

/update

这会拉取最新代码、更新依赖并重启网关。机器人会在重启期间短暂下线(通常 5-15 秒),然后恢复。

手动更新

如果你手动安装(不是通过快速安装程序):

cd /path/to/hermes-agent
export VIRTUAL_ENV="$(pwd)/venv"

# 拉取最新代码和子模块
git pull origin main
git submodule update --init --recursive

# 重新安装(获取新依赖)
uv pip install -e ".[all]"
uv pip install -e "./tinker-atropos"

# 检查新配置选项
hermes config check
hermes config migrate # 交互式添加任何缺失的选项

回滚说明

如果更新引入问题,你可以回滚到以前的版本:

cd /path/to/hermes-agent

# 列出最近版本
git log --oneline -10

# 回滚到特定提交
git checkout <commit-hash>
git submodule update --init --recursive
uv pip install -e ".[all]"

# 如果网关正在运行则重启
hermes gateway restart

要回滚到特定发布标签:

git checkout v0.6.0
git submodule update --init --recursive
uv pip install -e ".[all]"
注意

回滚可能导致配置不兼容(如果添加了新选项)。回滚后在 config.yaml 中运行 hermes config check 并删除任何无法识别的选项(如果遇到错误)。

Nix 用户注意事项

如果你通过 Nix flake 安装,更新通过 Nix 包管理器管理:

# 更新 flake 输入
nix flake update hermes-agent

# 或者使用最新版本重建
nix profile upgrade hermes-agent

Nix 安装是不可变的——回滚由 Nix 的生成系统处理:

nix profile rollback

请参阅 Nix 设置 了解更多详情。


卸载

hermes uninstall

卸载程序会给你保留配置文件的选项(~/.hermes/),以便将来重新安装。

手动卸载

rm -f ~/.local/bin/hermes
rm -rf /path/to/hermes-agent
rm -rf ~/.hermes # 可选——如果你计划重新安装则保留
信息

如果你将网关安装为系统服务,先停止并禁用它:

hermes gateway stop
# Linux: systemctl --user disable hermes-gateway
# macOS: launchctl remove ai.hermes.gateway