| 8087 | } |
| 8088 | |
| 8089 | static void install_devin_durable_context(const cbm_agent_registry_context_t *registry, |
| 8090 | const char *binary_path, const char *config_path, |
| 8091 | bool config_resolved, bool inherit_claude_session, |
| 8092 | bool force, bool dry_run) { |
| 8093 | char devin_dir[CLI_BUF_1K]; |
| 8094 | char instructions_path[CLI_BUF_1K]; |
| 8095 | char skills_dir[CLI_BUF_1K]; |
| 8096 | if (!cbm_devin_user_dir(registry, devin_dir, sizeof(devin_dir))) { |
| 8097 | record_agent_config_error(false, "Devin CLI / Local", "context_resolve", "devin"); |
| 8098 | return; |
| 8099 | } |
| 8100 | snprintf(instructions_path, sizeof(instructions_path), "%s/AGENTS.md", devin_dir); |
| 8101 | snprintf(skills_dir, sizeof(skills_dir), "%s/skills", devin_dir); |
| 8102 | install_managed_agent_instructions("Devin CLI / Local", instructions_path, dry_run); |
| 8103 | install_agent_skill("Devin CLI / Local", skills_dir, force, dry_run); |
| 8104 | bool hook_supported = cbm_optional_hook_supported("devin", registry->options.is_windows); |
| 8105 | if (g_install_plan) { |
| 8106 | if (hook_supported) { |
| 8107 | plan_record("Devin CLI / Local", "hook", config_path); |
| 8108 | } |
| 8109 | return; |
| 8110 | } |
| 8111 | if (!hook_supported) { |
| 8112 | printf(" hooks: withheld on Windows (vendor hook shell is undocumented)\n"); |
| 8113 | return; |
| 8114 | } |
| 8115 | if (!config_resolved) { |
| 8116 | printf(" hooks: skipped because the config path was unresolved\n"); |
| 8117 | return; |
| 8118 | } |
| 8119 | bool installed = true; |
| 8120 | if (!dry_run && ((inherit_claude_session && |
| 8121 | cbm_remove_devin_session_hook(config_path, binary_path) != CLI_OK) || |
| 8122 | cbm_upsert_devin_context_hooks(config_path, binary_path, |
| 8123 | !inherit_claude_session) != CLI_OK)) { |
| 8124 | installed = false; |
| 8125 | record_agent_config_error(false, "Devin CLI / Local", "lifecycle_hook_install", |
| 8126 | config_path); |
| 8127 | } |
| 8128 | if (installed) { |
| 8129 | printf(" hooks: %sUserPromptSubmit + PostCompaction (fail-open context)\n", |
| 8130 | inherit_claude_session ? "" : "SessionStart + "); |
| 8131 | } |
| 8132 | } |
| 8133 | |
| 8134 | /* Write a generated client extension module into `path` as a managed block. |
| 8135 | * |
no test coverage detected