[Feature]: 原生支持 Hermes Agent 作为平台执行器(聊天 / SOP 节点 / 执行机器)
Problem
LoopForge 目前把 Hermes Agent 只当成 Local 的宿主(README「LoopForge Local」支持列表里已有 Hermes Agent — Portable edition),但平台侧执行器白名单里没有 hermes,所以聊天、SOP 节点、执行机器都无法把 Hermes 当执行器用:
internal/domain/agent.go的AgentCLIExecutorKinds = opencode / cursor / agy / kimi / pi / dsh / zcode,加上内置的 codebuddy / codex / claude-code;internal/httpapi/executor_models.go的executorModelCatalogs()没有 hermes 条目,聊天"执行器"下拉里也就没有它;internal/runtime/provider_agentcli.go+agent_cli_stream.go是按 CLI 一家一家写的 argv 拼装与事件流解析,没有 hermes 分支。
结果是:一个团队如果想把 Hermes Agent 接进来(它自带 skills、MCP 客户端、-z/--oneshot 非交互模式、可 serve 成 backend),只能把它包成 MCP 工具塞给别的执行器,拿不到节点级的 token / 成本 / 轨迹归属,也没法在 SOP 节点上直接选它。
Proposed behavior
把 hermes 提成和 zcode(#125)/ opencode 同级的 AgentCLI 类执行器,行为对齐现有实现:
- 凭证:个人设置里同一套表单 ——
API Key+Base URL+ 协议(chat / responses / messages)+ 手填模型 ID(CustomModel: true,目录留空、模型来自 Base URL,和 opencode/pi 一致)。 - 聊天与 SOP 节点:执行器下拉可选
Hermes Agent;SOP 角色的executorId可写hermes。 - 非交互调用:希望用
hermes -z/--oneshot "<prompt>"(只输出答案),或如果 Hermes 能提供稳定的 JSON/stream 事件格式(--json之类)则优先用,便于适配agent-cli-stream-v1的 stream-json 协议。 - MCP 注入:Hermes 本身是 MCP 客户端(stdio / http 都支持),角色上挂的 MCP server 需要能透传给它。
- 执行机器:
internal/runner/detect.go增加{Kind: "hermes", Binary: "hermes"},执行机器页给出安装引导;未安装时给出可执行的安装提示(npm / 官方安装脚本二选一,与本仓库BindAgentCLI的凭证注入方式一致)。 - 原生审批:
internal/runtime/conversation_approval.go里每个 CLI 都写了审批 hook 适配,Hermes 需要等价的 hook(它支持 PreToolUse 类钩子与 permission 模式),否则聊天里的写操作审批链路会缺一环。 - 能力目录:
onDemandCLICatalog()里标Bundled: false,走"首次使用时按需安装 + 缓存",不要把 hermes 塞进官方镜像(镜像体积已经很敏感)。 - 参考实现路径:直接照
AgentCLIZCode那一套(provider + credential writer + stream adapter + 前端 i18n 一条),不需要新架构。
Scope
Platform — runtime / deployment
(同时涉及 Platform — UI / integrations:执行器下拉、角色编辑里的模型选择、执行机器页的安装引导。)
Alternatives considered
- 包成 MCP 工具:写一个 stdio MCP server 内部调
hermes -z,挂到角色上。可立即用、不改镜像,但 Hermes 只是"被调用的工具",节点的 token / 成本 / trace 都记在调用方角色上,也无法在 SOP 里把 Hermes 本身设成节点执行器。 - shim 伪装成已有执行器:把 hermes 包成
dsh/opencode的替身并翻译事件流。能跑通文本回答,但工具调用、审批 hook、MCP 注入这些语义对不上。 - 改源码私自分支:可行但长期维护成本高,所以希望能进主线。
额外观察(自建部署上实测,供参考)
自建 0.3.8 镜像 + OpenAI 兼容网关(/v1/chat/completions 与 /v1/responses 均可用)时踩到几处,可能与上面的实现相关:
- dsh 被标成 Bundled 但镜像里没装:
onDemandCLICatalog()里dsh是Bundled: true,但ghcr.io/tencent/loopforge:0.3.8的/usr/local/bin只有codex/codebuddy/cbc,npm root -g也只有@openai、@tencent-ai。结果 dsh 既没预装、也不会走"按需安装",选中就报未安装;手动npm i -g @deepseek-ai/[email protected] --engine-strict=false之后才可用(该版本要求 node ≥ 24.9,镜像 node 22 → 需要 relax engines)。 - dsh 的模型目录 id 与自定义网关不一致:
executorModelCatalogs()["dsh"]里是deepseek-flash/deepseek-v4-pro,自定义 Base URL 的网关往往只认自家的模型名(比如deepseek-v4.1-flash-1017),选了内置项就以 404 Model not found 失败 —— 与 #461 是同一类症状的另一条路径。 - Codex + 自定义网关需要关掉 web_search:
assistant_provider.go的聊天路径传了-c web_search="disabled",但provider_codex.go的codexConfigArgs()没有;SOP 节点用 codex + 自建网关时会因此吃到invalid_value: Invalid value: web_search, Supported values are: function, mcp, knowledge_search, namespace。 - 通用 agent CLI 在 SOP 沙箱里不可用:
sandbox_docker.go的按需 CLI 挂载依赖isolatedRuntimeImage(dockerfile),只有 Dockerfile 内容严格等于IsolatedDockerfile时才注入AGENTFLOW_RUNTIME_CLI_PATH;项目里只要给「公共开发环境」加了一行(例如装 JDK / Maven / 一个新 CLI),就退化成自建镜像,opencode等 CLI 不在 PATH,节点直接exit status 127。建议把"挂载 CLI 目录并加入 PATH"与是否隔离镜像解耦。
(如果这些更适合单独开,我可以分别补 issue。)
Checks
- [x] This proposal does not require organization-specific infrastructure or credentials.
- [x] I searched existing issues and discussions for similar proposals(参考 #125 ZCode/Reasonix、#372 qoder、#461 dsh + CLI default)。
感谢详细的提案!理解你的诉求是:把 Hermes Agent 作为与 opencode / zcode 同级的平台执行器接入,让聊天、SOP 节点和执行机器都能直接选用它(含凭证、非交互调用、MCP 透传和审批 hook),同时附上了自建部署时遇到的几处 dsh / Codex / 沙箱 CLI 相关现象。
已经看到,会按现有 Issue 排期查看。
Hello LoopForge team, I would love to see this feature in LoopForge. Thank you!