@sanity/ailf-studio 0.1.15 → 0.1.17

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
@@ -486,6 +486,14 @@ var evalRequestSchema = defineType({
486
486
  title: "Report ID",
487
487
  type: "string"
488
488
  }),
489
+ defineField({
490
+ description: "The report ID this request was re-run from (lineage tracking)",
491
+ group: ["optional", "all-fields"],
492
+ name: "sourceReportId",
493
+ readOnly: true,
494
+ title: "Source Report ID",
495
+ type: "string"
496
+ }),
489
497
  defineField({
490
498
  description: "ISO timestamp of when the request was created",
491
499
  group: ["main", "all-fields"],
@@ -891,6 +899,25 @@ var reportSchema = defineType4({
891
899
  name: "git",
892
900
  title: "Git Metadata",
893
901
  type: "object"
902
+ }),
903
+ defineField4({
904
+ fields: [
905
+ defineField4({
906
+ description: "Report ID this report was re-run from",
907
+ name: "rerunOf",
908
+ title: "Re-run Of",
909
+ type: "string"
910
+ }),
911
+ defineField4({
912
+ description: "Report ID this report was explicitly compared against",
913
+ name: "comparedAgainst",
914
+ title: "Compared Against",
915
+ type: "string"
916
+ })
917
+ ],
918
+ name: "lineage",
919
+ title: "Lineage",
920
+ type: "object"
894
921
  })
895
922
  ],
896
923
  group: ["main", "all-fields"],
@@ -2637,7 +2664,7 @@ var taskSchema = defineType5({
2637
2664
  components: {
2638
2665
  input: OriginInput
2639
2666
  },
2640
- hidden: ({ document }) => !document?.origin,
2667
+ hidden: ({ document: document2 }) => !document2?.origin,
2641
2668
  name: "origin",
2642
2669
  options: {
2643
2670
  collapsible: true,
@@ -2685,7 +2712,7 @@ var taskSchema = defineType5({
2685
2712
  // Document-level read-only when mirrored from a repo.
2686
2713
  // Native tasks (no origin) are fully editable; mirrored tasks
2687
2714
  // are read-only because the source of truth is the repo.
2688
- readOnly: ({ document }) => !!document?.origin,
2715
+ readOnly: ({ document: document2 }) => !!document2?.origin,
2689
2716
  title: "AILF Task",
2690
2717
  type: "document"
2691
2718
  });
@@ -2780,17 +2807,17 @@ import { route } from "sanity/router";
2780
2807
  // src/components/Dashboard.tsx
2781
2808
  import {
2782
2809
  Container,
2783
- Flex as Flex26,
2810
+ Flex as Flex29,
2784
2811
  Select as Select3,
2785
- Stack as Stack25,
2812
+ Stack as Stack27,
2786
2813
  Tab as Tab2,
2787
2814
  TabList as TabList2,
2788
2815
  TabPanel as TabPanel2,
2789
- Text as Text34
2816
+ Text as Text36
2790
2817
  } from "@sanity/ui";
2791
- import { useCallback as useCallback15, useEffect as useEffect10, useState as useState12 } from "react";
2792
- import { useClient as useClient9 } from "sanity";
2793
- import { useRouter } from "sanity/router";
2818
+ import { useCallback as useCallback22, useEffect as useEffect11, useState as useState17 } from "react";
2819
+ import { useClient as useClient14 } from "sanity";
2820
+ import { useRouter as useRouter2 } from "sanity/router";
2794
2821
 
2795
2822
  // src/queries.ts
2796
2823
  var REPORT_TYPE = "ailf.report";
@@ -4767,21 +4794,21 @@ function getDateThreshold(preset) {
4767
4794
  import { ArrowLeftIcon as ArrowLeftIcon2 } from "@sanity/icons";
4768
4795
  import {
4769
4796
  Box as Box15,
4770
- Button as Button3,
4771
- Stack as Stack23,
4797
+ Button as Button5,
4798
+ Stack as Stack25,
4772
4799
  Tab,
4773
4800
  TabList,
4774
4801
  TabPanel,
4775
- Text as Text32,
4776
- Tooltip as Tooltip9
4802
+ Text as Text34,
4803
+ Tooltip as Tooltip8
4777
4804
  } from "@sanity/ui";
4778
4805
  import {
4779
- useCallback as useCallback13,
4780
- useEffect as useEffect8,
4806
+ useCallback as useCallback20,
4807
+ useEffect as useEffect9,
4781
4808
  useMemo as useMemo7,
4782
- useState as useState10
4809
+ useState as useState15
4783
4810
  } from "react";
4784
- import { useClient as useClient7 } from "sanity";
4811
+ import { useClient as useClient12 } from "sanity";
4785
4812
 
4786
4813
  // src/components/report-detail/AgentActivitySection.tsx
4787
4814
  import { useMemo as useMemo6, useState as useState8 } from "react";
@@ -5316,17 +5343,150 @@ function AreaBadgeGroup({
5316
5343
  ] });
5317
5344
  }
5318
5345
 
5346
+ // src/components/report-detail/LineageCard.tsx
5347
+ import { LinkIcon as LinkIcon2 } from "@sanity/icons";
5348
+ import { Badge as Badge18, Card as Card18, Flex as Flex20, Stack as Stack18, Text as Text27 } from "@sanity/ui";
5349
+ import { useCallback as useCallback13, useEffect as useEffect8, useState as useState9 } from "react";
5350
+ import { useClient as useClient7 } from "sanity";
5351
+ import { useRouter } from "sanity/router";
5352
+ import { jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
5353
+ var REPORT_TYPE2 = "ailf.report";
5354
+ var SPAWNED_REPORTS_QUERY = (
5355
+ /* groq */
5356
+ `
5357
+ *[_type == $type && provenance.lineage.rerunOf == $reportId] | order(completedAt desc) {
5358
+ reportId,
5359
+ completedAt,
5360
+ tag
5361
+ }
5362
+ `
5363
+ );
5364
+ function LineageCard({ provenance, reportId }) {
5365
+ const { lineage } = provenance;
5366
+ const router = useRouter();
5367
+ const client = useClient7({ apiVersion: API_VERSION });
5368
+ const [spawned, setSpawned] = useState9([]);
5369
+ useEffect8(() => {
5370
+ let cancelled = false;
5371
+ client.fetch(SPAWNED_REPORTS_QUERY, {
5372
+ reportId,
5373
+ type: REPORT_TYPE2
5374
+ }).then((data) => {
5375
+ if (!cancelled) setSpawned(data ?? []);
5376
+ }).catch(() => {
5377
+ });
5378
+ return () => {
5379
+ cancelled = true;
5380
+ };
5381
+ }, [client, reportId]);
5382
+ const hasLineage = lineage?.rerunOf || lineage?.comparedAgainst;
5383
+ if (!hasLineage && spawned.length === 0) return null;
5384
+ return /* @__PURE__ */ jsx32(Card18, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs26(Stack18, { space: 4, children: [
5385
+ /* @__PURE__ */ jsx32(Flex20, { align: "center", gap: 2, children: /* @__PURE__ */ jsxs26(Text27, { size: 3, weight: "semibold", children: [
5386
+ /* @__PURE__ */ jsx32(LinkIcon2, {}),
5387
+ " Lineage"
5388
+ ] }) }),
5389
+ lineage?.rerunOf && /* @__PURE__ */ jsx32(
5390
+ LineageLink,
5391
+ {
5392
+ label: "Re-run of",
5393
+ reportId: lineage.rerunOf,
5394
+ router
5395
+ }
5396
+ ),
5397
+ lineage?.comparedAgainst && /* @__PURE__ */ jsx32(
5398
+ LineageLink,
5399
+ {
5400
+ label: "Compared against",
5401
+ reportId: lineage.comparedAgainst,
5402
+ router
5403
+ }
5404
+ ),
5405
+ spawned.length > 0 && /* @__PURE__ */ jsxs26(Stack18, { space: 2, children: [
5406
+ /* @__PURE__ */ jsx32(Text27, { muted: true, size: 1, weight: "semibold", children: "SPAWNED RE-RUNS" }),
5407
+ spawned.map((s) => /* @__PURE__ */ jsx32(SpawnedReportRow, { report: s, router }, s.reportId))
5408
+ ] })
5409
+ ] }) });
5410
+ }
5411
+ function LineageLink({
5412
+ label,
5413
+ reportId,
5414
+ router
5415
+ }) {
5416
+ const handleClick = useCallback13(() => {
5417
+ router.navigate({ reportId });
5418
+ }, [reportId, router]);
5419
+ return /* @__PURE__ */ jsxs26(Flex20, { align: "center", gap: 2, children: [
5420
+ /* @__PURE__ */ jsxs26(Text27, { muted: true, size: 2, weight: "semibold", children: [
5421
+ label,
5422
+ ":"
5423
+ ] }),
5424
+ /* @__PURE__ */ jsx32(Text27, { size: 2, children: /* @__PURE__ */ jsxs26(
5425
+ "a",
5426
+ {
5427
+ href: "#",
5428
+ onClick: (e) => {
5429
+ e.preventDefault();
5430
+ handleClick();
5431
+ },
5432
+ style: { cursor: "pointer" },
5433
+ children: [
5434
+ reportId.slice(0, 12),
5435
+ "\u2026"
5436
+ ]
5437
+ }
5438
+ ) })
5439
+ ] });
5440
+ }
5441
+ function SpawnedReportRow({
5442
+ report,
5443
+ router
5444
+ }) {
5445
+ const handleClick = useCallback13(() => {
5446
+ router.navigate({ reportId: report.reportId });
5447
+ }, [report.reportId, router]);
5448
+ const dateLabel = formatShortDate(report.completedAt);
5449
+ const label = report.tag ?? dateLabel;
5450
+ return /* @__PURE__ */ jsxs26(Flex20, { align: "center", gap: 2, children: [
5451
+ /* @__PURE__ */ jsx32(Text27, { size: 2, children: /* @__PURE__ */ jsx32(
5452
+ "a",
5453
+ {
5454
+ href: "#",
5455
+ onClick: (e) => {
5456
+ e.preventDefault();
5457
+ handleClick();
5458
+ },
5459
+ style: { cursor: "pointer" },
5460
+ children: label
5461
+ }
5462
+ ) }),
5463
+ report.tag && /* @__PURE__ */ jsx32(Text27, { muted: true, size: 1, children: dateLabel }),
5464
+ /* @__PURE__ */ jsx32(Badge18, { fontSize: 1, mode: "outline", tone: "default", children: report.reportId.slice(0, 8) })
5465
+ ] });
5466
+ }
5467
+ function formatShortDate(iso) {
5468
+ try {
5469
+ return new Date(iso).toLocaleDateString("en-US", {
5470
+ day: "numeric",
5471
+ month: "short",
5472
+ year: "numeric"
5473
+ });
5474
+ } catch {
5475
+ return iso;
5476
+ }
5477
+ }
5478
+
5319
5479
  // src/components/report-detail/JudgmentList.tsx
5320
- import { useState as useState9 } from "react";
5480
+ import { useState as useState10 } from "react";
5321
5481
  import { HelpCircleIcon as HelpCircleIcon6 } from "@sanity/icons";
5322
- import { Badge as Badge18, Box as Box12, Card as Card18, Flex as Flex20, Stack as Stack18, Text as Text27, Tooltip as Tooltip6 } from "@sanity/ui";
5482
+ import { Badge as Badge19, Box as Box12, Card as Card19, Flex as Flex21, Stack as Stack19, Text as Text28, Tooltip as Tooltip6 } from "@sanity/ui";
5323
5483
 
5324
5484
  // src/components/primitives/InlineCode.tsx
5325
- import { Fragment as Fragment5, jsx as jsx32 } from "react/jsx-runtime";
5485
+ import { Fragment as Fragment5, jsx as jsx33 } from "react/jsx-runtime";
5326
5486
  function InlineCode({ text }) {
5327
5487
  const parts = text.split(/`([^`]+)`/);
5328
- return /* @__PURE__ */ jsx32(Fragment5, { children: parts.map(
5329
- (part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx32(
5488
+ return /* @__PURE__ */ jsx33(Fragment5, { children: parts.map(
5489
+ (part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx33(
5330
5490
  "code",
5331
5491
  {
5332
5492
  style: {
@@ -5338,12 +5498,12 @@ function InlineCode({ text }) {
5338
5498
  children: part
5339
5499
  },
5340
5500
  i
5341
- ) : /* @__PURE__ */ jsx32("span", { children: part }, i)
5501
+ ) : /* @__PURE__ */ jsx33("span", { children: part }, i)
5342
5502
  ) });
5343
5503
  }
5344
5504
 
5345
5505
  // src/components/report-detail/JudgmentList.tsx
5346
- import { jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
5506
+ import { jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
5347
5507
  function groupByArea(judgments) {
5348
5508
  const byArea = /* @__PURE__ */ new Map();
5349
5509
  for (const j of judgments) {
@@ -5358,56 +5518,56 @@ var DIMENSION_LABELS = DIMENSION_LABELS_KEBAB;
5358
5518
  function JudgmentList({ judgments }) {
5359
5519
  if (judgments.length === 0) return null;
5360
5520
  const grouped = groupByArea(judgments);
5361
- return /* @__PURE__ */ jsx33(Card18, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs26(Stack18, { space: 4, children: [
5362
- /* @__PURE__ */ jsxs26(Flex20, { align: "center", gap: 3, wrap: "wrap", children: [
5363
- /* @__PURE__ */ jsx33(Text27, { size: 3, weight: "semibold", children: "Low-Scoring Judgments" }),
5364
- /* @__PURE__ */ jsx33(
5521
+ return /* @__PURE__ */ jsx34(Card19, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs27(Stack19, { space: 4, children: [
5522
+ /* @__PURE__ */ jsxs27(Flex21, { align: "center", gap: 3, wrap: "wrap", children: [
5523
+ /* @__PURE__ */ jsx34(Text28, { size: 3, weight: "semibold", children: "Low-Scoring Judgments" }),
5524
+ /* @__PURE__ */ jsx34(
5365
5525
  Tooltip6,
5366
5526
  {
5367
- content: /* @__PURE__ */ jsx33(Box12, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx33(Text27, { size: 2, children: GLOSSARY.lowScoringJudgments }) }),
5527
+ content: /* @__PURE__ */ jsx34(Box12, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx34(Text28, { size: 2, children: GLOSSARY.lowScoringJudgments }) }),
5368
5528
  placement: "bottom",
5369
5529
  portal: true,
5370
- children: /* @__PURE__ */ jsx33(Text27, { muted: true, size: 1, children: /* @__PURE__ */ jsx33(HelpCircleIcon6, {}) })
5530
+ children: /* @__PURE__ */ jsx34(Text28, { muted: true, size: 1, children: /* @__PURE__ */ jsx34(HelpCircleIcon6, {}) })
5371
5531
  }
5372
5532
  ),
5373
- /* @__PURE__ */ jsx33(Card18, { padding: 2, radius: 2, tone: "critical", children: /* @__PURE__ */ jsxs26(Text27, { size: 2, weight: "bold", children: [
5533
+ /* @__PURE__ */ jsx34(Card19, { padding: 2, radius: 2, tone: "critical", children: /* @__PURE__ */ jsxs27(Text28, { size: 2, weight: "bold", children: [
5374
5534
  judgments.length,
5375
5535
  " judgment",
5376
5536
  judgments.length === 1 ? "" : "s",
5377
5537
  " below 70"
5378
5538
  ] }) })
5379
5539
  ] }),
5380
- grouped.map(([area, areaJudgments]) => /* @__PURE__ */ jsx33(Card18, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs26(Stack18, { space: 3, children: [
5381
- /* @__PURE__ */ jsxs26(Text27, { size: 2, weight: "semibold", children: [
5540
+ grouped.map(([area, areaJudgments]) => /* @__PURE__ */ jsx34(Card19, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs27(Stack19, { space: 3, children: [
5541
+ /* @__PURE__ */ jsxs27(Text28, { size: 2, weight: "semibold", children: [
5382
5542
  area,
5383
5543
  " ",
5384
- /* @__PURE__ */ jsxs26(Text27, { muted: true, size: 2, weight: "regular", as: "span", children: [
5544
+ /* @__PURE__ */ jsxs27(Text28, { muted: true, size: 2, weight: "regular", as: "span", children: [
5385
5545
  "(",
5386
5546
  areaJudgments.length,
5387
5547
  ")"
5388
5548
  ] })
5389
5549
  ] }),
5390
- areaJudgments.map((j, i) => /* @__PURE__ */ jsx33(JudgmentCard, { judgment: j }, `${area}-${i}`))
5550
+ areaJudgments.map((j, i) => /* @__PURE__ */ jsx34(JudgmentCard, { judgment: j }, `${area}-${i}`))
5391
5551
  ] }) }, area))
5392
5552
  ] }) });
5393
5553
  }
5394
5554
  function JudgmentCard({ judgment }) {
5395
- const [expanded, setExpanded] = useState9(false);
5555
+ const [expanded, setExpanded] = useState10(false);
5396
5556
  const dimLabel = DIMENSION_LABELS[judgment.dimension] ?? judgment.dimension;
5397
5557
  const sep = judgment.taskId.indexOf(" - ");
5398
5558
  const taskName = sep > 0 ? judgment.taskId.substring(sep + 3) : judgment.taskId;
5399
- return /* @__PURE__ */ jsx33(
5400
- Card18,
5559
+ return /* @__PURE__ */ jsx34(
5560
+ Card19,
5401
5561
  {
5402
5562
  padding: 3,
5403
5563
  radius: 2,
5404
5564
  shadow: 1,
5405
5565
  style: { cursor: "pointer" },
5406
5566
  onClick: () => setExpanded(!expanded),
5407
- children: /* @__PURE__ */ jsxs26(Stack18, { space: 3, children: [
5408
- /* @__PURE__ */ jsxs26(Flex20, { align: "center", gap: 2, wrap: "wrap", children: [
5409
- /* @__PURE__ */ jsx33(Card18, { padding: 2, radius: 2, tone: scoreTone(judgment.score), children: /* @__PURE__ */ jsx33(
5410
- Text27,
5567
+ children: /* @__PURE__ */ jsxs27(Stack19, { space: 3, children: [
5568
+ /* @__PURE__ */ jsxs27(Flex21, { align: "center", gap: 2, wrap: "wrap", children: [
5569
+ /* @__PURE__ */ jsx34(Card19, { padding: 2, radius: 2, tone: scoreTone(judgment.score), children: /* @__PURE__ */ jsx34(
5570
+ Text28,
5411
5571
  {
5412
5572
  align: "center",
5413
5573
  size: 2,
@@ -5416,24 +5576,24 @@ function JudgmentCard({ judgment }) {
5416
5576
  children: judgment.score
5417
5577
  }
5418
5578
  ) }),
5419
- /* @__PURE__ */ jsx33(Badge18, { tone: "default", children: dimLabel }),
5420
- /* @__PURE__ */ jsx33(Text27, { size: 2, weight: "medium", children: taskName }),
5421
- /* @__PURE__ */ jsx33(Text27, { muted: true, size: 1, children: judgment.modelId }),
5422
- /* @__PURE__ */ jsx33(Text27, { muted: true, size: 1, style: { marginLeft: "auto" }, children: expanded ? "\u25B2" : "\u25BC" })
5579
+ /* @__PURE__ */ jsx34(Badge19, { tone: "default", children: dimLabel }),
5580
+ /* @__PURE__ */ jsx34(Text28, { size: 2, weight: "medium", children: taskName }),
5581
+ /* @__PURE__ */ jsx34(Text28, { muted: true, size: 1, children: judgment.modelId }),
5582
+ /* @__PURE__ */ jsx34(Text28, { muted: true, size: 1, style: { marginLeft: "auto" }, children: expanded ? "\u25B2" : "\u25BC" })
5423
5583
  ] }),
5424
- expanded && /* @__PURE__ */ jsxs26(Stack18, { space: 3, children: [
5425
- /* @__PURE__ */ jsx33(Card18, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx33(
5426
- Text27,
5584
+ expanded && /* @__PURE__ */ jsxs27(Stack19, { space: 3, children: [
5585
+ /* @__PURE__ */ jsx34(Card19, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx34(
5586
+ Text28,
5427
5587
  {
5428
5588
  muted: true,
5429
5589
  size: 2,
5430
5590
  style: { lineHeight: 1.6, whiteSpace: "pre-wrap" },
5431
- children: /* @__PURE__ */ jsx33(InlineCode, { text: judgment.reason })
5591
+ children: /* @__PURE__ */ jsx34(InlineCode, { text: judgment.reason })
5432
5592
  }
5433
5593
  ) }),
5434
- judgment.canonicalDocs && judgment.canonicalDocs.length > 0 && /* @__PURE__ */ jsxs26(Flex20, { align: "center", gap: 2, wrap: "wrap", children: [
5435
- /* @__PURE__ */ jsx33(Text27, { muted: true, size: 1, children: "Docs:" }),
5436
- judgment.canonicalDocs.map((doc) => /* @__PURE__ */ jsx33(DocBadge, { doc }, doc.slug))
5594
+ judgment.canonicalDocs && judgment.canonicalDocs.length > 0 && /* @__PURE__ */ jsxs27(Flex21, { align: "center", gap: 2, wrap: "wrap", children: [
5595
+ /* @__PURE__ */ jsx34(Text28, { muted: true, size: 1, children: "Docs:" }),
5596
+ judgment.canonicalDocs.map((doc) => /* @__PURE__ */ jsx34(DocBadge, { doc }, doc.slug))
5437
5597
  ] })
5438
5598
  ] })
5439
5599
  ] })
@@ -5449,17 +5609,17 @@ var editLinkStyle = {
5449
5609
  function DocBadge({
5450
5610
  doc
5451
5611
  }) {
5452
- const [hovered, setHovered] = useState9(false);
5612
+ const [hovered, setHovered] = useState10(false);
5453
5613
  const isLinked = Boolean(doc.documentId);
5454
5614
  const tooltipLabel = isLinked ? `Edit "${doc.title || doc.slug}"` : doc.title || doc.slug;
5455
- const badge = /* @__PURE__ */ jsx33(Badge18, { mode: "outline", tone: isLinked && hovered ? "caution" : "primary", children: doc.slug });
5456
- return /* @__PURE__ */ jsx33(
5615
+ const badge = /* @__PURE__ */ jsx34(Badge19, { mode: "outline", tone: isLinked && hovered ? "caution" : "primary", children: doc.slug });
5616
+ return /* @__PURE__ */ jsx34(
5457
5617
  Tooltip6,
5458
5618
  {
5459
- content: /* @__PURE__ */ jsx33(Box12, { padding: 2, children: /* @__PURE__ */ jsx33(Text27, { size: 2, children: tooltipLabel }) }),
5619
+ content: /* @__PURE__ */ jsx34(Box12, { padding: 2, children: /* @__PURE__ */ jsx34(Text28, { size: 2, children: tooltipLabel }) }),
5460
5620
  placement: "bottom",
5461
5621
  portal: true,
5462
- children: isLinked ? /* @__PURE__ */ jsx33(
5622
+ children: isLinked ? /* @__PURE__ */ jsx34(
5463
5623
  "a",
5464
5624
  {
5465
5625
  href: `/intent/edit/id=${doc.documentId}`,
@@ -5472,14 +5632,14 @@ function DocBadge({
5472
5632
  },
5473
5633
  children: badge
5474
5634
  }
5475
- ) : /* @__PURE__ */ jsx33("span", { children: badge })
5635
+ ) : /* @__PURE__ */ jsx34("span", { children: badge })
5476
5636
  }
5477
5637
  );
5478
5638
  }
5479
5639
 
5480
5640
  // src/components/report-detail/OverviewStats.tsx
5481
5641
  import { Grid as Grid4 } from "@sanity/ui";
5482
- import { jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
5642
+ import { jsx as jsx35, jsxs as jsxs28 } from "react/jsx-runtime";
5483
5643
  function OverviewStats({
5484
5644
  overall,
5485
5645
  durationMs,
@@ -5487,8 +5647,8 @@ function OverviewStats({
5487
5647
  isFullMode
5488
5648
  }) {
5489
5649
  const overallTone = scoreTone(overall.avgScore);
5490
- return /* @__PURE__ */ jsxs27(Grid4, { columns: [1, 1, 2, isFullMode ? 4 : 4], gap: 3, children: [
5491
- /* @__PURE__ */ jsx34(
5650
+ return /* @__PURE__ */ jsxs28(Grid4, { columns: [1, 1, 2, isFullMode ? 4 : 4], gap: 3, children: [
5651
+ /* @__PURE__ */ jsx35(
5492
5652
  StatCard,
5493
5653
  {
5494
5654
  label: "Overall Score",
@@ -5497,7 +5657,7 @@ function OverviewStats({
5497
5657
  value: overall.avgScore.toFixed(1)
5498
5658
  }
5499
5659
  ),
5500
- /* @__PURE__ */ jsx34(
5660
+ /* @__PURE__ */ jsx35(
5501
5661
  StatCard,
5502
5662
  {
5503
5663
  label: "Doc Lift",
@@ -5506,7 +5666,7 @@ function OverviewStats({
5506
5666
  value: overall.avgDocLift.toFixed(1)
5507
5667
  }
5508
5668
  ),
5509
- isFullMode && overall.avgActualScore != null && /* @__PURE__ */ jsx34(
5669
+ isFullMode && overall.avgActualScore != null && /* @__PURE__ */ jsx35(
5510
5670
  StatCard,
5511
5671
  {
5512
5672
  label: "Actual Score",
@@ -5515,7 +5675,7 @@ function OverviewStats({
5515
5675
  value: overall.avgActualScore.toFixed(1)
5516
5676
  }
5517
5677
  ),
5518
- isFullMode && overall.avgRetrievalGap != null && /* @__PURE__ */ jsx34(
5678
+ isFullMode && overall.avgRetrievalGap != null && /* @__PURE__ */ jsx35(
5519
5679
  StatCard,
5520
5680
  {
5521
5681
  label: "Retrieval Gap",
@@ -5525,7 +5685,7 @@ function OverviewStats({
5525
5685
  value: overall.avgRetrievalGap.toFixed(1)
5526
5686
  }
5527
5687
  ),
5528
- isFullMode && overall.avgInfrastructureEfficiency != null && /* @__PURE__ */ jsx34(
5688
+ isFullMode && overall.avgInfrastructureEfficiency != null && /* @__PURE__ */ jsx35(
5529
5689
  StatCard,
5530
5690
  {
5531
5691
  label: "Infra Efficiency",
@@ -5533,8 +5693,8 @@ function OverviewStats({
5533
5693
  value: formatPercent(overall.avgInfrastructureEfficiency)
5534
5694
  }
5535
5695
  ),
5536
- /* @__PURE__ */ jsx34(StatCard, { label: "Duration", value: formatDuration(durationMs) }),
5537
- /* @__PURE__ */ jsx34(
5696
+ /* @__PURE__ */ jsx35(StatCard, { label: "Duration", value: formatDuration(durationMs) }),
5697
+ /* @__PURE__ */ jsx35(
5538
5698
  StatCard,
5539
5699
  {
5540
5700
  label: "Tests",
@@ -5546,31 +5706,31 @@ function OverviewStats({
5546
5706
  }
5547
5707
 
5548
5708
  // src/components/report-detail/ProvenanceCard.tsx
5549
- import { Card as Card19, Flex as Flex21, Grid as Grid5, Stack as Stack19, Text as Text28 } from "@sanity/ui";
5550
- import { jsx as jsx35, jsxs as jsxs28 } from "react/jsx-runtime";
5709
+ import { Card as Card20, Flex as Flex22, Grid as Grid5, Stack as Stack20, Text as Text29 } from "@sanity/ui";
5710
+ import { jsx as jsx36, jsxs as jsxs29 } from "react/jsx-runtime";
5551
5711
  var VIEWABLE_PROMPTFOO_MODES = /* @__PURE__ */ new Set(["agentic", "observed"]);
5552
5712
  function ProvenanceCard({ provenance }) {
5553
- return /* @__PURE__ */ jsx35(Card19, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs28(Stack19, { space: 4, children: [
5554
- /* @__PURE__ */ jsx35(Text28, { size: 3, weight: "semibold", children: "Provenance" }),
5555
- /* @__PURE__ */ jsxs28(Grid5, { columns: [1, 2, 3], gap: 4, children: [
5556
- /* @__PURE__ */ jsx35(Field, { label: "Mode", value: provenance.mode }),
5557
- /* @__PURE__ */ jsx35(Field, { label: "Source", value: provenance.source.name }),
5558
- /* @__PURE__ */ jsx35(
5713
+ return /* @__PURE__ */ jsx36(Card20, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs29(Stack20, { space: 4, children: [
5714
+ /* @__PURE__ */ jsx36(Text29, { size: 3, weight: "semibold", children: "Provenance" }),
5715
+ /* @__PURE__ */ jsxs29(Grid5, { columns: [1, 2, 3], gap: 4, children: [
5716
+ /* @__PURE__ */ jsx36(Field, { label: "Mode", value: provenance.mode }),
5717
+ /* @__PURE__ */ jsx36(Field, { label: "Source", value: provenance.source.name }),
5718
+ /* @__PURE__ */ jsx36(
5559
5719
  Field,
5560
5720
  {
5561
5721
  label: "Trigger",
5562
5722
  value: provenance.trigger.type + (provenance.trigger.workflow ? ` (${provenance.trigger.workflow})` : "")
5563
5723
  }
5564
5724
  ),
5565
- /* @__PURE__ */ jsx35(
5725
+ /* @__PURE__ */ jsx36(
5566
5726
  Field,
5567
5727
  {
5568
5728
  label: "Models",
5569
5729
  value: provenance.models.map((m) => m.label).join(", ")
5570
5730
  }
5571
5731
  ),
5572
- /* @__PURE__ */ jsx35(Field, { label: "Grader Model", mono: true, value: provenance.graderModel }),
5573
- provenance.contextHash && /* @__PURE__ */ jsx35(
5732
+ /* @__PURE__ */ jsx36(Field, { label: "Grader Model", mono: true, value: provenance.graderModel }),
5733
+ provenance.contextHash && /* @__PURE__ */ jsx36(
5574
5734
  Field,
5575
5735
  {
5576
5736
  label: "Context Hash",
@@ -5579,8 +5739,8 @@ function ProvenanceCard({ provenance }) {
5579
5739
  }
5580
5740
  )
5581
5741
  ] }),
5582
- provenance.git && /* @__PURE__ */ jsx35(GitInfo, { git: provenance.git }),
5583
- /* @__PURE__ */ jsx35(PromptfooLinks, { provenance })
5742
+ provenance.git && /* @__PURE__ */ jsx36(GitInfo, { git: provenance.git }),
5743
+ /* @__PURE__ */ jsx36(PromptfooLinks, { provenance })
5584
5744
  ] }) });
5585
5745
  }
5586
5746
  function Field({
@@ -5588,9 +5748,9 @@ function Field({
5588
5748
  mono,
5589
5749
  value
5590
5750
  }) {
5591
- return /* @__PURE__ */ jsxs28(Stack19, { space: 1, children: [
5592
- /* @__PURE__ */ jsx35(
5593
- Text28,
5751
+ return /* @__PURE__ */ jsxs29(Stack20, { space: 1, children: [
5752
+ /* @__PURE__ */ jsx36(
5753
+ Text29,
5594
5754
  {
5595
5755
  muted: true,
5596
5756
  size: 1,
@@ -5599,7 +5759,7 @@ function Field({
5599
5759
  children: label
5600
5760
  }
5601
5761
  ),
5602
- /* @__PURE__ */ jsx35(Text28, { size: 2, style: mono ? { fontFamily: "monospace" } : void 0, children: value })
5762
+ /* @__PURE__ */ jsx36(Text29, { size: 2, style: mono ? { fontFamily: "monospace" } : void 0, children: value })
5603
5763
  ] });
5604
5764
  }
5605
5765
  function GitInfo({ git }) {
@@ -5607,15 +5767,15 @@ function GitInfo({ git }) {
5607
5767
  const branchUrl = `${repoUrl}/tree/${git.branch}`;
5608
5768
  const commitUrl = `${repoUrl}/commit/${git.sha}`;
5609
5769
  const prUrl = git.prNumber ? `${repoUrl}/pull/${git.prNumber}` : null;
5610
- return /* @__PURE__ */ jsx35(Card19, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs28(Flex21, { align: "center", gap: 3, wrap: "wrap", children: [
5611
- /* @__PURE__ */ jsx35(Text28, { muted: true, size: 2, weight: "semibold", children: "Git" }),
5612
- /* @__PURE__ */ jsxs28(Text28, { size: 2, children: [
5613
- /* @__PURE__ */ jsx35("a", { href: repoUrl, rel: "noopener noreferrer", target: "_blank", children: git.repo }),
5770
+ return /* @__PURE__ */ jsx36(Card20, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs29(Flex22, { align: "center", gap: 3, wrap: "wrap", children: [
5771
+ /* @__PURE__ */ jsx36(Text29, { muted: true, size: 2, weight: "semibold", children: "Git" }),
5772
+ /* @__PURE__ */ jsxs29(Text29, { size: 2, children: [
5773
+ /* @__PURE__ */ jsx36("a", { href: repoUrl, rel: "noopener noreferrer", target: "_blank", children: git.repo }),
5614
5774
  " / ",
5615
- /* @__PURE__ */ jsx35("a", { href: branchUrl, rel: "noopener noreferrer", target: "_blank", children: git.branch })
5775
+ /* @__PURE__ */ jsx36("a", { href: branchUrl, rel: "noopener noreferrer", target: "_blank", children: git.branch })
5616
5776
  ] }),
5617
- /* @__PURE__ */ jsx35(Text28, { muted: true, size: 2, style: { fontFamily: "monospace" }, children: /* @__PURE__ */ jsx35("a", { href: commitUrl, rel: "noopener noreferrer", target: "_blank", children: git.sha.slice(0, 12) }) }),
5618
- prUrl && /* @__PURE__ */ jsx35(Text28, { size: 2, children: /* @__PURE__ */ jsxs28("a", { href: prUrl, rel: "noopener noreferrer", target: "_blank", children: [
5777
+ /* @__PURE__ */ jsx36(Text29, { muted: true, size: 2, style: { fontFamily: "monospace" }, children: /* @__PURE__ */ jsx36("a", { href: commitUrl, rel: "noopener noreferrer", target: "_blank", children: git.sha.slice(0, 12) }) }),
5778
+ prUrl && /* @__PURE__ */ jsx36(Text29, { size: 2, children: /* @__PURE__ */ jsxs29("a", { href: prUrl, rel: "noopener noreferrer", target: "_blank", children: [
5619
5779
  "PR #",
5620
5780
  git.prNumber,
5621
5781
  " \u2192"
@@ -5630,14 +5790,14 @@ function PromptfooLinks({
5630
5790
  (e) => VIEWABLE_PROMPTFOO_MODES.has(e.mode)
5631
5791
  );
5632
5792
  if (viewable.length === 0) return null;
5633
- return /* @__PURE__ */ jsx35(Flex21, { gap: 3, wrap: "wrap", children: viewable.map((entry) => /* @__PURE__ */ jsx35(Text28, { size: 2, children: /* @__PURE__ */ jsxs28("a", { href: entry.url, rel: "noopener noreferrer", target: "_blank", children: [
5793
+ return /* @__PURE__ */ jsx36(Flex22, { gap: 3, wrap: "wrap", children: viewable.map((entry) => /* @__PURE__ */ jsx36(Text29, { size: 2, children: /* @__PURE__ */ jsxs29("a", { href: entry.url, rel: "noopener noreferrer", target: "_blank", children: [
5634
5794
  "View in Promptfoo (",
5635
5795
  entry.mode,
5636
5796
  ") \u2192"
5637
5797
  ] }) }, entry.mode)) });
5638
5798
  }
5639
5799
  if (provenance.promptfooUrl && VIEWABLE_PROMPTFOO_MODES.has(provenance.mode)) {
5640
- return /* @__PURE__ */ jsx35(Text28, { size: 2, children: /* @__PURE__ */ jsx35(
5800
+ return /* @__PURE__ */ jsx36(Text29, { size: 2, children: /* @__PURE__ */ jsx36(
5641
5801
  "a",
5642
5802
  {
5643
5803
  href: provenance.promptfooUrl,
@@ -5652,32 +5812,32 @@ function PromptfooLinks({
5652
5812
 
5653
5813
  // src/components/report-detail/RecommendationsSection.tsx
5654
5814
  import React4 from "react";
5655
- import { Badge as Badge19, Box as Box13, Card as Card20, Flex as Flex22, Stack as Stack20, Text as Text29, Tooltip as Tooltip7 } from "@sanity/ui";
5815
+ import { Badge as Badge20, Box as Box13, Card as Card21, Flex as Flex23, Stack as Stack21, Text as Text30, Tooltip as Tooltip7 } from "@sanity/ui";
5656
5816
  import { HelpCircleIcon as HelpCircleIcon7 } from "@sanity/icons";
5657
- import { jsx as jsx36, jsxs as jsxs29 } from "react/jsx-runtime";
5817
+ import { jsx as jsx37, jsxs as jsxs30 } from "react/jsx-runtime";
5658
5818
  function RecommendationsSection({
5659
5819
  recommendations
5660
5820
  }) {
5661
5821
  if (recommendations.gaps.length === 0) return null;
5662
- return /* @__PURE__ */ jsx36(Card20, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs29(Stack20, { space: 4, children: [
5663
- /* @__PURE__ */ jsxs29(Flex22, { align: "center", gap: 3, wrap: "wrap", children: [
5664
- /* @__PURE__ */ jsx36(Text29, { size: 3, weight: "semibold", children: "Recommendations" }),
5665
- /* @__PURE__ */ jsx36(
5822
+ return /* @__PURE__ */ jsx37(Card21, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs30(Stack21, { space: 4, children: [
5823
+ /* @__PURE__ */ jsxs30(Flex23, { align: "center", gap: 3, wrap: "wrap", children: [
5824
+ /* @__PURE__ */ jsx37(Text30, { size: 3, weight: "semibold", children: "Recommendations" }),
5825
+ /* @__PURE__ */ jsx37(
5666
5826
  Tooltip7,
5667
5827
  {
5668
- content: /* @__PURE__ */ jsx36(Box13, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx36(Text29, { size: 2, children: GLOSSARY.recommendations }) }),
5828
+ content: /* @__PURE__ */ jsx37(Box13, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx37(Text30, { size: 2, children: GLOSSARY.recommendations }) }),
5669
5829
  placement: "bottom",
5670
5830
  portal: true,
5671
- children: /* @__PURE__ */ jsx36(Text29, { muted: true, size: 1, children: /* @__PURE__ */ jsx36(HelpCircleIcon7, {}) })
5831
+ children: /* @__PURE__ */ jsx37(Text30, { muted: true, size: 1, children: /* @__PURE__ */ jsx37(HelpCircleIcon7, {}) })
5672
5832
  }
5673
5833
  ),
5674
- /* @__PURE__ */ jsx36(
5834
+ /* @__PURE__ */ jsx37(
5675
5835
  Tooltip7,
5676
5836
  {
5677
- content: /* @__PURE__ */ jsx36(Box13, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx36(Text29, { size: 2, children: GLOSSARY.totalPotentialLift }) }),
5837
+ content: /* @__PURE__ */ jsx37(Box13, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx37(Text30, { size: 2, children: GLOSSARY.totalPotentialLift }) }),
5678
5838
  placement: "bottom",
5679
5839
  portal: true,
5680
- children: /* @__PURE__ */ jsx36(Card20, { padding: 2, radius: 2, tone: "positive", children: /* @__PURE__ */ jsxs29(Text29, { size: 2, weight: "bold", children: [
5840
+ children: /* @__PURE__ */ jsx37(Card21, { padding: 2, radius: 2, tone: "positive", children: /* @__PURE__ */ jsxs30(Text30, { size: 2, weight: "bold", children: [
5681
5841
  "+",
5682
5842
  recommendations.totalPotentialLift.toFixed(1),
5683
5843
  " pts potential lift"
@@ -5685,7 +5845,7 @@ function RecommendationsSection({
5685
5845
  }
5686
5846
  )
5687
5847
  ] }),
5688
- /* @__PURE__ */ jsxs29(
5848
+ /* @__PURE__ */ jsxs30(
5689
5849
  "div",
5690
5850
  {
5691
5851
  style: {
@@ -5694,9 +5854,9 @@ function RecommendationsSection({
5694
5854
  gridTemplateColumns: "auto 2fr 2fr 1fr 1fr 1fr"
5695
5855
  },
5696
5856
  children: [
5697
- /* @__PURE__ */ jsx36(ColumnHeader, { borderBottom: true, label: "#" }),
5698
- /* @__PURE__ */ jsx36(ColumnHeader, { borderBottom: true, label: "Area" }),
5699
- /* @__PURE__ */ jsx36(
5857
+ /* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "#" }),
5858
+ /* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "Area" }),
5859
+ /* @__PURE__ */ jsx37(
5700
5860
  ColumnHeader,
5701
5861
  {
5702
5862
  borderBottom: true,
@@ -5704,8 +5864,8 @@ function RecommendationsSection({
5704
5864
  tooltip: GLOSSARY.failureMode
5705
5865
  }
5706
5866
  ),
5707
- /* @__PURE__ */ jsx36(ColumnHeader, { borderBottom: true, label: "Action" }),
5708
- /* @__PURE__ */ jsx36(
5867
+ /* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "Action" }),
5868
+ /* @__PURE__ */ jsx37(
5709
5869
  ColumnHeader,
5710
5870
  {
5711
5871
  borderBottom: true,
@@ -5713,7 +5873,7 @@ function RecommendationsSection({
5713
5873
  tooltip: GLOSSARY.estimatedLift
5714
5874
  }
5715
5875
  ),
5716
- /* @__PURE__ */ jsx36(
5876
+ /* @__PURE__ */ jsx37(
5717
5877
  ColumnHeader,
5718
5878
  {
5719
5879
  borderBottom: true,
@@ -5721,7 +5881,7 @@ function RecommendationsSection({
5721
5881
  tooltip: GLOSSARY.confidence
5722
5882
  }
5723
5883
  ),
5724
- recommendations.gaps.map((gap, i) => /* @__PURE__ */ jsx36(RecommendationRow, { gap, index: i }, `gap-${i}`))
5884
+ recommendations.gaps.map((gap, i) => /* @__PURE__ */ jsx37(RecommendationRow, { gap, index: i }, `gap-${i}`))
5725
5885
  ]
5726
5886
  }
5727
5887
  )
@@ -5733,8 +5893,8 @@ function RecommendationRow({
5733
5893
  }) {
5734
5894
  const confIcon = gap.confidence === "high" ? "\u{1F7E2}" : gap.confidence === "medium" ? "\u{1F7E1}" : "\u{1F534}";
5735
5895
  const bg = rowBackground(index);
5736
- return /* @__PURE__ */ jsxs29(React4.Fragment, { children: [
5737
- /* @__PURE__ */ jsx36(
5896
+ return /* @__PURE__ */ jsxs30(React4.Fragment, { children: [
5897
+ /* @__PURE__ */ jsx37(
5738
5898
  "div",
5739
5899
  {
5740
5900
  style: {
@@ -5744,10 +5904,10 @@ function RecommendationRow({
5744
5904
  display: "flex",
5745
5905
  padding: "8px 4px"
5746
5906
  },
5747
- children: /* @__PURE__ */ jsx36(Text29, { muted: true, size: 2, children: index + 1 })
5907
+ children: /* @__PURE__ */ jsx37(Text30, { muted: true, size: 2, children: index + 1 })
5748
5908
  }
5749
5909
  ),
5750
- /* @__PURE__ */ jsx36(
5910
+ /* @__PURE__ */ jsx37(
5751
5911
  "div",
5752
5912
  {
5753
5913
  style: {
@@ -5756,10 +5916,10 @@ function RecommendationRow({
5756
5916
  display: "flex",
5757
5917
  padding: "8px 0"
5758
5918
  },
5759
- children: /* @__PURE__ */ jsx36(Text29, { size: 2, weight: "medium", children: gap.area })
5919
+ children: /* @__PURE__ */ jsx37(Text30, { size: 2, weight: "medium", children: gap.area })
5760
5920
  }
5761
5921
  ),
5762
- /* @__PURE__ */ jsx36(
5922
+ /* @__PURE__ */ jsx37(
5763
5923
  "div",
5764
5924
  {
5765
5925
  style: {
@@ -5768,8 +5928,8 @@ function RecommendationRow({
5768
5928
  display: "flex",
5769
5929
  padding: "8px 0"
5770
5930
  },
5771
- children: /* @__PURE__ */ jsx36(
5772
- Badge19,
5931
+ children: /* @__PURE__ */ jsx37(
5932
+ Badge20,
5773
5933
  {
5774
5934
  tone: gap.failureMode === "missing-docs" ? "critical" : gap.failureMode === "incorrect-docs" ? "critical" : gap.failureMode === "outdated-docs" ? "caution" : "default",
5775
5935
  children: gap.failureMode
@@ -5777,7 +5937,7 @@ function RecommendationRow({
5777
5937
  )
5778
5938
  }
5779
5939
  ),
5780
- /* @__PURE__ */ jsx36(
5940
+ /* @__PURE__ */ jsx37(
5781
5941
  "div",
5782
5942
  {
5783
5943
  style: {
@@ -5786,10 +5946,10 @@ function RecommendationRow({
5786
5946
  display: "flex",
5787
5947
  padding: "8px 0"
5788
5948
  },
5789
- children: /* @__PURE__ */ jsx36(Text29, { muted: true, size: 2, children: gap.remediation })
5949
+ children: /* @__PURE__ */ jsx37(Text30, { muted: true, size: 2, children: gap.remediation })
5790
5950
  }
5791
5951
  ),
5792
- /* @__PURE__ */ jsx36(
5952
+ /* @__PURE__ */ jsx37(
5793
5953
  "div",
5794
5954
  {
5795
5955
  style: {
@@ -5798,13 +5958,13 @@ function RecommendationRow({
5798
5958
  display: "flex",
5799
5959
  padding: "8px 0"
5800
5960
  },
5801
- children: /* @__PURE__ */ jsx36(Card20, { padding: 2, radius: 2, tone: "positive", children: /* @__PURE__ */ jsxs29(Text29, { align: "center", size: 2, weight: "medium", children: [
5961
+ children: /* @__PURE__ */ jsx37(Card21, { padding: 2, radius: 2, tone: "positive", children: /* @__PURE__ */ jsxs30(Text30, { align: "center", size: 2, weight: "medium", children: [
5802
5962
  "+",
5803
5963
  gap.estimatedLift.toFixed(1)
5804
5964
  ] }) })
5805
5965
  }
5806
5966
  ),
5807
- /* @__PURE__ */ jsx36(
5967
+ /* @__PURE__ */ jsx37(
5808
5968
  "div",
5809
5969
  {
5810
5970
  style: {
@@ -5813,7 +5973,7 @@ function RecommendationRow({
5813
5973
  display: "flex",
5814
5974
  padding: "8px 0"
5815
5975
  },
5816
- children: /* @__PURE__ */ jsxs29(Text29, { size: 2, children: [
5976
+ children: /* @__PURE__ */ jsxs30(Text30, { size: 2, children: [
5817
5977
  confIcon,
5818
5978
  " ",
5819
5979
  gap.confidence
@@ -5824,23 +5984,509 @@ function RecommendationRow({
5824
5984
  }
5825
5985
 
5826
5986
  // src/components/report-detail/ReportHeader.tsx
5827
- import { ArrowLeftIcon, ClipboardIcon } from "@sanity/icons";
5987
+ import { ArrowLeftIcon } from "@sanity/icons";
5988
+ import { Badge as Badge21, Button as Button4, Flex as Flex26, Stack as Stack23, Text as Text32 } from "@sanity/ui";
5989
+
5990
+ // src/components/report-detail/report-actions/ReportActions.tsx
5991
+ import { ChevronDownIcon, CopyIcon as CopyIcon2 } from "@sanity/icons";
5828
5992
  import {
5829
- Badge as Badge20,
5830
- Box as Box14,
5831
- Button as Button2,
5832
- Card as Card21,
5833
- Flex as Flex23,
5834
- Stack as Stack21,
5835
- Text as Text30,
5836
- Tooltip as Tooltip8
5993
+ Button as Button3,
5994
+ Flex as Flex25,
5995
+ Menu as Menu2,
5996
+ MenuButton as MenuButton2,
5997
+ MenuDivider,
5998
+ useToast as useToast7
5837
5999
  } from "@sanity/ui";
5838
- import { Fragment as Fragment6, jsx as jsx37, jsxs as jsxs30 } from "react/jsx-runtime";
6000
+ import { useCallback as useCallback19, useState as useState14 } from "react";
6001
+ import { useClient as useClient11 } from "sanity";
6002
+
6003
+ // src/components/report-detail/report-actions/CopyReportAction.tsx
6004
+ import { ClipboardIcon } from "@sanity/icons";
6005
+ import { MenuItem as MenuItem2, useToast as useToast2 } from "@sanity/ui";
6006
+ import { useCallback as useCallback14, useState as useState11 } from "react";
6007
+ import { useClient as useClient8 } from "sanity";
6008
+ import { jsx as jsx38 } from "react/jsx-runtime";
6009
+ function CopyReportAction({ documentId }) {
6010
+ const client = useClient8({ apiVersion: API_VERSION });
6011
+ const toast = useToast2();
6012
+ const [copying, setCopying] = useState11(false);
6013
+ const handleClick = useCallback14(async () => {
6014
+ setCopying(true);
6015
+ try {
6016
+ const doc = await client.fetch(
6017
+ `*[_type == "ailf.report" && _id == $id][0]`,
6018
+ { id: documentId }
6019
+ );
6020
+ if (!doc) {
6021
+ toast.push({
6022
+ closable: true,
6023
+ status: "error",
6024
+ title: "Report document not found"
6025
+ });
6026
+ return;
6027
+ }
6028
+ const json = JSON.stringify(doc, null, 2);
6029
+ await navigator.clipboard.writeText(json);
6030
+ toast.push({
6031
+ closable: true,
6032
+ status: "success",
6033
+ title: "Report JSON copied to clipboard"
6034
+ });
6035
+ } catch {
6036
+ toast.push({
6037
+ closable: true,
6038
+ status: "error",
6039
+ title: "Failed to copy report"
6040
+ });
6041
+ } finally {
6042
+ setCopying(false);
6043
+ }
6044
+ }, [client, documentId, toast]);
6045
+ return /* @__PURE__ */ jsx38(
6046
+ MenuItem2,
6047
+ {
6048
+ disabled: copying,
6049
+ icon: ClipboardIcon,
6050
+ onClick: handleClick,
6051
+ text: copying ? "Copying\u2026" : "Copy full JSON"
6052
+ }
6053
+ );
6054
+ }
6055
+
6056
+ // src/components/report-detail/report-actions/CopyReportIdAction.tsx
6057
+ import { CopyIcon } from "@sanity/icons";
6058
+ import { MenuItem as MenuItem3, useToast as useToast3 } from "@sanity/ui";
6059
+ import { useCallback as useCallback15 } from "react";
6060
+ import { jsx as jsx39 } from "react/jsx-runtime";
6061
+ function CopyReportIdAction({ reportId }) {
6062
+ const toast = useToast3();
6063
+ const handleClick = useCallback15(() => {
6064
+ navigator.clipboard.writeText(reportId).then(
6065
+ () => {
6066
+ toast.push({
6067
+ closable: true,
6068
+ status: "success",
6069
+ title: "Report ID copied"
6070
+ });
6071
+ },
6072
+ () => {
6073
+ toast.push({
6074
+ closable: true,
6075
+ status: "error",
6076
+ title: "Failed to copy report ID"
6077
+ });
6078
+ }
6079
+ );
6080
+ }, [reportId, toast]);
6081
+ return /* @__PURE__ */ jsx39(MenuItem3, { icon: CopyIcon, onClick: handleClick, text: "Copy report ID" });
6082
+ }
6083
+
6084
+ // src/components/report-detail/report-actions/CopyVisionQueryAction.tsx
6085
+ import { SearchIcon as SearchIcon6 } from "@sanity/icons";
6086
+ import { MenuItem as MenuItem4, useToast as useToast4 } from "@sanity/ui";
6087
+ import { useCallback as useCallback16 } from "react";
6088
+ import { jsx as jsx40 } from "react/jsx-runtime";
6089
+ function CopyVisionQueryAction({
6090
+ reportId
6091
+ }) {
6092
+ const toast = useToast4();
6093
+ const handleClick = useCallback16(() => {
6094
+ const query = `*[_type == "ailf.report" && reportId == "${reportId}"][0]`;
6095
+ navigator.clipboard.writeText(query).then(
6096
+ () => {
6097
+ toast.push({
6098
+ closable: true,
6099
+ description: "Paste into the Vision tool to explore the full document",
6100
+ status: "success",
6101
+ title: "GROQ query copied"
6102
+ });
6103
+ },
6104
+ () => {
6105
+ toast.push({
6106
+ closable: true,
6107
+ status: "error",
6108
+ title: "Failed to copy query"
6109
+ });
6110
+ }
6111
+ );
6112
+ }, [reportId, toast]);
6113
+ return /* @__PURE__ */ jsx40(
6114
+ MenuItem4,
6115
+ {
6116
+ icon: SearchIcon6,
6117
+ onClick: handleClick,
6118
+ text: "Copy Vision query"
6119
+ }
6120
+ );
6121
+ }
6122
+
6123
+ // src/components/report-detail/report-actions/DeleteConfirmDialog.tsx
6124
+ import { Box as Box14, Button as Button2, Card as Card22, Dialog, Flex as Flex24, Stack as Stack22, Text as Text31 } from "@sanity/ui";
6125
+ import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
6126
+ function DeleteConfirmDialog({
6127
+ isDeleting,
6128
+ onClose,
6129
+ onConfirm,
6130
+ reportId
6131
+ }) {
6132
+ return /* @__PURE__ */ jsx41(
6133
+ Dialog,
6134
+ {
6135
+ header: "Delete Report",
6136
+ id: "delete-report-dialog",
6137
+ onClose,
6138
+ width: 1,
6139
+ children: /* @__PURE__ */ jsx41(Box14, { padding: 4, children: /* @__PURE__ */ jsxs31(Stack22, { space: 4, children: [
6140
+ /* @__PURE__ */ jsx41(Text31, { children: "Are you sure you want to delete this report? This action cannot be undone." }),
6141
+ /* @__PURE__ */ jsx41(Card22, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx41(
6142
+ Text31,
6143
+ {
6144
+ muted: true,
6145
+ size: 1,
6146
+ style: { fontFamily: "monospace", wordBreak: "break-all" },
6147
+ children: reportId
6148
+ }
6149
+ ) }),
6150
+ /* @__PURE__ */ jsxs31(Flex24, { gap: 2, justify: "flex-end", children: [
6151
+ /* @__PURE__ */ jsx41(
6152
+ Button2,
6153
+ {
6154
+ disabled: isDeleting,
6155
+ mode: "ghost",
6156
+ onClick: onClose,
6157
+ text: "Cancel"
6158
+ }
6159
+ ),
6160
+ /* @__PURE__ */ jsx41(
6161
+ Button2,
6162
+ {
6163
+ disabled: isDeleting,
6164
+ onClick: onConfirm,
6165
+ text: isDeleting ? "Deleting\u2026" : "Delete",
6166
+ tone: "critical"
6167
+ }
6168
+ )
6169
+ ] })
6170
+ ] }) })
6171
+ }
6172
+ );
6173
+ }
6174
+
6175
+ // src/components/report-detail/report-actions/DeleteReportAction.tsx
6176
+ import { TrashIcon } from "@sanity/icons";
6177
+ import { MenuItem as MenuItem5 } from "@sanity/ui";
6178
+ import { jsx as jsx42 } from "react/jsx-runtime";
6179
+ function DeleteReportAction({
6180
+ onRequestDelete
6181
+ }) {
6182
+ return /* @__PURE__ */ jsx42(
6183
+ MenuItem5,
6184
+ {
6185
+ icon: TrashIcon,
6186
+ onClick: onRequestDelete,
6187
+ text: "Delete report",
6188
+ tone: "critical"
6189
+ }
6190
+ );
6191
+ }
6192
+
6193
+ // src/components/report-detail/report-actions/DownloadReportAction.tsx
6194
+ import { DownloadIcon } from "@sanity/icons";
6195
+ import { MenuItem as MenuItem6, useToast as useToast5 } from "@sanity/ui";
6196
+ import { useCallback as useCallback17, useState as useState12 } from "react";
6197
+ import { useClient as useClient9 } from "sanity";
6198
+ import { jsx as jsx43 } from "react/jsx-runtime";
6199
+ function DownloadReportAction({
6200
+ documentId,
6201
+ reportId
6202
+ }) {
6203
+ const client = useClient9({ apiVersion: API_VERSION });
6204
+ const toast = useToast5();
6205
+ const [downloading, setDownloading] = useState12(false);
6206
+ const handleClick = useCallback17(async () => {
6207
+ setDownloading(true);
6208
+ try {
6209
+ const doc = await client.fetch(
6210
+ `*[_type == "ailf.report" && _id == $id][0]`,
6211
+ { id: documentId }
6212
+ );
6213
+ if (!doc) {
6214
+ toast.push({
6215
+ closable: true,
6216
+ status: "error",
6217
+ title: "Report document not found"
6218
+ });
6219
+ return;
6220
+ }
6221
+ const json = JSON.stringify(doc, null, 2);
6222
+ const blob = new Blob([json], { type: "application/json" });
6223
+ const url = URL.createObjectURL(blob);
6224
+ const anchor = document.createElement("a");
6225
+ anchor.href = url;
6226
+ anchor.download = `ailf-report-${reportId}.json`;
6227
+ document.body.appendChild(anchor);
6228
+ anchor.click();
6229
+ document.body.removeChild(anchor);
6230
+ URL.revokeObjectURL(url);
6231
+ toast.push({
6232
+ closable: true,
6233
+ status: "success",
6234
+ title: "Report downloaded"
6235
+ });
6236
+ } catch {
6237
+ toast.push({
6238
+ closable: true,
6239
+ status: "error",
6240
+ title: "Failed to download report"
6241
+ });
6242
+ } finally {
6243
+ setDownloading(false);
6244
+ }
6245
+ }, [client, documentId, reportId, toast]);
6246
+ return /* @__PURE__ */ jsx43(
6247
+ MenuItem6,
6248
+ {
6249
+ disabled: downloading,
6250
+ icon: DownloadIcon,
6251
+ onClick: handleClick,
6252
+ text: downloading ? "Downloading\u2026" : "Download JSON"
6253
+ }
6254
+ );
6255
+ }
6256
+
6257
+ // src/components/report-detail/report-actions/RerunEvaluationAction.tsx
6258
+ import { PlayIcon as PlayIcon2 } from "@sanity/icons";
6259
+ import { MenuItem as MenuItem7, useToast as useToast6 } from "@sanity/ui";
6260
+ import { useCallback as useCallback18, useState as useState13 } from "react";
6261
+ import { useClient as useClient10, useCurrentUser as useCurrentUser2 } from "sanity";
6262
+
6263
+ // src/lib/eval-scope.ts
6264
+ function extractEvalScope(provenance) {
6265
+ return {
6266
+ areas: provenance.areas,
6267
+ dataset: provenance.source.dataset,
6268
+ mode: provenance.mode,
6269
+ perspective: provenance.source.perspective,
6270
+ projectId: provenance.source.projectId,
6271
+ taskIds: provenance.taskIds
6272
+ };
6273
+ }
6274
+
6275
+ // src/components/report-detail/report-actions/RerunEvaluationAction.tsx
6276
+ import { jsx as jsx44 } from "react/jsx-runtime";
6277
+ var EVAL_REQUEST_TYPE2 = "ailf.evalRequest";
6278
+ function slugify2(s) {
6279
+ return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
6280
+ }
6281
+ function dateStamp2() {
6282
+ const d = /* @__PURE__ */ new Date();
6283
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
6284
+ }
6285
+ function buildRequestDoc(scope, meta) {
6286
+ const shortId = slugify2(meta.reportId.slice(0, 12));
6287
+ const tag = `rerun-${shortId}-${dateStamp2()}`;
6288
+ const now = (/* @__PURE__ */ new Date()).toISOString();
6289
+ return {
6290
+ _type: EVAL_REQUEST_TYPE2,
6291
+ // Spread all scope fields — new EvalScope fields are automatically
6292
+ // included without changes here
6293
+ areas: scope.areas,
6294
+ dataset: scope.dataset,
6295
+ mode: scope.mode,
6296
+ ...scope.perspective ? { perspective: scope.perspective } : {},
6297
+ projectId: scope.projectId,
6298
+ ...scope.taskIds && scope.taskIds.length > 0 ? { tasks: scope.taskIds } : {},
6299
+ // Request metadata
6300
+ requestedAt: now,
6301
+ requestedBy: meta.userId,
6302
+ // Lineage — links this request back to the source report
6303
+ sourceReportId: meta.reportId,
6304
+ status: "pending",
6305
+ tag
6306
+ };
6307
+ }
6308
+ function RerunEvaluationAction({
6309
+ provenance,
6310
+ reportId
6311
+ }) {
6312
+ const client = useClient10({ apiVersion: API_VERSION });
6313
+ const currentUser = useCurrentUser2();
6314
+ const toast = useToast6();
6315
+ const [requesting, setRequesting] = useState13(false);
6316
+ const handleClick = useCallback18(async () => {
6317
+ setRequesting(true);
6318
+ try {
6319
+ const scope = extractEvalScope(provenance);
6320
+ const doc = buildRequestDoc(scope, {
6321
+ reportId,
6322
+ userId: currentUser?.id ?? "unknown"
6323
+ });
6324
+ await client.create(doc);
6325
+ toast.push({
6326
+ closable: true,
6327
+ description: "The evaluation pipeline has been triggered. A new report will appear in the dashboard in ~10\u201315 minutes.",
6328
+ status: "info",
6329
+ title: "Evaluation re-run started"
6330
+ });
6331
+ } catch (err) {
6332
+ const message = err instanceof Error ? err.message : "Failed to create eval request";
6333
+ toast.push({
6334
+ closable: true,
6335
+ description: message,
6336
+ status: "error",
6337
+ title: "Re-run failed"
6338
+ });
6339
+ } finally {
6340
+ setRequesting(false);
6341
+ }
6342
+ }, [client, currentUser?.id, provenance, reportId, toast]);
6343
+ return /* @__PURE__ */ jsx44(
6344
+ MenuItem7,
6345
+ {
6346
+ disabled: requesting,
6347
+ icon: PlayIcon2,
6348
+ onClick: handleClick,
6349
+ text: requesting ? "Requesting\u2026" : "Re-run evaluation"
6350
+ }
6351
+ );
6352
+ }
6353
+
6354
+ // src/components/report-detail/report-actions/ReportActions.tsx
6355
+ import { Fragment as Fragment6, jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
6356
+ function ReportActions({
6357
+ documentId,
6358
+ onDeleted,
6359
+ provenance,
6360
+ reportId
6361
+ }) {
6362
+ const client = useClient11({ apiVersion: API_VERSION });
6363
+ const toast = useToast7();
6364
+ const handleCopyId = useCallback19(() => {
6365
+ navigator.clipboard.writeText(reportId).then(
6366
+ () => {
6367
+ toast.push({
6368
+ closable: true,
6369
+ status: "success",
6370
+ title: "Report ID copied"
6371
+ });
6372
+ },
6373
+ () => {
6374
+ toast.push({
6375
+ closable: true,
6376
+ status: "error",
6377
+ title: "Failed to copy report ID"
6378
+ });
6379
+ }
6380
+ );
6381
+ }, [reportId, toast]);
6382
+ const [deleteDialogOpen, setDeleteDialogOpen] = useState14(false);
6383
+ const [deleting, setDeleting] = useState14(false);
6384
+ const handleRequestDelete = useCallback19(() => {
6385
+ setDeleteDialogOpen(true);
6386
+ }, []);
6387
+ const handleDeleteClose = useCallback19(() => {
6388
+ if (!deleting) setDeleteDialogOpen(false);
6389
+ }, [deleting]);
6390
+ const handleDeleteConfirm = useCallback19(async () => {
6391
+ setDeleting(true);
6392
+ try {
6393
+ await client.delete(documentId);
6394
+ toast.push({
6395
+ closable: true,
6396
+ status: "success",
6397
+ title: "Report deleted"
6398
+ });
6399
+ setDeleteDialogOpen(false);
6400
+ onDeleted();
6401
+ } catch {
6402
+ toast.push({
6403
+ closable: true,
6404
+ status: "error",
6405
+ title: "Failed to delete report"
6406
+ });
6407
+ } finally {
6408
+ setDeleting(false);
6409
+ }
6410
+ }, [client, documentId, onDeleted, toast]);
6411
+ return /* @__PURE__ */ jsxs32(Fragment6, { children: [
6412
+ /* @__PURE__ */ jsxs32(Flex25, { children: [
6413
+ /* @__PURE__ */ jsx45(
6414
+ Button3,
6415
+ {
6416
+ icon: CopyIcon2,
6417
+ mode: "ghost",
6418
+ onClick: handleCopyId,
6419
+ style: {
6420
+ borderBottomRightRadius: 0,
6421
+ borderRight: "none",
6422
+ borderTopRightRadius: 0
6423
+ },
6424
+ text: "Copy Report ID"
6425
+ }
6426
+ ),
6427
+ /* @__PURE__ */ jsx45(
6428
+ MenuButton2,
6429
+ {
6430
+ button: /* @__PURE__ */ jsx45(
6431
+ Button3,
6432
+ {
6433
+ icon: ChevronDownIcon,
6434
+ mode: "ghost",
6435
+ padding: 2,
6436
+ style: {
6437
+ borderBottomLeftRadius: 0,
6438
+ borderTopLeftRadius: 0
6439
+ }
6440
+ }
6441
+ ),
6442
+ id: "report-actions-menu",
6443
+ menu: /* @__PURE__ */ jsxs32(Menu2, { children: [
6444
+ /* @__PURE__ */ jsx45(CopyReportIdAction, { reportId }),
6445
+ /* @__PURE__ */ jsx45(
6446
+ RerunEvaluationAction,
6447
+ {
6448
+ provenance,
6449
+ reportId
6450
+ }
6451
+ ),
6452
+ /* @__PURE__ */ jsx45(MenuDivider, {}),
6453
+ /* @__PURE__ */ jsx45(
6454
+ DownloadReportAction,
6455
+ {
6456
+ documentId,
6457
+ reportId
6458
+ }
6459
+ ),
6460
+ /* @__PURE__ */ jsx45(CopyReportAction, { documentId }),
6461
+ /* @__PURE__ */ jsx45(CopyVisionQueryAction, { reportId }),
6462
+ /* @__PURE__ */ jsx45(MenuDivider, {}),
6463
+ /* @__PURE__ */ jsx45(DeleteReportAction, { onRequestDelete: handleRequestDelete })
6464
+ ] }),
6465
+ popover: { placement: "bottom-end", portal: true }
6466
+ }
6467
+ )
6468
+ ] }),
6469
+ deleteDialogOpen && /* @__PURE__ */ jsx45(
6470
+ DeleteConfirmDialog,
6471
+ {
6472
+ isDeleting: deleting,
6473
+ onClose: handleDeleteClose,
6474
+ onConfirm: handleDeleteConfirm,
6475
+ reportId
6476
+ }
6477
+ )
6478
+ ] });
6479
+ }
6480
+
6481
+ // src/components/report-detail/ReportHeader.tsx
6482
+ import { jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
5839
6483
  function ReportHeader({
5840
6484
  completedAt,
6485
+ documentId,
5841
6486
  mode,
5842
6487
  onBack,
5843
- onCopyId,
6488
+ onDeleted,
6489
+ provenance,
5844
6490
  reportId,
5845
6491
  sourceName,
5846
6492
  tag
@@ -5848,89 +6494,42 @@ function ReportHeader({
5848
6494
  const dateLabel = formatCardDate(completedAt);
5849
6495
  const title = tag ?? dateLabel;
5850
6496
  const hasTag = Boolean(tag);
5851
- return /* @__PURE__ */ jsxs30(Fragment6, { children: [
5852
- /* @__PURE__ */ jsxs30(Flex23, { align: "center", gap: 3, children: [
5853
- /* @__PURE__ */ jsx37(
5854
- Button2,
6497
+ return /* @__PURE__ */ jsxs33(Flex26, { align: "center", gap: 3, children: [
6498
+ /* @__PURE__ */ jsx46(Button4, { icon: ArrowLeftIcon, mode: "bleed", onClick: onBack, text: "Back" }),
6499
+ /* @__PURE__ */ jsxs33(Stack23, { flex: 1, space: 1, children: [
6500
+ /* @__PURE__ */ jsx46(Text32, { size: 4, weight: "bold", children: title }),
6501
+ hasTag && /* @__PURE__ */ jsx46(Text32, { muted: true, size: 2, children: dateLabel })
6502
+ ] }),
6503
+ /* @__PURE__ */ jsxs33(Flex26, { align: "center", gap: 2, children: [
6504
+ /* @__PURE__ */ jsx46(Badge21, { mode: "outline", tone: "default", children: sourceName }),
6505
+ /* @__PURE__ */ jsx46(Badge21, { tone: "primary", children: mode }),
6506
+ /* @__PURE__ */ jsx46(
6507
+ ReportActions,
5855
6508
  {
5856
- icon: ArrowLeftIcon,
5857
- mode: "bleed",
5858
- onClick: onBack,
5859
- text: "Back"
6509
+ documentId,
6510
+ onDeleted,
6511
+ provenance,
6512
+ reportId
5860
6513
  }
5861
- ),
5862
- /* @__PURE__ */ jsxs30(Stack21, { flex: 1, space: 1, children: [
5863
- /* @__PURE__ */ jsx37(Text30, { size: 4, weight: "bold", children: title }),
5864
- hasTag && /* @__PURE__ */ jsx37(Text30, { muted: true, size: 2, children: dateLabel })
5865
- ] }),
5866
- /* @__PURE__ */ jsxs30(Flex23, { gap: 2, children: [
5867
- /* @__PURE__ */ jsx37(Badge20, { mode: "outline", tone: "default", children: sourceName }),
5868
- /* @__PURE__ */ jsx37(Badge20, { tone: "primary", children: mode })
5869
- ] })
5870
- ] }),
5871
- /* @__PURE__ */ jsx37(
5872
- Tooltip8,
5873
- {
5874
- content: /* @__PURE__ */ jsx37(Box14, { padding: 2, children: /* @__PURE__ */ jsx37(Text30, { size: 2, children: "Click to copy report ID" }) }),
5875
- placement: "bottom",
5876
- portal: true,
5877
- children: /* @__PURE__ */ jsx37(
5878
- Card21,
5879
- {
5880
- border: true,
5881
- onClick: onCopyId,
5882
- padding: 3,
5883
- radius: 2,
5884
- style: { cursor: "pointer" },
5885
- tone: "transparent",
5886
- children: /* @__PURE__ */ jsxs30(Flex23, { align: "center", gap: 3, children: [
5887
- /* @__PURE__ */ jsx37(
5888
- Text30,
5889
- {
5890
- muted: true,
5891
- size: 1,
5892
- style: {
5893
- letterSpacing: "0.05em",
5894
- textTransform: "uppercase"
5895
- },
5896
- weight: "semibold",
5897
- children: "Report ID"
5898
- }
5899
- ),
5900
- /* @__PURE__ */ jsx37(
5901
- Text30,
5902
- {
5903
- size: 2,
5904
- style: {
5905
- fontFamily: "monospace",
5906
- userSelect: "all"
5907
- },
5908
- children: reportId
5909
- }
5910
- ),
5911
- /* @__PURE__ */ jsx37(Box14, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx37(Text30, { muted: true, size: 2, children: /* @__PURE__ */ jsx37(ClipboardIcon, {}) }) })
5912
- ] })
5913
- }
5914
- )
5915
- }
5916
- )
6514
+ )
6515
+ ] })
5917
6516
  ] });
5918
6517
  }
5919
6518
 
5920
6519
  // src/components/report-detail/ThreeLayerTable.tsx
5921
6520
  import React5 from "react";
5922
- import { Badge as Badge21, Card as Card22, Flex as Flex24, Stack as Stack22, Text as Text31 } from "@sanity/ui";
5923
- import { jsx as jsx38, jsxs as jsxs31 } from "react/jsx-runtime";
6521
+ import { Badge as Badge22, Card as Card23, Flex as Flex27, Stack as Stack24, Text as Text33 } from "@sanity/ui";
6522
+ import { jsx as jsx47, jsxs as jsxs34 } from "react/jsx-runtime";
5924
6523
  function ThreeLayerTable({ scores }) {
5925
6524
  const filtered = scores.filter((s) => s.actualScore != null);
5926
6525
  if (filtered.length === 0) return null;
5927
6526
  const hasInverted = filtered.some((s) => s.invertedRetrievalGap);
5928
- return /* @__PURE__ */ jsx38(Card22, { overflow: "auto", padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs31(Stack22, { space: 4, children: [
5929
- /* @__PURE__ */ jsxs31(Flex24, { align: "center", gap: 3, children: [
5930
- /* @__PURE__ */ jsx38(Text31, { size: 3, weight: "semibold", children: "Three-Layer Decomposition" }),
5931
- /* @__PURE__ */ jsx38(Badge21, { tone: "primary", children: "full mode" })
6527
+ return /* @__PURE__ */ jsx47(Card23, { overflow: "auto", padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs34(Stack24, { space: 4, children: [
6528
+ /* @__PURE__ */ jsxs34(Flex27, { align: "center", gap: 3, children: [
6529
+ /* @__PURE__ */ jsx47(Text33, { size: 3, weight: "semibold", children: "Three-Layer Decomposition" }),
6530
+ /* @__PURE__ */ jsx47(Badge22, { tone: "primary", children: "full mode" })
5932
6531
  ] }),
5933
- /* @__PURE__ */ jsxs31(
6532
+ /* @__PURE__ */ jsxs34(
5934
6533
  "div",
5935
6534
  {
5936
6535
  style: {
@@ -5939,9 +6538,9 @@ function ThreeLayerTable({ scores }) {
5939
6538
  gridTemplateColumns: "2fr 1fr 1fr 1fr 1fr 1fr"
5940
6539
  },
5941
6540
  children: [
5942
- /* @__PURE__ */ jsx38(ColumnHeader, { borderBottom: true, label: "Area" }),
5943
- /* @__PURE__ */ jsx38(ColumnHeader, { borderBottom: true, label: "Floor", tooltip: GLOSSARY.floor }),
5944
- /* @__PURE__ */ jsx38(
6541
+ /* @__PURE__ */ jsx47(ColumnHeader, { borderBottom: true, label: "Area" }),
6542
+ /* @__PURE__ */ jsx47(ColumnHeader, { borderBottom: true, label: "Floor", tooltip: GLOSSARY.floor }),
6543
+ /* @__PURE__ */ jsx47(
5945
6544
  ColumnHeader,
5946
6545
  {
5947
6546
  borderBottom: true,
@@ -5949,8 +6548,8 @@ function ThreeLayerTable({ scores }) {
5949
6548
  tooltip: GLOSSARY.ceiling
5950
6549
  }
5951
6550
  ),
5952
- /* @__PURE__ */ jsx38(ColumnHeader, { borderBottom: true, label: "Actual", tooltip: GLOSSARY.actual }),
5953
- /* @__PURE__ */ jsx38(
6551
+ /* @__PURE__ */ jsx47(ColumnHeader, { borderBottom: true, label: "Actual", tooltip: GLOSSARY.actual }),
6552
+ /* @__PURE__ */ jsx47(
5954
6553
  ColumnHeader,
5955
6554
  {
5956
6555
  borderBottom: true,
@@ -5958,7 +6557,7 @@ function ThreeLayerTable({ scores }) {
5958
6557
  tooltip: GLOSSARY.retGap
5959
6558
  }
5960
6559
  ),
5961
- /* @__PURE__ */ jsx38(
6560
+ /* @__PURE__ */ jsx47(
5962
6561
  ColumnHeader,
5963
6562
  {
5964
6563
  borderBottom: true,
@@ -5966,8 +6565,8 @@ function ThreeLayerTable({ scores }) {
5966
6565
  tooltip: GLOSSARY.efficiency
5967
6566
  }
5968
6567
  ),
5969
- filtered.map((score, i) => /* @__PURE__ */ jsxs31(React5.Fragment, { children: [
5970
- /* @__PURE__ */ jsx38(
6568
+ filtered.map((score, i) => /* @__PURE__ */ jsxs34(React5.Fragment, { children: [
6569
+ /* @__PURE__ */ jsx47(
5971
6570
  "div",
5972
6571
  {
5973
6572
  style: {
@@ -5975,10 +6574,10 @@ function ThreeLayerTable({ scores }) {
5975
6574
  borderRadius: 4,
5976
6575
  padding: "8px 0 8px 4px"
5977
6576
  },
5978
- children: /* @__PURE__ */ jsx38(Text31, { size: 2, weight: "medium", children: score.feature })
6577
+ children: /* @__PURE__ */ jsx47(Text33, { size: 2, weight: "medium", children: score.feature })
5979
6578
  }
5980
6579
  ),
5981
- /* @__PURE__ */ jsx38(
6580
+ /* @__PURE__ */ jsx47(
5982
6581
  "div",
5983
6582
  {
5984
6583
  style: {
@@ -5986,10 +6585,10 @@ function ThreeLayerTable({ scores }) {
5986
6585
  display: "flex",
5987
6586
  padding: "2px 0"
5988
6587
  },
5989
- children: /* @__PURE__ */ jsx38(ScoreCell, { score: score.floorScore ?? 0 })
6588
+ children: /* @__PURE__ */ jsx47(ScoreCell, { score: score.floorScore ?? 0 })
5990
6589
  }
5991
6590
  ),
5992
- /* @__PURE__ */ jsx38(
6591
+ /* @__PURE__ */ jsx47(
5993
6592
  "div",
5994
6593
  {
5995
6594
  style: {
@@ -5997,10 +6596,10 @@ function ThreeLayerTable({ scores }) {
5997
6596
  display: "flex",
5998
6597
  padding: "2px 0"
5999
6598
  },
6000
- children: /* @__PURE__ */ jsx38(ScoreCell, { score: score.ceilingScore ?? score.totalScore })
6599
+ children: /* @__PURE__ */ jsx47(ScoreCell, { score: score.ceilingScore ?? score.totalScore })
6001
6600
  }
6002
6601
  ),
6003
- /* @__PURE__ */ jsx38(
6602
+ /* @__PURE__ */ jsx47(
6004
6603
  "div",
6005
6604
  {
6006
6605
  style: {
@@ -6008,10 +6607,10 @@ function ThreeLayerTable({ scores }) {
6008
6607
  display: "flex",
6009
6608
  padding: "2px 0"
6010
6609
  },
6011
- children: /* @__PURE__ */ jsx38(ScoreCell, { score: score.actualScore ?? 0 })
6610
+ children: /* @__PURE__ */ jsx47(ScoreCell, { score: score.actualScore ?? 0 })
6012
6611
  }
6013
6612
  ),
6014
- /* @__PURE__ */ jsx38(
6613
+ /* @__PURE__ */ jsx47(
6015
6614
  "div",
6016
6615
  {
6017
6616
  style: {
@@ -6020,10 +6619,10 @@ function ThreeLayerTable({ scores }) {
6020
6619
  display: "flex",
6021
6620
  padding: "6px 0"
6022
6621
  },
6023
- children: /* @__PURE__ */ jsx38(Text31, { size: 2, children: score.retrievalGap != null ? score.retrievalGap.toFixed(1) : "\u2014" })
6622
+ children: /* @__PURE__ */ jsx47(Text33, { size: 2, children: score.retrievalGap != null ? score.retrievalGap.toFixed(1) : "\u2014" })
6024
6623
  }
6025
6624
  ),
6026
- /* @__PURE__ */ jsx38(
6625
+ /* @__PURE__ */ jsx47(
6027
6626
  "div",
6028
6627
  {
6029
6628
  style: {
@@ -6032,7 +6631,7 @@ function ThreeLayerTable({ scores }) {
6032
6631
  display: "flex",
6033
6632
  padding: "6px 0"
6034
6633
  },
6035
- children: /* @__PURE__ */ jsxs31(Text31, { size: 2, children: [
6634
+ children: /* @__PURE__ */ jsxs34(Text33, { size: 2, children: [
6036
6635
  formatPercent(score.infrastructureEfficiency),
6037
6636
  score.invertedRetrievalGap && " \u26A0\uFE0F"
6038
6637
  ] })
@@ -6042,12 +6641,12 @@ function ThreeLayerTable({ scores }) {
6042
6641
  ]
6043
6642
  }
6044
6643
  ),
6045
- hasInverted && /* @__PURE__ */ jsx38(Text31, { muted: true, size: 1, children: GLOSSARY.invertedRetGap })
6644
+ hasInverted && /* @__PURE__ */ jsx47(Text33, { muted: true, size: 1, children: GLOSSARY.invertedRetGap })
6046
6645
  ] }) });
6047
6646
  }
6048
6647
 
6049
6648
  // src/components/report-detail/ReportDetail.tsx
6050
- import { jsx as jsx39, jsxs as jsxs32 } from "react/jsx-runtime";
6649
+ import { jsx as jsx48, jsxs as jsxs35 } from "react/jsx-runtime";
6051
6650
  var OVERVIEW_TAB = { id: "overview", label: "Overview" };
6052
6651
  var DIAGNOSTICS_TAB = { id: "diagnostics", label: "Diagnostics" };
6053
6652
  var ACTIVITY_TAB = { id: "activity", label: "Agent Activity" };
@@ -6061,10 +6660,10 @@ function ReportDetail({
6061
6660
  onTabChange,
6062
6661
  reportId
6063
6662
  }) {
6064
- const client = useClient7({ apiVersion: API_VERSION });
6065
- const [loading, setLoading] = useState10(true);
6066
- const [report, setReport] = useState10(null);
6067
- useEffect8(() => {
6663
+ const client = useClient12({ apiVersion: API_VERSION });
6664
+ const [loading, setLoading] = useState15(true);
6665
+ const [report, setReport] = useState15(null);
6666
+ useEffect9(() => {
6068
6667
  let cancelled = false;
6069
6668
  setLoading(true);
6070
6669
  client.fetch(reportDetailQuery, { reportId }).then((data) => {
@@ -6079,11 +6678,6 @@ function ReportDetail({
6079
6678
  cancelled = true;
6080
6679
  };
6081
6680
  }, [client, reportId]);
6082
- const handleCopyReportId = useCallback13(() => {
6083
- if (!report) return;
6084
- navigator.clipboard.writeText(report.reportId).catch(() => {
6085
- });
6086
- }, [report]);
6087
6681
  const { summary } = report ?? {};
6088
6682
  const hasDiagnostics = Boolean(
6089
6683
  summary?.recommendations && summary.recommendations.gaps.length > 0 || summary?.lowScoringJudgments && summary.lowScoringJudgments.length > 0
@@ -6106,19 +6700,19 @@ function ReportDetail({
6106
6700
  if (disabledTabs.has(parsed)) return "overview";
6107
6701
  return tabs.some((t) => t.id === parsed) ? parsed : "overview";
6108
6702
  }, [activeTab, disabledTabs, tabs]);
6109
- const handleTabClick = useCallback13(
6703
+ const handleTabClick = useCallback20(
6110
6704
  (tabId) => {
6111
6705
  onTabChange(tabId === "overview" ? null : tabId);
6112
6706
  },
6113
6707
  [onTabChange]
6114
6708
  );
6115
6709
  if (loading) {
6116
- return /* @__PURE__ */ jsx39(LoadingState, { message: "Loading report\u2026" });
6710
+ return /* @__PURE__ */ jsx48(LoadingState, { message: "Loading report\u2026" });
6117
6711
  }
6118
6712
  if (!report || !summary) {
6119
- return /* @__PURE__ */ jsx39(Box15, { padding: 5, children: /* @__PURE__ */ jsxs32(Stack23, { space: 4, children: [
6120
- /* @__PURE__ */ jsx39(
6121
- Button3,
6713
+ return /* @__PURE__ */ jsx48(Box15, { padding: 5, children: /* @__PURE__ */ jsxs35(Stack25, { space: 4, children: [
6714
+ /* @__PURE__ */ jsx48(
6715
+ Button5,
6122
6716
  {
6123
6717
  icon: ArrowLeftIcon2,
6124
6718
  mode: "bleed",
@@ -6126,29 +6720,31 @@ function ReportDetail({
6126
6720
  text: "Back"
6127
6721
  }
6128
6722
  ),
6129
- /* @__PURE__ */ jsx39(Text32, { align: "center", muted: true, size: 3, children: "Report not found" })
6723
+ /* @__PURE__ */ jsx48(Text34, { align: "center", muted: true, size: 3, children: "Report not found" })
6130
6724
  ] }) });
6131
6725
  }
6132
6726
  const { comparison, provenance } = report;
6133
6727
  const totalTests = summary.scores.reduce((n, s) => n + s.testCount, 0);
6134
6728
  const isFullMode = summary.evaluationMode === "full" || summary.scores.some((s) => s.actualScore != null);
6135
- return /* @__PURE__ */ jsx39(Box15, { padding: 4, children: /* @__PURE__ */ jsxs32(Stack23, { space: 5, children: [
6136
- /* @__PURE__ */ jsx39(
6729
+ return /* @__PURE__ */ jsx48(Box15, { padding: 4, children: /* @__PURE__ */ jsxs35(Stack25, { space: 5, children: [
6730
+ /* @__PURE__ */ jsx48(
6137
6731
  ReportHeader,
6138
6732
  {
6139
6733
  completedAt: report.completedAt,
6734
+ documentId: report._id,
6140
6735
  mode: provenance.mode,
6141
6736
  onBack,
6142
- onCopyId: handleCopyReportId,
6737
+ onDeleted: onBack,
6738
+ provenance,
6143
6739
  reportId: report.reportId,
6144
6740
  sourceName: provenance.source.name,
6145
6741
  tag: report.tag
6146
6742
  }
6147
6743
  ),
6148
- /* @__PURE__ */ jsx39(TabList, { space: 1, children: tabs.map((tab) => {
6744
+ /* @__PURE__ */ jsx48(TabList, { space: 1, children: tabs.map((tab) => {
6149
6745
  const isDisabled = disabledTabs.has(tab.id);
6150
6746
  const tooltip = getDisabledTabTooltip(tab.id, summary);
6151
- const tabElement = /* @__PURE__ */ jsx39(
6747
+ const tabElement = /* @__PURE__ */ jsx48(
6152
6748
  Tab,
6153
6749
  {
6154
6750
  "aria-controls": `panel-${tab.id}`,
@@ -6159,25 +6755,25 @@ function ReportDetail({
6159
6755
  selected: currentTab === tab.id
6160
6756
  }
6161
6757
  );
6162
- return isDisabled && tooltip ? /* @__PURE__ */ jsx39(
6163
- Tooltip9,
6758
+ return isDisabled && tooltip ? /* @__PURE__ */ jsx48(
6759
+ Tooltip8,
6164
6760
  {
6165
- content: /* @__PURE__ */ jsx39(Box15, { padding: 2, style: { maxWidth: 280 }, children: tooltip }),
6761
+ content: /* @__PURE__ */ jsx48(Box15, { padding: 2, style: { maxWidth: 280 }, children: tooltip }),
6166
6762
  placement: "bottom",
6167
6763
  portal: true,
6168
- children: /* @__PURE__ */ jsx39("span", { style: { display: "inline-block" }, children: tabElement })
6764
+ children: /* @__PURE__ */ jsx48("span", { style: { display: "inline-block" }, children: tabElement })
6169
6765
  },
6170
6766
  tab.id
6171
- ) : /* @__PURE__ */ jsx39("span", { children: tabElement }, tab.id);
6767
+ ) : /* @__PURE__ */ jsx48("span", { children: tabElement }, tab.id);
6172
6768
  }) }),
6173
- currentTab === "overview" && /* @__PURE__ */ jsx39(
6769
+ currentTab === "overview" && /* @__PURE__ */ jsx48(
6174
6770
  TabPanel,
6175
6771
  {
6176
6772
  "aria-labelledby": "tab-overview",
6177
6773
  hidden: currentTab !== "overview",
6178
6774
  id: "panel-overview",
6179
- children: /* @__PURE__ */ jsxs32(Stack23, { space: 5, children: [
6180
- /* @__PURE__ */ jsx39(
6775
+ children: /* @__PURE__ */ jsxs35(Stack25, { space: 5, children: [
6776
+ /* @__PURE__ */ jsx48(
6181
6777
  OverviewStats,
6182
6778
  {
6183
6779
  durationMs: report.durationMs,
@@ -6186,37 +6782,38 @@ function ReportDetail({
6186
6782
  totalTests
6187
6783
  }
6188
6784
  ),
6189
- isFullMode && /* @__PURE__ */ jsx39(ThreeLayerTable, { scores: summary.scores }),
6190
- /* @__PURE__ */ jsx39(AreaScoreTable, { scores: summary.scores }),
6191
- comparison && /* @__PURE__ */ jsx39(ComparisonSummary, { comparison }),
6192
- /* @__PURE__ */ jsx39(ProvenanceCard, { provenance })
6785
+ isFullMode && /* @__PURE__ */ jsx48(ThreeLayerTable, { scores: summary.scores }),
6786
+ /* @__PURE__ */ jsx48(AreaScoreTable, { scores: summary.scores }),
6787
+ comparison && /* @__PURE__ */ jsx48(ComparisonSummary, { comparison }),
6788
+ /* @__PURE__ */ jsx48(LineageCard, { provenance, reportId: report.reportId }),
6789
+ /* @__PURE__ */ jsx48(ProvenanceCard, { provenance })
6193
6790
  ] })
6194
6791
  }
6195
6792
  ),
6196
- currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */ jsx39(
6793
+ currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */ jsx48(
6197
6794
  TabPanel,
6198
6795
  {
6199
6796
  "aria-labelledby": "tab-diagnostics",
6200
6797
  hidden: currentTab !== "diagnostics",
6201
6798
  id: "panel-diagnostics",
6202
- children: /* @__PURE__ */ jsxs32(Stack23, { space: 5, children: [
6203
- summary.recommendations && summary.recommendations.gaps.length > 0 && /* @__PURE__ */ jsx39(
6799
+ children: /* @__PURE__ */ jsxs35(Stack25, { space: 5, children: [
6800
+ summary.recommendations && summary.recommendations.gaps.length > 0 && /* @__PURE__ */ jsx48(
6204
6801
  RecommendationsSection,
6205
6802
  {
6206
6803
  recommendations: summary.recommendations
6207
6804
  }
6208
6805
  ),
6209
- summary.lowScoringJudgments && summary.lowScoringJudgments.length > 0 && /* @__PURE__ */ jsx39(JudgmentList, { judgments: summary.lowScoringJudgments })
6806
+ summary.lowScoringJudgments && summary.lowScoringJudgments.length > 0 && /* @__PURE__ */ jsx48(JudgmentList, { judgments: summary.lowScoringJudgments })
6210
6807
  ] })
6211
6808
  }
6212
6809
  ),
6213
- currentTab === "activity" && hasAgentActivity && /* @__PURE__ */ jsx39(
6810
+ currentTab === "activity" && hasAgentActivity && /* @__PURE__ */ jsx48(
6214
6811
  TabPanel,
6215
6812
  {
6216
6813
  "aria-labelledby": "tab-activity",
6217
6814
  hidden: currentTab !== "activity",
6218
6815
  id: "panel-activity",
6219
- children: /* @__PURE__ */ jsx39(
6816
+ children: /* @__PURE__ */ jsx48(
6220
6817
  AgentActivitySection,
6221
6818
  {
6222
6819
  agentBehavior: summary.agentBehavior,
@@ -6238,27 +6835,27 @@ function getDisabledTabTooltip(tabId, summary) {
6238
6835
  if (!summary) return null;
6239
6836
  switch (tabId) {
6240
6837
  case "diagnostics":
6241
- return /* @__PURE__ */ jsx39(Text32, { muted: true, size: 2, children: "No diagnostic data available. Diagnostics require low-scoring judgments or gap analysis recommendations." });
6838
+ return /* @__PURE__ */ jsx48(Text34, { muted: true, size: 2, children: "No diagnostic data available. Diagnostics require low-scoring judgments or gap analysis recommendations." });
6242
6839
  case "activity":
6243
- return summary.evaluationMode === "baseline" ? /* @__PURE__ */ jsxs32(Text32, { muted: true, size: 2, children: [
6840
+ return summary.evaluationMode === "baseline" ? /* @__PURE__ */ jsxs35(Text34, { muted: true, size: 2, children: [
6244
6841
  "Not available for baseline-only evaluations. Run with",
6245
6842
  " ",
6246
- /* @__PURE__ */ jsx39("code", { style: inlineCodeStyle, children: "--mode full" }),
6843
+ /* @__PURE__ */ jsx48("code", { style: inlineCodeStyle, children: "--mode full" }),
6247
6844
  " or",
6248
6845
  " ",
6249
- /* @__PURE__ */ jsx39("code", { style: inlineCodeStyle, children: "--mode agentic" }),
6846
+ /* @__PURE__ */ jsx48("code", { style: inlineCodeStyle, children: "--mode agentic" }),
6250
6847
  " to capture agent browsing behavior."
6251
- ] }) : /* @__PURE__ */ jsx39(Text32, { muted: true, size: 2, children: "No agent activity data was recorded for this evaluation." });
6848
+ ] }) : /* @__PURE__ */ jsx48(Text34, { muted: true, size: 2, children: "No agent activity data was recorded for this evaluation." });
6252
6849
  default:
6253
6850
  return null;
6254
6851
  }
6255
6852
  }
6256
6853
 
6257
6854
  // src/components/ScoreTimeline.tsx
6258
- import { Card as Card23, Flex as Flex25, Select as Select2, Stack as Stack24, Text as Text33 } from "@sanity/ui";
6259
- import { useCallback as useCallback14, useEffect as useEffect9, useMemo as useMemo8, useState as useState11 } from "react";
6260
- import { useClient as useClient8 } from "sanity";
6261
- import { jsx as jsx40, jsxs as jsxs33 } from "react/jsx-runtime";
6855
+ import { Card as Card24, Flex as Flex28, Select as Select2, Stack as Stack26, Text as Text35 } from "@sanity/ui";
6856
+ import { useCallback as useCallback21, useEffect as useEffect10, useMemo as useMemo8, useState as useState16 } from "react";
6857
+ import { useClient as useClient13 } from "sanity";
6858
+ import { jsx as jsx49, jsxs as jsxs36 } from "react/jsx-runtime";
6262
6859
  var CHART_HEIGHT = 220;
6263
6860
  var CHART_WIDTH = 800;
6264
6861
  var PAD_BOTTOM = 30;
@@ -6292,11 +6889,11 @@ function scoreForPoint(point, area) {
6292
6889
  return match?.totalScore ?? null;
6293
6890
  }
6294
6891
  function ScoreTimeline({ mode = null, source = null }) {
6295
- const client = useClient8({ apiVersion: API_VERSION });
6296
- const [dataPoints, setDataPoints] = useState11([]);
6297
- const [loading, setLoading] = useState11(true);
6298
- const [rangeDays, setRangeDays] = useState11(30);
6299
- const [selectedArea, setSelectedArea] = useState11(null);
6892
+ const client = useClient13({ apiVersion: API_VERSION });
6893
+ const [dataPoints, setDataPoints] = useState16([]);
6894
+ const [loading, setLoading] = useState16(true);
6895
+ const [rangeDays, setRangeDays] = useState16(30);
6896
+ const [selectedArea, setSelectedArea] = useState16(null);
6300
6897
  const areaNames = useMemo8(() => {
6301
6898
  const names = /* @__PURE__ */ new Set();
6302
6899
  for (const dp of dataPoints) {
@@ -6306,7 +6903,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6306
6903
  }
6307
6904
  return Array.from(names).sort();
6308
6905
  }, [dataPoints]);
6309
- const fetchData = useCallback14(async () => {
6906
+ const fetchData = useCallback21(async () => {
6310
6907
  setLoading(true);
6311
6908
  try {
6312
6909
  const startDate = rangeDays ? daysAgo(rangeDays) : "1970-01-01T00:00:00Z";
@@ -6321,7 +6918,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6321
6918
  setLoading(false);
6322
6919
  }
6323
6920
  }, [client, mode, rangeDays, source]);
6324
- useEffect9(() => {
6921
+ useEffect10(() => {
6325
6922
  void fetchData();
6326
6923
  }, [fetchData]);
6327
6924
  const chartPoints = useMemo8(() => {
@@ -6342,14 +6939,14 @@ function ScoreTimeline({ mode = null, source = null }) {
6342
6939
  if (chartPoints.length === 0) return 0;
6343
6940
  return chartPoints.reduce((sum, p) => sum + p.score, 0) / chartPoints.length;
6344
6941
  }, [chartPoints]);
6345
- const handleRangeChange = useCallback14(
6942
+ const handleRangeChange = useCallback21(
6346
6943
  (e) => {
6347
6944
  const val = e.currentTarget.value;
6348
6945
  setRangeDays(val === "all" ? null : Number(val));
6349
6946
  },
6350
6947
  []
6351
6948
  );
6352
- const handleAreaChange = useCallback14(
6949
+ const handleAreaChange = useCallback21(
6353
6950
  (e) => {
6354
6951
  const val = e.currentTarget.value;
6355
6952
  setSelectedArea(val || null);
@@ -6357,22 +6954,22 @@ function ScoreTimeline({ mode = null, source = null }) {
6357
6954
  []
6358
6955
  );
6359
6956
  const polylinePoints = chartPoints.map((p) => `${p.x},${p.y}`).join(" ");
6360
- return /* @__PURE__ */ jsxs33(Stack24, { space: 4, children: [
6361
- /* @__PURE__ */ jsxs33(Flex25, { gap: 3, children: [
6362
- /* @__PURE__ */ jsx40(
6957
+ return /* @__PURE__ */ jsxs36(Stack26, { space: 4, children: [
6958
+ /* @__PURE__ */ jsxs36(Flex28, { gap: 3, children: [
6959
+ /* @__PURE__ */ jsx49(
6363
6960
  Select2,
6364
6961
  {
6365
6962
  onChange: handleRangeChange,
6366
6963
  value: rangeDays?.toString() ?? "all",
6367
- children: TIME_RANGES.map((r) => /* @__PURE__ */ jsx40("option", { value: r.days?.toString() ?? "all", children: r.label }, r.label))
6964
+ children: TIME_RANGES.map((r) => /* @__PURE__ */ jsx49("option", { value: r.days?.toString() ?? "all", children: r.label }, r.label))
6368
6965
  }
6369
6966
  ),
6370
- /* @__PURE__ */ jsxs33(Select2, { onChange: handleAreaChange, value: selectedArea ?? "", children: [
6371
- /* @__PURE__ */ jsx40("option", { value: "", children: "Overall" }),
6372
- areaNames.map((name) => /* @__PURE__ */ jsx40("option", { value: name, children: name }, name))
6967
+ /* @__PURE__ */ jsxs36(Select2, { onChange: handleAreaChange, value: selectedArea ?? "", children: [
6968
+ /* @__PURE__ */ jsx49("option", { value: "", children: "Overall" }),
6969
+ areaNames.map((name) => /* @__PURE__ */ jsx49("option", { value: name, children: name }, name))
6373
6970
  ] })
6374
6971
  ] }),
6375
- /* @__PURE__ */ jsx40(Card23, { padding: 3, radius: 2, shadow: 1, children: loading ? /* @__PURE__ */ jsx40(Flex25, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx40(Text33, { muted: true, size: 2, children: "Loading\u2026" }) }) : chartPoints.length === 0 ? /* @__PURE__ */ jsx40(Flex25, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx40(Text33, { muted: true, size: 2, children: "No reports found for this time range" }) }) : /* @__PURE__ */ jsxs33(
6972
+ /* @__PURE__ */ jsx49(Card24, { padding: 3, radius: 2, shadow: 1, children: loading ? /* @__PURE__ */ jsx49(Flex28, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx49(Text35, { muted: true, size: 2, children: "Loading\u2026" }) }) : chartPoints.length === 0 ? /* @__PURE__ */ jsx49(Flex28, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx49(Text35, { muted: true, size: 2, children: "No reports found for this time range" }) }) : /* @__PURE__ */ jsxs36(
6376
6973
  "svg",
6377
6974
  {
6378
6975
  style: { display: "block", width: "100%" },
@@ -6380,8 +6977,8 @@ function ScoreTimeline({ mode = null, source = null }) {
6380
6977
  children: [
6381
6978
  Y_TICKS.map((tick) => {
6382
6979
  const y = PAD_TOP + PLOT_HEIGHT - tick / Y_MAX * PLOT_HEIGHT;
6383
- return /* @__PURE__ */ jsxs33("g", { children: [
6384
- /* @__PURE__ */ jsx40(
6980
+ return /* @__PURE__ */ jsxs36("g", { children: [
6981
+ /* @__PURE__ */ jsx49(
6385
6982
  "line",
6386
6983
  {
6387
6984
  stroke: "#ccc",
@@ -6392,7 +6989,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6392
6989
  y2: y
6393
6990
  }
6394
6991
  ),
6395
- /* @__PURE__ */ jsx40(
6992
+ /* @__PURE__ */ jsx49(
6396
6993
  "text",
6397
6994
  {
6398
6995
  dominantBaseline: "middle",
@@ -6412,7 +7009,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6412
7009
  chartPoints.length - 1
6413
7010
  ].map((idx) => {
6414
7011
  const p = chartPoints[idx];
6415
- return /* @__PURE__ */ jsx40(
7012
+ return /* @__PURE__ */ jsx49(
6416
7013
  "text",
6417
7014
  {
6418
7015
  fill: "#999",
@@ -6424,7 +7021,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6424
7021
  },
6425
7022
  idx
6426
7023
  );
6427
- }) : chartPoints.map((p, idx) => /* @__PURE__ */ jsx40(
7024
+ }) : chartPoints.map((p, idx) => /* @__PURE__ */ jsx49(
6428
7025
  "text",
6429
7026
  {
6430
7027
  fill: "#999",
@@ -6436,7 +7033,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6436
7033
  },
6437
7034
  idx
6438
7035
  )),
6439
- /* @__PURE__ */ jsx40(
7036
+ /* @__PURE__ */ jsx49(
6440
7037
  "polyline",
6441
7038
  {
6442
7039
  fill: "none",
@@ -6446,7 +7043,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6446
7043
  strokeWidth: 2.5
6447
7044
  }
6448
7045
  ),
6449
- chartPoints.map((p, idx) => /* @__PURE__ */ jsx40(
7046
+ chartPoints.map((p, idx) => /* @__PURE__ */ jsx49(
6450
7047
  "circle",
6451
7048
  {
6452
7049
  cx: p.x,
@@ -6455,7 +7052,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6455
7052
  r: 4,
6456
7053
  stroke: "#fff",
6457
7054
  strokeWidth: 1.5,
6458
- children: /* @__PURE__ */ jsxs33("title", { children: [
7055
+ children: /* @__PURE__ */ jsxs36("title", { children: [
6459
7056
  formatDate2(p.date),
6460
7057
  ": ",
6461
7058
  Math.round(p.score)
@@ -6466,7 +7063,7 @@ function ScoreTimeline({ mode = null, source = null }) {
6466
7063
  ]
6467
7064
  }
6468
7065
  ) }),
6469
- /* @__PURE__ */ jsxs33(Text33, { muted: true, size: 2, children: [
7066
+ /* @__PURE__ */ jsxs36(Text35, { muted: true, size: 2, children: [
6470
7067
  chartPoints.length,
6471
7068
  " data point",
6472
7069
  chartPoints.length !== 1 ? "s" : ""
@@ -6476,19 +7073,19 @@ function ScoreTimeline({ mode = null, source = null }) {
6476
7073
  var ScoreTimeline_default = ScoreTimeline;
6477
7074
 
6478
7075
  // src/components/Dashboard.tsx
6479
- import { jsx as jsx41, jsxs as jsxs34 } from "react/jsx-runtime";
7076
+ import { jsx as jsx50, jsxs as jsxs37 } from "react/jsx-runtime";
6480
7077
  var VIEW_PARAM_MAP = {
6481
7078
  compare: "compare",
6482
7079
  timeline: "timeline"
6483
7080
  };
6484
7081
  function Dashboard() {
6485
- const client = useClient9({ apiVersion: API_VERSION });
6486
- const router = useRouter();
7082
+ const client = useClient14({ apiVersion: API_VERSION });
7083
+ const router = useRouter2();
6487
7084
  const routerState = router.state;
6488
7085
  const reportId = routerState.reportId ?? null;
6489
7086
  const isDetail = reportId !== null;
6490
7087
  const activeTab = isDetail ? "latest" : VIEW_PARAM_MAP[routerState.view ?? ""] ?? "latest";
6491
- const navigateToTab = useCallback15(
7088
+ const navigateToTab = useCallback22(
6492
7089
  (tab) => {
6493
7090
  if (tab === "latest") {
6494
7091
  router.navigate({});
@@ -6498,13 +7095,13 @@ function Dashboard() {
6498
7095
  },
6499
7096
  [router]
6500
7097
  );
6501
- const handleSelectReport = useCallback15(
7098
+ const handleSelectReport = useCallback22(
6502
7099
  (id) => {
6503
7100
  router.navigate({ reportId: id });
6504
7101
  },
6505
7102
  [router]
6506
7103
  );
6507
- const handleTabChange = useCallback15(
7104
+ const handleTabChange = useCallback22(
6508
7105
  (tab) => {
6509
7106
  if (!routerState.reportId) return;
6510
7107
  if (tab) {
@@ -6515,52 +7112,52 @@ function Dashboard() {
6515
7112
  },
6516
7113
  [router, routerState.reportId]
6517
7114
  );
6518
- const handleBack = useCallback15(() => {
7115
+ const handleBack = useCallback22(() => {
6519
7116
  router.navigate({});
6520
7117
  }, [router]);
6521
- const [source, setSource] = useState12(null);
6522
- const [mode, setMode] = useState12(null);
6523
- const [sources, setSources] = useState12([]);
6524
- const [modes, setModes] = useState12([]);
6525
- useEffect10(() => {
7118
+ const [source, setSource] = useState17(null);
7119
+ const [mode, setMode] = useState17(null);
7120
+ const [sources, setSources] = useState17([]);
7121
+ const [modes, setModes] = useState17([]);
7122
+ useEffect11(() => {
6526
7123
  client.fetch(distinctSourcesQuery).then((data) => setSources(data ?? [])).catch(() => setSources([]));
6527
7124
  client.fetch(distinctModesQuery).then((data) => setModes(data ?? [])).catch(() => setModes([]));
6528
7125
  }, [client]);
6529
- return /* @__PURE__ */ jsx41(Container, { width: 2, children: /* @__PURE__ */ jsxs34(Stack25, { padding: 4, space: 4, children: [
6530
- /* @__PURE__ */ jsxs34(Flex26, { align: "center", gap: 3, children: [
6531
- /* @__PURE__ */ jsxs34(Stack25, { flex: 1, space: 1, children: [
6532
- /* @__PURE__ */ jsx41(Text34, { size: 4, weight: "bold", children: "AI Literacy Framework" }),
6533
- /* @__PURE__ */ jsx41(Text34, { muted: true, size: 2, children: "Evaluation reports and score trends" })
7126
+ return /* @__PURE__ */ jsx50(Container, { width: 2, children: /* @__PURE__ */ jsxs37(Stack27, { padding: 4, space: 4, children: [
7127
+ /* @__PURE__ */ jsxs37(Flex29, { align: "center", gap: 3, children: [
7128
+ /* @__PURE__ */ jsxs37(Stack27, { flex: 1, space: 1, children: [
7129
+ /* @__PURE__ */ jsx50(Text36, { size: 4, weight: "bold", children: "AI Literacy Framework" }),
7130
+ /* @__PURE__ */ jsx50(Text36, { muted: true, size: 2, children: "Evaluation reports and score trends" })
6534
7131
  ] }),
6535
- !isDetail && /* @__PURE__ */ jsxs34(Flex26, { gap: 2, children: [
6536
- /* @__PURE__ */ jsxs34(
7132
+ !isDetail && /* @__PURE__ */ jsxs37(Flex29, { gap: 2, children: [
7133
+ /* @__PURE__ */ jsxs37(
6537
7134
  Select3,
6538
7135
  {
6539
7136
  fontSize: 2,
6540
7137
  onChange: (e) => setSource(e.currentTarget.value || null),
6541
7138
  value: source ?? "",
6542
7139
  children: [
6543
- /* @__PURE__ */ jsx41("option", { value: "", children: "All sources" }),
6544
- sources.map((s) => /* @__PURE__ */ jsx41("option", { value: s, children: s }, s))
7140
+ /* @__PURE__ */ jsx50("option", { value: "", children: "All sources" }),
7141
+ sources.map((s) => /* @__PURE__ */ jsx50("option", { value: s, children: s }, s))
6545
7142
  ]
6546
7143
  }
6547
7144
  ),
6548
- /* @__PURE__ */ jsxs34(
7145
+ /* @__PURE__ */ jsxs37(
6549
7146
  Select3,
6550
7147
  {
6551
7148
  fontSize: 2,
6552
7149
  onChange: (e) => setMode(e.currentTarget.value || null),
6553
7150
  value: mode ?? "",
6554
7151
  children: [
6555
- /* @__PURE__ */ jsx41("option", { value: "", children: "All modes" }),
6556
- modes.map((m) => /* @__PURE__ */ jsx41("option", { value: m, children: m }, m))
7152
+ /* @__PURE__ */ jsx50("option", { value: "", children: "All modes" }),
7153
+ modes.map((m) => /* @__PURE__ */ jsx50("option", { value: m, children: m }, m))
6557
7154
  ]
6558
7155
  }
6559
7156
  )
6560
7157
  ] })
6561
7158
  ] }),
6562
- !isDetail && /* @__PURE__ */ jsxs34(TabList2, { space: 1, children: [
6563
- /* @__PURE__ */ jsx41(
7159
+ !isDetail && /* @__PURE__ */ jsxs37(TabList2, { space: 1, children: [
7160
+ /* @__PURE__ */ jsx50(
6564
7161
  Tab2,
6565
7162
  {
6566
7163
  "aria-controls": "latest-panel",
@@ -6570,7 +7167,7 @@ function Dashboard() {
6570
7167
  selected: activeTab === "latest"
6571
7168
  }
6572
7169
  ),
6573
- /* @__PURE__ */ jsx41(
7170
+ /* @__PURE__ */ jsx50(
6574
7171
  Tab2,
6575
7172
  {
6576
7173
  "aria-controls": "timeline-panel",
@@ -6580,7 +7177,7 @@ function Dashboard() {
6580
7177
  selected: activeTab === "timeline"
6581
7178
  }
6582
7179
  ),
6583
- /* @__PURE__ */ jsx41(
7180
+ /* @__PURE__ */ jsx50(
6584
7181
  Tab2,
6585
7182
  {
6586
7183
  "aria-controls": "compare-panel",
@@ -6591,7 +7188,7 @@ function Dashboard() {
6591
7188
  }
6592
7189
  )
6593
7190
  ] }),
6594
- !isDetail && activeTab === "latest" && /* @__PURE__ */ jsx41(TabPanel2, { "aria-labelledby": "latest-tab", id: "latest-panel", children: /* @__PURE__ */ jsx41(
7191
+ !isDetail && activeTab === "latest" && /* @__PURE__ */ jsx50(TabPanel2, { "aria-labelledby": "latest-tab", id: "latest-panel", children: /* @__PURE__ */ jsx50(
6595
7192
  LatestReports,
6596
7193
  {
6597
7194
  mode,
@@ -6599,9 +7196,9 @@ function Dashboard() {
6599
7196
  source
6600
7197
  }
6601
7198
  ) }),
6602
- !isDetail && activeTab === "timeline" && /* @__PURE__ */ jsx41(TabPanel2, { "aria-labelledby": "timeline-tab", id: "timeline-panel", children: /* @__PURE__ */ jsx41(ScoreTimeline_default, { mode, source }) }),
6603
- !isDetail && activeTab === "compare" && /* @__PURE__ */ jsx41(TabPanel2, { "aria-labelledby": "compare-tab", id: "compare-panel", children: /* @__PURE__ */ jsx41(ComparisonView, {}) }),
6604
- isDetail && reportId && /* @__PURE__ */ jsx41(
7199
+ !isDetail && activeTab === "timeline" && /* @__PURE__ */ jsx50(TabPanel2, { "aria-labelledby": "timeline-tab", id: "timeline-panel", children: /* @__PURE__ */ jsx50(ScoreTimeline_default, { mode, source }) }),
7200
+ !isDetail && activeTab === "compare" && /* @__PURE__ */ jsx50(TabPanel2, { "aria-labelledby": "compare-tab", id: "compare-panel", children: /* @__PURE__ */ jsx50(ComparisonView, {}) }),
7201
+ isDetail && reportId && /* @__PURE__ */ jsx50(
6605
7202
  ReportDetail,
6606
7203
  {
6607
7204
  activeTab: routerState.tab ?? null,
@@ -6630,23 +7227,23 @@ function ailfTool(options = {}) {
6630
7227
 
6631
7228
  // src/actions/RunEvaluationAction.tsx
6632
7229
  import { BarChartIcon as BarChartIcon2 } from "@sanity/icons";
6633
- import { useToast as useToast2 } from "@sanity/ui";
6634
- import { useCallback as useCallback16, useEffect as useEffect11, useRef as useRef5, useState as useState13 } from "react";
7230
+ import { useToast as useToast8 } from "@sanity/ui";
7231
+ import { useCallback as useCallback23, useEffect as useEffect12, useRef as useRef5, useState as useState18 } from "react";
6635
7232
  import {
6636
7233
  getReleaseIdFromReleaseDocumentId as getReleaseIdFromReleaseDocumentId4,
6637
- useClient as useClient10,
6638
- useCurrentUser as useCurrentUser2,
7234
+ useClient as useClient15,
7235
+ useCurrentUser as useCurrentUser3,
6639
7236
  useDataset as useDataset2,
6640
7237
  useProjectId as useProjectId2
6641
7238
  } from "sanity";
6642
7239
  var API_VERSION2 = "2026-03-11";
6643
- var EVAL_REQUEST_TYPE2 = "ailf.evalRequest";
7240
+ var EVAL_REQUEST_TYPE3 = "ailf.evalRequest";
6644
7241
  var POLL_INTERVAL_MS2 = 3e4;
6645
7242
  var MAX_POLL_MS2 = 30 * 60 * 1e3;
6646
7243
  var EVAL_REQUEST_STATUS_QUERY2 = (
6647
7244
  /* groq */
6648
7245
  `
6649
- *[_type == "${EVAL_REQUEST_TYPE2}" && _id == $id][0] {
7246
+ *[_type == "${EVAL_REQUEST_TYPE3}" && _id == $id][0] {
6650
7247
  status,
6651
7248
  error,
6652
7249
  reportId
@@ -6657,15 +7254,15 @@ function createRunEvaluationAction(options = {}) {
6657
7254
  const { mode = "baseline" } = options;
6658
7255
  const RunEvaluationAction = (props) => {
6659
7256
  const { release } = props;
6660
- const client = useClient10({ apiVersion: API_VERSION2 });
7257
+ const client = useClient15({ apiVersion: API_VERSION2 });
6661
7258
  const dataset = useDataset2();
6662
7259
  const projectId = useProjectId2();
6663
- const currentUser = useCurrentUser2();
6664
- const toast = useToast2();
6665
- const [state, setState] = useState13({ status: "loading" });
7260
+ const currentUser = useCurrentUser3();
7261
+ const toast = useToast8();
7262
+ const [state, setState] = useState18({ status: "loading" });
6666
7263
  const requestedAtRef = useRef5(null);
6667
7264
  const perspectiveId = getReleaseIdFromReleaseDocumentId4(release._id);
6668
- useEffect11(() => {
7265
+ useEffect12(() => {
6669
7266
  let cancelled = false;
6670
7267
  client.fetch(contentImpactQuery, buildReportQueryParams(perspectiveId)).then((results) => {
6671
7268
  if (cancelled) return;
@@ -6688,7 +7285,7 @@ function createRunEvaluationAction(options = {}) {
6688
7285
  cancelled = true;
6689
7286
  };
6690
7287
  }, [client, perspectiveId]);
6691
- useEffect11(() => {
7288
+ useEffect12(() => {
6692
7289
  if (state.status !== "requested" && state.status !== "polling") return;
6693
7290
  const { requestId, startedAt } = state;
6694
7291
  if (state.status === "requested") {
@@ -6738,7 +7335,7 @@ function createRunEvaluationAction(options = {}) {
6738
7335
  }, POLL_INTERVAL_MS2);
6739
7336
  return () => clearInterval(interval);
6740
7337
  }, [client, perspectiveId, state]);
6741
- useEffect11(() => {
7338
+ useEffect12(() => {
6742
7339
  if (state.status !== "error") return;
6743
7340
  const timer = setTimeout(() => {
6744
7341
  client.fetch(contentImpactQuery, buildReportQueryParams(perspectiveId)).then((results) => {
@@ -6758,13 +7355,13 @@ function createRunEvaluationAction(options = {}) {
6758
7355
  }, 15e3);
6759
7356
  return () => clearTimeout(timer);
6760
7357
  }, [client, perspectiveId, state]);
6761
- const handleRequest = useCallback16(async () => {
7358
+ const handleRequest = useCallback23(async () => {
6762
7359
  const releaseTitle = release.metadata?.title ?? perspectiveId ?? "release";
6763
- const tag = `release-${slugify2(releaseTitle)}-${dateStamp2()}`;
7360
+ const tag = `release-${slugify3(releaseTitle)}-${dateStamp3()}`;
6764
7361
  const now = Date.now();
6765
7362
  try {
6766
7363
  const doc = await client.create({
6767
- _type: EVAL_REQUEST_TYPE2,
7364
+ _type: EVAL_REQUEST_TYPE3,
6768
7365
  dataset,
6769
7366
  mode,
6770
7367
  perspective: perspectiveId,
@@ -6858,10 +7455,10 @@ function buildReportQueryParams(perspectiveId) {
6858
7455
  source: null
6859
7456
  };
6860
7457
  }
6861
- function slugify2(s) {
7458
+ function slugify3(s) {
6862
7459
  return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
6863
7460
  }
6864
- function dateStamp2() {
7461
+ function dateStamp3() {
6865
7462
  const d = /* @__PURE__ */ new Date();
6866
7463
  return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
6867
7464
  }