| 8302 | } |
| 8303 | |
| 8304 | static void install_devin_durable_context(const cbm_agent_registry_context_t *registry, |
| 8305 | const char *binary_path, const char *config_path, |
| 8306 | bool config_resolved, bool inherit_claude_session, |
| 8307 | bool force, bool dry_run) { |
| 8308 | char devin_dir[CLI_BUF_1K]; |
| 8309 | char instructions_path[CLI_BUF_1K]; |
| 8310 | char skills_dir[CLI_BUF_1K]; |
| 8311 | if (!cbm_devin_user_dir(registry, devin_dir, sizeof(devin_dir))) { |
| 8312 | record_agent_config_error(false, "Devin CLI / Local", "context_resolve", "devin"); |
| 8313 | return; |
| 8314 | } |
| 8315 | snprintf(instructions_path, sizeof(instructions_path), "%s/AGENTS.md", devin_dir); |
| 8316 | snprintf(skills_dir, sizeof(skills_dir), "%s/skills", devin_dir); |
| 8317 | install_managed_agent_instructions("Devin CLI / Local", instructions_path, dry_run); |
| 8318 | install_agent_skill("Devin CLI / Local", skills_dir, force, dry_run); |
| 8319 | bool hook_supported = cbm_optional_hook_supported("devin", registry->options.is_windows); |
| 8320 | if (g_install_plan) { |
| 8321 | if (hook_supported) { |
| 8322 | plan_record("Devin CLI / Local", "hook", config_path); |
| 8323 | } |
| 8324 | return; |
| 8325 | } |
| 8326 | if (!hook_supported) { |
| 8327 | printf(" hooks: withheld on Windows (vendor hook shell is undocumented)\n"); |
| 8328 | return; |
| 8329 | } |
| 8330 | if (!config_resolved) { |
| 8331 | printf(" hooks: skipped because the config path was unresolved\n"); |
| 8332 | return; |
| 8333 | } |
| 8334 | bool installed = true; |
| 8335 | if (!dry_run && ((inherit_claude_session && |
| 8336 | cbm_remove_devin_session_hook(config_path, binary_path) != CLI_OK) || |
| 8337 | cbm_upsert_devin_context_hooks(config_path, binary_path, |
| 8338 | !inherit_claude_session) != CLI_OK)) { |
| 8339 | installed = false; |
| 8340 | record_agent_config_error(false, "Devin CLI / Local", "lifecycle_hook_install", |
| 8341 | config_path); |
| 8342 | } |
| 8343 | if (installed) { |
| 8344 | printf(" hooks: %sUserPromptSubmit + PostCompaction (fail-open context)\n", |
| 8345 | inherit_claude_session ? "" : "SessionStart + "); |
| 8346 | } |
| 8347 | } |
| 8348 | |
| 8349 | /* Write a generated client extension module into `path` as a managed block. |
| 8350 | * |
no test coverage detected