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