| 7522 | } |
| 7523 | |
| 7524 | static void uninstall_tiered_agent_profiles(cbm_tiered_profile_set_t profiles, bool dry_run) { |
| 7525 | cbm_graph_access_t access = cbm_tiered_profile_set_access(profiles); |
| 7526 | for (int value = 0; value < (int)CBM_GRAPH_TIER_COUNT; value++) { |
| 7527 | cbm_graph_tier_t tier = (cbm_graph_tier_t)value; |
| 7528 | char path[CLI_BUF_1K]; |
| 7529 | if (cbm_tiered_profile_path(profiles.verify_path, tier, path, sizeof(path)) != CLI_OK) { |
| 7530 | record_agent_config_error(true, profiles.label, "agent_path", profiles.verify_path); |
| 7531 | continue; |
| 7532 | } |
| 7533 | if (dry_run) { |
| 7534 | printf(" %s agent: would remove owned profile %s\n", profiles.label, path); |
| 7535 | continue; |
| 7536 | } |
| 7537 | char *current = |
| 7538 | cbm_render_graph_profile(profiles.dialect, tier, access, profiles.binary_path); |
| 7539 | if (!current) { |
| 7540 | record_agent_config_error(true, profiles.label, "agent_render", path); |
| 7541 | continue; |
| 7542 | } |
| 7543 | cbm_graph_access_t alternate_access = |
| 7544 | access == CBM_GRAPH_ACCESS_DIRECT ? CBM_GRAPH_ACCESS_HANDOFF : CBM_GRAPH_ACCESS_DIRECT; |
| 7545 | char *alternate = cbm_render_graph_profile(profiles.dialect, tier, alternate_access, |
| 7546 | profiles.binary_path); |
| 7547 | char *codex_rc1 = |
| 7548 | profiles.dialect == CBM_GRAPH_DIALECT_CODEX && access == CBM_GRAPH_ACCESS_DIRECT |
| 7549 | ? cbm_render_graph_profile_codex_rc1(tier) |
| 7550 | : NULL; |
| 7551 | const char *released[3]; |
| 7552 | size_t released_count = 0U; |
| 7553 | if (alternate) { |
| 7554 | released[released_count++] = alternate; |
| 7555 | } |
| 7556 | if (codex_rc1) { |
| 7557 | released[released_count++] = codex_rc1; |
| 7558 | } |
| 7559 | if (tier == CBM_GRAPH_TIER_VERIFY && profiles.legacy_verify_content) { |
| 7560 | released[released_count++] = profiles.legacy_verify_content; |
| 7561 | } |
| 7562 | int result = cbm_text_remove_owned_document_any(path, current, released, released_count); |
| 7563 | free(codex_rc1); |
| 7564 | free(alternate); |
| 7565 | free(current); |
| 7566 | if (result < CLI_OK) { |
| 7567 | record_agent_config_error(true, profiles.label, "agent_uninstall", path); |
| 7568 | } else if (result > CLI_OK) { |
| 7569 | printf(" %s agent: preserved modified profile %s\n", profiles.label, path); |
| 7570 | } else { |
| 7571 | printf(" %s agent: removed owned profile %s\n", profiles.label, path); |
| 7572 | } |
| 7573 | } |
| 7574 | } |
| 7575 | |
| 7576 | static void install_tiered_profile_prompts(const char *label, const char *verify_path, |
| 7577 | cbm_graph_profile_dialect_t dialect, |
no test coverage detected