@sanity/ailf-studio 0.1.14 → 0.1.16
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 +753 -235
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2637,7 +2637,7 @@ var taskSchema = defineType5({
|
|
|
2637
2637
|
components: {
|
|
2638
2638
|
input: OriginInput
|
|
2639
2639
|
},
|
|
2640
|
-
hidden: ({ document }) => !
|
|
2640
|
+
hidden: ({ document: document2 }) => !document2?.origin,
|
|
2641
2641
|
name: "origin",
|
|
2642
2642
|
options: {
|
|
2643
2643
|
collapsible: true,
|
|
@@ -2685,7 +2685,7 @@ var taskSchema = defineType5({
|
|
|
2685
2685
|
// Document-level read-only when mirrored from a repo.
|
|
2686
2686
|
// Native tasks (no origin) are fully editable; mirrored tasks
|
|
2687
2687
|
// are read-only because the source of truth is the repo.
|
|
2688
|
-
readOnly: ({ document }) => !!
|
|
2688
|
+
readOnly: ({ document: document2 }) => !!document2?.origin,
|
|
2689
2689
|
title: "AILF Task",
|
|
2690
2690
|
type: "document"
|
|
2691
2691
|
});
|
|
@@ -2780,16 +2780,16 @@ import { route } from "sanity/router";
|
|
|
2780
2780
|
// src/components/Dashboard.tsx
|
|
2781
2781
|
import {
|
|
2782
2782
|
Container,
|
|
2783
|
-
Flex as
|
|
2783
|
+
Flex as Flex28,
|
|
2784
2784
|
Select as Select3,
|
|
2785
|
-
Stack as
|
|
2785
|
+
Stack as Stack26,
|
|
2786
2786
|
Tab as Tab2,
|
|
2787
2787
|
TabList as TabList2,
|
|
2788
2788
|
TabPanel as TabPanel2,
|
|
2789
|
-
Text as
|
|
2789
|
+
Text as Text35
|
|
2790
2790
|
} from "@sanity/ui";
|
|
2791
|
-
import { useCallback as
|
|
2792
|
-
import { useClient as
|
|
2791
|
+
import { useCallback as useCallback21, useEffect as useEffect10, useState as useState16 } from "react";
|
|
2792
|
+
import { useClient as useClient13 } from "sanity";
|
|
2793
2793
|
import { useRouter } from "sanity/router";
|
|
2794
2794
|
|
|
2795
2795
|
// src/queries.ts
|
|
@@ -4767,21 +4767,21 @@ function getDateThreshold(preset) {
|
|
|
4767
4767
|
import { ArrowLeftIcon as ArrowLeftIcon2 } from "@sanity/icons";
|
|
4768
4768
|
import {
|
|
4769
4769
|
Box as Box15,
|
|
4770
|
-
Button as
|
|
4771
|
-
Stack as
|
|
4770
|
+
Button as Button5,
|
|
4771
|
+
Stack as Stack24,
|
|
4772
4772
|
Tab,
|
|
4773
4773
|
TabList,
|
|
4774
4774
|
TabPanel,
|
|
4775
|
-
Text as
|
|
4776
|
-
Tooltip as
|
|
4775
|
+
Text as Text33,
|
|
4776
|
+
Tooltip as Tooltip8
|
|
4777
4777
|
} from "@sanity/ui";
|
|
4778
4778
|
import {
|
|
4779
|
-
useCallback as
|
|
4779
|
+
useCallback as useCallback19,
|
|
4780
4780
|
useEffect as useEffect8,
|
|
4781
4781
|
useMemo as useMemo7,
|
|
4782
|
-
useState as
|
|
4782
|
+
useState as useState14
|
|
4783
4783
|
} from "react";
|
|
4784
|
-
import { useClient as
|
|
4784
|
+
import { useClient as useClient11 } from "sanity";
|
|
4785
4785
|
|
|
4786
4786
|
// src/components/report-detail/AgentActivitySection.tsx
|
|
4787
4787
|
import { useMemo as useMemo6, useState as useState8 } from "react";
|
|
@@ -5061,7 +5061,21 @@ import { Card as Card15, Text as Text24 } from "@sanity/ui";
|
|
|
5061
5061
|
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
5062
5062
|
function ScoreCell({ score, size = 2 }) {
|
|
5063
5063
|
const rounded = Math.round(score);
|
|
5064
|
-
return /* @__PURE__ */ jsx29(
|
|
5064
|
+
return /* @__PURE__ */ jsx29(
|
|
5065
|
+
Card15,
|
|
5066
|
+
{
|
|
5067
|
+
padding: 1,
|
|
5068
|
+
radius: 2,
|
|
5069
|
+
style: {
|
|
5070
|
+
alignItems: "center",
|
|
5071
|
+
display: "flex",
|
|
5072
|
+
flex: 1,
|
|
5073
|
+
justifyContent: "center"
|
|
5074
|
+
},
|
|
5075
|
+
tone: scoreTone(rounded),
|
|
5076
|
+
children: /* @__PURE__ */ jsx29(Text24, { align: "center", size, weight: "medium", children: rounded })
|
|
5077
|
+
}
|
|
5078
|
+
);
|
|
5065
5079
|
}
|
|
5066
5080
|
|
|
5067
5081
|
// src/components/report-detail/AreaScoreTable.tsx
|
|
@@ -5118,10 +5132,50 @@ function AreaScoreTable({ scores }) {
|
|
|
5118
5132
|
children: /* @__PURE__ */ jsx30(Text25, { size: 2, weight: "medium", children: score.feature })
|
|
5119
5133
|
}
|
|
5120
5134
|
),
|
|
5121
|
-
/* @__PURE__ */ jsx30(
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5135
|
+
/* @__PURE__ */ jsx30(
|
|
5136
|
+
"div",
|
|
5137
|
+
{
|
|
5138
|
+
style: {
|
|
5139
|
+
background: rowBackground(i),
|
|
5140
|
+
display: "flex",
|
|
5141
|
+
padding: "2px 0"
|
|
5142
|
+
},
|
|
5143
|
+
children: /* @__PURE__ */ jsx30(ScoreCell, { score: score.totalScore })
|
|
5144
|
+
}
|
|
5145
|
+
),
|
|
5146
|
+
/* @__PURE__ */ jsx30(
|
|
5147
|
+
"div",
|
|
5148
|
+
{
|
|
5149
|
+
style: {
|
|
5150
|
+
background: rowBackground(i),
|
|
5151
|
+
display: "flex",
|
|
5152
|
+
padding: "2px 0"
|
|
5153
|
+
},
|
|
5154
|
+
children: /* @__PURE__ */ jsx30(ScoreCell, { score: score.taskCompletion })
|
|
5155
|
+
}
|
|
5156
|
+
),
|
|
5157
|
+
/* @__PURE__ */ jsx30(
|
|
5158
|
+
"div",
|
|
5159
|
+
{
|
|
5160
|
+
style: {
|
|
5161
|
+
background: rowBackground(i),
|
|
5162
|
+
display: "flex",
|
|
5163
|
+
padding: "2px 0"
|
|
5164
|
+
},
|
|
5165
|
+
children: /* @__PURE__ */ jsx30(ScoreCell, { score: score.codeCorrectness })
|
|
5166
|
+
}
|
|
5167
|
+
),
|
|
5168
|
+
/* @__PURE__ */ jsx30(
|
|
5169
|
+
"div",
|
|
5170
|
+
{
|
|
5171
|
+
style: {
|
|
5172
|
+
background: rowBackground(i),
|
|
5173
|
+
display: "flex",
|
|
5174
|
+
padding: "2px 0"
|
|
5175
|
+
},
|
|
5176
|
+
children: /* @__PURE__ */ jsx30(ScoreCell, { score: score.docCoverage })
|
|
5177
|
+
}
|
|
5178
|
+
),
|
|
5125
5179
|
/* @__PURE__ */ jsx30(
|
|
5126
5180
|
"div",
|
|
5127
5181
|
{
|
|
@@ -5770,23 +5824,507 @@ function RecommendationRow({
|
|
|
5770
5824
|
}
|
|
5771
5825
|
|
|
5772
5826
|
// src/components/report-detail/ReportHeader.tsx
|
|
5773
|
-
import { ArrowLeftIcon
|
|
5827
|
+
import { ArrowLeftIcon } from "@sanity/icons";
|
|
5828
|
+
import { Badge as Badge20, Button as Button4, Flex as Flex25, Stack as Stack22, Text as Text31 } from "@sanity/ui";
|
|
5829
|
+
|
|
5830
|
+
// src/components/report-detail/report-actions/ReportActions.tsx
|
|
5831
|
+
import { ChevronDownIcon, CopyIcon as CopyIcon2 } from "@sanity/icons";
|
|
5774
5832
|
import {
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
Text as Text30,
|
|
5782
|
-
Tooltip as Tooltip8
|
|
5833
|
+
Button as Button3,
|
|
5834
|
+
Flex as Flex24,
|
|
5835
|
+
Menu as Menu2,
|
|
5836
|
+
MenuButton as MenuButton2,
|
|
5837
|
+
MenuDivider,
|
|
5838
|
+
useToast as useToast7
|
|
5783
5839
|
} from "@sanity/ui";
|
|
5784
|
-
import {
|
|
5840
|
+
import { useCallback as useCallback18, useState as useState13 } from "react";
|
|
5841
|
+
import { useClient as useClient10 } from "sanity";
|
|
5842
|
+
|
|
5843
|
+
// src/components/report-detail/report-actions/CopyReportAction.tsx
|
|
5844
|
+
import { ClipboardIcon } from "@sanity/icons";
|
|
5845
|
+
import { MenuItem as MenuItem2, useToast as useToast2 } from "@sanity/ui";
|
|
5846
|
+
import { useCallback as useCallback13, useState as useState10 } from "react";
|
|
5847
|
+
import { useClient as useClient7 } from "sanity";
|
|
5848
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
5849
|
+
function CopyReportAction({ documentId }) {
|
|
5850
|
+
const client = useClient7({ apiVersion: API_VERSION });
|
|
5851
|
+
const toast = useToast2();
|
|
5852
|
+
const [copying, setCopying] = useState10(false);
|
|
5853
|
+
const handleClick = useCallback13(async () => {
|
|
5854
|
+
setCopying(true);
|
|
5855
|
+
try {
|
|
5856
|
+
const doc = await client.fetch(
|
|
5857
|
+
`*[_type == "ailf.report" && _id == $id][0]`,
|
|
5858
|
+
{ id: documentId }
|
|
5859
|
+
);
|
|
5860
|
+
if (!doc) {
|
|
5861
|
+
toast.push({
|
|
5862
|
+
closable: true,
|
|
5863
|
+
status: "error",
|
|
5864
|
+
title: "Report document not found"
|
|
5865
|
+
});
|
|
5866
|
+
return;
|
|
5867
|
+
}
|
|
5868
|
+
const json = JSON.stringify(doc, null, 2);
|
|
5869
|
+
await navigator.clipboard.writeText(json);
|
|
5870
|
+
toast.push({
|
|
5871
|
+
closable: true,
|
|
5872
|
+
status: "success",
|
|
5873
|
+
title: "Report JSON copied to clipboard"
|
|
5874
|
+
});
|
|
5875
|
+
} catch {
|
|
5876
|
+
toast.push({
|
|
5877
|
+
closable: true,
|
|
5878
|
+
status: "error",
|
|
5879
|
+
title: "Failed to copy report"
|
|
5880
|
+
});
|
|
5881
|
+
} finally {
|
|
5882
|
+
setCopying(false);
|
|
5883
|
+
}
|
|
5884
|
+
}, [client, documentId, toast]);
|
|
5885
|
+
return /* @__PURE__ */ jsx37(
|
|
5886
|
+
MenuItem2,
|
|
5887
|
+
{
|
|
5888
|
+
disabled: copying,
|
|
5889
|
+
icon: ClipboardIcon,
|
|
5890
|
+
onClick: handleClick,
|
|
5891
|
+
text: copying ? "Copying\u2026" : "Copy full JSON"
|
|
5892
|
+
}
|
|
5893
|
+
);
|
|
5894
|
+
}
|
|
5895
|
+
|
|
5896
|
+
// src/components/report-detail/report-actions/CopyReportIdAction.tsx
|
|
5897
|
+
import { CopyIcon } from "@sanity/icons";
|
|
5898
|
+
import { MenuItem as MenuItem3, useToast as useToast3 } from "@sanity/ui";
|
|
5899
|
+
import { useCallback as useCallback14 } from "react";
|
|
5900
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
5901
|
+
function CopyReportIdAction({ reportId }) {
|
|
5902
|
+
const toast = useToast3();
|
|
5903
|
+
const handleClick = useCallback14(() => {
|
|
5904
|
+
navigator.clipboard.writeText(reportId).then(
|
|
5905
|
+
() => {
|
|
5906
|
+
toast.push({
|
|
5907
|
+
closable: true,
|
|
5908
|
+
status: "success",
|
|
5909
|
+
title: "Report ID copied"
|
|
5910
|
+
});
|
|
5911
|
+
},
|
|
5912
|
+
() => {
|
|
5913
|
+
toast.push({
|
|
5914
|
+
closable: true,
|
|
5915
|
+
status: "error",
|
|
5916
|
+
title: "Failed to copy report ID"
|
|
5917
|
+
});
|
|
5918
|
+
}
|
|
5919
|
+
);
|
|
5920
|
+
}, [reportId, toast]);
|
|
5921
|
+
return /* @__PURE__ */ jsx38(MenuItem3, { icon: CopyIcon, onClick: handleClick, text: "Copy report ID" });
|
|
5922
|
+
}
|
|
5923
|
+
|
|
5924
|
+
// src/components/report-detail/report-actions/CopyVisionQueryAction.tsx
|
|
5925
|
+
import { SearchIcon as SearchIcon6 } from "@sanity/icons";
|
|
5926
|
+
import { MenuItem as MenuItem4, useToast as useToast4 } from "@sanity/ui";
|
|
5927
|
+
import { useCallback as useCallback15 } from "react";
|
|
5928
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
5929
|
+
function CopyVisionQueryAction({
|
|
5930
|
+
reportId
|
|
5931
|
+
}) {
|
|
5932
|
+
const toast = useToast4();
|
|
5933
|
+
const handleClick = useCallback15(() => {
|
|
5934
|
+
const query = `*[_type == "ailf.report" && reportId == "${reportId}"][0]`;
|
|
5935
|
+
navigator.clipboard.writeText(query).then(
|
|
5936
|
+
() => {
|
|
5937
|
+
toast.push({
|
|
5938
|
+
closable: true,
|
|
5939
|
+
description: "Paste into the Vision tool to explore the full document",
|
|
5940
|
+
status: "success",
|
|
5941
|
+
title: "GROQ query copied"
|
|
5942
|
+
});
|
|
5943
|
+
},
|
|
5944
|
+
() => {
|
|
5945
|
+
toast.push({
|
|
5946
|
+
closable: true,
|
|
5947
|
+
status: "error",
|
|
5948
|
+
title: "Failed to copy query"
|
|
5949
|
+
});
|
|
5950
|
+
}
|
|
5951
|
+
);
|
|
5952
|
+
}, [reportId, toast]);
|
|
5953
|
+
return /* @__PURE__ */ jsx39(
|
|
5954
|
+
MenuItem4,
|
|
5955
|
+
{
|
|
5956
|
+
icon: SearchIcon6,
|
|
5957
|
+
onClick: handleClick,
|
|
5958
|
+
text: "Copy Vision query"
|
|
5959
|
+
}
|
|
5960
|
+
);
|
|
5961
|
+
}
|
|
5962
|
+
|
|
5963
|
+
// src/components/report-detail/report-actions/DeleteConfirmDialog.tsx
|
|
5964
|
+
import { Box as Box14, Button as Button2, Card as Card21, Dialog, Flex as Flex23, Stack as Stack21, Text as Text30 } from "@sanity/ui";
|
|
5965
|
+
import { jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5966
|
+
function DeleteConfirmDialog({
|
|
5967
|
+
isDeleting,
|
|
5968
|
+
onClose,
|
|
5969
|
+
onConfirm,
|
|
5970
|
+
reportId
|
|
5971
|
+
}) {
|
|
5972
|
+
return /* @__PURE__ */ jsx40(
|
|
5973
|
+
Dialog,
|
|
5974
|
+
{
|
|
5975
|
+
header: "Delete Report",
|
|
5976
|
+
id: "delete-report-dialog",
|
|
5977
|
+
onClose,
|
|
5978
|
+
width: 1,
|
|
5979
|
+
children: /* @__PURE__ */ jsx40(Box14, { padding: 4, children: /* @__PURE__ */ jsxs30(Stack21, { space: 4, children: [
|
|
5980
|
+
/* @__PURE__ */ jsx40(Text30, { children: "Are you sure you want to delete this report? This action cannot be undone." }),
|
|
5981
|
+
/* @__PURE__ */ jsx40(Card21, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx40(
|
|
5982
|
+
Text30,
|
|
5983
|
+
{
|
|
5984
|
+
muted: true,
|
|
5985
|
+
size: 1,
|
|
5986
|
+
style: { fontFamily: "monospace", wordBreak: "break-all" },
|
|
5987
|
+
children: reportId
|
|
5988
|
+
}
|
|
5989
|
+
) }),
|
|
5990
|
+
/* @__PURE__ */ jsxs30(Flex23, { gap: 2, justify: "flex-end", children: [
|
|
5991
|
+
/* @__PURE__ */ jsx40(
|
|
5992
|
+
Button2,
|
|
5993
|
+
{
|
|
5994
|
+
disabled: isDeleting,
|
|
5995
|
+
mode: "ghost",
|
|
5996
|
+
onClick: onClose,
|
|
5997
|
+
text: "Cancel"
|
|
5998
|
+
}
|
|
5999
|
+
),
|
|
6000
|
+
/* @__PURE__ */ jsx40(
|
|
6001
|
+
Button2,
|
|
6002
|
+
{
|
|
6003
|
+
disabled: isDeleting,
|
|
6004
|
+
onClick: onConfirm,
|
|
6005
|
+
text: isDeleting ? "Deleting\u2026" : "Delete",
|
|
6006
|
+
tone: "critical"
|
|
6007
|
+
}
|
|
6008
|
+
)
|
|
6009
|
+
] })
|
|
6010
|
+
] }) })
|
|
6011
|
+
}
|
|
6012
|
+
);
|
|
6013
|
+
}
|
|
6014
|
+
|
|
6015
|
+
// src/components/report-detail/report-actions/DeleteReportAction.tsx
|
|
6016
|
+
import { TrashIcon } from "@sanity/icons";
|
|
6017
|
+
import { MenuItem as MenuItem5 } from "@sanity/ui";
|
|
6018
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
6019
|
+
function DeleteReportAction({
|
|
6020
|
+
onRequestDelete
|
|
6021
|
+
}) {
|
|
6022
|
+
return /* @__PURE__ */ jsx41(
|
|
6023
|
+
MenuItem5,
|
|
6024
|
+
{
|
|
6025
|
+
icon: TrashIcon,
|
|
6026
|
+
onClick: onRequestDelete,
|
|
6027
|
+
text: "Delete report",
|
|
6028
|
+
tone: "critical"
|
|
6029
|
+
}
|
|
6030
|
+
);
|
|
6031
|
+
}
|
|
6032
|
+
|
|
6033
|
+
// src/components/report-detail/report-actions/DownloadReportAction.tsx
|
|
6034
|
+
import { DownloadIcon } from "@sanity/icons";
|
|
6035
|
+
import { MenuItem as MenuItem6, useToast as useToast5 } from "@sanity/ui";
|
|
6036
|
+
import { useCallback as useCallback16, useState as useState11 } from "react";
|
|
6037
|
+
import { useClient as useClient8 } from "sanity";
|
|
6038
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
6039
|
+
function DownloadReportAction({
|
|
6040
|
+
documentId,
|
|
6041
|
+
reportId
|
|
6042
|
+
}) {
|
|
6043
|
+
const client = useClient8({ apiVersion: API_VERSION });
|
|
6044
|
+
const toast = useToast5();
|
|
6045
|
+
const [downloading, setDownloading] = useState11(false);
|
|
6046
|
+
const handleClick = useCallback16(async () => {
|
|
6047
|
+
setDownloading(true);
|
|
6048
|
+
try {
|
|
6049
|
+
const doc = await client.fetch(
|
|
6050
|
+
`*[_type == "ailf.report" && _id == $id][0]`,
|
|
6051
|
+
{ id: documentId }
|
|
6052
|
+
);
|
|
6053
|
+
if (!doc) {
|
|
6054
|
+
toast.push({
|
|
6055
|
+
closable: true,
|
|
6056
|
+
status: "error",
|
|
6057
|
+
title: "Report document not found"
|
|
6058
|
+
});
|
|
6059
|
+
return;
|
|
6060
|
+
}
|
|
6061
|
+
const json = JSON.stringify(doc, null, 2);
|
|
6062
|
+
const blob = new Blob([json], { type: "application/json" });
|
|
6063
|
+
const url = URL.createObjectURL(blob);
|
|
6064
|
+
const anchor = document.createElement("a");
|
|
6065
|
+
anchor.href = url;
|
|
6066
|
+
anchor.download = `ailf-report-${reportId}.json`;
|
|
6067
|
+
document.body.appendChild(anchor);
|
|
6068
|
+
anchor.click();
|
|
6069
|
+
document.body.removeChild(anchor);
|
|
6070
|
+
URL.revokeObjectURL(url);
|
|
6071
|
+
toast.push({
|
|
6072
|
+
closable: true,
|
|
6073
|
+
status: "success",
|
|
6074
|
+
title: "Report downloaded"
|
|
6075
|
+
});
|
|
6076
|
+
} catch {
|
|
6077
|
+
toast.push({
|
|
6078
|
+
closable: true,
|
|
6079
|
+
status: "error",
|
|
6080
|
+
title: "Failed to download report"
|
|
6081
|
+
});
|
|
6082
|
+
} finally {
|
|
6083
|
+
setDownloading(false);
|
|
6084
|
+
}
|
|
6085
|
+
}, [client, documentId, reportId, toast]);
|
|
6086
|
+
return /* @__PURE__ */ jsx42(
|
|
6087
|
+
MenuItem6,
|
|
6088
|
+
{
|
|
6089
|
+
disabled: downloading,
|
|
6090
|
+
icon: DownloadIcon,
|
|
6091
|
+
onClick: handleClick,
|
|
6092
|
+
text: downloading ? "Downloading\u2026" : "Download JSON"
|
|
6093
|
+
}
|
|
6094
|
+
);
|
|
6095
|
+
}
|
|
6096
|
+
|
|
6097
|
+
// src/components/report-detail/report-actions/RerunEvaluationAction.tsx
|
|
6098
|
+
import { PlayIcon as PlayIcon2 } from "@sanity/icons";
|
|
6099
|
+
import { MenuItem as MenuItem7, useToast as useToast6 } from "@sanity/ui";
|
|
6100
|
+
import { useCallback as useCallback17, useState as useState12 } from "react";
|
|
6101
|
+
import { useClient as useClient9, useCurrentUser as useCurrentUser2 } from "sanity";
|
|
6102
|
+
|
|
6103
|
+
// src/lib/eval-scope.ts
|
|
6104
|
+
function extractEvalScope(provenance) {
|
|
6105
|
+
return {
|
|
6106
|
+
areas: provenance.areas,
|
|
6107
|
+
dataset: provenance.source.dataset,
|
|
6108
|
+
mode: provenance.mode,
|
|
6109
|
+
perspective: provenance.source.perspective,
|
|
6110
|
+
projectId: provenance.source.projectId,
|
|
6111
|
+
taskIds: provenance.taskIds
|
|
6112
|
+
};
|
|
6113
|
+
}
|
|
6114
|
+
|
|
6115
|
+
// src/components/report-detail/report-actions/RerunEvaluationAction.tsx
|
|
6116
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
6117
|
+
var EVAL_REQUEST_TYPE2 = "ailf.evalRequest";
|
|
6118
|
+
function slugify2(s) {
|
|
6119
|
+
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
|
|
6120
|
+
}
|
|
6121
|
+
function dateStamp2() {
|
|
6122
|
+
const d = /* @__PURE__ */ new Date();
|
|
6123
|
+
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
6124
|
+
}
|
|
6125
|
+
function buildRequestDoc(scope, meta) {
|
|
6126
|
+
const shortId = slugify2(meta.reportId.slice(0, 12));
|
|
6127
|
+
const tag = `rerun-${shortId}-${dateStamp2()}`;
|
|
6128
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
6129
|
+
return {
|
|
6130
|
+
_type: EVAL_REQUEST_TYPE2,
|
|
6131
|
+
// Spread all scope fields — new EvalScope fields are automatically
|
|
6132
|
+
// included without changes here
|
|
6133
|
+
areas: scope.areas,
|
|
6134
|
+
dataset: scope.dataset,
|
|
6135
|
+
mode: scope.mode,
|
|
6136
|
+
...scope.perspective ? { perspective: scope.perspective } : {},
|
|
6137
|
+
projectId: scope.projectId,
|
|
6138
|
+
...scope.taskIds && scope.taskIds.length > 0 ? { tasks: scope.taskIds } : {},
|
|
6139
|
+
// Request metadata
|
|
6140
|
+
requestedAt: now,
|
|
6141
|
+
requestedBy: meta.userId,
|
|
6142
|
+
status: "pending",
|
|
6143
|
+
tag
|
|
6144
|
+
};
|
|
6145
|
+
}
|
|
6146
|
+
function RerunEvaluationAction({
|
|
6147
|
+
provenance,
|
|
6148
|
+
reportId
|
|
6149
|
+
}) {
|
|
6150
|
+
const client = useClient9({ apiVersion: API_VERSION });
|
|
6151
|
+
const currentUser = useCurrentUser2();
|
|
6152
|
+
const toast = useToast6();
|
|
6153
|
+
const [requesting, setRequesting] = useState12(false);
|
|
6154
|
+
const handleClick = useCallback17(async () => {
|
|
6155
|
+
setRequesting(true);
|
|
6156
|
+
try {
|
|
6157
|
+
const scope = extractEvalScope(provenance);
|
|
6158
|
+
const doc = buildRequestDoc(scope, {
|
|
6159
|
+
reportId,
|
|
6160
|
+
userId: currentUser?.id ?? "unknown"
|
|
6161
|
+
});
|
|
6162
|
+
await client.create(doc);
|
|
6163
|
+
toast.push({
|
|
6164
|
+
closable: true,
|
|
6165
|
+
description: "The evaluation pipeline has been triggered. A new report will appear in the dashboard in ~10\u201315 minutes.",
|
|
6166
|
+
status: "info",
|
|
6167
|
+
title: "Evaluation re-run started"
|
|
6168
|
+
});
|
|
6169
|
+
} catch (err) {
|
|
6170
|
+
const message = err instanceof Error ? err.message : "Failed to create eval request";
|
|
6171
|
+
toast.push({
|
|
6172
|
+
closable: true,
|
|
6173
|
+
description: message,
|
|
6174
|
+
status: "error",
|
|
6175
|
+
title: "Re-run failed"
|
|
6176
|
+
});
|
|
6177
|
+
} finally {
|
|
6178
|
+
setRequesting(false);
|
|
6179
|
+
}
|
|
6180
|
+
}, [client, currentUser?.id, provenance, reportId, toast]);
|
|
6181
|
+
return /* @__PURE__ */ jsx43(
|
|
6182
|
+
MenuItem7,
|
|
6183
|
+
{
|
|
6184
|
+
disabled: requesting,
|
|
6185
|
+
icon: PlayIcon2,
|
|
6186
|
+
onClick: handleClick,
|
|
6187
|
+
text: requesting ? "Requesting\u2026" : "Re-run evaluation"
|
|
6188
|
+
}
|
|
6189
|
+
);
|
|
6190
|
+
}
|
|
6191
|
+
|
|
6192
|
+
// src/components/report-detail/report-actions/ReportActions.tsx
|
|
6193
|
+
import { Fragment as Fragment6, jsx as jsx44, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
6194
|
+
function ReportActions({
|
|
6195
|
+
documentId,
|
|
6196
|
+
onDeleted,
|
|
6197
|
+
provenance,
|
|
6198
|
+
reportId
|
|
6199
|
+
}) {
|
|
6200
|
+
const client = useClient10({ apiVersion: API_VERSION });
|
|
6201
|
+
const toast = useToast7();
|
|
6202
|
+
const handleCopyId = useCallback18(() => {
|
|
6203
|
+
navigator.clipboard.writeText(reportId).then(
|
|
6204
|
+
() => {
|
|
6205
|
+
toast.push({
|
|
6206
|
+
closable: true,
|
|
6207
|
+
status: "success",
|
|
6208
|
+
title: "Report ID copied"
|
|
6209
|
+
});
|
|
6210
|
+
},
|
|
6211
|
+
() => {
|
|
6212
|
+
toast.push({
|
|
6213
|
+
closable: true,
|
|
6214
|
+
status: "error",
|
|
6215
|
+
title: "Failed to copy report ID"
|
|
6216
|
+
});
|
|
6217
|
+
}
|
|
6218
|
+
);
|
|
6219
|
+
}, [reportId, toast]);
|
|
6220
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState13(false);
|
|
6221
|
+
const [deleting, setDeleting] = useState13(false);
|
|
6222
|
+
const handleRequestDelete = useCallback18(() => {
|
|
6223
|
+
setDeleteDialogOpen(true);
|
|
6224
|
+
}, []);
|
|
6225
|
+
const handleDeleteClose = useCallback18(() => {
|
|
6226
|
+
if (!deleting) setDeleteDialogOpen(false);
|
|
6227
|
+
}, [deleting]);
|
|
6228
|
+
const handleDeleteConfirm = useCallback18(async () => {
|
|
6229
|
+
setDeleting(true);
|
|
6230
|
+
try {
|
|
6231
|
+
await client.delete(documentId);
|
|
6232
|
+
toast.push({
|
|
6233
|
+
closable: true,
|
|
6234
|
+
status: "success",
|
|
6235
|
+
title: "Report deleted"
|
|
6236
|
+
});
|
|
6237
|
+
setDeleteDialogOpen(false);
|
|
6238
|
+
onDeleted();
|
|
6239
|
+
} catch {
|
|
6240
|
+
toast.push({
|
|
6241
|
+
closable: true,
|
|
6242
|
+
status: "error",
|
|
6243
|
+
title: "Failed to delete report"
|
|
6244
|
+
});
|
|
6245
|
+
} finally {
|
|
6246
|
+
setDeleting(false);
|
|
6247
|
+
}
|
|
6248
|
+
}, [client, documentId, onDeleted, toast]);
|
|
6249
|
+
return /* @__PURE__ */ jsxs31(Fragment6, { children: [
|
|
6250
|
+
/* @__PURE__ */ jsxs31(Flex24, { children: [
|
|
6251
|
+
/* @__PURE__ */ jsx44(
|
|
6252
|
+
Button3,
|
|
6253
|
+
{
|
|
6254
|
+
icon: CopyIcon2,
|
|
6255
|
+
mode: "ghost",
|
|
6256
|
+
onClick: handleCopyId,
|
|
6257
|
+
style: {
|
|
6258
|
+
borderBottomRightRadius: 0,
|
|
6259
|
+
borderRight: "none",
|
|
6260
|
+
borderTopRightRadius: 0
|
|
6261
|
+
},
|
|
6262
|
+
text: "Copy Report ID"
|
|
6263
|
+
}
|
|
6264
|
+
),
|
|
6265
|
+
/* @__PURE__ */ jsx44(
|
|
6266
|
+
MenuButton2,
|
|
6267
|
+
{
|
|
6268
|
+
button: /* @__PURE__ */ jsx44(
|
|
6269
|
+
Button3,
|
|
6270
|
+
{
|
|
6271
|
+
icon: ChevronDownIcon,
|
|
6272
|
+
mode: "ghost",
|
|
6273
|
+
padding: 2,
|
|
6274
|
+
style: {
|
|
6275
|
+
borderBottomLeftRadius: 0,
|
|
6276
|
+
borderTopLeftRadius: 0
|
|
6277
|
+
}
|
|
6278
|
+
}
|
|
6279
|
+
),
|
|
6280
|
+
id: "report-actions-menu",
|
|
6281
|
+
menu: /* @__PURE__ */ jsxs31(Menu2, { children: [
|
|
6282
|
+
/* @__PURE__ */ jsx44(CopyReportIdAction, { reportId }),
|
|
6283
|
+
/* @__PURE__ */ jsx44(
|
|
6284
|
+
RerunEvaluationAction,
|
|
6285
|
+
{
|
|
6286
|
+
provenance,
|
|
6287
|
+
reportId
|
|
6288
|
+
}
|
|
6289
|
+
),
|
|
6290
|
+
/* @__PURE__ */ jsx44(MenuDivider, {}),
|
|
6291
|
+
/* @__PURE__ */ jsx44(
|
|
6292
|
+
DownloadReportAction,
|
|
6293
|
+
{
|
|
6294
|
+
documentId,
|
|
6295
|
+
reportId
|
|
6296
|
+
}
|
|
6297
|
+
),
|
|
6298
|
+
/* @__PURE__ */ jsx44(CopyReportAction, { documentId }),
|
|
6299
|
+
/* @__PURE__ */ jsx44(CopyVisionQueryAction, { reportId }),
|
|
6300
|
+
/* @__PURE__ */ jsx44(MenuDivider, {}),
|
|
6301
|
+
/* @__PURE__ */ jsx44(DeleteReportAction, { onRequestDelete: handleRequestDelete })
|
|
6302
|
+
] }),
|
|
6303
|
+
popover: { placement: "bottom-end", portal: true }
|
|
6304
|
+
}
|
|
6305
|
+
)
|
|
6306
|
+
] }),
|
|
6307
|
+
deleteDialogOpen && /* @__PURE__ */ jsx44(
|
|
6308
|
+
DeleteConfirmDialog,
|
|
6309
|
+
{
|
|
6310
|
+
isDeleting: deleting,
|
|
6311
|
+
onClose: handleDeleteClose,
|
|
6312
|
+
onConfirm: handleDeleteConfirm,
|
|
6313
|
+
reportId
|
|
6314
|
+
}
|
|
6315
|
+
)
|
|
6316
|
+
] });
|
|
6317
|
+
}
|
|
6318
|
+
|
|
6319
|
+
// src/components/report-detail/ReportHeader.tsx
|
|
6320
|
+
import { jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
5785
6321
|
function ReportHeader({
|
|
5786
6322
|
completedAt,
|
|
6323
|
+
documentId,
|
|
5787
6324
|
mode,
|
|
5788
6325
|
onBack,
|
|
5789
|
-
|
|
6326
|
+
onDeleted,
|
|
6327
|
+
provenance,
|
|
5790
6328
|
reportId,
|
|
5791
6329
|
sourceName,
|
|
5792
6330
|
tag
|
|
@@ -5794,89 +6332,42 @@ function ReportHeader({
|
|
|
5794
6332
|
const dateLabel = formatCardDate(completedAt);
|
|
5795
6333
|
const title = tag ?? dateLabel;
|
|
5796
6334
|
const hasTag = Boolean(tag);
|
|
5797
|
-
return /* @__PURE__ */
|
|
5798
|
-
/* @__PURE__ */
|
|
5799
|
-
|
|
5800
|
-
|
|
6335
|
+
return /* @__PURE__ */ jsxs32(Flex25, { align: "center", gap: 3, children: [
|
|
6336
|
+
/* @__PURE__ */ jsx45(Button4, { icon: ArrowLeftIcon, mode: "bleed", onClick: onBack, text: "Back" }),
|
|
6337
|
+
/* @__PURE__ */ jsxs32(Stack22, { flex: 1, space: 1, children: [
|
|
6338
|
+
/* @__PURE__ */ jsx45(Text31, { size: 4, weight: "bold", children: title }),
|
|
6339
|
+
hasTag && /* @__PURE__ */ jsx45(Text31, { muted: true, size: 2, children: dateLabel })
|
|
6340
|
+
] }),
|
|
6341
|
+
/* @__PURE__ */ jsxs32(Flex25, { align: "center", gap: 2, children: [
|
|
6342
|
+
/* @__PURE__ */ jsx45(Badge20, { mode: "outline", tone: "default", children: sourceName }),
|
|
6343
|
+
/* @__PURE__ */ jsx45(Badge20, { tone: "primary", children: mode }),
|
|
6344
|
+
/* @__PURE__ */ jsx45(
|
|
6345
|
+
ReportActions,
|
|
5801
6346
|
{
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
6347
|
+
documentId,
|
|
6348
|
+
onDeleted,
|
|
6349
|
+
provenance,
|
|
6350
|
+
reportId
|
|
5806
6351
|
}
|
|
5807
|
-
)
|
|
5808
|
-
|
|
5809
|
-
/* @__PURE__ */ jsx37(Text30, { size: 4, weight: "bold", children: title }),
|
|
5810
|
-
hasTag && /* @__PURE__ */ jsx37(Text30, { muted: true, size: 2, children: dateLabel })
|
|
5811
|
-
] }),
|
|
5812
|
-
/* @__PURE__ */ jsxs30(Flex23, { gap: 2, children: [
|
|
5813
|
-
/* @__PURE__ */ jsx37(Badge20, { mode: "outline", tone: "default", children: sourceName }),
|
|
5814
|
-
/* @__PURE__ */ jsx37(Badge20, { tone: "primary", children: mode })
|
|
5815
|
-
] })
|
|
5816
|
-
] }),
|
|
5817
|
-
/* @__PURE__ */ jsx37(
|
|
5818
|
-
Tooltip8,
|
|
5819
|
-
{
|
|
5820
|
-
content: /* @__PURE__ */ jsx37(Box14, { padding: 2, children: /* @__PURE__ */ jsx37(Text30, { size: 2, children: "Click to copy report ID" }) }),
|
|
5821
|
-
placement: "bottom",
|
|
5822
|
-
portal: true,
|
|
5823
|
-
children: /* @__PURE__ */ jsx37(
|
|
5824
|
-
Card21,
|
|
5825
|
-
{
|
|
5826
|
-
border: true,
|
|
5827
|
-
onClick: onCopyId,
|
|
5828
|
-
padding: 3,
|
|
5829
|
-
radius: 2,
|
|
5830
|
-
style: { cursor: "pointer" },
|
|
5831
|
-
tone: "transparent",
|
|
5832
|
-
children: /* @__PURE__ */ jsxs30(Flex23, { align: "center", gap: 3, children: [
|
|
5833
|
-
/* @__PURE__ */ jsx37(
|
|
5834
|
-
Text30,
|
|
5835
|
-
{
|
|
5836
|
-
muted: true,
|
|
5837
|
-
size: 1,
|
|
5838
|
-
style: {
|
|
5839
|
-
letterSpacing: "0.05em",
|
|
5840
|
-
textTransform: "uppercase"
|
|
5841
|
-
},
|
|
5842
|
-
weight: "semibold",
|
|
5843
|
-
children: "Report ID"
|
|
5844
|
-
}
|
|
5845
|
-
),
|
|
5846
|
-
/* @__PURE__ */ jsx37(
|
|
5847
|
-
Text30,
|
|
5848
|
-
{
|
|
5849
|
-
size: 2,
|
|
5850
|
-
style: {
|
|
5851
|
-
fontFamily: "monospace",
|
|
5852
|
-
userSelect: "all"
|
|
5853
|
-
},
|
|
5854
|
-
children: reportId
|
|
5855
|
-
}
|
|
5856
|
-
),
|
|
5857
|
-
/* @__PURE__ */ jsx37(Box14, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx37(Text30, { muted: true, size: 2, children: /* @__PURE__ */ jsx37(ClipboardIcon, {}) }) })
|
|
5858
|
-
] })
|
|
5859
|
-
}
|
|
5860
|
-
)
|
|
5861
|
-
}
|
|
5862
|
-
)
|
|
6352
|
+
)
|
|
6353
|
+
] })
|
|
5863
6354
|
] });
|
|
5864
6355
|
}
|
|
5865
6356
|
|
|
5866
6357
|
// src/components/report-detail/ThreeLayerTable.tsx
|
|
5867
6358
|
import React5 from "react";
|
|
5868
|
-
import { Badge as Badge21, Card as Card22, Flex as
|
|
5869
|
-
import { jsx as
|
|
6359
|
+
import { Badge as Badge21, Card as Card22, Flex as Flex26, Stack as Stack23, Text as Text32 } from "@sanity/ui";
|
|
6360
|
+
import { jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
5870
6361
|
function ThreeLayerTable({ scores }) {
|
|
5871
6362
|
const filtered = scores.filter((s) => s.actualScore != null);
|
|
5872
6363
|
if (filtered.length === 0) return null;
|
|
5873
6364
|
const hasInverted = filtered.some((s) => s.invertedRetrievalGap);
|
|
5874
|
-
return /* @__PURE__ */
|
|
5875
|
-
/* @__PURE__ */
|
|
5876
|
-
/* @__PURE__ */
|
|
5877
|
-
/* @__PURE__ */
|
|
6365
|
+
return /* @__PURE__ */ jsx46(Card22, { overflow: "auto", padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs33(Stack23, { space: 4, children: [
|
|
6366
|
+
/* @__PURE__ */ jsxs33(Flex26, { align: "center", gap: 3, children: [
|
|
6367
|
+
/* @__PURE__ */ jsx46(Text32, { size: 3, weight: "semibold", children: "Three-Layer Decomposition" }),
|
|
6368
|
+
/* @__PURE__ */ jsx46(Badge21, { tone: "primary", children: "full mode" })
|
|
5878
6369
|
] }),
|
|
5879
|
-
/* @__PURE__ */
|
|
6370
|
+
/* @__PURE__ */ jsxs33(
|
|
5880
6371
|
"div",
|
|
5881
6372
|
{
|
|
5882
6373
|
style: {
|
|
@@ -5885,9 +6376,9 @@ function ThreeLayerTable({ scores }) {
|
|
|
5885
6376
|
gridTemplateColumns: "2fr 1fr 1fr 1fr 1fr 1fr"
|
|
5886
6377
|
},
|
|
5887
6378
|
children: [
|
|
5888
|
-
/* @__PURE__ */
|
|
5889
|
-
/* @__PURE__ */
|
|
5890
|
-
/* @__PURE__ */
|
|
6379
|
+
/* @__PURE__ */ jsx46(ColumnHeader, { borderBottom: true, label: "Area" }),
|
|
6380
|
+
/* @__PURE__ */ jsx46(ColumnHeader, { borderBottom: true, label: "Floor", tooltip: GLOSSARY.floor }),
|
|
6381
|
+
/* @__PURE__ */ jsx46(
|
|
5891
6382
|
ColumnHeader,
|
|
5892
6383
|
{
|
|
5893
6384
|
borderBottom: true,
|
|
@@ -5895,8 +6386,8 @@ function ThreeLayerTable({ scores }) {
|
|
|
5895
6386
|
tooltip: GLOSSARY.ceiling
|
|
5896
6387
|
}
|
|
5897
6388
|
),
|
|
5898
|
-
/* @__PURE__ */
|
|
5899
|
-
/* @__PURE__ */
|
|
6389
|
+
/* @__PURE__ */ jsx46(ColumnHeader, { borderBottom: true, label: "Actual", tooltip: GLOSSARY.actual }),
|
|
6390
|
+
/* @__PURE__ */ jsx46(
|
|
5900
6391
|
ColumnHeader,
|
|
5901
6392
|
{
|
|
5902
6393
|
borderBottom: true,
|
|
@@ -5904,7 +6395,7 @@ function ThreeLayerTable({ scores }) {
|
|
|
5904
6395
|
tooltip: GLOSSARY.retGap
|
|
5905
6396
|
}
|
|
5906
6397
|
),
|
|
5907
|
-
/* @__PURE__ */
|
|
6398
|
+
/* @__PURE__ */ jsx46(
|
|
5908
6399
|
ColumnHeader,
|
|
5909
6400
|
{
|
|
5910
6401
|
borderBottom: true,
|
|
@@ -5912,8 +6403,8 @@ function ThreeLayerTable({ scores }) {
|
|
|
5912
6403
|
tooltip: GLOSSARY.efficiency
|
|
5913
6404
|
}
|
|
5914
6405
|
),
|
|
5915
|
-
filtered.map((score, i) => /* @__PURE__ */
|
|
5916
|
-
/* @__PURE__ */
|
|
6406
|
+
filtered.map((score, i) => /* @__PURE__ */ jsxs33(React5.Fragment, { children: [
|
|
6407
|
+
/* @__PURE__ */ jsx46(
|
|
5917
6408
|
"div",
|
|
5918
6409
|
{
|
|
5919
6410
|
style: {
|
|
@@ -5921,13 +6412,43 @@ function ThreeLayerTable({ scores }) {
|
|
|
5921
6412
|
borderRadius: 4,
|
|
5922
6413
|
padding: "8px 0 8px 4px"
|
|
5923
6414
|
},
|
|
5924
|
-
children: /* @__PURE__ */
|
|
6415
|
+
children: /* @__PURE__ */ jsx46(Text32, { size: 2, weight: "medium", children: score.feature })
|
|
6416
|
+
}
|
|
6417
|
+
),
|
|
6418
|
+
/* @__PURE__ */ jsx46(
|
|
6419
|
+
"div",
|
|
6420
|
+
{
|
|
6421
|
+
style: {
|
|
6422
|
+
background: rowBackground(i),
|
|
6423
|
+
display: "flex",
|
|
6424
|
+
padding: "2px 0"
|
|
6425
|
+
},
|
|
6426
|
+
children: /* @__PURE__ */ jsx46(ScoreCell, { score: score.floorScore ?? 0 })
|
|
5925
6427
|
}
|
|
5926
6428
|
),
|
|
5927
|
-
/* @__PURE__ */
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
6429
|
+
/* @__PURE__ */ jsx46(
|
|
6430
|
+
"div",
|
|
6431
|
+
{
|
|
6432
|
+
style: {
|
|
6433
|
+
background: rowBackground(i),
|
|
6434
|
+
display: "flex",
|
|
6435
|
+
padding: "2px 0"
|
|
6436
|
+
},
|
|
6437
|
+
children: /* @__PURE__ */ jsx46(ScoreCell, { score: score.ceilingScore ?? score.totalScore })
|
|
6438
|
+
}
|
|
6439
|
+
),
|
|
6440
|
+
/* @__PURE__ */ jsx46(
|
|
6441
|
+
"div",
|
|
6442
|
+
{
|
|
6443
|
+
style: {
|
|
6444
|
+
background: rowBackground(i),
|
|
6445
|
+
display: "flex",
|
|
6446
|
+
padding: "2px 0"
|
|
6447
|
+
},
|
|
6448
|
+
children: /* @__PURE__ */ jsx46(ScoreCell, { score: score.actualScore ?? 0 })
|
|
6449
|
+
}
|
|
6450
|
+
),
|
|
6451
|
+
/* @__PURE__ */ jsx46(
|
|
5931
6452
|
"div",
|
|
5932
6453
|
{
|
|
5933
6454
|
style: {
|
|
@@ -5936,10 +6457,10 @@ function ThreeLayerTable({ scores }) {
|
|
|
5936
6457
|
display: "flex",
|
|
5937
6458
|
padding: "6px 0"
|
|
5938
6459
|
},
|
|
5939
|
-
children: /* @__PURE__ */
|
|
6460
|
+
children: /* @__PURE__ */ jsx46(Text32, { size: 2, children: score.retrievalGap != null ? score.retrievalGap.toFixed(1) : "\u2014" })
|
|
5940
6461
|
}
|
|
5941
6462
|
),
|
|
5942
|
-
/* @__PURE__ */
|
|
6463
|
+
/* @__PURE__ */ jsx46(
|
|
5943
6464
|
"div",
|
|
5944
6465
|
{
|
|
5945
6466
|
style: {
|
|
@@ -5948,7 +6469,7 @@ function ThreeLayerTable({ scores }) {
|
|
|
5948
6469
|
display: "flex",
|
|
5949
6470
|
padding: "6px 0"
|
|
5950
6471
|
},
|
|
5951
|
-
children: /* @__PURE__ */
|
|
6472
|
+
children: /* @__PURE__ */ jsxs33(Text32, { size: 2, children: [
|
|
5952
6473
|
formatPercent(score.infrastructureEfficiency),
|
|
5953
6474
|
score.invertedRetrievalGap && " \u26A0\uFE0F"
|
|
5954
6475
|
] })
|
|
@@ -5958,12 +6479,12 @@ function ThreeLayerTable({ scores }) {
|
|
|
5958
6479
|
]
|
|
5959
6480
|
}
|
|
5960
6481
|
),
|
|
5961
|
-
hasInverted && /* @__PURE__ */
|
|
6482
|
+
hasInverted && /* @__PURE__ */ jsx46(Text32, { muted: true, size: 1, children: GLOSSARY.invertedRetGap })
|
|
5962
6483
|
] }) });
|
|
5963
6484
|
}
|
|
5964
6485
|
|
|
5965
6486
|
// src/components/report-detail/ReportDetail.tsx
|
|
5966
|
-
import { jsx as
|
|
6487
|
+
import { jsx as jsx47, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
5967
6488
|
var OVERVIEW_TAB = { id: "overview", label: "Overview" };
|
|
5968
6489
|
var DIAGNOSTICS_TAB = { id: "diagnostics", label: "Diagnostics" };
|
|
5969
6490
|
var ACTIVITY_TAB = { id: "activity", label: "Agent Activity" };
|
|
@@ -5977,9 +6498,9 @@ function ReportDetail({
|
|
|
5977
6498
|
onTabChange,
|
|
5978
6499
|
reportId
|
|
5979
6500
|
}) {
|
|
5980
|
-
const client =
|
|
5981
|
-
const [loading, setLoading] =
|
|
5982
|
-
const [report, setReport] =
|
|
6501
|
+
const client = useClient11({ apiVersion: API_VERSION });
|
|
6502
|
+
const [loading, setLoading] = useState14(true);
|
|
6503
|
+
const [report, setReport] = useState14(null);
|
|
5983
6504
|
useEffect8(() => {
|
|
5984
6505
|
let cancelled = false;
|
|
5985
6506
|
setLoading(true);
|
|
@@ -5995,11 +6516,6 @@ function ReportDetail({
|
|
|
5995
6516
|
cancelled = true;
|
|
5996
6517
|
};
|
|
5997
6518
|
}, [client, reportId]);
|
|
5998
|
-
const handleCopyReportId = useCallback13(() => {
|
|
5999
|
-
if (!report) return;
|
|
6000
|
-
navigator.clipboard.writeText(report.reportId).catch(() => {
|
|
6001
|
-
});
|
|
6002
|
-
}, [report]);
|
|
6003
6519
|
const { summary } = report ?? {};
|
|
6004
6520
|
const hasDiagnostics = Boolean(
|
|
6005
6521
|
summary?.recommendations && summary.recommendations.gaps.length > 0 || summary?.lowScoringJudgments && summary.lowScoringJudgments.length > 0
|
|
@@ -6022,19 +6538,19 @@ function ReportDetail({
|
|
|
6022
6538
|
if (disabledTabs.has(parsed)) return "overview";
|
|
6023
6539
|
return tabs.some((t) => t.id === parsed) ? parsed : "overview";
|
|
6024
6540
|
}, [activeTab, disabledTabs, tabs]);
|
|
6025
|
-
const handleTabClick =
|
|
6541
|
+
const handleTabClick = useCallback19(
|
|
6026
6542
|
(tabId) => {
|
|
6027
6543
|
onTabChange(tabId === "overview" ? null : tabId);
|
|
6028
6544
|
},
|
|
6029
6545
|
[onTabChange]
|
|
6030
6546
|
);
|
|
6031
6547
|
if (loading) {
|
|
6032
|
-
return /* @__PURE__ */
|
|
6548
|
+
return /* @__PURE__ */ jsx47(LoadingState, { message: "Loading report\u2026" });
|
|
6033
6549
|
}
|
|
6034
6550
|
if (!report || !summary) {
|
|
6035
|
-
return /* @__PURE__ */
|
|
6036
|
-
/* @__PURE__ */
|
|
6037
|
-
|
|
6551
|
+
return /* @__PURE__ */ jsx47(Box15, { padding: 5, children: /* @__PURE__ */ jsxs34(Stack24, { space: 4, children: [
|
|
6552
|
+
/* @__PURE__ */ jsx47(
|
|
6553
|
+
Button5,
|
|
6038
6554
|
{
|
|
6039
6555
|
icon: ArrowLeftIcon2,
|
|
6040
6556
|
mode: "bleed",
|
|
@@ -6042,29 +6558,31 @@ function ReportDetail({
|
|
|
6042
6558
|
text: "Back"
|
|
6043
6559
|
}
|
|
6044
6560
|
),
|
|
6045
|
-
/* @__PURE__ */
|
|
6561
|
+
/* @__PURE__ */ jsx47(Text33, { align: "center", muted: true, size: 3, children: "Report not found" })
|
|
6046
6562
|
] }) });
|
|
6047
6563
|
}
|
|
6048
6564
|
const { comparison, provenance } = report;
|
|
6049
6565
|
const totalTests = summary.scores.reduce((n, s) => n + s.testCount, 0);
|
|
6050
6566
|
const isFullMode = summary.evaluationMode === "full" || summary.scores.some((s) => s.actualScore != null);
|
|
6051
|
-
return /* @__PURE__ */
|
|
6052
|
-
/* @__PURE__ */
|
|
6567
|
+
return /* @__PURE__ */ jsx47(Box15, { padding: 4, children: /* @__PURE__ */ jsxs34(Stack24, { space: 5, children: [
|
|
6568
|
+
/* @__PURE__ */ jsx47(
|
|
6053
6569
|
ReportHeader,
|
|
6054
6570
|
{
|
|
6055
6571
|
completedAt: report.completedAt,
|
|
6572
|
+
documentId: report._id,
|
|
6056
6573
|
mode: provenance.mode,
|
|
6057
6574
|
onBack,
|
|
6058
|
-
|
|
6575
|
+
onDeleted: onBack,
|
|
6576
|
+
provenance,
|
|
6059
6577
|
reportId: report.reportId,
|
|
6060
6578
|
sourceName: provenance.source.name,
|
|
6061
6579
|
tag: report.tag
|
|
6062
6580
|
}
|
|
6063
6581
|
),
|
|
6064
|
-
/* @__PURE__ */
|
|
6582
|
+
/* @__PURE__ */ jsx47(TabList, { space: 1, children: tabs.map((tab) => {
|
|
6065
6583
|
const isDisabled = disabledTabs.has(tab.id);
|
|
6066
6584
|
const tooltip = getDisabledTabTooltip(tab.id, summary);
|
|
6067
|
-
const tabElement = /* @__PURE__ */
|
|
6585
|
+
const tabElement = /* @__PURE__ */ jsx47(
|
|
6068
6586
|
Tab,
|
|
6069
6587
|
{
|
|
6070
6588
|
"aria-controls": `panel-${tab.id}`,
|
|
@@ -6075,25 +6593,25 @@ function ReportDetail({
|
|
|
6075
6593
|
selected: currentTab === tab.id
|
|
6076
6594
|
}
|
|
6077
6595
|
);
|
|
6078
|
-
return isDisabled && tooltip ? /* @__PURE__ */
|
|
6079
|
-
|
|
6596
|
+
return isDisabled && tooltip ? /* @__PURE__ */ jsx47(
|
|
6597
|
+
Tooltip8,
|
|
6080
6598
|
{
|
|
6081
|
-
content: /* @__PURE__ */
|
|
6599
|
+
content: /* @__PURE__ */ jsx47(Box15, { padding: 2, style: { maxWidth: 280 }, children: tooltip }),
|
|
6082
6600
|
placement: "bottom",
|
|
6083
6601
|
portal: true,
|
|
6084
|
-
children: /* @__PURE__ */
|
|
6602
|
+
children: /* @__PURE__ */ jsx47("span", { style: { display: "inline-block" }, children: tabElement })
|
|
6085
6603
|
},
|
|
6086
6604
|
tab.id
|
|
6087
|
-
) : /* @__PURE__ */
|
|
6605
|
+
) : /* @__PURE__ */ jsx47("span", { children: tabElement }, tab.id);
|
|
6088
6606
|
}) }),
|
|
6089
|
-
currentTab === "overview" && /* @__PURE__ */
|
|
6607
|
+
currentTab === "overview" && /* @__PURE__ */ jsx47(
|
|
6090
6608
|
TabPanel,
|
|
6091
6609
|
{
|
|
6092
6610
|
"aria-labelledby": "tab-overview",
|
|
6093
6611
|
hidden: currentTab !== "overview",
|
|
6094
6612
|
id: "panel-overview",
|
|
6095
|
-
children: /* @__PURE__ */
|
|
6096
|
-
/* @__PURE__ */
|
|
6613
|
+
children: /* @__PURE__ */ jsxs34(Stack24, { space: 5, children: [
|
|
6614
|
+
/* @__PURE__ */ jsx47(
|
|
6097
6615
|
OverviewStats,
|
|
6098
6616
|
{
|
|
6099
6617
|
durationMs: report.durationMs,
|
|
@@ -6102,37 +6620,37 @@ function ReportDetail({
|
|
|
6102
6620
|
totalTests
|
|
6103
6621
|
}
|
|
6104
6622
|
),
|
|
6105
|
-
isFullMode && /* @__PURE__ */
|
|
6106
|
-
/* @__PURE__ */
|
|
6107
|
-
comparison && /* @__PURE__ */
|
|
6108
|
-
/* @__PURE__ */
|
|
6623
|
+
isFullMode && /* @__PURE__ */ jsx47(ThreeLayerTable, { scores: summary.scores }),
|
|
6624
|
+
/* @__PURE__ */ jsx47(AreaScoreTable, { scores: summary.scores }),
|
|
6625
|
+
comparison && /* @__PURE__ */ jsx47(ComparisonSummary, { comparison }),
|
|
6626
|
+
/* @__PURE__ */ jsx47(ProvenanceCard, { provenance })
|
|
6109
6627
|
] })
|
|
6110
6628
|
}
|
|
6111
6629
|
),
|
|
6112
|
-
currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */
|
|
6630
|
+
currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */ jsx47(
|
|
6113
6631
|
TabPanel,
|
|
6114
6632
|
{
|
|
6115
6633
|
"aria-labelledby": "tab-diagnostics",
|
|
6116
6634
|
hidden: currentTab !== "diagnostics",
|
|
6117
6635
|
id: "panel-diagnostics",
|
|
6118
|
-
children: /* @__PURE__ */
|
|
6119
|
-
summary.recommendations && summary.recommendations.gaps.length > 0 && /* @__PURE__ */
|
|
6636
|
+
children: /* @__PURE__ */ jsxs34(Stack24, { space: 5, children: [
|
|
6637
|
+
summary.recommendations && summary.recommendations.gaps.length > 0 && /* @__PURE__ */ jsx47(
|
|
6120
6638
|
RecommendationsSection,
|
|
6121
6639
|
{
|
|
6122
6640
|
recommendations: summary.recommendations
|
|
6123
6641
|
}
|
|
6124
6642
|
),
|
|
6125
|
-
summary.lowScoringJudgments && summary.lowScoringJudgments.length > 0 && /* @__PURE__ */
|
|
6643
|
+
summary.lowScoringJudgments && summary.lowScoringJudgments.length > 0 && /* @__PURE__ */ jsx47(JudgmentList, { judgments: summary.lowScoringJudgments })
|
|
6126
6644
|
] })
|
|
6127
6645
|
}
|
|
6128
6646
|
),
|
|
6129
|
-
currentTab === "activity" && hasAgentActivity && /* @__PURE__ */
|
|
6647
|
+
currentTab === "activity" && hasAgentActivity && /* @__PURE__ */ jsx47(
|
|
6130
6648
|
TabPanel,
|
|
6131
6649
|
{
|
|
6132
6650
|
"aria-labelledby": "tab-activity",
|
|
6133
6651
|
hidden: currentTab !== "activity",
|
|
6134
6652
|
id: "panel-activity",
|
|
6135
|
-
children: /* @__PURE__ */
|
|
6653
|
+
children: /* @__PURE__ */ jsx47(
|
|
6136
6654
|
AgentActivitySection,
|
|
6137
6655
|
{
|
|
6138
6656
|
agentBehavior: summary.agentBehavior,
|
|
@@ -6154,27 +6672,27 @@ function getDisabledTabTooltip(tabId, summary) {
|
|
|
6154
6672
|
if (!summary) return null;
|
|
6155
6673
|
switch (tabId) {
|
|
6156
6674
|
case "diagnostics":
|
|
6157
|
-
return /* @__PURE__ */
|
|
6675
|
+
return /* @__PURE__ */ jsx47(Text33, { muted: true, size: 2, children: "No diagnostic data available. Diagnostics require low-scoring judgments or gap analysis recommendations." });
|
|
6158
6676
|
case "activity":
|
|
6159
|
-
return summary.evaluationMode === "baseline" ? /* @__PURE__ */
|
|
6677
|
+
return summary.evaluationMode === "baseline" ? /* @__PURE__ */ jsxs34(Text33, { muted: true, size: 2, children: [
|
|
6160
6678
|
"Not available for baseline-only evaluations. Run with",
|
|
6161
6679
|
" ",
|
|
6162
|
-
/* @__PURE__ */
|
|
6680
|
+
/* @__PURE__ */ jsx47("code", { style: inlineCodeStyle, children: "--mode full" }),
|
|
6163
6681
|
" or",
|
|
6164
6682
|
" ",
|
|
6165
|
-
/* @__PURE__ */
|
|
6683
|
+
/* @__PURE__ */ jsx47("code", { style: inlineCodeStyle, children: "--mode agentic" }),
|
|
6166
6684
|
" to capture agent browsing behavior."
|
|
6167
|
-
] }) : /* @__PURE__ */
|
|
6685
|
+
] }) : /* @__PURE__ */ jsx47(Text33, { muted: true, size: 2, children: "No agent activity data was recorded for this evaluation." });
|
|
6168
6686
|
default:
|
|
6169
6687
|
return null;
|
|
6170
6688
|
}
|
|
6171
6689
|
}
|
|
6172
6690
|
|
|
6173
6691
|
// src/components/ScoreTimeline.tsx
|
|
6174
|
-
import { Card as Card23, Flex as
|
|
6175
|
-
import { useCallback as
|
|
6176
|
-
import { useClient as
|
|
6177
|
-
import { jsx as
|
|
6692
|
+
import { Card as Card23, Flex as Flex27, Select as Select2, Stack as Stack25, Text as Text34 } from "@sanity/ui";
|
|
6693
|
+
import { useCallback as useCallback20, useEffect as useEffect9, useMemo as useMemo8, useState as useState15 } from "react";
|
|
6694
|
+
import { useClient as useClient12 } from "sanity";
|
|
6695
|
+
import { jsx as jsx48, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
6178
6696
|
var CHART_HEIGHT = 220;
|
|
6179
6697
|
var CHART_WIDTH = 800;
|
|
6180
6698
|
var PAD_BOTTOM = 30;
|
|
@@ -6208,11 +6726,11 @@ function scoreForPoint(point, area) {
|
|
|
6208
6726
|
return match?.totalScore ?? null;
|
|
6209
6727
|
}
|
|
6210
6728
|
function ScoreTimeline({ mode = null, source = null }) {
|
|
6211
|
-
const client =
|
|
6212
|
-
const [dataPoints, setDataPoints] =
|
|
6213
|
-
const [loading, setLoading] =
|
|
6214
|
-
const [rangeDays, setRangeDays] =
|
|
6215
|
-
const [selectedArea, setSelectedArea] =
|
|
6729
|
+
const client = useClient12({ apiVersion: API_VERSION });
|
|
6730
|
+
const [dataPoints, setDataPoints] = useState15([]);
|
|
6731
|
+
const [loading, setLoading] = useState15(true);
|
|
6732
|
+
const [rangeDays, setRangeDays] = useState15(30);
|
|
6733
|
+
const [selectedArea, setSelectedArea] = useState15(null);
|
|
6216
6734
|
const areaNames = useMemo8(() => {
|
|
6217
6735
|
const names = /* @__PURE__ */ new Set();
|
|
6218
6736
|
for (const dp of dataPoints) {
|
|
@@ -6222,7 +6740,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6222
6740
|
}
|
|
6223
6741
|
return Array.from(names).sort();
|
|
6224
6742
|
}, [dataPoints]);
|
|
6225
|
-
const fetchData =
|
|
6743
|
+
const fetchData = useCallback20(async () => {
|
|
6226
6744
|
setLoading(true);
|
|
6227
6745
|
try {
|
|
6228
6746
|
const startDate = rangeDays ? daysAgo(rangeDays) : "1970-01-01T00:00:00Z";
|
|
@@ -6258,14 +6776,14 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6258
6776
|
if (chartPoints.length === 0) return 0;
|
|
6259
6777
|
return chartPoints.reduce((sum, p) => sum + p.score, 0) / chartPoints.length;
|
|
6260
6778
|
}, [chartPoints]);
|
|
6261
|
-
const handleRangeChange =
|
|
6779
|
+
const handleRangeChange = useCallback20(
|
|
6262
6780
|
(e) => {
|
|
6263
6781
|
const val = e.currentTarget.value;
|
|
6264
6782
|
setRangeDays(val === "all" ? null : Number(val));
|
|
6265
6783
|
},
|
|
6266
6784
|
[]
|
|
6267
6785
|
);
|
|
6268
|
-
const handleAreaChange =
|
|
6786
|
+
const handleAreaChange = useCallback20(
|
|
6269
6787
|
(e) => {
|
|
6270
6788
|
const val = e.currentTarget.value;
|
|
6271
6789
|
setSelectedArea(val || null);
|
|
@@ -6273,22 +6791,22 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6273
6791
|
[]
|
|
6274
6792
|
);
|
|
6275
6793
|
const polylinePoints = chartPoints.map((p) => `${p.x},${p.y}`).join(" ");
|
|
6276
|
-
return /* @__PURE__ */
|
|
6277
|
-
/* @__PURE__ */
|
|
6278
|
-
/* @__PURE__ */
|
|
6794
|
+
return /* @__PURE__ */ jsxs35(Stack25, { space: 4, children: [
|
|
6795
|
+
/* @__PURE__ */ jsxs35(Flex27, { gap: 3, children: [
|
|
6796
|
+
/* @__PURE__ */ jsx48(
|
|
6279
6797
|
Select2,
|
|
6280
6798
|
{
|
|
6281
6799
|
onChange: handleRangeChange,
|
|
6282
6800
|
value: rangeDays?.toString() ?? "all",
|
|
6283
|
-
children: TIME_RANGES.map((r) => /* @__PURE__ */
|
|
6801
|
+
children: TIME_RANGES.map((r) => /* @__PURE__ */ jsx48("option", { value: r.days?.toString() ?? "all", children: r.label }, r.label))
|
|
6284
6802
|
}
|
|
6285
6803
|
),
|
|
6286
|
-
/* @__PURE__ */
|
|
6287
|
-
/* @__PURE__ */
|
|
6288
|
-
areaNames.map((name) => /* @__PURE__ */
|
|
6804
|
+
/* @__PURE__ */ jsxs35(Select2, { onChange: handleAreaChange, value: selectedArea ?? "", children: [
|
|
6805
|
+
/* @__PURE__ */ jsx48("option", { value: "", children: "Overall" }),
|
|
6806
|
+
areaNames.map((name) => /* @__PURE__ */ jsx48("option", { value: name, children: name }, name))
|
|
6289
6807
|
] })
|
|
6290
6808
|
] }),
|
|
6291
|
-
/* @__PURE__ */
|
|
6809
|
+
/* @__PURE__ */ jsx48(Card23, { padding: 3, radius: 2, shadow: 1, children: loading ? /* @__PURE__ */ jsx48(Flex27, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx48(Text34, { muted: true, size: 2, children: "Loading\u2026" }) }) : chartPoints.length === 0 ? /* @__PURE__ */ jsx48(Flex27, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx48(Text34, { muted: true, size: 2, children: "No reports found for this time range" }) }) : /* @__PURE__ */ jsxs35(
|
|
6292
6810
|
"svg",
|
|
6293
6811
|
{
|
|
6294
6812
|
style: { display: "block", width: "100%" },
|
|
@@ -6296,8 +6814,8 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6296
6814
|
children: [
|
|
6297
6815
|
Y_TICKS.map((tick) => {
|
|
6298
6816
|
const y = PAD_TOP + PLOT_HEIGHT - tick / Y_MAX * PLOT_HEIGHT;
|
|
6299
|
-
return /* @__PURE__ */
|
|
6300
|
-
/* @__PURE__ */
|
|
6817
|
+
return /* @__PURE__ */ jsxs35("g", { children: [
|
|
6818
|
+
/* @__PURE__ */ jsx48(
|
|
6301
6819
|
"line",
|
|
6302
6820
|
{
|
|
6303
6821
|
stroke: "#ccc",
|
|
@@ -6308,7 +6826,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6308
6826
|
y2: y
|
|
6309
6827
|
}
|
|
6310
6828
|
),
|
|
6311
|
-
/* @__PURE__ */
|
|
6829
|
+
/* @__PURE__ */ jsx48(
|
|
6312
6830
|
"text",
|
|
6313
6831
|
{
|
|
6314
6832
|
dominantBaseline: "middle",
|
|
@@ -6328,7 +6846,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6328
6846
|
chartPoints.length - 1
|
|
6329
6847
|
].map((idx) => {
|
|
6330
6848
|
const p = chartPoints[idx];
|
|
6331
|
-
return /* @__PURE__ */
|
|
6849
|
+
return /* @__PURE__ */ jsx48(
|
|
6332
6850
|
"text",
|
|
6333
6851
|
{
|
|
6334
6852
|
fill: "#999",
|
|
@@ -6340,7 +6858,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6340
6858
|
},
|
|
6341
6859
|
idx
|
|
6342
6860
|
);
|
|
6343
|
-
}) : chartPoints.map((p, idx) => /* @__PURE__ */
|
|
6861
|
+
}) : chartPoints.map((p, idx) => /* @__PURE__ */ jsx48(
|
|
6344
6862
|
"text",
|
|
6345
6863
|
{
|
|
6346
6864
|
fill: "#999",
|
|
@@ -6352,7 +6870,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6352
6870
|
},
|
|
6353
6871
|
idx
|
|
6354
6872
|
)),
|
|
6355
|
-
/* @__PURE__ */
|
|
6873
|
+
/* @__PURE__ */ jsx48(
|
|
6356
6874
|
"polyline",
|
|
6357
6875
|
{
|
|
6358
6876
|
fill: "none",
|
|
@@ -6362,7 +6880,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6362
6880
|
strokeWidth: 2.5
|
|
6363
6881
|
}
|
|
6364
6882
|
),
|
|
6365
|
-
chartPoints.map((p, idx) => /* @__PURE__ */
|
|
6883
|
+
chartPoints.map((p, idx) => /* @__PURE__ */ jsx48(
|
|
6366
6884
|
"circle",
|
|
6367
6885
|
{
|
|
6368
6886
|
cx: p.x,
|
|
@@ -6371,7 +6889,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6371
6889
|
r: 4,
|
|
6372
6890
|
stroke: "#fff",
|
|
6373
6891
|
strokeWidth: 1.5,
|
|
6374
|
-
children: /* @__PURE__ */
|
|
6892
|
+
children: /* @__PURE__ */ jsxs35("title", { children: [
|
|
6375
6893
|
formatDate2(p.date),
|
|
6376
6894
|
": ",
|
|
6377
6895
|
Math.round(p.score)
|
|
@@ -6382,7 +6900,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6382
6900
|
]
|
|
6383
6901
|
}
|
|
6384
6902
|
) }),
|
|
6385
|
-
/* @__PURE__ */
|
|
6903
|
+
/* @__PURE__ */ jsxs35(Text34, { muted: true, size: 2, children: [
|
|
6386
6904
|
chartPoints.length,
|
|
6387
6905
|
" data point",
|
|
6388
6906
|
chartPoints.length !== 1 ? "s" : ""
|
|
@@ -6392,19 +6910,19 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6392
6910
|
var ScoreTimeline_default = ScoreTimeline;
|
|
6393
6911
|
|
|
6394
6912
|
// src/components/Dashboard.tsx
|
|
6395
|
-
import { jsx as
|
|
6913
|
+
import { jsx as jsx49, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
6396
6914
|
var VIEW_PARAM_MAP = {
|
|
6397
6915
|
compare: "compare",
|
|
6398
6916
|
timeline: "timeline"
|
|
6399
6917
|
};
|
|
6400
6918
|
function Dashboard() {
|
|
6401
|
-
const client =
|
|
6919
|
+
const client = useClient13({ apiVersion: API_VERSION });
|
|
6402
6920
|
const router = useRouter();
|
|
6403
6921
|
const routerState = router.state;
|
|
6404
6922
|
const reportId = routerState.reportId ?? null;
|
|
6405
6923
|
const isDetail = reportId !== null;
|
|
6406
6924
|
const activeTab = isDetail ? "latest" : VIEW_PARAM_MAP[routerState.view ?? ""] ?? "latest";
|
|
6407
|
-
const navigateToTab =
|
|
6925
|
+
const navigateToTab = useCallback21(
|
|
6408
6926
|
(tab) => {
|
|
6409
6927
|
if (tab === "latest") {
|
|
6410
6928
|
router.navigate({});
|
|
@@ -6414,13 +6932,13 @@ function Dashboard() {
|
|
|
6414
6932
|
},
|
|
6415
6933
|
[router]
|
|
6416
6934
|
);
|
|
6417
|
-
const handleSelectReport =
|
|
6935
|
+
const handleSelectReport = useCallback21(
|
|
6418
6936
|
(id) => {
|
|
6419
6937
|
router.navigate({ reportId: id });
|
|
6420
6938
|
},
|
|
6421
6939
|
[router]
|
|
6422
6940
|
);
|
|
6423
|
-
const handleTabChange =
|
|
6941
|
+
const handleTabChange = useCallback21(
|
|
6424
6942
|
(tab) => {
|
|
6425
6943
|
if (!routerState.reportId) return;
|
|
6426
6944
|
if (tab) {
|
|
@@ -6431,52 +6949,52 @@ function Dashboard() {
|
|
|
6431
6949
|
},
|
|
6432
6950
|
[router, routerState.reportId]
|
|
6433
6951
|
);
|
|
6434
|
-
const handleBack =
|
|
6952
|
+
const handleBack = useCallback21(() => {
|
|
6435
6953
|
router.navigate({});
|
|
6436
6954
|
}, [router]);
|
|
6437
|
-
const [source, setSource] =
|
|
6438
|
-
const [mode, setMode] =
|
|
6439
|
-
const [sources, setSources] =
|
|
6440
|
-
const [modes, setModes] =
|
|
6955
|
+
const [source, setSource] = useState16(null);
|
|
6956
|
+
const [mode, setMode] = useState16(null);
|
|
6957
|
+
const [sources, setSources] = useState16([]);
|
|
6958
|
+
const [modes, setModes] = useState16([]);
|
|
6441
6959
|
useEffect10(() => {
|
|
6442
6960
|
client.fetch(distinctSourcesQuery).then((data) => setSources(data ?? [])).catch(() => setSources([]));
|
|
6443
6961
|
client.fetch(distinctModesQuery).then((data) => setModes(data ?? [])).catch(() => setModes([]));
|
|
6444
6962
|
}, [client]);
|
|
6445
|
-
return /* @__PURE__ */
|
|
6446
|
-
/* @__PURE__ */
|
|
6447
|
-
/* @__PURE__ */
|
|
6448
|
-
/* @__PURE__ */
|
|
6449
|
-
/* @__PURE__ */
|
|
6963
|
+
return /* @__PURE__ */ jsx49(Container, { width: 2, children: /* @__PURE__ */ jsxs36(Stack26, { padding: 4, space: 4, children: [
|
|
6964
|
+
/* @__PURE__ */ jsxs36(Flex28, { align: "center", gap: 3, children: [
|
|
6965
|
+
/* @__PURE__ */ jsxs36(Stack26, { flex: 1, space: 1, children: [
|
|
6966
|
+
/* @__PURE__ */ jsx49(Text35, { size: 4, weight: "bold", children: "AI Literacy Framework" }),
|
|
6967
|
+
/* @__PURE__ */ jsx49(Text35, { muted: true, size: 2, children: "Evaluation reports and score trends" })
|
|
6450
6968
|
] }),
|
|
6451
|
-
!isDetail && /* @__PURE__ */
|
|
6452
|
-
/* @__PURE__ */
|
|
6969
|
+
!isDetail && /* @__PURE__ */ jsxs36(Flex28, { gap: 2, children: [
|
|
6970
|
+
/* @__PURE__ */ jsxs36(
|
|
6453
6971
|
Select3,
|
|
6454
6972
|
{
|
|
6455
6973
|
fontSize: 2,
|
|
6456
6974
|
onChange: (e) => setSource(e.currentTarget.value || null),
|
|
6457
6975
|
value: source ?? "",
|
|
6458
6976
|
children: [
|
|
6459
|
-
/* @__PURE__ */
|
|
6460
|
-
sources.map((s) => /* @__PURE__ */
|
|
6977
|
+
/* @__PURE__ */ jsx49("option", { value: "", children: "All sources" }),
|
|
6978
|
+
sources.map((s) => /* @__PURE__ */ jsx49("option", { value: s, children: s }, s))
|
|
6461
6979
|
]
|
|
6462
6980
|
}
|
|
6463
6981
|
),
|
|
6464
|
-
/* @__PURE__ */
|
|
6982
|
+
/* @__PURE__ */ jsxs36(
|
|
6465
6983
|
Select3,
|
|
6466
6984
|
{
|
|
6467
6985
|
fontSize: 2,
|
|
6468
6986
|
onChange: (e) => setMode(e.currentTarget.value || null),
|
|
6469
6987
|
value: mode ?? "",
|
|
6470
6988
|
children: [
|
|
6471
|
-
/* @__PURE__ */
|
|
6472
|
-
modes.map((m) => /* @__PURE__ */
|
|
6989
|
+
/* @__PURE__ */ jsx49("option", { value: "", children: "All modes" }),
|
|
6990
|
+
modes.map((m) => /* @__PURE__ */ jsx49("option", { value: m, children: m }, m))
|
|
6473
6991
|
]
|
|
6474
6992
|
}
|
|
6475
6993
|
)
|
|
6476
6994
|
] })
|
|
6477
6995
|
] }),
|
|
6478
|
-
!isDetail && /* @__PURE__ */
|
|
6479
|
-
/* @__PURE__ */
|
|
6996
|
+
!isDetail && /* @__PURE__ */ jsxs36(TabList2, { space: 1, children: [
|
|
6997
|
+
/* @__PURE__ */ jsx49(
|
|
6480
6998
|
Tab2,
|
|
6481
6999
|
{
|
|
6482
7000
|
"aria-controls": "latest-panel",
|
|
@@ -6486,7 +7004,7 @@ function Dashboard() {
|
|
|
6486
7004
|
selected: activeTab === "latest"
|
|
6487
7005
|
}
|
|
6488
7006
|
),
|
|
6489
|
-
/* @__PURE__ */
|
|
7007
|
+
/* @__PURE__ */ jsx49(
|
|
6490
7008
|
Tab2,
|
|
6491
7009
|
{
|
|
6492
7010
|
"aria-controls": "timeline-panel",
|
|
@@ -6496,7 +7014,7 @@ function Dashboard() {
|
|
|
6496
7014
|
selected: activeTab === "timeline"
|
|
6497
7015
|
}
|
|
6498
7016
|
),
|
|
6499
|
-
/* @__PURE__ */
|
|
7017
|
+
/* @__PURE__ */ jsx49(
|
|
6500
7018
|
Tab2,
|
|
6501
7019
|
{
|
|
6502
7020
|
"aria-controls": "compare-panel",
|
|
@@ -6507,7 +7025,7 @@ function Dashboard() {
|
|
|
6507
7025
|
}
|
|
6508
7026
|
)
|
|
6509
7027
|
] }),
|
|
6510
|
-
!isDetail && activeTab === "latest" && /* @__PURE__ */
|
|
7028
|
+
!isDetail && activeTab === "latest" && /* @__PURE__ */ jsx49(TabPanel2, { "aria-labelledby": "latest-tab", id: "latest-panel", children: /* @__PURE__ */ jsx49(
|
|
6511
7029
|
LatestReports,
|
|
6512
7030
|
{
|
|
6513
7031
|
mode,
|
|
@@ -6515,9 +7033,9 @@ function Dashboard() {
|
|
|
6515
7033
|
source
|
|
6516
7034
|
}
|
|
6517
7035
|
) }),
|
|
6518
|
-
!isDetail && activeTab === "timeline" && /* @__PURE__ */
|
|
6519
|
-
!isDetail && activeTab === "compare" && /* @__PURE__ */
|
|
6520
|
-
isDetail && reportId && /* @__PURE__ */
|
|
7036
|
+
!isDetail && activeTab === "timeline" && /* @__PURE__ */ jsx49(TabPanel2, { "aria-labelledby": "timeline-tab", id: "timeline-panel", children: /* @__PURE__ */ jsx49(ScoreTimeline_default, { mode, source }) }),
|
|
7037
|
+
!isDetail && activeTab === "compare" && /* @__PURE__ */ jsx49(TabPanel2, { "aria-labelledby": "compare-tab", id: "compare-panel", children: /* @__PURE__ */ jsx49(ComparisonView, {}) }),
|
|
7038
|
+
isDetail && reportId && /* @__PURE__ */ jsx49(
|
|
6521
7039
|
ReportDetail,
|
|
6522
7040
|
{
|
|
6523
7041
|
activeTab: routerState.tab ?? null,
|
|
@@ -6546,23 +7064,23 @@ function ailfTool(options = {}) {
|
|
|
6546
7064
|
|
|
6547
7065
|
// src/actions/RunEvaluationAction.tsx
|
|
6548
7066
|
import { BarChartIcon as BarChartIcon2 } from "@sanity/icons";
|
|
6549
|
-
import { useToast as
|
|
6550
|
-
import { useCallback as
|
|
7067
|
+
import { useToast as useToast8 } from "@sanity/ui";
|
|
7068
|
+
import { useCallback as useCallback22, useEffect as useEffect11, useRef as useRef5, useState as useState17 } from "react";
|
|
6551
7069
|
import {
|
|
6552
7070
|
getReleaseIdFromReleaseDocumentId as getReleaseIdFromReleaseDocumentId4,
|
|
6553
|
-
useClient as
|
|
6554
|
-
useCurrentUser as
|
|
7071
|
+
useClient as useClient14,
|
|
7072
|
+
useCurrentUser as useCurrentUser3,
|
|
6555
7073
|
useDataset as useDataset2,
|
|
6556
7074
|
useProjectId as useProjectId2
|
|
6557
7075
|
} from "sanity";
|
|
6558
7076
|
var API_VERSION2 = "2026-03-11";
|
|
6559
|
-
var
|
|
7077
|
+
var EVAL_REQUEST_TYPE3 = "ailf.evalRequest";
|
|
6560
7078
|
var POLL_INTERVAL_MS2 = 3e4;
|
|
6561
7079
|
var MAX_POLL_MS2 = 30 * 60 * 1e3;
|
|
6562
7080
|
var EVAL_REQUEST_STATUS_QUERY2 = (
|
|
6563
7081
|
/* groq */
|
|
6564
7082
|
`
|
|
6565
|
-
*[_type == "${
|
|
7083
|
+
*[_type == "${EVAL_REQUEST_TYPE3}" && _id == $id][0] {
|
|
6566
7084
|
status,
|
|
6567
7085
|
error,
|
|
6568
7086
|
reportId
|
|
@@ -6573,12 +7091,12 @@ function createRunEvaluationAction(options = {}) {
|
|
|
6573
7091
|
const { mode = "baseline" } = options;
|
|
6574
7092
|
const RunEvaluationAction = (props) => {
|
|
6575
7093
|
const { release } = props;
|
|
6576
|
-
const client =
|
|
7094
|
+
const client = useClient14({ apiVersion: API_VERSION2 });
|
|
6577
7095
|
const dataset = useDataset2();
|
|
6578
7096
|
const projectId = useProjectId2();
|
|
6579
|
-
const currentUser =
|
|
6580
|
-
const toast =
|
|
6581
|
-
const [state, setState] =
|
|
7097
|
+
const currentUser = useCurrentUser3();
|
|
7098
|
+
const toast = useToast8();
|
|
7099
|
+
const [state, setState] = useState17({ status: "loading" });
|
|
6582
7100
|
const requestedAtRef = useRef5(null);
|
|
6583
7101
|
const perspectiveId = getReleaseIdFromReleaseDocumentId4(release._id);
|
|
6584
7102
|
useEffect11(() => {
|
|
@@ -6674,13 +7192,13 @@ function createRunEvaluationAction(options = {}) {
|
|
|
6674
7192
|
}, 15e3);
|
|
6675
7193
|
return () => clearTimeout(timer);
|
|
6676
7194
|
}, [client, perspectiveId, state]);
|
|
6677
|
-
const handleRequest =
|
|
7195
|
+
const handleRequest = useCallback22(async () => {
|
|
6678
7196
|
const releaseTitle = release.metadata?.title ?? perspectiveId ?? "release";
|
|
6679
|
-
const tag = `release-${
|
|
7197
|
+
const tag = `release-${slugify3(releaseTitle)}-${dateStamp3()}`;
|
|
6680
7198
|
const now = Date.now();
|
|
6681
7199
|
try {
|
|
6682
7200
|
const doc = await client.create({
|
|
6683
|
-
_type:
|
|
7201
|
+
_type: EVAL_REQUEST_TYPE3,
|
|
6684
7202
|
dataset,
|
|
6685
7203
|
mode,
|
|
6686
7204
|
perspective: perspectiveId,
|
|
@@ -6774,10 +7292,10 @@ function buildReportQueryParams(perspectiveId) {
|
|
|
6774
7292
|
source: null
|
|
6775
7293
|
};
|
|
6776
7294
|
}
|
|
6777
|
-
function
|
|
7295
|
+
function slugify3(s) {
|
|
6778
7296
|
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
|
|
6779
7297
|
}
|
|
6780
|
-
function
|
|
7298
|
+
function dateStamp3() {
|
|
6781
7299
|
const d = /* @__PURE__ */ new Date();
|
|
6782
7300
|
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
6783
7301
|
}
|