>}> */ public static function build(): array { $keys = ['business_summary','services_products','locations','hours','policies','contact_actions','page_summaries','answerable_questions','ai_file_entries','missing_answers']; $out = []; foreach ($keys as $key) $out[$key] = ['status' => 'not_found', 'facts' => [], 'total' => 0]; $map = ['about'=>'business_summary','service'=>'services_products','product'=>'services_products','location'=>'locations','legal'=>'policies','contact'=>'contact_actions']; $store = TheDotDevAgenticBridge_Content_Metadata::normalized_store(); TheDotDevAgenticBridge_Content_Policy::each_outbound_candidate(static function (WP_Post $post) use (&$out, $map, $store): bool { if (!TheDotDevAgenticBridge_Content_Metadata::is_artifact_eligible($post, $store)) return true; $config = TheDotDevAgenticBridge_Content_Metadata::effective_config_for_post($post, $store); $intent=(string)($config['intent']??'general_information'); $base=['sourceTitle'=>(string)$post->post_title,'sourceId'=>(int)$post->ID,'sourceUrl'=>get_permalink($post),'modifiedAt'=>get_post_modified_time('c',true,$post),'intent'=>$intent,'intentLabel'=>TheDotDevAgenticBridge_Content_Metadata::intent_label($intent)]; $summary=trim((string)($config['agentSummary']??'')); if ($summary !== '') { self::add($out,'page_summaries',$base+['text'=>$summary]); if(isset($map[$intent])) self::add($out,$map[$intent],$base+['text'=>$summary]); } foreach (TheDotDevAgenticBridge_Controlled_Answerable_Questions::records_for_post((int)$post->ID) as $record) { if (($record['state']??'') !== 'APPROVED' || trim((string) ($record['answer'] ?? '')) === '') continue; self::add($out,'answerable_questions',$base+['text'=>(string)($record['answer']??''),'question'=>(string)($record['question']??''),'recordType'=>(string)($record['type']??''),'recordId'=>(string)($record['id']??'')]); } return true; }); if (TheDotDevAgenticBridge_Artifacts::should_serve_public_artifacts()) { $published = TheDotDevAgenticBridge_Artifacts::published_artifact_payload(); $count = count($published['agent_map']['entries'] ?? []); if ($count > 0) self::add($out, 'ai_file_entries', ['text' => sprintf( /* translators: %d: eligible entry count in the locally published agent map. */ __('The published local agent map contains %d eligible entries.', 'agentic-bridge'), $count), 'sourceTitle' => 'agent-map.json', 'sourceUrl' => home_url('/agent-map.json')]); } foreach (['business_summary'=>'Business summary','services_products'=>'Services or products','locations'=>'Locations or service area','hours'=>'Hours or availability','policies'=>'Policies','contact_actions'=>'Contact or actions'] as $key=>$label) if($out[$key]['facts']===[]) self::add($out,'missing_answers',['text'=>$label,'status'=>'not_found']); return $out; } private static function add(array &$out,string $key,array $fact): void { ++$out[$key]['total']; if (count($out[$key]['facts']) < 50) $out[$key]['facts'][]=$fact; $out[$key]['status']='found'; } }