| 7938 | } |
| 7939 | |
| 7940 | static void install_devin_durable_context(const cbm_agent_registry_context_t *registry, |
| 7941 | const char *binary_path, const char *config_path, |
| 7942 | bool config_resolved, bool inherit_claude_session, |
| 7943 | bool force, bool dry_run) { |
| 7944 | char devin_dir[CLI_BUF_1K]; |
| 7945 | char instructions_path[CLI_BUF_1K]; |
| 7946 | char skills_dir[CLI_BUF_1K]; |
| 7947 | if (!cbm_devin_user_dir(registry, devin_dir, sizeof(devin_dir))) { |
| 7948 | record_agent_config_error(false, "Devin CLI / Local", "context_resolve", "devin"); |
| 7949 | return; |
| 7950 | } |
| 7951 | snprintf(instructions_path, sizeof(instructions_path), "%s/AGENTS.md", devin_dir); |
| 7952 | snprintf(skills_dir, sizeof(skills_dir), "%s/skills", devin_dir); |
| 7953 | install_managed_agent_instructions("Devin CLI / Local", instructions_path, dry_run); |
| 7954 | install_agent_skill("Devin CLI / Local", skills_dir, force, dry_run); |
| 7955 | bool hook_supported = cbm_optional_hook_supported("devin", registry->options.is_windows); |
| 7956 | if (g_install_plan) { |
| 7957 | if (hook_supported) { |
| 7958 | plan_record("Devin CLI / Local", "hook", config_path); |
| 7959 | } |
| 7960 | return; |
| 7961 | } |
| 7962 | if (!hook_supported) { |
| 7963 | printf(" hooks: withheld on Windows (vendor hook shell is undocumented)\n"); |
| 7964 | return; |
| 7965 | } |
| 7966 | if (!config_resolved) { |
| 7967 | printf(" hooks: skipped because the config path was unresolved\n"); |
| 7968 | return; |
| 7969 | } |
| 7970 | bool installed = true; |
| 7971 | if (!dry_run && ((inherit_claude_session && |
| 7972 | cbm_remove_devin_session_hook(config_path, binary_path) != CLI_OK) || |
| 7973 | cbm_upsert_devin_context_hooks(config_path, binary_path, |
| 7974 | !inherit_claude_session) != CLI_OK)) { |
| 7975 | installed = false; |
| 7976 | record_agent_config_error(false, "Devin CLI / Local", "lifecycle_hook_install", |
| 7977 | config_path); |
| 7978 | } |
| 7979 | if (installed) { |
| 7980 | printf(" hooks: %sUserPromptSubmit + PostCompaction (fail-open context)\n", |
| 7981 | inherit_claude_session ? "" : "SessionStart + "); |
| 7982 | } |
| 7983 | } |
| 7984 | |
| 7985 | /* Write a generated client extension module into `path` as a managed block. |
| 7986 | * |
no test coverage detected