| 9127 | } |
| 9128 | |
| 9129 | static void install_devin_durable_context(const cbm_agent_registry_context_t *registry, |
| 9130 | const char *binary_path, const char *config_path, |
| 9131 | bool config_resolved, bool inherit_claude_session, |
| 9132 | bool force, bool dry_run) { |
| 9133 | char devin_dir[CLI_BUF_1K]; |
| 9134 | char instructions_path[CLI_BUF_1K]; |
| 9135 | char skills_dir[CLI_BUF_1K]; |
| 9136 | if (!cbm_devin_user_dir(registry, devin_dir, sizeof(devin_dir))) { |
| 9137 | record_agent_config_error(false, "Devin CLI / Local", "context_resolve", "devin"); |
| 9138 | return; |
| 9139 | } |
| 9140 | snprintf(instructions_path, sizeof(instructions_path), "%s/AGENTS.md", devin_dir); |
| 9141 | snprintf(skills_dir, sizeof(skills_dir), "%s/skills", devin_dir); |
| 9142 | install_managed_agent_instructions("Devin CLI / Local", instructions_path, dry_run); |
| 9143 | install_agent_skill("Devin CLI / Local", skills_dir, force, dry_run); |
| 9144 | bool hook_supported = cbm_optional_hook_supported("devin", registry->options.is_windows); |
| 9145 | if (g_install_plan) { |
| 9146 | if (hook_supported) { |
| 9147 | plan_record("Devin CLI / Local", "hook", config_path); |
| 9148 | } |
| 9149 | return; |
| 9150 | } |
| 9151 | if (!hook_supported) { |
| 9152 | printf(" hooks: withheld on Windows (vendor hook shell is undocumented)\n"); |
| 9153 | return; |
| 9154 | } |
| 9155 | if (!config_resolved) { |
| 9156 | printf(" hooks: skipped because the config path was unresolved\n"); |
| 9157 | return; |
| 9158 | } |
| 9159 | bool installed = true; |
| 9160 | if (!dry_run && ((inherit_claude_session && |
| 9161 | cbm_remove_devin_session_hook(config_path, binary_path) != CLI_OK) || |
| 9162 | cbm_upsert_devin_context_hooks(config_path, binary_path, |
| 9163 | !inherit_claude_session) != CLI_OK)) { |
| 9164 | installed = false; |
| 9165 | record_agent_config_error(false, "Devin CLI / Local", "lifecycle_hook_install", |
| 9166 | config_path); |
| 9167 | } |
| 9168 | if (installed) { |
| 9169 | printf(" hooks: %sUserPromptSubmit + PostCompaction (fail-open context)\n", |
| 9170 | inherit_claude_session ? "" : "SessionStart + "); |
| 9171 | } |
| 9172 | } |
| 9173 | |
| 9174 | /* Write a generated client extension module into `path` as a managed block. |
| 9175 | * |
no test coverage detected