stats(); $counts = isset( $stats['counts'] ) && is_array( $stats['counts'] ) ? $stats['counts'] : array(); $timings = isset( $stats['timings_ms'] ) && is_array( $stats['timings_ms'] ) ? $stats['timings_ms'] : array(); $top = isset( $stats['top_abilities'] ) && is_array( $stats['top_abilities'] ) ? $stats['top_abilities'] : array(); $tile_keys = array( 'pending' => __( 'Pending', 'abilityguard-mcp' ), 'approved' => __( 'Approved', 'abilityguard-mcp' ), 'rejected' => __( 'Rejected', 'abilityguard-mcp' ), 'ok' => __( 'OK', 'abilityguard-mcp' ), 'error' => __( 'Error', 'abilityguard-mcp' ), 'rolled_back' => __( 'Rolled back', 'abilityguard-mcp' ), ); $page_url = admin_url( 'tools.php?page=' . AdminMenu::PAGE_SLUG ); echo '
'; echo ''; foreach ( $tile_keys as $key => $label ) { $value = isset( $counts[ $key ] ) ? (int) $counts[ $key ] : 0; echo ''; } echo '
'; echo '
' . esc_html( (string) $value ) . '
'; echo '
' . esc_html( $label ) . '
'; echo '
'; $p50 = isset( $timings['p50'] ) && null !== $timings['p50'] ? (int) $timings['p50'] : null; $p95 = isset( $timings['p95'] ) && null !== $timings['p95'] ? (int) $timings['p95'] : null; echo '

'; echo '' . esc_html__( 'Duration', 'abilityguard-mcp' ) . ': '; echo 'p50 ' . esc_html( null === $p50 ? '-' : $p50 . 'ms' ) . ' · '; echo 'p95 ' . esc_html( null === $p95 ? '-' : $p95 . 'ms' ); echo '

'; if ( array() !== $top ) { echo '

' . esc_html__( 'Top abilities', 'abilityguard-mcp' ) . '

'; echo '
    '; foreach ( $top as $row ) { $name = isset( $row['name'] ) ? (string) $row['name'] : ''; $count = isset( $row['count'] ) ? (int) $row['count'] : 0; if ( '' === $name ) { continue; } echo '
  1. ' . esc_html( $name ) . ' · ' . esc_html( (string) $count ) . '
  2. '; } echo '
'; } else { echo '

' . esc_html__( 'No invocations yet.', 'abilityguard-mcp' ) . '

'; } echo '

' . esc_html__( 'Open Tessera →', 'abilityguard-mcp' ) . '

'; echo '
'; } }