Skip to content

更新与卸载

更新

使用单个命令更新到最新版本:

bash
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 后显示意外更改,请在继续之前停止并检查它们。这通常意味着本地修改在更新后的代码之上重新应用,或依赖项步骤刷新了锁定文件。

检查当前版本

bash
hermes version

GitHub 发布页面 上的最新版本进行比较或检查可用更新:

bash
hermes update --check

从消息平台更新

您还可以直接从 Telegram、Discord、Slack 或 WhatsApp 更新,发送:

/update

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

手动更新

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

bash
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   # 交互式添加任何缺少的选项

回滚说明

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

bash
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

要回滚到特定发布标签:

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

警告

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

Nix 用户注意事项

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

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

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

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

bash
nix profile rollback

更多详情请参阅 Nix 设置


卸载

bash
hermes uninstall

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

手动卸载

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

信息

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

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