| 8000 | } |
| 8001 | |
| 8002 | static void install_devin_durable_context(const cbm_agent_registry_context_t *registry, |
| 8003 | const char *binary_path, const char *config_path, |
| 8004 | bool config_resolved, bool inherit_claude_session, |
| 8005 | bool force, bool dry_run) { |
| 8006 | char devin_dir[CLI_BUF_1K]; |
| 8007 | char instructions_path[CLI_BUF_1K]; |
| 8008 | char skills_dir[CLI_BUF_1K]; |
| 8009 | if (!cbm_devin_user_dir(registry, devin_dir, sizeof(devin_dir))) { |
| 8010 | record_agent_config_error(false, "Devin CLI / Local", "context_resolve", "devin"); |
| 8011 | return; |
| 8012 | } |
| 8013 | snprintf(instructions_path, sizeof(instructions_path), "%s/AGENTS.md", devin_dir); |
| 8014 | snprintf(skills_dir, sizeof(skills_dir), "%s/skills", devin_dir); |
| 8015 | install_managed_agent_instructions("Devin CLI / Local", instructions_path, dry_run); |
| 8016 | install_agent_skill("Devin CLI / Local", skills_dir, force, dry_run); |
| 8017 | bool hook_supported = cbm_optional_hook_supported("devin", registry->options.is_windows); |
| 8018 | if (g_install_plan) { |
| 8019 | if (hook_supported) { |
| 8020 | plan_record("Devin CLI / Local", "hook", config_path); |
| 8021 | } |
| 8022 | return; |
| 8023 | } |
| 8024 | if (!hook_supported) { |
| 8025 | printf(" hooks: withheld on Windows (vendor hook shell is undocumented)\n"); |
| 8026 | return; |
| 8027 | } |
| 8028 | if (!config_resolved) { |
| 8029 | printf(" hooks: skipped because the config path was unresolved\n"); |
| 8030 | return; |
| 8031 | } |
| 8032 | bool installed = true; |
| 8033 | if (!dry_run && ((inherit_claude_session && |
| 8034 | cbm_remove_devin_session_hook(config_path, binary_path) != CLI_OK) || |
| 8035 | cbm_upsert_devin_context_hooks(config_path, binary_path, |
| 8036 | !inherit_claude_session) != CLI_OK)) { |
| 8037 | installed = false; |
| 8038 | record_agent_config_error(false, "Devin CLI / Local", "lifecycle_hook_install", |
| 8039 | config_path); |
| 8040 | } |
| 8041 | if (installed) { |
| 8042 | printf(" hooks: %sUserPromptSubmit + PostCompaction (fail-open context)\n", |
| 8043 | inherit_claude_session ? "" : "SessionStart + "); |
| 8044 | } |
| 8045 | } |
| 8046 | |
| 8047 | /* Write a generated client extension module into `path` as a managed block. |
| 8048 | * |
no test coverage detected