@sanity/ailf-studio 0.1.26 → 0.2.0

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