Skip to main content

更新与卸载

更新

使用单条命令即可更新到最新版本:

hermes update

该命令会拉取最新代码,更新依赖项,并提示你配置自上次更新以来新增的任何选项。

tip

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

更新时发生的过程

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

  1. Git 拉取 — 从 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. (or: Updating abc1234..def5678)
📦 Updating dependencies...
✅ Dependencies updated
🔍 Checking for new config options...
✅ Config is up to date (or: 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 --short 显示 hermes update 后出现意外更改,请停止并检查这些变更。这通常意味着本地修改被重新应用到了更新后的代码上,或某个依赖步骤刷新了锁文件。

检查当前版本

hermes version

GitHub 发布页面 上的最新版本对比,或检查是否有可用更新:

hermes update --check

从消息平台直接更新

你也可以通过 Telegram、Discord、Slack 或 WhatsApp 直接发送以下指令来更新:

/update

此操作将拉取最新代码,更新依赖,并重启网关。机器人在重启期间会短暂离线(通常为 5–15 秒),之后将恢复正常运行。

手动更新

如果你是手动安装的(非通过快速安装器):

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

# Pull latest code and submodules
git pull origin main
git submodule update --init --recursive

# Reinstall (picks up new dependencies)
uv pip install -e ".[all]"
uv pip install -e "./tinker-atropos"

# Check for new config options
hermes config check
hermes config migrate # Interactively add any missing options

回滚说明

若更新引入了问题,你可以回滚到之前的版本:

cd /path/to/hermes-agent

# List recent versions
git log --oneline -10

# Roll back to a specific commit
git checkout <commit-hash>
git submodule update --init --recursive
uv pip install -e ".[all]"

# Restart the gateway if running
hermes gateway restart

要回滚到特定发布标签:

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

回滚可能导致配置不兼容,特别是当新增了配置选项时。回滚后请运行 hermes config check,并删除 config.yaml 中任何无法识别的选项,以防出错。

Nix 用户注意

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

# Update the flake input
nix flake update hermes-agent

# Or rebuild with the latest
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 # Optional — keep if you plan to reinstall
info

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

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