| 7930 | } |
| 7931 | |
| 7932 | static void uninstall_tiered_agent_profiles(cbm_tiered_profile_set_t profiles, bool dry_run) { |
| 7933 | cbm_graph_access_t access = cbm_tiered_profile_set_access(profiles); |
| 7934 | for (int value = 0; value < (int)CBM_GRAPH_TIER_COUNT; value++) { |
| 7935 | cbm_graph_tier_t tier = (cbm_graph_tier_t)value; |
| 7936 | char path[CLI_BUF_1K]; |
| 7937 | if (cbm_tiered_profile_path(profiles.verify_path, tier, path, sizeof(path)) != CLI_OK) { |
| 7938 | record_agent_config_error(true, profiles.label, "agent_path", profiles.verify_path); |
| 7939 | continue; |
| 7940 | } |
| 7941 | if (dry_run) { |
| 7942 | printf(" %s agent: would remove owned profile %s\n", profiles.label, path); |
| 7943 | continue; |
| 7944 | } |
| 7945 | char *current = |
| 7946 | cbm_render_graph_profile(profiles.dialect, tier, access, profiles.binary_path); |
| 7947 | if (!current) { |
| 7948 | record_agent_config_error(true, profiles.label, "agent_render", path); |
| 7949 | continue; |
| 7950 | } |
| 7951 | cbm_graph_access_t alternate_access = |
| 7952 | access == CBM_GRAPH_ACCESS_DIRECT ? CBM_GRAPH_ACCESS_HANDOFF : CBM_GRAPH_ACCESS_DIRECT; |
| 7953 | char *alternate = cbm_render_graph_profile(profiles.dialect, tier, alternate_access, |
| 7954 | profiles.binary_path); |
| 7955 | char *codex_rc1 = |
| 7956 | profiles.dialect == CBM_GRAPH_DIALECT_CODEX && access == CBM_GRAPH_ACCESS_DIRECT |
| 7957 | ? cbm_render_graph_profile_codex_rc1(tier) |
| 7958 | : NULL; |
| 7959 | const char *released[3]; |
| 7960 | size_t released_count = 0U; |
| 7961 | if (alternate) { |
| 7962 | released[released_count++] = alternate; |
| 7963 | } |
| 7964 | if (codex_rc1) { |
| 7965 | released[released_count++] = codex_rc1; |
| 7966 | } |
| 7967 | if (tier == CBM_GRAPH_TIER_VERIFY && profiles.legacy_verify_content) { |
| 7968 | released[released_count++] = profiles.legacy_verify_content; |
| 7969 | } |
| 7970 | int result = cbm_text_remove_owned_document_any(path, current, released, released_count); |
| 7971 | free(codex_rc1); |
| 7972 | free(alternate); |
| 7973 | free(current); |
| 7974 | if (result < CLI_OK) { |
| 7975 | record_agent_config_error(true, profiles.label, "agent_uninstall", path); |
| 7976 | } else if (result > CLI_OK) { |
| 7977 | printf(" %s agent: preserved modified profile %s\n", profiles.label, path); |
| 7978 | } else { |
| 7979 | printf(" %s agent: removed owned profile %s\n", profiles.label, path); |
| 7980 | } |
| 7981 | } |
| 7982 | } |
| 7983 | |
| 7984 | static void install_tiered_profile_prompts(const char *label, const char *verify_path, |
| 7985 | cbm_graph_profile_dialect_t dialect, |
no test coverage detected