| 7755 | } |
| 7756 | |
| 7757 | static void install_copilot_durable_context(const char *home, const char *binary_path, bool force, |
| 7758 | bool dry_run) { |
| 7759 | char config_dir[CLI_BUF_1K]; |
| 7760 | char hooks_dir[CLI_BUF_1K]; |
| 7761 | char hook_path[CLI_BUF_1K]; |
| 7762 | char skills_dir[CLI_BUF_1K]; |
| 7763 | char agent_path[CLI_BUF_1K]; |
| 7764 | cbm_copilot_config_dir(home, config_dir, sizeof(config_dir)); |
| 7765 | snprintf(hooks_dir, sizeof(hooks_dir), "%s/hooks", config_dir); |
| 7766 | snprintf(hook_path, sizeof(hook_path), "%s/hooks/codebase-memory-mcp.json", config_dir); |
| 7767 | snprintf(skills_dir, sizeof(skills_dir), "%s/skills", config_dir); |
| 7768 | snprintf(agent_path, sizeof(agent_path), "%s/agents/codebase-memory.agent.md", config_dir); |
| 7769 | install_agent_skill("Copilot", skills_dir, force, dry_run); |
| 7770 | install_tiered_agent_profiles( |
| 7771 | (cbm_tiered_profile_set_t){ |
| 7772 | .label = "Copilot", |
| 7773 | .verify_path = agent_path, |
| 7774 | .binary_path = binary_path, |
| 7775 | .legacy_verify_content = legacy_copilot_verify_agent_content, |
| 7776 | .dialect = CBM_GRAPH_DIALECT_COPILOT, |
| 7777 | }, |
| 7778 | dry_run); |
| 7779 | if (g_install_plan) { |
| 7780 | plan_record("Copilot", "hook", hook_path); |
| 7781 | return; |
| 7782 | } |
| 7783 | bool hook_ok = true; |
| 7784 | if (!dry_run && (!cbm_mkdir_p(hooks_dir, CLI_OCTAL_PERM) || |
| 7785 | cbm_upsert_copilot_hooks(binary_path, hook_path) != CLI_OK)) { |
| 7786 | hook_ok = false; |
| 7787 | record_agent_config_error(false, "Copilot", "lifecycle_hook_install", hook_path); |
| 7788 | } |
| 7789 | if (hook_ok) { |
| 7790 | printf(" hooks: SessionStart + SubagentStart (dynamic graph context)\n"); |
| 7791 | } |
| 7792 | } |
| 7793 | |
| 7794 | typedef struct { |
| 7795 | cbm_agent_client_resolve_options_t options; |
no test coverage detected