@sanity/ailf-studio 0.2.0 → 0.3.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +19 -0
  2. package/dist/index.js +1414 -1242
  3. package/package.json +1 -1
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 Flex28,
3048
+ Flex as Flex29,
3049
3049
  Stack as Stack29,
3050
3050
  Tab as Tab2,
3051
3051
  TabList as TabList2,
3052
3052
  TabPanel as TabPanel2,
3053
- Text as Text36
3053
+ Text as Text37
3054
3054
  } from "@sanity/ui";
3055
- import { useCallback as useCallback21 } from "react";
3055
+ import { useCallback as useCallback22 } from "react";
3056
3056
  import { useRouter as useRouter3 } from "sanity/router";
3057
3057
 
3058
3058
  // src/components/ComparisonView.tsx
@@ -3127,7 +3127,29 @@ var GLOSSARY = {
3127
3127
  // -- Dimension deltas -----------------------------------------------------
3128
3128
  dimTaskCompletion: "Change in task completion between runs. Positive means implementations are more complete.",
3129
3129
  dimCodeCorrectness: "Change in code correctness between runs. Positive means better code quality.",
3130
- dimDocCoverage: "Change in doc coverage between runs. Positive means the docs are providing more useful information."
3130
+ dimDocCoverage: "Change in doc coverage between runs. Positive means the docs are providing more useful information.",
3131
+ // -- Per-area trend delta ----------------------------------------------------
3132
+ areaDelta: "Score change for this area compared to the previous evaluation run.",
3133
+ // -- Source values -----------------------------------------------------------
3134
+ sourceProduction: "Production source \u2014 docs fetched from the live production dataset. Scores reflect what real users and AI agents experience today.",
3135
+ sourceBranch: "Branch source \u2014 docs fetched from a branch or draft dataset. Use this to preview how content changes affect scores before publishing.",
3136
+ sourceLocal: "Local source \u2014 docs fetched from local files or a local dev server. Useful for testing doc changes before pushing.",
3137
+ // -- Report list columns ----------------------------------------------------
3138
+ reportScore: "The overall weighted score for this evaluation run: Task Completion (50%), Code Correctness (25%), and Doc Coverage (25%), averaged across all feature areas.",
3139
+ reportMode: "The evaluation mode determines which reference points are measured. Different modes test different aspects of how AI agents interact with documentation.",
3140
+ reportTrigger: "What initiated this evaluation run. Knowing the trigger helps you understand whether a score change was from a content edit, a code deploy, or a scheduled check.",
3141
+ // -- Mode values -----------------------------------------------------------
3142
+ modeBaseline: "Baseline mode \u2014 tests the model with gold-standard docs injected directly. Measures ceiling performance (best the docs can do).",
3143
+ modeFull: "Full mode \u2014 runs baseline + agentic. Compares ceiling (injected docs) against actual (agent-retrieved docs) to measure retrieval gap and infrastructure efficiency.",
3144
+ modeAgentic: "Agentic mode \u2014 the AI agent finds docs on its own via web search. Measures real-world performance: can agents actually discover and use your documentation?",
3145
+ modeObserved: "Observed mode \u2014 records how agents interact with docs without scoring. Captures search queries, pages visited, and browsing patterns for analysis.",
3146
+ modeDebug: "Debug mode \u2014 a diagnostic run for pipeline development. May use non-standard configurations or limited task sets.",
3147
+ // -- Trigger values --------------------------------------------------------
3148
+ triggerManual: "Manually triggered \u2014 someone ran the evaluation pipeline by hand, either locally or via the Studio UI.",
3149
+ triggerCi: "CI-triggered \u2014 the evaluation ran automatically as part of a pull request or merge pipeline.",
3150
+ triggerSchedule: "Scheduled \u2014 the evaluation ran on a recurring schedule (e.g. nightly or weekly) to track score trends over time.",
3151
+ triggerWebhook: "Webhook-triggered \u2014 a content change in Sanity triggered the evaluation automatically. Helps catch doc regressions early.",
3152
+ triggerCrossRepo: "Cross-repo \u2014 triggered from another repository via the dispatch API. Used when external repos want to validate their docs against AILF tasks."
3131
3153
  };
3132
3154
 
3133
3155
  // src/lib/comparison.ts
@@ -3736,8 +3758,8 @@ function formatOption(r) {
3736
3758
  }
3737
3759
 
3738
3760
  // src/components/LatestReports.tsx
3739
- import { Button, Card as Card7, Flex as Flex10, Stack as Stack10, Text as Text14 } from "@sanity/ui";
3740
- import { useCallback as useCallback10, useEffect as useEffect5, useMemo as useMemo4, useState as useState5 } from "react";
3761
+ import { Button, Card as Card7, Flex as Flex11, Stack as Stack10, Text as Text17 } from "@sanity/ui";
3762
+ import { useCallback as useCallback10, useEffect as useEffect5, useMemo as useMemo4, useState as useState6 } from "react";
3741
3763
  import { useClient as useClient4 } from "sanity";
3742
3764
  import { useRouter } from "sanity/router";
3743
3765
 
@@ -3987,10 +4009,10 @@ function OutlineBadge({
3987
4009
  import {
3988
4010
  Badge as Badge4,
3989
4011
  Code,
3990
- Flex as Flex9,
4012
+ Flex as Flex10,
3991
4013
  Inline,
3992
4014
  Stack as Stack9,
3993
- Text as Text13
4015
+ Text as Text16
3994
4016
  } from "@sanity/ui";
3995
4017
 
3996
4018
  // src/components/report-table/useContainerWidth.ts
@@ -4033,8 +4055,141 @@ function useContainerWidth() {
4033
4055
  return { ref, tier: getTier(width), width };
4034
4056
  }
4035
4057
 
4058
+ // src/components/primitives/DeltaIndicator.tsx
4059
+ import { TrendUpwardIcon } from "@sanity/icons";
4060
+ import { Flex as Flex9, Text as Text13 } from "@sanity/ui";
4061
+ import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
4062
+ function DeltaIndicator({
4063
+ delta,
4064
+ icon = false,
4065
+ mono = false,
4066
+ prefix,
4067
+ round = false,
4068
+ showZero = false,
4069
+ size = 2
4070
+ }) {
4071
+ if (delta === 0 && !showZero) return null;
4072
+ const isUp = delta > 0;
4073
+ const color = delta > 0 ? "var(--card-badge-positive-dot-color)" : delta < 0 ? "var(--card-badge-critical-dot-color)" : void 0;
4074
+ const formatted = round ? `${delta > 0 ? "+" : ""}${Math.round(delta)}` : formatDelta(delta);
4075
+ const displayText = `${prefix ?? ""}${formatted}`;
4076
+ if (icon) {
4077
+ return /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 1, children: [
4078
+ /* @__PURE__ */ jsx15(
4079
+ TrendUpwardIcon,
4080
+ {
4081
+ style: {
4082
+ color,
4083
+ fontSize: size === 1 ? 13 : 15,
4084
+ transform: isUp ? void 0 : "scaleY(-1)"
4085
+ }
4086
+ }
4087
+ ),
4088
+ /* @__PURE__ */ jsx15(
4089
+ Text13,
4090
+ {
4091
+ size,
4092
+ style: {
4093
+ color,
4094
+ ...mono ? { fontFamily: "var(--font-code-size, monospace)" } : {},
4095
+ fontWeight: 600
4096
+ },
4097
+ children: displayText
4098
+ }
4099
+ )
4100
+ ] });
4101
+ }
4102
+ return /* @__PURE__ */ jsx15(
4103
+ Text13,
4104
+ {
4105
+ size,
4106
+ style: {
4107
+ color,
4108
+ ...mono ? { fontFamily: "var(--font-code-size, monospace)" } : {},
4109
+ fontWeight: mono ? 500 : void 0
4110
+ },
4111
+ children: displayText
4112
+ }
4113
+ );
4114
+ }
4115
+
4116
+ // src/components/report-detail/HoverTip.tsx
4117
+ import { useState as useState5 } from "react";
4118
+ import { Box as Box8, Text as Text14, Tooltip as Tooltip3 } from "@sanity/ui";
4119
+ import { jsx as jsx16 } from "react/jsx-runtime";
4120
+ function HoverTip({
4121
+ text,
4122
+ children,
4123
+ placement = "bottom",
4124
+ display = "inline-flex"
4125
+ }) {
4126
+ const [hovered, setHovered] = useState5(false);
4127
+ const isBlock = display === "block";
4128
+ return /* @__PURE__ */ jsx16(
4129
+ Tooltip3,
4130
+ {
4131
+ content: /* @__PURE__ */ jsx16(Box8, { padding: 2, style: { maxWidth: 280 }, children: typeof text === "string" ? /* @__PURE__ */ jsx16(Text14, { size: 2, children: text }) : text }),
4132
+ placement,
4133
+ portal: true,
4134
+ children: /* @__PURE__ */ jsx16(
4135
+ "span",
4136
+ {
4137
+ onMouseEnter: () => setHovered(true),
4138
+ onMouseLeave: () => setHovered(false),
4139
+ style: {
4140
+ borderRadius: isBlock ? 6 : 4,
4141
+ cursor: "help",
4142
+ display,
4143
+ ...isBlock ? {
4144
+ transition: "box-shadow 150ms ease, transform 150ms ease, filter 150ms ease",
4145
+ ...hovered ? {
4146
+ boxShadow: "0 4px 12px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.08)",
4147
+ filter: "brightness(1.08)",
4148
+ transform: "translateY(-2px)"
4149
+ } : {}
4150
+ } : {
4151
+ outline: hovered ? "1px solid rgba(255,255,255,0.15)" : "1px solid transparent",
4152
+ transition: "background 150ms ease, outline 150ms ease",
4153
+ ...hovered ? { background: "rgba(255,255,255,0.06)" } : {}
4154
+ }
4155
+ },
4156
+ children
4157
+ }
4158
+ )
4159
+ }
4160
+ );
4161
+ }
4162
+
4163
+ // src/components/report-detail/InfoTip.tsx
4164
+ import { HelpCircleIcon as HelpCircleIcon4 } from "@sanity/icons";
4165
+ import { Box as Box9, Text as Text15, Tooltip as Tooltip4 } from "@sanity/ui";
4166
+ import { jsx as jsx17 } from "react/jsx-runtime";
4167
+ function InfoTip({ text }) {
4168
+ return /* @__PURE__ */ jsx17(
4169
+ Tooltip4,
4170
+ {
4171
+ content: /* @__PURE__ */ jsx17(Box9, { padding: 2, style: { maxWidth: 280 }, children: typeof text === "string" ? /* @__PURE__ */ jsx17(Text15, { size: 2, children: text }) : text }),
4172
+ placement: "bottom",
4173
+ portal: true,
4174
+ children: /* @__PURE__ */ jsx17(
4175
+ "span",
4176
+ {
4177
+ style: {
4178
+ color: "var(--card-muted-fg-color)",
4179
+ cursor: "help",
4180
+ display: "inline-flex",
4181
+ fontSize: 15,
4182
+ verticalAlign: "middle"
4183
+ },
4184
+ children: /* @__PURE__ */ jsx17(HelpCircleIcon4, {})
4185
+ }
4186
+ )
4187
+ }
4188
+ );
4189
+ }
4190
+
4036
4191
  // src/components/report-table/ReportTable.tsx
4037
- import { ClockIcon, TrendUpwardIcon } from "@sanity/icons";
4192
+ import { ClockIcon } from "@sanity/icons";
4038
4193
  import { useCallback as useCallback9 } from "react";
4039
4194
 
4040
4195
  // src/components/report-card/types.ts
@@ -4049,9 +4204,9 @@ function formatCardDate(iso) {
4049
4204
  }
4050
4205
 
4051
4206
  // src/components/report-table/ReportTable.tsx
4052
- import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
4207
+ import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
4053
4208
  function GitBranchIcon({ style }) {
4054
- return /* @__PURE__ */ jsxs12(
4209
+ return /* @__PURE__ */ jsxs13(
4055
4210
  "svg",
4056
4211
  {
4057
4212
  "aria-hidden": "true",
@@ -4066,9 +4221,9 @@ function GitBranchIcon({ style }) {
4066
4221
  width: 12,
4067
4222
  xmlns: "http://www.w3.org/2000/svg",
4068
4223
  children: [
4069
- /* @__PURE__ */ jsx15("path", { d: "M15 6a9 9 0 0 0-9 9V3" }),
4070
- /* @__PURE__ */ jsx15("circle", { cx: 18, cy: 6, r: 3 }),
4071
- /* @__PURE__ */ jsx15("circle", { cx: 6, cy: 18, r: 3 })
4224
+ /* @__PURE__ */ jsx18("path", { d: "M15 6a9 9 0 0 0-9 9V3" }),
4225
+ /* @__PURE__ */ jsx18("circle", { cx: 18, cy: 6, r: 3 }),
4226
+ /* @__PURE__ */ jsx18("circle", { cx: 6, cy: 18, r: 3 })
4072
4227
  ]
4073
4228
  }
4074
4229
  );
@@ -4094,10 +4249,10 @@ function ReportTable({
4094
4249
  onSortChange
4095
4250
  }) {
4096
4251
  const { ref, tier } = useContainerWidth();
4097
- return /* @__PURE__ */ jsxs12(Fragment5, { children: [
4098
- /* @__PURE__ */ jsx15("style", { children: TABLE_HOVER_STYLES }),
4099
- /* @__PURE__ */ jsxs12("div", { ref, children: [
4100
- /* @__PURE__ */ jsxs12(
4252
+ return /* @__PURE__ */ jsxs13(Fragment5, { children: [
4253
+ /* @__PURE__ */ jsx18("style", { children: TABLE_HOVER_STYLES }),
4254
+ /* @__PURE__ */ jsxs13("div", { ref, children: [
4255
+ /* @__PURE__ */ jsxs13(
4101
4256
  "div",
4102
4257
  {
4103
4258
  style: {
@@ -4108,29 +4263,29 @@ function ReportTable({
4108
4263
  padding: "12px 12px 8px"
4109
4264
  },
4110
4265
  children: [
4111
- /* @__PURE__ */ jsx15("div", {}),
4112
- /* @__PURE__ */ jsx15(
4266
+ /* @__PURE__ */ jsx18(
4113
4267
  ColHeader,
4114
4268
  {
4115
- active: sort.field === "name",
4269
+ active: sort.field === "score",
4116
4270
  direction: sort.direction,
4117
- label: "Report",
4118
- onClick: () => onSortChange("name")
4271
+ label: "Score",
4272
+ onClick: () => onSortChange("score")
4119
4273
  }
4120
4274
  ),
4121
- tier !== "narrow" && /* @__PURE__ */ jsx15(
4275
+ /* @__PURE__ */ jsx18(
4122
4276
  ColHeader,
4123
4277
  {
4124
- active: sort.field === "score",
4278
+ active: sort.field === "name",
4125
4279
  direction: sort.direction,
4126
- label: "Change",
4127
- onClick: () => onSortChange("score")
4280
+ label: "Report",
4281
+ onClick: () => onSortChange("name")
4128
4282
  }
4129
4283
  ),
4130
- tier === "full" && /* @__PURE__ */ jsxs12(Fragment5, { children: [
4131
- /* @__PURE__ */ jsx15(ColHeader, { label: "Mode" }),
4132
- /* @__PURE__ */ jsx15(ColHeader, { label: "Trigger" }),
4133
- /* @__PURE__ */ jsx15(
4284
+ tier !== "narrow" && /* @__PURE__ */ jsx18(ColHeader, { label: "Change" }),
4285
+ tier === "full" && /* @__PURE__ */ jsxs13(Fragment5, { children: [
4286
+ /* @__PURE__ */ jsx18(ColHeader, { infoTip: GLOSSARY.reportMode, label: "Mode" }),
4287
+ /* @__PURE__ */ jsx18(ColHeader, { infoTip: GLOSSARY.reportTrigger, label: "Trigger" }),
4288
+ /* @__PURE__ */ jsx18(
4134
4289
  ColHeader,
4135
4290
  {
4136
4291
  active: sort.field === "date",
@@ -4144,7 +4299,7 @@ function ReportTable({
4144
4299
  ]
4145
4300
  }
4146
4301
  ),
4147
- reports.map((report) => /* @__PURE__ */ jsx15(
4302
+ reports.map((report) => /* @__PURE__ */ jsx18(
4148
4303
  ReportRow,
4149
4304
  {
4150
4305
  onSelect: onSelectReport,
@@ -4169,7 +4324,6 @@ function ReportRow({
4169
4324
  const colors = SCORE_COLORS[grade];
4170
4325
  const hasDelta = report.comparisonDelta != null && report.comparisonDelta !== 0;
4171
4326
  const delta = report.comparisonDelta ?? 0;
4172
- const deltaUp = delta > 0;
4173
4327
  const regressedCount = report.regressed?.length ?? 0;
4174
4328
  const improvedCount = report.improved?.length ?? 0;
4175
4329
  const hasAreas = report.areas && report.areas.length > 0;
@@ -4179,7 +4333,7 @@ function ReportRow({
4179
4333
  const scoreSize = isSmall ? 40 : 48;
4180
4334
  const scoreWidth = isSmall ? 44 : 56;
4181
4335
  const scoreFontSize = isSmall ? 18 : 22;
4182
- return /* @__PURE__ */ jsxs12(
4336
+ return /* @__PURE__ */ jsxs13(
4183
4337
  "div",
4184
4338
  {
4185
4339
  className: "ailf-row",
@@ -4194,7 +4348,7 @@ function ReportRow({
4194
4348
  padding: isSmall ? "10px 8px" : "14px 12px"
4195
4349
  },
4196
4350
  children: [
4197
- /* @__PURE__ */ jsx15(Flex9, { align: "center", justify: "center", style: { paddingTop: 2 }, children: /* @__PURE__ */ jsx15(
4351
+ /* @__PURE__ */ jsx18(Flex10, { align: "center", justify: "center", style: { paddingTop: 2 }, children: /* @__PURE__ */ jsx18(
4198
4352
  "div",
4199
4353
  {
4200
4354
  style: {
@@ -4214,24 +4368,24 @@ function ReportRow({
4214
4368
  children: rounded
4215
4369
  }
4216
4370
  ) }),
4217
- /* @__PURE__ */ jsxs12(Stack9, { space: 2, children: [
4218
- /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 2, wrap: "wrap", children: [
4219
- /* @__PURE__ */ jsx15(Text13, { size: isSmall ? 2 : 3, weight: "semibold", children: report.tag ?? formatCardDate(report.completedAt) }),
4220
- git && /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 2, children: [
4221
- git.repo && /* @__PURE__ */ jsx15(Code, { size: isSmall ? 1 : 2, style: { opacity: 0.7 }, children: git.repo }),
4222
- /* @__PURE__ */ jsxs12(Inline, { space: 1, children: [
4223
- /* @__PURE__ */ jsx15(GitBranchIcon, { style: { opacity: 0.6 } }),
4224
- /* @__PURE__ */ jsx15(Code, { size: isSmall ? 1 : 2, children: git.branch })
4371
+ /* @__PURE__ */ jsxs13(Stack9, { space: 2, children: [
4372
+ /* @__PURE__ */ jsxs13(Flex10, { align: "center", gap: 2, wrap: "wrap", children: [
4373
+ /* @__PURE__ */ jsx18(Text16, { size: isSmall ? 2 : 3, weight: "semibold", children: report.tag ?? formatCardDate(report.completedAt) }),
4374
+ git && /* @__PURE__ */ jsxs13(Flex10, { align: "center", gap: 2, children: [
4375
+ git.repo && /* @__PURE__ */ jsx18(Code, { size: isSmall ? 1 : 2, style: { opacity: 0.7 }, children: git.repo }),
4376
+ /* @__PURE__ */ jsxs13(Inline, { space: 1, children: [
4377
+ /* @__PURE__ */ jsx18(GitBranchIcon, { style: { opacity: 0.6 } }),
4378
+ /* @__PURE__ */ jsx18(Code, { size: isSmall ? 1 : 2, children: git.branch })
4225
4379
  ] }),
4226
- git.prNumber && /* @__PURE__ */ jsxs12(Text13, { muted: true, size: isSmall ? 1 : 2, children: [
4380
+ git.prNumber && /* @__PURE__ */ jsxs13(Text16, { muted: true, size: isSmall ? 1 : 2, children: [
4227
4381
  "#",
4228
4382
  git.prNumber
4229
4383
  ] }),
4230
- tier === "full" && git.sha && git.sha !== "unknown" && /* @__PURE__ */ jsx15(Code, { size: 1, style: { opacity: 0.5 }, children: git.sha.slice(0, 7) })
4384
+ tier === "full" && git.sha && git.sha !== "unknown" && /* @__PURE__ */ jsx18(Code, { size: 1, style: { opacity: 0.5 }, children: git.sha.slice(0, 7) })
4231
4385
  ] })
4232
4386
  ] }),
4233
- /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 2, wrap: "wrap", children: [
4234
- report.source && /* @__PURE__ */ jsx15(
4387
+ /* @__PURE__ */ jsxs13(Flex10, { align: "center", gap: 2, wrap: "wrap", children: [
4388
+ report.source && /* @__PURE__ */ jsx18(
4235
4389
  Badge4,
4236
4390
  {
4237
4391
  fontSize: isSmall ? 0 : 1,
@@ -4241,7 +4395,7 @@ function ReportRow({
4241
4395
  children: report.source
4242
4396
  }
4243
4397
  ),
4244
- report.models?.map((model) => /* @__PURE__ */ jsx15(
4398
+ report.models?.map((model) => /* @__PURE__ */ jsx18(
4245
4399
  Badge4,
4246
4400
  {
4247
4401
  fontSize: isSmall ? 0 : 1,
@@ -4252,21 +4406,21 @@ function ReportRow({
4252
4406
  },
4253
4407
  model
4254
4408
  )),
4255
- report.perspective && /* @__PURE__ */ jsx15(OutlineBadge, { tone: "cyan", children: report.perspective }),
4256
- report.durationMs != null && report.durationMs > 0 && /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 1, children: [
4257
- /* @__PURE__ */ jsx15(ClockIcon, { style: { fontSize: 13, opacity: 0.5 } }),
4258
- /* @__PURE__ */ jsx15(Text13, { muted: true, size: isSmall ? 0 : 1, children: formatDuration(report.durationMs) })
4409
+ report.perspective && /* @__PURE__ */ jsx18(OutlineBadge, { tone: "cyan", children: report.perspective }),
4410
+ report.durationMs != null && report.durationMs > 0 && /* @__PURE__ */ jsxs13(Flex10, { align: "center", gap: 1, children: [
4411
+ /* @__PURE__ */ jsx18(ClockIcon, { style: { fontSize: 13, opacity: 0.5 } }),
4412
+ /* @__PURE__ */ jsx18(Text16, { muted: true, size: isSmall ? 0 : 1, children: formatDuration(report.durationMs) })
4259
4413
  ] })
4260
4414
  ] }),
4261
- (hasAreas || hasDocs) && /* @__PURE__ */ jsxs12(Flex9, { gap: 2, wrap: "wrap", children: [
4262
- hasAreas && report.areas.map((area) => /* @__PURE__ */ jsx15(OutlineBadge, { tone: "purple", children: area }, `a-${area}`)),
4263
- hasDocs && report.targetDocuments.map((doc) => /* @__PURE__ */ jsx15(OutlineBadge, { tone: "positive", children: doc }, `d-${doc}`))
4415
+ (hasAreas || hasDocs) && /* @__PURE__ */ jsxs13(Flex10, { gap: 2, wrap: "wrap", children: [
4416
+ hasAreas && report.areas.map((area) => /* @__PURE__ */ jsx18(OutlineBadge, { tone: "purple", children: area }, `a-${area}`)),
4417
+ hasDocs && report.targetDocuments.map((doc) => /* @__PURE__ */ jsx18(OutlineBadge, { tone: "positive", children: doc }, `d-${doc}`))
4264
4418
  ] }),
4265
- isSmall && /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 2, wrap: "wrap", children: [
4266
- /* @__PURE__ */ jsx15(OutlineBadge, { tone: MODE_TONE[report.mode] ?? "default", children: report.mode }),
4267
- report.trigger && /* @__PURE__ */ jsx15(OutlineBadge, { tone: TRIGGER_TONE[report.trigger] ?? "default", children: report.trigger }),
4268
- /* @__PURE__ */ jsx15(
4269
- Text13,
4419
+ isSmall && /* @__PURE__ */ jsxs13(Flex10, { align: "center", gap: 2, wrap: "wrap", children: [
4420
+ /* @__PURE__ */ jsx18(ModeBadge, { mode: report.mode }),
4421
+ report.trigger && /* @__PURE__ */ jsx18(TriggerBadge, { trigger: report.trigger }),
4422
+ /* @__PURE__ */ jsx18(
4423
+ Text16,
4270
4424
  {
4271
4425
  muted: true,
4272
4426
  size: 0,
@@ -4274,41 +4428,41 @@ function ReportRow({
4274
4428
  children: formatRelativeTime(report.completedAt)
4275
4429
  }
4276
4430
  ),
4277
- tier === "narrow" && hasDelta && /* @__PURE__ */ jsx15(DeltaInline, { delta, deltaUp }),
4278
- tier === "narrow" && improvedCount > 0 && /* @__PURE__ */ jsxs12(OutlineBadge, { tone: "positive", children: [
4431
+ tier === "narrow" && hasDelta && /* @__PURE__ */ jsx18(DeltaIndicator, { delta, icon: true, round: true }),
4432
+ tier === "narrow" && improvedCount > 0 && /* @__PURE__ */ jsxs13(OutlineBadge, { tone: "positive", children: [
4279
4433
  improvedCount,
4280
4434
  " improved"
4281
4435
  ] }),
4282
- tier === "narrow" && regressedCount > 0 && /* @__PURE__ */ jsxs12(OutlineBadge, { tone: "critical", children: [
4436
+ tier === "narrow" && regressedCount > 0 && /* @__PURE__ */ jsxs13(OutlineBadge, { tone: "critical", children: [
4283
4437
  regressedCount,
4284
4438
  " regressed"
4285
4439
  ] })
4286
4440
  ] })
4287
4441
  ] }),
4288
- tier !== "narrow" && /* @__PURE__ */ jsxs12(
4289
- Flex9,
4442
+ tier !== "narrow" && /* @__PURE__ */ jsxs13(
4443
+ Flex10,
4290
4444
  {
4291
4445
  align: "flex-start",
4292
4446
  direction: "column",
4293
4447
  gap: 2,
4294
4448
  style: { paddingTop: 2 },
4295
4449
  children: [
4296
- hasDelta && /* @__PURE__ */ jsx15(DeltaInline, { delta, deltaUp }),
4297
- improvedCount > 0 && /* @__PURE__ */ jsxs12(OutlineBadge, { tone: "positive", children: [
4450
+ hasDelta && /* @__PURE__ */ jsx18(DeltaIndicator, { delta, icon: true, round: true }),
4451
+ improvedCount > 0 && /* @__PURE__ */ jsxs13(OutlineBadge, { tone: "positive", children: [
4298
4452
  improvedCount,
4299
4453
  " improved"
4300
4454
  ] }),
4301
- regressedCount > 0 && /* @__PURE__ */ jsxs12(OutlineBadge, { tone: "critical", children: [
4455
+ regressedCount > 0 && /* @__PURE__ */ jsxs13(OutlineBadge, { tone: "critical", children: [
4302
4456
  regressedCount,
4303
4457
  " regressed"
4304
4458
  ] })
4305
4459
  ]
4306
4460
  }
4307
4461
  ),
4308
- tier === "full" && /* @__PURE__ */ jsx15("div", { style: { paddingTop: 2 }, children: /* @__PURE__ */ jsx15(OutlineBadge, { tone: MODE_TONE[report.mode] ?? "default", children: report.mode }) }),
4309
- tier === "full" && /* @__PURE__ */ jsx15("div", { style: { paddingTop: 2 }, children: report.trigger && /* @__PURE__ */ jsx15(OutlineBadge, { tone: TRIGGER_TONE[report.trigger] ?? "default", children: report.trigger }) }),
4310
- tier === "full" && /* @__PURE__ */ jsx15("div", { style: { paddingTop: 2, textAlign: "right" }, children: /* @__PURE__ */ jsx15(
4311
- Text13,
4462
+ tier === "full" && /* @__PURE__ */ jsx18("div", { style: { paddingTop: 2 }, children: /* @__PURE__ */ jsx18(ModeBadge, { mode: report.mode }) }),
4463
+ tier === "full" && /* @__PURE__ */ jsx18("div", { style: { paddingTop: 2 }, children: report.trigger && /* @__PURE__ */ jsx18(TriggerBadge, { trigger: report.trigger }) }),
4464
+ tier === "full" && /* @__PURE__ */ jsx18("div", { style: { paddingTop: 2, textAlign: "right" }, children: /* @__PURE__ */ jsx18(
4465
+ Text16,
4312
4466
  {
4313
4467
  muted: true,
4314
4468
  size: 2,
@@ -4320,34 +4474,6 @@ function ReportRow({
4320
4474
  }
4321
4475
  );
4322
4476
  }
4323
- function DeltaInline({ delta, deltaUp }) {
4324
- return /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 1, children: [
4325
- /* @__PURE__ */ jsx15(
4326
- TrendUpwardIcon,
4327
- {
4328
- style: {
4329
- color: deltaUp ? "var(--card-badge-positive-dot-color)" : "var(--card-badge-critical-dot-color)",
4330
- fontSize: 15,
4331
- transform: deltaUp ? void 0 : "scaleY(-1)"
4332
- }
4333
- }
4334
- ),
4335
- /* @__PURE__ */ jsxs12(
4336
- Text13,
4337
- {
4338
- size: 2,
4339
- style: {
4340
- color: deltaUp ? "var(--card-badge-positive-dot-color)" : "var(--card-badge-critical-dot-color)",
4341
- fontWeight: 600
4342
- },
4343
- children: [
4344
- deltaUp ? "+" : "",
4345
- Math.round(delta)
4346
- ]
4347
- }
4348
- )
4349
- ] });
4350
- }
4351
4477
  var MODE_TONE = {
4352
4478
  agentic: "positive",
4353
4479
  baseline: "default",
@@ -4367,10 +4493,37 @@ var TRIGGER_TONE = {
4367
4493
  schedule: "default",
4368
4494
  webhook: "positive"
4369
4495
  };
4496
+ var MODE_TIP = {
4497
+ agentic: GLOSSARY.modeAgentic,
4498
+ baseline: GLOSSARY.modeBaseline,
4499
+ debug: GLOSSARY.modeDebug,
4500
+ full: GLOSSARY.modeFull,
4501
+ observed: GLOSSARY.modeObserved
4502
+ };
4503
+ var TRIGGER_TIP = {
4504
+ ci: GLOSSARY.triggerCi,
4505
+ "cross-repo": GLOSSARY.triggerCrossRepo,
4506
+ manual: GLOSSARY.triggerManual,
4507
+ schedule: GLOSSARY.triggerSchedule,
4508
+ webhook: GLOSSARY.triggerWebhook
4509
+ };
4510
+ function ModeBadge({ mode }) {
4511
+ const badge = /* @__PURE__ */ jsx18(OutlineBadge, { tone: MODE_TONE[mode] ?? "default", children: mode });
4512
+ const tip = MODE_TIP[mode];
4513
+ if (!tip) return badge;
4514
+ return /* @__PURE__ */ jsx18(HoverTip, { text: tip, children: badge });
4515
+ }
4516
+ function TriggerBadge({ trigger }) {
4517
+ const badge = /* @__PURE__ */ jsx18(OutlineBadge, { tone: TRIGGER_TONE[trigger] ?? "default", children: trigger });
4518
+ const tip = TRIGGER_TIP[trigger];
4519
+ if (!tip) return badge;
4520
+ return /* @__PURE__ */ jsx18(HoverTip, { text: tip, children: badge });
4521
+ }
4370
4522
  function ColHeader({
4371
4523
  label,
4372
4524
  active,
4373
4525
  direction,
4526
+ infoTip,
4374
4527
  onClick,
4375
4528
  align
4376
4529
  }) {
@@ -4384,40 +4537,45 @@ function ColHeader({
4384
4537
  [onClick]
4385
4538
  );
4386
4539
  const arrow = active ? direction === "asc" ? " \u2191" : " \u2193" : "";
4387
- return /* @__PURE__ */ jsx15(
4388
- "div",
4540
+ return /* @__PURE__ */ jsxs13(
4541
+ Flex10,
4389
4542
  {
4543
+ align: "center",
4544
+ gap: 1,
4390
4545
  onClick,
4391
4546
  onKeyDown: onClick ? handleKeyDown : void 0,
4392
4547
  role: onClick ? "button" : void 0,
4393
4548
  style: {
4394
4549
  cursor: onClick ? "pointer" : "default",
4395
- textAlign: align,
4550
+ justifyContent: align === "right" ? "flex-end" : "flex-start",
4396
4551
  userSelect: "none"
4397
4552
  },
4398
4553
  tabIndex: onClick ? 0 : void 0,
4399
- children: /* @__PURE__ */ jsxs12(
4400
- Text13,
4401
- {
4402
- muted: true,
4403
- size: 1,
4404
- style: {
4405
- letterSpacing: "0.08em",
4406
- textTransform: "uppercase"
4407
- },
4408
- weight: "semibold",
4409
- children: [
4410
- label,
4411
- arrow
4412
- ]
4413
- }
4414
- )
4554
+ children: [
4555
+ /* @__PURE__ */ jsxs13(
4556
+ Text16,
4557
+ {
4558
+ muted: true,
4559
+ size: 1,
4560
+ style: {
4561
+ letterSpacing: "0.08em",
4562
+ textTransform: "uppercase"
4563
+ },
4564
+ weight: "semibold",
4565
+ children: [
4566
+ label,
4567
+ arrow
4568
+ ]
4569
+ }
4570
+ ),
4571
+ infoTip && /* @__PURE__ */ jsx18(InfoTip, { text: infoTip })
4572
+ ]
4415
4573
  }
4416
4574
  );
4417
4575
  }
4418
4576
 
4419
4577
  // src/components/LatestReports.tsx
4420
- import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
4578
+ import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
4421
4579
  function readParam(params, key) {
4422
4580
  if (!params) return null;
4423
4581
  const pair = params.find(([k]) => k === key);
@@ -4439,16 +4597,16 @@ function LatestReports({
4439
4597
  const router = useRouter();
4440
4598
  const routerState = router.state;
4441
4599
  const urlParams = routerState._searchParams;
4442
- const [searchQuery, setSearchQuery] = useState5(
4600
+ const [searchQuery, setSearchQuery] = useState6(
4443
4601
  () => readParam(urlParams, "q") ?? ""
4444
4602
  );
4445
- const [mode, setMode] = useState5(
4603
+ const [mode, setMode] = useState6(
4446
4604
  () => readParam(urlParams, "mode")
4447
4605
  );
4448
- const [source, setSource] = useState5(
4606
+ const [source, setSource] = useState6(
4449
4607
  () => readParam(urlParams, "source")
4450
4608
  );
4451
- const [trigger, setTrigger] = useState5(
4609
+ const [trigger, setTrigger] = useState6(
4452
4610
  () => readParam(urlParams, "trigger")
4453
4611
  );
4454
4612
  useEffect5(() => {
@@ -4460,14 +4618,14 @@ function LatestReports({
4460
4618
  });
4461
4619
  router.navigate({ ...router.state, _searchParams: params });
4462
4620
  }, [searchQuery, mode, source, trigger]);
4463
- const [initialLoading, setInitialLoading] = useState5(true);
4464
- const [loadingMore, setLoadingMore] = useState5(false);
4465
- const [reports, setReports] = useState5([]);
4466
- const [hasMore, setHasMore] = useState5(true);
4467
- const [modes, setModes] = useState5([]);
4468
- const [sources, setSources] = useState5([]);
4469
- const [triggers, setTriggers] = useState5([]);
4470
- const [sort, setSort] = useState5({
4621
+ const [initialLoading, setInitialLoading] = useState6(true);
4622
+ const [loadingMore, setLoadingMore] = useState6(false);
4623
+ const [reports, setReports] = useState6([]);
4624
+ const [hasMore, setHasMore] = useState6(true);
4625
+ const [modes, setModes] = useState6([]);
4626
+ const [sources, setSources] = useState6([]);
4627
+ const [triggers, setTriggers] = useState6([]);
4628
+ const [sort, setSort] = useState6({
4471
4629
  direction: "desc",
4472
4630
  field: "date"
4473
4631
  });
@@ -4559,13 +4717,13 @@ function LatestReports({
4559
4717
  setTrigger(null);
4560
4718
  }, []);
4561
4719
  if (initialLoading) {
4562
- return /* @__PURE__ */ jsx16(Card7, { padding: 4, children: /* @__PURE__ */ jsx16(Text14, { muted: true, children: "Loading reports\u2026" }) });
4720
+ return /* @__PURE__ */ jsx19(Card7, { padding: 4, children: /* @__PURE__ */ jsx19(Text17, { muted: true, children: "Loading reports\u2026" }) });
4563
4721
  }
4564
4722
  if (reports.length === 0 && !mode && !source) {
4565
- return /* @__PURE__ */ jsx16(Card7, { padding: 4, children: /* @__PURE__ */ jsx16(Text14, { muted: true, children: "No reports found. Run the pipeline with --publish to create reports." }) });
4723
+ return /* @__PURE__ */ jsx19(Card7, { padding: 4, children: /* @__PURE__ */ jsx19(Text17, { muted: true, children: "No reports found. Run the pipeline with --publish to create reports." }) });
4566
4724
  }
4567
- return /* @__PURE__ */ jsxs13(Stack10, { space: 0, children: [
4568
- /* @__PURE__ */ jsx16(
4725
+ return /* @__PURE__ */ jsxs14(Stack10, { space: 0, children: [
4726
+ /* @__PURE__ */ jsx19(
4569
4727
  FilterBar,
4570
4728
  {
4571
4729
  filteredCount: filteredReports.length,
@@ -4584,9 +4742,9 @@ function LatestReports({
4584
4742
  triggers
4585
4743
  }
4586
4744
  ),
4587
- filteredReports.length === 0 ? /* @__PURE__ */ jsx16(Card7, { padding: 4, radius: 2, children: /* @__PURE__ */ jsxs13(Stack10, { space: 3, children: [
4588
- /* @__PURE__ */ jsx16(Text14, { align: "center", muted: true, size: 3, children: "No reports match the current filters." }),
4589
- /* @__PURE__ */ jsx16(Flex10, { justify: "center", children: /* @__PURE__ */ jsx16(
4745
+ filteredReports.length === 0 ? /* @__PURE__ */ jsx19(Card7, { padding: 4, radius: 2, children: /* @__PURE__ */ jsxs14(Stack10, { space: 3, children: [
4746
+ /* @__PURE__ */ jsx19(Text17, { align: "center", muted: true, size: 3, children: "No reports match the current filters." }),
4747
+ /* @__PURE__ */ jsx19(Flex11, { justify: "center", children: /* @__PURE__ */ jsx19(
4590
4748
  Button,
4591
4749
  {
4592
4750
  fontSize: 2,
@@ -4595,7 +4753,7 @@ function LatestReports({
4595
4753
  text: "Clear filters"
4596
4754
  }
4597
4755
  ) })
4598
- ] }) }) : /* @__PURE__ */ jsx16(
4756
+ ] }) }) : /* @__PURE__ */ jsx19(
4599
4757
  ReportTable,
4600
4758
  {
4601
4759
  onSelectReport,
@@ -4604,7 +4762,7 @@ function LatestReports({
4604
4762
  sort
4605
4763
  }
4606
4764
  ),
4607
- hasMore && /* @__PURE__ */ jsx16(Flex10, { justify: "center", paddingY: 3, children: /* @__PURE__ */ jsx16(
4765
+ hasMore && /* @__PURE__ */ jsx19(Flex11, { justify: "center", paddingY: 3, children: /* @__PURE__ */ jsx19(
4608
4766
  Button,
4609
4767
  {
4610
4768
  disabled: loadingMore,
@@ -4620,43 +4778,84 @@ function LatestReports({
4620
4778
  // src/components/report-detail/ReportDetail.tsx
4621
4779
  import { ArrowLeftIcon as ArrowLeftIcon2 } from "@sanity/icons";
4622
4780
  import {
4781
+ Badge as Badge7,
4623
4782
  Box as Box20,
4624
- Button as Button5,
4625
- Flex as Flex24,
4783
+ Button as Button7,
4784
+ Flex as Flex25,
4626
4785
  Stack as Stack24,
4627
4786
  Tab,
4628
4787
  TabList,
4629
4788
  TabPanel,
4630
- Text as Text30,
4631
- Tooltip as Tooltip9
4789
+ Text as Text31,
4790
+ Tooltip as Tooltip8
4632
4791
  } from "@sanity/ui";
4633
4792
  import {
4634
- useCallback as useCallback19,
4635
- useEffect as useEffect7,
4793
+ useCallback as useCallback20,
4794
+ useEffect as useEffect8,
4636
4795
  useMemo as useMemo7,
4637
4796
  useState as useState15
4638
4797
  } from "react";
4639
4798
  import { useClient as useClient10 } from "sanity";
4640
4799
 
4800
+ // src/lib/thresholds.ts
4801
+ var SCORE_POSITIVE = 80;
4802
+ var SCORE_CAUTION = 70;
4803
+ var DIMENSION_WEAKNESS = 50;
4804
+ function scoreSentiment(score) {
4805
+ if (score >= SCORE_POSITIVE) return "positive";
4806
+ if (score >= SCORE_CAUTION) return "caution";
4807
+ return "critical";
4808
+ }
4809
+ var DOC_LIFT_POSITIVE = 10;
4810
+ var DOC_LIFT_CAUTION = 5;
4811
+ function docLiftSentiment(docLift) {
4812
+ if (docLift < 0) return "critical";
4813
+ if (docLift >= DOC_LIFT_POSITIVE) return "positive";
4814
+ if (docLift >= DOC_LIFT_CAUTION) return "caution";
4815
+ return "critical";
4816
+ }
4817
+ var RET_GAP_POSITIVE = 5;
4818
+ var RET_GAP_CAUTION = 15;
4819
+ function retrievalGapSentiment(gap) {
4820
+ if (gap <= RET_GAP_POSITIVE) return "positive";
4821
+ if (gap <= RET_GAP_CAUTION) return "caution";
4822
+ return "critical";
4823
+ }
4824
+ var EFFICIENCY_POSITIVE = 0.85;
4825
+ var EFFICIENCY_CAUTION = 0.7;
4826
+ var EFFICIENCY_ANOMALY = 1.05;
4827
+ function efficiencySentiment(efficiency) {
4828
+ if (efficiency >= EFFICIENCY_POSITIVE) return "positive";
4829
+ if (efficiency >= EFFICIENCY_CAUTION) return "caution";
4830
+ return "critical";
4831
+ }
4832
+ var NEG_DOC_LIFT_POSITIVE = 0;
4833
+ var NEG_DOC_LIFT_CAUTION = 2;
4834
+ function negativeDocLiftSentiment(count) {
4835
+ if (count <= NEG_DOC_LIFT_POSITIVE) return "positive";
4836
+ if (count <= NEG_DOC_LIFT_CAUTION) return "caution";
4837
+ return "critical";
4838
+ }
4839
+
4641
4840
  // src/components/report-detail/AgentActivitySection.tsx
4642
- import { useMemo as useMemo5, useState as useState6 } from "react";
4643
- import { HelpCircleIcon as HelpCircleIcon5, SearchIcon as SearchIcon3 } from "@sanity/icons";
4841
+ import { useMemo as useMemo5, useState as useState7 } from "react";
4842
+ import { HelpCircleIcon as HelpCircleIcon6, SearchIcon as SearchIcon3 } from "@sanity/icons";
4644
4843
  import {
4645
4844
  Badge as Badge5,
4646
- Box as Box9,
4845
+ Box as Box11,
4647
4846
  Card as Card9,
4648
- Flex as Flex11,
4847
+ Flex as Flex12,
4649
4848
  Grid as Grid2,
4650
4849
  Stack as Stack12,
4651
- Text as Text16,
4850
+ Text as Text19,
4652
4851
  TextInput as TextInput2,
4653
- Tooltip as Tooltip4
4852
+ Tooltip as Tooltip6
4654
4853
  } from "@sanity/ui";
4655
4854
 
4656
4855
  // src/components/primitives/StatCard.tsx
4657
- import { HelpCircleIcon as HelpCircleIcon4 } from "@sanity/icons";
4658
- import { Box as Box8, Card as Card8, Stack as Stack11, Text as Text15, Tooltip as Tooltip3 } from "@sanity/ui";
4659
- import { Fragment as Fragment6, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
4856
+ import { HelpCircleIcon as HelpCircleIcon5 } from "@sanity/icons";
4857
+ import { Box as Box10, Card as Card8, Stack as Stack11, Text as Text18, Tooltip as Tooltip5 } from "@sanity/ui";
4858
+ import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
4660
4859
  function StatCard({
4661
4860
  label,
4662
4861
  value,
@@ -4664,24 +4863,24 @@ function StatCard({
4664
4863
  suffix,
4665
4864
  tone = "default"
4666
4865
  }) {
4667
- return /* @__PURE__ */ jsx17(Card8, { padding: 3, radius: 2, shadow: 1, tone, children: /* @__PURE__ */ jsxs14(Stack11, { space: 2, children: [
4668
- /* @__PURE__ */ jsxs14(Text15, { muted: true, size: 2, children: [
4866
+ return /* @__PURE__ */ jsx20(Card8, { padding: 3, radius: 2, shadow: 1, tone, children: /* @__PURE__ */ jsxs15(Stack11, { space: 2, children: [
4867
+ /* @__PURE__ */ jsxs15(Text18, { muted: true, size: 2, children: [
4669
4868
  label,
4670
- tooltip && /* @__PURE__ */ jsxs14(Fragment6, { children: [
4869
+ tooltip && /* @__PURE__ */ jsxs15(Fragment6, { children: [
4671
4870
  " ",
4672
- /* @__PURE__ */ jsx17(
4673
- Tooltip3,
4871
+ /* @__PURE__ */ jsx20(
4872
+ Tooltip5,
4674
4873
  {
4675
- content: /* @__PURE__ */ jsx17(Box8, { padding: 2, children: /* @__PURE__ */ jsx17(Text15, { size: 2, children: tooltip }) }),
4874
+ content: /* @__PURE__ */ jsx20(Box10, { padding: 2, children: /* @__PURE__ */ jsx20(Text18, { size: 2, children: tooltip }) }),
4676
4875
  portal: true,
4677
- children: /* @__PURE__ */ jsx17("span", { style: { cursor: "help" }, children: /* @__PURE__ */ jsx17(HelpCircleIcon4, {}) })
4876
+ children: /* @__PURE__ */ jsx20("span", { style: { cursor: "help" }, children: /* @__PURE__ */ jsx20(HelpCircleIcon5, {}) })
4678
4877
  }
4679
4878
  )
4680
4879
  ] })
4681
4880
  ] }),
4682
- /* @__PURE__ */ jsxs14(Text15, { size: 4, weight: "bold", children: [
4881
+ /* @__PURE__ */ jsxs15(Text18, { size: 4, weight: "bold", children: [
4683
4882
  value,
4684
- suffix && /* @__PURE__ */ jsxs14("span", { style: { fontSize: "0.6em", fontWeight: 400 }, children: [
4883
+ suffix && /* @__PURE__ */ jsxs15("span", { style: { fontSize: "0.6em", fontWeight: 400 }, children: [
4685
4884
  " ",
4686
4885
  suffix
4687
4886
  ] })
@@ -4690,24 +4889,24 @@ function StatCard({
4690
4889
  }
4691
4890
 
4692
4891
  // src/components/report-detail/AgentActivitySection.tsx
4693
- import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
4892
+ import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
4694
4893
  function AgentActivitySection({
4695
4894
  agentBehavior,
4696
4895
  overall
4697
4896
  }) {
4698
- return /* @__PURE__ */ jsxs15(Stack12, { space: 5, children: [
4699
- overall && /* @__PURE__ */ jsx18(OverviewGrid, { overall }),
4700
- agentBehavior.map((ab) => /* @__PURE__ */ jsx18(FeatureActivityCard, { behavior: ab }, ab.feature))
4897
+ return /* @__PURE__ */ jsxs16(Stack12, { space: 5, children: [
4898
+ overall && /* @__PURE__ */ jsx21(OverviewGrid, { overall }),
4899
+ agentBehavior.map((ab) => /* @__PURE__ */ jsx21(FeatureActivityCard, { behavior: ab }, ab.feature))
4701
4900
  ] });
4702
4901
  }
4703
4902
  function OverviewGrid({ overall }) {
4704
- return /* @__PURE__ */ jsx18(Card9, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs15(Stack12, { space: 4, children: [
4705
- /* @__PURE__ */ jsxs15(Flex11, { align: "center", gap: 3, children: [
4706
- /* @__PURE__ */ jsx18(Text16, { size: 3, weight: "semibold", children: "Agent Activity Overview" }),
4707
- /* @__PURE__ */ jsx18(GlossaryTip, { text: GLOSSARY.agentBehaviorOverview })
4903
+ return /* @__PURE__ */ jsx21(Card9, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs16(Stack12, { space: 4, children: [
4904
+ /* @__PURE__ */ jsxs16(Flex12, { align: "center", gap: 3, children: [
4905
+ /* @__PURE__ */ jsx21(Text19, { size: 3, weight: "semibold", children: "Agent Activity Overview" }),
4906
+ /* @__PURE__ */ jsx21(GlossaryTip, { text: GLOSSARY.agentBehaviorOverview })
4708
4907
  ] }),
4709
- /* @__PURE__ */ jsxs15(Grid2, { columns: [1, 2, 3], gap: 3, children: [
4710
- /* @__PURE__ */ jsx18(
4908
+ /* @__PURE__ */ jsxs16(Grid2, { columns: [1, 2, 3], gap: 3, children: [
4909
+ /* @__PURE__ */ jsx21(
4711
4910
  StatCard,
4712
4911
  {
4713
4912
  label: "Avg Pages Visited",
@@ -4715,7 +4914,7 @@ function OverviewGrid({ overall }) {
4715
4914
  value: overall.avgDocPagesVisited.toFixed(1)
4716
4915
  }
4717
4916
  ),
4718
- /* @__PURE__ */ jsx18(
4917
+ /* @__PURE__ */ jsx21(
4719
4918
  StatCard,
4720
4919
  {
4721
4920
  label: "Avg Searches",
@@ -4723,7 +4922,7 @@ function OverviewGrid({ overall }) {
4723
4922
  value: overall.avgSearchesPerformed.toFixed(1)
4724
4923
  }
4725
4924
  ),
4726
- /* @__PURE__ */ jsx18(
4925
+ /* @__PURE__ */ jsx21(
4727
4926
  StatCard,
4728
4927
  {
4729
4928
  label: "Avg Network Time",
@@ -4731,7 +4930,7 @@ function OverviewGrid({ overall }) {
4731
4930
  value: formatDuration(overall.avgNetworkTimeMs)
4732
4931
  }
4733
4932
  ),
4734
- /* @__PURE__ */ jsx18(
4933
+ /* @__PURE__ */ jsx21(
4735
4934
  StatCard,
4736
4935
  {
4737
4936
  label: "Unique Doc Slugs",
@@ -4739,7 +4938,7 @@ function OverviewGrid({ overall }) {
4739
4938
  value: String(overall.totalUniqueDocSlugs)
4740
4939
  }
4741
4940
  ),
4742
- /* @__PURE__ */ jsx18(
4941
+ /* @__PURE__ */ jsx21(
4743
4942
  StatCard,
4744
4943
  {
4745
4944
  label: "Unique Search Queries",
@@ -4747,7 +4946,7 @@ function OverviewGrid({ overall }) {
4747
4946
  value: String(overall.totalUniqueSearchQueries)
4748
4947
  }
4749
4948
  ),
4750
- /* @__PURE__ */ jsx18(
4949
+ /* @__PURE__ */ jsx21(
4751
4950
  StatCard,
4752
4951
  {
4753
4952
  label: "Tests with Data",
@@ -4760,31 +4959,31 @@ function OverviewGrid({ overall }) {
4760
4959
  function FeatureActivityCard({
4761
4960
  behavior
4762
4961
  }) {
4763
- return /* @__PURE__ */ jsx18(Card9, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs15(Stack12, { space: 4, children: [
4764
- /* @__PURE__ */ jsxs15(Flex11, { align: "center", gap: 3, wrap: "wrap", children: [
4765
- /* @__PURE__ */ jsx18(Text16, { size: 3, weight: "semibold", children: behavior.feature }),
4766
- /* @__PURE__ */ jsxs15(Badge5, { tone: "primary", children: [
4962
+ return /* @__PURE__ */ jsx21(Card9, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs16(Stack12, { space: 4, children: [
4963
+ /* @__PURE__ */ jsxs16(Flex12, { align: "center", gap: 3, wrap: "wrap", children: [
4964
+ /* @__PURE__ */ jsx21(Text19, { size: 3, weight: "semibold", children: behavior.feature }),
4965
+ /* @__PURE__ */ jsxs16(Badge5, { tone: "primary", children: [
4767
4966
  behavior.tasksWithBehaviorData,
4768
4967
  " test",
4769
4968
  behavior.tasksWithBehaviorData === 1 ? "" : "s"
4770
4969
  ] })
4771
4970
  ] }),
4772
- /* @__PURE__ */ jsxs15(Grid2, { columns: [1, 3], gap: 3, children: [
4773
- /* @__PURE__ */ jsx18(
4971
+ /* @__PURE__ */ jsxs16(Grid2, { columns: [1, 3], gap: 3, children: [
4972
+ /* @__PURE__ */ jsx21(
4774
4973
  MiniStat,
4775
4974
  {
4776
4975
  label: "Avg pages visited",
4777
4976
  value: behavior.avgDocPagesVisited.toFixed(1)
4778
4977
  }
4779
4978
  ),
4780
- /* @__PURE__ */ jsx18(
4979
+ /* @__PURE__ */ jsx21(
4781
4980
  MiniStat,
4782
4981
  {
4783
4982
  label: "Avg searches",
4784
4983
  value: behavior.avgSearchesPerformed.toFixed(1)
4785
4984
  }
4786
4985
  ),
4787
- /* @__PURE__ */ jsx18(
4986
+ /* @__PURE__ */ jsx21(
4788
4987
  MiniStat,
4789
4988
  {
4790
4989
  label: "Avg network time",
@@ -4792,8 +4991,8 @@ function FeatureActivityCard({
4792
4991
  }
4793
4992
  )
4794
4993
  ] }),
4795
- behavior.searchQueries.length > 0 && /* @__PURE__ */ jsx18(SearchQueryList, { queries: behavior.searchQueries }),
4796
- behavior.docSlugsVisited.length > 0 && /* @__PURE__ */ jsx18(
4994
+ behavior.searchQueries.length > 0 && /* @__PURE__ */ jsx21(SearchQueryList, { queries: behavior.searchQueries }),
4995
+ behavior.docSlugsVisited.length > 0 && /* @__PURE__ */ jsx21(
4797
4996
  BadgeList,
4798
4997
  {
4799
4998
  items: behavior.docSlugsVisited,
@@ -4802,7 +5001,7 @@ function FeatureActivityCard({
4802
5001
  tooltip: GLOSSARY.docSlugsVisited
4803
5002
  }
4804
5003
  ),
4805
- behavior.externalDomains.length > 0 && /* @__PURE__ */ jsx18(
5004
+ behavior.externalDomains.length > 0 && /* @__PURE__ */ jsx21(
4806
5005
  BadgeList,
4807
5006
  {
4808
5007
  items: behavior.externalDomains,
@@ -4814,19 +5013,19 @@ function FeatureActivityCard({
4814
5013
  ] }) });
4815
5014
  }
4816
5015
  function SearchQueryList({ queries }) {
4817
- const [filter, setFilter] = useState6("");
5016
+ const [filter, setFilter] = useState7("");
4818
5017
  const filtered = useMemo5(() => {
4819
5018
  if (!filter) return queries;
4820
5019
  const lower = filter.toLowerCase();
4821
5020
  return queries.filter((q) => q.toLowerCase().includes(lower));
4822
5021
  }, [queries, filter]);
4823
- return /* @__PURE__ */ jsxs15(Stack12, { space: 3, children: [
4824
- /* @__PURE__ */ jsxs15(Flex11, { align: "center", gap: 3, wrap: "wrap", children: [
4825
- /* @__PURE__ */ jsx18(Text16, { size: 2, weight: "semibold", children: "Search Queries" }),
4826
- /* @__PURE__ */ jsx18(GlossaryTip, { text: GLOSSARY.searchQueries }),
4827
- /* @__PURE__ */ jsx18(Badge5, { tone: "default", children: queries.length })
5022
+ return /* @__PURE__ */ jsxs16(Stack12, { space: 3, children: [
5023
+ /* @__PURE__ */ jsxs16(Flex12, { align: "center", gap: 3, wrap: "wrap", children: [
5024
+ /* @__PURE__ */ jsx21(Text19, { size: 2, weight: "semibold", children: "Search Queries" }),
5025
+ /* @__PURE__ */ jsx21(GlossaryTip, { text: GLOSSARY.searchQueries }),
5026
+ /* @__PURE__ */ jsx21(Badge5, { tone: "default", children: queries.length })
4828
5027
  ] }),
4829
- queries.length > 5 && /* @__PURE__ */ jsx18(
5028
+ queries.length > 5 && /* @__PURE__ */ jsx21(
4830
5029
  TextInput2,
4831
5030
  {
4832
5031
  fontSize: 2,
@@ -4836,7 +5035,7 @@ function SearchQueryList({ queries }) {
4836
5035
  value: filter
4837
5036
  }
4838
5037
  ),
4839
- /* @__PURE__ */ jsx18(
5038
+ /* @__PURE__ */ jsx21(
4840
5039
  Card9,
4841
5040
  {
4842
5041
  overflow: "auto",
@@ -4844,10 +5043,10 @@ function SearchQueryList({ queries }) {
4844
5043
  radius: 2,
4845
5044
  style: { maxHeight: 300 },
4846
5045
  tone: "transparent",
4847
- children: /* @__PURE__ */ jsxs15(Stack12, { space: 2, children: [
4848
- filtered.length === 0 && /* @__PURE__ */ jsx18(Text16, { muted: true, size: 2, children: "No matching queries" }),
4849
- filtered.map((query, i) => /* @__PURE__ */ jsx18(
4850
- Text16,
5046
+ children: /* @__PURE__ */ jsxs16(Stack12, { space: 2, children: [
5047
+ filtered.length === 0 && /* @__PURE__ */ jsx21(Text19, { muted: true, size: 2, children: "No matching queries" }),
5048
+ filtered.map((query, i) => /* @__PURE__ */ jsx21(
5049
+ Text19,
4851
5050
  {
4852
5051
  muted: true,
4853
5052
  size: 2,
@@ -4871,19 +5070,19 @@ function BadgeList({
4871
5070
  tone,
4872
5071
  tooltip
4873
5072
  }) {
4874
- return /* @__PURE__ */ jsxs15(Stack12, { space: 3, children: [
4875
- /* @__PURE__ */ jsxs15(Flex11, { align: "center", gap: 3, wrap: "wrap", children: [
4876
- /* @__PURE__ */ jsx18(Text16, { size: 2, weight: "semibold", children: label }),
4877
- tooltip && /* @__PURE__ */ jsx18(GlossaryTip, { text: tooltip }),
4878
- /* @__PURE__ */ jsx18(Badge5, { tone: "default", children: items.length })
5073
+ return /* @__PURE__ */ jsxs16(Stack12, { space: 3, children: [
5074
+ /* @__PURE__ */ jsxs16(Flex12, { align: "center", gap: 3, wrap: "wrap", children: [
5075
+ /* @__PURE__ */ jsx21(Text19, { size: 2, weight: "semibold", children: label }),
5076
+ tooltip && /* @__PURE__ */ jsx21(GlossaryTip, { text: tooltip }),
5077
+ /* @__PURE__ */ jsx21(Badge5, { tone: "default", children: items.length })
4879
5078
  ] }),
4880
- /* @__PURE__ */ jsx18(Flex11, { gap: 2, wrap: "wrap", children: items.map((item) => /* @__PURE__ */ jsx18(Badge5, { mode: "outline", tone, children: item }, item)) })
5079
+ /* @__PURE__ */ jsx21(Flex12, { gap: 2, wrap: "wrap", children: items.map((item) => /* @__PURE__ */ jsx21(Badge5, { mode: "outline", tone, children: item }, item)) })
4881
5080
  ] });
4882
5081
  }
4883
5082
  function MiniStat({ label, value }) {
4884
- return /* @__PURE__ */ jsxs15(Stack12, { space: 1, children: [
4885
- /* @__PURE__ */ jsx18(
4886
- Text16,
5083
+ return /* @__PURE__ */ jsxs16(Stack12, { space: 1, children: [
5084
+ /* @__PURE__ */ jsx21(
5085
+ Text19,
4887
5086
  {
4888
5087
  muted: true,
4889
5088
  size: 1,
@@ -4892,17 +5091,17 @@ function MiniStat({ label, value }) {
4892
5091
  children: label
4893
5092
  }
4894
5093
  ),
4895
- /* @__PURE__ */ jsx18(Text16, { size: 3, weight: "bold", children: value })
5094
+ /* @__PURE__ */ jsx21(Text19, { size: 3, weight: "bold", children: value })
4896
5095
  ] });
4897
5096
  }
4898
5097
  function GlossaryTip({ text }) {
4899
- return /* @__PURE__ */ jsx18(
4900
- Tooltip4,
5098
+ return /* @__PURE__ */ jsx21(
5099
+ Tooltip6,
4901
5100
  {
4902
- content: /* @__PURE__ */ jsx18(Box9, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx18(Text16, { size: 2, children: text }) }),
5101
+ content: /* @__PURE__ */ jsx21(Box11, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx21(Text19, { size: 2, children: text }) }),
4903
5102
  placement: "bottom",
4904
5103
  portal: true,
4905
- children: /* @__PURE__ */ jsx18(Text16, { muted: true, size: 1, children: /* @__PURE__ */ jsx18(HelpCircleIcon5, {}) })
5104
+ children: /* @__PURE__ */ jsx21(Text19, { muted: true, size: 1, children: /* @__PURE__ */ jsx21(HelpCircleIcon6, {}) })
4906
5105
  }
4907
5106
  );
4908
5107
  }
@@ -4915,7 +5114,7 @@ import {
4915
5114
  ErrorOutlineIcon,
4916
5115
  WarningOutlineIcon
4917
5116
  } from "@sanity/icons";
4918
- import { Box as Box11, Flex as Flex12, Stack as Stack13, Text as Text18 } from "@sanity/ui";
5117
+ import { Box as Box12, Flex as Flex13, Stack as Stack13, Text as Text20 } from "@sanity/ui";
4919
5118
 
4920
5119
  // src/components/report-detail/diagnostics-styles.ts
4921
5120
  var COLORS = {
@@ -4946,8 +5145,8 @@ var COLORS = {
4946
5145
  }
4947
5146
  };
4948
5147
  function colorForScore(score) {
4949
- if (score >= 80) return "emerald";
4950
- if (score >= 70) return "amber";
5148
+ if (score >= SCORE_POSITIVE) return "emerald";
5149
+ if (score >= SCORE_CAUTION) return "amber";
4951
5150
  if (score >= 50) return "orange";
4952
5151
  return "red";
4953
5152
  }
@@ -4990,15 +5189,10 @@ function barFillColor(score) {
4990
5189
  return "var(--card-border-color)";
4991
5190
  }
4992
5191
  }
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
5192
  function efficiencyColor(eff) {
4999
5193
  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;
5194
+ if (eff >= EFFICIENCY_POSITIVE) return COLORS.emerald.text;
5195
+ if (eff >= EFFICIENCY_CAUTION) return COLORS.amber.text;
5002
5196
  return COLORS.red.text;
5003
5197
  }
5004
5198
  function sectionStyle(color) {
@@ -5016,37 +5210,25 @@ var neutralCardStyle = {
5016
5210
  var dividerStyle = {
5017
5211
  borderTop: "1px solid var(--card-border-color)"
5018
5212
  };
5019
-
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";
5023
- import { jsx as jsx19 } from "react/jsx-runtime";
5024
- function InfoTip({ text }) {
5025
- return /* @__PURE__ */ jsx19(
5026
- Tooltip5,
5027
- {
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
- )
5044
- }
5045
- );
5213
+ function sentimentColorKey(sentiment) {
5214
+ switch (sentiment) {
5215
+ case "positive":
5216
+ return "emerald";
5217
+ case "caution":
5218
+ return "amber";
5219
+ case "critical":
5220
+ return "red";
5221
+ }
5222
+ }
5223
+ function sentimentCardStyle(sentiment) {
5224
+ return sectionStyle(sentimentColorKey(sentiment));
5225
+ }
5226
+ function sentimentTextColor(sentiment) {
5227
+ return COLORS[sentimentColorKey(sentiment)].text;
5046
5228
  }
5047
5229
 
5048
5230
  // src/components/report-detail/DiagnosticsOverview.tsx
5049
- import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
5231
+ import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
5050
5232
  function DiagnosticsOverview({
5051
5233
  scores,
5052
5234
  overall,
@@ -5055,18 +5237,18 @@ function DiagnosticsOverview({
5055
5237
  totalTests
5056
5238
  }) {
5057
5239
  if (scores.length === 0) return null;
5058
- const strong = scores.filter((s) => s.totalScore >= 80);
5240
+ const strong = scores.filter((s) => s.totalScore >= SCORE_POSITIVE);
5059
5241
  const attention = scores.filter(
5060
- (s) => s.totalScore >= 70 && s.totalScore < 80
5242
+ (s) => s.totalScore >= SCORE_CAUTION && s.totalScore < SCORE_POSITIVE
5061
5243
  );
5062
- const weak = scores.filter((s) => s.totalScore < 70);
5244
+ const weak = scores.filter((s) => s.totalScore < SCORE_CAUTION);
5063
5245
  const negativeDocLiftCount = scores.filter((s) => s.docLift < 0).length;
5064
5246
  const improved = comparison?.improved ?? [];
5065
5247
  const regressed = comparison?.regressed ?? [];
5066
5248
  const unchanged = comparison?.unchanged ?? [];
5067
5249
  const hasComparison = improved.length > 0 || regressed.length > 0 || unchanged.length > 0;
5068
- return /* @__PURE__ */ jsxs16(Stack13, { space: 4, children: [
5069
- /* @__PURE__ */ jsxs16(
5250
+ return /* @__PURE__ */ jsxs17(Stack13, { space: 4, children: [
5251
+ /* @__PURE__ */ jsxs17(
5070
5252
  "div",
5071
5253
  {
5072
5254
  style: {
@@ -5075,95 +5257,94 @@ function DiagnosticsOverview({
5075
5257
  gridTemplateColumns: "repeat(4, 1fr)"
5076
5258
  },
5077
5259
  children: [
5078
- /* @__PURE__ */ jsx20(
5260
+ /* @__PURE__ */ jsx22(HoverTip, { display: "block", text: GLOSSARY.overallScore, children: /* @__PURE__ */ jsx22(
5079
5261
  ScoreCard,
5080
5262
  {
5081
5263
  delta: comparison?.deltas.overall,
5082
- infoTip: GLOSSARY.overallScore,
5083
5264
  label: "AVG SCORE",
5265
+ sentiment: scoreSentiment(overall.avgScore),
5084
5266
  subtitle: "Overall quality score",
5085
5267
  value: Math.round(overall.avgScore)
5086
5268
  }
5087
- ),
5088
- /* @__PURE__ */ jsx20(
5269
+ ) }),
5270
+ /* @__PURE__ */ jsx22(HoverTip, { display: "block", text: GLOSSARY.docLift, children: /* @__PURE__ */ jsx22(
5089
5271
  ScoreCard,
5090
5272
  {
5091
5273
  delta: comparison?.deltas.docLift,
5092
- infoTip: GLOSSARY.docLift,
5093
5274
  label: "AVG DOC LIFT",
5275
+ sentiment: docLiftSentiment(overall.avgDocLift),
5094
5276
  subtitle: "Improvement with docs",
5095
5277
  value: Math.round(overall.avgDocLift)
5096
5278
  }
5097
- ),
5098
- /* @__PURE__ */ jsx20(
5279
+ ) }),
5280
+ /* @__PURE__ */ jsx22(HoverTip, { display: "block", text: GLOSSARY.ceiling, children: /* @__PURE__ */ jsx22(
5099
5281
  ScoreCard,
5100
5282
  {
5101
- infoTip: GLOSSARY.ceiling,
5102
5283
  label: "AVG CEILING",
5284
+ sentiment: scoreSentiment(overall.avgCeilingScore ?? 0),
5103
5285
  subtitle: "Best case performance",
5104
5286
  value: Math.round(overall.avgCeilingScore ?? 0)
5105
5287
  }
5106
- ),
5107
- overall.avgInfrastructureEfficiency != null ? /* @__PURE__ */ jsx20(
5288
+ ) }),
5289
+ overall.avgInfrastructureEfficiency != null ? /* @__PURE__ */ jsx22(HoverTip, { display: "block", text: GLOSSARY.infraEfficiency, children: /* @__PURE__ */ jsx22(
5108
5290
  ScoreCard,
5109
5291
  {
5110
- infoTip: GLOSSARY.infraEfficiency,
5111
5292
  label: "EFFICIENCY",
5293
+ sentiment: efficiencySentiment(
5294
+ overall.avgInfrastructureEfficiency
5295
+ ),
5112
5296
  subtitle: "Infra utilization",
5113
5297
  suffix: "%",
5114
5298
  value: Math.round(overall.avgInfrastructureEfficiency * 100)
5115
5299
  }
5116
- ) : /* @__PURE__ */ jsx20(
5300
+ ) }) : /* @__PURE__ */ jsx22(HoverTip, { display: "block", text: GLOSSARY.floor, children: /* @__PURE__ */ jsx22(
5117
5301
  ScoreCard,
5118
5302
  {
5119
- infoTip: GLOSSARY.floor,
5120
5303
  label: "AVG FLOOR",
5304
+ sentiment: scoreSentiment(overall.avgFloorScore ?? 0),
5121
5305
  subtitle: "Model-only baseline",
5122
5306
  value: Math.round(overall.avgFloorScore ?? 0)
5123
5307
  }
5124
- )
5308
+ ) })
5125
5309
  ]
5126
5310
  }
5127
5311
  ),
5128
- /* @__PURE__ */ jsxs16(
5312
+ /* @__PURE__ */ jsxs17(
5129
5313
  "div",
5130
5314
  {
5131
5315
  style: { display: "grid", gap: 12, gridTemplateColumns: "1fr 1fr 1fr" },
5132
5316
  children: [
5133
- /* @__PURE__ */ jsx20(
5317
+ /* @__PURE__ */ jsx22(HoverTip, { display: "block", text: GLOSSARY.healthStrong, children: /* @__PURE__ */ jsx22(
5134
5318
  HealthCard,
5135
5319
  {
5136
- color: "emerald",
5320
+ color: strong.length > 0 ? "emerald" : "muted",
5137
5321
  count: strong.length,
5138
- icon: /* @__PURE__ */ jsx20(CheckmarkCircleIcon, {}),
5139
- infoTip: GLOSSARY.healthStrong,
5322
+ icon: /* @__PURE__ */ jsx22(CheckmarkCircleIcon, {}),
5140
5323
  label: "Strong (80+)"
5141
5324
  }
5142
- ),
5143
- /* @__PURE__ */ jsx20(
5325
+ ) }),
5326
+ /* @__PURE__ */ jsx22(HoverTip, { display: "block", text: GLOSSARY.healthAttention, children: /* @__PURE__ */ jsx22(
5144
5327
  HealthCard,
5145
5328
  {
5146
- color: "amber",
5329
+ color: attention.length === 0 ? "muted" : "amber",
5147
5330
  count: attention.length,
5148
- icon: /* @__PURE__ */ jsx20(WarningOutlineIcon, {}),
5149
- infoTip: GLOSSARY.healthAttention,
5331
+ icon: /* @__PURE__ */ jsx22(WarningOutlineIcon, {}),
5150
5332
  label: "Attention (70-79)"
5151
5333
  }
5152
- ),
5153
- /* @__PURE__ */ jsx20(
5334
+ ) }),
5335
+ /* @__PURE__ */ jsx22(HoverTip, { display: "block", text: GLOSSARY.healthWeak, children: /* @__PURE__ */ jsx22(
5154
5336
  HealthCard,
5155
5337
  {
5156
- color: "red",
5338
+ color: weak.length === 0 ? "muted" : "red",
5157
5339
  count: weak.length,
5158
- icon: /* @__PURE__ */ jsx20(ErrorOutlineIcon, {}),
5159
- infoTip: GLOSSARY.healthWeak,
5340
+ icon: /* @__PURE__ */ jsx22(ErrorOutlineIcon, {}),
5160
5341
  label: "Weak (<70)"
5161
5342
  }
5162
- )
5343
+ ) })
5163
5344
  ]
5164
5345
  }
5165
5346
  ),
5166
- /* @__PURE__ */ jsxs16(
5347
+ /* @__PURE__ */ jsxs17(
5167
5348
  "div",
5168
5349
  {
5169
5350
  style: {
@@ -5172,61 +5353,60 @@ function DiagnosticsOverview({
5172
5353
  gridTemplateColumns: "repeat(auto-fit, minmax(140px, 1fr))"
5173
5354
  },
5174
5355
  children: [
5175
- /* @__PURE__ */ jsx20(
5356
+ /* @__PURE__ */ jsx22(HoverTip, { display: "block", text: GLOSSARY.floor, children: /* @__PURE__ */ jsx22(
5176
5357
  MetricCard,
5177
5358
  {
5178
- infoTip: GLOSSARY.floor,
5179
5359
  label: "Avg Floor",
5360
+ sentiment: scoreSentiment(overall.avgFloorScore ?? 0),
5180
5361
  value: String(Math.round(overall.avgFloorScore ?? 0))
5181
5362
  }
5182
- ),
5183
- overall.avgActualScore != null && /* @__PURE__ */ jsx20(
5363
+ ) }),
5364
+ overall.avgActualScore != null && /* @__PURE__ */ jsx22(HoverTip, { display: "block", text: GLOSSARY.actualScore, children: /* @__PURE__ */ jsx22(
5184
5365
  MetricCard,
5185
5366
  {
5186
- infoTip: GLOSSARY.actualScore,
5187
5367
  label: "Avg Actual",
5368
+ sentiment: scoreSentiment(overall.avgActualScore),
5188
5369
  value: String(Math.round(overall.avgActualScore))
5189
5370
  }
5190
- ),
5191
- overall.avgRetrievalGap != null && /* @__PURE__ */ jsx20(
5371
+ ) }),
5372
+ overall.avgRetrievalGap != null && /* @__PURE__ */ jsx22(HoverTip, { display: "block", text: GLOSSARY.retrievalGap, children: /* @__PURE__ */ jsx22(
5192
5373
  MetricCard,
5193
5374
  {
5194
- infoTip: GLOSSARY.retrievalGap,
5195
5375
  label: "Avg Retrieval Gap",
5376
+ sentiment: retrievalGapSentiment(overall.avgRetrievalGap),
5196
5377
  value: overall.avgRetrievalGap.toFixed(1)
5197
5378
  }
5198
- ),
5199
- /* @__PURE__ */ jsx20(
5379
+ ) }),
5380
+ /* @__PURE__ */ jsx22(HoverTip, { display: "block", text: GLOSSARY.negativeDocLiftMetric, children: /* @__PURE__ */ jsx22(
5200
5381
  MetricCard,
5201
5382
  {
5202
- highlight: negativeDocLiftCount > 0,
5203
- infoTip: GLOSSARY.negativeDocLiftMetric,
5204
5383
  label: "Negative Doc Lift",
5384
+ sentiment: negativeDocLiftSentiment(negativeDocLiftCount),
5205
5385
  value: `${negativeDocLiftCount} area${negativeDocLiftCount === 1 ? "" : "s"}`
5206
5386
  }
5207
- ),
5208
- totalTests != null && /* @__PURE__ */ jsx20(
5209
- MetricCard,
5387
+ ) }),
5388
+ totalTests != null && /* @__PURE__ */ jsx22(HoverTip, { display: "block", text: GLOSSARY.tests, children: /* @__PURE__ */ jsx22(MetricCard, { label: "Tests", value: String(totalTests) }) }),
5389
+ durationMs != null && durationMs > 0 && /* @__PURE__ */ jsx22(
5390
+ HoverTip,
5210
5391
  {
5211
- infoTip: GLOSSARY.tests,
5212
- label: "Tests",
5213
- value: String(totalTests)
5392
+ display: "block",
5393
+ text: "Total wall-clock time for the evaluation pipeline run.",
5394
+ children: /* @__PURE__ */ jsx22(MetricCard, { label: "Duration", value: formatDuration(durationMs) })
5214
5395
  }
5215
- ),
5216
- durationMs != null && durationMs > 0 && /* @__PURE__ */ jsx20(MetricCard, { label: "Duration", value: formatDuration(durationMs) })
5396
+ )
5217
5397
  ]
5218
5398
  }
5219
5399
  ),
5220
- hasComparison && /* @__PURE__ */ jsxs16(Box11, { style: neutralCardStyle, children: [
5221
- /* @__PURE__ */ jsx20(
5222
- Box11,
5400
+ hasComparison && /* @__PURE__ */ jsxs17(Box12, { style: neutralCardStyle, children: [
5401
+ /* @__PURE__ */ jsx22(
5402
+ Box12,
5223
5403
  {
5224
5404
  padding: 4,
5225
5405
  style: { borderBottom: "1px solid var(--card-border-color)" },
5226
- children: /* @__PURE__ */ jsx20(Text18, { size: 3, weight: "semibold", children: "Change from Previous Run" })
5406
+ children: /* @__PURE__ */ jsx22(Text20, { size: 3, weight: "semibold", children: "Change from Previous Run" })
5227
5407
  }
5228
5408
  ),
5229
- /* @__PURE__ */ jsxs16(
5409
+ /* @__PURE__ */ jsxs17(
5230
5410
  "div",
5231
5411
  {
5232
5412
  style: {
@@ -5234,43 +5414,43 @@ function DiagnosticsOverview({
5234
5414
  gridTemplateColumns: "1fr 1fr 1fr"
5235
5415
  },
5236
5416
  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: [
5417
+ /* @__PURE__ */ jsx22(Box12, { padding: 4, children: /* @__PURE__ */ jsxs17(Stack13, { space: 3, children: [
5418
+ /* @__PURE__ */ jsxs17(Flex13, { align: "center", gap: 2, children: [
5419
+ /* @__PURE__ */ jsx22(ArrowUpIcon, { style: { color: "#34d399" } }),
5420
+ /* @__PURE__ */ jsxs17(Text20, { size: 2, style: { color: "#34d399" }, weight: "medium", children: [
5241
5421
  "Improved (",
5242
5422
  improved.length,
5243
5423
  ")"
5244
5424
  ] })
5245
5425
  ] }),
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" }) })
5426
+ /* @__PURE__ */ jsx22(Flex13, { gap: 2, wrap: "wrap", children: improved.length > 0 ? improved.map((area) => /* @__PURE__ */ jsx22(Pill, { color: "emerald", label: area }, area)) : /* @__PURE__ */ jsx22(Text20, { muted: true, size: 2, children: "None" }) })
5247
5427
  ] }) }),
5248
- /* @__PURE__ */ jsx20(
5249
- Box11,
5428
+ /* @__PURE__ */ jsx22(
5429
+ Box12,
5250
5430
  {
5251
5431
  padding: 4,
5252
5432
  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: [
5433
+ children: /* @__PURE__ */ jsxs17(Stack13, { space: 3, children: [
5434
+ /* @__PURE__ */ jsxs17(Flex13, { align: "center", gap: 2, children: [
5435
+ /* @__PURE__ */ jsx22(ArrowDownIcon, { style: { color: "#f87171" } }),
5436
+ /* @__PURE__ */ jsxs17(Text20, { size: 2, style: { color: "#f87171" }, weight: "medium", children: [
5257
5437
  "Regressed (",
5258
5438
  regressed.length,
5259
5439
  ")"
5260
5440
  ] })
5261
5441
  ] }),
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" }) })
5442
+ /* @__PURE__ */ jsx22(Flex13, { gap: 2, wrap: "wrap", children: regressed.length > 0 ? regressed.map((area) => /* @__PURE__ */ jsx22(Pill, { color: "red", label: area }, area)) : /* @__PURE__ */ jsx22(Text20, { muted: true, size: 2, children: "None" }) })
5263
5443
  ] })
5264
5444
  }
5265
5445
  ),
5266
- /* @__PURE__ */ jsx20(
5267
- Box11,
5446
+ /* @__PURE__ */ jsx22(
5447
+ Box12,
5268
5448
  {
5269
5449
  padding: 4,
5270
5450
  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(
5451
+ children: /* @__PURE__ */ jsxs17(Stack13, { space: 3, children: [
5452
+ /* @__PURE__ */ jsxs17(Flex13, { align: "center", gap: 2, children: [
5453
+ /* @__PURE__ */ jsx22(
5274
5454
  "span",
5275
5455
  {
5276
5456
  style: {
@@ -5281,13 +5461,13 @@ function DiagnosticsOverview({
5281
5461
  children: "\u2014"
5282
5462
  }
5283
5463
  ),
5284
- /* @__PURE__ */ jsxs16(Text18, { muted: true, size: 2, weight: "medium", children: [
5464
+ /* @__PURE__ */ jsxs17(Text20, { muted: true, size: 2, weight: "medium", children: [
5285
5465
  "Unchanged (",
5286
5466
  unchanged.length,
5287
5467
  ")"
5288
5468
  ] })
5289
5469
  ] }),
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" }) })
5470
+ /* @__PURE__ */ jsx22(Flex13, { gap: 2, wrap: "wrap", children: unchanged.length > 0 ? unchanged.map((area) => /* @__PURE__ */ jsx22(Pill, { color: "muted", label: area }, area)) : /* @__PURE__ */ jsx22(Text20, { muted: true, size: 2, children: "None" }) })
5291
5471
  ] })
5292
5472
  }
5293
5473
  )
@@ -5299,96 +5479,78 @@ function DiagnosticsOverview({
5299
5479
  }
5300
5480
  function ScoreCard({
5301
5481
  delta,
5302
- infoTip,
5303
5482
  label,
5483
+ sentiment,
5304
5484
  subtitle,
5305
5485
  suffix,
5306
5486
  value
5307
5487
  }) {
5308
- const color = scoreColor(value);
5309
- return /* @__PURE__ */ jsx20(
5310
- Box11,
5311
- {
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
- );
5488
+ const color = sentiment ? sentimentTextColor(sentiment) : scoreColor(value);
5489
+ const cardStyle = sentiment ? sentimentCardStyle(sentiment) : {
5490
+ backgroundColor: "var(--card-bg2-color, var(--card-bg-color))",
5491
+ border: "1px solid var(--card-border-color)",
5492
+ borderRadius: 6
5493
+ };
5494
+ return /* @__PURE__ */ jsx22(Box12, { padding: 4, style: cardStyle, children: /* @__PURE__ */ jsxs17(Stack13, { space: 3, children: [
5495
+ /* @__PURE__ */ jsx22(
5496
+ Text20,
5497
+ {
5498
+ muted: true,
5499
+ size: 1,
5500
+ style: {
5501
+ letterSpacing: "0.08em",
5502
+ textTransform: "uppercase"
5503
+ },
5504
+ children: label
5505
+ }
5506
+ ),
5507
+ /* @__PURE__ */ jsxs17(Flex13, { align: "baseline", gap: 2, children: [
5508
+ /* @__PURE__ */ jsxs17(
5509
+ "span",
5510
+ {
5511
+ style: {
5512
+ color,
5513
+ fontFamily: "var(--font-code-size, monospace)",
5514
+ fontSize: 42,
5515
+ fontWeight: 700,
5516
+ lineHeight: 1
5517
+ },
5518
+ children: [
5519
+ value,
5520
+ suffix && /* @__PURE__ */ jsx22("span", { style: { fontSize: 24 }, children: suffix })
5521
+ ]
5522
+ }
5523
+ ),
5524
+ delta != null && delta !== 0 && /* @__PURE__ */ jsx22(DeltaIndicator, { delta, icon: true, mono: true, size: 1 })
5525
+ ] }),
5526
+ /* @__PURE__ */ jsx22(Text20, { muted: true, size: 1, children: subtitle })
5527
+ ] }) });
5371
5528
  }
5372
5529
  function HealthCard({
5373
5530
  color,
5374
5531
  count,
5375
5532
  icon,
5376
- infoTip,
5377
5533
  label
5378
5534
  }) {
5379
- const textColor = color === "emerald" ? "#34d399" : color === "amber" ? "#fbbf24" : "#f87171";
5380
- return /* @__PURE__ */ jsx20(
5381
- Box11,
5535
+ const TEXT_COLORS = {
5536
+ emerald: "#34d399",
5537
+ amber: "#fbbf24",
5538
+ red: "#f87171",
5539
+ muted: "var(--card-muted-fg-color)"
5540
+ };
5541
+ const textColor = TEXT_COLORS[color];
5542
+ return /* @__PURE__ */ jsx22(
5543
+ Box12,
5382
5544
  {
5383
5545
  padding: 4,
5384
5546
  style: {
5385
5547
  ...sectionStyle(color),
5386
5548
  minHeight: 80
5387
5549
  },
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(
5550
+ children: /* @__PURE__ */ jsxs17(Flex13, { align: "center", gap: 3, children: [
5551
+ /* @__PURE__ */ jsx22("span", { style: { color: textColor, fontSize: 28 }, children: icon }),
5552
+ /* @__PURE__ */ jsxs17(Stack13, { space: 1, children: [
5553
+ /* @__PURE__ */ jsx22(
5392
5554
  "span",
5393
5555
  {
5394
5556
  style: {
@@ -5401,23 +5563,19 @@ function HealthCard({
5401
5563
  children: count
5402
5564
  }
5403
5565
  ),
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 })
5407
- ] })
5566
+ /* @__PURE__ */ jsx22(Text20, { muted: true, size: 2, children: label })
5408
5567
  ] })
5409
5568
  ] })
5410
5569
  }
5411
5570
  );
5412
5571
  }
5413
5572
  function MetricCard({
5414
- highlight,
5415
- infoTip,
5416
5573
  label,
5574
+ sentiment,
5417
5575
  value
5418
5576
  }) {
5419
- const style = highlight ? {
5420
- ...sectionStyle("red"),
5577
+ const style = sentiment ? {
5578
+ ...sentimentCardStyle(sentiment),
5421
5579
  padding: 16
5422
5580
  } : {
5423
5581
  backgroundColor: "var(--card-bg2-color, var(--card-bg-color))",
@@ -5425,16 +5583,14 @@ function MetricCard({
5425
5583
  borderRadius: 6,
5426
5584
  padding: 16
5427
5585
  };
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(
5586
+ const valueColor = sentiment ? sentimentTextColor(sentiment) : "var(--card-fg-color)";
5587
+ return /* @__PURE__ */ jsx22(Box12, { style, children: /* @__PURE__ */ jsxs17(Stack13, { space: 2, children: [
5588
+ /* @__PURE__ */ jsx22(Text20, { muted: true, size: 2, children: label }),
5589
+ /* @__PURE__ */ jsx22(
5434
5590
  "span",
5435
5591
  {
5436
5592
  style: {
5437
- color: highlight ? "#f87171" : "var(--card-fg-color)",
5593
+ color: valueColor,
5438
5594
  fontFamily: "var(--font-code-size, monospace)",
5439
5595
  fontSize: 28,
5440
5596
  fontWeight: 600,
@@ -5458,7 +5614,7 @@ function Pill({
5458
5614
  }
5459
5615
  };
5460
5616
  const c = colors[color];
5461
- return /* @__PURE__ */ jsx20(
5617
+ return /* @__PURE__ */ jsx22(
5462
5618
  "span",
5463
5619
  {
5464
5620
  style: {
@@ -5477,11 +5633,11 @@ function Pill({
5477
5633
 
5478
5634
  // src/components/report-detail/LineageCard.tsx
5479
5635
  import { LinkIcon as LinkIcon2 } from "@sanity/icons";
5480
- import { Badge as Badge6, Card as Card10, Flex as Flex13, Stack as Stack14, Text as Text19 } from "@sanity/ui";
5481
- import { useCallback as useCallback11, useEffect as useEffect6, useState as useState7 } from "react";
5636
+ import { Badge as Badge6, Card as Card10, Flex as Flex14, Stack as Stack14, Text as Text21 } from "@sanity/ui";
5637
+ import { useCallback as useCallback11, useEffect as useEffect6, useState as useState8 } from "react";
5482
5638
  import { useClient as useClient5 } from "sanity";
5483
5639
  import { useRouter as useRouter2 } from "sanity/router";
5484
- import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
5640
+ import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
5485
5641
  var REPORT_TYPE2 = "ailf.report";
5486
5642
  var SPAWNED_REPORTS_QUERY = (
5487
5643
  /* groq */
@@ -5497,7 +5653,7 @@ function LineageCard({ provenance, reportId }) {
5497
5653
  const { lineage } = provenance;
5498
5654
  const router = useRouter2();
5499
5655
  const client = useClient5({ apiVersion: API_VERSION });
5500
- const [spawned, setSpawned] = useState7([]);
5656
+ const [spawned, setSpawned] = useState8([]);
5501
5657
  useEffect6(() => {
5502
5658
  let cancelled = false;
5503
5659
  client.fetch(SPAWNED_REPORTS_QUERY, {
@@ -5513,12 +5669,12 @@ function LineageCard({ provenance, reportId }) {
5513
5669
  }, [client, reportId]);
5514
5670
  const hasLineage = lineage?.rerunOf || lineage?.comparedAgainst;
5515
5671
  if (!hasLineage && spawned.length === 0) return null;
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, {}),
5672
+ return /* @__PURE__ */ jsx23(Card10, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs18(Stack14, { space: 4, children: [
5673
+ /* @__PURE__ */ jsx23(Flex14, { align: "center", gap: 2, children: /* @__PURE__ */ jsxs18(Text21, { size: 3, weight: "semibold", children: [
5674
+ /* @__PURE__ */ jsx23(LinkIcon2, {}),
5519
5675
  " Lineage"
5520
5676
  ] }) }),
5521
- lineage?.rerunOf && /* @__PURE__ */ jsx21(
5677
+ lineage?.rerunOf && /* @__PURE__ */ jsx23(
5522
5678
  LineageLink,
5523
5679
  {
5524
5680
  label: "Re-run of",
@@ -5526,7 +5682,7 @@ function LineageCard({ provenance, reportId }) {
5526
5682
  router
5527
5683
  }
5528
5684
  ),
5529
- lineage?.comparedAgainst && /* @__PURE__ */ jsx21(
5685
+ lineage?.comparedAgainst && /* @__PURE__ */ jsx23(
5530
5686
  LineageLink,
5531
5687
  {
5532
5688
  label: "Compared against",
@@ -5534,9 +5690,9 @@ function LineageCard({ provenance, reportId }) {
5534
5690
  router
5535
5691
  }
5536
5692
  ),
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))
5693
+ spawned.length > 0 && /* @__PURE__ */ jsxs18(Stack14, { space: 2, children: [
5694
+ /* @__PURE__ */ jsx23(Text21, { muted: true, size: 1, weight: "semibold", children: "SPAWNED RE-RUNS" }),
5695
+ spawned.map((s) => /* @__PURE__ */ jsx23(SpawnedReportRow, { report: s, router }, s.reportId))
5540
5696
  ] })
5541
5697
  ] }) });
5542
5698
  }
@@ -5548,12 +5704,12 @@ function LineageLink({
5548
5704
  const handleClick = useCallback11(() => {
5549
5705
  router.navigate({ reportId });
5550
5706
  }, [reportId, router]);
5551
- return /* @__PURE__ */ jsxs17(Flex13, { align: "center", gap: 2, children: [
5552
- /* @__PURE__ */ jsxs17(Text19, { muted: true, size: 2, weight: "semibold", children: [
5707
+ return /* @__PURE__ */ jsxs18(Flex14, { align: "center", gap: 2, children: [
5708
+ /* @__PURE__ */ jsxs18(Text21, { muted: true, size: 2, weight: "semibold", children: [
5553
5709
  label,
5554
5710
  ":"
5555
5711
  ] }),
5556
- /* @__PURE__ */ jsx21(Text19, { size: 2, children: /* @__PURE__ */ jsxs17(
5712
+ /* @__PURE__ */ jsx23(Text21, { size: 2, children: /* @__PURE__ */ jsxs18(
5557
5713
  "a",
5558
5714
  {
5559
5715
  href: "#",
@@ -5579,8 +5735,8 @@ function SpawnedReportRow({
5579
5735
  }, [report.reportId, router]);
5580
5736
  const dateLabel = formatShortDate(report.completedAt);
5581
5737
  const label = report.tag ?? dateLabel;
5582
- return /* @__PURE__ */ jsxs17(Flex13, { align: "center", gap: 2, children: [
5583
- /* @__PURE__ */ jsx21(Text19, { size: 2, children: /* @__PURE__ */ jsx21(
5738
+ return /* @__PURE__ */ jsxs18(Flex14, { align: "center", gap: 2, children: [
5739
+ /* @__PURE__ */ jsx23(Text21, { size: 2, children: /* @__PURE__ */ jsx23(
5584
5740
  "a",
5585
5741
  {
5586
5742
  href: "#",
@@ -5592,8 +5748,8 @@ function SpawnedReportRow({
5592
5748
  children: label
5593
5749
  }
5594
5750
  ) }),
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) })
5751
+ report.tag && /* @__PURE__ */ jsx23(Text21, { muted: true, size: 1, children: dateLabel }),
5752
+ /* @__PURE__ */ jsx23(Badge6, { fontSize: 1, mode: "outline", tone: "default", children: report.reportId.slice(0, 8) })
5597
5753
  ] });
5598
5754
  }
5599
5755
  function formatShortDate(iso) {
@@ -5609,16 +5765,16 @@ function formatShortDate(iso) {
5609
5765
  }
5610
5766
 
5611
5767
  // src/components/report-detail/JudgmentList.tsx
5612
- import { useState as useState8 } from "react";
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";
5768
+ import { useCallback as useCallback12, useEffect as useEffect7, useRef as useRef4, useState as useState9 } from "react";
5769
+ import { CopyIcon, ErrorOutlineIcon as ErrorOutlineIcon2, HelpCircleIcon as HelpCircleIcon7 } from "@sanity/icons";
5770
+ import { Box as Box13, Button as Button2, Flex as Flex15, Stack as Stack15, Text as Text22, Tooltip as Tooltip7, useToast as useToast2 } from "@sanity/ui";
5615
5771
 
5616
5772
  // src/components/primitives/InlineCode.tsx
5617
- import { Fragment as Fragment7, jsx as jsx22 } from "react/jsx-runtime";
5773
+ import { Fragment as Fragment7, jsx as jsx24 } from "react/jsx-runtime";
5618
5774
  function InlineCode({ text }) {
5619
5775
  const parts = text.split(/`([^`]+)`/);
5620
- return /* @__PURE__ */ jsx22(Fragment7, { children: parts.map(
5621
- (part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx22(
5776
+ return /* @__PURE__ */ jsx24(Fragment7, { children: parts.map(
5777
+ (part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx24(
5622
5778
  "code",
5623
5779
  {
5624
5780
  style: {
@@ -5630,12 +5786,19 @@ function InlineCode({ text }) {
5630
5786
  children: part
5631
5787
  },
5632
5788
  i
5633
- ) : /* @__PURE__ */ jsx22("span", { children: part }, i)
5789
+ ) : /* @__PURE__ */ jsx24("span", { children: part }, i)
5634
5790
  ) });
5635
5791
  }
5636
5792
 
5637
5793
  // src/components/report-detail/JudgmentList.tsx
5638
- import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
5794
+ import { Fragment as Fragment8, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
5795
+ function judgmentSlug(j) {
5796
+ const sep = j.taskId.indexOf(" - ");
5797
+ const area = sep > 0 ? j.taskId.substring(0, sep) : j.taskId;
5798
+ const task = sep > 0 ? j.taskId.substring(sep + 3) : j.taskId;
5799
+ const slugify4 = (s) => s.toLowerCase().replace(/[()]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
5800
+ return `${slugify4(area)}--${slugify4(task)}--${slugify4(j.dimension)}--${slugify4(j.modelId)}`;
5801
+ }
5639
5802
  function groupByArea(judgments) {
5640
5803
  const byArea = /* @__PURE__ */ new Map();
5641
5804
  for (const j of judgments) {
@@ -5647,23 +5810,27 @@ function groupByArea(judgments) {
5647
5810
  return [...byArea.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([area, js]) => [area, js.sort((a, b) => a.score - b.score)]);
5648
5811
  }
5649
5812
  var DIMENSION_LABELS = DIMENSION_LABELS_KEBAB;
5650
- function JudgmentList({ judgments }) {
5813
+ function JudgmentList({
5814
+ focus,
5815
+ judgments,
5816
+ onFocusChange
5817
+ }) {
5651
5818
  if (judgments.length === 0) return null;
5652
5819
  const grouped = groupByArea(judgments);
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(
5658
- Tooltip6,
5820
+ return /* @__PURE__ */ jsxs19(Stack15, { space: 3, children: [
5821
+ /* @__PURE__ */ jsxs19(Flex15, { align: "center", gap: 2, children: [
5822
+ /* @__PURE__ */ jsx25(ErrorOutlineIcon2, { style: { color: "#f87171" } }),
5823
+ /* @__PURE__ */ jsx25(Text22, { size: 2, weight: "medium", children: "Low-Scoring Judgments" }),
5824
+ /* @__PURE__ */ jsx25(
5825
+ Tooltip7,
5659
5826
  {
5660
- content: /* @__PURE__ */ jsx23(Box12, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx23(Text20, { size: 2, children: GLOSSARY.lowScoringJudgments }) }),
5827
+ content: /* @__PURE__ */ jsx25(Box13, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx25(Text22, { size: 2, children: GLOSSARY.lowScoringJudgments }) }),
5661
5828
  placement: "bottom",
5662
5829
  portal: true,
5663
- children: /* @__PURE__ */ jsx23(Text20, { muted: true, size: 1, children: /* @__PURE__ */ jsx23(HelpCircleIcon7, {}) })
5830
+ children: /* @__PURE__ */ jsx25(Text22, { muted: true, size: 1, children: /* @__PURE__ */ jsx25(HelpCircleIcon7, {}) })
5664
5831
  }
5665
5832
  ),
5666
- /* @__PURE__ */ jsxs18(
5833
+ /* @__PURE__ */ jsxs19(
5667
5834
  "span",
5668
5835
  {
5669
5836
  style: {
@@ -5682,16 +5849,16 @@ function JudgmentList({ judgments }) {
5682
5849
  }
5683
5850
  )
5684
5851
  ] }),
5685
- /* @__PURE__ */ jsx23(Box12, { style: neutralCardStyle, children: grouped.map(([area, areaJudgments], groupIndex) => /* @__PURE__ */ jsx23(
5686
- Box12,
5852
+ /* @__PURE__ */ jsx25(Box13, { style: neutralCardStyle, children: grouped.map(([area, areaJudgments], groupIndex) => /* @__PURE__ */ jsx25(
5853
+ Box13,
5687
5854
  {
5688
5855
  padding: 4,
5689
5856
  style: groupIndex > 0 ? dividerStyle : void 0,
5690
- children: /* @__PURE__ */ jsxs18(Stack15, { space: 3, children: [
5691
- /* @__PURE__ */ jsxs18(Text20, { size: 2, weight: "semibold", children: [
5857
+ children: /* @__PURE__ */ jsxs19(Stack15, { space: 3, children: [
5858
+ /* @__PURE__ */ jsxs19(Text22, { size: 2, weight: "semibold", children: [
5692
5859
  area,
5693
5860
  " ",
5694
- /* @__PURE__ */ jsxs18(
5861
+ /* @__PURE__ */ jsxs19(
5695
5862
  "span",
5696
5863
  {
5697
5864
  style: {
@@ -5706,30 +5873,92 @@ function JudgmentList({ judgments }) {
5706
5873
  }
5707
5874
  )
5708
5875
  ] }),
5709
- /* @__PURE__ */ jsx23(Stack15, { space: 2, children: areaJudgments.map((j, i) => /* @__PURE__ */ jsx23(JudgmentCard, { judgment: j }, `${area}-${i}`)) })
5876
+ /* @__PURE__ */ jsx25(Stack15, { space: 2, children: areaJudgments.map((j) => {
5877
+ const slug = judgmentSlug(j);
5878
+ return /* @__PURE__ */ jsx25(
5879
+ JudgmentCard,
5880
+ {
5881
+ focused: slug === focus,
5882
+ judgment: j,
5883
+ onFocusChange,
5884
+ slug
5885
+ },
5886
+ slug
5887
+ );
5888
+ }) })
5710
5889
  ] })
5711
5890
  },
5712
5891
  area
5713
5892
  )) })
5714
5893
  ] });
5715
5894
  }
5716
- function JudgmentCard({ judgment }) {
5717
- const [expanded, setExpanded] = useState8(false);
5895
+ function JudgmentCard({
5896
+ focused,
5897
+ judgment,
5898
+ onFocusChange,
5899
+ slug
5900
+ }) {
5901
+ const [expanded, setExpanded] = useState9(focused);
5902
+ const cardRef = useRef4(null);
5903
+ const toast = useToast2();
5718
5904
  const dimLabel = DIMENSION_LABELS[judgment.dimension] ?? judgment.dimension;
5719
5905
  const sep = judgment.taskId.indexOf(" - ");
5720
5906
  const taskName = sep > 0 ? judgment.taskId.substring(sep + 3) : judgment.taskId;
5721
- return /* @__PURE__ */ jsx23(
5722
- Box12,
5907
+ useEffect7(() => {
5908
+ if (focused) {
5909
+ setExpanded(true);
5910
+ const timer = setTimeout(() => {
5911
+ cardRef.current?.scrollIntoView({ behavior: "smooth", block: "center" });
5912
+ }, 100);
5913
+ return () => clearTimeout(timer);
5914
+ }
5915
+ }, []);
5916
+ const handleToggle = useCallback12(() => {
5917
+ setExpanded((prev) => !prev);
5918
+ }, []);
5919
+ const handleCopyLink = useCallback12(
5920
+ (e) => {
5921
+ e.stopPropagation();
5922
+ onFocusChange?.(slug);
5923
+ const url = window.location.href;
5924
+ navigator.clipboard.writeText(url).then(
5925
+ () => {
5926
+ toast.push({
5927
+ closable: true,
5928
+ status: "success",
5929
+ title: "Link copied to clipboard"
5930
+ });
5931
+ },
5932
+ () => {
5933
+ toast.push({
5934
+ closable: true,
5935
+ status: "error",
5936
+ title: "Failed to copy link"
5937
+ });
5938
+ }
5939
+ );
5940
+ },
5941
+ [toast]
5942
+ );
5943
+ return /* @__PURE__ */ jsx25(
5944
+ Box13,
5723
5945
  {
5946
+ id: `judgment-${slug}`,
5947
+ ref: cardRef,
5724
5948
  style: {
5725
5949
  ...neutralCardStyle,
5726
5950
  cursor: "pointer",
5727
- padding: 16
5951
+ padding: 16,
5952
+ // Highlight ring when focused via deep-link
5953
+ ...focused ? {
5954
+ boxShadow: "0 0 0 2px rgba(96,165,250,0.5)",
5955
+ transition: "box-shadow 300ms ease"
5956
+ } : {}
5728
5957
  },
5729
- onClick: () => setExpanded(!expanded),
5730
- children: /* @__PURE__ */ jsxs18(Stack15, { space: 3, children: [
5731
- /* @__PURE__ */ jsxs18(Flex14, { align: "center", gap: 3, wrap: "wrap", children: [
5732
- /* @__PURE__ */ jsx23(
5958
+ onClick: handleToggle,
5959
+ children: /* @__PURE__ */ jsxs19(Stack15, { space: 3, children: [
5960
+ /* @__PURE__ */ jsxs19(Flex15, { align: "center", gap: 3, wrap: "wrap", children: [
5961
+ /* @__PURE__ */ jsx25(
5733
5962
  "span",
5734
5963
  {
5735
5964
  style: {
@@ -5744,7 +5973,7 @@ function JudgmentCard({ judgment }) {
5744
5973
  children: judgment.score
5745
5974
  }
5746
5975
  ),
5747
- /* @__PURE__ */ jsx23(
5976
+ /* @__PURE__ */ jsx25(
5748
5977
  "span",
5749
5978
  {
5750
5979
  style: {
@@ -5757,9 +5986,9 @@ function JudgmentCard({ judgment }) {
5757
5986
  children: dimLabel
5758
5987
  }
5759
5988
  ),
5760
- /* @__PURE__ */ jsx23(Text20, { size: 2, weight: "medium", children: taskName }),
5761
- /* @__PURE__ */ jsx23(Text20, { muted: true, size: 1, children: judgment.modelId }),
5762
- /* @__PURE__ */ jsx23(
5989
+ /* @__PURE__ */ jsx25(Text22, { size: 2, weight: "medium", children: taskName }),
5990
+ /* @__PURE__ */ jsx25(Text22, { muted: true, size: 1, children: judgment.modelId }),
5991
+ /* @__PURE__ */ jsx25(
5763
5992
  "span",
5764
5993
  {
5765
5994
  style: {
@@ -5771,29 +6000,42 @@ function JudgmentCard({ judgment }) {
5771
6000
  }
5772
6001
  )
5773
6002
  ] }),
5774
- expanded && /* @__PURE__ */ jsxs18(Stack15, { space: 3, children: [
5775
- /* @__PURE__ */ jsx23(
5776
- Box12,
6003
+ expanded && /* @__PURE__ */ jsxs19(Stack15, { space: 3, children: [
6004
+ /* @__PURE__ */ jsx25(
6005
+ Box13,
5777
6006
  {
5778
6007
  style: {
5779
6008
  backgroundColor: "var(--card-muted-bg-color, rgba(255,255,255,0.04))",
5780
6009
  borderRadius: 4,
5781
6010
  padding: 16
5782
6011
  },
5783
- children: /* @__PURE__ */ jsx23(
5784
- Text20,
6012
+ children: /* @__PURE__ */ jsx25(
6013
+ Text22,
5785
6014
  {
5786
6015
  muted: true,
5787
6016
  size: 2,
5788
6017
  style: { lineHeight: 1.6, whiteSpace: "pre-wrap" },
5789
- children: /* @__PURE__ */ jsx23(InlineCode, { text: judgment.reason })
6018
+ children: /* @__PURE__ */ jsx25(InlineCode, { text: judgment.reason })
5790
6019
  }
5791
6020
  )
5792
6021
  }
5793
6022
  ),
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))
6023
+ /* @__PURE__ */ jsxs19(Flex15, { align: "center", gap: 2, wrap: "wrap", children: [
6024
+ judgment.canonicalDocs && judgment.canonicalDocs.length > 0 && /* @__PURE__ */ jsxs19(Fragment8, { children: [
6025
+ /* @__PURE__ */ jsx25(Text22, { muted: true, size: 1, children: "Docs:" }),
6026
+ judgment.canonicalDocs.map((doc) => /* @__PURE__ */ jsx25(DocBadge, { doc }, doc.slug))
6027
+ ] }),
6028
+ /* @__PURE__ */ jsx25("span", { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx25(
6029
+ Button2,
6030
+ {
6031
+ fontSize: 1,
6032
+ icon: CopyIcon,
6033
+ mode: "ghost",
6034
+ onClick: handleCopyLink,
6035
+ padding: 2,
6036
+ text: "Copy Link"
6037
+ }
6038
+ ) })
5797
6039
  ] })
5798
6040
  ] })
5799
6041
  ] })
@@ -5803,10 +6045,10 @@ function JudgmentCard({ judgment }) {
5803
6045
  function DocBadge({
5804
6046
  doc
5805
6047
  }) {
5806
- const [hovered, setHovered] = useState8(false);
6048
+ const [hovered, setHovered] = useState9(false);
5807
6049
  const isLinked = Boolean(doc.documentId);
5808
6050
  const tooltipLabel = isLinked ? `Edit "${doc.title || doc.slug}"` : doc.title || doc.slug;
5809
- const badge = /* @__PURE__ */ jsx23(
6051
+ const badge = /* @__PURE__ */ jsx25(
5810
6052
  "span",
5811
6053
  {
5812
6054
  style: {
@@ -5819,13 +6061,13 @@ function DocBadge({
5819
6061
  children: doc.slug
5820
6062
  }
5821
6063
  );
5822
- return /* @__PURE__ */ jsx23(
5823
- Tooltip6,
6064
+ return /* @__PURE__ */ jsx25(
6065
+ Tooltip7,
5824
6066
  {
5825
- content: /* @__PURE__ */ jsx23(Box12, { padding: 2, children: /* @__PURE__ */ jsx23(Text20, { size: 2, children: tooltipLabel }) }),
6067
+ content: /* @__PURE__ */ jsx25(Box13, { padding: 2, children: /* @__PURE__ */ jsx25(Text22, { size: 2, children: tooltipLabel }) }),
5826
6068
  placement: "bottom",
5827
6069
  portal: true,
5828
- children: isLinked ? /* @__PURE__ */ jsx23(
6070
+ children: isLinked ? /* @__PURE__ */ jsx25(
5829
6071
  "a",
5830
6072
  {
5831
6073
  href: `/intent/edit/id=${doc.documentId}`,
@@ -5841,37 +6083,37 @@ function DocBadge({
5841
6083
  },
5842
6084
  children: badge
5843
6085
  }
5844
- ) : /* @__PURE__ */ jsx23("span", { children: badge })
6086
+ ) : /* @__PURE__ */ jsx25("span", { children: badge })
5845
6087
  }
5846
6088
  );
5847
6089
  }
5848
6090
 
5849
6091
  // src/components/report-detail/ProvenanceCard.tsx
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";
6092
+ import { Card as Card11, Flex as Flex16, Grid as Grid3, Stack as Stack16, Text as Text23 } from "@sanity/ui";
6093
+ import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
5852
6094
  var VIEWABLE_PROMPTFOO_MODES = /* @__PURE__ */ new Set(["agentic", "observed"]);
5853
6095
  function ProvenanceCard({ provenance }) {
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(
6096
+ return /* @__PURE__ */ jsx26(Card11, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs20(Stack16, { space: 4, children: [
6097
+ /* @__PURE__ */ jsx26(Text23, { size: 3, weight: "semibold", children: "Provenance" }),
6098
+ /* @__PURE__ */ jsxs20(Grid3, { columns: [1, 2, 3], gap: 4, children: [
6099
+ /* @__PURE__ */ jsx26(Field, { label: "Mode", value: provenance.mode }),
6100
+ /* @__PURE__ */ jsx26(Field, { label: "Source", value: provenance.source.name }),
6101
+ /* @__PURE__ */ jsx26(
5860
6102
  Field,
5861
6103
  {
5862
6104
  label: "Trigger",
5863
6105
  value: provenance.trigger.type + (provenance.trigger.workflow ? ` (${provenance.trigger.workflow})` : "")
5864
6106
  }
5865
6107
  ),
5866
- /* @__PURE__ */ jsx24(
6108
+ /* @__PURE__ */ jsx26(
5867
6109
  Field,
5868
6110
  {
5869
6111
  label: "Models",
5870
6112
  value: provenance.models.map((m) => m.label).join(", ")
5871
6113
  }
5872
6114
  ),
5873
- /* @__PURE__ */ jsx24(Field, { label: "Grader Model", mono: true, value: provenance.graderModel }),
5874
- provenance.contextHash && /* @__PURE__ */ jsx24(
6115
+ /* @__PURE__ */ jsx26(Field, { label: "Grader Model", mono: true, value: provenance.graderModel }),
6116
+ provenance.contextHash && /* @__PURE__ */ jsx26(
5875
6117
  Field,
5876
6118
  {
5877
6119
  label: "Context Hash",
@@ -5880,8 +6122,8 @@ function ProvenanceCard({ provenance }) {
5880
6122
  }
5881
6123
  )
5882
6124
  ] }),
5883
- provenance.git && /* @__PURE__ */ jsx24(GitInfo, { git: provenance.git }),
5884
- /* @__PURE__ */ jsx24(PromptfooLinks, { provenance })
6125
+ provenance.git && /* @__PURE__ */ jsx26(GitInfo, { git: provenance.git }),
6126
+ /* @__PURE__ */ jsx26(PromptfooLinks, { provenance })
5885
6127
  ] }) });
5886
6128
  }
5887
6129
  function Field({
@@ -5889,9 +6131,9 @@ function Field({
5889
6131
  mono,
5890
6132
  value
5891
6133
  }) {
5892
- return /* @__PURE__ */ jsxs19(Stack16, { space: 1, children: [
5893
- /* @__PURE__ */ jsx24(
5894
- Text21,
6134
+ return /* @__PURE__ */ jsxs20(Stack16, { space: 1, children: [
6135
+ /* @__PURE__ */ jsx26(
6136
+ Text23,
5895
6137
  {
5896
6138
  muted: true,
5897
6139
  size: 1,
@@ -5900,7 +6142,7 @@ function Field({
5900
6142
  children: label
5901
6143
  }
5902
6144
  ),
5903
- /* @__PURE__ */ jsx24(Text21, { size: 2, style: mono ? { fontFamily: "monospace" } : void 0, children: value })
6145
+ /* @__PURE__ */ jsx26(Text23, { size: 2, style: mono ? { fontFamily: "monospace" } : void 0, children: value })
5904
6146
  ] });
5905
6147
  }
5906
6148
  function GitInfo({ git }) {
@@ -5908,15 +6150,15 @@ function GitInfo({ git }) {
5908
6150
  const branchUrl = `${repoUrl}/tree/${git.branch}`;
5909
6151
  const commitUrl = `${repoUrl}/commit/${git.sha}`;
5910
6152
  const prUrl = git.prNumber ? `${repoUrl}/pull/${git.prNumber}` : null;
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 }),
6153
+ return /* @__PURE__ */ jsx26(Card11, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs20(Flex16, { align: "center", gap: 3, wrap: "wrap", children: [
6154
+ /* @__PURE__ */ jsx26(Text23, { muted: true, size: 2, weight: "semibold", children: "Git" }),
6155
+ /* @__PURE__ */ jsxs20(Text23, { size: 2, children: [
6156
+ /* @__PURE__ */ jsx26("a", { href: repoUrl, rel: "noopener noreferrer", target: "_blank", children: git.repo }),
5915
6157
  " / ",
5916
- /* @__PURE__ */ jsx24("a", { href: branchUrl, rel: "noopener noreferrer", target: "_blank", children: git.branch })
6158
+ /* @__PURE__ */ jsx26("a", { href: branchUrl, rel: "noopener noreferrer", target: "_blank", children: git.branch })
5917
6159
  ] }),
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: [
6160
+ /* @__PURE__ */ jsx26(Text23, { muted: true, size: 2, style: { fontFamily: "monospace" }, children: /* @__PURE__ */ jsx26("a", { href: commitUrl, rel: "noopener noreferrer", target: "_blank", children: git.sha.slice(0, 12) }) }),
6161
+ prUrl && /* @__PURE__ */ jsx26(Text23, { size: 2, children: /* @__PURE__ */ jsxs20("a", { href: prUrl, rel: "noopener noreferrer", target: "_blank", children: [
5920
6162
  "PR #",
5921
6163
  git.prNumber,
5922
6164
  " \u2192"
@@ -5931,14 +6173,14 @@ function PromptfooLinks({
5931
6173
  (e) => VIEWABLE_PROMPTFOO_MODES.has(e.mode)
5932
6174
  );
5933
6175
  if (viewable.length === 0) return null;
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: [
6176
+ return /* @__PURE__ */ jsx26(Flex16, { gap: 3, wrap: "wrap", children: viewable.map((entry) => /* @__PURE__ */ jsx26(Text23, { size: 2, children: /* @__PURE__ */ jsxs20("a", { href: entry.url, rel: "noopener noreferrer", target: "_blank", children: [
5935
6177
  "View in Promptfoo (",
5936
6178
  entry.mode,
5937
6179
  ") \u2192"
5938
6180
  ] }) }, entry.mode)) });
5939
6181
  }
5940
6182
  if (provenance.promptfooUrl && VIEWABLE_PROMPTFOO_MODES.has(provenance.mode)) {
5941
- return /* @__PURE__ */ jsx24(Text21, { size: 2, children: /* @__PURE__ */ jsx24(
6183
+ return /* @__PURE__ */ jsx26(Text23, { size: 2, children: /* @__PURE__ */ jsx26(
5942
6184
  "a",
5943
6185
  {
5944
6186
  href: provenance.promptfooUrl,
@@ -5952,65 +6194,31 @@ function PromptfooLinks({
5952
6194
  }
5953
6195
 
5954
6196
  // src/components/report-detail/RecommendationsSection.tsx
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
- );
6197
+ import { BoltIcon } from "@sanity/icons";
6198
+ import { Box as Box14, Flex as Flex17, Stack as Stack17, Text as Text24 } from "@sanity/ui";
6199
+ import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
6200
+ function tableTier(width) {
6201
+ if (width >= 800) return "full";
6202
+ if (width >= 600) return "compact";
6203
+ return "narrow";
5992
6204
  }
5993
-
5994
- // src/components/report-detail/RecommendationsSection.tsx
5995
- import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
6205
+ var GRID2 = {
6206
+ full: "1fr 1fr 2fr 72px 90px",
6207
+ compact: "1fr 1fr 2fr 90px",
6208
+ narrow: "1fr 1fr"
6209
+ };
5996
6210
  function RecommendationsSection({
5997
6211
  recommendations
5998
6212
  }) {
6213
+ const { ref, width } = useContainerWidth();
6214
+ const tier = tableTier(width);
5999
6215
  if (recommendations.gaps.length === 0) return null;
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,
6006
- {
6007
- content: /* @__PURE__ */ jsx26(Box14, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx26(Text23, { size: 2, children: GLOSSARY.recommendations }) }),
6008
- placement: "bottom",
6009
- portal: true,
6010
- children: /* @__PURE__ */ jsx26(Text23, { muted: true, size: 1, children: /* @__PURE__ */ jsx26(HelpCircleIcon8, {}) })
6011
- }
6012
- ),
6013
- /* @__PURE__ */ jsxs20(
6216
+ return /* @__PURE__ */ jsxs21(Stack17, { space: 3, children: [
6217
+ /* @__PURE__ */ jsxs21(Flex17, { align: "center", gap: 2, children: [
6218
+ /* @__PURE__ */ jsx27(BoltIcon, { style: { color: "#fbbf24" } }),
6219
+ /* @__PURE__ */ jsx27(Text24, { size: 2, weight: "medium", children: "Recommendations" }),
6220
+ /* @__PURE__ */ jsx27(InfoTip, { text: GLOSSARY.recommendations }),
6221
+ /* @__PURE__ */ jsxs21(
6014
6222
  "span",
6015
6223
  {
6016
6224
  style: {
@@ -6030,61 +6238,48 @@ function RecommendationsSection({
6030
6238
  }
6031
6239
  )
6032
6240
  ] }),
6033
- /* @__PURE__ */ jsxs20(Box14, { style: neutralCardStyle, children: [
6034
- /* @__PURE__ */ jsxs20(
6035
- Flex16,
6241
+ /* @__PURE__ */ jsxs21(Box14, { ref, style: { ...neutralCardStyle, overflow: "auto" }, children: [
6242
+ /* @__PURE__ */ jsxs21(
6243
+ "div",
6036
6244
  {
6037
- align: "center",
6038
- gap: 3,
6039
- padding: 4,
6040
- style: { borderBottom: "1px solid var(--card-border-color)" },
6245
+ style: {
6246
+ borderBottom: "1px solid var(--card-border-color)",
6247
+ display: "grid",
6248
+ gap: "0 12px",
6249
+ gridTemplateColumns: GRID2[tier],
6250
+ padding: "12px 16px 8px"
6251
+ },
6041
6252
  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
- ] }) })
6253
+ /* @__PURE__ */ jsx27(ColHeader2, { label: "Area" }),
6254
+ /* @__PURE__ */ jsx27(ColHeader2, { label: "Failure Mode", tooltip: GLOSSARY.failureMode }),
6255
+ tier !== "narrow" && /* @__PURE__ */ jsx27(ColHeader2, { label: "Action" }),
6256
+ tier === "full" && /* @__PURE__ */ jsx27(ColHeader2, { label: "Lift", tooltip: GLOSSARY.estimatedLift }),
6257
+ tier !== "narrow" && /* @__PURE__ */ jsx27(ColHeader2, { label: "Confidence", tooltip: GLOSSARY.confidence })
6081
6258
  ]
6082
6259
  }
6083
6260
  ),
6084
- recommendations.gaps.map((gap, i) => /* @__PURE__ */ jsx26(RecommendationRow, { gap, index: i }, `gap-${i}`))
6261
+ recommendations.gaps.map((gap, i) => /* @__PURE__ */ jsx27(RecommendationRow, { gap, index: i, tier }, `gap-${i}`))
6085
6262
  ] })
6086
6263
  ] });
6087
6264
  }
6265
+ function ColHeader2({ label, tooltip }) {
6266
+ return /* @__PURE__ */ jsxs21(Flex17, { align: "center", gap: 1, children: [
6267
+ /* @__PURE__ */ jsx27(
6268
+ Text24,
6269
+ {
6270
+ muted: true,
6271
+ size: 1,
6272
+ style: {
6273
+ letterSpacing: "0.06em",
6274
+ textTransform: "uppercase"
6275
+ },
6276
+ weight: "semibold",
6277
+ children: label
6278
+ }
6279
+ ),
6280
+ tooltip && /* @__PURE__ */ jsx27(InfoTip, { text: tooltip })
6281
+ ] });
6282
+ }
6088
6283
  var FAILURE_MODE_COLORS = {
6089
6284
  "missing-docs": { bg: "rgba(239,68,68,0.2)", text: "#f87171" },
6090
6285
  "incorrect-docs": { bg: "rgba(239,68,68,0.2)", text: "#f87171" },
@@ -6103,8 +6298,8 @@ var FAILURE_MODE_DESCS = {
6103
6298
  function failureModeTip(mode) {
6104
6299
  const desc = FAILURE_MODE_DESCS[mode];
6105
6300
  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 }),
6301
+ return /* @__PURE__ */ jsxs21(Text24, { size: 2, style: { lineHeight: 1.5 }, children: [
6302
+ /* @__PURE__ */ jsx27("span", { style: fmLabel, children: mode }),
6108
6303
  " \u2014 ",
6109
6304
  desc
6110
6305
  ] });
@@ -6118,10 +6313,10 @@ function confidenceTip(level) {
6118
6313
  const desc = CONFIDENCE_DESCS[level];
6119
6314
  if (!desc) return GLOSSARY.confidence;
6120
6315
  const icons = { high: "\u{1F7E2}", medium: "\u{1F7E1}", low: "\u{1F534}" };
6121
- return /* @__PURE__ */ jsxs20(Text23, { size: 2, style: { lineHeight: 1.5 }, children: [
6316
+ return /* @__PURE__ */ jsxs21(Text24, { size: 2, style: { lineHeight: 1.5 }, children: [
6122
6317
  icons[level],
6123
6318
  " ",
6124
- /* @__PURE__ */ jsxs20("span", { style: fmLabel, children: [
6319
+ /* @__PURE__ */ jsxs21("span", { style: fmLabel, children: [
6125
6320
  level,
6126
6321
  " confidence"
6127
6322
  ] }),
@@ -6131,24 +6326,28 @@ function confidenceTip(level) {
6131
6326
  }
6132
6327
  function RecommendationRow({
6133
6328
  gap,
6134
- index
6329
+ index,
6330
+ tier
6135
6331
  }) {
6136
6332
  const confIcon = gap.confidence === "high" ? "\u{1F7E2}" : gap.confidence === "medium" ? "\u{1F7E1}" : "\u{1F534}";
6137
6333
  const fmColors = FAILURE_MODE_COLORS[gap.failureMode] ?? {
6138
6334
  bg: "var(--card-muted-bg-color)",
6139
6335
  text: "var(--card-muted-fg-color)"
6140
6336
  };
6141
- return /* @__PURE__ */ jsxs20(
6142
- Flex16,
6337
+ return /* @__PURE__ */ jsxs21(
6338
+ "div",
6143
6339
  {
6144
- align: "center",
6145
- gap: 3,
6146
- padding: 4,
6147
- style: index > 0 ? dividerStyle : void 0,
6340
+ style: {
6341
+ alignItems: "center",
6342
+ display: "grid",
6343
+ gap: "0 12px",
6344
+ gridTemplateColumns: GRID2[tier],
6345
+ padding: "10px 16px",
6346
+ ...index > 0 ? dividerStyle : {}
6347
+ },
6148
6348
  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(
6349
+ /* @__PURE__ */ jsx27(Text24, { size: 2, weight: "medium", children: gap.area }),
6350
+ /* @__PURE__ */ jsx27(HoverTip, { text: failureModeTip(gap.failureMode), children: /* @__PURE__ */ jsx27(
6152
6351
  "span",
6153
6352
  {
6154
6353
  style: {
@@ -6161,9 +6360,9 @@ function RecommendationRow({
6161
6360
  },
6162
6361
  children: gap.failureMode
6163
6362
  }
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(
6363
+ ) }),
6364
+ tier !== "narrow" && /* @__PURE__ */ jsx27(Text24, { muted: true, size: 2, children: gap.remediation }),
6365
+ tier === "full" && /* @__PURE__ */ jsxs21(
6167
6366
  "span",
6168
6367
  {
6169
6368
  style: {
@@ -6173,52 +6372,53 @@ function RecommendationRow({
6173
6372
  fontFamily: "var(--font-code-size, monospace)",
6174
6373
  fontSize: 14,
6175
6374
  fontWeight: 600,
6176
- padding: "3px 8px"
6375
+ padding: "3px 8px",
6376
+ textAlign: "right"
6177
6377
  },
6178
6378
  children: [
6179
6379
  "+",
6180
6380
  gap.estimatedLift.toFixed(1)
6181
6381
  ]
6182
6382
  }
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: [
6383
+ ),
6384
+ tier !== "narrow" && /* @__PURE__ */ jsx27(HoverTip, { text: confidenceTip(gap.confidence), children: /* @__PURE__ */ jsxs21(Text24, { size: 2, children: [
6185
6385
  confIcon,
6186
6386
  " ",
6187
6387
  gap.confidence
6188
- ] }) }) })
6388
+ ] }) })
6189
6389
  ]
6190
6390
  }
6191
6391
  );
6192
6392
  }
6193
6393
 
6194
- // src/components/report-detail/ReportHeader.tsx
6195
- import { ArrowLeftIcon } from "@sanity/icons";
6196
- import { Badge as Badge7, Button as Button4, Flex as Flex19, Stack as Stack19, Text as Text25 } from "@sanity/ui";
6394
+ // src/components/report-detail/report-actions/ActionButton.tsx
6395
+ import { Button as Button3, useToast as useToast3 } from "@sanity/ui";
6396
+ import { jsx as jsx28 } from "react/jsx-runtime";
6197
6397
 
6198
6398
  // src/components/report-detail/report-actions/ReportActions.tsx
6199
- import { ChevronDownIcon, CopyIcon as CopyIcon2 } from "@sanity/icons";
6399
+ import { ChevronDownIcon, CopyIcon as CopyIcon3 } from "@sanity/icons";
6200
6400
  import {
6201
- Button as Button3,
6202
- Flex as Flex18,
6401
+ Button as Button5,
6402
+ Flex as Flex19,
6203
6403
  Menu,
6204
6404
  MenuButton,
6205
6405
  MenuDivider,
6206
- useToast as useToast7
6406
+ useToast as useToast9
6207
6407
  } from "@sanity/ui";
6208
- import { useCallback as useCallback17, useState as useState13 } from "react";
6408
+ import { useCallback as useCallback18, useState as useState13 } from "react";
6209
6409
  import { useClient as useClient9 } from "sanity";
6210
6410
 
6211
6411
  // src/components/report-detail/report-actions/CopyReportAction.tsx
6212
6412
  import { ClipboardIcon } from "@sanity/icons";
6213
- import { MenuItem, useToast as useToast2 } from "@sanity/ui";
6214
- import { useCallback as useCallback12, useState as useState10 } from "react";
6413
+ import { MenuItem, useToast as useToast4 } from "@sanity/ui";
6414
+ import { useCallback as useCallback13, useState as useState10 } from "react";
6215
6415
  import { useClient as useClient6 } from "sanity";
6216
- import { jsx as jsx27 } from "react/jsx-runtime";
6416
+ import { jsx as jsx29 } from "react/jsx-runtime";
6217
6417
  function CopyReportAction({ documentId }) {
6218
6418
  const client = useClient6({ apiVersion: API_VERSION });
6219
- const toast = useToast2();
6419
+ const toast = useToast4();
6220
6420
  const [copying, setCopying] = useState10(false);
6221
- const handleClick = useCallback12(async () => {
6421
+ const handleClick = useCallback13(async () => {
6222
6422
  setCopying(true);
6223
6423
  try {
6224
6424
  const doc = await client.fetch(
@@ -6250,7 +6450,7 @@ function CopyReportAction({ documentId }) {
6250
6450
  setCopying(false);
6251
6451
  }
6252
6452
  }, [client, documentId, toast]);
6253
- return /* @__PURE__ */ jsx27(
6453
+ return /* @__PURE__ */ jsx29(
6254
6454
  MenuItem,
6255
6455
  {
6256
6456
  disabled: copying,
@@ -6262,13 +6462,13 @@ function CopyReportAction({ documentId }) {
6262
6462
  }
6263
6463
 
6264
6464
  // src/components/report-detail/report-actions/CopyReportIdAction.tsx
6265
- import { CopyIcon } from "@sanity/icons";
6266
- import { MenuItem as MenuItem2, useToast as useToast3 } from "@sanity/ui";
6267
- import { useCallback as useCallback13 } from "react";
6268
- import { jsx as jsx28 } from "react/jsx-runtime";
6465
+ import { CopyIcon as CopyIcon2 } from "@sanity/icons";
6466
+ import { MenuItem as MenuItem2, useToast as useToast5 } from "@sanity/ui";
6467
+ import { useCallback as useCallback14 } from "react";
6468
+ import { jsx as jsx30 } from "react/jsx-runtime";
6269
6469
  function CopyReportIdAction({ reportId }) {
6270
- const toast = useToast3();
6271
- const handleClick = useCallback13(() => {
6470
+ const toast = useToast5();
6471
+ const handleClick = useCallback14(() => {
6272
6472
  navigator.clipboard.writeText(reportId).then(
6273
6473
  () => {
6274
6474
  toast.push({
@@ -6286,19 +6486,19 @@ function CopyReportIdAction({ reportId }) {
6286
6486
  }
6287
6487
  );
6288
6488
  }, [reportId, toast]);
6289
- return /* @__PURE__ */ jsx28(MenuItem2, { icon: CopyIcon, onClick: handleClick, text: "Copy report ID" });
6489
+ return /* @__PURE__ */ jsx30(MenuItem2, { icon: CopyIcon2, onClick: handleClick, text: "Copy report ID" });
6290
6490
  }
6291
6491
 
6292
6492
  // src/components/report-detail/report-actions/CopyVisionQueryAction.tsx
6293
6493
  import { SearchIcon as SearchIcon4 } from "@sanity/icons";
6294
- import { MenuItem as MenuItem3, useToast as useToast4 } from "@sanity/ui";
6295
- import { useCallback as useCallback14 } from "react";
6296
- import { jsx as jsx29 } from "react/jsx-runtime";
6494
+ import { MenuItem as MenuItem3, useToast as useToast6 } from "@sanity/ui";
6495
+ import { useCallback as useCallback15 } from "react";
6496
+ import { jsx as jsx31 } from "react/jsx-runtime";
6297
6497
  function CopyVisionQueryAction({
6298
6498
  reportId
6299
6499
  }) {
6300
- const toast = useToast4();
6301
- const handleClick = useCallback14(() => {
6500
+ const toast = useToast6();
6501
+ const handleClick = useCallback15(() => {
6302
6502
  const query = `*[_type == "ailf.report" && reportId == "${reportId}"][0]`;
6303
6503
  navigator.clipboard.writeText(query).then(
6304
6504
  () => {
@@ -6318,7 +6518,7 @@ function CopyVisionQueryAction({
6318
6518
  }
6319
6519
  );
6320
6520
  }, [reportId, toast]);
6321
- return /* @__PURE__ */ jsx29(
6521
+ return /* @__PURE__ */ jsx31(
6322
6522
  MenuItem3,
6323
6523
  {
6324
6524
  icon: SearchIcon4,
@@ -6329,25 +6529,25 @@ function CopyVisionQueryAction({
6329
6529
  }
6330
6530
 
6331
6531
  // src/components/report-detail/report-actions/DeleteConfirmDialog.tsx
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";
6532
+ import { Box as Box15, Button as Button4, Card as Card12, Dialog, Flex as Flex18, Stack as Stack18, Text as Text25 } from "@sanity/ui";
6533
+ import { jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
6334
6534
  function DeleteConfirmDialog({
6335
6535
  isDeleting,
6336
6536
  onClose,
6337
6537
  onConfirm,
6338
6538
  reportId
6339
6539
  }) {
6340
- return /* @__PURE__ */ jsx30(
6540
+ return /* @__PURE__ */ jsx32(
6341
6541
  Dialog,
6342
6542
  {
6343
6543
  header: "Delete Report",
6344
6544
  id: "delete-report-dialog",
6345
6545
  onClose,
6346
6546
  width: 1,
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(
6350
- Text24,
6547
+ children: /* @__PURE__ */ jsx32(Box15, { padding: 4, children: /* @__PURE__ */ jsxs22(Stack18, { space: 4, children: [
6548
+ /* @__PURE__ */ jsx32(Text25, { children: "Are you sure you want to delete this report? This action cannot be undone." }),
6549
+ /* @__PURE__ */ jsx32(Card12, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx32(
6550
+ Text25,
6351
6551
  {
6352
6552
  muted: true,
6353
6553
  size: 1,
@@ -6355,9 +6555,9 @@ function DeleteConfirmDialog({
6355
6555
  children: reportId
6356
6556
  }
6357
6557
  ) }),
6358
- /* @__PURE__ */ jsxs21(Flex17, { gap: 2, justify: "flex-end", children: [
6359
- /* @__PURE__ */ jsx30(
6360
- Button2,
6558
+ /* @__PURE__ */ jsxs22(Flex18, { gap: 2, justify: "flex-end", children: [
6559
+ /* @__PURE__ */ jsx32(
6560
+ Button4,
6361
6561
  {
6362
6562
  disabled: isDeleting,
6363
6563
  mode: "ghost",
@@ -6365,8 +6565,8 @@ function DeleteConfirmDialog({
6365
6565
  text: "Cancel"
6366
6566
  }
6367
6567
  ),
6368
- /* @__PURE__ */ jsx30(
6369
- Button2,
6568
+ /* @__PURE__ */ jsx32(
6569
+ Button4,
6370
6570
  {
6371
6571
  disabled: isDeleting,
6372
6572
  onClick: onConfirm,
@@ -6383,11 +6583,11 @@ function DeleteConfirmDialog({
6383
6583
  // src/components/report-detail/report-actions/DeleteReportAction.tsx
6384
6584
  import { TrashIcon } from "@sanity/icons";
6385
6585
  import { MenuItem as MenuItem4 } from "@sanity/ui";
6386
- import { jsx as jsx31 } from "react/jsx-runtime";
6586
+ import { jsx as jsx33 } from "react/jsx-runtime";
6387
6587
  function DeleteReportAction({
6388
6588
  onRequestDelete
6389
6589
  }) {
6390
- return /* @__PURE__ */ jsx31(
6590
+ return /* @__PURE__ */ jsx33(
6391
6591
  MenuItem4,
6392
6592
  {
6393
6593
  icon: TrashIcon,
@@ -6400,18 +6600,18 @@ function DeleteReportAction({
6400
6600
 
6401
6601
  // src/components/report-detail/report-actions/DownloadReportAction.tsx
6402
6602
  import { DownloadIcon } from "@sanity/icons";
6403
- import { MenuItem as MenuItem5, useToast as useToast5 } from "@sanity/ui";
6404
- import { useCallback as useCallback15, useState as useState11 } from "react";
6603
+ import { MenuItem as MenuItem5, useToast as useToast7 } from "@sanity/ui";
6604
+ import { useCallback as useCallback16, useState as useState11 } from "react";
6405
6605
  import { useClient as useClient7 } from "sanity";
6406
- import { jsx as jsx32 } from "react/jsx-runtime";
6606
+ import { jsx as jsx34 } from "react/jsx-runtime";
6407
6607
  function DownloadReportAction({
6408
6608
  documentId,
6409
6609
  reportId
6410
6610
  }) {
6411
6611
  const client = useClient7({ apiVersion: API_VERSION });
6412
- const toast = useToast5();
6612
+ const toast = useToast7();
6413
6613
  const [downloading, setDownloading] = useState11(false);
6414
- const handleClick = useCallback15(async () => {
6614
+ const handleClick = useCallback16(async () => {
6415
6615
  setDownloading(true);
6416
6616
  try {
6417
6617
  const doc = await client.fetch(
@@ -6451,7 +6651,7 @@ function DownloadReportAction({
6451
6651
  setDownloading(false);
6452
6652
  }
6453
6653
  }, [client, documentId, reportId, toast]);
6454
- return /* @__PURE__ */ jsx32(
6654
+ return /* @__PURE__ */ jsx34(
6455
6655
  MenuItem5,
6456
6656
  {
6457
6657
  disabled: downloading,
@@ -6464,8 +6664,8 @@ function DownloadReportAction({
6464
6664
 
6465
6665
  // src/components/report-detail/report-actions/RerunEvaluationAction.tsx
6466
6666
  import { PlayIcon as PlayIcon2 } from "@sanity/icons";
6467
- import { MenuItem as MenuItem6, useToast as useToast6 } from "@sanity/ui";
6468
- import { useCallback as useCallback16, useState as useState12 } from "react";
6667
+ import { MenuItem as MenuItem6, useToast as useToast8 } from "@sanity/ui";
6668
+ import { useCallback as useCallback17, useState as useState12 } from "react";
6469
6669
  import { useClient as useClient8, useCurrentUser as useCurrentUser3 } from "sanity";
6470
6670
 
6471
6671
  // src/lib/eval-scope.ts
@@ -6481,7 +6681,7 @@ function extractEvalScope(provenance) {
6481
6681
  }
6482
6682
 
6483
6683
  // src/components/report-detail/report-actions/RerunEvaluationAction.tsx
6484
- import { jsx as jsx33 } from "react/jsx-runtime";
6684
+ import { jsx as jsx35 } from "react/jsx-runtime";
6485
6685
  var EVAL_REQUEST_TYPE2 = "ailf.evalRequest";
6486
6686
  function slugify2(s) {
6487
6687
  return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
@@ -6519,9 +6719,9 @@ function RerunEvaluationAction({
6519
6719
  }) {
6520
6720
  const client = useClient8({ apiVersion: API_VERSION });
6521
6721
  const currentUser = useCurrentUser3();
6522
- const toast = useToast6();
6722
+ const toast = useToast8();
6523
6723
  const [requesting, setRequesting] = useState12(false);
6524
- const handleClick = useCallback16(async () => {
6724
+ const handleClick = useCallback17(async () => {
6525
6725
  setRequesting(true);
6526
6726
  try {
6527
6727
  const scope = extractEvalScope(provenance);
@@ -6548,7 +6748,7 @@ function RerunEvaluationAction({
6548
6748
  setRequesting(false);
6549
6749
  }
6550
6750
  }, [client, currentUser?.id, provenance, reportId, toast]);
6551
- return /* @__PURE__ */ jsx33(
6751
+ return /* @__PURE__ */ jsx35(
6552
6752
  MenuItem6,
6553
6753
  {
6554
6754
  disabled: requesting,
@@ -6560,7 +6760,7 @@ function RerunEvaluationAction({
6560
6760
  }
6561
6761
 
6562
6762
  // src/components/report-detail/report-actions/ReportActions.tsx
6563
- import { Fragment as Fragment8, jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
6763
+ import { Fragment as Fragment9, jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
6564
6764
  function ReportActions({
6565
6765
  documentId,
6566
6766
  onDeleted,
@@ -6568,8 +6768,8 @@ function ReportActions({
6568
6768
  reportId
6569
6769
  }) {
6570
6770
  const client = useClient9({ apiVersion: API_VERSION });
6571
- const toast = useToast7();
6572
- const handleCopyId = useCallback17(() => {
6771
+ const toast = useToast9();
6772
+ const handleCopyId = useCallback18(() => {
6573
6773
  navigator.clipboard.writeText(reportId).then(
6574
6774
  () => {
6575
6775
  toast.push({
@@ -6589,13 +6789,13 @@ function ReportActions({
6589
6789
  }, [reportId, toast]);
6590
6790
  const [deleteDialogOpen, setDeleteDialogOpen] = useState13(false);
6591
6791
  const [deleting, setDeleting] = useState13(false);
6592
- const handleRequestDelete = useCallback17(() => {
6792
+ const handleRequestDelete = useCallback18(() => {
6593
6793
  setDeleteDialogOpen(true);
6594
6794
  }, []);
6595
- const handleDeleteClose = useCallback17(() => {
6795
+ const handleDeleteClose = useCallback18(() => {
6596
6796
  if (!deleting) setDeleteDialogOpen(false);
6597
6797
  }, [deleting]);
6598
- const handleDeleteConfirm = useCallback17(async () => {
6798
+ const handleDeleteConfirm = useCallback18(async () => {
6599
6799
  setDeleting(true);
6600
6800
  try {
6601
6801
  await client.delete(documentId);
@@ -6616,12 +6816,12 @@ function ReportActions({
6616
6816
  setDeleting(false);
6617
6817
  }
6618
6818
  }, [client, documentId, onDeleted, toast]);
6619
- return /* @__PURE__ */ jsxs22(Fragment8, { children: [
6620
- /* @__PURE__ */ jsxs22(Flex18, { children: [
6621
- /* @__PURE__ */ jsx34(
6622
- Button3,
6819
+ return /* @__PURE__ */ jsxs23(Fragment9, { children: [
6820
+ /* @__PURE__ */ jsxs23(Flex19, { children: [
6821
+ /* @__PURE__ */ jsx36(
6822
+ Button5,
6623
6823
  {
6624
- icon: CopyIcon2,
6824
+ icon: CopyIcon3,
6625
6825
  mode: "ghost",
6626
6826
  onClick: handleCopyId,
6627
6827
  style: {
@@ -6632,11 +6832,11 @@ function ReportActions({
6632
6832
  text: "Copy Report ID"
6633
6833
  }
6634
6834
  ),
6635
- /* @__PURE__ */ jsx34(
6835
+ /* @__PURE__ */ jsx36(
6636
6836
  MenuButton,
6637
6837
  {
6638
- button: /* @__PURE__ */ jsx34(
6639
- Button3,
6838
+ button: /* @__PURE__ */ jsx36(
6839
+ Button5,
6640
6840
  {
6641
6841
  icon: ChevronDownIcon,
6642
6842
  mode: "ghost",
@@ -6648,33 +6848,33 @@ function ReportActions({
6648
6848
  }
6649
6849
  ),
6650
6850
  id: "report-actions-menu",
6651
- menu: /* @__PURE__ */ jsxs22(Menu, { children: [
6652
- /* @__PURE__ */ jsx34(CopyReportIdAction, { reportId }),
6653
- /* @__PURE__ */ jsx34(
6851
+ menu: /* @__PURE__ */ jsxs23(Menu, { children: [
6852
+ /* @__PURE__ */ jsx36(CopyReportIdAction, { reportId }),
6853
+ /* @__PURE__ */ jsx36(
6654
6854
  RerunEvaluationAction,
6655
6855
  {
6656
6856
  provenance,
6657
6857
  reportId
6658
6858
  }
6659
6859
  ),
6660
- /* @__PURE__ */ jsx34(MenuDivider, {}),
6661
- /* @__PURE__ */ jsx34(
6860
+ /* @__PURE__ */ jsx36(MenuDivider, {}),
6861
+ /* @__PURE__ */ jsx36(
6662
6862
  DownloadReportAction,
6663
6863
  {
6664
6864
  documentId,
6665
6865
  reportId
6666
6866
  }
6667
6867
  ),
6668
- /* @__PURE__ */ jsx34(CopyReportAction, { documentId }),
6669
- /* @__PURE__ */ jsx34(CopyVisionQueryAction, { reportId }),
6670
- /* @__PURE__ */ jsx34(MenuDivider, {}),
6671
- /* @__PURE__ */ jsx34(DeleteReportAction, { onRequestDelete: handleRequestDelete })
6868
+ /* @__PURE__ */ jsx36(CopyReportAction, { documentId }),
6869
+ /* @__PURE__ */ jsx36(CopyVisionQueryAction, { reportId }),
6870
+ /* @__PURE__ */ jsx36(MenuDivider, {}),
6871
+ /* @__PURE__ */ jsx36(DeleteReportAction, { onRequestDelete: handleRequestDelete })
6672
6872
  ] }),
6673
6873
  popover: { placement: "bottom-end", portal: true }
6674
6874
  }
6675
6875
  )
6676
6876
  ] }),
6677
- deleteDialogOpen && /* @__PURE__ */ jsx34(
6877
+ deleteDialogOpen && /* @__PURE__ */ jsx36(
6678
6878
  DeleteConfirmDialog,
6679
6879
  {
6680
6880
  isDeleting: deleting,
@@ -6687,66 +6887,51 @@ function ReportActions({
6687
6887
  }
6688
6888
 
6689
6889
  // src/components/report-detail/ReportHeader.tsx
6690
- import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
6691
- function ReportHeader({
6692
- completedAt,
6693
- documentId,
6694
- mode,
6695
- onBack,
6696
- onDeleted,
6697
- provenance,
6698
- reportId,
6699
- sourceName,
6700
- tag
6701
- }) {
6890
+ import { ArrowLeftIcon } from "@sanity/icons";
6891
+ import { Button as Button6, Flex as Flex20, Stack as Stack19, Text as Text26 } from "@sanity/ui";
6892
+ import { jsx as jsx37, jsxs as jsxs24 } from "react/jsx-runtime";
6893
+ function ReportHeader({ completedAt, onBack, tag }) {
6702
6894
  const dateLabel = formatCardDate(completedAt);
6703
6895
  const title = tag ?? dateLabel;
6704
6896
  const hasTag = Boolean(tag);
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 })
6710
- ] }),
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(
6715
- ReportActions,
6716
- {
6717
- documentId,
6718
- onDeleted,
6719
- provenance,
6720
- reportId
6721
- }
6722
- )
6897
+ return /* @__PURE__ */ jsxs24(Flex20, { align: "center", gap: 3, children: [
6898
+ /* @__PURE__ */ jsx37(Button6, { icon: ArrowLeftIcon, mode: "bleed", onClick: onBack, text: "Back" }),
6899
+ /* @__PURE__ */ jsxs24(Stack19, { flex: 1, space: 1, children: [
6900
+ /* @__PURE__ */ jsx37(Text26, { size: 4, weight: "bold", children: title }),
6901
+ hasTag && /* @__PURE__ */ jsx37(Text26, { muted: true, size: 2, children: dateLabel })
6723
6902
  ] })
6724
6903
  ] });
6725
6904
  }
6726
6905
 
6727
6906
  // 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";
6907
+ import { CheckmarkCircleIcon as CheckmarkCircleIcon2, SearchIcon as SearchIcon5 } from "@sanity/icons";
6908
+ import { Box as Box17, Flex as Flex22, Stack as Stack21, Text as Text28 } from "@sanity/ui";
6730
6909
 
6731
6910
  // src/components/report-detail/StrengthsTable.tsx
6732
6911
  import {
6733
- useCallback as useCallback18,
6912
+ useCallback as useCallback19,
6734
6913
  useMemo as useMemo6,
6735
6914
  useState as useState14
6736
6915
  } from "react";
6737
6916
  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
- }) {
6917
+ import { Box as Box16, Flex as Flex21, Stack as Stack20, Text as Text27 } from "@sanity/ui";
6918
+ import { Fragment as Fragment10, jsx as jsx38, jsxs as jsxs25 } from "react/jsx-runtime";
6919
+ function tableTier2(width) {
6920
+ if (width >= 900) return "full";
6921
+ if (width >= 600) return "compact";
6922
+ return "narrow";
6923
+ }
6924
+ var GRID3 = {
6925
+ full: "120px 1fr 1fr 1fr 1fr 80px 72px 72px",
6926
+ compact: "96px 1fr 1fr 1fr 1fr 80px",
6927
+ narrow: "56px 1fr 1fr 1fr 1fr"
6928
+ };
6929
+ function StrengthsTable({ scores, perArea }) {
6930
+ const { ref: containerRef, width } = useContainerWidth();
6931
+ const tier = tableTier2(width);
6747
6932
  const [sortField, setSortField] = useState14("score");
6748
6933
  const [sortDir, setSortDir] = useState14("desc");
6749
- const handleSort = useCallback18(
6934
+ const handleSort = useCallback19(
6750
6935
  (field) => {
6751
6936
  if (field === sortField) {
6752
6937
  setSortDir((d) => d === "asc" ? "desc" : "asc");
@@ -6773,27 +6958,25 @@ function StrengthsTable({
6773
6958
  return (a.docCoverage - b.docCoverage) * dir;
6774
6959
  case "lift":
6775
6960
  return (a.docLift - b.docLift) * dir;
6776
- case "ceiling":
6777
- return ((a.ceilingScore ?? 0) - (b.ceilingScore ?? 0)) * dir;
6778
6961
  default:
6779
6962
  return 0;
6780
6963
  }
6781
6964
  });
6782
6965
  }, [scores, sortField, sortDir]);
6783
- return /* @__PURE__ */ jsxs24(Box16, { style: { ...neutralCardStyle, overflow: "auto" }, children: [
6784
- /* @__PURE__ */ jsxs24(
6966
+ return /* @__PURE__ */ jsxs25(Box16, { ref: containerRef, style: { ...neutralCardStyle, overflow: "auto" }, children: [
6967
+ /* @__PURE__ */ jsxs25(
6785
6968
  "div",
6786
6969
  {
6787
6970
  style: {
6788
6971
  borderBottom: "1px solid var(--card-border-color)",
6789
6972
  display: "grid",
6790
6973
  gap: "0 12px",
6791
- gridTemplateColumns: GRID2,
6974
+ gridTemplateColumns: GRID3[tier],
6792
6975
  padding: "12px 16px 8px"
6793
6976
  },
6794
6977
  children: [
6795
- /* @__PURE__ */ jsx36(
6796
- ColHeader2,
6978
+ /* @__PURE__ */ jsx38(
6979
+ ColHeader3,
6797
6980
  {
6798
6981
  active: sortField === "score",
6799
6982
  direction: sortDir,
@@ -6802,8 +6985,8 @@ function StrengthsTable({
6802
6985
  tooltip: GLOSSARY.score
6803
6986
  }
6804
6987
  ),
6805
- /* @__PURE__ */ jsx36(
6806
- ColHeader2,
6988
+ /* @__PURE__ */ jsx38(
6989
+ ColHeader3,
6807
6990
  {
6808
6991
  active: sortField === "area",
6809
6992
  direction: sortDir,
@@ -6811,8 +6994,8 @@ function StrengthsTable({
6811
6994
  onClick: () => handleSort("area")
6812
6995
  }
6813
6996
  ),
6814
- /* @__PURE__ */ jsx36(
6815
- ColHeader2,
6997
+ /* @__PURE__ */ jsx38(
6998
+ ColHeader3,
6816
6999
  {
6817
7000
  active: sortField === "task",
6818
7001
  direction: sortDir,
@@ -6821,8 +7004,8 @@ function StrengthsTable({
6821
7004
  tooltip: GLOSSARY.taskCompletion
6822
7005
  }
6823
7006
  ),
6824
- /* @__PURE__ */ jsx36(
6825
- ColHeader2,
7007
+ /* @__PURE__ */ jsx38(
7008
+ ColHeader3,
6826
7009
  {
6827
7010
  active: sortField === "code",
6828
7011
  direction: sortDir,
@@ -6831,8 +7014,8 @@ function StrengthsTable({
6831
7014
  tooltip: GLOSSARY.codeCorrectness
6832
7015
  }
6833
7016
  ),
6834
- /* @__PURE__ */ jsx36(
6835
- ColHeader2,
7017
+ /* @__PURE__ */ jsx38(
7018
+ ColHeader3,
6836
7019
  {
6837
7020
  active: sortField === "docs",
6838
7021
  direction: sortDir,
@@ -6841,8 +7024,8 @@ function StrengthsTable({
6841
7024
  tooltip: GLOSSARY.docCoverage
6842
7025
  }
6843
7026
  ),
6844
- /* @__PURE__ */ jsx36(
6845
- ColHeader2,
7027
+ tier !== "narrow" && /* @__PURE__ */ jsx38(
7028
+ ColHeader3,
6846
7029
  {
6847
7030
  active: sortField === "lift",
6848
7031
  direction: sortDir,
@@ -6851,26 +7034,19 @@ function StrengthsTable({
6851
7034
  tooltip: GLOSSARY.docLift
6852
7035
  }
6853
7036
  ),
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" })
7037
+ tier === "full" && /* @__PURE__ */ jsxs25(Fragment10, { children: [
7038
+ /* @__PURE__ */ jsx38(ColHeader3, { label: "Floor", tooltip: GLOSSARY.floor }),
7039
+ /* @__PURE__ */ jsx38(ColHeader3, { label: "Ceil", tooltip: GLOSSARY.ceiling })
7040
+ ] })
6864
7041
  ]
6865
7042
  }
6866
7043
  ),
6867
- sorted.map((area) => /* @__PURE__ */ jsx36(
7044
+ sorted.map((area) => /* @__PURE__ */ jsx38(
6868
7045
  AreaRow,
6869
7046
  {
6870
7047
  area,
6871
- improved,
6872
- regressed,
6873
- unchanged
7048
+ delta: perArea?.[area.feature],
7049
+ tier
6874
7050
  },
6875
7051
  area.feature
6876
7052
  ))
@@ -6878,12 +7054,11 @@ function StrengthsTable({
6878
7054
  }
6879
7055
  function AreaRow({
6880
7056
  area,
6881
- improved,
6882
- regressed,
6883
- unchanged
7057
+ delta,
7058
+ tier
6884
7059
  }) {
6885
- const trend = improved.includes(area.feature) ? "improved" : regressed.includes(area.feature) ? "regressed" : unchanged.includes(area.feature) ? "unchanged" : null;
6886
- return /* @__PURE__ */ jsxs24(
7060
+ const isNarrow = tier === "narrow";
7061
+ return /* @__PURE__ */ jsxs25(
6887
7062
  "div",
6888
7063
  {
6889
7064
  style: {
@@ -6891,57 +7066,60 @@ function AreaRow({
6891
7066
  borderBottom: "1px solid var(--card-border-color)",
6892
7067
  display: "grid",
6893
7068
  gap: "0 12px",
6894
- gridTemplateColumns: GRID2,
6895
- padding: "10px 16px"
7069
+ gridTemplateColumns: GRID3[tier],
7070
+ padding: isNarrow ? "8px 12px" : "10px 16px"
6896
7071
  },
6897
7072
  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",
7073
+ /* @__PURE__ */ jsxs25(Flex21, { align: "center", gap: isNarrow ? 0 : 2, children: [
7074
+ /* @__PURE__ */ jsx38(
7075
+ HoverTip,
7076
+ {
7077
+ text: /* @__PURE__ */ jsxs25(Text27, { size: 2, style: { lineHeight: 1.5 }, children: [
7078
+ /* @__PURE__ */ jsx38("span", { style: { fontWeight: 600 }, children: area.feature }),
7079
+ " composite:",
7080
+ " ",
7081
+ /* @__PURE__ */ jsx38(
7082
+ "span",
7083
+ {
7084
+ style: {
7085
+ color: scoreColor(area.totalScore),
7086
+ fontFamily: "var(--font-code-size, monospace)",
7087
+ fontWeight: 600
7088
+ },
7089
+ children: Math.round(area.totalScore)
7090
+ }
7091
+ ),
7092
+ /* @__PURE__ */ jsx38("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
7093
+ ".",
7094
+ " ",
7095
+ GLOSSARY.score
7096
+ ] }),
7097
+ children: /* @__PURE__ */ jsx38(
7098
+ "div",
6907
7099
  {
6908
7100
  style: {
7101
+ alignItems: "center",
7102
+ backgroundColor: scoreBg(area.totalScore),
7103
+ border: `1px solid ${scoreBorder(area.totalScore)}`,
7104
+ borderRadius: isNarrow ? 4 : 6,
6909
7105
  color: scoreColor(area.totalScore),
6910
- fontFamily: "var(--font-code-size, monospace)",
6911
- fontWeight: 600
7106
+ display: "flex",
7107
+ fontSize: isNarrow ? 13 : 16,
7108
+ fontWeight: 700,
7109
+ height: isNarrow ? 28 : 36,
7110
+ justifyContent: "center",
7111
+ width: isNarrow ? 36 : 44
6912
7112
  },
6913
7113
  children: Math.round(area.totalScore)
6914
7114
  }
6915
- ),
6916
- /* @__PURE__ */ jsx36("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
6917
- ".",
6918
- " ",
6919
- GLOSSARY.score
6920
- ] }),
6921
- children: /* @__PURE__ */ jsx36(
6922
- "div",
6923
- {
6924
- style: {
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
6936
- },
6937
- children: Math.round(area.totalScore)
6938
- }
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(
7115
+ )
7116
+ }
7117
+ ),
7118
+ !isNarrow && delta != null && delta !== 0 && /* @__PURE__ */ jsx38(HoverTip, { text: GLOSSARY.areaDelta, children: /* @__PURE__ */ jsx38(DeltaIndicator, { delta, icon: true, size: 1 }) })
7119
+ ] }),
7120
+ /* @__PURE__ */ jsxs25(Flex21, { align: "center", gap: 2, wrap: "wrap", children: [
7121
+ /* @__PURE__ */ jsx38(Text27, { size: 2, weight: "medium", children: area.feature }),
7122
+ area.negativeDocLift && /* @__PURE__ */ jsx38(HoverTip, { text: GLOSSARY.docsHurt, children: /* @__PURE__ */ jsx38(
6945
7123
  "span",
6946
7124
  {
6947
7125
  style: {
@@ -6954,11 +7132,11 @@ function AreaRow({
6954
7132
  gap: 3,
6955
7133
  padding: "1px 5px"
6956
7134
  },
6957
- children: /* @__PURE__ */ jsx36(WarningOutlineIcon2, {})
7135
+ children: /* @__PURE__ */ jsx38(WarningOutlineIcon2, {})
6958
7136
  }
6959
7137
  ) })
6960
7138
  ] }),
6961
- /* @__PURE__ */ jsx36(
7139
+ /* @__PURE__ */ jsx38(
6962
7140
  DimCell,
6963
7141
  {
6964
7142
  area: area.feature,
@@ -6966,7 +7144,7 @@ function AreaRow({
6966
7144
  value: area.taskCompletion
6967
7145
  }
6968
7146
  ),
6969
- /* @__PURE__ */ jsx36(
7147
+ /* @__PURE__ */ jsx38(
6970
7148
  DimCell,
6971
7149
  {
6972
7150
  area: area.feature,
@@ -6974,7 +7152,7 @@ function AreaRow({
6974
7152
  value: area.codeCorrectness
6975
7153
  }
6976
7154
  ),
6977
- /* @__PURE__ */ jsx36(
7155
+ /* @__PURE__ */ jsx38(
6978
7156
  DimCell,
6979
7157
  {
6980
7158
  area: area.feature,
@@ -6982,14 +7160,14 @@ function AreaRow({
6982
7160
  value: area.docCoverage
6983
7161
  }
6984
7162
  ),
6985
- /* @__PURE__ */ jsx36(
7163
+ !isNarrow && /* @__PURE__ */ jsx38(
6986
7164
  HoverTip,
6987
7165
  {
6988
- text: /* @__PURE__ */ jsxs24(Text26, { size: 2, style: { lineHeight: 1.5 }, children: [
6989
- /* @__PURE__ */ jsx36("span", { style: { fontWeight: 600 }, children: area.feature }),
7166
+ text: /* @__PURE__ */ jsxs25(Text27, { size: 2, style: { lineHeight: 1.5 }, children: [
7167
+ /* @__PURE__ */ jsx38("span", { style: { fontWeight: 600 }, children: area.feature }),
6990
7168
  " doc lift:",
6991
7169
  " ",
6992
- /* @__PURE__ */ jsxs24(
7170
+ /* @__PURE__ */ jsxs25(
6993
7171
  "span",
6994
7172
  {
6995
7173
  style: {
@@ -7007,8 +7185,8 @@ function AreaRow({
7007
7185
  "pts. ",
7008
7186
  GLOSSARY.docLift
7009
7187
  ] }),
7010
- children: /* @__PURE__ */ jsxs24(
7011
- Text26,
7188
+ children: /* @__PURE__ */ jsxs25(
7189
+ Text27,
7012
7190
  {
7013
7191
  size: 2,
7014
7192
  style: {
@@ -7024,33 +7202,22 @@ function AreaRow({
7024
7202
  )
7025
7203
  }
7026
7204
  ),
7027
- /* @__PURE__ */ jsxs24(
7028
- Text26,
7205
+ tier === "full" && /* @__PURE__ */ jsx38(
7206
+ Text27,
7029
7207
  {
7030
7208
  muted: true,
7031
- size: 1,
7209
+ size: 2,
7032
7210
  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
- ]
7211
+ children: Math.round(area.floorScore ?? 0)
7039
7212
  }
7040
7213
  ),
7041
- trend && /* @__PURE__ */ jsx36(
7042
- "span",
7214
+ tier === "full" && /* @__PURE__ */ jsx38(
7215
+ Text27,
7043
7216
  {
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
7217
+ muted: true,
7218
+ size: 2,
7219
+ style: { fontFamily: "var(--font-code-size, monospace)" },
7220
+ children: Math.round(area.ceilingScore ?? 0)
7054
7221
  }
7055
7222
  )
7056
7223
  ]
@@ -7067,17 +7234,17 @@ function DimCell({
7067
7234
  "Code Correctness": GLOSSARY.codeCorrectness,
7068
7235
  "Doc Coverage": GLOSSARY.docCoverage
7069
7236
  };
7070
- return /* @__PURE__ */ jsx36(
7237
+ return /* @__PURE__ */ jsx38(
7071
7238
  HoverTip,
7072
7239
  {
7073
- text: /* @__PURE__ */ jsxs24(Text26, { size: 2, style: { lineHeight: 1.5 }, children: [
7074
- /* @__PURE__ */ jsx36("span", { style: { fontWeight: 600 }, children: area }),
7240
+ text: /* @__PURE__ */ jsxs25(Text27, { size: 2, style: { lineHeight: 1.5 }, children: [
7241
+ /* @__PURE__ */ jsx38("span", { style: { fontWeight: 600 }, children: area }),
7075
7242
  " \u2192",
7076
7243
  " ",
7077
- /* @__PURE__ */ jsx36("span", { style: { fontWeight: 600 }, children: dim }),
7244
+ /* @__PURE__ */ jsx38("span", { style: { fontWeight: 600 }, children: dim }),
7078
7245
  ":",
7079
7246
  " ",
7080
- /* @__PURE__ */ jsx36(
7247
+ /* @__PURE__ */ jsx38(
7081
7248
  "span",
7082
7249
  {
7083
7250
  style: {
@@ -7088,14 +7255,14 @@ function DimCell({
7088
7255
  children: Math.round(value)
7089
7256
  }
7090
7257
  ),
7091
- /* @__PURE__ */ jsx36("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
7258
+ /* @__PURE__ */ jsx38("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
7092
7259
  ".",
7093
7260
  " ",
7094
7261
  glossary[dim] ?? ""
7095
7262
  ] }),
7096
- children: /* @__PURE__ */ jsxs24(Stack20, { space: 1, style: { width: "100%" }, children: [
7097
- /* @__PURE__ */ jsx36(
7098
- Text26,
7263
+ children: /* @__PURE__ */ jsxs25(Stack20, { space: 1, style: { width: "100%" }, children: [
7264
+ /* @__PURE__ */ jsx38(
7265
+ Text27,
7099
7266
  {
7100
7267
  size: 1,
7101
7268
  style: {
@@ -7106,7 +7273,7 @@ function DimCell({
7106
7273
  children: Math.round(value)
7107
7274
  }
7108
7275
  ),
7109
- /* @__PURE__ */ jsx36(
7276
+ /* @__PURE__ */ jsx38(
7110
7277
  "div",
7111
7278
  {
7112
7279
  style: {
@@ -7116,7 +7283,7 @@ function DimCell({
7116
7283
  overflow: "hidden",
7117
7284
  width: "100%"
7118
7285
  },
7119
- children: /* @__PURE__ */ jsx36(
7286
+ children: /* @__PURE__ */ jsx38(
7120
7287
  "div",
7121
7288
  {
7122
7289
  style: {
@@ -7134,14 +7301,14 @@ function DimCell({
7134
7301
  }
7135
7302
  );
7136
7303
  }
7137
- function ColHeader2({
7304
+ function ColHeader3({
7138
7305
  active,
7139
7306
  direction,
7140
7307
  label,
7141
7308
  onClick,
7142
7309
  tooltip
7143
7310
  }) {
7144
- const handleKeyDown = useCallback18(
7311
+ const handleKeyDown = useCallback19(
7145
7312
  (e) => {
7146
7313
  if (onClick && (e.key === "Enter" || e.key === " ")) {
7147
7314
  e.preventDefault();
@@ -7151,8 +7318,8 @@ function ColHeader2({
7151
7318
  [onClick]
7152
7319
  );
7153
7320
  const arrow = active ? direction === "asc" ? " \u2191" : " \u2193" : "";
7154
- return /* @__PURE__ */ jsxs24(Flex20, { align: "center", gap: 1, children: [
7155
- /* @__PURE__ */ jsx36(
7321
+ return /* @__PURE__ */ jsxs25(Flex21, { align: "center", gap: 1, children: [
7322
+ /* @__PURE__ */ jsx38(
7156
7323
  "div",
7157
7324
  {
7158
7325
  onClick,
@@ -7163,8 +7330,8 @@ function ColHeader2({
7163
7330
  userSelect: "none"
7164
7331
  },
7165
7332
  tabIndex: onClick ? 0 : void 0,
7166
- children: /* @__PURE__ */ jsxs24(
7167
- Text26,
7333
+ children: /* @__PURE__ */ jsxs25(
7334
+ Text27,
7168
7335
  {
7169
7336
  muted: true,
7170
7337
  size: 1,
@@ -7181,65 +7348,55 @@ function ColHeader2({
7181
7348
  )
7182
7349
  }
7183
7350
  ),
7184
- tooltip && /* @__PURE__ */ jsx36(InfoTip, { text: tooltip })
7351
+ tooltip && /* @__PURE__ */ jsx38(InfoTip, { text: tooltip })
7185
7352
  ] });
7186
7353
  }
7187
7354
 
7188
7355
  // src/components/report-detail/StrengthsList.tsx
7189
- import { jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
7190
- var EFFICIENCY_THRESHOLD = 0.85;
7356
+ import { jsx as jsx39, jsxs as jsxs26 } from "react/jsx-runtime";
7191
7357
  function StrengthsList({ scores, comparison }) {
7192
7358
  const retrievalSuccesses = scores.filter(
7193
- (s) => s.infrastructureEfficiency != null && s.infrastructureEfficiency >= EFFICIENCY_THRESHOLD && !s.invertedRetrievalGap
7359
+ (s) => s.infrastructureEfficiency != null && s.infrastructureEfficiency >= EFFICIENCY_POSITIVE && !s.invertedRetrievalGap
7194
7360
  ).sort(
7195
7361
  (a, b) => (b.infrastructureEfficiency ?? 0) - (a.infrastructureEfficiency ?? 0)
7196
7362
  );
7197
- const improved = comparison?.improved ?? [];
7198
7363
  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 })
7364
+ return /* @__PURE__ */ jsxs26(Stack21, { space: 5, children: [
7365
+ /* @__PURE__ */ jsxs26(Stack21, { space: 3, children: [
7366
+ /* @__PURE__ */ jsxs26(Flex22, { align: "center", gap: 2, children: [
7367
+ /* @__PURE__ */ jsx39(CheckmarkCircleIcon2, { style: { color: "#34d399" } }),
7368
+ /* @__PURE__ */ jsx39(Text28, { size: 2, weight: "medium", children: "All Areas \u2014 Scores & Doc Lift" }),
7369
+ /* @__PURE__ */ jsx39(InfoTip, { text: GLOSSARY.strengths })
7205
7370
  ] }),
7206
- /* @__PURE__ */ jsx37(
7207
- StrengthsTable,
7208
- {
7209
- improved: comparison?.improved ?? [],
7210
- regressed: comparison?.regressed ?? [],
7211
- scores,
7212
- unchanged: comparison?.unchanged ?? []
7213
- }
7214
- )
7371
+ /* @__PURE__ */ jsx39(StrengthsTable, { perArea: comparison?.deltas?.perArea, scores })
7215
7372
  ] }),
7216
- retrievalSuccesses.length > 0 && /* @__PURE__ */ jsxs25(Box17, { style: neutralCardStyle, children: [
7217
- /* @__PURE__ */ jsx37(
7373
+ retrievalSuccesses.length > 0 && /* @__PURE__ */ jsxs26(Box17, { style: neutralCardStyle, children: [
7374
+ /* @__PURE__ */ jsx39(
7218
7375
  Box17,
7219
7376
  {
7220
7377
  padding: 4,
7221
7378
  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: [
7379
+ children: /* @__PURE__ */ jsxs26(Flex22, { align: "center", gap: 2, children: [
7380
+ /* @__PURE__ */ jsx39(SearchIcon5, { style: { color: "#34d399" } }),
7381
+ /* @__PURE__ */ jsxs26(Text28, { size: 2, weight: "medium", children: [
7225
7382
  "Retrieval Successes (",
7226
- Math.round(EFFICIENCY_THRESHOLD * 100),
7383
+ Math.round(EFFICIENCY_POSITIVE * 100),
7227
7384
  "%+ efficiency)"
7228
7385
  ] }),
7229
- /* @__PURE__ */ jsx37(InfoTip, { text: GLOSSARY.retrievalExcellence })
7386
+ /* @__PURE__ */ jsx39(InfoTip, { text: GLOSSARY.retrievalExcellence })
7230
7387
  ] })
7231
7388
  }
7232
7389
  ),
7233
- /* @__PURE__ */ jsx37(Stack21, { children: retrievalSuccesses.map((area, i) => /* @__PURE__ */ jsxs25(
7234
- Flex21,
7390
+ /* @__PURE__ */ jsx39(Stack21, { children: retrievalSuccesses.map((area, i) => /* @__PURE__ */ jsxs26(
7391
+ Flex22,
7235
7392
  {
7236
7393
  align: "center",
7237
7394
  justify: "space-between",
7238
7395
  padding: 4,
7239
7396
  style: i > 0 ? dividerStyle : void 0,
7240
7397
  children: [
7241
- /* @__PURE__ */ jsx37(Text27, { size: 2, children: area.feature }),
7242
- /* @__PURE__ */ jsx37(
7398
+ /* @__PURE__ */ jsx39(Text28, { size: 2, children: area.feature }),
7399
+ /* @__PURE__ */ jsx39(
7243
7400
  "span",
7244
7401
  {
7245
7402
  style: {
@@ -7257,50 +7414,6 @@ function StrengthsList({ scores, comparison }) {
7257
7414
  },
7258
7415
  area.feature
7259
7416
  )) })
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
7417
  ] })
7305
7418
  ] });
7306
7419
  }
@@ -7313,41 +7426,41 @@ import {
7313
7426
  BoltIcon as BoltIcon2,
7314
7427
  ArrowDownIcon as ArrowDownIcon2
7315
7428
  } from "@sanity/icons";
7316
- import { Box as Box19, Flex as Flex23, Stack as Stack23, Text as Text29 } from "@sanity/ui";
7429
+ import { Box as Box19, Flex as Flex24, Stack as Stack23, Text as Text30 } from "@sanity/ui";
7317
7430
 
7318
7431
  // src/components/report-detail/AreaScoreRow.tsx
7319
7432
  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";
7433
+ import { Box as Box18, Flex as Flex23, Stack as Stack22, Text as Text29 } from "@sanity/ui";
7434
+ import { jsx as jsx40, jsxs as jsxs27 } from "react/jsx-runtime";
7322
7435
  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(
7436
+ return /* @__PURE__ */ jsx40(Box18, { style: { ...neutralCardStyle, padding: 20 }, children: /* @__PURE__ */ jsxs27(Stack22, { space: 4, children: [
7437
+ /* @__PURE__ */ jsxs27(Flex23, { align: "flex-start", gap: 3, justify: "space-between", wrap: "wrap", children: [
7438
+ /* @__PURE__ */ jsxs27(Flex23, { align: "center", gap: 3, children: [
7439
+ /* @__PURE__ */ jsx40(
7327
7440
  HoverTip,
7328
7441
  {
7329
- text: /* @__PURE__ */ jsxs26(Text28, { size: 2, style: { lineHeight: 1.5 }, children: [
7330
- /* @__PURE__ */ jsx38("span", { style: tipBold, children: area.feature }),
7442
+ text: /* @__PURE__ */ jsxs27(Text29, { size: 2, style: { lineHeight: 1.5 }, children: [
7443
+ /* @__PURE__ */ jsx40("span", { style: tipBold, children: area.feature }),
7331
7444
  " composite score:",
7332
7445
  " ",
7333
- /* @__PURE__ */ jsx38(
7446
+ /* @__PURE__ */ jsx40(
7334
7447
  "span",
7335
7448
  {
7336
7449
  style: { ...tipValue, color: scoreColor(area.totalScore) },
7337
7450
  children: Math.round(area.totalScore)
7338
7451
  }
7339
7452
  ),
7340
- /* @__PURE__ */ jsx38("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
7453
+ /* @__PURE__ */ jsx40("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
7341
7454
  ". ",
7342
7455
  GLOSSARY.score
7343
7456
  ] }),
7344
- children: /* @__PURE__ */ jsx38(Box18, { style: scoreBoxStyle(area.totalScore), children: /* @__PURE__ */ jsx38("span", { style: { fontSize: 20 }, children: Math.round(area.totalScore) }) })
7457
+ children: /* @__PURE__ */ jsx40(Box18, { style: scoreBoxStyle(area.totalScore), children: /* @__PURE__ */ jsx40("span", { style: { fontSize: 20 }, children: Math.round(area.totalScore) }) })
7345
7458
  }
7346
7459
  ),
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(
7460
+ /* @__PURE__ */ jsxs27(Stack22, { space: 2, children: [
7461
+ /* @__PURE__ */ jsxs27(Flex23, { align: "center", gap: 2, wrap: "wrap", children: [
7462
+ /* @__PURE__ */ jsx40(Text29, { size: 3, weight: "semibold", children: area.feature }),
7463
+ area.negativeDocLift && /* @__PURE__ */ jsx40(HoverTip, { text: GLOSSARY.docsHurt, children: /* @__PURE__ */ jsxs27(
7351
7464
  "span",
7352
7465
  {
7353
7466
  style: {
@@ -7361,12 +7474,12 @@ function AreaScoreRow({ area, showTrend }) {
7361
7474
  padding: "3px 8px"
7362
7475
  },
7363
7476
  children: [
7364
- /* @__PURE__ */ jsx38(WarningOutlineIcon3, {}),
7477
+ /* @__PURE__ */ jsx40(WarningOutlineIcon3, {}),
7365
7478
  "Docs Hurt"
7366
7479
  ]
7367
7480
  }
7368
7481
  ) }),
7369
- area.invertedRetrievalGap && /* @__PURE__ */ jsx38(HoverTip, { text: GLOSSARY.invertedRetGap, children: /* @__PURE__ */ jsx38(
7482
+ area.invertedRetrievalGap && /* @__PURE__ */ jsx40(HoverTip, { text: GLOSSARY.invertedRetGap, children: /* @__PURE__ */ jsx40(
7370
7483
  "span",
7371
7484
  {
7372
7485
  style: {
@@ -7380,14 +7493,14 @@ function AreaScoreRow({ area, showTrend }) {
7380
7493
  }
7381
7494
  ) })
7382
7495
  ] }),
7383
- /* @__PURE__ */ jsxs26(Text28, { muted: true, size: 2, children: [
7496
+ /* @__PURE__ */ jsxs27(Text29, { muted: true, size: 2, children: [
7384
7497
  area.testCount,
7385
7498
  " test",
7386
7499
  area.testCount === 1 ? "" : "s"
7387
7500
  ] })
7388
7501
  ] })
7389
7502
  ] }),
7390
- showTrend && /* @__PURE__ */ jsx38(
7503
+ showTrend && /* @__PURE__ */ jsx40(
7391
7504
  "span",
7392
7505
  {
7393
7506
  style: {
@@ -7402,7 +7515,7 @@ function AreaScoreRow({ area, showTrend }) {
7402
7515
  }
7403
7516
  )
7404
7517
  ] }),
7405
- /* @__PURE__ */ jsxs26(
7518
+ /* @__PURE__ */ jsxs27(
7406
7519
  "div",
7407
7520
  {
7408
7521
  style: {
@@ -7411,7 +7524,7 @@ function AreaScoreRow({ area, showTrend }) {
7411
7524
  gridTemplateColumns: "1fr 1fr 1fr"
7412
7525
  },
7413
7526
  children: [
7414
- /* @__PURE__ */ jsx38(
7527
+ /* @__PURE__ */ jsx40(
7415
7528
  DimBar,
7416
7529
  {
7417
7530
  label: "Task Completion",
@@ -7424,7 +7537,7 @@ function AreaScoreRow({ area, showTrend }) {
7424
7537
  value: area.taskCompletion
7425
7538
  }
7426
7539
  ),
7427
- /* @__PURE__ */ jsx38(
7540
+ /* @__PURE__ */ jsx40(
7428
7541
  DimBar,
7429
7542
  {
7430
7543
  label: "Code Correctness",
@@ -7437,7 +7550,7 @@ function AreaScoreRow({ area, showTrend }) {
7437
7550
  value: area.codeCorrectness
7438
7551
  }
7439
7552
  ),
7440
- /* @__PURE__ */ jsx38(
7553
+ /* @__PURE__ */ jsx40(
7441
7554
  DimBar,
7442
7555
  {
7443
7556
  label: "Doc Coverage",
@@ -7453,8 +7566,8 @@ function AreaScoreRow({ area, showTrend }) {
7453
7566
  ]
7454
7567
  }
7455
7568
  ),
7456
- /* @__PURE__ */ jsxs26(Flex22, { gap: 5, style: { ...dividerStyle, paddingTop: 12 }, wrap: "wrap", children: [
7457
- /* @__PURE__ */ jsx38(
7569
+ /* @__PURE__ */ jsxs27(Flex23, { gap: 5, style: { ...dividerStyle, paddingTop: 12 }, wrap: "wrap", children: [
7570
+ /* @__PURE__ */ jsx40(
7458
7571
  MetricPair,
7459
7572
  {
7460
7573
  color: area.negativeDocLift ? "#f87171" : "#34d399",
@@ -7468,7 +7581,7 @@ function AreaScoreRow({ area, showTrend }) {
7468
7581
  value: `${area.docLift > 0 ? "+" : ""}${area.docLift}`
7469
7582
  }
7470
7583
  ),
7471
- /* @__PURE__ */ jsx38(
7584
+ /* @__PURE__ */ jsx40(
7472
7585
  MetricPair,
7473
7586
  {
7474
7587
  label: "Ceiling",
@@ -7481,7 +7594,7 @@ function AreaScoreRow({ area, showTrend }) {
7481
7594
  value: String(Math.round(area.ceilingScore ?? 0))
7482
7595
  }
7483
7596
  ),
7484
- /* @__PURE__ */ jsx38(
7597
+ /* @__PURE__ */ jsx40(
7485
7598
  MetricPair,
7486
7599
  {
7487
7600
  label: "Floor",
@@ -7494,7 +7607,7 @@ function AreaScoreRow({ area, showTrend }) {
7494
7607
  value: String(Math.round(area.floorScore ?? 0))
7495
7608
  }
7496
7609
  ),
7497
- area.actualScore != null && /* @__PURE__ */ jsx38(
7610
+ area.actualScore != null && /* @__PURE__ */ jsx40(
7498
7611
  MetricPair,
7499
7612
  {
7500
7613
  label: "Actual",
@@ -7507,7 +7620,7 @@ function AreaScoreRow({ area, showTrend }) {
7507
7620
  value: String(Math.round(area.actualScore))
7508
7621
  }
7509
7622
  ),
7510
- area.infrastructureEfficiency != null && /* @__PURE__ */ jsx38(
7623
+ area.infrastructureEfficiency != null && /* @__PURE__ */ jsx40(
7511
7624
  MetricPair,
7512
7625
  {
7513
7626
  color: efficiencyColor(area.infrastructureEfficiency),
@@ -7521,7 +7634,7 @@ function AreaScoreRow({ area, showTrend }) {
7521
7634
  value: formatPercent(area.infrastructureEfficiency)
7522
7635
  }
7523
7636
  ),
7524
- area.retrievalGap != null && /* @__PURE__ */ jsx38(
7637
+ area.retrievalGap != null && /* @__PURE__ */ jsx40(
7525
7638
  MetricPair,
7526
7639
  {
7527
7640
  label: "Ret Gap",
@@ -7543,14 +7656,14 @@ var tipValue = {
7543
7656
  };
7544
7657
  var tipBold = { fontWeight: 600 };
7545
7658
  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 }),
7659
+ return /* @__PURE__ */ jsxs27(Text29, { size: 2, style: { lineHeight: 1.5 }, children: [
7660
+ /* @__PURE__ */ jsx40("span", { style: tipBold, children: area }),
7548
7661
  " \u2192 ",
7549
- /* @__PURE__ */ jsx38("span", { style: tipBold, children: dim }),
7662
+ /* @__PURE__ */ jsx40("span", { style: tipBold, children: dim }),
7550
7663
  ":",
7551
7664
  " ",
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" }),
7665
+ /* @__PURE__ */ jsx40("span", { style: { ...tipValue, color: scoreColor(score) }, children: Math.round(score) }),
7666
+ /* @__PURE__ */ jsx40("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
7554
7667
  ".",
7555
7668
  " ",
7556
7669
  description
@@ -7561,10 +7674,10 @@ function DimBar({
7561
7674
  value,
7562
7675
  tip
7563
7676
  }) {
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(
7677
+ const bar = /* @__PURE__ */ jsxs27(Stack22, { space: 2, style: { flex: 1 }, children: [
7678
+ /* @__PURE__ */ jsxs27(Flex23, { align: "center", justify: "space-between", children: [
7679
+ /* @__PURE__ */ jsx40(Text29, { muted: true, size: 1, children: label }),
7680
+ /* @__PURE__ */ jsx40(
7568
7681
  "span",
7569
7682
  {
7570
7683
  style: {
@@ -7577,7 +7690,7 @@ function DimBar({
7577
7690
  }
7578
7691
  )
7579
7692
  ] }),
7580
- /* @__PURE__ */ jsx38(
7693
+ /* @__PURE__ */ jsx40(
7581
7694
  Box18,
7582
7695
  {
7583
7696
  style: {
@@ -7586,7 +7699,7 @@ function DimBar({
7586
7699
  height: 6,
7587
7700
  overflow: "hidden"
7588
7701
  },
7589
- children: /* @__PURE__ */ jsx38(
7702
+ children: /* @__PURE__ */ jsx40(
7590
7703
  Box18,
7591
7704
  {
7592
7705
  style: {
@@ -7602,19 +7715,19 @@ function DimBar({
7602
7715
  )
7603
7716
  ] });
7604
7717
  if (tip) {
7605
- return /* @__PURE__ */ jsx38(HoverTip, { text: tip, children: bar });
7718
+ return /* @__PURE__ */ jsx40(HoverTip, { text: tip, children: bar });
7606
7719
  }
7607
7720
  return bar;
7608
7721
  }
7609
7722
  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 }),
7723
+ return /* @__PURE__ */ jsxs27(Text29, { size: 2, style: { lineHeight: 1.5 }, children: [
7724
+ /* @__PURE__ */ jsx40("span", { style: tipBold, children: area }),
7612
7725
  " \u2192",
7613
7726
  " ",
7614
- /* @__PURE__ */ jsx38("span", { style: tipBold, children: metric }),
7727
+ /* @__PURE__ */ jsx40("span", { style: tipBold, children: metric }),
7615
7728
  ":",
7616
7729
  " ",
7617
- /* @__PURE__ */ jsx38("span", { style: tipValue, children: displayValue }),
7730
+ /* @__PURE__ */ jsx40("span", { style: tipValue, children: displayValue }),
7618
7731
  ". ",
7619
7732
  description
7620
7733
  ] });
@@ -7625,11 +7738,11 @@ function MetricPair({
7625
7738
  value,
7626
7739
  tip
7627
7740
  }) {
7628
- const content = /* @__PURE__ */ jsxs26(Text28, { muted: true, size: 1, children: [
7741
+ const content = /* @__PURE__ */ jsxs27(Text29, { muted: true, size: 1, children: [
7629
7742
  label,
7630
7743
  ":",
7631
7744
  " ",
7632
- /* @__PURE__ */ jsx38(
7745
+ /* @__PURE__ */ jsx40(
7633
7746
  "span",
7634
7747
  {
7635
7748
  style: {
@@ -7642,25 +7755,26 @@ function MetricPair({
7642
7755
  )
7643
7756
  ] });
7644
7757
  if (tip) {
7645
- return /* @__PURE__ */ jsx38(HoverTip, { text: tip, children: content });
7758
+ return /* @__PURE__ */ jsx40(HoverTip, { text: tip, children: content });
7646
7759
  }
7647
7760
  return content;
7648
7761
  }
7649
7762
 
7650
7763
  // src/components/report-detail/WeaknessesList.tsx
7651
- import { jsx as jsx39, jsxs as jsxs27 } from "react/jsx-runtime";
7764
+ import { jsx as jsx41, jsxs as jsxs28 } from "react/jsx-runtime";
7652
7765
  function WeaknessesList({ scores, comparison }) {
7653
- const weakAreas = scores.filter((s) => s.totalScore < 70).sort((a, b) => a.totalScore - b.totalScore);
7766
+ const weakAreas = scores.filter((s) => s.totalScore < SCORE_CAUTION).sort((a, b) => a.totalScore - b.totalScore);
7654
7767
  const docsHurt = scores.filter((s) => s.negativeDocLift);
7655
7768
  const retrievalIssues = scores.filter(
7656
- (s) => s.infrastructureEfficiency != null && s.infrastructureEfficiency < 0.7 && !s.invertedRetrievalGap
7769
+ (s) => s.infrastructureEfficiency != null && s.infrastructureEfficiency < EFFICIENCY_CAUTION && !s.invertedRetrievalGap
7657
7770
  );
7658
7771
  const dimWeaknesses = scores.map((s) => ({ area: s, dims: getDimensionWeaknesses(s) })).filter(({ dims }) => dims.length > 0);
7659
7772
  const regressed = comparison?.regressed ?? [];
7660
7773
  const improved = comparison?.improved ?? [];
7661
7774
  const unchanged = comparison?.unchanged ?? [];
7775
+ const perArea = comparison?.deltas?.perArea;
7662
7776
  const efficiencyAnomalies = scores.filter(
7663
- (s) => s.infrastructureEfficiency != null && s.infrastructureEfficiency > 1.05
7777
+ (s) => s.infrastructureEfficiency != null && s.infrastructureEfficiency > EFFICIENCY_ANOMALY
7664
7778
  );
7665
7779
  const hasContent = weakAreas.length > 0 || docsHurt.length > 0 || retrievalIssues.length > 0 || dimWeaknesses.length > 0 || regressed.length > 0 || efficiencyAnomalies.length > 0;
7666
7780
  if (!hasContent) return null;
@@ -7670,14 +7784,14 @@ function WeaknessesList({ scores, comparison }) {
7670
7784
  if (unchanged.includes(feature)) return "unchanged";
7671
7785
  return null;
7672
7786
  };
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 })
7787
+ return /* @__PURE__ */ jsxs28(Stack23, { space: 5, children: [
7788
+ weakAreas.length > 0 && /* @__PURE__ */ jsxs28(Stack23, { space: 3, children: [
7789
+ /* @__PURE__ */ jsxs28(Flex24, { align: "center", gap: 2, children: [
7790
+ /* @__PURE__ */ jsx41(ErrorOutlineIcon3, { style: { color: "#f87171" } }),
7791
+ /* @__PURE__ */ jsx41(Text30, { size: 2, weight: "medium", children: "Weak Areas (<70)" }),
7792
+ /* @__PURE__ */ jsx41(InfoTip, { text: GLOSSARY.weakAreas })
7679
7793
  ] }),
7680
- /* @__PURE__ */ jsx39(Stack23, { space: 3, children: weakAreas.map((area) => /* @__PURE__ */ jsx39(
7794
+ /* @__PURE__ */ jsx41(Stack23, { space: 3, children: weakAreas.map((area) => /* @__PURE__ */ jsx41(
7681
7795
  AreaScoreRow,
7682
7796
  {
7683
7797
  area,
@@ -7686,22 +7800,22 @@ function WeaknessesList({ scores, comparison }) {
7686
7800
  area.feature
7687
7801
  )) })
7688
7802
  ] }),
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 })
7803
+ docsHurt.length > 0 && /* @__PURE__ */ jsxs28(Stack23, { space: 3, children: [
7804
+ /* @__PURE__ */ jsxs28(Flex24, { align: "center", gap: 2, children: [
7805
+ /* @__PURE__ */ jsx41(ErrorOutlineIcon3, { style: { color: "#f87171" } }),
7806
+ /* @__PURE__ */ jsx41(Text30, { size: 2, weight: "medium", children: "Docs Hurt Performance (Negative Doc Lift)" }),
7807
+ /* @__PURE__ */ jsx41(InfoTip, { text: GLOSSARY.docsHurt })
7694
7808
  ] }),
7695
- /* @__PURE__ */ jsx39(Box19, { style: sectionStyle("red"), children: docsHurt.map((area, i) => /* @__PURE__ */ jsxs27(
7809
+ /* @__PURE__ */ jsx41(Box19, { style: sectionStyle("red"), children: docsHurt.map((area, i) => /* @__PURE__ */ jsxs28(
7696
7810
  Box19,
7697
7811
  {
7698
7812
  padding: 4,
7699
7813
  style: i > 0 ? { borderTop: "1px solid rgba(239,68,68,0.2)" } : void 0,
7700
7814
  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(
7815
+ /* @__PURE__ */ jsxs28(Flex24, { align: "center", justify: "space-between", wrap: "wrap", children: [
7816
+ /* @__PURE__ */ jsxs28(Flex24, { align: "center", gap: 2, children: [
7817
+ /* @__PURE__ */ jsx41(Text30, { size: 2, weight: "medium", children: area.feature }),
7818
+ /* @__PURE__ */ jsx41(
7705
7819
  "span",
7706
7820
  {
7707
7821
  style: {
@@ -7716,7 +7830,7 @@ function WeaknessesList({ scores, comparison }) {
7716
7830
  }
7717
7831
  )
7718
7832
  ] }),
7719
- /* @__PURE__ */ jsx39(
7833
+ /* @__PURE__ */ jsx41(
7720
7834
  "span",
7721
7835
  {
7722
7836
  style: {
@@ -7729,8 +7843,8 @@ function WeaknessesList({ scores, comparison }) {
7729
7843
  }
7730
7844
  )
7731
7845
  ] }),
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: [
7846
+ /* @__PURE__ */ jsx41(Box19, { paddingTop: 2, children: /* @__PURE__ */ jsxs28(Text30, { muted: true, size: 2, children: [
7847
+ area.invertedRetrievalGap && /* @__PURE__ */ jsxs28("span", { style: { color: "#fbbf24" }, children: [
7734
7848
  "Agent does better by NOT finding these docs.",
7735
7849
  " "
7736
7850
  ] }),
@@ -7745,22 +7859,22 @@ function WeaknessesList({ scores, comparison }) {
7745
7859
  area.feature
7746
7860
  )) })
7747
7861
  ] }),
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 })
7862
+ retrievalIssues.length > 0 && /* @__PURE__ */ jsxs28(Stack23, { space: 3, children: [
7863
+ /* @__PURE__ */ jsxs28(Flex24, { align: "center", gap: 2, children: [
7864
+ /* @__PURE__ */ jsx41(SearchIcon6, { style: { color: "#fbbf24" } }),
7865
+ /* @__PURE__ */ jsx41(Text30, { size: 2, weight: "medium", children: "Retrieval Issues (<70% efficiency)" }),
7866
+ /* @__PURE__ */ jsx41(InfoTip, { text: GLOSSARY.retrievalIssues })
7753
7867
  ] }),
7754
- /* @__PURE__ */ jsx39(Box19, { style: sectionStyle("amber"), children: retrievalIssues.map((area, i) => /* @__PURE__ */ jsxs27(
7868
+ /* @__PURE__ */ jsx41(Box19, { style: sectionStyle("amber"), children: retrievalIssues.map((area, i) => /* @__PURE__ */ jsxs28(
7755
7869
  Box19,
7756
7870
  {
7757
7871
  padding: 4,
7758
7872
  style: i > 0 ? { borderTop: "1px solid rgba(245,158,11,0.2)" } : void 0,
7759
7873
  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(
7874
+ /* @__PURE__ */ jsxs28(Flex24, { align: "center", justify: "space-between", wrap: "wrap", children: [
7875
+ /* @__PURE__ */ jsxs28(Flex24, { align: "center", gap: 2, children: [
7876
+ /* @__PURE__ */ jsx41(Text30, { size: 2, weight: "medium", children: area.feature }),
7877
+ /* @__PURE__ */ jsx41(
7764
7878
  "span",
7765
7879
  {
7766
7880
  style: {
@@ -7775,7 +7889,7 @@ function WeaknessesList({ scores, comparison }) {
7775
7889
  }
7776
7890
  )
7777
7891
  ] }),
7778
- /* @__PURE__ */ jsx39(
7892
+ /* @__PURE__ */ jsx41(
7779
7893
  "span",
7780
7894
  {
7781
7895
  style: {
@@ -7788,7 +7902,7 @@ function WeaknessesList({ scores, comparison }) {
7788
7902
  }
7789
7903
  )
7790
7904
  ] }),
7791
- /* @__PURE__ */ jsx39(Box19, { paddingTop: 2, children: /* @__PURE__ */ jsxs27(Text29, { muted: true, size: 2, children: [
7905
+ /* @__PURE__ */ jsx41(Box19, { paddingTop: 2, children: /* @__PURE__ */ jsxs28(Text30, { muted: true, size: 2, children: [
7792
7906
  "Actual score (",
7793
7907
  Math.round(area.actualScore ?? 0),
7794
7908
  ") is much lower than ceiling (",
@@ -7803,21 +7917,21 @@ function WeaknessesList({ scores, comparison }) {
7803
7917
  area.feature
7804
7918
  )) })
7805
7919
  ] }),
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 })
7920
+ dimWeaknesses.length > 0 && /* @__PURE__ */ jsxs28(Stack23, { space: 3, children: [
7921
+ /* @__PURE__ */ jsxs28(Flex24, { align: "center", gap: 2, children: [
7922
+ /* @__PURE__ */ jsx41(WarningOutlineIcon4, { style: { color: "#fbbf24" } }),
7923
+ /* @__PURE__ */ jsx41(Text30, { size: 2, weight: "medium", children: "Dimension Weaknesses (<50)" }),
7924
+ /* @__PURE__ */ jsx41(InfoTip, { text: GLOSSARY.dimWeaknesses })
7811
7925
  ] }),
7812
- /* @__PURE__ */ jsx39(Box19, { style: neutralCardStyle, children: dimWeaknesses.map(({ area, dims }, i) => /* @__PURE__ */ jsxs27(
7926
+ /* @__PURE__ */ jsx41(Box19, { style: neutralCardStyle, children: dimWeaknesses.map(({ area, dims }, i) => /* @__PURE__ */ jsxs28(
7813
7927
  Box19,
7814
7928
  {
7815
7929
  padding: 4,
7816
7930
  style: i > 0 ? dividerStyle : void 0,
7817
7931
  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(
7932
+ /* @__PURE__ */ jsxs28(Flex24, { align: "center", gap: 2, paddingBottom: 2, children: [
7933
+ /* @__PURE__ */ jsx41(Text30, { size: 2, weight: "medium", children: area.feature }),
7934
+ /* @__PURE__ */ jsx41(
7821
7935
  "span",
7822
7936
  {
7823
7937
  style: {
@@ -7832,7 +7946,7 @@ function WeaknessesList({ scores, comparison }) {
7832
7946
  }
7833
7947
  )
7834
7948
  ] }),
7835
- /* @__PURE__ */ jsx39(Flex23, { gap: 2, wrap: "wrap", children: dims.map((w) => /* @__PURE__ */ jsx39(HoverTip, { text: w.tip, children: /* @__PURE__ */ jsxs27(
7949
+ /* @__PURE__ */ jsx41(Flex24, { gap: 2, wrap: "wrap", children: dims.map((w) => /* @__PURE__ */ jsx41(HoverTip, { text: w.tip, children: /* @__PURE__ */ jsxs28(
7836
7950
  "span",
7837
7951
  {
7838
7952
  style: {
@@ -7854,76 +7968,80 @@ function WeaknessesList({ scores, comparison }) {
7854
7968
  area.feature
7855
7969
  )) })
7856
7970
  ] }),
7857
- regressed.length > 0 && /* @__PURE__ */ jsxs27(Box19, { style: neutralCardStyle, children: [
7858
- /* @__PURE__ */ jsx39(
7971
+ regressed.length > 0 && /* @__PURE__ */ jsxs28(Box19, { style: neutralCardStyle, children: [
7972
+ /* @__PURE__ */ jsx41(
7859
7973
  Box19,
7860
7974
  {
7861
7975
  padding: 4,
7862
7976
  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" })
7977
+ children: /* @__PURE__ */ jsxs28(Flex24, { align: "center", gap: 2, children: [
7978
+ /* @__PURE__ */ jsx41(ArrowDownIcon2, { style: { color: "#f87171" } }),
7979
+ /* @__PURE__ */ jsx41(Text30, { size: 2, weight: "medium", children: "Regressed Since Last Run" })
7866
7980
  ] })
7867
7981
  }
7868
7982
  ),
7869
- /* @__PURE__ */ jsx39(Stack23, { children: regressed.map((featureName, i) => {
7983
+ /* @__PURE__ */ jsx41(Stack23, { children: regressed.map((featureName, i) => {
7870
7984
  const area = scores.find((s) => s.feature === featureName);
7871
- return /* @__PURE__ */ jsxs27(
7872
- Flex23,
7985
+ const areaDelta = perArea?.[featureName];
7986
+ return /* @__PURE__ */ jsxs28(
7987
+ Flex24,
7873
7988
  {
7874
7989
  align: "center",
7875
7990
  justify: "space-between",
7876
7991
  padding: 4,
7877
7992
  style: i > 0 ? dividerStyle : void 0,
7878
7993
  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
- )
7994
+ /* @__PURE__ */ jsx41(Text30, { size: 2, children: featureName }),
7995
+ /* @__PURE__ */ jsxs28(Flex24, { align: "center", gap: 3, children: [
7996
+ areaDelta != null && /* @__PURE__ */ jsx41(DeltaIndicator, { delta: areaDelta, icon: true }),
7997
+ area && /* @__PURE__ */ jsx41(
7998
+ "span",
7999
+ {
8000
+ style: {
8001
+ backgroundColor: scoreBg(area.totalScore),
8002
+ borderRadius: 4,
8003
+ color: scoreColor(area.totalScore),
8004
+ fontFamily: "var(--font-code-size, monospace)",
8005
+ fontSize: 14,
8006
+ fontWeight: 500,
8007
+ padding: "3px 10px"
8008
+ },
8009
+ children: Math.round(area.totalScore)
8010
+ }
8011
+ )
8012
+ ] })
7895
8013
  ]
7896
8014
  },
7897
8015
  featureName
7898
8016
  );
7899
8017
  }) })
7900
8018
  ] }),
7901
- efficiencyAnomalies.length > 0 && /* @__PURE__ */ jsxs27(Box19, { style: neutralCardStyle, children: [
7902
- /* @__PURE__ */ jsx39(
8019
+ efficiencyAnomalies.length > 0 && /* @__PURE__ */ jsxs28(Box19, { style: neutralCardStyle, children: [
8020
+ /* @__PURE__ */ jsx41(
7903
8021
  Box19,
7904
8022
  {
7905
8023
  padding: 4,
7906
8024
  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 })
8025
+ children: /* @__PURE__ */ jsxs28(Stack23, { space: 2, children: [
8026
+ /* @__PURE__ */ jsxs28(Flex24, { align: "center", gap: 2, children: [
8027
+ /* @__PURE__ */ jsx41(BoltIcon2, { style: { color: "#fbbf24" } }),
8028
+ /* @__PURE__ */ jsx41(Text30, { size: 2, weight: "medium", children: "Efficiency Anomalies (>100%)" }),
8029
+ /* @__PURE__ */ jsx41(InfoTip, { text: GLOSSARY.efficiencyAnomalies })
7912
8030
  ] }),
7913
- /* @__PURE__ */ jsx39(Text29, { muted: true, size: 2, children: "Agent outperforms injected docs \u2014 may indicate doc quality issues or agent memorization." })
8031
+ /* @__PURE__ */ jsx41(Text30, { muted: true, size: 2, children: "Agent outperforms injected docs \u2014 may indicate doc quality issues or agent memorization." })
7914
8032
  ] })
7915
8033
  }
7916
8034
  ),
7917
- /* @__PURE__ */ jsx39(Stack23, { children: efficiencyAnomalies.map((area, i) => /* @__PURE__ */ jsxs27(
7918
- Flex23,
8035
+ /* @__PURE__ */ jsx41(Stack23, { children: efficiencyAnomalies.map((area, i) => /* @__PURE__ */ jsxs28(
8036
+ Flex24,
7919
8037
  {
7920
8038
  align: "center",
7921
8039
  justify: "space-between",
7922
8040
  padding: 4,
7923
8041
  style: i > 0 ? dividerStyle : void 0,
7924
8042
  children: [
7925
- /* @__PURE__ */ jsx39(Text29, { size: 2, children: area.feature }),
7926
- /* @__PURE__ */ jsx39(
8043
+ /* @__PURE__ */ jsx41(Text30, { size: 2, children: area.feature }),
8044
+ /* @__PURE__ */ jsx41(
7927
8045
  "span",
7928
8046
  {
7929
8047
  style: {
@@ -7951,12 +8069,12 @@ var tipArea = {
7951
8069
  fontWeight: 600
7952
8070
  };
7953
8071
  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 }),
8072
+ return /* @__PURE__ */ jsxs28(Text30, { size: 2, style: { lineHeight: 1.5 }, children: [
8073
+ /* @__PURE__ */ jsx41("span", { style: tipArea, children: area }),
7956
8074
  " scores",
7957
8075
  " ",
7958
- /* @__PURE__ */ jsx39("span", { style: tipValue2, children: score }),
7959
- /* @__PURE__ */ jsx39("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
8076
+ /* @__PURE__ */ jsx41("span", { style: tipValue2, children: score }),
8077
+ /* @__PURE__ */ jsx41("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
7960
8078
  " on",
7961
8079
  " ",
7962
8080
  dim.toLowerCase(),
@@ -7966,7 +8084,7 @@ function dimTip(area, dim, score, description) {
7966
8084
  }
7967
8085
  function getDimensionWeaknesses(area) {
7968
8086
  const result = [];
7969
- if (area.taskCompletion < 50)
8087
+ if (area.taskCompletion < DIMENSION_WEAKNESS)
7970
8088
  result.push({
7971
8089
  dimension: "Task Completion",
7972
8090
  tip: dimTip(
@@ -7977,7 +8095,7 @@ function getDimensionWeaknesses(area) {
7977
8095
  ),
7978
8096
  value: Math.round(area.taskCompletion)
7979
8097
  });
7980
- if (area.codeCorrectness < 50)
8098
+ if (area.codeCorrectness < DIMENSION_WEAKNESS)
7981
8099
  result.push({
7982
8100
  dimension: "Code Correctness",
7983
8101
  tip: dimTip(
@@ -7988,7 +8106,7 @@ function getDimensionWeaknesses(area) {
7988
8106
  ),
7989
8107
  value: Math.round(area.codeCorrectness)
7990
8108
  });
7991
- if (area.docCoverage < 50)
8109
+ if (area.docCoverage < DIMENSION_WEAKNESS)
7992
8110
  result.push({
7993
8111
  dimension: "Doc Coverage",
7994
8112
  tip: dimTip(
@@ -8003,7 +8121,7 @@ function getDimensionWeaknesses(area) {
8003
8121
  }
8004
8122
 
8005
8123
  // src/components/report-detail/ReportDetail.tsx
8006
- import { jsx as jsx40, jsxs as jsxs28 } from "react/jsx-runtime";
8124
+ import { jsx as jsx42, jsxs as jsxs29 } from "react/jsx-runtime";
8007
8125
  var OVERVIEW_TAB = { id: "overview", label: "Overview" };
8008
8126
  var DIAGNOSTICS_TAB = { id: "diagnostics", label: "Diagnostics" };
8009
8127
  var ACTIVITY_TAB = { id: "activity", label: "Agent Activity" };
@@ -8013,14 +8131,16 @@ function parseTab(raw) {
8013
8131
  }
8014
8132
  function ReportDetail({
8015
8133
  activeTab,
8134
+ focus,
8016
8135
  onBack,
8017
8136
  onTabChange,
8018
- reportId
8137
+ reportId,
8138
+ subTab
8019
8139
  }) {
8020
8140
  const client = useClient10({ apiVersion: API_VERSION });
8021
8141
  const [loading, setLoading] = useState15(true);
8022
8142
  const [report, setReport] = useState15(null);
8023
- useEffect7(() => {
8143
+ useEffect8(() => {
8024
8144
  let cancelled = false;
8025
8145
  setLoading(true);
8026
8146
  client.fetch(reportDetailQuery, { reportId }).then((data) => {
@@ -8060,19 +8180,19 @@ function ReportDetail({
8060
8180
  if (disabledTabs.has(parsed)) return "overview";
8061
8181
  return tabs.some((t) => t.id === parsed) ? parsed : "overview";
8062
8182
  }, [activeTab, disabledTabs, tabs]);
8063
- const handleTabClick = useCallback19(
8183
+ const handleTabClick = useCallback20(
8064
8184
  (tabId) => {
8065
- onTabChange(tabId === "overview" ? null : tabId);
8185
+ onTabChange(tabId === "overview" ? null : tabId, null, null);
8066
8186
  },
8067
8187
  [onTabChange]
8068
8188
  );
8069
8189
  if (loading) {
8070
- return /* @__PURE__ */ jsx40(LoadingState, { message: "Loading report\u2026" });
8190
+ return /* @__PURE__ */ jsx42(LoadingState, { message: "Loading report\u2026" });
8071
8191
  }
8072
8192
  if (!report || !summary) {
8073
- return /* @__PURE__ */ jsx40(Box20, { padding: 5, children: /* @__PURE__ */ jsxs28(Stack24, { space: 4, children: [
8074
- /* @__PURE__ */ jsx40(
8075
- Button5,
8193
+ return /* @__PURE__ */ jsx42(Box20, { padding: 5, children: /* @__PURE__ */ jsxs29(Stack24, { space: 4, children: [
8194
+ /* @__PURE__ */ jsx42(
8195
+ Button7,
8076
8196
  {
8077
8197
  icon: ArrowLeftIcon2,
8078
8198
  mode: "bleed",
@@ -8080,59 +8200,74 @@ function ReportDetail({
8080
8200
  text: "Back"
8081
8201
  }
8082
8202
  ),
8083
- /* @__PURE__ */ jsx40(Text30, { align: "center", muted: true, size: 3, children: "Report not found" })
8203
+ /* @__PURE__ */ jsx42(Text31, { align: "center", muted: true, size: 3, children: "Report not found" })
8084
8204
  ] }) });
8085
8205
  }
8086
8206
  const { comparison, provenance } = report;
8087
8207
  const totalTests = summary.scores.reduce((n, s) => n + s.testCount, 0);
8088
- return /* @__PURE__ */ jsx40(Box20, { padding: 4, children: /* @__PURE__ */ jsxs28(Stack24, { space: 5, children: [
8089
- /* @__PURE__ */ jsx40(
8208
+ return /* @__PURE__ */ jsx42(Box20, { padding: 4, children: /* @__PURE__ */ jsxs29(Stack24, { space: 5, children: [
8209
+ /* @__PURE__ */ jsx42(
8090
8210
  ReportHeader,
8091
8211
  {
8092
8212
  completedAt: report.completedAt,
8093
- documentId: report._id,
8094
- mode: provenance.mode,
8095
8213
  onBack,
8096
- onDeleted: onBack,
8097
- provenance,
8098
- reportId: report.reportId,
8099
- sourceName: provenance.source.name,
8100
8214
  tag: report.tag
8101
8215
  }
8102
8216
  ),
8103
- /* @__PURE__ */ jsx40(TabList, { space: 1, children: tabs.map((tab) => {
8104
- const isDisabled = disabledTabs.has(tab.id);
8105
- const tooltip = getDisabledTabTooltip(tab.id, summary);
8106
- const tabElement = /* @__PURE__ */ jsx40(
8107
- Tab,
8108
- {
8109
- "aria-controls": `panel-${tab.id}`,
8110
- disabled: isDisabled,
8111
- id: `tab-${tab.id}`,
8112
- label: tab.label,
8113
- onClick: () => handleTabClick(tab.id),
8114
- selected: currentTab === tab.id
8115
- }
8116
- );
8117
- return isDisabled && tooltip ? /* @__PURE__ */ jsx40(
8118
- Tooltip9,
8119
- {
8120
- content: /* @__PURE__ */ jsx40(Box20, { padding: 2, style: { maxWidth: 280 }, children: tooltip }),
8121
- placement: "bottom",
8122
- portal: true,
8123
- children: /* @__PURE__ */ jsx40("span", { style: { display: "inline-block" }, children: tabElement })
8124
- },
8125
- tab.id
8126
- ) : /* @__PURE__ */ jsx40("span", { children: tabElement }, tab.id);
8127
- }) }),
8128
- currentTab === "overview" && /* @__PURE__ */ jsx40(
8217
+ /* @__PURE__ */ jsxs29(Flex25, { align: "center", gap: 2, wrap: "wrap", children: [
8218
+ /* @__PURE__ */ jsx42(TabList, { space: 1, children: tabs.map((tab) => {
8219
+ const isDisabled = disabledTabs.has(tab.id);
8220
+ const tooltip = getDisabledTabTooltip(tab.id, summary);
8221
+ const tabElement = /* @__PURE__ */ jsx42(
8222
+ Tab,
8223
+ {
8224
+ "aria-controls": `panel-${tab.id}`,
8225
+ disabled: isDisabled,
8226
+ id: `tab-${tab.id}`,
8227
+ label: tab.label,
8228
+ onClick: () => handleTabClick(tab.id),
8229
+ selected: currentTab === tab.id
8230
+ }
8231
+ );
8232
+ return isDisabled && tooltip ? /* @__PURE__ */ jsx42(
8233
+ Tooltip8,
8234
+ {
8235
+ content: /* @__PURE__ */ jsx42(Box20, { padding: 2, style: { maxWidth: 280 }, children: tooltip }),
8236
+ placement: "bottom",
8237
+ portal: true,
8238
+ children: /* @__PURE__ */ jsx42("span", { style: { display: "inline-block" }, children: tabElement })
8239
+ },
8240
+ tab.id
8241
+ ) : /* @__PURE__ */ jsx42("span", { children: tabElement }, tab.id);
8242
+ }) }),
8243
+ /* @__PURE__ */ jsxs29(Flex25, { align: "center", gap: 2, style: { marginLeft: "auto" }, children: [
8244
+ /* @__PURE__ */ jsx42(
8245
+ HoverTip,
8246
+ {
8247
+ text: SOURCE_TIP[provenance.source.name] ?? GLOSSARY.reportMode,
8248
+ children: /* @__PURE__ */ jsx42(Badge7, { mode: "outline", tone: "default", children: provenance.source.name })
8249
+ }
8250
+ ),
8251
+ /* @__PURE__ */ jsx42(HoverTip, { text: MODE_TIP2[provenance.mode] ?? GLOSSARY.reportMode, children: /* @__PURE__ */ jsx42(Badge7, { tone: "primary", children: provenance.mode }) }),
8252
+ /* @__PURE__ */ jsx42(
8253
+ ReportActions,
8254
+ {
8255
+ documentId: report._id,
8256
+ onDeleted: onBack,
8257
+ provenance,
8258
+ reportId: report.reportId
8259
+ }
8260
+ )
8261
+ ] })
8262
+ ] }),
8263
+ currentTab === "overview" && /* @__PURE__ */ jsx42(
8129
8264
  TabPanel,
8130
8265
  {
8131
8266
  "aria-labelledby": "tab-overview",
8132
8267
  hidden: currentTab !== "overview",
8133
8268
  id: "panel-overview",
8134
- children: /* @__PURE__ */ jsxs28(Stack24, { space: 5, children: [
8135
- /* @__PURE__ */ jsx40(
8269
+ children: /* @__PURE__ */ jsxs29(Stack24, { space: 5, children: [
8270
+ /* @__PURE__ */ jsx42(
8136
8271
  DiagnosticsOverview,
8137
8272
  {
8138
8273
  comparison,
@@ -8142,27 +8277,30 @@ function ReportDetail({
8142
8277
  totalTests
8143
8278
  }
8144
8279
  ),
8145
- /* @__PURE__ */ jsx40(LineageCard, { provenance, reportId: report.reportId }),
8146
- /* @__PURE__ */ jsx40(ProvenanceCard, { provenance })
8280
+ /* @__PURE__ */ jsx42(LineageCard, { provenance, reportId: report.reportId }),
8281
+ /* @__PURE__ */ jsx42(ProvenanceCard, { provenance })
8147
8282
  ] })
8148
8283
  }
8149
8284
  ),
8150
- currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */ jsx40(
8285
+ currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */ jsx42(
8151
8286
  DiagnosticsPanel,
8152
8287
  {
8153
8288
  comparison,
8289
+ focus,
8154
8290
  judgments: summary.lowScoringJudgments,
8291
+ onNavigate: (newSubTab, newFocus) => onTabChange("diagnostics", newSubTab, newFocus),
8155
8292
  recommendations: summary.recommendations,
8156
- scores: summary.scores
8293
+ scores: summary.scores,
8294
+ subTab
8157
8295
  }
8158
8296
  ),
8159
- currentTab === "activity" && hasAgentActivity && /* @__PURE__ */ jsx40(
8297
+ currentTab === "activity" && hasAgentActivity && /* @__PURE__ */ jsx42(
8160
8298
  TabPanel,
8161
8299
  {
8162
8300
  "aria-labelledby": "tab-activity",
8163
8301
  hidden: currentTab !== "activity",
8164
8302
  id: "panel-activity",
8165
- children: /* @__PURE__ */ jsx40(
8303
+ children: /* @__PURE__ */ jsx42(
8166
8304
  AgentActivitySection,
8167
8305
  {
8168
8306
  agentBehavior: summary.agentBehavior,
@@ -8173,23 +8311,30 @@ function ReportDetail({
8173
8311
  )
8174
8312
  ] }) });
8175
8313
  }
8314
+ function parseDiagSubTab(raw) {
8315
+ if (raw === "issues") return "issues";
8316
+ return "strengths";
8317
+ }
8176
8318
  var DIAG_TABS = [
8177
8319
  { id: "strengths", label: "Strengths" },
8178
8320
  { id: "issues", label: "Issues" }
8179
8321
  ];
8180
8322
  function DiagnosticsPanel({
8181
8323
  comparison,
8324
+ focus,
8182
8325
  judgments,
8326
+ onNavigate,
8183
8327
  recommendations,
8184
- scores
8328
+ scores,
8329
+ subTab: subTabParam
8185
8330
  }) {
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
8331
+ const subTab = parseDiagSubTab(subTabParam);
8332
+ const issueCount = scores.filter((s) => s.totalScore < SCORE_CAUTION).length + scores.filter((s) => s.negativeDocLift).length + scores.filter(
8333
+ (s) => s.infrastructureEfficiency != null && s.infrastructureEfficiency < EFFICIENCY_CAUTION && !s.invertedRetrievalGap
8189
8334
  ).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,
8335
+ return /* @__PURE__ */ jsx42(TabPanel, { "aria-labelledby": "tab-diagnostics", id: "panel-diagnostics", children: /* @__PURE__ */ jsxs29(Stack24, { space: 4, children: [
8336
+ /* @__PURE__ */ jsx42(
8337
+ Flex25,
8193
8338
  {
8194
8339
  align: "center",
8195
8340
  gap: 1,
@@ -8198,10 +8343,10 @@ function DiagnosticsPanel({
8198
8343
  paddingBottom: 8
8199
8344
  },
8200
8345
  wrap: "wrap",
8201
- children: DIAG_TABS.map((tab) => /* @__PURE__ */ jsxs28(
8346
+ children: DIAG_TABS.map((tab) => /* @__PURE__ */ jsxs29(
8202
8347
  "button",
8203
8348
  {
8204
- onClick: () => setSubTab(tab.id),
8349
+ onClick: () => onNavigate(tab.id === "strengths" ? null : tab.id, null),
8205
8350
  style: {
8206
8351
  alignItems: "center",
8207
8352
  background: subTab === tab.id ? "var(--card-muted-bg-color)" : "transparent",
@@ -8218,7 +8363,7 @@ function DiagnosticsPanel({
8218
8363
  type: "button",
8219
8364
  children: [
8220
8365
  tab.label,
8221
- tab.id === "issues" && issueCount > 0 && /* @__PURE__ */ jsx40(
8366
+ tab.id === "issues" && issueCount > 0 && /* @__PURE__ */ jsx42(
8222
8367
  "span",
8223
8368
  {
8224
8369
  style: {
@@ -8238,14 +8383,33 @@ function DiagnosticsPanel({
8238
8383
  ))
8239
8384
  }
8240
8385
  ),
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 })
8386
+ subTab === "strengths" && /* @__PURE__ */ jsx42(StrengthsList, { comparison, scores }),
8387
+ subTab === "issues" && /* @__PURE__ */ jsxs29(Stack24, { space: 5, children: [
8388
+ /* @__PURE__ */ jsx42(WeaknessesList, { comparison, scores }),
8389
+ recommendations && recommendations.gaps.length > 0 && /* @__PURE__ */ jsx42(RecommendationsSection, { recommendations }),
8390
+ judgments && judgments.length > 0 && /* @__PURE__ */ jsx42(
8391
+ JudgmentList,
8392
+ {
8393
+ focus,
8394
+ judgments,
8395
+ onFocusChange: (slug) => onNavigate("issues", slug)
8396
+ }
8397
+ )
8246
8398
  ] })
8247
8399
  ] }) });
8248
8400
  }
8401
+ var MODE_TIP2 = {
8402
+ agentic: GLOSSARY.modeAgentic,
8403
+ baseline: GLOSSARY.modeBaseline,
8404
+ debug: GLOSSARY.modeDebug,
8405
+ full: GLOSSARY.modeFull,
8406
+ observed: GLOSSARY.modeObserved
8407
+ };
8408
+ var SOURCE_TIP = {
8409
+ branch: GLOSSARY.sourceBranch,
8410
+ local: GLOSSARY.sourceLocal,
8411
+ production: GLOSSARY.sourceProduction
8412
+ };
8249
8413
  var inlineCodeStyle = {
8250
8414
  background: "var(--card-code-bg-color, rgba(255,255,255,0.06))",
8251
8415
  borderRadius: 3,
@@ -8257,17 +8421,17 @@ function getDisabledTabTooltip(tabId, summary) {
8257
8421
  if (!summary) return null;
8258
8422
  switch (tabId) {
8259
8423
  case "diagnostics":
8260
- return /* @__PURE__ */ jsx40(Text30, { muted: true, size: 2, children: "No diagnostic data available. Diagnostics require at least one scored feature area." });
8424
+ return /* @__PURE__ */ jsx42(Text31, { muted: true, size: 2, children: "No diagnostic data available. Diagnostics require at least one scored feature area." });
8261
8425
  case "activity":
8262
- return summary.evaluationMode === "baseline" ? /* @__PURE__ */ jsxs28(Text30, { muted: true, size: 2, children: [
8426
+ return summary.evaluationMode === "baseline" ? /* @__PURE__ */ jsxs29(Text31, { muted: true, size: 2, children: [
8263
8427
  "Not available for baseline-only evaluations. Run with",
8264
8428
  " ",
8265
- /* @__PURE__ */ jsx40("code", { style: inlineCodeStyle, children: "--mode full" }),
8429
+ /* @__PURE__ */ jsx42("code", { style: inlineCodeStyle, children: "--mode full" }),
8266
8430
  " or",
8267
8431
  " ",
8268
- /* @__PURE__ */ jsx40("code", { style: inlineCodeStyle, children: "--mode agentic" }),
8432
+ /* @__PURE__ */ jsx42("code", { style: inlineCodeStyle, children: "--mode agentic" }),
8269
8433
  " to capture agent browsing behavior."
8270
- ] }) : /* @__PURE__ */ jsx40(Text30, { muted: true, size: 2, children: "No agent activity data was recorded for this evaluation." });
8434
+ ] }) : /* @__PURE__ */ jsx42(Text31, { muted: true, size: 2, children: "No agent activity data was recorded for this evaluation." });
8271
8435
  default:
8272
8436
  return null;
8273
8437
  }
@@ -8275,7 +8439,7 @@ function getDisabledTabTooltip(tabId, summary) {
8275
8439
 
8276
8440
  // src/components/report-detail/AreaScoreTable.tsx
8277
8441
  import React4 from "react";
8278
- import { Card as Card14, Stack as Stack25, Text as Text32 } from "@sanity/ui";
8442
+ import { Card as Card14, Stack as Stack25, Text as Text33 } from "@sanity/ui";
8279
8443
 
8280
8444
  // src/lib/scoring.ts
8281
8445
  var HEX_MAP = {
@@ -8292,30 +8456,30 @@ function scoreHex(score) {
8292
8456
  }
8293
8457
 
8294
8458
  // 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";
8459
+ import { Card as Card13, Text as Text32 } from "@sanity/ui";
8460
+ import { jsx as jsx43 } from "react/jsx-runtime";
8297
8461
 
8298
8462
  // src/components/report-detail/AreaScoreTable.tsx
8299
- import { jsx as jsx42, jsxs as jsxs29 } from "react/jsx-runtime";
8463
+ import { jsx as jsx44, jsxs as jsxs30 } from "react/jsx-runtime";
8300
8464
 
8301
8465
  // 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";
8466
+ import { Badge as Badge8, Box as Box21, Card as Card15, Flex as Flex26, Grid as Grid4, Stack as Stack26, Text as Text34, Tooltip as Tooltip9 } from "@sanity/ui";
8467
+ import { jsx as jsx45, jsxs as jsxs31 } from "react/jsx-runtime";
8304
8468
 
8305
8469
  // src/components/report-detail/OverviewStats.tsx
8306
8470
  import { Grid as Grid5 } from "@sanity/ui";
8307
- import { jsx as jsx44, jsxs as jsxs31 } from "react/jsx-runtime";
8471
+ import { jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
8308
8472
 
8309
8473
  // src/components/report-detail/ThreeLayerTable.tsx
8310
8474
  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";
8475
+ import { Badge as Badge9, Card as Card16, Flex as Flex27, Stack as Stack27, Text as Text35 } from "@sanity/ui";
8476
+ import { jsx as jsx47, jsxs as jsxs33 } from "react/jsx-runtime";
8313
8477
 
8314
8478
  // src/components/ScoreTimeline.tsx
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";
8479
+ import { Card as Card17, Flex as Flex28, Select as Select2, Stack as Stack28, Text as Text36 } from "@sanity/ui";
8480
+ import { useCallback as useCallback21, useEffect as useEffect9, useMemo as useMemo8, useState as useState16 } from "react";
8317
8481
  import { useClient as useClient11 } from "sanity";
8318
- import { jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
8482
+ import { jsx as jsx48, jsxs as jsxs34 } from "react/jsx-runtime";
8319
8483
  var CHART_HEIGHT = 220;
8320
8484
  var CHART_WIDTH = 800;
8321
8485
  var PAD_BOTTOM = 30;
@@ -8363,7 +8527,7 @@ function ScoreTimeline({ mode = null, source = null }) {
8363
8527
  }
8364
8528
  return Array.from(names).sort();
8365
8529
  }, [dataPoints]);
8366
- const fetchData = useCallback20(async () => {
8530
+ const fetchData = useCallback21(async () => {
8367
8531
  setLoading(true);
8368
8532
  try {
8369
8533
  const startDate = rangeDays ? daysAgo(rangeDays) : "1970-01-01T00:00:00Z";
@@ -8378,7 +8542,7 @@ function ScoreTimeline({ mode = null, source = null }) {
8378
8542
  setLoading(false);
8379
8543
  }
8380
8544
  }, [client, mode, rangeDays, source]);
8381
- useEffect8(() => {
8545
+ useEffect9(() => {
8382
8546
  void fetchData();
8383
8547
  }, [fetchData]);
8384
8548
  const chartPoints = useMemo8(() => {
@@ -8399,14 +8563,14 @@ function ScoreTimeline({ mode = null, source = null }) {
8399
8563
  if (chartPoints.length === 0) return 0;
8400
8564
  return chartPoints.reduce((sum, p) => sum + p.score, 0) / chartPoints.length;
8401
8565
  }, [chartPoints]);
8402
- const handleRangeChange = useCallback20(
8566
+ const handleRangeChange = useCallback21(
8403
8567
  (e) => {
8404
8568
  const val = e.currentTarget.value;
8405
8569
  setRangeDays(val === "all" ? null : Number(val));
8406
8570
  },
8407
8571
  []
8408
8572
  );
8409
- const handleAreaChange = useCallback20(
8573
+ const handleAreaChange = useCallback21(
8410
8574
  (e) => {
8411
8575
  const val = e.currentTarget.value;
8412
8576
  setSelectedArea(val || null);
@@ -8414,22 +8578,22 @@ function ScoreTimeline({ mode = null, source = null }) {
8414
8578
  []
8415
8579
  );
8416
8580
  const polylinePoints = chartPoints.map((p) => `${p.x},${p.y}`).join(" ");
8417
- return /* @__PURE__ */ jsxs33(Stack28, { space: 4, children: [
8418
- /* @__PURE__ */ jsxs33(Flex27, { gap: 3, children: [
8419
- /* @__PURE__ */ jsx46(
8581
+ return /* @__PURE__ */ jsxs34(Stack28, { space: 4, children: [
8582
+ /* @__PURE__ */ jsxs34(Flex28, { gap: 3, children: [
8583
+ /* @__PURE__ */ jsx48(
8420
8584
  Select2,
8421
8585
  {
8422
8586
  onChange: handleRangeChange,
8423
8587
  value: rangeDays?.toString() ?? "all",
8424
- children: TIME_RANGES.map((r) => /* @__PURE__ */ jsx46("option", { value: r.days?.toString() ?? "all", children: r.label }, r.label))
8588
+ children: TIME_RANGES.map((r) => /* @__PURE__ */ jsx48("option", { value: r.days?.toString() ?? "all", children: r.label }, r.label))
8425
8589
  }
8426
8590
  ),
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))
8591
+ /* @__PURE__ */ jsxs34(Select2, { onChange: handleAreaChange, value: selectedArea ?? "", children: [
8592
+ /* @__PURE__ */ jsx48("option", { value: "", children: "Overall" }),
8593
+ areaNames.map((name) => /* @__PURE__ */ jsx48("option", { value: name, children: name }, name))
8430
8594
  ] })
8431
8595
  ] }),
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(
8596
+ /* @__PURE__ */ jsx48(Card17, { padding: 3, radius: 2, shadow: 1, children: loading ? /* @__PURE__ */ jsx48(Flex28, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx48(Text36, { muted: true, size: 2, children: "Loading\u2026" }) }) : chartPoints.length === 0 ? /* @__PURE__ */ jsx48(Flex28, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx48(Text36, { muted: true, size: 2, children: "No reports found for this time range" }) }) : /* @__PURE__ */ jsxs34(
8433
8597
  "svg",
8434
8598
  {
8435
8599
  style: { display: "block", width: "100%" },
@@ -8437,8 +8601,8 @@ function ScoreTimeline({ mode = null, source = null }) {
8437
8601
  children: [
8438
8602
  Y_TICKS.map((tick) => {
8439
8603
  const y = PAD_TOP + PLOT_HEIGHT - tick / Y_MAX * PLOT_HEIGHT;
8440
- return /* @__PURE__ */ jsxs33("g", { children: [
8441
- /* @__PURE__ */ jsx46(
8604
+ return /* @__PURE__ */ jsxs34("g", { children: [
8605
+ /* @__PURE__ */ jsx48(
8442
8606
  "line",
8443
8607
  {
8444
8608
  stroke: "#ccc",
@@ -8449,7 +8613,7 @@ function ScoreTimeline({ mode = null, source = null }) {
8449
8613
  y2: y
8450
8614
  }
8451
8615
  ),
8452
- /* @__PURE__ */ jsx46(
8616
+ /* @__PURE__ */ jsx48(
8453
8617
  "text",
8454
8618
  {
8455
8619
  dominantBaseline: "middle",
@@ -8469,7 +8633,7 @@ function ScoreTimeline({ mode = null, source = null }) {
8469
8633
  chartPoints.length - 1
8470
8634
  ].map((idx) => {
8471
8635
  const p = chartPoints[idx];
8472
- return /* @__PURE__ */ jsx46(
8636
+ return /* @__PURE__ */ jsx48(
8473
8637
  "text",
8474
8638
  {
8475
8639
  fill: "#999",
@@ -8481,7 +8645,7 @@ function ScoreTimeline({ mode = null, source = null }) {
8481
8645
  },
8482
8646
  idx
8483
8647
  );
8484
- }) : chartPoints.map((p, idx) => /* @__PURE__ */ jsx46(
8648
+ }) : chartPoints.map((p, idx) => /* @__PURE__ */ jsx48(
8485
8649
  "text",
8486
8650
  {
8487
8651
  fill: "#999",
@@ -8493,7 +8657,7 @@ function ScoreTimeline({ mode = null, source = null }) {
8493
8657
  },
8494
8658
  idx
8495
8659
  )),
8496
- /* @__PURE__ */ jsx46(
8660
+ /* @__PURE__ */ jsx48(
8497
8661
  "polyline",
8498
8662
  {
8499
8663
  fill: "none",
@@ -8503,7 +8667,7 @@ function ScoreTimeline({ mode = null, source = null }) {
8503
8667
  strokeWidth: 2.5
8504
8668
  }
8505
8669
  ),
8506
- chartPoints.map((p, idx) => /* @__PURE__ */ jsx46(
8670
+ chartPoints.map((p, idx) => /* @__PURE__ */ jsx48(
8507
8671
  "circle",
8508
8672
  {
8509
8673
  cx: p.x,
@@ -8512,7 +8676,7 @@ function ScoreTimeline({ mode = null, source = null }) {
8512
8676
  r: 4,
8513
8677
  stroke: "#fff",
8514
8678
  strokeWidth: 1.5,
8515
- children: /* @__PURE__ */ jsxs33("title", { children: [
8679
+ children: /* @__PURE__ */ jsxs34("title", { children: [
8516
8680
  formatDate(p.date),
8517
8681
  ": ",
8518
8682
  Math.round(p.score)
@@ -8523,7 +8687,7 @@ function ScoreTimeline({ mode = null, source = null }) {
8523
8687
  ]
8524
8688
  }
8525
8689
  ) }),
8526
- /* @__PURE__ */ jsxs33(Text35, { muted: true, size: 2, children: [
8690
+ /* @__PURE__ */ jsxs34(Text36, { muted: true, size: 2, children: [
8527
8691
  chartPoints.length,
8528
8692
  " data point",
8529
8693
  chartPoints.length !== 1 ? "s" : ""
@@ -8533,7 +8697,7 @@ function ScoreTimeline({ mode = null, source = null }) {
8533
8697
  var ScoreTimeline_default = ScoreTimeline;
8534
8698
 
8535
8699
  // src/components/Dashboard.tsx
8536
- import { jsx as jsx47, jsxs as jsxs34 } from "react/jsx-runtime";
8700
+ import { jsx as jsx49, jsxs as jsxs35 } from "react/jsx-runtime";
8537
8701
  var VIEW_PARAM_MAP = {
8538
8702
  compare: "compare",
8539
8703
  timeline: "timeline"
@@ -8544,7 +8708,7 @@ function Dashboard() {
8544
8708
  const reportId = routerState.reportId ?? null;
8545
8709
  const isDetail = reportId !== null;
8546
8710
  const activeTab = isDetail ? "latest" : VIEW_PARAM_MAP[routerState.view ?? ""] ?? "latest";
8547
- const navigateToTab = useCallback21(
8711
+ const navigateToTab = useCallback22(
8548
8712
  (tab) => {
8549
8713
  if (tab === "latest") {
8550
8714
  router.navigate({});
@@ -8554,33 +8718,35 @@ function Dashboard() {
8554
8718
  },
8555
8719
  [router]
8556
8720
  );
8557
- const handleSelectReport = useCallback21(
8721
+ const handleSelectReport = useCallback22(
8558
8722
  (id) => {
8559
8723
  router.navigate({ reportId: id });
8560
8724
  },
8561
8725
  [router]
8562
8726
  );
8563
- const handleTabChange = useCallback21(
8564
- (tab) => {
8727
+ const handleTabChange = useCallback22(
8728
+ (tab, subTab, focus) => {
8565
8729
  if (!routerState.reportId) return;
8566
- if (tab) {
8567
- router.navigate({ reportId: routerState.reportId, tab });
8568
- } else {
8569
- router.navigate({ reportId: routerState.reportId });
8570
- }
8730
+ const state = {
8731
+ reportId: routerState.reportId
8732
+ };
8733
+ if (tab) state.tab = tab;
8734
+ if (subTab) state.subTab = subTab;
8735
+ if (focus) state.focus = focus;
8736
+ router.navigate(state);
8571
8737
  },
8572
8738
  [router, routerState.reportId]
8573
8739
  );
8574
- const handleBack = useCallback21(() => {
8740
+ const handleBack = useCallback22(() => {
8575
8741
  router.navigate({});
8576
8742
  }, [router]);
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" })
8743
+ return /* @__PURE__ */ jsx49(Container, { width: 4, children: /* @__PURE__ */ jsxs35(Stack29, { padding: 4, space: 4, children: [
8744
+ /* @__PURE__ */ jsx49(Flex29, { align: "center", gap: 3, children: /* @__PURE__ */ jsxs35(Stack29, { flex: 1, space: 1, children: [
8745
+ /* @__PURE__ */ jsx49(Text37, { size: 4, weight: "bold", children: "AI Literacy Framework" }),
8746
+ /* @__PURE__ */ jsx49(Text37, { muted: true, size: 2, children: "Evaluation reports and score trends" })
8581
8747
  ] }) }),
8582
- !isDetail && /* @__PURE__ */ jsxs34(TabList2, { space: 1, children: [
8583
- /* @__PURE__ */ jsx47(
8748
+ !isDetail && /* @__PURE__ */ jsxs35(TabList2, { space: 1, children: [
8749
+ /* @__PURE__ */ jsx49(
8584
8750
  Tab2,
8585
8751
  {
8586
8752
  "aria-controls": "latest-panel",
@@ -8590,7 +8756,7 @@ function Dashboard() {
8590
8756
  selected: activeTab === "latest"
8591
8757
  }
8592
8758
  ),
8593
- /* @__PURE__ */ jsx47(
8759
+ /* @__PURE__ */ jsx49(
8594
8760
  Tab2,
8595
8761
  {
8596
8762
  "aria-controls": "timeline-panel",
@@ -8600,7 +8766,7 @@ function Dashboard() {
8600
8766
  selected: activeTab === "timeline"
8601
8767
  }
8602
8768
  ),
8603
- /* @__PURE__ */ jsx47(
8769
+ /* @__PURE__ */ jsx49(
8604
8770
  Tab2,
8605
8771
  {
8606
8772
  "aria-controls": "compare-panel",
@@ -8611,16 +8777,18 @@ function Dashboard() {
8611
8777
  }
8612
8778
  )
8613
8779
  ] }),
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(
8780
+ !isDetail && activeTab === "latest" && /* @__PURE__ */ jsx49(TabPanel2, { "aria-labelledby": "latest-tab", id: "latest-panel", children: /* @__PURE__ */ jsx49(LatestReports, { onSelectReport: handleSelectReport }) }),
8781
+ !isDetail && activeTab === "timeline" && /* @__PURE__ */ jsx49(TabPanel2, { "aria-labelledby": "timeline-tab", id: "timeline-panel", children: /* @__PURE__ */ jsx49(ScoreTimeline_default, {}) }),
8782
+ !isDetail && activeTab === "compare" && /* @__PURE__ */ jsx49(TabPanel2, { "aria-labelledby": "compare-tab", id: "compare-panel", children: /* @__PURE__ */ jsx49(ComparisonView, {}) }),
8783
+ isDetail && reportId && /* @__PURE__ */ jsx49(
8618
8784
  ReportDetail,
8619
8785
  {
8620
8786
  activeTab: routerState.tab ?? null,
8787
+ focus: routerState.focus ?? null,
8621
8788
  onBack: handleBack,
8622
8789
  onTabChange: handleTabChange,
8623
- reportId
8790
+ reportId,
8791
+ subTab: routerState.subTab ?? null
8624
8792
  }
8625
8793
  )
8626
8794
  ] }) });
@@ -8628,7 +8796,11 @@ function Dashboard() {
8628
8796
 
8629
8797
  // src/tool.tsx
8630
8798
  var toolRouter = route.create("/", [
8631
- route.create("/report/:reportId", [route.create("/:tab")]),
8799
+ route.create("/report/:reportId", [
8800
+ route.create("/:tab", [
8801
+ route.create("/:subTab", [route.create("/:focus")])
8802
+ ])
8803
+ ]),
8632
8804
  route.create("/:view")
8633
8805
  ]);
8634
8806
  function ailfTool(options = {}) {
@@ -8643,8 +8815,8 @@ function ailfTool(options = {}) {
8643
8815
 
8644
8816
  // src/actions/RunEvaluationAction.tsx
8645
8817
  import { BarChartIcon as BarChartIcon2 } from "@sanity/icons";
8646
- import { useToast as useToast8 } from "@sanity/ui";
8647
- import { useCallback as useCallback22, useEffect as useEffect9, useRef as useRef4, useState as useState17 } from "react";
8818
+ import { useToast as useToast10 } from "@sanity/ui";
8819
+ import { useCallback as useCallback23, useEffect as useEffect10, useRef as useRef5, useState as useState17 } from "react";
8648
8820
  import {
8649
8821
  getReleaseIdFromReleaseDocumentId as getReleaseIdFromReleaseDocumentId3,
8650
8822
  useClient as useClient12,
@@ -8674,11 +8846,11 @@ function createRunEvaluationAction(options = {}) {
8674
8846
  const dataset = useDataset2();
8675
8847
  const projectId = useProjectId2();
8676
8848
  const currentUser = useCurrentUser4();
8677
- const toast = useToast8();
8849
+ const toast = useToast10();
8678
8850
  const [state, setState] = useState17({ status: "loading" });
8679
- const requestedAtRef = useRef4(null);
8851
+ const requestedAtRef = useRef5(null);
8680
8852
  const perspectiveId = getReleaseIdFromReleaseDocumentId3(release._id);
8681
- useEffect9(() => {
8853
+ useEffect10(() => {
8682
8854
  let cancelled = false;
8683
8855
  client.fetch(contentImpactQuery, buildReportQueryParams(perspectiveId)).then((results) => {
8684
8856
  if (cancelled) return;
@@ -8701,7 +8873,7 @@ function createRunEvaluationAction(options = {}) {
8701
8873
  cancelled = true;
8702
8874
  };
8703
8875
  }, [client, perspectiveId]);
8704
- useEffect9(() => {
8876
+ useEffect10(() => {
8705
8877
  if (state.status !== "requested" && state.status !== "polling") return;
8706
8878
  const { requestId, startedAt } = state;
8707
8879
  if (state.status === "requested") {
@@ -8751,7 +8923,7 @@ function createRunEvaluationAction(options = {}) {
8751
8923
  }, POLL_INTERVAL_MS2);
8752
8924
  return () => clearInterval(interval);
8753
8925
  }, [client, perspectiveId, state]);
8754
- useEffect9(() => {
8926
+ useEffect10(() => {
8755
8927
  if (state.status !== "error") return;
8756
8928
  const timer = setTimeout(() => {
8757
8929
  client.fetch(contentImpactQuery, buildReportQueryParams(perspectiveId)).then((results) => {
@@ -8771,7 +8943,7 @@ function createRunEvaluationAction(options = {}) {
8771
8943
  }, 15e3);
8772
8944
  return () => clearTimeout(timer);
8773
8945
  }, [client, perspectiveId, state]);
8774
- const handleRequest = useCallback22(async () => {
8946
+ const handleRequest = useCallback23(async () => {
8775
8947
  const releaseTitle = release.metadata?.title ?? perspectiveId ?? "release";
8776
8948
  const tag = `release-${slugify3(releaseTitle)}-${dateStamp3()}`;
8777
8949
  const now = Date.now();