| 7894 | } |
| 7895 | |
| 7896 | static void install_devin_durable_context(const cbm_agent_registry_context_t *registry, |
| 7897 | const char *binary_path, const char *config_path, |
| 7898 | bool config_resolved, bool inherit_claude_session, |
| 7899 | bool force, bool dry_run) { |
| 7900 | char devin_dir[CLI_BUF_1K]; |
| 7901 | char instructions_path[CLI_BUF_1K]; |
| 7902 | char skills_dir[CLI_BUF_1K]; |
| 7903 | if (!cbm_devin_user_dir(registry, devin_dir, sizeof(devin_dir))) { |
| 7904 | record_agent_config_error(false, "Devin CLI / Local", "context_resolve", "devin"); |
| 7905 | return; |
| 7906 | } |
| 7907 | snprintf(instructions_path, sizeof(instructions_path), "%s/AGENTS.md", devin_dir); |
| 7908 | snprintf(skills_dir, sizeof(skills_dir), "%s/skills", devin_dir); |
| 7909 | install_managed_agent_instructions("Devin CLI / Local", instructions_path, dry_run); |
| 7910 | install_agent_skill("Devin CLI / Local", skills_dir, force, dry_run); |
| 7911 | bool hook_supported = cbm_optional_hook_supported("devin", registry->options.is_windows); |
| 7912 | if (g_install_plan) { |
| 7913 | if (hook_supported) { |
| 7914 | plan_record("Devin CLI / Local", "hook", config_path); |
| 7915 | } |
| 7916 | return; |
| 7917 | } |
| 7918 | if (!hook_supported) { |
| 7919 | printf(" hooks: withheld on Windows (vendor hook shell is undocumented)\n"); |
| 7920 | return; |
| 7921 | } |
| 7922 | if (!config_resolved) { |
| 7923 | printf(" hooks: skipped because the config path was unresolved\n"); |
| 7924 | return; |
| 7925 | } |
| 7926 | bool installed = true; |
| 7927 | if (!dry_run && ((inherit_claude_session && |
| 7928 | cbm_remove_devin_session_hook(config_path, binary_path) != CLI_OK) || |
| 7929 | cbm_upsert_devin_context_hooks(config_path, binary_path, |
| 7930 | !inherit_claude_session) != CLI_OK)) { |
| 7931 | installed = false; |
| 7932 | record_agent_config_error(false, "Devin CLI / Local", "lifecycle_hook_install", |
| 7933 | config_path); |
| 7934 | } |
| 7935 | if (installed) { |
| 7936 | printf(" hooks: %sUserPromptSubmit + PostCompaction (fail-open context)\n", |
| 7937 | inherit_claude_session ? "" : "SessionStart + "); |
| 7938 | } |
| 7939 | } |
| 7940 | |
| 7941 | /* Write a generated client extension module into `path` as a managed block. |
| 7942 | * |
no test coverage detected