| 10224 | } |
| 10225 | |
| 10226 | static void install_additional_agent_configs(const cbm_detected_agents_t *agents, const char *home, |
| 10227 | const char *binary_path, bool force, bool dry_run) { |
| 10228 | if (agents->hermes) { |
| 10229 | char hermes_home[CLI_BUF_1K]; |
| 10230 | char cp[CLI_BUF_1K]; |
| 10231 | char skills_dir[CLI_BUF_1K]; |
| 10232 | cbm_hermes_home_dir(home, hermes_home, sizeof(hermes_home)); |
| 10233 | snprintf(cp, sizeof(cp), "%s/config.yaml", hermes_home); |
| 10234 | snprintf(skills_dir, sizeof(skills_dir), "%s/skills", hermes_home); |
| 10235 | install_generic_agent_config("Hermes", binary_path, cp, NULL, dry_run, |
| 10236 | cbm_upsert_hermes_mcp); |
| 10237 | install_agent_skill("Hermes", skills_dir, force, dry_run); |
| 10238 | if (g_install_plan) { |
| 10239 | plan_record("Hermes", "hook", cp); |
| 10240 | } else { |
| 10241 | int hook_result = CBM_YAML_IDENTITY_EDIT_OK; |
| 10242 | if (!dry_run) { |
| 10243 | hook_result = prepare_config_parent(cp) |
| 10244 | ? cbm_upsert_hermes_context_hook(cp, binary_path) |
| 10245 | : CBM_YAML_IDENTITY_EDIT_ERROR; |
| 10246 | } |
| 10247 | if (hook_result == CBM_YAML_IDENTITY_EDIT_FOREIGN) { |
| 10248 | record_agent_config_error(false, "Hermes", "pre_llm_hook_foreign", cp); |
| 10249 | } else if (hook_result != CBM_YAML_IDENTITY_EDIT_OK) { |
| 10250 | record_agent_config_error(false, "Hermes", "pre_llm_hook_install", cp); |
| 10251 | } else { |
| 10252 | printf(" hook: %s (pre_llm_call)\n", cp); |
| 10253 | } |
| 10254 | } |
| 10255 | } |
| 10256 | if (agents->openhands) { |
| 10257 | char cp[CLI_BUF_1K]; |
| 10258 | char skills_dir[CLI_BUF_1K]; |
| 10259 | char settings_path[CLI_BUF_1K]; |
| 10260 | char profiles_dir[CLI_BUF_1K]; |
| 10261 | snprintf(cp, sizeof(cp), "%s/.openhands/mcp.json", home); |
| 10262 | snprintf(skills_dir, sizeof(skills_dir), "%s/.agents/skills", home); |
| 10263 | snprintf(settings_path, sizeof(settings_path), "%s/.openhands/settings.json", home); |
| 10264 | snprintf(profiles_dir, sizeof(profiles_dir), "%s/.openhands/agent-profiles", home); |
| 10265 | install_generic_agent_config("OpenHands", binary_path, cp, NULL, dry_run, |
| 10266 | cbm_install_editor_mcp); |
| 10267 | install_agent_skill("OpenHands", skills_dir, force, dry_run); |
| 10268 | /* #1826: the mcpServers-shaped mcp.json above is not enough — OpenHands |
| 10269 | * only loads a server registered under settings.json -> mcp_config, and |
| 10270 | * only for agent profiles that reference it. agent-profiles/ is never |
| 10271 | * invented; a missing directory means nothing to register into yet. */ |
| 10272 | if (g_install_plan) { |
| 10273 | plan_record("OpenHands", "mcp_config", settings_path); |
| 10274 | } else { |
| 10275 | if (!dry_run) { |
| 10276 | if (!prepare_config_parent(settings_path) || |
| 10277 | cbm_upsert_openhands_settings_mcp(binary_path, settings_path) != CLI_OK) { |
| 10278 | record_agent_config_error(false, "OpenHands", "settings_mcp_install", |
| 10279 | settings_path); |
| 10280 | } |
| 10281 | } |
| 10282 | printf(" settings mcp_config: %s\n", settings_path); |
| 10283 | openhands_update_profile_refs(profiles_dir, true, dry_run); |
no test coverage detected