| 654 | } |
| 655 | |
| 656 | bool cbm_agent_client_detect(cbm_agent_client_id_t id, |
| 657 | const cbm_agent_client_resolve_options_t *options) { |
| 658 | const cbm_agent_client_profile_t *profile = cbm_agent_client_by_id(id); |
| 659 | if (!profile || !options) { |
| 660 | return false; |
| 661 | } |
| 662 | char path[1024]; |
| 663 | int resolved = cbm_agent_client_resolve_path(id, options, path, sizeof(path)); |
| 664 | if (id == CBM_AGENT_CLIENT_CONTINUE || id == CBM_AGENT_CLIENT_TRAE || |
| 665 | id == CBM_AGENT_CLIENT_ROO_CODE || id == CBM_AGENT_CLIENT_SOURCEGRAPH_CODY) { |
| 666 | return resolved == 0 && agent_path_exists(options, path); |
| 667 | } |
| 668 | if (id == CBM_AGENT_CLIENT_VISUAL_STUDIO) { |
| 669 | return options->is_windows && agent_command_exists(options, profile->detection_command); |
| 670 | } |
| 671 | char marker_path[1024]; |
| 672 | int marker_resolved = agent_client_marker_path(id, options, marker_path, sizeof(marker_path)); |
| 673 | return (marker_resolved == 0 && agent_path_exists(options, marker_path)) || |
| 674 | (resolved == 0 && agent_path_exists(options, path)) || |
| 675 | agent_command_exists(options, profile->detection_command); |
| 676 | } |
| 677 | |
| 678 | bool cbm_agent_client_cleanup_candidate(cbm_agent_client_id_t id, |
| 679 | const cbm_agent_client_resolve_options_t *options) { |
no test coverage detected