array( 'type' => 'integer', 'default' => 12, 'minimum' => 1, 'maximum' => 100, 'description' => __( 'How many lines of live output to include. The preview is skipped entirely when the module is inactive.', 'acrossai-abilities-manager' ), ), ); } protected function output_properties(): array { return array( 'module' => array( 'type' => 'string' ), 'module_active' => array( 'type' => 'boolean' ), 'route_url' => array( 'type' => 'string' ), 'rewrite' => array( 'type' => 'object' ), 'settings' => array( 'type' => 'object' ), 'live_preview' => array( 'type' => array( 'object', 'null' ) ), ); } protected function required_input(): array { return array(); } protected function annotations(): array { return array( 'readonly' => true, 'destructive' => false, 'idempotent' => true ); } /** * @param array $input * @return array|WP_Error */ protected function run( array $input ) { $lines = isset( $input['preview_lines'] ) ? (int) $input['preview_lines'] : 12; $lines = max( 1, min( 100, $lines ) ); $status = Routes_Repository::llms_status( $lines ); if ( ! $status['module_active'] ) { $status['message'] = __( 'The Rank Math llms.txt module is inactive, so /llms.txt is not served. Enable it with rank-math/set-module-status.', 'acrossai-abilities-manager' ); } elseif ( empty( $status['rewrite']['present'] ) ) { $status['message'] = __( 'The llms.txt module is active but its rewrite rule is not persisted, so the route will 404. Run rank-math/refresh-llms-route.', 'acrossai-abilities-manager' ); } else { $status['message'] = __( 'Returned llms.txt status, settings and a live preview.', 'acrossai-abilities-manager' ); } return $status; } }