*/ public static function build(): array { $settings = TheDotDevAgenticBridge_Storage::get(); $site_id = (string) ($settings['site_id'] ?? ''); $content = TheDotDevAgenticBridge_Content_Metadata::artifact_eligible_content_items(); $claims = TheDotDevAgenticBridge_Content_Policy::outbound_claims(); $artifacts_published = TheDotDevAgenticBridge_Storage::artifacts_published(); $has_physical = self::has_physical_llms_txt(); $meta = [ 'siteUrl' => home_url('/'), 'siteName' => get_bloginfo('name'), 'wordpressVersion' => get_bloginfo('version'), 'pluginVersion' => THEDOTDEV_AGENTIC_BRIDGE_VERSION, 'timezone' => wp_timezone_string(), 'hasPhysicalLlmsTxt' => $has_physical, 'killSwitchEnabled' => TheDotDevAgenticBridge_Storage::kill_switch_enabled(), 'artifactsPublished' => $artifacts_published, 'generatedAt' => TheDotDevAgenticBridge_Readiness_Clock::iso(), ]; // SnapshotMeta v1.0: physicalLlmsTxtPath is optional string — omit when absent (never null). if ($has_physical) { $meta['physicalLlmsTxtPath'] = '/llms.txt'; } $payload = [ 'schemaVersion' => '1.0', 'siteId' => $site_id, 'meta' => $meta, 'content' => $content, 'claims' => $claims, ]; // SnapshotPayload v1.0: publishedArtifacts is optional object — omit when unpublished (never null). if ($artifacts_published) { $artifacts = TheDotDevAgenticBridge_Artifacts::published_artifact_payload(); $payload['publishedArtifacts'] = [ 'llmsTxt' => $artifacts['llms_txt'] ?? '', 'agentMap' => $artifacts['agent_map'] ?? new stdClass(), ]; } return $payload; } public static function has_physical_llms_txt(): bool { $path = self::physical_llms_txt_path(); return file_exists($path) && is_readable($path); } private static function physical_llms_txt_path(): string { // The test runtime is deliberately source-mounted read-only. Its fixture // path is supplied only by the isolated test bootstrap; production always // checks the WordPress-root llms.txt file. if ( defined('THEDOTDEV_AGENTIC_BRIDGE_TESTING') && THEDOTDEV_AGENTIC_BRIDGE_TESTING && defined('THEDOTDEV_AGENTIC_BRIDGE_TEST_PHYSICAL_LLMS_PATH') ) { return (string) THEDOTDEV_AGENTIC_BRIDGE_TEST_PHYSICAL_LLMS_PATH; } return ABSPATH . 'llms.txt'; } }