Repository navigation
fix(config): resolve Hermes home via HERMES_HOME and platform default (prepare 2.2.1) - #248
Merged
Merged
Conversation
Hermes resolves its home as HERMES_HOME -> platform-native default (%LOCALAPPDATA%\hermes on Windows, ~/.hermes elsewhere). The config writer, inventory probe, detail extraction and skill roots all hard-coded ~/.hermes, so on Windows or any customized HERMES_HOME the config was written where Hermes never reads it and the command silently no-oped. Add a shared core helper getHermesHome() mirroring hermes-agent resolution and use it uniformly across the writer, inventory and skill fan-out. Fixes #131
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
bl config agent --agent hermes硬编码~/.hermes/config.yaml,忽略HERMES_HOME环境变量与平台原生默认路径。在 Windows(Hermes 默认 home 为%LOCALAPPDATA%\hermes)或任何自定义了HERMES_HOME的机器上,配置被写到 Hermes 根本不读的文件,命令却报告成功——模型/provider 变更静默失效。inventory 探测同样硬编码,会误报 hermes 为「未配置」。Fixes #131
根因
Hermes 自身按
hermes_constants.get_hermes_home()解析 home:HERMES_HOME环境变量 → 平台原生默认(win32 用%LOCALAPPDATA%\hermes,其它用~/.hermes)。CLI 的 writer / inventory probe / detailFields / skillRoots 四处都写死了~/.hermes,与 Hermes 真实行为不一致。改动
getHermesHome(home = homedir())(packages/core/src/utils/agent-home.ts),忠实镜像 Hermes 的解析顺序:HERMES_HOME(trim + 展开前导~)→ win32%LOCALAPPDATA%\hermes(无则~/AppData/Local/hermes)→ 其它平台~/.hermes;并从bailian-cli-core导出hermes.ts、inventory 的 skillRoots / probe paths / detect / detailFields、以及agents.ts的 skill fan-out 全部改用该 helper,保证「写入位置 = 探测位置 = Hermes 实际读取位置」agent-home.test.ts(HERMES_HOME 优先、~展开、Linux/macOS 与 Windows 平台默认、空值忽略);writer 单测新增 HERMES_HOME 重定向用例;inventory 单测新增 HERMES_HOME relocated 探测用例验证
pnpm run check(format + lint + typecheck)退出码 0skills-agents.test.ts在本地 macOS 有 9 个既有失败(clean main 同样失败,属环境问题,与本改动无关;CI ubuntu 上 main 为绿)