@sanity/ailf-studio 0.1.27 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3045,14 +3045,14 @@ import { route } from "sanity/router";
3045
3045
  // src/components/Dashboard.tsx
3046
3046
  import {
3047
3047
  Container,
3048
- Flex as Flex22,
3049
- Stack as Stack24,
3048
+ Flex as Flex28,
3049
+ Stack as Stack29,
3050
3050
  Tab as Tab2,
3051
3051
  TabList as TabList2,
3052
3052
  TabPanel as TabPanel2,
3053
- Text as Text29
3053
+ Text as Text36
3054
3054
  } from "@sanity/ui";
3055
- import { useCallback as useCallback20 } from "react";
3055
+ import { useCallback as useCallback21 } from "react";
3056
3056
  import { useRouter as useRouter3 } from "sanity/router";
3057
3057
 
3058
3058
  // src/components/ComparisonView.tsx
@@ -3094,6 +3094,20 @@ var GLOSSARY = {
3094
3094
  // -- Grader judgments ------------------------------------------------------
3095
3095
  lowScoringJudgments: "The grading model's explanations for tests that scored below 70/100.",
3096
3096
  judgmentReason: "The grading model's natural language explanation of what went wrong.",
3097
+ // -- Diagnostics overview ---------------------------------------------------
3098
+ healthStrong: "Feature areas scoring 80 or above. The docs are working well for these features \u2014 AI agents produce correct, complete implementations.",
3099
+ healthAttention: "Feature areas scoring 70\u201379. These are okay but could be improved \u2014 there may be gaps in specific dimensions like doc coverage or code correctness.",
3100
+ healthWeak: "Feature areas scoring below 70. The docs are not providing enough support for AI agents to implement these features correctly.",
3101
+ negativeDocLiftMetric: "Number of areas where the documentation actually hurts AI performance \u2014 the model scores higher without docs than with them. This usually means the docs contain outdated patterns or incorrect examples.",
3102
+ weakAreas: "Feature areas where the overall score is below 70. These need the most attention \u2014 low scores mean AI agents consistently struggle to implement these features.",
3103
+ docsHurt: "Areas where the floor score (no docs) is higher than the ceiling score (with docs). The documentation is actively misleading the model. These docs need to be rewritten or removed.",
3104
+ retrievalIssues: "Areas where AI agents can find less than 70% of the available doc quality. The docs exist and are good, but agents can't discover them through search. Consider improving page titles, metadata, or search engine indexing.",
3105
+ dimWeaknesses: "Individual grading dimensions scoring below 50 within an area. These are the specific skills where AI agents fail most \u2014 task completion (can it build the feature?), code correctness (is the code right?), or doc coverage (did it use the docs?).",
3106
+ efficiencyAnomalies: "Areas where agent efficiency exceeds 100% \u2014 meaning agents perform better with self-found docs than with gold-standard docs injected directly. This can indicate doc quality issues (injected docs confuse the model) or agent memorization.",
3107
+ docLiftWins: "Areas where documentation boosts AI performance by 5 or more points. Higher doc lift means the docs are providing crucial information that the model doesn't already know.",
3108
+ retrievalExcellence: "Areas where AI agents successfully find and use at least 85% of the available doc quality through web search. Good retrieval means your docs are well-indexed and easy for agents to discover.",
3109
+ // -- Strengths (positive diagnostics) ---------------------------------------
3110
+ strengths: "What's working well: high-scoring areas, dimensions where the docs are strong, and areas where AI agents successfully find and use the documentation.",
3097
3111
  // -- Recommendations / gap analysis ----------------------------------------
3098
3112
  recommendations: "Prioritized remediation plan from gap analysis. Each recommendation identifies a documentation problem, the affected feature area, and the estimated score lift from fixing it.",
3099
3113
  totalPotentialLift: "Aggregate potential score lift if all identified gaps were fixed. This is a conservative estimate \u2014 each gap targets the median of non-bottlenecked dimensions, not 100.",
@@ -4606,20 +4620,21 @@ function LatestReports({
4606
4620
  // src/components/report-detail/ReportDetail.tsx
4607
4621
  import { ArrowLeftIcon as ArrowLeftIcon2 } from "@sanity/icons";
4608
4622
  import {
4609
- Box as Box14,
4623
+ Box as Box20,
4610
4624
  Button as Button5,
4611
- Stack as Stack22,
4625
+ Flex as Flex24,
4626
+ Stack as Stack24,
4612
4627
  Tab,
4613
4628
  TabList,
4614
4629
  TabPanel,
4615
- Text as Text27,
4616
- Tooltip as Tooltip8
4630
+ Text as Text30,
4631
+ Tooltip as Tooltip9
4617
4632
  } from "@sanity/ui";
4618
4633
  import {
4619
- useCallback as useCallback18,
4634
+ useCallback as useCallback19,
4620
4635
  useEffect as useEffect7,
4621
- useMemo as useMemo6,
4622
- useState as useState13
4636
+ useMemo as useMemo7,
4637
+ useState as useState15
4623
4638
  } from "react";
4624
4639
  import { useClient as useClient10 } from "sanity";
4625
4640
 
@@ -4892,306 +4907,581 @@ function GlossaryTip({ text }) {
4892
4907
  );
4893
4908
  }
4894
4909
 
4895
- // src/components/report-detail/AreaScoreTable.tsx
4896
- import React2 from "react";
4897
- import { Card as Card11, Stack as Stack13, Text as Text18 } from "@sanity/ui";
4910
+ // src/components/report-detail/DiagnosticsOverview.tsx
4911
+ import {
4912
+ ArrowDownIcon,
4913
+ ArrowUpIcon,
4914
+ CheckmarkCircleIcon,
4915
+ ErrorOutlineIcon,
4916
+ WarningOutlineIcon
4917
+ } from "@sanity/icons";
4918
+ import { Box as Box11, Flex as Flex12, Stack as Stack13, Text as Text18 } from "@sanity/ui";
4898
4919
 
4899
- // src/lib/scoring.ts
4900
- var TONE_MAP = {
4901
- good: "positive",
4902
- warning: "caution",
4903
- "needs-work": "default",
4904
- critical: "critical"
4920
+ // src/components/report-detail/diagnostics-styles.ts
4921
+ var COLORS = {
4922
+ emerald: {
4923
+ bg: "rgba(16,185,129,0.15)",
4924
+ border: "rgba(16,185,129,0.30)",
4925
+ text: "#34d399"
4926
+ },
4927
+ amber: {
4928
+ bg: "rgba(245,158,11,0.15)",
4929
+ border: "rgba(245,158,11,0.30)",
4930
+ text: "#fbbf24"
4931
+ },
4932
+ orange: {
4933
+ bg: "rgba(249,115,22,0.15)",
4934
+ border: "rgba(249,115,22,0.30)",
4935
+ text: "#fb923c"
4936
+ },
4937
+ red: {
4938
+ bg: "rgba(239,68,68,0.15)",
4939
+ border: "rgba(239,68,68,0.30)",
4940
+ text: "#f87171"
4941
+ },
4942
+ muted: {
4943
+ bg: "transparent",
4944
+ border: "var(--card-border-color)",
4945
+ text: "var(--card-muted-fg-color)"
4946
+ }
4905
4947
  };
4906
- function gradeTone(grade) {
4907
- return TONE_MAP[grade];
4948
+ function colorForScore(score) {
4949
+ if (score >= 80) return "emerald";
4950
+ if (score >= 70) return "amber";
4951
+ if (score >= 50) return "orange";
4952
+ return "red";
4908
4953
  }
4909
- function scoreTone(score) {
4910
- return gradeTone(scoreGrade(Math.round(score)));
4954
+ function scoreColor(score) {
4955
+ return COLORS[colorForScore(score)].text;
4911
4956
  }
4912
- var HEX_MAP = {
4913
- good: "#2ecc71",
4914
- warning: "#f1c40f",
4915
- "needs-work": "#e67e22",
4916
- critical: "#e74c3c"
4917
- };
4918
- function gradeHex(grade) {
4919
- return HEX_MAP[grade];
4957
+ function scoreBg(score) {
4958
+ return COLORS[colorForScore(score)].bg;
4920
4959
  }
4921
- function scoreHex(score) {
4922
- return gradeHex(scoreGrade(Math.round(score)));
4960
+ function scoreBorder(score) {
4961
+ return COLORS[colorForScore(score)].border;
4962
+ }
4963
+ function scoreBoxStyle(score) {
4964
+ const key = colorForScore(score);
4965
+ return {
4966
+ alignItems: "center",
4967
+ backgroundColor: COLORS[key].bg,
4968
+ borderRadius: 6,
4969
+ color: COLORS[key].text,
4970
+ display: "flex",
4971
+ fontFamily: "var(--font-code-size)",
4972
+ fontWeight: 700,
4973
+ height: 48,
4974
+ justifyContent: "center",
4975
+ width: 48
4976
+ };
4977
+ }
4978
+ function barFillColor(score) {
4979
+ const key = colorForScore(score);
4980
+ switch (key) {
4981
+ case "emerald":
4982
+ return "rgba(16,185,129,0.6)";
4983
+ case "amber":
4984
+ return "rgba(245,158,11,0.6)";
4985
+ case "orange":
4986
+ return "rgba(249,115,22,0.6)";
4987
+ case "red":
4988
+ return "rgba(239,68,68,0.6)";
4989
+ default:
4990
+ return "var(--card-border-color)";
4991
+ }
4923
4992
  }
4924
- function rowBackground(index) {
4925
- return index % 2 === 1 ? "var(--card-muted-bg-color)" : void 0;
4993
+ function deltaColor(delta) {
4994
+ if (delta > 0) return COLORS.emerald.text;
4995
+ if (delta < 0) return COLORS.red.text;
4996
+ return "var(--card-muted-fg-color)";
4997
+ }
4998
+ function efficiencyColor(eff) {
4999
+ if (eff == null) return "var(--card-muted-fg-color)";
5000
+ if (eff >= 0.9) return COLORS.emerald.text;
5001
+ if (eff >= 0.7) return COLORS.amber.text;
5002
+ return COLORS.red.text;
5003
+ }
5004
+ function sectionStyle(color) {
5005
+ return {
5006
+ backgroundColor: COLORS[color].bg,
5007
+ border: `1px solid ${COLORS[color].border}`,
5008
+ borderRadius: 6
5009
+ };
4926
5010
  }
5011
+ var neutralCardStyle = {
5012
+ backgroundColor: "var(--card-bg-color)",
5013
+ border: "1px solid var(--card-border-color)",
5014
+ borderRadius: 6
5015
+ };
5016
+ var dividerStyle = {
5017
+ borderTop: "1px solid var(--card-border-color)"
5018
+ };
4927
5019
 
4928
- // src/components/primitives/ScoreCell.tsx
4929
- import { Card as Card10, Text as Text17 } from "@sanity/ui";
5020
+ // src/components/report-detail/InfoTip.tsx
5021
+ import { HelpCircleIcon as HelpCircleIcon6 } from "@sanity/icons";
5022
+ import { Box as Box10, Text as Text17, Tooltip as Tooltip5 } from "@sanity/ui";
4930
5023
  import { jsx as jsx19 } from "react/jsx-runtime";
4931
- function ScoreCell({ score, size = 2 }) {
4932
- const rounded = Math.round(score);
5024
+ function InfoTip({ text }) {
4933
5025
  return /* @__PURE__ */ jsx19(
4934
- Card10,
5026
+ Tooltip5,
4935
5027
  {
4936
- padding: 1,
4937
- radius: 2,
4938
- style: {
4939
- alignItems: "center",
4940
- display: "flex",
4941
- flex: 1,
4942
- justifyContent: "center"
4943
- },
4944
- tone: scoreTone(rounded),
4945
- children: /* @__PURE__ */ jsx19(Text17, { align: "center", size, weight: "medium", children: rounded })
5028
+ content: /* @__PURE__ */ jsx19(Box10, { padding: 2, style: { maxWidth: 280 }, children: typeof text === "string" ? /* @__PURE__ */ jsx19(Text17, { size: 2, children: text }) : text }),
5029
+ placement: "bottom",
5030
+ portal: true,
5031
+ children: /* @__PURE__ */ jsx19(
5032
+ "span",
5033
+ {
5034
+ style: {
5035
+ color: "var(--card-muted-fg-color)",
5036
+ cursor: "help",
5037
+ display: "inline-flex",
5038
+ fontSize: 15,
5039
+ verticalAlign: "middle"
5040
+ },
5041
+ children: /* @__PURE__ */ jsx19(HelpCircleIcon6, {})
5042
+ }
5043
+ )
4946
5044
  }
4947
5045
  );
4948
5046
  }
4949
5047
 
4950
- // src/components/report-detail/AreaScoreTable.tsx
5048
+ // src/components/report-detail/DiagnosticsOverview.tsx
4951
5049
  import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
4952
- function AreaScoreTable({ scores }) {
4953
- return /* @__PURE__ */ jsx20(Card11, { overflow: "auto", padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs16(Stack13, { space: 4, children: [
4954
- /* @__PURE__ */ jsx20(Text18, { size: 3, weight: "semibold", children: "Per-Area Scores" }),
5050
+ function DiagnosticsOverview({
5051
+ scores,
5052
+ overall,
5053
+ comparison,
5054
+ durationMs,
5055
+ totalTests
5056
+ }) {
5057
+ if (scores.length === 0) return null;
5058
+ const strong = scores.filter((s) => s.totalScore >= 80);
5059
+ const attention = scores.filter(
5060
+ (s) => s.totalScore >= 70 && s.totalScore < 80
5061
+ );
5062
+ const weak = scores.filter((s) => s.totalScore < 70);
5063
+ const negativeDocLiftCount = scores.filter((s) => s.docLift < 0).length;
5064
+ const improved = comparison?.improved ?? [];
5065
+ const regressed = comparison?.regressed ?? [];
5066
+ const unchanged = comparison?.unchanged ?? [];
5067
+ const hasComparison = improved.length > 0 || regressed.length > 0 || unchanged.length > 0;
5068
+ return /* @__PURE__ */ jsxs16(Stack13, { space: 4, children: [
4955
5069
  /* @__PURE__ */ jsxs16(
4956
5070
  "div",
4957
5071
  {
4958
5072
  style: {
4959
5073
  display: "grid",
4960
- gap: "0 8px",
4961
- gridTemplateColumns: "2fr 1fr 1fr 1fr 1fr 1fr 1fr"
5074
+ gap: 12,
5075
+ gridTemplateColumns: "repeat(4, 1fr)"
4962
5076
  },
4963
5077
  children: [
4964
- /* @__PURE__ */ jsx20(ColumnHeader, { borderBottom: true, label: "Area" }),
4965
- /* @__PURE__ */ jsx20(ColumnHeader, { borderBottom: true, label: "Score", tooltip: GLOSSARY.score }),
4966
5078
  /* @__PURE__ */ jsx20(
4967
- ColumnHeader,
5079
+ ScoreCard,
4968
5080
  {
4969
- borderBottom: true,
4970
- label: "Task",
4971
- tooltip: GLOSSARY.taskCompletion
5081
+ delta: comparison?.deltas.overall,
5082
+ infoTip: GLOSSARY.overallScore,
5083
+ label: "AVG SCORE",
5084
+ subtitle: "Overall quality score",
5085
+ value: Math.round(overall.avgScore)
4972
5086
  }
4973
5087
  ),
4974
5088
  /* @__PURE__ */ jsx20(
4975
- ColumnHeader,
5089
+ ScoreCard,
4976
5090
  {
4977
- borderBottom: true,
4978
- label: "Code",
4979
- tooltip: GLOSSARY.codeCorrectness
5091
+ delta: comparison?.deltas.docLift,
5092
+ infoTip: GLOSSARY.docLift,
5093
+ label: "AVG DOC LIFT",
5094
+ subtitle: "Improvement with docs",
5095
+ value: Math.round(overall.avgDocLift)
4980
5096
  }
4981
5097
  ),
4982
5098
  /* @__PURE__ */ jsx20(
4983
- ColumnHeader,
5099
+ ScoreCard,
4984
5100
  {
4985
- borderBottom: true,
4986
- label: "Docs",
4987
- tooltip: GLOSSARY.docCoverage
5101
+ infoTip: GLOSSARY.ceiling,
5102
+ label: "AVG CEILING",
5103
+ subtitle: "Best case performance",
5104
+ value: Math.round(overall.avgCeilingScore ?? 0)
4988
5105
  }
4989
5106
  ),
4990
- /* @__PURE__ */ jsx20(ColumnHeader, { borderBottom: true, label: "Lift", tooltip: GLOSSARY.docLift }),
4991
- /* @__PURE__ */ jsx20(ColumnHeader, { borderBottom: true, label: "Tests", tooltip: GLOSSARY.tests }),
4992
- scores.map((score, i) => /* @__PURE__ */ jsxs16(React2.Fragment, { children: [
4993
- /* @__PURE__ */ jsx20(
4994
- "div",
4995
- {
4996
- style: {
4997
- background: rowBackground(i),
4998
- borderRadius: 4,
4999
- padding: "8px 0 8px 4px"
5000
- },
5001
- children: /* @__PURE__ */ jsx20(Text18, { size: 2, weight: "medium", children: score.feature })
5002
- }
5003
- ),
5004
- /* @__PURE__ */ jsx20(
5005
- "div",
5006
- {
5007
- style: {
5008
- background: rowBackground(i),
5009
- display: "flex",
5010
- padding: "2px 0"
5011
- },
5012
- children: /* @__PURE__ */ jsx20(ScoreCell, { score: score.totalScore })
5013
- }
5014
- ),
5015
- /* @__PURE__ */ jsx20(
5016
- "div",
5017
- {
5018
- style: {
5019
- background: rowBackground(i),
5020
- display: "flex",
5021
- padding: "2px 0"
5022
- },
5023
- children: /* @__PURE__ */ jsx20(ScoreCell, { score: score.taskCompletion })
5024
- }
5025
- ),
5026
- /* @__PURE__ */ jsx20(
5027
- "div",
5028
- {
5029
- style: {
5030
- background: rowBackground(i),
5031
- display: "flex",
5032
- padding: "2px 0"
5033
- },
5034
- children: /* @__PURE__ */ jsx20(ScoreCell, { score: score.codeCorrectness })
5035
- }
5036
- ),
5037
- /* @__PURE__ */ jsx20(
5038
- "div",
5039
- {
5040
- style: {
5041
- background: rowBackground(i),
5042
- display: "flex",
5043
- padding: "2px 0"
5044
- },
5045
- children: /* @__PURE__ */ jsx20(ScoreCell, { score: score.docCoverage })
5046
- }
5047
- ),
5107
+ overall.avgInfrastructureEfficiency != null ? /* @__PURE__ */ jsx20(
5108
+ ScoreCard,
5109
+ {
5110
+ infoTip: GLOSSARY.infraEfficiency,
5111
+ label: "EFFICIENCY",
5112
+ subtitle: "Infra utilization",
5113
+ suffix: "%",
5114
+ value: Math.round(overall.avgInfrastructureEfficiency * 100)
5115
+ }
5116
+ ) : /* @__PURE__ */ jsx20(
5117
+ ScoreCard,
5118
+ {
5119
+ infoTip: GLOSSARY.floor,
5120
+ label: "AVG FLOOR",
5121
+ subtitle: "Model-only baseline",
5122
+ value: Math.round(overall.avgFloorScore ?? 0)
5123
+ }
5124
+ )
5125
+ ]
5126
+ }
5127
+ ),
5128
+ /* @__PURE__ */ jsxs16(
5129
+ "div",
5130
+ {
5131
+ style: { display: "grid", gap: 12, gridTemplateColumns: "1fr 1fr 1fr" },
5132
+ children: [
5133
+ /* @__PURE__ */ jsx20(
5134
+ HealthCard,
5135
+ {
5136
+ color: "emerald",
5137
+ count: strong.length,
5138
+ icon: /* @__PURE__ */ jsx20(CheckmarkCircleIcon, {}),
5139
+ infoTip: GLOSSARY.healthStrong,
5140
+ label: "Strong (80+)"
5141
+ }
5142
+ ),
5143
+ /* @__PURE__ */ jsx20(
5144
+ HealthCard,
5145
+ {
5146
+ color: "amber",
5147
+ count: attention.length,
5148
+ icon: /* @__PURE__ */ jsx20(WarningOutlineIcon, {}),
5149
+ infoTip: GLOSSARY.healthAttention,
5150
+ label: "Attention (70-79)"
5151
+ }
5152
+ ),
5153
+ /* @__PURE__ */ jsx20(
5154
+ HealthCard,
5155
+ {
5156
+ color: "red",
5157
+ count: weak.length,
5158
+ icon: /* @__PURE__ */ jsx20(ErrorOutlineIcon, {}),
5159
+ infoTip: GLOSSARY.healthWeak,
5160
+ label: "Weak (<70)"
5161
+ }
5162
+ )
5163
+ ]
5164
+ }
5165
+ ),
5166
+ /* @__PURE__ */ jsxs16(
5167
+ "div",
5168
+ {
5169
+ style: {
5170
+ display: "grid",
5171
+ gap: 12,
5172
+ gridTemplateColumns: "repeat(auto-fit, minmax(140px, 1fr))"
5173
+ },
5174
+ children: [
5175
+ /* @__PURE__ */ jsx20(
5176
+ MetricCard,
5177
+ {
5178
+ infoTip: GLOSSARY.floor,
5179
+ label: "Avg Floor",
5180
+ value: String(Math.round(overall.avgFloorScore ?? 0))
5181
+ }
5182
+ ),
5183
+ overall.avgActualScore != null && /* @__PURE__ */ jsx20(
5184
+ MetricCard,
5185
+ {
5186
+ infoTip: GLOSSARY.actualScore,
5187
+ label: "Avg Actual",
5188
+ value: String(Math.round(overall.avgActualScore))
5189
+ }
5190
+ ),
5191
+ overall.avgRetrievalGap != null && /* @__PURE__ */ jsx20(
5192
+ MetricCard,
5193
+ {
5194
+ infoTip: GLOSSARY.retrievalGap,
5195
+ label: "Avg Retrieval Gap",
5196
+ value: overall.avgRetrievalGap.toFixed(1)
5197
+ }
5198
+ ),
5199
+ /* @__PURE__ */ jsx20(
5200
+ MetricCard,
5201
+ {
5202
+ highlight: negativeDocLiftCount > 0,
5203
+ infoTip: GLOSSARY.negativeDocLiftMetric,
5204
+ label: "Negative Doc Lift",
5205
+ value: `${negativeDocLiftCount} area${negativeDocLiftCount === 1 ? "" : "s"}`
5206
+ }
5207
+ ),
5208
+ totalTests != null && /* @__PURE__ */ jsx20(
5209
+ MetricCard,
5210
+ {
5211
+ infoTip: GLOSSARY.tests,
5212
+ label: "Tests",
5213
+ value: String(totalTests)
5214
+ }
5215
+ ),
5216
+ durationMs != null && durationMs > 0 && /* @__PURE__ */ jsx20(MetricCard, { label: "Duration", value: formatDuration(durationMs) })
5217
+ ]
5218
+ }
5219
+ ),
5220
+ hasComparison && /* @__PURE__ */ jsxs16(Box11, { style: neutralCardStyle, children: [
5221
+ /* @__PURE__ */ jsx20(
5222
+ Box11,
5223
+ {
5224
+ padding: 4,
5225
+ style: { borderBottom: "1px solid var(--card-border-color)" },
5226
+ children: /* @__PURE__ */ jsx20(Text18, { size: 3, weight: "semibold", children: "Change from Previous Run" })
5227
+ }
5228
+ ),
5229
+ /* @__PURE__ */ jsxs16(
5230
+ "div",
5231
+ {
5232
+ style: {
5233
+ display: "grid",
5234
+ gridTemplateColumns: "1fr 1fr 1fr"
5235
+ },
5236
+ children: [
5237
+ /* @__PURE__ */ jsx20(Box11, { padding: 4, children: /* @__PURE__ */ jsxs16(Stack13, { space: 3, children: [
5238
+ /* @__PURE__ */ jsxs16(Flex12, { align: "center", gap: 2, children: [
5239
+ /* @__PURE__ */ jsx20(ArrowUpIcon, { style: { color: "#34d399" } }),
5240
+ /* @__PURE__ */ jsxs16(Text18, { size: 2, style: { color: "#34d399" }, weight: "medium", children: [
5241
+ "Improved (",
5242
+ improved.length,
5243
+ ")"
5244
+ ] })
5245
+ ] }),
5246
+ /* @__PURE__ */ jsx20(Flex12, { gap: 2, wrap: "wrap", children: improved.length > 0 ? improved.map((area) => /* @__PURE__ */ jsx20(Pill, { color: "emerald", label: area }, area)) : /* @__PURE__ */ jsx20(Text18, { muted: true, size: 2, children: "None" }) })
5247
+ ] }) }),
5048
5248
  /* @__PURE__ */ jsx20(
5049
- "div",
5249
+ Box11,
5050
5250
  {
5051
- style: {
5052
- alignItems: "center",
5053
- background: rowBackground(i),
5054
- display: "flex"
5055
- },
5056
- children: /* @__PURE__ */ jsx20(Text18, { size: 2, children: formatDelta(score.docLift) })
5251
+ padding: 4,
5252
+ style: { borderLeft: "1px solid var(--card-border-color)" },
5253
+ children: /* @__PURE__ */ jsxs16(Stack13, { space: 3, children: [
5254
+ /* @__PURE__ */ jsxs16(Flex12, { align: "center", gap: 2, children: [
5255
+ /* @__PURE__ */ jsx20(ArrowDownIcon, { style: { color: "#f87171" } }),
5256
+ /* @__PURE__ */ jsxs16(Text18, { size: 2, style: { color: "#f87171" }, weight: "medium", children: [
5257
+ "Regressed (",
5258
+ regressed.length,
5259
+ ")"
5260
+ ] })
5261
+ ] }),
5262
+ /* @__PURE__ */ jsx20(Flex12, { gap: 2, wrap: "wrap", children: regressed.length > 0 ? regressed.map((area) => /* @__PURE__ */ jsx20(Pill, { color: "red", label: area }, area)) : /* @__PURE__ */ jsx20(Text18, { muted: true, size: 2, children: "None" }) })
5263
+ ] })
5057
5264
  }
5058
5265
  ),
5059
5266
  /* @__PURE__ */ jsx20(
5060
- "div",
5267
+ Box11,
5061
5268
  {
5062
- style: {
5063
- alignItems: "center",
5064
- background: rowBackground(i),
5065
- display: "flex"
5066
- },
5067
- children: /* @__PURE__ */ jsx20(Text18, { muted: true, size: 2, children: score.testCount })
5269
+ padding: 4,
5270
+ style: { borderLeft: "1px solid var(--card-border-color)" },
5271
+ children: /* @__PURE__ */ jsxs16(Stack13, { space: 3, children: [
5272
+ /* @__PURE__ */ jsxs16(Flex12, { align: "center", gap: 2, children: [
5273
+ /* @__PURE__ */ jsx20(
5274
+ "span",
5275
+ {
5276
+ style: {
5277
+ color: "var(--card-muted-fg-color)",
5278
+ fontSize: 18,
5279
+ lineHeight: 1
5280
+ },
5281
+ children: "\u2014"
5282
+ }
5283
+ ),
5284
+ /* @__PURE__ */ jsxs16(Text18, { muted: true, size: 2, weight: "medium", children: [
5285
+ "Unchanged (",
5286
+ unchanged.length,
5287
+ ")"
5288
+ ] })
5289
+ ] }),
5290
+ /* @__PURE__ */ jsx20(Flex12, { gap: 2, wrap: "wrap", children: unchanged.length > 0 ? unchanged.map((area) => /* @__PURE__ */ jsx20(Pill, { color: "muted", label: area }, area)) : /* @__PURE__ */ jsx20(Text18, { muted: true, size: 2, children: "None" }) })
5291
+ ] })
5068
5292
  }
5069
5293
  )
5070
- ] }, score.feature))
5071
- ]
5072
- }
5073
- )
5074
- ] }) });
5075
- }
5076
-
5077
- // src/components/report-detail/ComparisonSummary.tsx
5078
- import { Badge as Badge6, Box as Box10, Card as Card12, Flex as Flex12, Grid as Grid3, Stack as Stack14, Text as Text19, Tooltip as Tooltip5 } from "@sanity/ui";
5079
- import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
5080
- function ComparisonSummary({ comparison }) {
5081
- return /* @__PURE__ */ jsx21(Card12, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs17(Stack14, { space: 4, children: [
5082
- /* @__PURE__ */ jsxs17(Flex12, { align: "center", gap: 3, wrap: "wrap", children: [
5083
- /* @__PURE__ */ jsx21(Text19, { size: 3, weight: "semibold", children: "Comparison" }),
5084
- /* @__PURE__ */ jsx21(
5085
- DeltaCard,
5086
- {
5087
- delta: comparison.deltas.overall,
5088
- label: "pts overall",
5089
- tooltip: GLOSSARY.overallDelta
5090
- }
5091
- ),
5092
- comparison.deltas.actualDelta != null && /* @__PURE__ */ jsx21(
5093
- DeltaCard,
5094
- {
5095
- delta: comparison.deltas.actualDelta,
5096
- label: "actual",
5097
- tooltip: GLOSSARY.actualDelta
5098
- }
5099
- ),
5100
- comparison.deltas.retrievalGapDelta != null && /* @__PURE__ */ jsx21(
5101
- DeltaCard,
5102
- {
5103
- delta: comparison.deltas.retrievalGapDelta,
5104
- invertedPolarity: true,
5105
- label: "ret. gap",
5106
- tooltip: GLOSSARY.retGapDelta
5107
- }
5108
- )
5109
- ] }),
5110
- /* @__PURE__ */ jsxs17(Grid3, { columns: [1, 1, 3], gap: 3, children: [
5111
- comparison.improved.length > 0 && /* @__PURE__ */ jsx21(
5112
- AreaBadgeGroup,
5113
- {
5114
- areas: comparison.improved,
5115
- label: "Improved",
5116
- tone: "positive"
5117
- }
5118
- ),
5119
- comparison.regressed.length > 0 && /* @__PURE__ */ jsx21(
5120
- AreaBadgeGroup,
5121
- {
5122
- areas: comparison.regressed,
5123
- label: "Regressed",
5124
- tone: "critical"
5125
- }
5126
- ),
5127
- comparison.unchanged.length > 0 && /* @__PURE__ */ jsx21(
5128
- AreaBadgeGroup,
5129
- {
5130
- areas: comparison.unchanged,
5131
- label: "Unchanged",
5132
- tone: "default"
5294
+ ]
5133
5295
  }
5134
5296
  )
5135
5297
  ] })
5136
- ] }) });
5298
+ ] });
5137
5299
  }
5138
- function DeltaCard({
5300
+ function ScoreCard({
5139
5301
  delta,
5140
- invertedPolarity = false,
5302
+ infoTip,
5141
5303
  label,
5142
- tooltip
5304
+ subtitle,
5305
+ suffix,
5306
+ value
5143
5307
  }) {
5144
- const isPositive = invertedPolarity ? delta < 0 : delta > 0;
5145
- const isNegative = invertedPolarity ? delta > 0 : delta < 0;
5146
- return /* @__PURE__ */ jsx21(
5147
- Tooltip5,
5308
+ const color = scoreColor(value);
5309
+ return /* @__PURE__ */ jsx20(
5310
+ Box11,
5148
5311
  {
5149
- content: /* @__PURE__ */ jsx21(Box10, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx21(Text19, { size: 2, children: tooltip }) }),
5150
- placement: "bottom",
5151
- portal: true,
5152
- children: /* @__PURE__ */ jsx21(
5153
- Card12,
5154
- {
5155
- padding: 2,
5156
- radius: 2,
5157
- tone: isPositive ? "positive" : isNegative ? "critical" : "default",
5158
- children: /* @__PURE__ */ jsxs17(Text19, { size: 2, weight: "bold", children: [
5159
- formatDelta(delta),
5160
- " ",
5161
- label
5312
+ padding: 4,
5313
+ style: {
5314
+ backgroundColor: "var(--card-bg2-color, var(--card-bg-color))",
5315
+ border: "1px solid var(--card-border-color)",
5316
+ borderRadius: 6
5317
+ },
5318
+ children: /* @__PURE__ */ jsxs16(Stack13, { space: 3, children: [
5319
+ /* @__PURE__ */ jsxs16(Flex12, { align: "center", gap: 2, children: [
5320
+ /* @__PURE__ */ jsx20(
5321
+ Text18,
5322
+ {
5323
+ muted: true,
5324
+ size: 1,
5325
+ style: {
5326
+ letterSpacing: "0.08em",
5327
+ textTransform: "uppercase"
5328
+ },
5329
+ children: label
5330
+ }
5331
+ ),
5332
+ infoTip && /* @__PURE__ */ jsx20(InfoTip, { text: infoTip })
5333
+ ] }),
5334
+ /* @__PURE__ */ jsxs16(Flex12, { align: "baseline", gap: 2, children: [
5335
+ /* @__PURE__ */ jsxs16(
5336
+ "span",
5337
+ {
5338
+ style: {
5339
+ color,
5340
+ fontFamily: "var(--font-code-size, monospace)",
5341
+ fontSize: 42,
5342
+ fontWeight: 700,
5343
+ lineHeight: 1
5344
+ },
5345
+ children: [
5346
+ value,
5347
+ suffix && /* @__PURE__ */ jsx20("span", { style: { fontSize: 24 }, children: suffix })
5348
+ ]
5349
+ }
5350
+ ),
5351
+ delta != null && delta !== 0 && /* @__PURE__ */ jsxs16(
5352
+ "span",
5353
+ {
5354
+ style: {
5355
+ color: deltaColor(delta),
5356
+ fontFamily: "var(--font-code-size, monospace)",
5357
+ fontSize: 15,
5358
+ fontWeight: 500
5359
+ },
5360
+ children: [
5361
+ "~",
5362
+ formatDelta(delta)
5363
+ ]
5364
+ }
5365
+ )
5366
+ ] }),
5367
+ /* @__PURE__ */ jsx20(Text18, { muted: true, size: 1, children: subtitle })
5368
+ ] })
5369
+ }
5370
+ );
5371
+ }
5372
+ function HealthCard({
5373
+ color,
5374
+ count,
5375
+ icon,
5376
+ infoTip,
5377
+ label
5378
+ }) {
5379
+ const textColor = color === "emerald" ? "#34d399" : color === "amber" ? "#fbbf24" : "#f87171";
5380
+ return /* @__PURE__ */ jsx20(
5381
+ Box11,
5382
+ {
5383
+ padding: 4,
5384
+ style: {
5385
+ ...sectionStyle(color),
5386
+ minHeight: 80
5387
+ },
5388
+ children: /* @__PURE__ */ jsxs16(Flex12, { align: "center", gap: 3, children: [
5389
+ /* @__PURE__ */ jsx20("span", { style: { color: textColor, fontSize: 28 }, children: icon }),
5390
+ /* @__PURE__ */ jsxs16(Stack13, { space: 1, children: [
5391
+ /* @__PURE__ */ jsx20(
5392
+ "span",
5393
+ {
5394
+ style: {
5395
+ color: textColor,
5396
+ fontFamily: "var(--font-code-size, monospace)",
5397
+ fontSize: 36,
5398
+ fontWeight: 700,
5399
+ lineHeight: 1
5400
+ },
5401
+ children: count
5402
+ }
5403
+ ),
5404
+ /* @__PURE__ */ jsxs16(Flex12, { align: "center", gap: 1, children: [
5405
+ /* @__PURE__ */ jsx20(Text18, { muted: true, size: 2, children: label }),
5406
+ infoTip && /* @__PURE__ */ jsx20(InfoTip, { text: infoTip })
5162
5407
  ] })
5163
- }
5164
- )
5408
+ ] })
5409
+ ] })
5165
5410
  }
5166
5411
  );
5167
5412
  }
5168
- function AreaBadgeGroup({
5169
- areas,
5413
+ function MetricCard({
5414
+ highlight,
5415
+ infoTip,
5170
5416
  label,
5171
- tone
5417
+ value
5172
5418
  }) {
5173
- return /* @__PURE__ */ jsxs17(Stack14, { space: 2, children: [
5174
- /* @__PURE__ */ jsx21(
5175
- Text19,
5419
+ const style = highlight ? {
5420
+ ...sectionStyle("red"),
5421
+ padding: 16
5422
+ } : {
5423
+ backgroundColor: "var(--card-bg2-color, var(--card-bg-color))",
5424
+ border: "1px solid var(--card-border-color)",
5425
+ borderRadius: 6,
5426
+ padding: 16
5427
+ };
5428
+ return /* @__PURE__ */ jsx20(Box11, { style, children: /* @__PURE__ */ jsxs16(Stack13, { space: 2, children: [
5429
+ /* @__PURE__ */ jsxs16(Flex12, { align: "center", gap: 1, children: [
5430
+ /* @__PURE__ */ jsx20(Text18, { muted: true, size: 2, children: label }),
5431
+ infoTip && /* @__PURE__ */ jsx20(InfoTip, { text: infoTip })
5432
+ ] }),
5433
+ /* @__PURE__ */ jsx20(
5434
+ "span",
5176
5435
  {
5177
- muted: true,
5178
- size: 1,
5179
- style: { letterSpacing: "0.05em", textTransform: "uppercase" },
5180
- weight: "semibold",
5181
- children: label
5436
+ style: {
5437
+ color: highlight ? "#f87171" : "var(--card-fg-color)",
5438
+ fontFamily: "var(--font-code-size, monospace)",
5439
+ fontSize: 28,
5440
+ fontWeight: 600,
5441
+ lineHeight: 1.2
5442
+ },
5443
+ children: value
5182
5444
  }
5183
- ),
5184
- /* @__PURE__ */ jsx21(Flex12, { gap: 1, wrap: "wrap", children: areas.map((a) => /* @__PURE__ */ jsx21(Badge6, { tone, children: a }, a)) })
5185
- ] });
5445
+ )
5446
+ ] }) });
5447
+ }
5448
+ function Pill({
5449
+ color,
5450
+ label
5451
+ }) {
5452
+ const colors = {
5453
+ emerald: { bg: "rgba(16,185,129,0.25)", text: "#34d399" },
5454
+ red: { bg: "rgba(239,68,68,0.25)", text: "#f87171" },
5455
+ muted: {
5456
+ bg: "var(--card-muted-bg-color, rgba(255,255,255,0.06))",
5457
+ text: "var(--card-muted-fg-color)"
5458
+ }
5459
+ };
5460
+ const c = colors[color];
5461
+ return /* @__PURE__ */ jsx20(
5462
+ "span",
5463
+ {
5464
+ style: {
5465
+ backgroundColor: c.bg,
5466
+ borderRadius: 4,
5467
+ color: c.text,
5468
+ fontSize: 14,
5469
+ fontWeight: 500,
5470
+ padding: "4px 10px",
5471
+ whiteSpace: "nowrap"
5472
+ },
5473
+ children: label
5474
+ }
5475
+ );
5186
5476
  }
5187
5477
 
5188
5478
  // src/components/report-detail/LineageCard.tsx
5189
5479
  import { LinkIcon as LinkIcon2 } from "@sanity/icons";
5190
- import { Badge as Badge7, Card as Card13, Flex as Flex13, Stack as Stack15, Text as Text20 } from "@sanity/ui";
5480
+ import { Badge as Badge6, Card as Card10, Flex as Flex13, Stack as Stack14, Text as Text19 } from "@sanity/ui";
5191
5481
  import { useCallback as useCallback11, useEffect as useEffect6, useState as useState7 } from "react";
5192
5482
  import { useClient as useClient5 } from "sanity";
5193
5483
  import { useRouter as useRouter2 } from "sanity/router";
5194
- import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
5484
+ import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
5195
5485
  var REPORT_TYPE2 = "ailf.report";
5196
5486
  var SPAWNED_REPORTS_QUERY = (
5197
5487
  /* groq */
@@ -5223,12 +5513,12 @@ function LineageCard({ provenance, reportId }) {
5223
5513
  }, [client, reportId]);
5224
5514
  const hasLineage = lineage?.rerunOf || lineage?.comparedAgainst;
5225
5515
  if (!hasLineage && spawned.length === 0) return null;
5226
- return /* @__PURE__ */ jsx22(Card13, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs18(Stack15, { space: 4, children: [
5227
- /* @__PURE__ */ jsx22(Flex13, { align: "center", gap: 2, children: /* @__PURE__ */ jsxs18(Text20, { size: 3, weight: "semibold", children: [
5228
- /* @__PURE__ */ jsx22(LinkIcon2, {}),
5516
+ return /* @__PURE__ */ jsx21(Card10, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs17(Stack14, { space: 4, children: [
5517
+ /* @__PURE__ */ jsx21(Flex13, { align: "center", gap: 2, children: /* @__PURE__ */ jsxs17(Text19, { size: 3, weight: "semibold", children: [
5518
+ /* @__PURE__ */ jsx21(LinkIcon2, {}),
5229
5519
  " Lineage"
5230
5520
  ] }) }),
5231
- lineage?.rerunOf && /* @__PURE__ */ jsx22(
5521
+ lineage?.rerunOf && /* @__PURE__ */ jsx21(
5232
5522
  LineageLink,
5233
5523
  {
5234
5524
  label: "Re-run of",
@@ -5236,7 +5526,7 @@ function LineageCard({ provenance, reportId }) {
5236
5526
  router
5237
5527
  }
5238
5528
  ),
5239
- lineage?.comparedAgainst && /* @__PURE__ */ jsx22(
5529
+ lineage?.comparedAgainst && /* @__PURE__ */ jsx21(
5240
5530
  LineageLink,
5241
5531
  {
5242
5532
  label: "Compared against",
@@ -5244,9 +5534,9 @@ function LineageCard({ provenance, reportId }) {
5244
5534
  router
5245
5535
  }
5246
5536
  ),
5247
- spawned.length > 0 && /* @__PURE__ */ jsxs18(Stack15, { space: 2, children: [
5248
- /* @__PURE__ */ jsx22(Text20, { muted: true, size: 1, weight: "semibold", children: "SPAWNED RE-RUNS" }),
5249
- spawned.map((s) => /* @__PURE__ */ jsx22(SpawnedReportRow, { report: s, router }, s.reportId))
5537
+ spawned.length > 0 && /* @__PURE__ */ jsxs17(Stack14, { space: 2, children: [
5538
+ /* @__PURE__ */ jsx21(Text19, { muted: true, size: 1, weight: "semibold", children: "SPAWNED RE-RUNS" }),
5539
+ spawned.map((s) => /* @__PURE__ */ jsx21(SpawnedReportRow, { report: s, router }, s.reportId))
5250
5540
  ] })
5251
5541
  ] }) });
5252
5542
  }
@@ -5258,12 +5548,12 @@ function LineageLink({
5258
5548
  const handleClick = useCallback11(() => {
5259
5549
  router.navigate({ reportId });
5260
5550
  }, [reportId, router]);
5261
- return /* @__PURE__ */ jsxs18(Flex13, { align: "center", gap: 2, children: [
5262
- /* @__PURE__ */ jsxs18(Text20, { muted: true, size: 2, weight: "semibold", children: [
5551
+ return /* @__PURE__ */ jsxs17(Flex13, { align: "center", gap: 2, children: [
5552
+ /* @__PURE__ */ jsxs17(Text19, { muted: true, size: 2, weight: "semibold", children: [
5263
5553
  label,
5264
5554
  ":"
5265
5555
  ] }),
5266
- /* @__PURE__ */ jsx22(Text20, { size: 2, children: /* @__PURE__ */ jsxs18(
5556
+ /* @__PURE__ */ jsx21(Text19, { size: 2, children: /* @__PURE__ */ jsxs17(
5267
5557
  "a",
5268
5558
  {
5269
5559
  href: "#",
@@ -5289,8 +5579,8 @@ function SpawnedReportRow({
5289
5579
  }, [report.reportId, router]);
5290
5580
  const dateLabel = formatShortDate(report.completedAt);
5291
5581
  const label = report.tag ?? dateLabel;
5292
- return /* @__PURE__ */ jsxs18(Flex13, { align: "center", gap: 2, children: [
5293
- /* @__PURE__ */ jsx22(Text20, { size: 2, children: /* @__PURE__ */ jsx22(
5582
+ return /* @__PURE__ */ jsxs17(Flex13, { align: "center", gap: 2, children: [
5583
+ /* @__PURE__ */ jsx21(Text19, { size: 2, children: /* @__PURE__ */ jsx21(
5294
5584
  "a",
5295
5585
  {
5296
5586
  href: "#",
@@ -5302,8 +5592,8 @@ function SpawnedReportRow({
5302
5592
  children: label
5303
5593
  }
5304
5594
  ) }),
5305
- report.tag && /* @__PURE__ */ jsx22(Text20, { muted: true, size: 1, children: dateLabel }),
5306
- /* @__PURE__ */ jsx22(Badge7, { fontSize: 1, mode: "outline", tone: "default", children: report.reportId.slice(0, 8) })
5595
+ report.tag && /* @__PURE__ */ jsx21(Text19, { muted: true, size: 1, children: dateLabel }),
5596
+ /* @__PURE__ */ jsx21(Badge6, { fontSize: 1, mode: "outline", tone: "default", children: report.reportId.slice(0, 8) })
5307
5597
  ] });
5308
5598
  }
5309
5599
  function formatShortDate(iso) {
@@ -5320,15 +5610,15 @@ function formatShortDate(iso) {
5320
5610
 
5321
5611
  // src/components/report-detail/JudgmentList.tsx
5322
5612
  import { useState as useState8 } from "react";
5323
- import { HelpCircleIcon as HelpCircleIcon6 } from "@sanity/icons";
5324
- import { Badge as Badge8, Box as Box11, Card as Card14, Flex as Flex14, Stack as Stack16, Text as Text21, Tooltip as Tooltip6 } from "@sanity/ui";
5613
+ import { ErrorOutlineIcon as ErrorOutlineIcon2, HelpCircleIcon as HelpCircleIcon7 } from "@sanity/icons";
5614
+ import { Box as Box12, Flex as Flex14, Stack as Stack15, Text as Text20, Tooltip as Tooltip6 } from "@sanity/ui";
5325
5615
 
5326
5616
  // src/components/primitives/InlineCode.tsx
5327
- import { Fragment as Fragment7, jsx as jsx23 } from "react/jsx-runtime";
5617
+ import { Fragment as Fragment7, jsx as jsx22 } from "react/jsx-runtime";
5328
5618
  function InlineCode({ text }) {
5329
5619
  const parts = text.split(/`([^`]+)`/);
5330
- return /* @__PURE__ */ jsx23(Fragment7, { children: parts.map(
5331
- (part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx23(
5620
+ return /* @__PURE__ */ jsx22(Fragment7, { children: parts.map(
5621
+ (part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx22(
5332
5622
  "code",
5333
5623
  {
5334
5624
  style: {
@@ -5340,12 +5630,12 @@ function InlineCode({ text }) {
5340
5630
  children: part
5341
5631
  },
5342
5632
  i
5343
- ) : /* @__PURE__ */ jsx23("span", { children: part }, i)
5633
+ ) : /* @__PURE__ */ jsx22("span", { children: part }, i)
5344
5634
  ) });
5345
5635
  }
5346
5636
 
5347
5637
  // src/components/report-detail/JudgmentList.tsx
5348
- import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
5638
+ import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
5349
5639
  function groupByArea(judgments) {
5350
5640
  const byArea = /* @__PURE__ */ new Map();
5351
5641
  for (const j of judgments) {
@@ -5360,108 +5650,182 @@ var DIMENSION_LABELS = DIMENSION_LABELS_KEBAB;
5360
5650
  function JudgmentList({ judgments }) {
5361
5651
  if (judgments.length === 0) return null;
5362
5652
  const grouped = groupByArea(judgments);
5363
- return /* @__PURE__ */ jsx24(Card14, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs19(Stack16, { space: 4, children: [
5364
- /* @__PURE__ */ jsxs19(Flex14, { align: "center", gap: 3, wrap: "wrap", children: [
5365
- /* @__PURE__ */ jsx24(Text21, { size: 3, weight: "semibold", children: "Low-Scoring Judgments" }),
5366
- /* @__PURE__ */ jsx24(
5653
+ return /* @__PURE__ */ jsxs18(Stack15, { space: 3, children: [
5654
+ /* @__PURE__ */ jsxs18(Flex14, { align: "center", gap: 2, children: [
5655
+ /* @__PURE__ */ jsx23(ErrorOutlineIcon2, { style: { color: "#f87171" } }),
5656
+ /* @__PURE__ */ jsx23(Text20, { size: 2, weight: "medium", children: "Low-Scoring Judgments" }),
5657
+ /* @__PURE__ */ jsx23(
5367
5658
  Tooltip6,
5368
5659
  {
5369
- content: /* @__PURE__ */ jsx24(Box11, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx24(Text21, { size: 2, children: GLOSSARY.lowScoringJudgments }) }),
5660
+ content: /* @__PURE__ */ jsx23(Box12, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx23(Text20, { size: 2, children: GLOSSARY.lowScoringJudgments }) }),
5370
5661
  placement: "bottom",
5371
5662
  portal: true,
5372
- children: /* @__PURE__ */ jsx24(Text21, { muted: true, size: 1, children: /* @__PURE__ */ jsx24(HelpCircleIcon6, {}) })
5663
+ children: /* @__PURE__ */ jsx23(Text20, { muted: true, size: 1, children: /* @__PURE__ */ jsx23(HelpCircleIcon7, {}) })
5373
5664
  }
5374
5665
  ),
5375
- /* @__PURE__ */ jsx24(Card14, { padding: 2, radius: 2, tone: "critical", children: /* @__PURE__ */ jsxs19(Text21, { size: 2, weight: "bold", children: [
5376
- judgments.length,
5377
- " judgment",
5378
- judgments.length === 1 ? "" : "s",
5379
- " below 70"
5380
- ] }) })
5666
+ /* @__PURE__ */ jsxs18(
5667
+ "span",
5668
+ {
5669
+ style: {
5670
+ backgroundColor: "rgba(239,68,68,0.2)",
5671
+ borderRadius: 999,
5672
+ color: "#f87171",
5673
+ fontSize: 13,
5674
+ fontWeight: 500,
5675
+ marginLeft: 4,
5676
+ padding: "2px 10px"
5677
+ },
5678
+ children: [
5679
+ judgments.length,
5680
+ " below 70"
5681
+ ]
5682
+ }
5683
+ )
5381
5684
  ] }),
5382
- grouped.map(([area, areaJudgments]) => /* @__PURE__ */ jsx24(Card14, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs19(Stack16, { space: 3, children: [
5383
- /* @__PURE__ */ jsxs19(Text21, { size: 2, weight: "semibold", children: [
5384
- area,
5385
- " ",
5386
- /* @__PURE__ */ jsxs19(Text21, { muted: true, size: 2, weight: "regular", as: "span", children: [
5387
- "(",
5388
- areaJudgments.length,
5389
- ")"
5685
+ /* @__PURE__ */ jsx23(Box12, { style: neutralCardStyle, children: grouped.map(([area, areaJudgments], groupIndex) => /* @__PURE__ */ jsx23(
5686
+ Box12,
5687
+ {
5688
+ padding: 4,
5689
+ style: groupIndex > 0 ? dividerStyle : void 0,
5690
+ children: /* @__PURE__ */ jsxs18(Stack15, { space: 3, children: [
5691
+ /* @__PURE__ */ jsxs18(Text20, { size: 2, weight: "semibold", children: [
5692
+ area,
5693
+ " ",
5694
+ /* @__PURE__ */ jsxs18(
5695
+ "span",
5696
+ {
5697
+ style: {
5698
+ color: "var(--card-muted-fg-color)",
5699
+ fontWeight: 400
5700
+ },
5701
+ children: [
5702
+ "(",
5703
+ areaJudgments.length,
5704
+ ")"
5705
+ ]
5706
+ }
5707
+ )
5708
+ ] }),
5709
+ /* @__PURE__ */ jsx23(Stack15, { space: 2, children: areaJudgments.map((j, i) => /* @__PURE__ */ jsx23(JudgmentCard, { judgment: j }, `${area}-${i}`)) })
5390
5710
  ] })
5391
- ] }),
5392
- areaJudgments.map((j, i) => /* @__PURE__ */ jsx24(JudgmentCard, { judgment: j }, `${area}-${i}`))
5393
- ] }) }, area))
5394
- ] }) });
5711
+ },
5712
+ area
5713
+ )) })
5714
+ ] });
5395
5715
  }
5396
5716
  function JudgmentCard({ judgment }) {
5397
5717
  const [expanded, setExpanded] = useState8(false);
5398
5718
  const dimLabel = DIMENSION_LABELS[judgment.dimension] ?? judgment.dimension;
5399
5719
  const sep = judgment.taskId.indexOf(" - ");
5400
5720
  const taskName = sep > 0 ? judgment.taskId.substring(sep + 3) : judgment.taskId;
5401
- return /* @__PURE__ */ jsx24(
5402
- Card14,
5721
+ return /* @__PURE__ */ jsx23(
5722
+ Box12,
5403
5723
  {
5404
- padding: 3,
5405
- radius: 2,
5406
- shadow: 1,
5407
- style: { cursor: "pointer" },
5724
+ style: {
5725
+ ...neutralCardStyle,
5726
+ cursor: "pointer",
5727
+ padding: 16
5728
+ },
5408
5729
  onClick: () => setExpanded(!expanded),
5409
- children: /* @__PURE__ */ jsxs19(Stack16, { space: 3, children: [
5410
- /* @__PURE__ */ jsxs19(Flex14, { align: "center", gap: 2, wrap: "wrap", children: [
5411
- /* @__PURE__ */ jsx24(Card14, { padding: 2, radius: 2, tone: scoreTone(judgment.score), children: /* @__PURE__ */ jsx24(
5412
- Text21,
5730
+ children: /* @__PURE__ */ jsxs18(Stack15, { space: 3, children: [
5731
+ /* @__PURE__ */ jsxs18(Flex14, { align: "center", gap: 3, wrap: "wrap", children: [
5732
+ /* @__PURE__ */ jsx23(
5733
+ "span",
5413
5734
  {
5414
- align: "center",
5415
- size: 2,
5416
- style: { minWidth: 28 },
5417
- weight: "bold",
5735
+ style: {
5736
+ backgroundColor: scoreBg(judgment.score),
5737
+ borderRadius: 4,
5738
+ color: scoreColor(judgment.score),
5739
+ fontFamily: "var(--font-code-size, monospace)",
5740
+ fontSize: 14,
5741
+ fontWeight: 600,
5742
+ padding: "3px 10px"
5743
+ },
5418
5744
  children: judgment.score
5419
5745
  }
5420
- ) }),
5421
- /* @__PURE__ */ jsx24(Badge8, { tone: "default", children: dimLabel }),
5422
- /* @__PURE__ */ jsx24(Text21, { size: 2, weight: "medium", children: taskName }),
5423
- /* @__PURE__ */ jsx24(Text21, { muted: true, size: 1, children: judgment.modelId }),
5424
- /* @__PURE__ */ jsx24(Text21, { muted: true, size: 1, style: { marginLeft: "auto" }, children: expanded ? "\u25B2" : "\u25BC" })
5746
+ ),
5747
+ /* @__PURE__ */ jsx23(
5748
+ "span",
5749
+ {
5750
+ style: {
5751
+ backgroundColor: "var(--card-muted-bg-color, rgba(255,255,255,0.06))",
5752
+ borderRadius: 4,
5753
+ color: "var(--card-muted-fg-color)",
5754
+ fontSize: 13,
5755
+ padding: "3px 8px"
5756
+ },
5757
+ children: dimLabel
5758
+ }
5759
+ ),
5760
+ /* @__PURE__ */ jsx23(Text20, { size: 2, weight: "medium", children: taskName }),
5761
+ /* @__PURE__ */ jsx23(Text20, { muted: true, size: 1, children: judgment.modelId }),
5762
+ /* @__PURE__ */ jsx23(
5763
+ "span",
5764
+ {
5765
+ style: {
5766
+ color: "var(--card-muted-fg-color)",
5767
+ fontSize: 14,
5768
+ marginLeft: "auto"
5769
+ },
5770
+ children: expanded ? "\u25B2" : "\u25BC"
5771
+ }
5772
+ )
5425
5773
  ] }),
5426
- expanded && /* @__PURE__ */ jsxs19(Stack16, { space: 3, children: [
5427
- /* @__PURE__ */ jsx24(Card14, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx24(
5428
- Text21,
5774
+ expanded && /* @__PURE__ */ jsxs18(Stack15, { space: 3, children: [
5775
+ /* @__PURE__ */ jsx23(
5776
+ Box12,
5429
5777
  {
5430
- muted: true,
5431
- size: 2,
5432
- style: { lineHeight: 1.6, whiteSpace: "pre-wrap" },
5433
- children: /* @__PURE__ */ jsx24(InlineCode, { text: judgment.reason })
5778
+ style: {
5779
+ backgroundColor: "var(--card-muted-bg-color, rgba(255,255,255,0.04))",
5780
+ borderRadius: 4,
5781
+ padding: 16
5782
+ },
5783
+ children: /* @__PURE__ */ jsx23(
5784
+ Text20,
5785
+ {
5786
+ muted: true,
5787
+ size: 2,
5788
+ style: { lineHeight: 1.6, whiteSpace: "pre-wrap" },
5789
+ children: /* @__PURE__ */ jsx23(InlineCode, { text: judgment.reason })
5790
+ }
5791
+ )
5434
5792
  }
5435
- ) }),
5436
- judgment.canonicalDocs && judgment.canonicalDocs.length > 0 && /* @__PURE__ */ jsxs19(Flex14, { align: "center", gap: 2, wrap: "wrap", children: [
5437
- /* @__PURE__ */ jsx24(Text21, { muted: true, size: 1, children: "Docs:" }),
5438
- judgment.canonicalDocs.map((doc) => /* @__PURE__ */ jsx24(DocBadge, { doc }, doc.slug))
5793
+ ),
5794
+ judgment.canonicalDocs && judgment.canonicalDocs.length > 0 && /* @__PURE__ */ jsxs18(Flex14, { align: "center", gap: 2, wrap: "wrap", children: [
5795
+ /* @__PURE__ */ jsx23(Text20, { muted: true, size: 1, children: "Docs:" }),
5796
+ judgment.canonicalDocs.map((doc) => /* @__PURE__ */ jsx23(DocBadge, { doc }, doc.slug))
5439
5797
  ] })
5440
5798
  ] })
5441
5799
  ] })
5442
5800
  }
5443
5801
  );
5444
5802
  }
5445
- var editLinkStyle = {
5446
- cursor: "pointer",
5447
- display: "inline-block",
5448
- textDecoration: "none",
5449
- transition: "opacity 150ms ease"
5450
- };
5451
5803
  function DocBadge({
5452
5804
  doc
5453
5805
  }) {
5454
5806
  const [hovered, setHovered] = useState8(false);
5455
5807
  const isLinked = Boolean(doc.documentId);
5456
5808
  const tooltipLabel = isLinked ? `Edit "${doc.title || doc.slug}"` : doc.title || doc.slug;
5457
- const badge = /* @__PURE__ */ jsx24(Badge8, { mode: "outline", tone: isLinked && hovered ? "caution" : "primary", children: doc.slug });
5458
- return /* @__PURE__ */ jsx24(
5809
+ const badge = /* @__PURE__ */ jsx23(
5810
+ "span",
5811
+ {
5812
+ style: {
5813
+ backgroundColor: isLinked && hovered ? "rgba(245,158,11,0.2)" : "rgba(59,130,246,0.15)",
5814
+ borderRadius: 4,
5815
+ color: isLinked && hovered ? "#fbbf24" : "#60a5fa",
5816
+ fontSize: 13,
5817
+ padding: "3px 8px"
5818
+ },
5819
+ children: doc.slug
5820
+ }
5821
+ );
5822
+ return /* @__PURE__ */ jsx23(
5459
5823
  Tooltip6,
5460
5824
  {
5461
- content: /* @__PURE__ */ jsx24(Box11, { padding: 2, children: /* @__PURE__ */ jsx24(Text21, { size: 2, children: tooltipLabel }) }),
5825
+ content: /* @__PURE__ */ jsx23(Box12, { padding: 2, children: /* @__PURE__ */ jsx23(Text20, { size: 2, children: tooltipLabel }) }),
5462
5826
  placement: "bottom",
5463
5827
  portal: true,
5464
- children: isLinked ? /* @__PURE__ */ jsx24(
5828
+ children: isLinked ? /* @__PURE__ */ jsx23(
5465
5829
  "a",
5466
5830
  {
5467
5831
  href: `/intent/edit/id=${doc.documentId}`,
@@ -5469,110 +5833,45 @@ function DocBadge({
5469
5833
  onMouseEnter: () => setHovered(true),
5470
5834
  onMouseLeave: () => setHovered(false),
5471
5835
  style: {
5472
- ...editLinkStyle,
5473
- opacity: hovered ? 0.8 : 1
5836
+ cursor: "pointer",
5837
+ display: "inline-block",
5838
+ opacity: hovered ? 0.8 : 1,
5839
+ textDecoration: "none",
5840
+ transition: "opacity 150ms ease"
5474
5841
  },
5475
5842
  children: badge
5476
5843
  }
5477
- ) : /* @__PURE__ */ jsx24("span", { children: badge })
5844
+ ) : /* @__PURE__ */ jsx23("span", { children: badge })
5478
5845
  }
5479
5846
  );
5480
5847
  }
5481
5848
 
5482
- // src/components/report-detail/OverviewStats.tsx
5483
- import { Grid as Grid4 } from "@sanity/ui";
5484
- import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
5485
- function OverviewStats({
5486
- overall,
5487
- durationMs,
5488
- totalTests,
5489
- isFullMode
5490
- }) {
5491
- const overallTone = scoreTone(overall.avgScore);
5492
- return /* @__PURE__ */ jsxs20(Grid4, { columns: [1, 1, 2, isFullMode ? 4 : 4], gap: 3, children: [
5493
- /* @__PURE__ */ jsx25(
5494
- StatCard,
5495
- {
5496
- label: "Overall Score",
5497
- tooltip: GLOSSARY.overallScore,
5498
- tone: overallTone,
5499
- value: overall.avgScore.toFixed(1)
5500
- }
5501
- ),
5502
- /* @__PURE__ */ jsx25(
5503
- StatCard,
5504
- {
5505
- label: "Doc Lift",
5506
- suffix: "pts",
5507
- tooltip: GLOSSARY.docLift,
5508
- value: overall.avgDocLift.toFixed(1)
5509
- }
5510
- ),
5511
- isFullMode && overall.avgActualScore != null && /* @__PURE__ */ jsx25(
5512
- StatCard,
5513
- {
5514
- label: "Actual Score",
5515
- suffix: "(agent)",
5516
- tooltip: GLOSSARY.actualScore,
5517
- value: overall.avgActualScore.toFixed(1)
5518
- }
5519
- ),
5520
- isFullMode && overall.avgRetrievalGap != null && /* @__PURE__ */ jsx25(
5521
- StatCard,
5522
- {
5523
- label: "Retrieval Gap",
5524
- suffix: "pts",
5525
- tooltip: GLOSSARY.retrievalGap,
5526
- tone: overall.avgRetrievalGap > 15 ? "critical" : overall.avgRetrievalGap > 5 ? "caution" : "positive",
5527
- value: overall.avgRetrievalGap.toFixed(1)
5528
- }
5529
- ),
5530
- isFullMode && overall.avgInfrastructureEfficiency != null && /* @__PURE__ */ jsx25(
5531
- StatCard,
5532
- {
5533
- label: "Infra Efficiency",
5534
- tooltip: GLOSSARY.infraEfficiency,
5535
- value: formatPercent(overall.avgInfrastructureEfficiency)
5536
- }
5537
- ),
5538
- /* @__PURE__ */ jsx25(StatCard, { label: "Duration", value: formatDuration(durationMs) }),
5539
- /* @__PURE__ */ jsx25(
5540
- StatCard,
5541
- {
5542
- label: "Tests",
5543
- tooltip: GLOSSARY.tests,
5544
- value: String(totalTests)
5545
- }
5546
- )
5547
- ] });
5548
- }
5549
-
5550
5849
  // src/components/report-detail/ProvenanceCard.tsx
5551
- import { Card as Card15, Flex as Flex15, Grid as Grid5, Stack as Stack17, Text as Text22 } from "@sanity/ui";
5552
- import { jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
5850
+ import { Card as Card11, Flex as Flex15, Grid as Grid3, Stack as Stack16, Text as Text21 } from "@sanity/ui";
5851
+ import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
5553
5852
  var VIEWABLE_PROMPTFOO_MODES = /* @__PURE__ */ new Set(["agentic", "observed"]);
5554
5853
  function ProvenanceCard({ provenance }) {
5555
- return /* @__PURE__ */ jsx26(Card15, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs21(Stack17, { space: 4, children: [
5556
- /* @__PURE__ */ jsx26(Text22, { size: 3, weight: "semibold", children: "Provenance" }),
5557
- /* @__PURE__ */ jsxs21(Grid5, { columns: [1, 2, 3], gap: 4, children: [
5558
- /* @__PURE__ */ jsx26(Field, { label: "Mode", value: provenance.mode }),
5559
- /* @__PURE__ */ jsx26(Field, { label: "Source", value: provenance.source.name }),
5560
- /* @__PURE__ */ jsx26(
5854
+ return /* @__PURE__ */ jsx24(Card11, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs19(Stack16, { space: 4, children: [
5855
+ /* @__PURE__ */ jsx24(Text21, { size: 3, weight: "semibold", children: "Provenance" }),
5856
+ /* @__PURE__ */ jsxs19(Grid3, { columns: [1, 2, 3], gap: 4, children: [
5857
+ /* @__PURE__ */ jsx24(Field, { label: "Mode", value: provenance.mode }),
5858
+ /* @__PURE__ */ jsx24(Field, { label: "Source", value: provenance.source.name }),
5859
+ /* @__PURE__ */ jsx24(
5561
5860
  Field,
5562
5861
  {
5563
5862
  label: "Trigger",
5564
5863
  value: provenance.trigger.type + (provenance.trigger.workflow ? ` (${provenance.trigger.workflow})` : "")
5565
5864
  }
5566
5865
  ),
5567
- /* @__PURE__ */ jsx26(
5866
+ /* @__PURE__ */ jsx24(
5568
5867
  Field,
5569
5868
  {
5570
5869
  label: "Models",
5571
5870
  value: provenance.models.map((m) => m.label).join(", ")
5572
5871
  }
5573
5872
  ),
5574
- /* @__PURE__ */ jsx26(Field, { label: "Grader Model", mono: true, value: provenance.graderModel }),
5575
- provenance.contextHash && /* @__PURE__ */ jsx26(
5873
+ /* @__PURE__ */ jsx24(Field, { label: "Grader Model", mono: true, value: provenance.graderModel }),
5874
+ provenance.contextHash && /* @__PURE__ */ jsx24(
5576
5875
  Field,
5577
5876
  {
5578
5877
  label: "Context Hash",
@@ -5581,8 +5880,8 @@ function ProvenanceCard({ provenance }) {
5581
5880
  }
5582
5881
  )
5583
5882
  ] }),
5584
- provenance.git && /* @__PURE__ */ jsx26(GitInfo, { git: provenance.git }),
5585
- /* @__PURE__ */ jsx26(PromptfooLinks, { provenance })
5883
+ provenance.git && /* @__PURE__ */ jsx24(GitInfo, { git: provenance.git }),
5884
+ /* @__PURE__ */ jsx24(PromptfooLinks, { provenance })
5586
5885
  ] }) });
5587
5886
  }
5588
5887
  function Field({
@@ -5590,9 +5889,9 @@ function Field({
5590
5889
  mono,
5591
5890
  value
5592
5891
  }) {
5593
- return /* @__PURE__ */ jsxs21(Stack17, { space: 1, children: [
5594
- /* @__PURE__ */ jsx26(
5595
- Text22,
5892
+ return /* @__PURE__ */ jsxs19(Stack16, { space: 1, children: [
5893
+ /* @__PURE__ */ jsx24(
5894
+ Text21,
5596
5895
  {
5597
5896
  muted: true,
5598
5897
  size: 1,
@@ -5601,7 +5900,7 @@ function Field({
5601
5900
  children: label
5602
5901
  }
5603
5902
  ),
5604
- /* @__PURE__ */ jsx26(Text22, { size: 2, style: mono ? { fontFamily: "monospace" } : void 0, children: value })
5903
+ /* @__PURE__ */ jsx24(Text21, { size: 2, style: mono ? { fontFamily: "monospace" } : void 0, children: value })
5605
5904
  ] });
5606
5905
  }
5607
5906
  function GitInfo({ git }) {
@@ -5609,15 +5908,15 @@ function GitInfo({ git }) {
5609
5908
  const branchUrl = `${repoUrl}/tree/${git.branch}`;
5610
5909
  const commitUrl = `${repoUrl}/commit/${git.sha}`;
5611
5910
  const prUrl = git.prNumber ? `${repoUrl}/pull/${git.prNumber}` : null;
5612
- return /* @__PURE__ */ jsx26(Card15, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs21(Flex15, { align: "center", gap: 3, wrap: "wrap", children: [
5613
- /* @__PURE__ */ jsx26(Text22, { muted: true, size: 2, weight: "semibold", children: "Git" }),
5614
- /* @__PURE__ */ jsxs21(Text22, { size: 2, children: [
5615
- /* @__PURE__ */ jsx26("a", { href: repoUrl, rel: "noopener noreferrer", target: "_blank", children: git.repo }),
5911
+ return /* @__PURE__ */ jsx24(Card11, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs19(Flex15, { align: "center", gap: 3, wrap: "wrap", children: [
5912
+ /* @__PURE__ */ jsx24(Text21, { muted: true, size: 2, weight: "semibold", children: "Git" }),
5913
+ /* @__PURE__ */ jsxs19(Text21, { size: 2, children: [
5914
+ /* @__PURE__ */ jsx24("a", { href: repoUrl, rel: "noopener noreferrer", target: "_blank", children: git.repo }),
5616
5915
  " / ",
5617
- /* @__PURE__ */ jsx26("a", { href: branchUrl, rel: "noopener noreferrer", target: "_blank", children: git.branch })
5916
+ /* @__PURE__ */ jsx24("a", { href: branchUrl, rel: "noopener noreferrer", target: "_blank", children: git.branch })
5618
5917
  ] }),
5619
- /* @__PURE__ */ jsx26(Text22, { muted: true, size: 2, style: { fontFamily: "monospace" }, children: /* @__PURE__ */ jsx26("a", { href: commitUrl, rel: "noopener noreferrer", target: "_blank", children: git.sha.slice(0, 12) }) }),
5620
- prUrl && /* @__PURE__ */ jsx26(Text22, { size: 2, children: /* @__PURE__ */ jsxs21("a", { href: prUrl, rel: "noopener noreferrer", target: "_blank", children: [
5918
+ /* @__PURE__ */ jsx24(Text21, { muted: true, size: 2, style: { fontFamily: "monospace" }, children: /* @__PURE__ */ jsx24("a", { href: commitUrl, rel: "noopener noreferrer", target: "_blank", children: git.sha.slice(0, 12) }) }),
5919
+ prUrl && /* @__PURE__ */ jsx24(Text21, { size: 2, children: /* @__PURE__ */ jsxs19("a", { href: prUrl, rel: "noopener noreferrer", target: "_blank", children: [
5621
5920
  "PR #",
5622
5921
  git.prNumber,
5623
5922
  " \u2192"
@@ -5632,14 +5931,14 @@ function PromptfooLinks({
5632
5931
  (e) => VIEWABLE_PROMPTFOO_MODES.has(e.mode)
5633
5932
  );
5634
5933
  if (viewable.length === 0) return null;
5635
- return /* @__PURE__ */ jsx26(Flex15, { gap: 3, wrap: "wrap", children: viewable.map((entry) => /* @__PURE__ */ jsx26(Text22, { size: 2, children: /* @__PURE__ */ jsxs21("a", { href: entry.url, rel: "noopener noreferrer", target: "_blank", children: [
5934
+ return /* @__PURE__ */ jsx24(Flex15, { gap: 3, wrap: "wrap", children: viewable.map((entry) => /* @__PURE__ */ jsx24(Text21, { size: 2, children: /* @__PURE__ */ jsxs19("a", { href: entry.url, rel: "noopener noreferrer", target: "_blank", children: [
5636
5935
  "View in Promptfoo (",
5637
5936
  entry.mode,
5638
5937
  ") \u2192"
5639
5938
  ] }) }, entry.mode)) });
5640
5939
  }
5641
5940
  if (provenance.promptfooUrl && VIEWABLE_PROMPTFOO_MODES.has(provenance.mode)) {
5642
- return /* @__PURE__ */ jsx26(Text22, { size: 2, children: /* @__PURE__ */ jsx26(
5941
+ return /* @__PURE__ */ jsx24(Text21, { size: 2, children: /* @__PURE__ */ jsx24(
5643
5942
  "a",
5644
5943
  {
5645
5944
  href: provenance.promptfooUrl,
@@ -5653,181 +5952,248 @@ function PromptfooLinks({
5653
5952
  }
5654
5953
 
5655
5954
  // src/components/report-detail/RecommendationsSection.tsx
5656
- import React4 from "react";
5657
- import { Badge as Badge9, Box as Box12, Card as Card16, Flex as Flex16, Stack as Stack18, Text as Text23, Tooltip as Tooltip7 } from "@sanity/ui";
5658
- import { HelpCircleIcon as HelpCircleIcon7 } from "@sanity/icons";
5659
- import { jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
5955
+ import { HelpCircleIcon as HelpCircleIcon8, BoltIcon } from "@sanity/icons";
5956
+ import { Box as Box14, Flex as Flex16, Stack as Stack17, Text as Text23, Tooltip as Tooltip8 } from "@sanity/ui";
5957
+
5958
+ // src/components/report-detail/HoverTip.tsx
5959
+ import { useState as useState9 } from "react";
5960
+ import { Box as Box13, Text as Text22, Tooltip as Tooltip7 } from "@sanity/ui";
5961
+ import { jsx as jsx25 } from "react/jsx-runtime";
5962
+ function HoverTip({
5963
+ text,
5964
+ children,
5965
+ placement = "bottom"
5966
+ }) {
5967
+ const [hovered, setHovered] = useState9(false);
5968
+ return /* @__PURE__ */ jsx25(
5969
+ Tooltip7,
5970
+ {
5971
+ content: /* @__PURE__ */ jsx25(Box13, { padding: 2, style: { maxWidth: 280 }, children: typeof text === "string" ? /* @__PURE__ */ jsx25(Text22, { size: 2, children: text }) : text }),
5972
+ placement,
5973
+ portal: true,
5974
+ children: /* @__PURE__ */ jsx25(
5975
+ "span",
5976
+ {
5977
+ onMouseEnter: () => setHovered(true),
5978
+ onMouseLeave: () => setHovered(false),
5979
+ style: {
5980
+ borderRadius: 4,
5981
+ cursor: "help",
5982
+ display: "inline-flex",
5983
+ outline: hovered ? "1px solid rgba(255,255,255,0.15)" : "1px solid transparent",
5984
+ transition: "background 150ms ease, outline 150ms ease",
5985
+ ...hovered ? { background: "rgba(255,255,255,0.06)" } : {}
5986
+ },
5987
+ children
5988
+ }
5989
+ )
5990
+ }
5991
+ );
5992
+ }
5993
+
5994
+ // src/components/report-detail/RecommendationsSection.tsx
5995
+ import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
5660
5996
  function RecommendationsSection({
5661
5997
  recommendations
5662
5998
  }) {
5663
5999
  if (recommendations.gaps.length === 0) return null;
5664
- return /* @__PURE__ */ jsx27(Card16, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs22(Stack18, { space: 4, children: [
5665
- /* @__PURE__ */ jsxs22(Flex16, { align: "center", gap: 3, wrap: "wrap", children: [
5666
- /* @__PURE__ */ jsx27(Text23, { size: 3, weight: "semibold", children: "Recommendations" }),
5667
- /* @__PURE__ */ jsx27(
5668
- Tooltip7,
6000
+ return /* @__PURE__ */ jsxs20(Stack17, { space: 3, children: [
6001
+ /* @__PURE__ */ jsxs20(Flex16, { align: "center", gap: 2, children: [
6002
+ /* @__PURE__ */ jsx26(BoltIcon, { style: { color: "#fbbf24" } }),
6003
+ /* @__PURE__ */ jsx26(Text23, { size: 2, weight: "medium", children: "Recommendations" }),
6004
+ /* @__PURE__ */ jsx26(
6005
+ Tooltip8,
5669
6006
  {
5670
- content: /* @__PURE__ */ jsx27(Box12, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx27(Text23, { size: 2, children: GLOSSARY.recommendations }) }),
6007
+ content: /* @__PURE__ */ jsx26(Box14, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx26(Text23, { size: 2, children: GLOSSARY.recommendations }) }),
5671
6008
  placement: "bottom",
5672
6009
  portal: true,
5673
- children: /* @__PURE__ */ jsx27(Text23, { muted: true, size: 1, children: /* @__PURE__ */ jsx27(HelpCircleIcon7, {}) })
6010
+ children: /* @__PURE__ */ jsx26(Text23, { muted: true, size: 1, children: /* @__PURE__ */ jsx26(HelpCircleIcon8, {}) })
5674
6011
  }
5675
6012
  ),
5676
- /* @__PURE__ */ jsx27(
5677
- Tooltip7,
6013
+ /* @__PURE__ */ jsxs20(
6014
+ "span",
5678
6015
  {
5679
- content: /* @__PURE__ */ jsx27(Box12, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx27(Text23, { size: 2, children: GLOSSARY.totalPotentialLift }) }),
5680
- placement: "bottom",
5681
- portal: true,
5682
- children: /* @__PURE__ */ jsx27(Card16, { padding: 2, radius: 2, tone: "positive", children: /* @__PURE__ */ jsxs22(Text23, { size: 2, weight: "bold", children: [
6016
+ style: {
6017
+ backgroundColor: "rgba(16,185,129,0.2)",
6018
+ borderRadius: 999,
6019
+ color: "#34d399",
6020
+ fontSize: 13,
6021
+ fontWeight: 500,
6022
+ marginLeft: 4,
6023
+ padding: "2px 10px"
6024
+ },
6025
+ children: [
5683
6026
  "+",
5684
6027
  recommendations.totalPotentialLift.toFixed(1),
5685
- " pts potential lift"
5686
- ] }) })
6028
+ " pts lift"
6029
+ ]
5687
6030
  }
5688
6031
  )
5689
6032
  ] }),
5690
- /* @__PURE__ */ jsxs22(
5691
- "div",
5692
- {
5693
- style: {
5694
- display: "grid",
5695
- gap: "0 8px",
5696
- gridTemplateColumns: "auto 2fr 2fr 1fr 1fr 1fr"
5697
- },
5698
- children: [
5699
- /* @__PURE__ */ jsx27(ColumnHeader, { borderBottom: true, label: "#" }),
5700
- /* @__PURE__ */ jsx27(ColumnHeader, { borderBottom: true, label: "Area" }),
5701
- /* @__PURE__ */ jsx27(
5702
- ColumnHeader,
5703
- {
5704
- borderBottom: true,
5705
- label: "Failure Mode",
5706
- tooltip: GLOSSARY.failureMode
5707
- }
5708
- ),
5709
- /* @__PURE__ */ jsx27(ColumnHeader, { borderBottom: true, label: "Action" }),
5710
- /* @__PURE__ */ jsx27(
5711
- ColumnHeader,
5712
- {
5713
- borderBottom: true,
5714
- label: "Lift",
5715
- tooltip: GLOSSARY.estimatedLift
5716
- }
5717
- ),
5718
- /* @__PURE__ */ jsx27(
5719
- ColumnHeader,
5720
- {
5721
- borderBottom: true,
5722
- label: "Confidence",
5723
- tooltip: GLOSSARY.confidence
5724
- }
5725
- ),
5726
- recommendations.gaps.map((gap, i) => /* @__PURE__ */ jsx27(RecommendationRow, { gap, index: i }, `gap-${i}`))
5727
- ]
5728
- }
5729
- )
5730
- ] }) });
6033
+ /* @__PURE__ */ jsxs20(Box14, { style: neutralCardStyle, children: [
6034
+ /* @__PURE__ */ jsxs20(
6035
+ Flex16,
6036
+ {
6037
+ align: "center",
6038
+ gap: 3,
6039
+ padding: 4,
6040
+ style: { borderBottom: "1px solid var(--card-border-color)" },
6041
+ children: [
6042
+ /* @__PURE__ */ jsx26(Box14, { style: { width: 32 }, children: /* @__PURE__ */ jsx26(Text23, { muted: true, size: 1, children: "#" }) }),
6043
+ /* @__PURE__ */ jsx26(Box14, { flex: 2, children: /* @__PURE__ */ jsx26(Text23, { muted: true, size: 1, children: "Area" }) }),
6044
+ /* @__PURE__ */ jsx26(Box14, { flex: 2, children: /* @__PURE__ */ jsxs20(Flex16, { align: "center", gap: 1, children: [
6045
+ /* @__PURE__ */ jsx26(Text23, { muted: true, size: 1, children: "Failure Mode" }),
6046
+ /* @__PURE__ */ jsx26(
6047
+ Tooltip8,
6048
+ {
6049
+ content: /* @__PURE__ */ jsx26(Box14, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx26(Text23, { size: 2, children: GLOSSARY.failureMode }) }),
6050
+ placement: "bottom",
6051
+ portal: true,
6052
+ children: /* @__PURE__ */ jsx26(Text23, { muted: true, size: 1, children: /* @__PURE__ */ jsx26(HelpCircleIcon8, {}) })
6053
+ }
6054
+ )
6055
+ ] }) }),
6056
+ /* @__PURE__ */ jsx26(Box14, { flex: 2, children: /* @__PURE__ */ jsx26(Text23, { muted: true, size: 1, children: "Action" }) }),
6057
+ /* @__PURE__ */ jsx26(Box14, { style: { textAlign: "right", width: 72 }, children: /* @__PURE__ */ jsxs20(Flex16, { align: "center", gap: 1, justify: "flex-end", children: [
6058
+ /* @__PURE__ */ jsx26(Text23, { muted: true, size: 1, children: "Lift" }),
6059
+ /* @__PURE__ */ jsx26(
6060
+ Tooltip8,
6061
+ {
6062
+ content: /* @__PURE__ */ jsx26(Box14, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx26(Text23, { size: 2, children: GLOSSARY.estimatedLift }) }),
6063
+ placement: "bottom",
6064
+ portal: true,
6065
+ children: /* @__PURE__ */ jsx26(Text23, { muted: true, size: 1, children: /* @__PURE__ */ jsx26(HelpCircleIcon8, {}) })
6066
+ }
6067
+ )
6068
+ ] }) }),
6069
+ /* @__PURE__ */ jsx26(Box14, { style: { textAlign: "right", width: 90 }, children: /* @__PURE__ */ jsxs20(Flex16, { align: "center", gap: 1, justify: "flex-end", children: [
6070
+ /* @__PURE__ */ jsx26(Text23, { muted: true, size: 1, children: "Confidence" }),
6071
+ /* @__PURE__ */ jsx26(
6072
+ Tooltip8,
6073
+ {
6074
+ content: /* @__PURE__ */ jsx26(Box14, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx26(Text23, { size: 2, children: GLOSSARY.confidence }) }),
6075
+ placement: "bottom",
6076
+ portal: true,
6077
+ children: /* @__PURE__ */ jsx26(Text23, { muted: true, size: 1, children: /* @__PURE__ */ jsx26(HelpCircleIcon8, {}) })
6078
+ }
6079
+ )
6080
+ ] }) })
6081
+ ]
6082
+ }
6083
+ ),
6084
+ recommendations.gaps.map((gap, i) => /* @__PURE__ */ jsx26(RecommendationRow, { gap, index: i }, `gap-${i}`))
6085
+ ] })
6086
+ ] });
6087
+ }
6088
+ var FAILURE_MODE_COLORS = {
6089
+ "missing-docs": { bg: "rgba(239,68,68,0.2)", text: "#f87171" },
6090
+ "incorrect-docs": { bg: "rgba(239,68,68,0.2)", text: "#f87171" },
6091
+ "outdated-docs": { bg: "rgba(245,158,11,0.2)", text: "#fbbf24" },
6092
+ "poor-structure": { bg: "rgba(245,158,11,0.2)", text: "#fbbf24" }
6093
+ };
6094
+ var fmLabel = {
6095
+ fontWeight: 600
6096
+ };
6097
+ var FAILURE_MODE_DESCS = {
6098
+ "missing-docs": "This feature has no documentation at all. AI agents have nothing to reference when implementing it.",
6099
+ "incorrect-docs": "The documentation contains factual errors \u2014 wrong API signatures, incorrect parameters, or misleading examples.",
6100
+ "outdated-docs": "The docs describe old APIs or deprecated patterns. AI agents follow them and produce code that doesn't work with current versions.",
6101
+ "poor-structure": "The docs exist but are hard to find or understand. AI agents struggle to locate the right information or misinterpret it."
6102
+ };
6103
+ function failureModeTip(mode) {
6104
+ const desc = FAILURE_MODE_DESCS[mode];
6105
+ if (!desc) return GLOSSARY.failureMode;
6106
+ return /* @__PURE__ */ jsxs20(Text23, { size: 2, style: { lineHeight: 1.5 }, children: [
6107
+ /* @__PURE__ */ jsx26("span", { style: fmLabel, children: mode }),
6108
+ " \u2014 ",
6109
+ desc
6110
+ ] });
6111
+ }
6112
+ var CONFIDENCE_DESCS = {
6113
+ high: "Strong keyword and structural signal agreement \u2014 this diagnosis is reliable.",
6114
+ medium: "Partial signal agreement \u2014 likely correct but worth verifying manually.",
6115
+ low: "Weak signals only \u2014 treat as a hypothesis to investigate, not a confirmed diagnosis."
6116
+ };
6117
+ function confidenceTip(level) {
6118
+ const desc = CONFIDENCE_DESCS[level];
6119
+ if (!desc) return GLOSSARY.confidence;
6120
+ const icons = { high: "\u{1F7E2}", medium: "\u{1F7E1}", low: "\u{1F534}" };
6121
+ return /* @__PURE__ */ jsxs20(Text23, { size: 2, style: { lineHeight: 1.5 }, children: [
6122
+ icons[level],
6123
+ " ",
6124
+ /* @__PURE__ */ jsxs20("span", { style: fmLabel, children: [
6125
+ level,
6126
+ " confidence"
6127
+ ] }),
6128
+ " \u2014 ",
6129
+ desc
6130
+ ] });
5731
6131
  }
5732
6132
  function RecommendationRow({
5733
6133
  gap,
5734
6134
  index
5735
6135
  }) {
5736
6136
  const confIcon = gap.confidence === "high" ? "\u{1F7E2}" : gap.confidence === "medium" ? "\u{1F7E1}" : "\u{1F534}";
5737
- const bg = rowBackground(index);
5738
- return /* @__PURE__ */ jsxs22(React4.Fragment, { children: [
5739
- /* @__PURE__ */ jsx27(
5740
- "div",
5741
- {
5742
- style: {
5743
- alignItems: "center",
5744
- background: bg,
5745
- borderRadius: 4,
5746
- display: "flex",
5747
- padding: "8px 4px"
5748
- },
5749
- children: /* @__PURE__ */ jsx27(Text23, { muted: true, size: 2, children: index + 1 })
5750
- }
5751
- ),
5752
- /* @__PURE__ */ jsx27(
5753
- "div",
5754
- {
5755
- style: {
5756
- alignItems: "center",
5757
- background: bg,
5758
- display: "flex",
5759
- padding: "8px 0"
5760
- },
5761
- children: /* @__PURE__ */ jsx27(Text23, { size: 2, weight: "medium", children: gap.area })
5762
- }
5763
- ),
5764
- /* @__PURE__ */ jsx27(
5765
- "div",
5766
- {
5767
- style: {
5768
- alignItems: "center",
5769
- background: bg,
5770
- display: "flex",
5771
- padding: "8px 0"
5772
- },
5773
- children: /* @__PURE__ */ jsx27(
5774
- Badge9,
6137
+ const fmColors = FAILURE_MODE_COLORS[gap.failureMode] ?? {
6138
+ bg: "var(--card-muted-bg-color)",
6139
+ text: "var(--card-muted-fg-color)"
6140
+ };
6141
+ return /* @__PURE__ */ jsxs20(
6142
+ Flex16,
6143
+ {
6144
+ align: "center",
6145
+ gap: 3,
6146
+ padding: 4,
6147
+ style: index > 0 ? dividerStyle : void 0,
6148
+ children: [
6149
+ /* @__PURE__ */ jsx26(Box14, { style: { width: 32 }, children: /* @__PURE__ */ jsx26(Text23, { muted: true, size: 2, children: index + 1 }) }),
6150
+ /* @__PURE__ */ jsx26(Box14, { flex: 2, children: /* @__PURE__ */ jsx26(Text23, { size: 2, weight: "medium", children: gap.area }) }),
6151
+ /* @__PURE__ */ jsx26(Box14, { flex: 2, children: /* @__PURE__ */ jsx26(HoverTip, { text: failureModeTip(gap.failureMode), children: /* @__PURE__ */ jsx26(
6152
+ "span",
5775
6153
  {
5776
- tone: gap.failureMode === "missing-docs" ? "critical" : gap.failureMode === "incorrect-docs" ? "critical" : gap.failureMode === "outdated-docs" ? "caution" : "default",
6154
+ style: {
6155
+ backgroundColor: fmColors.bg,
6156
+ borderRadius: 4,
6157
+ color: fmColors.text,
6158
+ fontSize: 13,
6159
+ fontWeight: 500,
6160
+ padding: "3px 8px"
6161
+ },
5777
6162
  children: gap.failureMode
5778
6163
  }
5779
- )
5780
- }
5781
- ),
5782
- /* @__PURE__ */ jsx27(
5783
- "div",
5784
- {
5785
- style: {
5786
- alignItems: "center",
5787
- background: bg,
5788
- display: "flex",
5789
- padding: "8px 0"
5790
- },
5791
- children: /* @__PURE__ */ jsx27(Text23, { muted: true, size: 2, children: gap.remediation })
5792
- }
5793
- ),
5794
- /* @__PURE__ */ jsx27(
5795
- "div",
5796
- {
5797
- style: {
5798
- alignItems: "center",
5799
- background: bg,
5800
- display: "flex",
5801
- padding: "8px 0"
5802
- },
5803
- children: /* @__PURE__ */ jsx27(Card16, { padding: 2, radius: 2, tone: "positive", children: /* @__PURE__ */ jsxs22(Text23, { align: "center", size: 2, weight: "medium", children: [
5804
- "+",
5805
- gap.estimatedLift.toFixed(1)
5806
- ] }) })
5807
- }
5808
- ),
5809
- /* @__PURE__ */ jsx27(
5810
- "div",
5811
- {
5812
- style: {
5813
- alignItems: "center",
5814
- background: bg,
5815
- display: "flex",
5816
- padding: "8px 0"
5817
- },
5818
- children: /* @__PURE__ */ jsxs22(Text23, { size: 2, children: [
6164
+ ) }) }),
6165
+ /* @__PURE__ */ jsx26(Box14, { flex: 2, children: /* @__PURE__ */ jsx26(Text23, { muted: true, size: 2, children: gap.remediation }) }),
6166
+ /* @__PURE__ */ jsx26(Box14, { style: { textAlign: "right", width: 72 }, children: /* @__PURE__ */ jsxs20(
6167
+ "span",
6168
+ {
6169
+ style: {
6170
+ backgroundColor: "rgba(16,185,129,0.2)",
6171
+ borderRadius: 4,
6172
+ color: "#34d399",
6173
+ fontFamily: "var(--font-code-size, monospace)",
6174
+ fontSize: 14,
6175
+ fontWeight: 600,
6176
+ padding: "3px 8px"
6177
+ },
6178
+ children: [
6179
+ "+",
6180
+ gap.estimatedLift.toFixed(1)
6181
+ ]
6182
+ }
6183
+ ) }),
6184
+ /* @__PURE__ */ jsx26(Box14, { style: { textAlign: "right", width: 90 }, children: /* @__PURE__ */ jsx26(HoverTip, { text: confidenceTip(gap.confidence), children: /* @__PURE__ */ jsxs20(Text23, { size: 2, children: [
5819
6185
  confIcon,
5820
6186
  " ",
5821
6187
  gap.confidence
5822
- ] })
5823
- }
5824
- )
5825
- ] });
6188
+ ] }) }) })
6189
+ ]
6190
+ }
6191
+ );
5826
6192
  }
5827
6193
 
5828
6194
  // src/components/report-detail/ReportHeader.tsx
5829
6195
  import { ArrowLeftIcon } from "@sanity/icons";
5830
- import { Badge as Badge10, Button as Button4, Flex as Flex19, Stack as Stack20, Text as Text25 } from "@sanity/ui";
6196
+ import { Badge as Badge7, Button as Button4, Flex as Flex19, Stack as Stack19, Text as Text25 } from "@sanity/ui";
5831
6197
 
5832
6198
  // src/components/report-detail/report-actions/ReportActions.tsx
5833
6199
  import { ChevronDownIcon, CopyIcon as CopyIcon2 } from "@sanity/icons";
@@ -5839,19 +6205,19 @@ import {
5839
6205
  MenuDivider,
5840
6206
  useToast as useToast7
5841
6207
  } from "@sanity/ui";
5842
- import { useCallback as useCallback17, useState as useState12 } from "react";
6208
+ import { useCallback as useCallback17, useState as useState13 } from "react";
5843
6209
  import { useClient as useClient9 } from "sanity";
5844
6210
 
5845
6211
  // src/components/report-detail/report-actions/CopyReportAction.tsx
5846
6212
  import { ClipboardIcon } from "@sanity/icons";
5847
6213
  import { MenuItem, useToast as useToast2 } from "@sanity/ui";
5848
- import { useCallback as useCallback12, useState as useState9 } from "react";
6214
+ import { useCallback as useCallback12, useState as useState10 } from "react";
5849
6215
  import { useClient as useClient6 } from "sanity";
5850
- import { jsx as jsx28 } from "react/jsx-runtime";
6216
+ import { jsx as jsx27 } from "react/jsx-runtime";
5851
6217
  function CopyReportAction({ documentId }) {
5852
6218
  const client = useClient6({ apiVersion: API_VERSION });
5853
6219
  const toast = useToast2();
5854
- const [copying, setCopying] = useState9(false);
6220
+ const [copying, setCopying] = useState10(false);
5855
6221
  const handleClick = useCallback12(async () => {
5856
6222
  setCopying(true);
5857
6223
  try {
@@ -5884,7 +6250,7 @@ function CopyReportAction({ documentId }) {
5884
6250
  setCopying(false);
5885
6251
  }
5886
6252
  }, [client, documentId, toast]);
5887
- return /* @__PURE__ */ jsx28(
6253
+ return /* @__PURE__ */ jsx27(
5888
6254
  MenuItem,
5889
6255
  {
5890
6256
  disabled: copying,
@@ -5899,7 +6265,7 @@ function CopyReportAction({ documentId }) {
5899
6265
  import { CopyIcon } from "@sanity/icons";
5900
6266
  import { MenuItem as MenuItem2, useToast as useToast3 } from "@sanity/ui";
5901
6267
  import { useCallback as useCallback13 } from "react";
5902
- import { jsx as jsx29 } from "react/jsx-runtime";
6268
+ import { jsx as jsx28 } from "react/jsx-runtime";
5903
6269
  function CopyReportIdAction({ reportId }) {
5904
6270
  const toast = useToast3();
5905
6271
  const handleClick = useCallback13(() => {
@@ -5920,14 +6286,14 @@ function CopyReportIdAction({ reportId }) {
5920
6286
  }
5921
6287
  );
5922
6288
  }, [reportId, toast]);
5923
- return /* @__PURE__ */ jsx29(MenuItem2, { icon: CopyIcon, onClick: handleClick, text: "Copy report ID" });
6289
+ return /* @__PURE__ */ jsx28(MenuItem2, { icon: CopyIcon, onClick: handleClick, text: "Copy report ID" });
5924
6290
  }
5925
6291
 
5926
6292
  // src/components/report-detail/report-actions/CopyVisionQueryAction.tsx
5927
6293
  import { SearchIcon as SearchIcon4 } from "@sanity/icons";
5928
6294
  import { MenuItem as MenuItem3, useToast as useToast4 } from "@sanity/ui";
5929
6295
  import { useCallback as useCallback14 } from "react";
5930
- import { jsx as jsx30 } from "react/jsx-runtime";
6296
+ import { jsx as jsx29 } from "react/jsx-runtime";
5931
6297
  function CopyVisionQueryAction({
5932
6298
  reportId
5933
6299
  }) {
@@ -5952,7 +6318,7 @@ function CopyVisionQueryAction({
5952
6318
  }
5953
6319
  );
5954
6320
  }, [reportId, toast]);
5955
- return /* @__PURE__ */ jsx30(
6321
+ return /* @__PURE__ */ jsx29(
5956
6322
  MenuItem3,
5957
6323
  {
5958
6324
  icon: SearchIcon4,
@@ -5963,24 +6329,24 @@ function CopyVisionQueryAction({
5963
6329
  }
5964
6330
 
5965
6331
  // src/components/report-detail/report-actions/DeleteConfirmDialog.tsx
5966
- import { Box as Box13, Button as Button2, Card as Card17, Dialog, Flex as Flex17, Stack as Stack19, Text as Text24 } from "@sanity/ui";
5967
- import { jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
6332
+ import { Box as Box15, Button as Button2, Card as Card12, Dialog, Flex as Flex17, Stack as Stack18, Text as Text24 } from "@sanity/ui";
6333
+ import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
5968
6334
  function DeleteConfirmDialog({
5969
6335
  isDeleting,
5970
6336
  onClose,
5971
6337
  onConfirm,
5972
6338
  reportId
5973
6339
  }) {
5974
- return /* @__PURE__ */ jsx31(
6340
+ return /* @__PURE__ */ jsx30(
5975
6341
  Dialog,
5976
6342
  {
5977
6343
  header: "Delete Report",
5978
6344
  id: "delete-report-dialog",
5979
6345
  onClose,
5980
6346
  width: 1,
5981
- children: /* @__PURE__ */ jsx31(Box13, { padding: 4, children: /* @__PURE__ */ jsxs23(Stack19, { space: 4, children: [
5982
- /* @__PURE__ */ jsx31(Text24, { children: "Are you sure you want to delete this report? This action cannot be undone." }),
5983
- /* @__PURE__ */ jsx31(Card17, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx31(
6347
+ children: /* @__PURE__ */ jsx30(Box15, { padding: 4, children: /* @__PURE__ */ jsxs21(Stack18, { space: 4, children: [
6348
+ /* @__PURE__ */ jsx30(Text24, { children: "Are you sure you want to delete this report? This action cannot be undone." }),
6349
+ /* @__PURE__ */ jsx30(Card12, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx30(
5984
6350
  Text24,
5985
6351
  {
5986
6352
  muted: true,
@@ -5989,8 +6355,8 @@ function DeleteConfirmDialog({
5989
6355
  children: reportId
5990
6356
  }
5991
6357
  ) }),
5992
- /* @__PURE__ */ jsxs23(Flex17, { gap: 2, justify: "flex-end", children: [
5993
- /* @__PURE__ */ jsx31(
6358
+ /* @__PURE__ */ jsxs21(Flex17, { gap: 2, justify: "flex-end", children: [
6359
+ /* @__PURE__ */ jsx30(
5994
6360
  Button2,
5995
6361
  {
5996
6362
  disabled: isDeleting,
@@ -5999,7 +6365,7 @@ function DeleteConfirmDialog({
5999
6365
  text: "Cancel"
6000
6366
  }
6001
6367
  ),
6002
- /* @__PURE__ */ jsx31(
6368
+ /* @__PURE__ */ jsx30(
6003
6369
  Button2,
6004
6370
  {
6005
6371
  disabled: isDeleting,
@@ -6017,11 +6383,11 @@ function DeleteConfirmDialog({
6017
6383
  // src/components/report-detail/report-actions/DeleteReportAction.tsx
6018
6384
  import { TrashIcon } from "@sanity/icons";
6019
6385
  import { MenuItem as MenuItem4 } from "@sanity/ui";
6020
- import { jsx as jsx32 } from "react/jsx-runtime";
6386
+ import { jsx as jsx31 } from "react/jsx-runtime";
6021
6387
  function DeleteReportAction({
6022
6388
  onRequestDelete
6023
6389
  }) {
6024
- return /* @__PURE__ */ jsx32(
6390
+ return /* @__PURE__ */ jsx31(
6025
6391
  MenuItem4,
6026
6392
  {
6027
6393
  icon: TrashIcon,
@@ -6035,16 +6401,16 @@ function DeleteReportAction({
6035
6401
  // src/components/report-detail/report-actions/DownloadReportAction.tsx
6036
6402
  import { DownloadIcon } from "@sanity/icons";
6037
6403
  import { MenuItem as MenuItem5, useToast as useToast5 } from "@sanity/ui";
6038
- import { useCallback as useCallback15, useState as useState10 } from "react";
6404
+ import { useCallback as useCallback15, useState as useState11 } from "react";
6039
6405
  import { useClient as useClient7 } from "sanity";
6040
- import { jsx as jsx33 } from "react/jsx-runtime";
6406
+ import { jsx as jsx32 } from "react/jsx-runtime";
6041
6407
  function DownloadReportAction({
6042
6408
  documentId,
6043
6409
  reportId
6044
6410
  }) {
6045
6411
  const client = useClient7({ apiVersion: API_VERSION });
6046
6412
  const toast = useToast5();
6047
- const [downloading, setDownloading] = useState10(false);
6413
+ const [downloading, setDownloading] = useState11(false);
6048
6414
  const handleClick = useCallback15(async () => {
6049
6415
  setDownloading(true);
6050
6416
  try {
@@ -6085,7 +6451,7 @@ function DownloadReportAction({
6085
6451
  setDownloading(false);
6086
6452
  }
6087
6453
  }, [client, documentId, reportId, toast]);
6088
- return /* @__PURE__ */ jsx33(
6454
+ return /* @__PURE__ */ jsx32(
6089
6455
  MenuItem5,
6090
6456
  {
6091
6457
  disabled: downloading,
@@ -6099,7 +6465,7 @@ function DownloadReportAction({
6099
6465
  // src/components/report-detail/report-actions/RerunEvaluationAction.tsx
6100
6466
  import { PlayIcon as PlayIcon2 } from "@sanity/icons";
6101
6467
  import { MenuItem as MenuItem6, useToast as useToast6 } from "@sanity/ui";
6102
- import { useCallback as useCallback16, useState as useState11 } from "react";
6468
+ import { useCallback as useCallback16, useState as useState12 } from "react";
6103
6469
  import { useClient as useClient8, useCurrentUser as useCurrentUser3 } from "sanity";
6104
6470
 
6105
6471
  // src/lib/eval-scope.ts
@@ -6115,7 +6481,7 @@ function extractEvalScope(provenance) {
6115
6481
  }
6116
6482
 
6117
6483
  // src/components/report-detail/report-actions/RerunEvaluationAction.tsx
6118
- import { jsx as jsx34 } from "react/jsx-runtime";
6484
+ import { jsx as jsx33 } from "react/jsx-runtime";
6119
6485
  var EVAL_REQUEST_TYPE2 = "ailf.evalRequest";
6120
6486
  function slugify2(s) {
6121
6487
  return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
@@ -6154,7 +6520,7 @@ function RerunEvaluationAction({
6154
6520
  const client = useClient8({ apiVersion: API_VERSION });
6155
6521
  const currentUser = useCurrentUser3();
6156
6522
  const toast = useToast6();
6157
- const [requesting, setRequesting] = useState11(false);
6523
+ const [requesting, setRequesting] = useState12(false);
6158
6524
  const handleClick = useCallback16(async () => {
6159
6525
  setRequesting(true);
6160
6526
  try {
@@ -6182,7 +6548,7 @@ function RerunEvaluationAction({
6182
6548
  setRequesting(false);
6183
6549
  }
6184
6550
  }, [client, currentUser?.id, provenance, reportId, toast]);
6185
- return /* @__PURE__ */ jsx34(
6551
+ return /* @__PURE__ */ jsx33(
6186
6552
  MenuItem6,
6187
6553
  {
6188
6554
  disabled: requesting,
@@ -6194,7 +6560,7 @@ function RerunEvaluationAction({
6194
6560
  }
6195
6561
 
6196
6562
  // src/components/report-detail/report-actions/ReportActions.tsx
6197
- import { Fragment as Fragment8, jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
6563
+ import { Fragment as Fragment8, jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
6198
6564
  function ReportActions({
6199
6565
  documentId,
6200
6566
  onDeleted,
@@ -6221,8 +6587,8 @@ function ReportActions({
6221
6587
  }
6222
6588
  );
6223
6589
  }, [reportId, toast]);
6224
- const [deleteDialogOpen, setDeleteDialogOpen] = useState12(false);
6225
- const [deleting, setDeleting] = useState12(false);
6590
+ const [deleteDialogOpen, setDeleteDialogOpen] = useState13(false);
6591
+ const [deleting, setDeleting] = useState13(false);
6226
6592
  const handleRequestDelete = useCallback17(() => {
6227
6593
  setDeleteDialogOpen(true);
6228
6594
  }, []);
@@ -6250,9 +6616,9 @@ function ReportActions({
6250
6616
  setDeleting(false);
6251
6617
  }
6252
6618
  }, [client, documentId, onDeleted, toast]);
6253
- return /* @__PURE__ */ jsxs24(Fragment8, { children: [
6254
- /* @__PURE__ */ jsxs24(Flex18, { children: [
6255
- /* @__PURE__ */ jsx35(
6619
+ return /* @__PURE__ */ jsxs22(Fragment8, { children: [
6620
+ /* @__PURE__ */ jsxs22(Flex18, { children: [
6621
+ /* @__PURE__ */ jsx34(
6256
6622
  Button3,
6257
6623
  {
6258
6624
  icon: CopyIcon2,
@@ -6266,10 +6632,10 @@ function ReportActions({
6266
6632
  text: "Copy Report ID"
6267
6633
  }
6268
6634
  ),
6269
- /* @__PURE__ */ jsx35(
6635
+ /* @__PURE__ */ jsx34(
6270
6636
  MenuButton,
6271
6637
  {
6272
- button: /* @__PURE__ */ jsx35(
6638
+ button: /* @__PURE__ */ jsx34(
6273
6639
  Button3,
6274
6640
  {
6275
6641
  icon: ChevronDownIcon,
@@ -6282,33 +6648,33 @@ function ReportActions({
6282
6648
  }
6283
6649
  ),
6284
6650
  id: "report-actions-menu",
6285
- menu: /* @__PURE__ */ jsxs24(Menu, { children: [
6286
- /* @__PURE__ */ jsx35(CopyReportIdAction, { reportId }),
6287
- /* @__PURE__ */ jsx35(
6651
+ menu: /* @__PURE__ */ jsxs22(Menu, { children: [
6652
+ /* @__PURE__ */ jsx34(CopyReportIdAction, { reportId }),
6653
+ /* @__PURE__ */ jsx34(
6288
6654
  RerunEvaluationAction,
6289
6655
  {
6290
6656
  provenance,
6291
6657
  reportId
6292
6658
  }
6293
6659
  ),
6294
- /* @__PURE__ */ jsx35(MenuDivider, {}),
6295
- /* @__PURE__ */ jsx35(
6660
+ /* @__PURE__ */ jsx34(MenuDivider, {}),
6661
+ /* @__PURE__ */ jsx34(
6296
6662
  DownloadReportAction,
6297
6663
  {
6298
6664
  documentId,
6299
6665
  reportId
6300
6666
  }
6301
6667
  ),
6302
- /* @__PURE__ */ jsx35(CopyReportAction, { documentId }),
6303
- /* @__PURE__ */ jsx35(CopyVisionQueryAction, { reportId }),
6304
- /* @__PURE__ */ jsx35(MenuDivider, {}),
6305
- /* @__PURE__ */ jsx35(DeleteReportAction, { onRequestDelete: handleRequestDelete })
6668
+ /* @__PURE__ */ jsx34(CopyReportAction, { documentId }),
6669
+ /* @__PURE__ */ jsx34(CopyVisionQueryAction, { reportId }),
6670
+ /* @__PURE__ */ jsx34(MenuDivider, {}),
6671
+ /* @__PURE__ */ jsx34(DeleteReportAction, { onRequestDelete: handleRequestDelete })
6306
6672
  ] }),
6307
6673
  popover: { placement: "bottom-end", portal: true }
6308
6674
  }
6309
6675
  )
6310
6676
  ] }),
6311
- deleteDialogOpen && /* @__PURE__ */ jsx35(
6677
+ deleteDialogOpen && /* @__PURE__ */ jsx34(
6312
6678
  DeleteConfirmDialog,
6313
6679
  {
6314
6680
  isDeleting: deleting,
@@ -6321,7 +6687,7 @@ function ReportActions({
6321
6687
  }
6322
6688
 
6323
6689
  // src/components/report-detail/ReportHeader.tsx
6324
- import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
6690
+ import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
6325
6691
  function ReportHeader({
6326
6692
  completedAt,
6327
6693
  documentId,
@@ -6336,16 +6702,16 @@ function ReportHeader({
6336
6702
  const dateLabel = formatCardDate(completedAt);
6337
6703
  const title = tag ?? dateLabel;
6338
6704
  const hasTag = Boolean(tag);
6339
- return /* @__PURE__ */ jsxs25(Flex19, { align: "center", gap: 3, children: [
6340
- /* @__PURE__ */ jsx36(Button4, { icon: ArrowLeftIcon, mode: "bleed", onClick: onBack, text: "Back" }),
6341
- /* @__PURE__ */ jsxs25(Stack20, { flex: 1, space: 1, children: [
6342
- /* @__PURE__ */ jsx36(Text25, { size: 4, weight: "bold", children: title }),
6343
- hasTag && /* @__PURE__ */ jsx36(Text25, { muted: true, size: 2, children: dateLabel })
6705
+ return /* @__PURE__ */ jsxs23(Flex19, { align: "center", gap: 3, children: [
6706
+ /* @__PURE__ */ jsx35(Button4, { icon: ArrowLeftIcon, mode: "bleed", onClick: onBack, text: "Back" }),
6707
+ /* @__PURE__ */ jsxs23(Stack19, { flex: 1, space: 1, children: [
6708
+ /* @__PURE__ */ jsx35(Text25, { size: 4, weight: "bold", children: title }),
6709
+ hasTag && /* @__PURE__ */ jsx35(Text25, { muted: true, size: 2, children: dateLabel })
6344
6710
  ] }),
6345
- /* @__PURE__ */ jsxs25(Flex19, { align: "center", gap: 2, children: [
6346
- /* @__PURE__ */ jsx36(Badge10, { mode: "outline", tone: "default", children: sourceName }),
6347
- /* @__PURE__ */ jsx36(Badge10, { tone: "primary", children: mode }),
6348
- /* @__PURE__ */ jsx36(
6711
+ /* @__PURE__ */ jsxs23(Flex19, { align: "center", gap: 2, children: [
6712
+ /* @__PURE__ */ jsx35(Badge7, { mode: "outline", tone: "default", children: sourceName }),
6713
+ /* @__PURE__ */ jsx35(Badge7, { tone: "primary", children: mode }),
6714
+ /* @__PURE__ */ jsx35(
6349
6715
  ReportActions,
6350
6716
  {
6351
6717
  documentId,
@@ -6358,137 +6724,1286 @@ function ReportHeader({
6358
6724
  ] });
6359
6725
  }
6360
6726
 
6361
- // src/components/report-detail/ThreeLayerTable.tsx
6362
- import React5 from "react";
6363
- import { Badge as Badge11, Card as Card18, Flex as Flex20, Stack as Stack21, Text as Text26 } from "@sanity/ui";
6364
- import { jsx as jsx37, jsxs as jsxs26 } from "react/jsx-runtime";
6365
- function ThreeLayerTable({ scores }) {
6366
- const filtered = scores.filter((s) => s.actualScore != null);
6367
- if (filtered.length === 0) return null;
6368
- const hasInverted = filtered.some((s) => s.invertedRetrievalGap);
6369
- return /* @__PURE__ */ jsx37(Card18, { overflow: "auto", padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs26(Stack21, { space: 4, children: [
6370
- /* @__PURE__ */ jsxs26(Flex20, { align: "center", gap: 3, children: [
6371
- /* @__PURE__ */ jsx37(Text26, { size: 3, weight: "semibold", children: "Three-Layer Decomposition" }),
6372
- /* @__PURE__ */ jsx37(Badge11, { tone: "primary", children: "full mode" })
6373
- ] }),
6374
- /* @__PURE__ */ jsxs26(
6727
+ // src/components/report-detail/StrengthsList.tsx
6728
+ import { CheckmarkCircleIcon as CheckmarkCircleIcon2, SearchIcon as SearchIcon5, ChartUpwardIcon } from "@sanity/icons";
6729
+ import { Box as Box17, Flex as Flex21, Stack as Stack21, Text as Text27 } from "@sanity/ui";
6730
+
6731
+ // src/components/report-detail/StrengthsTable.tsx
6732
+ import {
6733
+ useCallback as useCallback18,
6734
+ useMemo as useMemo6,
6735
+ useState as useState14
6736
+ } from "react";
6737
+ import { WarningOutlineIcon as WarningOutlineIcon2 } from "@sanity/icons";
6738
+ import { Box as Box16, Flex as Flex20, Stack as Stack20, Text as Text26 } from "@sanity/ui";
6739
+ import { jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
6740
+ var GRID2 = "96px 1fr 1fr 1fr 1fr 80px 120px 80px";
6741
+ function StrengthsTable({
6742
+ scores,
6743
+ improved = [],
6744
+ regressed = [],
6745
+ unchanged = []
6746
+ }) {
6747
+ const [sortField, setSortField] = useState14("score");
6748
+ const [sortDir, setSortDir] = useState14("desc");
6749
+ const handleSort = useCallback18(
6750
+ (field) => {
6751
+ if (field === sortField) {
6752
+ setSortDir((d) => d === "asc" ? "desc" : "asc");
6753
+ } else {
6754
+ setSortField(field);
6755
+ setSortDir("desc");
6756
+ }
6757
+ },
6758
+ [sortField]
6759
+ );
6760
+ const sorted = useMemo6(() => {
6761
+ const dir = sortDir === "asc" ? 1 : -1;
6762
+ return [...scores].sort((a, b) => {
6763
+ switch (sortField) {
6764
+ case "score":
6765
+ return (a.totalScore - b.totalScore) * dir;
6766
+ case "area":
6767
+ return a.feature.localeCompare(b.feature) * dir;
6768
+ case "task":
6769
+ return (a.taskCompletion - b.taskCompletion) * dir;
6770
+ case "code":
6771
+ return (a.codeCorrectness - b.codeCorrectness) * dir;
6772
+ case "docs":
6773
+ return (a.docCoverage - b.docCoverage) * dir;
6774
+ case "lift":
6775
+ return (a.docLift - b.docLift) * dir;
6776
+ case "ceiling":
6777
+ return ((a.ceilingScore ?? 0) - (b.ceilingScore ?? 0)) * dir;
6778
+ default:
6779
+ return 0;
6780
+ }
6781
+ });
6782
+ }, [scores, sortField, sortDir]);
6783
+ return /* @__PURE__ */ jsxs24(Box16, { style: { ...neutralCardStyle, overflow: "auto" }, children: [
6784
+ /* @__PURE__ */ jsxs24(
6375
6785
  "div",
6376
6786
  {
6377
6787
  style: {
6788
+ borderBottom: "1px solid var(--card-border-color)",
6378
6789
  display: "grid",
6379
- gap: "0 8px",
6380
- gridTemplateColumns: "2fr 1fr 1fr 1fr 1fr 1fr"
6790
+ gap: "0 12px",
6791
+ gridTemplateColumns: GRID2,
6792
+ padding: "12px 16px 8px"
6381
6793
  },
6382
6794
  children: [
6383
- /* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "Area" }),
6384
- /* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "Floor", tooltip: GLOSSARY.floor }),
6385
- /* @__PURE__ */ jsx37(
6386
- ColumnHeader,
6795
+ /* @__PURE__ */ jsx36(
6796
+ ColHeader2,
6387
6797
  {
6388
- borderBottom: true,
6389
- label: "Ceiling",
6390
- tooltip: GLOSSARY.ceiling
6798
+ active: sortField === "score",
6799
+ direction: sortDir,
6800
+ label: "Score",
6801
+ onClick: () => handleSort("score"),
6802
+ tooltip: GLOSSARY.score
6391
6803
  }
6392
6804
  ),
6393
- /* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "Actual", tooltip: GLOSSARY.actual }),
6394
- /* @__PURE__ */ jsx37(
6395
- ColumnHeader,
6805
+ /* @__PURE__ */ jsx36(
6806
+ ColHeader2,
6396
6807
  {
6397
- borderBottom: true,
6398
- label: "Ret. Gap",
6399
- tooltip: GLOSSARY.retGap
6808
+ active: sortField === "area",
6809
+ direction: sortDir,
6810
+ label: "Area",
6811
+ onClick: () => handleSort("area")
6400
6812
  }
6401
6813
  ),
6402
- /* @__PURE__ */ jsx37(
6403
- ColumnHeader,
6814
+ /* @__PURE__ */ jsx36(
6815
+ ColHeader2,
6404
6816
  {
6405
- borderBottom: true,
6406
- label: "Efficiency",
6407
- tooltip: GLOSSARY.efficiency
6817
+ active: sortField === "task",
6818
+ direction: sortDir,
6819
+ label: "Task",
6820
+ onClick: () => handleSort("task"),
6821
+ tooltip: GLOSSARY.taskCompletion
6408
6822
  }
6409
6823
  ),
6410
- filtered.map((score, i) => /* @__PURE__ */ jsxs26(React5.Fragment, { children: [
6411
- /* @__PURE__ */ jsx37(
6824
+ /* @__PURE__ */ jsx36(
6825
+ ColHeader2,
6826
+ {
6827
+ active: sortField === "code",
6828
+ direction: sortDir,
6829
+ label: "Code",
6830
+ onClick: () => handleSort("code"),
6831
+ tooltip: GLOSSARY.codeCorrectness
6832
+ }
6833
+ ),
6834
+ /* @__PURE__ */ jsx36(
6835
+ ColHeader2,
6836
+ {
6837
+ active: sortField === "docs",
6838
+ direction: sortDir,
6839
+ label: "Docs",
6840
+ onClick: () => handleSort("docs"),
6841
+ tooltip: GLOSSARY.docCoverage
6842
+ }
6843
+ ),
6844
+ /* @__PURE__ */ jsx36(
6845
+ ColHeader2,
6846
+ {
6847
+ active: sortField === "lift",
6848
+ direction: sortDir,
6849
+ label: "Lift",
6850
+ onClick: () => handleSort("lift"),
6851
+ tooltip: GLOSSARY.docLift
6852
+ }
6853
+ ),
6854
+ /* @__PURE__ */ jsx36(
6855
+ ColHeader2,
6856
+ {
6857
+ active: sortField === "ceiling",
6858
+ direction: sortDir,
6859
+ label: "Floor\u2192Ceil",
6860
+ onClick: () => handleSort("ceiling")
6861
+ }
6862
+ ),
6863
+ /* @__PURE__ */ jsx36(ColHeader2, { label: "Trend" })
6864
+ ]
6865
+ }
6866
+ ),
6867
+ sorted.map((area) => /* @__PURE__ */ jsx36(
6868
+ AreaRow,
6869
+ {
6870
+ area,
6871
+ improved,
6872
+ regressed,
6873
+ unchanged
6874
+ },
6875
+ area.feature
6876
+ ))
6877
+ ] });
6878
+ }
6879
+ function AreaRow({
6880
+ area,
6881
+ improved,
6882
+ regressed,
6883
+ unchanged
6884
+ }) {
6885
+ const trend = improved.includes(area.feature) ? "improved" : regressed.includes(area.feature) ? "regressed" : unchanged.includes(area.feature) ? "unchanged" : null;
6886
+ return /* @__PURE__ */ jsxs24(
6887
+ "div",
6888
+ {
6889
+ style: {
6890
+ alignItems: "center",
6891
+ borderBottom: "1px solid var(--card-border-color)",
6892
+ display: "grid",
6893
+ gap: "0 12px",
6894
+ gridTemplateColumns: GRID2,
6895
+ padding: "10px 16px"
6896
+ },
6897
+ children: [
6898
+ /* @__PURE__ */ jsx36(
6899
+ HoverTip,
6900
+ {
6901
+ text: /* @__PURE__ */ jsxs24(Text26, { size: 2, style: { lineHeight: 1.5 }, children: [
6902
+ /* @__PURE__ */ jsx36("span", { style: { fontWeight: 600 }, children: area.feature }),
6903
+ " composite:",
6904
+ " ",
6905
+ /* @__PURE__ */ jsx36(
6906
+ "span",
6907
+ {
6908
+ style: {
6909
+ color: scoreColor(area.totalScore),
6910
+ fontFamily: "var(--font-code-size, monospace)",
6911
+ fontWeight: 600
6912
+ },
6913
+ children: Math.round(area.totalScore)
6914
+ }
6915
+ ),
6916
+ /* @__PURE__ */ jsx36("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
6917
+ ".",
6918
+ " ",
6919
+ GLOSSARY.score
6920
+ ] }),
6921
+ children: /* @__PURE__ */ jsx36(
6412
6922
  "div",
6413
6923
  {
6414
6924
  style: {
6415
- background: rowBackground(i),
6416
- borderRadius: 4,
6417
- padding: "8px 0 8px 4px"
6925
+ alignItems: "center",
6926
+ backgroundColor: scoreBg(area.totalScore),
6927
+ border: `1px solid ${scoreBorder(area.totalScore)}`,
6928
+ borderRadius: 6,
6929
+ color: scoreColor(area.totalScore),
6930
+ display: "flex",
6931
+ fontSize: 16,
6932
+ fontWeight: 700,
6933
+ height: 36,
6934
+ justifyContent: "center",
6935
+ width: 44
6418
6936
  },
6419
- children: /* @__PURE__ */ jsx37(Text26, { size: 2, weight: "medium", children: score.feature })
6937
+ children: Math.round(area.totalScore)
6420
6938
  }
6421
- ),
6422
- /* @__PURE__ */ jsx37(
6423
- "div",
6939
+ )
6940
+ }
6941
+ ),
6942
+ /* @__PURE__ */ jsxs24(Flex20, { align: "center", gap: 2, wrap: "wrap", children: [
6943
+ /* @__PURE__ */ jsx36(Text26, { size: 2, weight: "medium", children: area.feature }),
6944
+ area.negativeDocLift && /* @__PURE__ */ jsx36(HoverTip, { text: GLOSSARY.docsHurt, children: /* @__PURE__ */ jsx36(
6945
+ "span",
6946
+ {
6947
+ style: {
6948
+ alignItems: "center",
6949
+ backgroundColor: "rgba(239,68,68,0.2)",
6950
+ borderRadius: 3,
6951
+ color: "#f87171",
6952
+ display: "inline-flex",
6953
+ fontSize: 11,
6954
+ gap: 3,
6955
+ padding: "1px 5px"
6956
+ },
6957
+ children: /* @__PURE__ */ jsx36(WarningOutlineIcon2, {})
6958
+ }
6959
+ ) })
6960
+ ] }),
6961
+ /* @__PURE__ */ jsx36(
6962
+ DimCell,
6963
+ {
6964
+ area: area.feature,
6965
+ dim: "Task Completion",
6966
+ value: area.taskCompletion
6967
+ }
6968
+ ),
6969
+ /* @__PURE__ */ jsx36(
6970
+ DimCell,
6971
+ {
6972
+ area: area.feature,
6973
+ dim: "Code Correctness",
6974
+ value: area.codeCorrectness
6975
+ }
6976
+ ),
6977
+ /* @__PURE__ */ jsx36(
6978
+ DimCell,
6979
+ {
6980
+ area: area.feature,
6981
+ dim: "Doc Coverage",
6982
+ value: area.docCoverage
6983
+ }
6984
+ ),
6985
+ /* @__PURE__ */ jsx36(
6986
+ HoverTip,
6987
+ {
6988
+ text: /* @__PURE__ */ jsxs24(Text26, { size: 2, style: { lineHeight: 1.5 }, children: [
6989
+ /* @__PURE__ */ jsx36("span", { style: { fontWeight: 600 }, children: area.feature }),
6990
+ " doc lift:",
6991
+ " ",
6992
+ /* @__PURE__ */ jsxs24(
6993
+ "span",
6994
+ {
6995
+ style: {
6996
+ color: area.docLift >= 0 ? "#34d399" : "#f87171",
6997
+ fontFamily: "var(--font-code-size, monospace)",
6998
+ fontWeight: 600
6999
+ },
7000
+ children: [
7001
+ area.docLift > 0 ? "+" : "",
7002
+ area.docLift
7003
+ ]
7004
+ }
7005
+ ),
7006
+ " ",
7007
+ "pts. ",
7008
+ GLOSSARY.docLift
7009
+ ] }),
7010
+ children: /* @__PURE__ */ jsxs24(
7011
+ Text26,
6424
7012
  {
7013
+ size: 2,
6425
7014
  style: {
6426
- background: rowBackground(i),
6427
- display: "flex",
6428
- padding: "2px 0"
7015
+ color: area.docLift >= 5 ? "#34d399" : area.docLift < 0 ? "#f87171" : "var(--card-fg-color)",
7016
+ fontFamily: "var(--font-code-size, monospace)",
7017
+ fontWeight: 600
6429
7018
  },
6430
- children: /* @__PURE__ */ jsx37(ScoreCell, { score: score.floorScore ?? 0 })
7019
+ children: [
7020
+ area.docLift > 0 ? "+" : "",
7021
+ area.docLift
7022
+ ]
6431
7023
  }
6432
- ),
6433
- /* @__PURE__ */ jsx37(
7024
+ )
7025
+ }
7026
+ ),
7027
+ /* @__PURE__ */ jsxs24(
7028
+ Text26,
7029
+ {
7030
+ muted: true,
7031
+ size: 1,
7032
+ style: { fontFamily: "var(--font-code-size, monospace)" },
7033
+ children: [
7034
+ Math.round(area.floorScore ?? 0),
7035
+ " \u2192",
7036
+ " ",
7037
+ Math.round(area.ceilingScore ?? 0)
7038
+ ]
7039
+ }
7040
+ ),
7041
+ trend && /* @__PURE__ */ jsx36(
7042
+ "span",
7043
+ {
7044
+ style: {
7045
+ backgroundColor: trend === "improved" ? "rgba(16,185,129,0.2)" : trend === "regressed" ? "rgba(239,68,68,0.2)" : "var(--card-muted-bg-color)",
7046
+ borderRadius: 4,
7047
+ color: trend === "improved" ? "#34d399" : trend === "regressed" ? "#f87171" : "var(--card-muted-fg-color)",
7048
+ fontSize: 12,
7049
+ fontWeight: 500,
7050
+ padding: "3px 8px",
7051
+ whiteSpace: "nowrap"
7052
+ },
7053
+ children: trend
7054
+ }
7055
+ )
7056
+ ]
7057
+ }
7058
+ );
7059
+ }
7060
+ function DimCell({
7061
+ area,
7062
+ dim,
7063
+ value
7064
+ }) {
7065
+ const glossary = {
7066
+ "Task Completion": GLOSSARY.taskCompletion,
7067
+ "Code Correctness": GLOSSARY.codeCorrectness,
7068
+ "Doc Coverage": GLOSSARY.docCoverage
7069
+ };
7070
+ return /* @__PURE__ */ jsx36(
7071
+ HoverTip,
7072
+ {
7073
+ text: /* @__PURE__ */ jsxs24(Text26, { size: 2, style: { lineHeight: 1.5 }, children: [
7074
+ /* @__PURE__ */ jsx36("span", { style: { fontWeight: 600 }, children: area }),
7075
+ " \u2192",
7076
+ " ",
7077
+ /* @__PURE__ */ jsx36("span", { style: { fontWeight: 600 }, children: dim }),
7078
+ ":",
7079
+ " ",
7080
+ /* @__PURE__ */ jsx36(
7081
+ "span",
7082
+ {
7083
+ style: {
7084
+ color: scoreColor(value),
7085
+ fontFamily: "var(--font-code-size, monospace)",
7086
+ fontWeight: 600
7087
+ },
7088
+ children: Math.round(value)
7089
+ }
7090
+ ),
7091
+ /* @__PURE__ */ jsx36("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
7092
+ ".",
7093
+ " ",
7094
+ glossary[dim] ?? ""
7095
+ ] }),
7096
+ children: /* @__PURE__ */ jsxs24(Stack20, { space: 1, style: { width: "100%" }, children: [
7097
+ /* @__PURE__ */ jsx36(
7098
+ Text26,
7099
+ {
7100
+ size: 1,
7101
+ style: {
7102
+ color: scoreColor(value),
7103
+ fontFamily: "var(--font-code-size, monospace)",
7104
+ fontWeight: 600
7105
+ },
7106
+ children: Math.round(value)
7107
+ }
7108
+ ),
7109
+ /* @__PURE__ */ jsx36(
7110
+ "div",
7111
+ {
7112
+ style: {
7113
+ backgroundColor: "var(--card-border-color)",
7114
+ borderRadius: 999,
7115
+ height: 4,
7116
+ overflow: "hidden",
7117
+ width: "100%"
7118
+ },
7119
+ children: /* @__PURE__ */ jsx36(
6434
7120
  "div",
6435
7121
  {
6436
7122
  style: {
6437
- background: rowBackground(i),
6438
- display: "flex",
6439
- padding: "2px 0"
6440
- },
6441
- children: /* @__PURE__ */ jsx37(ScoreCell, { score: score.ceilingScore ?? score.totalScore })
7123
+ backgroundColor: barFillColor(value),
7124
+ borderRadius: 999,
7125
+ height: "100%",
7126
+ transition: "width 0.3s",
7127
+ width: `${Math.min(value, 100)}%`
7128
+ }
6442
7129
  }
6443
- ),
7130
+ )
7131
+ }
7132
+ )
7133
+ ] })
7134
+ }
7135
+ );
7136
+ }
7137
+ function ColHeader2({
7138
+ active,
7139
+ direction,
7140
+ label,
7141
+ onClick,
7142
+ tooltip
7143
+ }) {
7144
+ const handleKeyDown = useCallback18(
7145
+ (e) => {
7146
+ if (onClick && (e.key === "Enter" || e.key === " ")) {
7147
+ e.preventDefault();
7148
+ onClick();
7149
+ }
7150
+ },
7151
+ [onClick]
7152
+ );
7153
+ const arrow = active ? direction === "asc" ? " \u2191" : " \u2193" : "";
7154
+ return /* @__PURE__ */ jsxs24(Flex20, { align: "center", gap: 1, children: [
7155
+ /* @__PURE__ */ jsx36(
7156
+ "div",
7157
+ {
7158
+ onClick,
7159
+ onKeyDown: onClick ? handleKeyDown : void 0,
7160
+ role: onClick ? "button" : void 0,
7161
+ style: {
7162
+ cursor: onClick ? "pointer" : "default",
7163
+ userSelect: "none"
7164
+ },
7165
+ tabIndex: onClick ? 0 : void 0,
7166
+ children: /* @__PURE__ */ jsxs24(
7167
+ Text26,
7168
+ {
7169
+ muted: true,
7170
+ size: 1,
7171
+ style: {
7172
+ letterSpacing: "0.06em",
7173
+ textTransform: "uppercase"
7174
+ },
7175
+ weight: "semibold",
7176
+ children: [
7177
+ label,
7178
+ arrow
7179
+ ]
7180
+ }
7181
+ )
7182
+ }
7183
+ ),
7184
+ tooltip && /* @__PURE__ */ jsx36(InfoTip, { text: tooltip })
7185
+ ] });
7186
+ }
7187
+
7188
+ // src/components/report-detail/StrengthsList.tsx
7189
+ import { jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
7190
+ var EFFICIENCY_THRESHOLD = 0.85;
7191
+ function StrengthsList({ scores, comparison }) {
7192
+ const retrievalSuccesses = scores.filter(
7193
+ (s) => s.infrastructureEfficiency != null && s.infrastructureEfficiency >= EFFICIENCY_THRESHOLD && !s.invertedRetrievalGap
7194
+ ).sort(
7195
+ (a, b) => (b.infrastructureEfficiency ?? 0) - (a.infrastructureEfficiency ?? 0)
7196
+ );
7197
+ const improved = comparison?.improved ?? [];
7198
+ if (scores.length === 0) return null;
7199
+ return /* @__PURE__ */ jsxs25(Stack21, { space: 5, children: [
7200
+ /* @__PURE__ */ jsxs25(Stack21, { space: 3, children: [
7201
+ /* @__PURE__ */ jsxs25(Flex21, { align: "center", gap: 2, children: [
7202
+ /* @__PURE__ */ jsx37(CheckmarkCircleIcon2, { style: { color: "#34d399" } }),
7203
+ /* @__PURE__ */ jsx37(Text27, { size: 2, weight: "medium", children: "All Areas \u2014 Scores & Doc Lift" }),
7204
+ /* @__PURE__ */ jsx37(InfoTip, { text: GLOSSARY.strengths })
7205
+ ] }),
7206
+ /* @__PURE__ */ jsx37(
7207
+ StrengthsTable,
7208
+ {
7209
+ improved: comparison?.improved ?? [],
7210
+ regressed: comparison?.regressed ?? [],
7211
+ scores,
7212
+ unchanged: comparison?.unchanged ?? []
7213
+ }
7214
+ )
7215
+ ] }),
7216
+ retrievalSuccesses.length > 0 && /* @__PURE__ */ jsxs25(Box17, { style: neutralCardStyle, children: [
7217
+ /* @__PURE__ */ jsx37(
7218
+ Box17,
7219
+ {
7220
+ padding: 4,
7221
+ style: { borderBottom: "1px solid var(--card-border-color)" },
7222
+ children: /* @__PURE__ */ jsxs25(Flex21, { align: "center", gap: 2, children: [
7223
+ /* @__PURE__ */ jsx37(SearchIcon5, { style: { color: "#34d399" } }),
7224
+ /* @__PURE__ */ jsxs25(Text27, { size: 2, weight: "medium", children: [
7225
+ "Retrieval Successes (",
7226
+ Math.round(EFFICIENCY_THRESHOLD * 100),
7227
+ "%+ efficiency)"
7228
+ ] }),
7229
+ /* @__PURE__ */ jsx37(InfoTip, { text: GLOSSARY.retrievalExcellence })
7230
+ ] })
7231
+ }
7232
+ ),
7233
+ /* @__PURE__ */ jsx37(Stack21, { children: retrievalSuccesses.map((area, i) => /* @__PURE__ */ jsxs25(
7234
+ Flex21,
7235
+ {
7236
+ align: "center",
7237
+ justify: "space-between",
7238
+ padding: 4,
7239
+ style: i > 0 ? dividerStyle : void 0,
7240
+ children: [
7241
+ /* @__PURE__ */ jsx37(Text27, { size: 2, children: area.feature }),
6444
7242
  /* @__PURE__ */ jsx37(
6445
- "div",
7243
+ "span",
6446
7244
  {
6447
7245
  style: {
6448
- background: rowBackground(i),
6449
- display: "flex",
6450
- padding: "2px 0"
7246
+ color: efficiencyColor(
7247
+ area.infrastructureEfficiency ?? null
7248
+ ),
7249
+ fontFamily: "var(--font-code-size, monospace)",
7250
+ fontSize: 16,
7251
+ fontWeight: 600
6451
7252
  },
6452
- children: /* @__PURE__ */ jsx37(ScoreCell, { score: score.actualScore ?? 0 })
7253
+ children: formatPercent(area.infrastructureEfficiency)
6453
7254
  }
6454
- ),
6455
- /* @__PURE__ */ jsx37(
6456
- "div",
7255
+ )
7256
+ ]
7257
+ },
7258
+ area.feature
7259
+ )) })
7260
+ ] }),
7261
+ improved.length > 0 && /* @__PURE__ */ jsxs25(Box17, { style: neutralCardStyle, children: [
7262
+ /* @__PURE__ */ jsx37(
7263
+ Box17,
7264
+ {
7265
+ padding: 4,
7266
+ style: { borderBottom: "1px solid var(--card-border-color)" },
7267
+ children: /* @__PURE__ */ jsxs25(Flex21, { align: "center", gap: 2, children: [
7268
+ /* @__PURE__ */ jsx37(ChartUpwardIcon, { style: { color: "#34d399" } }),
7269
+ /* @__PURE__ */ jsx37(Text27, { size: 2, weight: "medium", children: "Improved Since Last Run" })
7270
+ ] })
7271
+ }
7272
+ ),
7273
+ /* @__PURE__ */ jsx37(Stack21, { children: improved.map((featureName, i) => {
7274
+ const area = scores.find((s) => s.feature === featureName);
7275
+ return /* @__PURE__ */ jsxs25(
7276
+ Flex21,
7277
+ {
7278
+ align: "center",
7279
+ justify: "space-between",
7280
+ padding: 4,
7281
+ style: i > 0 ? dividerStyle : void 0,
7282
+ children: [
7283
+ /* @__PURE__ */ jsx37(Text27, { size: 2, children: featureName }),
7284
+ area && /* @__PURE__ */ jsx37(
7285
+ "span",
7286
+ {
7287
+ style: {
7288
+ backgroundColor: scoreBg(area.totalScore),
7289
+ borderRadius: 4,
7290
+ color: scoreColor(area.totalScore),
7291
+ fontFamily: "var(--font-code-size, monospace)",
7292
+ fontSize: 14,
7293
+ fontWeight: 500,
7294
+ padding: "3px 10px"
7295
+ },
7296
+ children: Math.round(area.totalScore)
7297
+ }
7298
+ )
7299
+ ]
7300
+ },
7301
+ featureName
7302
+ );
7303
+ }) })
7304
+ ] })
7305
+ ] });
7306
+ }
7307
+
7308
+ // src/components/report-detail/WeaknessesList.tsx
7309
+ import {
7310
+ ErrorOutlineIcon as ErrorOutlineIcon3,
7311
+ SearchIcon as SearchIcon6,
7312
+ WarningOutlineIcon as WarningOutlineIcon4,
7313
+ BoltIcon as BoltIcon2,
7314
+ ArrowDownIcon as ArrowDownIcon2
7315
+ } from "@sanity/icons";
7316
+ import { Box as Box19, Flex as Flex23, Stack as Stack23, Text as Text29 } from "@sanity/ui";
7317
+
7318
+ // src/components/report-detail/AreaScoreRow.tsx
7319
+ import { WarningOutlineIcon as WarningOutlineIcon3 } from "@sanity/icons";
7320
+ import { Box as Box18, Flex as Flex22, Stack as Stack22, Text as Text28 } from "@sanity/ui";
7321
+ import { jsx as jsx38, jsxs as jsxs26 } from "react/jsx-runtime";
7322
+ function AreaScoreRow({ area, showTrend }) {
7323
+ return /* @__PURE__ */ jsx38(Box18, { style: { ...neutralCardStyle, padding: 20 }, children: /* @__PURE__ */ jsxs26(Stack22, { space: 4, children: [
7324
+ /* @__PURE__ */ jsxs26(Flex22, { align: "flex-start", gap: 3, justify: "space-between", wrap: "wrap", children: [
7325
+ /* @__PURE__ */ jsxs26(Flex22, { align: "center", gap: 3, children: [
7326
+ /* @__PURE__ */ jsx38(
7327
+ HoverTip,
7328
+ {
7329
+ text: /* @__PURE__ */ jsxs26(Text28, { size: 2, style: { lineHeight: 1.5 }, children: [
7330
+ /* @__PURE__ */ jsx38("span", { style: tipBold, children: area.feature }),
7331
+ " composite score:",
7332
+ " ",
7333
+ /* @__PURE__ */ jsx38(
7334
+ "span",
7335
+ {
7336
+ style: { ...tipValue, color: scoreColor(area.totalScore) },
7337
+ children: Math.round(area.totalScore)
7338
+ }
7339
+ ),
7340
+ /* @__PURE__ */ jsx38("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
7341
+ ". ",
7342
+ GLOSSARY.score
7343
+ ] }),
7344
+ children: /* @__PURE__ */ jsx38(Box18, { style: scoreBoxStyle(area.totalScore), children: /* @__PURE__ */ jsx38("span", { style: { fontSize: 20 }, children: Math.round(area.totalScore) }) })
7345
+ }
7346
+ ),
7347
+ /* @__PURE__ */ jsxs26(Stack22, { space: 2, children: [
7348
+ /* @__PURE__ */ jsxs26(Flex22, { align: "center", gap: 2, wrap: "wrap", children: [
7349
+ /* @__PURE__ */ jsx38(Text28, { size: 3, weight: "semibold", children: area.feature }),
7350
+ area.negativeDocLift && /* @__PURE__ */ jsx38(HoverTip, { text: GLOSSARY.docsHurt, children: /* @__PURE__ */ jsxs26(
7351
+ "span",
6457
7352
  {
6458
7353
  style: {
6459
7354
  alignItems: "center",
6460
- background: rowBackground(i),
6461
- display: "flex",
6462
- padding: "6px 0"
7355
+ backgroundColor: "rgba(239,68,68,0.2)",
7356
+ borderRadius: 4,
7357
+ color: "#f87171",
7358
+ display: "inline-flex",
7359
+ fontSize: 13,
7360
+ gap: 4,
7361
+ padding: "3px 8px"
6463
7362
  },
6464
- children: /* @__PURE__ */ jsx37(Text26, { size: 2, children: score.retrievalGap != null ? score.retrievalGap.toFixed(1) : "\u2014" })
7363
+ children: [
7364
+ /* @__PURE__ */ jsx38(WarningOutlineIcon3, {}),
7365
+ "Docs Hurt"
7366
+ ]
6465
7367
  }
6466
- ),
6467
- /* @__PURE__ */ jsx37(
6468
- "div",
7368
+ ) }),
7369
+ area.invertedRetrievalGap && /* @__PURE__ */ jsx38(HoverTip, { text: GLOSSARY.invertedRetGap, children: /* @__PURE__ */ jsx38(
7370
+ "span",
6469
7371
  {
6470
7372
  style: {
6471
- alignItems: "center",
6472
- background: rowBackground(i),
6473
- display: "flex",
6474
- padding: "6px 0"
7373
+ backgroundColor: "rgba(245,158,11,0.2)",
7374
+ borderRadius: 4,
7375
+ color: "#fbbf24",
7376
+ fontSize: 13,
7377
+ padding: "3px 8px"
6475
7378
  },
6476
- children: /* @__PURE__ */ jsxs26(Text26, { size: 2, children: [
6477
- formatPercent(score.infrastructureEfficiency),
6478
- score.invertedRetrievalGap && " \u26A0\uFE0F"
6479
- ] })
7379
+ children: "Inverted Retrieval"
6480
7380
  }
6481
- )
6482
- ] }, score.feature))
7381
+ ) })
7382
+ ] }),
7383
+ /* @__PURE__ */ jsxs26(Text28, { muted: true, size: 2, children: [
7384
+ area.testCount,
7385
+ " test",
7386
+ area.testCount === 1 ? "" : "s"
7387
+ ] })
7388
+ ] })
7389
+ ] }),
7390
+ showTrend && /* @__PURE__ */ jsx38(
7391
+ "span",
7392
+ {
7393
+ style: {
7394
+ backgroundColor: showTrend === "improved" ? "rgba(16,185,129,0.2)" : showTrend === "regressed" ? "rgba(239,68,68,0.2)" : "var(--card-muted-bg-color)",
7395
+ borderRadius: 4,
7396
+ color: showTrend === "improved" ? "#34d399" : showTrend === "regressed" ? "#f87171" : "var(--card-muted-fg-color)",
7397
+ fontSize: 13,
7398
+ fontWeight: 500,
7399
+ padding: "4px 10px"
7400
+ },
7401
+ children: showTrend
7402
+ }
7403
+ )
7404
+ ] }),
7405
+ /* @__PURE__ */ jsxs26(
7406
+ "div",
7407
+ {
7408
+ style: {
7409
+ display: "grid",
7410
+ gap: 16,
7411
+ gridTemplateColumns: "1fr 1fr 1fr"
7412
+ },
7413
+ children: [
7414
+ /* @__PURE__ */ jsx38(
7415
+ DimBar,
7416
+ {
7417
+ label: "Task Completion",
7418
+ tip: dimBarTip(
7419
+ area.feature,
7420
+ "Task Completion",
7421
+ area.taskCompletion,
7422
+ GLOSSARY.taskCompletion
7423
+ ),
7424
+ value: area.taskCompletion
7425
+ }
7426
+ ),
7427
+ /* @__PURE__ */ jsx38(
7428
+ DimBar,
7429
+ {
7430
+ label: "Code Correctness",
7431
+ tip: dimBarTip(
7432
+ area.feature,
7433
+ "Code Correctness",
7434
+ area.codeCorrectness,
7435
+ GLOSSARY.codeCorrectness
7436
+ ),
7437
+ value: area.codeCorrectness
7438
+ }
7439
+ ),
7440
+ /* @__PURE__ */ jsx38(
7441
+ DimBar,
7442
+ {
7443
+ label: "Doc Coverage",
7444
+ tip: dimBarTip(
7445
+ area.feature,
7446
+ "Doc Coverage",
7447
+ area.docCoverage,
7448
+ GLOSSARY.docCoverage
7449
+ ),
7450
+ value: area.docCoverage
7451
+ }
7452
+ )
6483
7453
  ]
6484
7454
  }
6485
7455
  ),
6486
- hasInverted && /* @__PURE__ */ jsx37(Text26, { muted: true, size: 1, children: GLOSSARY.invertedRetGap })
7456
+ /* @__PURE__ */ jsxs26(Flex22, { gap: 5, style: { ...dividerStyle, paddingTop: 12 }, wrap: "wrap", children: [
7457
+ /* @__PURE__ */ jsx38(
7458
+ MetricPair,
7459
+ {
7460
+ color: area.negativeDocLift ? "#f87171" : "#34d399",
7461
+ label: "Doc Lift",
7462
+ tip: metricTip(
7463
+ area.feature,
7464
+ "Doc Lift",
7465
+ `${area.docLift > 0 ? "+" : ""}${area.docLift}`,
7466
+ GLOSSARY.docLift
7467
+ ),
7468
+ value: `${area.docLift > 0 ? "+" : ""}${area.docLift}`
7469
+ }
7470
+ ),
7471
+ /* @__PURE__ */ jsx38(
7472
+ MetricPair,
7473
+ {
7474
+ label: "Ceiling",
7475
+ tip: metricTip(
7476
+ area.feature,
7477
+ "Ceiling",
7478
+ String(Math.round(area.ceilingScore ?? 0)),
7479
+ GLOSSARY.ceiling
7480
+ ),
7481
+ value: String(Math.round(area.ceilingScore ?? 0))
7482
+ }
7483
+ ),
7484
+ /* @__PURE__ */ jsx38(
7485
+ MetricPair,
7486
+ {
7487
+ label: "Floor",
7488
+ tip: metricTip(
7489
+ area.feature,
7490
+ "Floor",
7491
+ String(Math.round(area.floorScore ?? 0)),
7492
+ GLOSSARY.floor
7493
+ ),
7494
+ value: String(Math.round(area.floorScore ?? 0))
7495
+ }
7496
+ ),
7497
+ area.actualScore != null && /* @__PURE__ */ jsx38(
7498
+ MetricPair,
7499
+ {
7500
+ label: "Actual",
7501
+ tip: metricTip(
7502
+ area.feature,
7503
+ "Actual",
7504
+ String(Math.round(area.actualScore)),
7505
+ GLOSSARY.actualScore
7506
+ ),
7507
+ value: String(Math.round(area.actualScore))
7508
+ }
7509
+ ),
7510
+ area.infrastructureEfficiency != null && /* @__PURE__ */ jsx38(
7511
+ MetricPair,
7512
+ {
7513
+ color: efficiencyColor(area.infrastructureEfficiency),
7514
+ label: "Efficiency",
7515
+ tip: metricTip(
7516
+ area.feature,
7517
+ "Efficiency",
7518
+ formatPercent(area.infrastructureEfficiency),
7519
+ GLOSSARY.infraEfficiency
7520
+ ),
7521
+ value: formatPercent(area.infrastructureEfficiency)
7522
+ }
7523
+ ),
7524
+ area.retrievalGap != null && /* @__PURE__ */ jsx38(
7525
+ MetricPair,
7526
+ {
7527
+ label: "Ret Gap",
7528
+ tip: metricTip(
7529
+ area.feature,
7530
+ "Retrieval Gap",
7531
+ String(area.retrievalGap),
7532
+ GLOSSARY.retrievalGap
7533
+ ),
7534
+ value: String(area.retrievalGap)
7535
+ }
7536
+ )
7537
+ ] })
6487
7538
  ] }) });
6488
7539
  }
7540
+ var tipValue = {
7541
+ fontFamily: "var(--font-code-size, monospace)",
7542
+ fontWeight: 600
7543
+ };
7544
+ var tipBold = { fontWeight: 600 };
7545
+ function dimBarTip(area, dim, score, description) {
7546
+ return /* @__PURE__ */ jsxs26(Text28, { size: 2, style: { lineHeight: 1.5 }, children: [
7547
+ /* @__PURE__ */ jsx38("span", { style: tipBold, children: area }),
7548
+ " \u2192 ",
7549
+ /* @__PURE__ */ jsx38("span", { style: tipBold, children: dim }),
7550
+ ":",
7551
+ " ",
7552
+ /* @__PURE__ */ jsx38("span", { style: { ...tipValue, color: scoreColor(score) }, children: Math.round(score) }),
7553
+ /* @__PURE__ */ jsx38("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
7554
+ ".",
7555
+ " ",
7556
+ description
7557
+ ] });
7558
+ }
7559
+ function DimBar({
7560
+ label,
7561
+ value,
7562
+ tip
7563
+ }) {
7564
+ const bar = /* @__PURE__ */ jsxs26(Stack22, { space: 2, style: { flex: 1 }, children: [
7565
+ /* @__PURE__ */ jsxs26(Flex22, { align: "center", justify: "space-between", children: [
7566
+ /* @__PURE__ */ jsx38(Text28, { muted: true, size: 1, children: label }),
7567
+ /* @__PURE__ */ jsx38(
7568
+ "span",
7569
+ {
7570
+ style: {
7571
+ color: scoreColor(value),
7572
+ fontFamily: "var(--font-code-size, monospace)",
7573
+ fontSize: 14,
7574
+ fontWeight: 600
7575
+ },
7576
+ children: Math.round(value)
7577
+ }
7578
+ )
7579
+ ] }),
7580
+ /* @__PURE__ */ jsx38(
7581
+ Box18,
7582
+ {
7583
+ style: {
7584
+ backgroundColor: "var(--card-border-color)",
7585
+ borderRadius: 999,
7586
+ height: 6,
7587
+ overflow: "hidden"
7588
+ },
7589
+ children: /* @__PURE__ */ jsx38(
7590
+ Box18,
7591
+ {
7592
+ style: {
7593
+ backgroundColor: barFillColor(value),
7594
+ borderRadius: 999,
7595
+ height: "100%",
7596
+ transition: "width 0.3s",
7597
+ width: `${Math.min(value, 100)}%`
7598
+ }
7599
+ }
7600
+ )
7601
+ }
7602
+ )
7603
+ ] });
7604
+ if (tip) {
7605
+ return /* @__PURE__ */ jsx38(HoverTip, { text: tip, children: bar });
7606
+ }
7607
+ return bar;
7608
+ }
7609
+ function metricTip(area, metric, displayValue, description) {
7610
+ return /* @__PURE__ */ jsxs26(Text28, { size: 2, style: { lineHeight: 1.5 }, children: [
7611
+ /* @__PURE__ */ jsx38("span", { style: tipBold, children: area }),
7612
+ " \u2192",
7613
+ " ",
7614
+ /* @__PURE__ */ jsx38("span", { style: tipBold, children: metric }),
7615
+ ":",
7616
+ " ",
7617
+ /* @__PURE__ */ jsx38("span", { style: tipValue, children: displayValue }),
7618
+ ". ",
7619
+ description
7620
+ ] });
7621
+ }
7622
+ function MetricPair({
7623
+ color,
7624
+ label,
7625
+ value,
7626
+ tip
7627
+ }) {
7628
+ const content = /* @__PURE__ */ jsxs26(Text28, { muted: true, size: 1, children: [
7629
+ label,
7630
+ ":",
7631
+ " ",
7632
+ /* @__PURE__ */ jsx38(
7633
+ "span",
7634
+ {
7635
+ style: {
7636
+ color: color ?? "var(--card-fg-color)",
7637
+ fontFamily: "var(--font-code-size, monospace)",
7638
+ fontWeight: 500
7639
+ },
7640
+ children: value
7641
+ }
7642
+ )
7643
+ ] });
7644
+ if (tip) {
7645
+ return /* @__PURE__ */ jsx38(HoverTip, { text: tip, children: content });
7646
+ }
7647
+ return content;
7648
+ }
7649
+
7650
+ // src/components/report-detail/WeaknessesList.tsx
7651
+ import { jsx as jsx39, jsxs as jsxs27 } from "react/jsx-runtime";
7652
+ function WeaknessesList({ scores, comparison }) {
7653
+ const weakAreas = scores.filter((s) => s.totalScore < 70).sort((a, b) => a.totalScore - b.totalScore);
7654
+ const docsHurt = scores.filter((s) => s.negativeDocLift);
7655
+ const retrievalIssues = scores.filter(
7656
+ (s) => s.infrastructureEfficiency != null && s.infrastructureEfficiency < 0.7 && !s.invertedRetrievalGap
7657
+ );
7658
+ const dimWeaknesses = scores.map((s) => ({ area: s, dims: getDimensionWeaknesses(s) })).filter(({ dims }) => dims.length > 0);
7659
+ const regressed = comparison?.regressed ?? [];
7660
+ const improved = comparison?.improved ?? [];
7661
+ const unchanged = comparison?.unchanged ?? [];
7662
+ const efficiencyAnomalies = scores.filter(
7663
+ (s) => s.infrastructureEfficiency != null && s.infrastructureEfficiency > 1.05
7664
+ );
7665
+ const hasContent = weakAreas.length > 0 || docsHurt.length > 0 || retrievalIssues.length > 0 || dimWeaknesses.length > 0 || regressed.length > 0 || efficiencyAnomalies.length > 0;
7666
+ if (!hasContent) return null;
7667
+ const trendFor = (feature) => {
7668
+ if (improved.includes(feature)) return "improved";
7669
+ if (regressed.includes(feature)) return "regressed";
7670
+ if (unchanged.includes(feature)) return "unchanged";
7671
+ return null;
7672
+ };
7673
+ return /* @__PURE__ */ jsxs27(Stack23, { space: 5, children: [
7674
+ weakAreas.length > 0 && /* @__PURE__ */ jsxs27(Stack23, { space: 3, children: [
7675
+ /* @__PURE__ */ jsxs27(Flex23, { align: "center", gap: 2, children: [
7676
+ /* @__PURE__ */ jsx39(ErrorOutlineIcon3, { style: { color: "#f87171" } }),
7677
+ /* @__PURE__ */ jsx39(Text29, { size: 2, weight: "medium", children: "Weak Areas (<70)" }),
7678
+ /* @__PURE__ */ jsx39(InfoTip, { text: GLOSSARY.weakAreas })
7679
+ ] }),
7680
+ /* @__PURE__ */ jsx39(Stack23, { space: 3, children: weakAreas.map((area) => /* @__PURE__ */ jsx39(
7681
+ AreaScoreRow,
7682
+ {
7683
+ area,
7684
+ showTrend: trendFor(area.feature)
7685
+ },
7686
+ area.feature
7687
+ )) })
7688
+ ] }),
7689
+ docsHurt.length > 0 && /* @__PURE__ */ jsxs27(Stack23, { space: 3, children: [
7690
+ /* @__PURE__ */ jsxs27(Flex23, { align: "center", gap: 2, children: [
7691
+ /* @__PURE__ */ jsx39(ErrorOutlineIcon3, { style: { color: "#f87171" } }),
7692
+ /* @__PURE__ */ jsx39(Text29, { size: 2, weight: "medium", children: "Docs Hurt Performance (Negative Doc Lift)" }),
7693
+ /* @__PURE__ */ jsx39(InfoTip, { text: GLOSSARY.docsHurt })
7694
+ ] }),
7695
+ /* @__PURE__ */ jsx39(Box19, { style: sectionStyle("red"), children: docsHurt.map((area, i) => /* @__PURE__ */ jsxs27(
7696
+ Box19,
7697
+ {
7698
+ padding: 4,
7699
+ style: i > 0 ? { borderTop: "1px solid rgba(239,68,68,0.2)" } : void 0,
7700
+ children: [
7701
+ /* @__PURE__ */ jsxs27(Flex23, { align: "center", justify: "space-between", wrap: "wrap", children: [
7702
+ /* @__PURE__ */ jsxs27(Flex23, { align: "center", gap: 2, children: [
7703
+ /* @__PURE__ */ jsx39(Text29, { size: 2, weight: "medium", children: area.feature }),
7704
+ /* @__PURE__ */ jsx39(
7705
+ "span",
7706
+ {
7707
+ style: {
7708
+ backgroundColor: scoreBg(area.totalScore),
7709
+ borderRadius: 4,
7710
+ color: scoreColor(area.totalScore),
7711
+ fontSize: 13,
7712
+ fontWeight: 500,
7713
+ padding: "3px 8px"
7714
+ },
7715
+ children: Math.round(area.totalScore)
7716
+ }
7717
+ )
7718
+ ] }),
7719
+ /* @__PURE__ */ jsx39(
7720
+ "span",
7721
+ {
7722
+ style: {
7723
+ color: "#f87171",
7724
+ fontFamily: "var(--font-code-size, monospace)",
7725
+ fontSize: 16,
7726
+ fontWeight: 600
7727
+ },
7728
+ children: area.docLift
7729
+ }
7730
+ )
7731
+ ] }),
7732
+ /* @__PURE__ */ jsx39(Box19, { paddingTop: 2, children: /* @__PURE__ */ jsxs27(Text29, { muted: true, size: 2, children: [
7733
+ area.invertedRetrievalGap && /* @__PURE__ */ jsxs27("span", { style: { color: "#fbbf24" }, children: [
7734
+ "Agent does better by NOT finding these docs.",
7735
+ " "
7736
+ ] }),
7737
+ "Floor (",
7738
+ Math.round(area.floorScore ?? 0),
7739
+ ") is higher than ceiling (",
7740
+ Math.round(area.ceilingScore ?? 0),
7741
+ ")."
7742
+ ] }) })
7743
+ ]
7744
+ },
7745
+ area.feature
7746
+ )) })
7747
+ ] }),
7748
+ retrievalIssues.length > 0 && /* @__PURE__ */ jsxs27(Stack23, { space: 3, children: [
7749
+ /* @__PURE__ */ jsxs27(Flex23, { align: "center", gap: 2, children: [
7750
+ /* @__PURE__ */ jsx39(SearchIcon6, { style: { color: "#fbbf24" } }),
7751
+ /* @__PURE__ */ jsx39(Text29, { size: 2, weight: "medium", children: "Retrieval Issues (<70% efficiency)" }),
7752
+ /* @__PURE__ */ jsx39(InfoTip, { text: GLOSSARY.retrievalIssues })
7753
+ ] }),
7754
+ /* @__PURE__ */ jsx39(Box19, { style: sectionStyle("amber"), children: retrievalIssues.map((area, i) => /* @__PURE__ */ jsxs27(
7755
+ Box19,
7756
+ {
7757
+ padding: 4,
7758
+ style: i > 0 ? { borderTop: "1px solid rgba(245,158,11,0.2)" } : void 0,
7759
+ children: [
7760
+ /* @__PURE__ */ jsxs27(Flex23, { align: "center", justify: "space-between", wrap: "wrap", children: [
7761
+ /* @__PURE__ */ jsxs27(Flex23, { align: "center", gap: 2, children: [
7762
+ /* @__PURE__ */ jsx39(Text29, { size: 2, weight: "medium", children: area.feature }),
7763
+ /* @__PURE__ */ jsx39(
7764
+ "span",
7765
+ {
7766
+ style: {
7767
+ backgroundColor: scoreBg(area.totalScore),
7768
+ borderRadius: 4,
7769
+ color: scoreColor(area.totalScore),
7770
+ fontSize: 13,
7771
+ fontWeight: 500,
7772
+ padding: "3px 8px"
7773
+ },
7774
+ children: Math.round(area.totalScore)
7775
+ }
7776
+ )
7777
+ ] }),
7778
+ /* @__PURE__ */ jsx39(
7779
+ "span",
7780
+ {
7781
+ style: {
7782
+ color: "#fbbf24",
7783
+ fontFamily: "var(--font-code-size, monospace)",
7784
+ fontSize: 16,
7785
+ fontWeight: 600
7786
+ },
7787
+ children: formatPercent(area.infrastructureEfficiency)
7788
+ }
7789
+ )
7790
+ ] }),
7791
+ /* @__PURE__ */ jsx39(Box19, { paddingTop: 2, children: /* @__PURE__ */ jsxs27(Text29, { muted: true, size: 2, children: [
7792
+ "Actual score (",
7793
+ Math.round(area.actualScore ?? 0),
7794
+ ") is much lower than ceiling (",
7795
+ Math.round(area.ceilingScore ?? 0),
7796
+ "). Agent struggles to find the right docs (retrieval gap:",
7797
+ " ",
7798
+ area.retrievalGap,
7799
+ ")."
7800
+ ] }) })
7801
+ ]
7802
+ },
7803
+ area.feature
7804
+ )) })
7805
+ ] }),
7806
+ dimWeaknesses.length > 0 && /* @__PURE__ */ jsxs27(Stack23, { space: 3, children: [
7807
+ /* @__PURE__ */ jsxs27(Flex23, { align: "center", gap: 2, children: [
7808
+ /* @__PURE__ */ jsx39(WarningOutlineIcon4, { style: { color: "#fbbf24" } }),
7809
+ /* @__PURE__ */ jsx39(Text29, { size: 2, weight: "medium", children: "Dimension Weaknesses (<50)" }),
7810
+ /* @__PURE__ */ jsx39(InfoTip, { text: GLOSSARY.dimWeaknesses })
7811
+ ] }),
7812
+ /* @__PURE__ */ jsx39(Box19, { style: neutralCardStyle, children: dimWeaknesses.map(({ area, dims }, i) => /* @__PURE__ */ jsxs27(
7813
+ Box19,
7814
+ {
7815
+ padding: 4,
7816
+ style: i > 0 ? dividerStyle : void 0,
7817
+ children: [
7818
+ /* @__PURE__ */ jsxs27(Flex23, { align: "center", gap: 2, paddingBottom: 2, children: [
7819
+ /* @__PURE__ */ jsx39(Text29, { size: 2, weight: "medium", children: area.feature }),
7820
+ /* @__PURE__ */ jsx39(
7821
+ "span",
7822
+ {
7823
+ style: {
7824
+ backgroundColor: scoreBg(area.totalScore),
7825
+ borderRadius: 4,
7826
+ color: scoreColor(area.totalScore),
7827
+ fontSize: 13,
7828
+ fontWeight: 500,
7829
+ padding: "3px 8px"
7830
+ },
7831
+ children: Math.round(area.totalScore)
7832
+ }
7833
+ )
7834
+ ] }),
7835
+ /* @__PURE__ */ jsx39(Flex23, { gap: 2, wrap: "wrap", children: dims.map((w) => /* @__PURE__ */ jsx39(HoverTip, { text: w.tip, children: /* @__PURE__ */ jsxs27(
7836
+ "span",
7837
+ {
7838
+ style: {
7839
+ backgroundColor: "rgba(239,68,68,0.2)",
7840
+ borderRadius: 4,
7841
+ color: "#f87171",
7842
+ fontSize: 13,
7843
+ padding: "4px 10px"
7844
+ },
7845
+ children: [
7846
+ w.dimension,
7847
+ ": ",
7848
+ w.value
7849
+ ]
7850
+ }
7851
+ ) }, w.dimension)) })
7852
+ ]
7853
+ },
7854
+ area.feature
7855
+ )) })
7856
+ ] }),
7857
+ regressed.length > 0 && /* @__PURE__ */ jsxs27(Box19, { style: neutralCardStyle, children: [
7858
+ /* @__PURE__ */ jsx39(
7859
+ Box19,
7860
+ {
7861
+ padding: 4,
7862
+ style: { borderBottom: "1px solid var(--card-border-color)" },
7863
+ children: /* @__PURE__ */ jsxs27(Flex23, { align: "center", gap: 2, children: [
7864
+ /* @__PURE__ */ jsx39(ArrowDownIcon2, { style: { color: "#f87171" } }),
7865
+ /* @__PURE__ */ jsx39(Text29, { size: 2, weight: "medium", children: "Regressed Since Last Run" })
7866
+ ] })
7867
+ }
7868
+ ),
7869
+ /* @__PURE__ */ jsx39(Stack23, { children: regressed.map((featureName, i) => {
7870
+ const area = scores.find((s) => s.feature === featureName);
7871
+ return /* @__PURE__ */ jsxs27(
7872
+ Flex23,
7873
+ {
7874
+ align: "center",
7875
+ justify: "space-between",
7876
+ padding: 4,
7877
+ style: i > 0 ? dividerStyle : void 0,
7878
+ children: [
7879
+ /* @__PURE__ */ jsx39(Text29, { size: 2, children: featureName }),
7880
+ area && /* @__PURE__ */ jsx39(
7881
+ "span",
7882
+ {
7883
+ style: {
7884
+ backgroundColor: scoreBg(area.totalScore),
7885
+ borderRadius: 4,
7886
+ color: scoreColor(area.totalScore),
7887
+ fontFamily: "var(--font-code-size, monospace)",
7888
+ fontSize: 14,
7889
+ fontWeight: 500,
7890
+ padding: "3px 10px"
7891
+ },
7892
+ children: Math.round(area.totalScore)
7893
+ }
7894
+ )
7895
+ ]
7896
+ },
7897
+ featureName
7898
+ );
7899
+ }) })
7900
+ ] }),
7901
+ efficiencyAnomalies.length > 0 && /* @__PURE__ */ jsxs27(Box19, { style: neutralCardStyle, children: [
7902
+ /* @__PURE__ */ jsx39(
7903
+ Box19,
7904
+ {
7905
+ padding: 4,
7906
+ style: { borderBottom: "1px solid var(--card-border-color)" },
7907
+ children: /* @__PURE__ */ jsxs27(Stack23, { space: 2, children: [
7908
+ /* @__PURE__ */ jsxs27(Flex23, { align: "center", gap: 2, children: [
7909
+ /* @__PURE__ */ jsx39(BoltIcon2, { style: { color: "#fbbf24" } }),
7910
+ /* @__PURE__ */ jsx39(Text29, { size: 2, weight: "medium", children: "Efficiency Anomalies (>100%)" }),
7911
+ /* @__PURE__ */ jsx39(InfoTip, { text: GLOSSARY.efficiencyAnomalies })
7912
+ ] }),
7913
+ /* @__PURE__ */ jsx39(Text29, { muted: true, size: 2, children: "Agent outperforms injected docs \u2014 may indicate doc quality issues or agent memorization." })
7914
+ ] })
7915
+ }
7916
+ ),
7917
+ /* @__PURE__ */ jsx39(Stack23, { children: efficiencyAnomalies.map((area, i) => /* @__PURE__ */ jsxs27(
7918
+ Flex23,
7919
+ {
7920
+ align: "center",
7921
+ justify: "space-between",
7922
+ padding: 4,
7923
+ style: i > 0 ? dividerStyle : void 0,
7924
+ children: [
7925
+ /* @__PURE__ */ jsx39(Text29, { size: 2, children: area.feature }),
7926
+ /* @__PURE__ */ jsx39(
7927
+ "span",
7928
+ {
7929
+ style: {
7930
+ color: "#fbbf24",
7931
+ fontFamily: "var(--font-code-size, monospace)",
7932
+ fontSize: 16,
7933
+ fontWeight: 600
7934
+ },
7935
+ children: formatPercent(area.infrastructureEfficiency)
7936
+ }
7937
+ )
7938
+ ]
7939
+ },
7940
+ area.feature
7941
+ )) })
7942
+ ] })
7943
+ ] });
7944
+ }
7945
+ var tipValue2 = {
7946
+ color: "#f87171",
7947
+ fontFamily: "var(--font-code-size, monospace)",
7948
+ fontWeight: 600
7949
+ };
7950
+ var tipArea = {
7951
+ fontWeight: 600
7952
+ };
7953
+ function dimTip(area, dim, score, description) {
7954
+ return /* @__PURE__ */ jsxs27(Text29, { size: 2, style: { lineHeight: 1.5 }, children: [
7955
+ /* @__PURE__ */ jsx39("span", { style: tipArea, children: area }),
7956
+ " scores",
7957
+ " ",
7958
+ /* @__PURE__ */ jsx39("span", { style: tipValue2, children: score }),
7959
+ /* @__PURE__ */ jsx39("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
7960
+ " on",
7961
+ " ",
7962
+ dim.toLowerCase(),
7963
+ ". ",
7964
+ description
7965
+ ] });
7966
+ }
7967
+ function getDimensionWeaknesses(area) {
7968
+ const result = [];
7969
+ if (area.taskCompletion < 50)
7970
+ result.push({
7971
+ dimension: "Task Completion",
7972
+ tip: dimTip(
7973
+ area.feature,
7974
+ "Task Completion",
7975
+ Math.round(area.taskCompletion),
7976
+ GLOSSARY.taskCompletion
7977
+ ),
7978
+ value: Math.round(area.taskCompletion)
7979
+ });
7980
+ if (area.codeCorrectness < 50)
7981
+ result.push({
7982
+ dimension: "Code Correctness",
7983
+ tip: dimTip(
7984
+ area.feature,
7985
+ "Code Correctness",
7986
+ Math.round(area.codeCorrectness),
7987
+ GLOSSARY.codeCorrectness
7988
+ ),
7989
+ value: Math.round(area.codeCorrectness)
7990
+ });
7991
+ if (area.docCoverage < 50)
7992
+ result.push({
7993
+ dimension: "Doc Coverage",
7994
+ tip: dimTip(
7995
+ area.feature,
7996
+ "Doc Coverage",
7997
+ Math.round(area.docCoverage),
7998
+ GLOSSARY.docCoverage
7999
+ ),
8000
+ value: Math.round(area.docCoverage)
8001
+ });
8002
+ return result;
8003
+ }
6489
8004
 
6490
8005
  // src/components/report-detail/ReportDetail.tsx
6491
- import { jsx as jsx38, jsxs as jsxs27 } from "react/jsx-runtime";
8006
+ import { jsx as jsx40, jsxs as jsxs28 } from "react/jsx-runtime";
6492
8007
  var OVERVIEW_TAB = { id: "overview", label: "Overview" };
6493
8008
  var DIAGNOSTICS_TAB = { id: "diagnostics", label: "Diagnostics" };
6494
8009
  var ACTIVITY_TAB = { id: "activity", label: "Agent Activity" };
@@ -6503,8 +8018,8 @@ function ReportDetail({
6503
8018
  reportId
6504
8019
  }) {
6505
8020
  const client = useClient10({ apiVersion: API_VERSION });
6506
- const [loading, setLoading] = useState13(true);
6507
- const [report, setReport] = useState13(null);
8021
+ const [loading, setLoading] = useState15(true);
8022
+ const [report, setReport] = useState15(null);
6508
8023
  useEffect7(() => {
6509
8024
  let cancelled = false;
6510
8025
  setLoading(true);
@@ -6521,39 +8036,42 @@ function ReportDetail({
6521
8036
  };
6522
8037
  }, [client, reportId]);
6523
8038
  const { summary } = report ?? {};
6524
- const hasDiagnostics = Boolean(
8039
+ const hasWeaknesses = Boolean(
6525
8040
  summary?.recommendations && summary.recommendations.gaps.length > 0 || summary?.lowScoringJudgments && summary.lowScoringJudgments.length > 0
6526
8041
  );
8042
+ const hasDiagnostics = Boolean(
8043
+ summary?.scores && summary.scores.length > 0 || hasWeaknesses
8044
+ );
6527
8045
  const hasAgentActivity = Boolean(
6528
8046
  summary?.agentBehavior && summary.agentBehavior.length > 0
6529
8047
  );
6530
- const tabs = useMemo6(
8048
+ const tabs = useMemo7(
6531
8049
  () => [OVERVIEW_TAB, DIAGNOSTICS_TAB, ACTIVITY_TAB],
6532
8050
  []
6533
8051
  );
6534
- const disabledTabs = useMemo6(() => {
8052
+ const disabledTabs = useMemo7(() => {
6535
8053
  const set2 = /* @__PURE__ */ new Set();
6536
8054
  if (!hasDiagnostics) set2.add("diagnostics");
6537
8055
  if (!hasAgentActivity) set2.add("activity");
6538
8056
  return set2;
6539
8057
  }, [hasDiagnostics, hasAgentActivity]);
6540
- const currentTab = useMemo6(() => {
8058
+ const currentTab = useMemo7(() => {
6541
8059
  const parsed = parseTab(activeTab);
6542
8060
  if (disabledTabs.has(parsed)) return "overview";
6543
8061
  return tabs.some((t) => t.id === parsed) ? parsed : "overview";
6544
8062
  }, [activeTab, disabledTabs, tabs]);
6545
- const handleTabClick = useCallback18(
8063
+ const handleTabClick = useCallback19(
6546
8064
  (tabId) => {
6547
8065
  onTabChange(tabId === "overview" ? null : tabId);
6548
8066
  },
6549
8067
  [onTabChange]
6550
8068
  );
6551
8069
  if (loading) {
6552
- return /* @__PURE__ */ jsx38(LoadingState, { message: "Loading report\u2026" });
8070
+ return /* @__PURE__ */ jsx40(LoadingState, { message: "Loading report\u2026" });
6553
8071
  }
6554
8072
  if (!report || !summary) {
6555
- return /* @__PURE__ */ jsx38(Box14, { padding: 5, children: /* @__PURE__ */ jsxs27(Stack22, { space: 4, children: [
6556
- /* @__PURE__ */ jsx38(
8073
+ return /* @__PURE__ */ jsx40(Box20, { padding: 5, children: /* @__PURE__ */ jsxs28(Stack24, { space: 4, children: [
8074
+ /* @__PURE__ */ jsx40(
6557
8075
  Button5,
6558
8076
  {
6559
8077
  icon: ArrowLeftIcon2,
@@ -6562,14 +8080,13 @@ function ReportDetail({
6562
8080
  text: "Back"
6563
8081
  }
6564
8082
  ),
6565
- /* @__PURE__ */ jsx38(Text27, { align: "center", muted: true, size: 3, children: "Report not found" })
8083
+ /* @__PURE__ */ jsx40(Text30, { align: "center", muted: true, size: 3, children: "Report not found" })
6566
8084
  ] }) });
6567
8085
  }
6568
8086
  const { comparison, provenance } = report;
6569
8087
  const totalTests = summary.scores.reduce((n, s) => n + s.testCount, 0);
6570
- const isFullMode = summary.evaluationMode === "full" || summary.scores.some((s) => s.actualScore != null);
6571
- return /* @__PURE__ */ jsx38(Box14, { padding: 4, children: /* @__PURE__ */ jsxs27(Stack22, { space: 5, children: [
6572
- /* @__PURE__ */ jsx38(
8088
+ return /* @__PURE__ */ jsx40(Box20, { padding: 4, children: /* @__PURE__ */ jsxs28(Stack24, { space: 5, children: [
8089
+ /* @__PURE__ */ jsx40(
6573
8090
  ReportHeader,
6574
8091
  {
6575
8092
  completedAt: report.completedAt,
@@ -6583,10 +8100,10 @@ function ReportDetail({
6583
8100
  tag: report.tag
6584
8101
  }
6585
8102
  ),
6586
- /* @__PURE__ */ jsx38(TabList, { space: 1, children: tabs.map((tab) => {
8103
+ /* @__PURE__ */ jsx40(TabList, { space: 1, children: tabs.map((tab) => {
6587
8104
  const isDisabled = disabledTabs.has(tab.id);
6588
8105
  const tooltip = getDisabledTabTooltip(tab.id, summary);
6589
- const tabElement = /* @__PURE__ */ jsx38(
8106
+ const tabElement = /* @__PURE__ */ jsx40(
6590
8107
  Tab,
6591
8108
  {
6592
8109
  "aria-controls": `panel-${tab.id}`,
@@ -6597,65 +8114,55 @@ function ReportDetail({
6597
8114
  selected: currentTab === tab.id
6598
8115
  }
6599
8116
  );
6600
- return isDisabled && tooltip ? /* @__PURE__ */ jsx38(
6601
- Tooltip8,
8117
+ return isDisabled && tooltip ? /* @__PURE__ */ jsx40(
8118
+ Tooltip9,
6602
8119
  {
6603
- content: /* @__PURE__ */ jsx38(Box14, { padding: 2, style: { maxWidth: 280 }, children: tooltip }),
8120
+ content: /* @__PURE__ */ jsx40(Box20, { padding: 2, style: { maxWidth: 280 }, children: tooltip }),
6604
8121
  placement: "bottom",
6605
8122
  portal: true,
6606
- children: /* @__PURE__ */ jsx38("span", { style: { display: "inline-block" }, children: tabElement })
8123
+ children: /* @__PURE__ */ jsx40("span", { style: { display: "inline-block" }, children: tabElement })
6607
8124
  },
6608
8125
  tab.id
6609
- ) : /* @__PURE__ */ jsx38("span", { children: tabElement }, tab.id);
8126
+ ) : /* @__PURE__ */ jsx40("span", { children: tabElement }, tab.id);
6610
8127
  }) }),
6611
- currentTab === "overview" && /* @__PURE__ */ jsx38(
8128
+ currentTab === "overview" && /* @__PURE__ */ jsx40(
6612
8129
  TabPanel,
6613
8130
  {
6614
8131
  "aria-labelledby": "tab-overview",
6615
8132
  hidden: currentTab !== "overview",
6616
8133
  id: "panel-overview",
6617
- children: /* @__PURE__ */ jsxs27(Stack22, { space: 5, children: [
6618
- /* @__PURE__ */ jsx38(
6619
- OverviewStats,
8134
+ children: /* @__PURE__ */ jsxs28(Stack24, { space: 5, children: [
8135
+ /* @__PURE__ */ jsx40(
8136
+ DiagnosticsOverview,
6620
8137
  {
8138
+ comparison,
6621
8139
  durationMs: report.durationMs,
6622
- isFullMode,
6623
8140
  overall: summary.overall,
8141
+ scores: summary.scores,
6624
8142
  totalTests
6625
8143
  }
6626
8144
  ),
6627
- isFullMode && /* @__PURE__ */ jsx38(ThreeLayerTable, { scores: summary.scores }),
6628
- /* @__PURE__ */ jsx38(AreaScoreTable, { scores: summary.scores }),
6629
- comparison && /* @__PURE__ */ jsx38(ComparisonSummary, { comparison }),
6630
- /* @__PURE__ */ jsx38(LineageCard, { provenance, reportId: report.reportId }),
6631
- /* @__PURE__ */ jsx38(ProvenanceCard, { provenance })
8145
+ /* @__PURE__ */ jsx40(LineageCard, { provenance, reportId: report.reportId }),
8146
+ /* @__PURE__ */ jsx40(ProvenanceCard, { provenance })
6632
8147
  ] })
6633
8148
  }
6634
8149
  ),
6635
- currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */ jsx38(
6636
- TabPanel,
8150
+ currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */ jsx40(
8151
+ DiagnosticsPanel,
6637
8152
  {
6638
- "aria-labelledby": "tab-diagnostics",
6639
- hidden: currentTab !== "diagnostics",
6640
- id: "panel-diagnostics",
6641
- children: /* @__PURE__ */ jsxs27(Stack22, { space: 5, children: [
6642
- summary.recommendations && summary.recommendations.gaps.length > 0 && /* @__PURE__ */ jsx38(
6643
- RecommendationsSection,
6644
- {
6645
- recommendations: summary.recommendations
6646
- }
6647
- ),
6648
- summary.lowScoringJudgments && summary.lowScoringJudgments.length > 0 && /* @__PURE__ */ jsx38(JudgmentList, { judgments: summary.lowScoringJudgments })
6649
- ] })
8153
+ comparison,
8154
+ judgments: summary.lowScoringJudgments,
8155
+ recommendations: summary.recommendations,
8156
+ scores: summary.scores
6650
8157
  }
6651
8158
  ),
6652
- currentTab === "activity" && hasAgentActivity && /* @__PURE__ */ jsx38(
8159
+ currentTab === "activity" && hasAgentActivity && /* @__PURE__ */ jsx40(
6653
8160
  TabPanel,
6654
8161
  {
6655
8162
  "aria-labelledby": "tab-activity",
6656
8163
  hidden: currentTab !== "activity",
6657
8164
  id: "panel-activity",
6658
- children: /* @__PURE__ */ jsx38(
8165
+ children: /* @__PURE__ */ jsx40(
6659
8166
  AgentActivitySection,
6660
8167
  {
6661
8168
  agentBehavior: summary.agentBehavior,
@@ -6666,6 +8173,79 @@ function ReportDetail({
6666
8173
  )
6667
8174
  ] }) });
6668
8175
  }
8176
+ var DIAG_TABS = [
8177
+ { id: "strengths", label: "Strengths" },
8178
+ { id: "issues", label: "Issues" }
8179
+ ];
8180
+ function DiagnosticsPanel({
8181
+ comparison,
8182
+ judgments,
8183
+ recommendations,
8184
+ scores
8185
+ }) {
8186
+ const [subTab, setSubTab] = useState15("strengths");
8187
+ const issueCount = scores.filter((s) => s.totalScore < 70).length + scores.filter((s) => s.negativeDocLift).length + scores.filter(
8188
+ (s) => s.infrastructureEfficiency != null && s.infrastructureEfficiency < 0.7 && !s.invertedRetrievalGap
8189
+ ).length;
8190
+ return /* @__PURE__ */ jsx40(TabPanel, { "aria-labelledby": "tab-diagnostics", id: "panel-diagnostics", children: /* @__PURE__ */ jsxs28(Stack24, { space: 4, children: [
8191
+ /* @__PURE__ */ jsx40(
8192
+ Flex24,
8193
+ {
8194
+ align: "center",
8195
+ gap: 1,
8196
+ style: {
8197
+ borderBottom: "1px solid var(--card-border-color)",
8198
+ paddingBottom: 8
8199
+ },
8200
+ wrap: "wrap",
8201
+ children: DIAG_TABS.map((tab) => /* @__PURE__ */ jsxs28(
8202
+ "button",
8203
+ {
8204
+ onClick: () => setSubTab(tab.id),
8205
+ style: {
8206
+ alignItems: "center",
8207
+ background: subTab === tab.id ? "var(--card-muted-bg-color)" : "transparent",
8208
+ border: "none",
8209
+ borderRadius: 6,
8210
+ color: subTab === tab.id ? "var(--card-fg-color)" : "var(--card-muted-fg-color)",
8211
+ cursor: "pointer",
8212
+ display: "inline-flex",
8213
+ fontSize: 15,
8214
+ fontWeight: 500,
8215
+ gap: 8,
8216
+ padding: "8px 16px"
8217
+ },
8218
+ type: "button",
8219
+ children: [
8220
+ tab.label,
8221
+ tab.id === "issues" && issueCount > 0 && /* @__PURE__ */ jsx40(
8222
+ "span",
8223
+ {
8224
+ style: {
8225
+ backgroundColor: "rgba(239,68,68,0.2)",
8226
+ borderRadius: 999,
8227
+ color: "#f87171",
8228
+ fontSize: 13,
8229
+ marginLeft: 4,
8230
+ padding: "2px 8px"
8231
+ },
8232
+ children: issueCount
8233
+ }
8234
+ )
8235
+ ]
8236
+ },
8237
+ tab.id
8238
+ ))
8239
+ }
8240
+ ),
8241
+ subTab === "strengths" && /* @__PURE__ */ jsx40(StrengthsList, { comparison, scores }),
8242
+ subTab === "issues" && /* @__PURE__ */ jsxs28(Stack24, { space: 5, children: [
8243
+ /* @__PURE__ */ jsx40(WeaknessesList, { comparison, scores }),
8244
+ recommendations && recommendations.gaps.length > 0 && /* @__PURE__ */ jsx40(RecommendationsSection, { recommendations }),
8245
+ judgments && judgments.length > 0 && /* @__PURE__ */ jsx40(JudgmentList, { judgments })
8246
+ ] })
8247
+ ] }) });
8248
+ }
6669
8249
  var inlineCodeStyle = {
6670
8250
  background: "var(--card-code-bg-color, rgba(255,255,255,0.06))",
6671
8251
  borderRadius: 3,
@@ -6677,27 +8257,65 @@ function getDisabledTabTooltip(tabId, summary) {
6677
8257
  if (!summary) return null;
6678
8258
  switch (tabId) {
6679
8259
  case "diagnostics":
6680
- return /* @__PURE__ */ jsx38(Text27, { muted: true, size: 2, children: "No diagnostic data available. Diagnostics require low-scoring judgments or gap analysis recommendations." });
8260
+ return /* @__PURE__ */ jsx40(Text30, { muted: true, size: 2, children: "No diagnostic data available. Diagnostics require at least one scored feature area." });
6681
8261
  case "activity":
6682
- return summary.evaluationMode === "baseline" ? /* @__PURE__ */ jsxs27(Text27, { muted: true, size: 2, children: [
8262
+ return summary.evaluationMode === "baseline" ? /* @__PURE__ */ jsxs28(Text30, { muted: true, size: 2, children: [
6683
8263
  "Not available for baseline-only evaluations. Run with",
6684
8264
  " ",
6685
- /* @__PURE__ */ jsx38("code", { style: inlineCodeStyle, children: "--mode full" }),
8265
+ /* @__PURE__ */ jsx40("code", { style: inlineCodeStyle, children: "--mode full" }),
6686
8266
  " or",
6687
8267
  " ",
6688
- /* @__PURE__ */ jsx38("code", { style: inlineCodeStyle, children: "--mode agentic" }),
8268
+ /* @__PURE__ */ jsx40("code", { style: inlineCodeStyle, children: "--mode agentic" }),
6689
8269
  " to capture agent browsing behavior."
6690
- ] }) : /* @__PURE__ */ jsx38(Text27, { muted: true, size: 2, children: "No agent activity data was recorded for this evaluation." });
8270
+ ] }) : /* @__PURE__ */ jsx40(Text30, { muted: true, size: 2, children: "No agent activity data was recorded for this evaluation." });
6691
8271
  default:
6692
8272
  return null;
6693
8273
  }
6694
8274
  }
6695
8275
 
8276
+ // src/components/report-detail/AreaScoreTable.tsx
8277
+ import React4 from "react";
8278
+ import { Card as Card14, Stack as Stack25, Text as Text32 } from "@sanity/ui";
8279
+
8280
+ // src/lib/scoring.ts
8281
+ var HEX_MAP = {
8282
+ good: "#2ecc71",
8283
+ warning: "#f1c40f",
8284
+ "needs-work": "#e67e22",
8285
+ critical: "#e74c3c"
8286
+ };
8287
+ function gradeHex(grade) {
8288
+ return HEX_MAP[grade];
8289
+ }
8290
+ function scoreHex(score) {
8291
+ return gradeHex(scoreGrade(Math.round(score)));
8292
+ }
8293
+
8294
+ // src/components/primitives/ScoreCell.tsx
8295
+ import { Card as Card13, Text as Text31 } from "@sanity/ui";
8296
+ import { jsx as jsx41 } from "react/jsx-runtime";
8297
+
8298
+ // src/components/report-detail/AreaScoreTable.tsx
8299
+ import { jsx as jsx42, jsxs as jsxs29 } from "react/jsx-runtime";
8300
+
8301
+ // src/components/report-detail/ComparisonSummary.tsx
8302
+ import { Badge as Badge8, Box as Box21, Card as Card15, Flex as Flex25, Grid as Grid4, Stack as Stack26, Text as Text33, Tooltip as Tooltip10 } from "@sanity/ui";
8303
+ import { jsx as jsx43, jsxs as jsxs30 } from "react/jsx-runtime";
8304
+
8305
+ // src/components/report-detail/OverviewStats.tsx
8306
+ import { Grid as Grid5 } from "@sanity/ui";
8307
+ import { jsx as jsx44, jsxs as jsxs31 } from "react/jsx-runtime";
8308
+
8309
+ // src/components/report-detail/ThreeLayerTable.tsx
8310
+ import React5 from "react";
8311
+ import { Badge as Badge9, Card as Card16, Flex as Flex26, Stack as Stack27, Text as Text34 } from "@sanity/ui";
8312
+ import { jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
8313
+
6696
8314
  // src/components/ScoreTimeline.tsx
6697
- import { Card as Card19, Flex as Flex21, Select as Select2, Stack as Stack23, Text as Text28 } from "@sanity/ui";
6698
- import { useCallback as useCallback19, useEffect as useEffect8, useMemo as useMemo7, useState as useState14 } from "react";
8315
+ import { Card as Card17, Flex as Flex27, Select as Select2, Stack as Stack28, Text as Text35 } from "@sanity/ui";
8316
+ import { useCallback as useCallback20, useEffect as useEffect8, useMemo as useMemo8, useState as useState16 } from "react";
6699
8317
  import { useClient as useClient11 } from "sanity";
6700
- import { jsx as jsx39, jsxs as jsxs28 } from "react/jsx-runtime";
8318
+ import { jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
6701
8319
  var CHART_HEIGHT = 220;
6702
8320
  var CHART_WIDTH = 800;
6703
8321
  var PAD_BOTTOM = 30;
@@ -6732,11 +8350,11 @@ function scoreForPoint(point, area) {
6732
8350
  }
6733
8351
  function ScoreTimeline({ mode = null, source = null }) {
6734
8352
  const client = useClient11({ apiVersion: API_VERSION });
6735
- const [dataPoints, setDataPoints] = useState14([]);
6736
- const [loading, setLoading] = useState14(true);
6737
- const [rangeDays, setRangeDays] = useState14(30);
6738
- const [selectedArea, setSelectedArea] = useState14(null);
6739
- const areaNames = useMemo7(() => {
8353
+ const [dataPoints, setDataPoints] = useState16([]);
8354
+ const [loading, setLoading] = useState16(true);
8355
+ const [rangeDays, setRangeDays] = useState16(30);
8356
+ const [selectedArea, setSelectedArea] = useState16(null);
8357
+ const areaNames = useMemo8(() => {
6740
8358
  const names = /* @__PURE__ */ new Set();
6741
8359
  for (const dp of dataPoints) {
6742
8360
  for (const s of dp.scores) {
@@ -6745,7 +8363,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6745
8363
  }
6746
8364
  return Array.from(names).sort();
6747
8365
  }, [dataPoints]);
6748
- const fetchData = useCallback19(async () => {
8366
+ const fetchData = useCallback20(async () => {
6749
8367
  setLoading(true);
6750
8368
  try {
6751
8369
  const startDate = rangeDays ? daysAgo(rangeDays) : "1970-01-01T00:00:00Z";
@@ -6763,7 +8381,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6763
8381
  useEffect8(() => {
6764
8382
  void fetchData();
6765
8383
  }, [fetchData]);
6766
- const chartPoints = useMemo7(() => {
8384
+ const chartPoints = useMemo8(() => {
6767
8385
  const pts = [];
6768
8386
  const scored = dataPoints.map((dp) => ({
6769
8387
  date: dp.completedAt,
@@ -6777,18 +8395,18 @@ function ScoreTimeline({ mode = null, source = null }) {
6777
8395
  });
6778
8396
  return pts;
6779
8397
  }, [dataPoints, selectedArea]);
6780
- const avgScore = useMemo7(() => {
8398
+ const avgScore = useMemo8(() => {
6781
8399
  if (chartPoints.length === 0) return 0;
6782
8400
  return chartPoints.reduce((sum, p) => sum + p.score, 0) / chartPoints.length;
6783
8401
  }, [chartPoints]);
6784
- const handleRangeChange = useCallback19(
8402
+ const handleRangeChange = useCallback20(
6785
8403
  (e) => {
6786
8404
  const val = e.currentTarget.value;
6787
8405
  setRangeDays(val === "all" ? null : Number(val));
6788
8406
  },
6789
8407
  []
6790
8408
  );
6791
- const handleAreaChange = useCallback19(
8409
+ const handleAreaChange = useCallback20(
6792
8410
  (e) => {
6793
8411
  const val = e.currentTarget.value;
6794
8412
  setSelectedArea(val || null);
@@ -6796,22 +8414,22 @@ function ScoreTimeline({ mode = null, source = null }) {
6796
8414
  []
6797
8415
  );
6798
8416
  const polylinePoints = chartPoints.map((p) => `${p.x},${p.y}`).join(" ");
6799
- return /* @__PURE__ */ jsxs28(Stack23, { space: 4, children: [
6800
- /* @__PURE__ */ jsxs28(Flex21, { gap: 3, children: [
6801
- /* @__PURE__ */ jsx39(
8417
+ return /* @__PURE__ */ jsxs33(Stack28, { space: 4, children: [
8418
+ /* @__PURE__ */ jsxs33(Flex27, { gap: 3, children: [
8419
+ /* @__PURE__ */ jsx46(
6802
8420
  Select2,
6803
8421
  {
6804
8422
  onChange: handleRangeChange,
6805
8423
  value: rangeDays?.toString() ?? "all",
6806
- children: TIME_RANGES.map((r) => /* @__PURE__ */ jsx39("option", { value: r.days?.toString() ?? "all", children: r.label }, r.label))
8424
+ children: TIME_RANGES.map((r) => /* @__PURE__ */ jsx46("option", { value: r.days?.toString() ?? "all", children: r.label }, r.label))
6807
8425
  }
6808
8426
  ),
6809
- /* @__PURE__ */ jsxs28(Select2, { onChange: handleAreaChange, value: selectedArea ?? "", children: [
6810
- /* @__PURE__ */ jsx39("option", { value: "", children: "Overall" }),
6811
- areaNames.map((name) => /* @__PURE__ */ jsx39("option", { value: name, children: name }, name))
8427
+ /* @__PURE__ */ jsxs33(Select2, { onChange: handleAreaChange, value: selectedArea ?? "", children: [
8428
+ /* @__PURE__ */ jsx46("option", { value: "", children: "Overall" }),
8429
+ areaNames.map((name) => /* @__PURE__ */ jsx46("option", { value: name, children: name }, name))
6812
8430
  ] })
6813
8431
  ] }),
6814
- /* @__PURE__ */ jsx39(Card19, { padding: 3, radius: 2, shadow: 1, children: loading ? /* @__PURE__ */ jsx39(Flex21, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx39(Text28, { muted: true, size: 2, children: "Loading\u2026" }) }) : chartPoints.length === 0 ? /* @__PURE__ */ jsx39(Flex21, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx39(Text28, { muted: true, size: 2, children: "No reports found for this time range" }) }) : /* @__PURE__ */ jsxs28(
8432
+ /* @__PURE__ */ jsx46(Card17, { padding: 3, radius: 2, shadow: 1, children: loading ? /* @__PURE__ */ jsx46(Flex27, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx46(Text35, { muted: true, size: 2, children: "Loading\u2026" }) }) : chartPoints.length === 0 ? /* @__PURE__ */ jsx46(Flex27, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx46(Text35, { muted: true, size: 2, children: "No reports found for this time range" }) }) : /* @__PURE__ */ jsxs33(
6815
8433
  "svg",
6816
8434
  {
6817
8435
  style: { display: "block", width: "100%" },
@@ -6819,8 +8437,8 @@ function ScoreTimeline({ mode = null, source = null }) {
6819
8437
  children: [
6820
8438
  Y_TICKS.map((tick) => {
6821
8439
  const y = PAD_TOP + PLOT_HEIGHT - tick / Y_MAX * PLOT_HEIGHT;
6822
- return /* @__PURE__ */ jsxs28("g", { children: [
6823
- /* @__PURE__ */ jsx39(
8440
+ return /* @__PURE__ */ jsxs33("g", { children: [
8441
+ /* @__PURE__ */ jsx46(
6824
8442
  "line",
6825
8443
  {
6826
8444
  stroke: "#ccc",
@@ -6831,7 +8449,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6831
8449
  y2: y
6832
8450
  }
6833
8451
  ),
6834
- /* @__PURE__ */ jsx39(
8452
+ /* @__PURE__ */ jsx46(
6835
8453
  "text",
6836
8454
  {
6837
8455
  dominantBaseline: "middle",
@@ -6851,7 +8469,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6851
8469
  chartPoints.length - 1
6852
8470
  ].map((idx) => {
6853
8471
  const p = chartPoints[idx];
6854
- return /* @__PURE__ */ jsx39(
8472
+ return /* @__PURE__ */ jsx46(
6855
8473
  "text",
6856
8474
  {
6857
8475
  fill: "#999",
@@ -6863,7 +8481,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6863
8481
  },
6864
8482
  idx
6865
8483
  );
6866
- }) : chartPoints.map((p, idx) => /* @__PURE__ */ jsx39(
8484
+ }) : chartPoints.map((p, idx) => /* @__PURE__ */ jsx46(
6867
8485
  "text",
6868
8486
  {
6869
8487
  fill: "#999",
@@ -6875,7 +8493,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6875
8493
  },
6876
8494
  idx
6877
8495
  )),
6878
- /* @__PURE__ */ jsx39(
8496
+ /* @__PURE__ */ jsx46(
6879
8497
  "polyline",
6880
8498
  {
6881
8499
  fill: "none",
@@ -6885,7 +8503,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6885
8503
  strokeWidth: 2.5
6886
8504
  }
6887
8505
  ),
6888
- chartPoints.map((p, idx) => /* @__PURE__ */ jsx39(
8506
+ chartPoints.map((p, idx) => /* @__PURE__ */ jsx46(
6889
8507
  "circle",
6890
8508
  {
6891
8509
  cx: p.x,
@@ -6894,7 +8512,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6894
8512
  r: 4,
6895
8513
  stroke: "#fff",
6896
8514
  strokeWidth: 1.5,
6897
- children: /* @__PURE__ */ jsxs28("title", { children: [
8515
+ children: /* @__PURE__ */ jsxs33("title", { children: [
6898
8516
  formatDate(p.date),
6899
8517
  ": ",
6900
8518
  Math.round(p.score)
@@ -6905,7 +8523,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6905
8523
  ]
6906
8524
  }
6907
8525
  ) }),
6908
- /* @__PURE__ */ jsxs28(Text28, { muted: true, size: 2, children: [
8526
+ /* @__PURE__ */ jsxs33(Text35, { muted: true, size: 2, children: [
6909
8527
  chartPoints.length,
6910
8528
  " data point",
6911
8529
  chartPoints.length !== 1 ? "s" : ""
@@ -6915,7 +8533,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6915
8533
  var ScoreTimeline_default = ScoreTimeline;
6916
8534
 
6917
8535
  // src/components/Dashboard.tsx
6918
- import { jsx as jsx40, jsxs as jsxs29 } from "react/jsx-runtime";
8536
+ import { jsx as jsx47, jsxs as jsxs34 } from "react/jsx-runtime";
6919
8537
  var VIEW_PARAM_MAP = {
6920
8538
  compare: "compare",
6921
8539
  timeline: "timeline"
@@ -6926,7 +8544,7 @@ function Dashboard() {
6926
8544
  const reportId = routerState.reportId ?? null;
6927
8545
  const isDetail = reportId !== null;
6928
8546
  const activeTab = isDetail ? "latest" : VIEW_PARAM_MAP[routerState.view ?? ""] ?? "latest";
6929
- const navigateToTab = useCallback20(
8547
+ const navigateToTab = useCallback21(
6930
8548
  (tab) => {
6931
8549
  if (tab === "latest") {
6932
8550
  router.navigate({});
@@ -6936,13 +8554,13 @@ function Dashboard() {
6936
8554
  },
6937
8555
  [router]
6938
8556
  );
6939
- const handleSelectReport = useCallback20(
8557
+ const handleSelectReport = useCallback21(
6940
8558
  (id) => {
6941
8559
  router.navigate({ reportId: id });
6942
8560
  },
6943
8561
  [router]
6944
8562
  );
6945
- const handleTabChange = useCallback20(
8563
+ const handleTabChange = useCallback21(
6946
8564
  (tab) => {
6947
8565
  if (!routerState.reportId) return;
6948
8566
  if (tab) {
@@ -6953,16 +8571,16 @@ function Dashboard() {
6953
8571
  },
6954
8572
  [router, routerState.reportId]
6955
8573
  );
6956
- const handleBack = useCallback20(() => {
8574
+ const handleBack = useCallback21(() => {
6957
8575
  router.navigate({});
6958
8576
  }, [router]);
6959
- return /* @__PURE__ */ jsx40(Container, { width: 4, children: /* @__PURE__ */ jsxs29(Stack24, { padding: 4, space: 4, children: [
6960
- /* @__PURE__ */ jsx40(Flex22, { align: "center", gap: 3, children: /* @__PURE__ */ jsxs29(Stack24, { flex: 1, space: 1, children: [
6961
- /* @__PURE__ */ jsx40(Text29, { size: 4, weight: "bold", children: "AI Literacy Framework" }),
6962
- /* @__PURE__ */ jsx40(Text29, { muted: true, size: 2, children: "Evaluation reports and score trends" })
8577
+ return /* @__PURE__ */ jsx47(Container, { width: 4, children: /* @__PURE__ */ jsxs34(Stack29, { padding: 4, space: 4, children: [
8578
+ /* @__PURE__ */ jsx47(Flex28, { align: "center", gap: 3, children: /* @__PURE__ */ jsxs34(Stack29, { flex: 1, space: 1, children: [
8579
+ /* @__PURE__ */ jsx47(Text36, { size: 4, weight: "bold", children: "AI Literacy Framework" }),
8580
+ /* @__PURE__ */ jsx47(Text36, { muted: true, size: 2, children: "Evaluation reports and score trends" })
6963
8581
  ] }) }),
6964
- !isDetail && /* @__PURE__ */ jsxs29(TabList2, { space: 1, children: [
6965
- /* @__PURE__ */ jsx40(
8582
+ !isDetail && /* @__PURE__ */ jsxs34(TabList2, { space: 1, children: [
8583
+ /* @__PURE__ */ jsx47(
6966
8584
  Tab2,
6967
8585
  {
6968
8586
  "aria-controls": "latest-panel",
@@ -6972,7 +8590,7 @@ function Dashboard() {
6972
8590
  selected: activeTab === "latest"
6973
8591
  }
6974
8592
  ),
6975
- /* @__PURE__ */ jsx40(
8593
+ /* @__PURE__ */ jsx47(
6976
8594
  Tab2,
6977
8595
  {
6978
8596
  "aria-controls": "timeline-panel",
@@ -6982,7 +8600,7 @@ function Dashboard() {
6982
8600
  selected: activeTab === "timeline"
6983
8601
  }
6984
8602
  ),
6985
- /* @__PURE__ */ jsx40(
8603
+ /* @__PURE__ */ jsx47(
6986
8604
  Tab2,
6987
8605
  {
6988
8606
  "aria-controls": "compare-panel",
@@ -6993,10 +8611,10 @@ function Dashboard() {
6993
8611
  }
6994
8612
  )
6995
8613
  ] }),
6996
- !isDetail && activeTab === "latest" && /* @__PURE__ */ jsx40(TabPanel2, { "aria-labelledby": "latest-tab", id: "latest-panel", children: /* @__PURE__ */ jsx40(LatestReports, { onSelectReport: handleSelectReport }) }),
6997
- !isDetail && activeTab === "timeline" && /* @__PURE__ */ jsx40(TabPanel2, { "aria-labelledby": "timeline-tab", id: "timeline-panel", children: /* @__PURE__ */ jsx40(ScoreTimeline_default, {}) }),
6998
- !isDetail && activeTab === "compare" && /* @__PURE__ */ jsx40(TabPanel2, { "aria-labelledby": "compare-tab", id: "compare-panel", children: /* @__PURE__ */ jsx40(ComparisonView, {}) }),
6999
- isDetail && reportId && /* @__PURE__ */ jsx40(
8614
+ !isDetail && activeTab === "latest" && /* @__PURE__ */ jsx47(TabPanel2, { "aria-labelledby": "latest-tab", id: "latest-panel", children: /* @__PURE__ */ jsx47(LatestReports, { onSelectReport: handleSelectReport }) }),
8615
+ !isDetail && activeTab === "timeline" && /* @__PURE__ */ jsx47(TabPanel2, { "aria-labelledby": "timeline-tab", id: "timeline-panel", children: /* @__PURE__ */ jsx47(ScoreTimeline_default, {}) }),
8616
+ !isDetail && activeTab === "compare" && /* @__PURE__ */ jsx47(TabPanel2, { "aria-labelledby": "compare-tab", id: "compare-panel", children: /* @__PURE__ */ jsx47(ComparisonView, {}) }),
8617
+ isDetail && reportId && /* @__PURE__ */ jsx47(
7000
8618
  ReportDetail,
7001
8619
  {
7002
8620
  activeTab: routerState.tab ?? null,
@@ -7026,7 +8644,7 @@ function ailfTool(options = {}) {
7026
8644
  // src/actions/RunEvaluationAction.tsx
7027
8645
  import { BarChartIcon as BarChartIcon2 } from "@sanity/icons";
7028
8646
  import { useToast as useToast8 } from "@sanity/ui";
7029
- import { useCallback as useCallback21, useEffect as useEffect9, useRef as useRef4, useState as useState15 } from "react";
8647
+ import { useCallback as useCallback22, useEffect as useEffect9, useRef as useRef4, useState as useState17 } from "react";
7030
8648
  import {
7031
8649
  getReleaseIdFromReleaseDocumentId as getReleaseIdFromReleaseDocumentId3,
7032
8650
  useClient as useClient12,
@@ -7057,7 +8675,7 @@ function createRunEvaluationAction(options = {}) {
7057
8675
  const projectId = useProjectId2();
7058
8676
  const currentUser = useCurrentUser4();
7059
8677
  const toast = useToast8();
7060
- const [state, setState] = useState15({ status: "loading" });
8678
+ const [state, setState] = useState17({ status: "loading" });
7061
8679
  const requestedAtRef = useRef4(null);
7062
8680
  const perspectiveId = getReleaseIdFromReleaseDocumentId3(release._id);
7063
8681
  useEffect9(() => {
@@ -7153,7 +8771,7 @@ function createRunEvaluationAction(options = {}) {
7153
8771
  }, 15e3);
7154
8772
  return () => clearTimeout(timer);
7155
8773
  }, [client, perspectiveId, state]);
7156
- const handleRequest = useCallback21(async () => {
8774
+ const handleRequest = useCallback22(async () => {
7157
8775
  const releaseTitle = release.metadata?.title ?? perspectiveId ?? "release";
7158
8776
  const tag = `release-${slugify3(releaseTitle)}-${dateStamp3()}`;
7159
8777
  const now = Date.now();