| 7628 | } |
| 7629 | |
| 7630 | static void uninstall_tiered_agent_profiles(cbm_tiered_profile_set_t profiles, bool dry_run) { |
| 7631 | cbm_graph_access_t access = cbm_tiered_profile_set_access(profiles); |
| 7632 | for (int value = 0; value < (int)CBM_GRAPH_TIER_COUNT; value++) { |
| 7633 | cbm_graph_tier_t tier = (cbm_graph_tier_t)value; |
| 7634 | char path[CLI_BUF_1K]; |
| 7635 | if (cbm_tiered_profile_path(profiles.verify_path, tier, path, sizeof(path)) != CLI_OK) { |
| 7636 | record_agent_config_error(true, profiles.label, "agent_path", profiles.verify_path); |
| 7637 | continue; |
| 7638 | } |
| 7639 | if (dry_run) { |
| 7640 | printf(" %s agent: would remove owned profile %s\n", profiles.label, path); |
| 7641 | continue; |
| 7642 | } |
| 7643 | char *current = |
| 7644 | cbm_render_graph_profile(profiles.dialect, tier, access, profiles.binary_path); |
| 7645 | if (!current) { |
| 7646 | record_agent_config_error(true, profiles.label, "agent_render", path); |
| 7647 | continue; |
| 7648 | } |
| 7649 | cbm_graph_access_t alternate_access = |
| 7650 | access == CBM_GRAPH_ACCESS_DIRECT ? CBM_GRAPH_ACCESS_HANDOFF : CBM_GRAPH_ACCESS_DIRECT; |
| 7651 | char *alternate = cbm_render_graph_profile(profiles.dialect, tier, alternate_access, |
| 7652 | profiles.binary_path); |
| 7653 | char *codex_rc1 = |
| 7654 | profiles.dialect == CBM_GRAPH_DIALECT_CODEX && access == CBM_GRAPH_ACCESS_DIRECT |
| 7655 | ? cbm_render_graph_profile_codex_rc1(tier) |
| 7656 | : NULL; |
| 7657 | const char *released[3]; |
| 7658 | size_t released_count = 0U; |
| 7659 | if (alternate) { |
| 7660 | released[released_count++] = alternate; |
| 7661 | } |
| 7662 | if (codex_rc1) { |
| 7663 | released[released_count++] = codex_rc1; |
| 7664 | } |
| 7665 | if (tier == CBM_GRAPH_TIER_VERIFY && profiles.legacy_verify_content) { |
| 7666 | released[released_count++] = profiles.legacy_verify_content; |
| 7667 | } |
| 7668 | int result = cbm_text_remove_owned_document_any(path, current, released, released_count); |
| 7669 | free(codex_rc1); |
| 7670 | free(alternate); |
| 7671 | free(current); |
| 7672 | if (result < CLI_OK) { |
| 7673 | record_agent_config_error(true, profiles.label, "agent_uninstall", path); |
| 7674 | } else if (result > CLI_OK) { |
| 7675 | printf(" %s agent: preserved modified profile %s\n", profiles.label, path); |
| 7676 | } else { |
| 7677 | printf(" %s agent: removed owned profile %s\n", profiles.label, path); |
| 7678 | } |
| 7679 | } |
| 7680 | } |
| 7681 | |
| 7682 | static void install_tiered_profile_prompts(const char *label, const char *verify_path, |
| 7683 | cbm_graph_profile_dialect_t dialect, |
no test coverage detected