> */ public static function candidates(): array { $items = []; TheDotDevAgenticBridge_Content_Policy::each_outbound_candidate(static function (WP_Post $post) use (&$items): bool { if (count($items) >= self::MAX_POSTS) { return false; } $result = TheDotDevAgenticBridge_Block_Answer_Extractor::extract_post($post); foreach ($result['candidates'] as $candidate) { $answer = TheDotDevAgenticBridge_Answer_Structure_Assessor::assess_sections([[ 'heading' => (string) $candidate['heading'], 'leadText' => (string) $candidate['answerText'], 'leadTag' => str_replace('core/', '', (string) $candidate['answerType']), ]], true); $links = TheDotDevAgenticBridge_Link_Health_Assessor::assess_post($post); $candidate['sourceType'] = 'block_answer + answer_structure + link_health'; $candidate['answerStatus'] = (string) ($answer['status'] ?? 'unknown'); $candidate['linkStatus'] = (string) ($links['status'] ?? 'local_candidate'); $candidate['sourceLabel'] = 'Local candidate'; $candidate['reviewAction'] = 'Open and review'; $items[] = $candidate; } return true; }); return $items; } /** @param list|mixed> $snapshots @return list> */ public static function content_health_candidates(array $snapshots, int $site_id): array { $assessment = TheDotDevAgenticBridge_Content_Health_Assessor::assess($snapshots, $site_id); $items = []; foreach ($assessment['findings'] as $finding) { if (!in_array($finding['status'], [TheDotDevAgenticBridge_Content_Health_Assessor::CONFIRMED_ISSUE, TheDotDevAgenticBridge_Content_Health_Assessor::REVIEW_NEEDED], true)) continue; $items[] = ['heading'=>(string)$finding['check'],'answerText'=>(string)$finding['evidence'],'sourceLabel'=>(($finding['snapshotSource'] ?? '') === 'local_post_snapshot' ? 'Local snapshot' : 'Sample'),'sourceType'=>'content_health','freshness'=>(string)$finding['snapshotTime'],'scope'=>(string)$finding['scope'],'exclusions'=>$finding['exclusions'],'reviewAction'=>(string)$finding['nextAction'],'status'=>(string)$finding['status']]; } return $items; } /** @param list|mixed> $snapshots @return list> */ public static function content_health_conditions(array $snapshots, int $site_id): array { $items = []; foreach (TheDotDevAgenticBridge_Content_Health_Assessor::assess($snapshots, $site_id)['findings'] as $finding) { if (!in_array($finding['status'], [TheDotDevAgenticBridge_Content_Health_Assessor::NOT_APPLICABLE, TheDotDevAgenticBridge_Content_Health_Assessor::UNKNOWN], true)) continue; $items[] = ['status'=>(string) $finding['status'], 'evidence'=>(string) $finding['evidence']]; } return $items; } /** @return array{candidates:list>,conditions:list>} */ public static function current_site_content_health(int $site_id): array { $snapshots = TheDotDevAgenticBridge_Content_Health_Snapshot_Adapter::snapshots_for_current_site($site_id); return [ 'candidates' => self::content_health_candidates($snapshots, $site_id), 'conditions' => self::content_health_conditions($snapshots, $site_id), ]; } }