@sanity/ailf-studio 0.1.15 → 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 +667 -233
- 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";
|
|
@@ -5824,23 +5824,507 @@ function RecommendationRow({
|
|
|
5824
5824
|
}
|
|
5825
5825
|
|
|
5826
5826
|
// src/components/report-detail/ReportHeader.tsx
|
|
5827
|
-
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";
|
|
5828
5832
|
import {
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
Text as Text30,
|
|
5836
|
-
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
|
|
5837
5839
|
} from "@sanity/ui";
|
|
5838
|
-
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";
|
|
5839
6321
|
function ReportHeader({
|
|
5840
6322
|
completedAt,
|
|
6323
|
+
documentId,
|
|
5841
6324
|
mode,
|
|
5842
6325
|
onBack,
|
|
5843
|
-
|
|
6326
|
+
onDeleted,
|
|
6327
|
+
provenance,
|
|
5844
6328
|
reportId,
|
|
5845
6329
|
sourceName,
|
|
5846
6330
|
tag
|
|
@@ -5848,89 +6332,42 @@ function ReportHeader({
|
|
|
5848
6332
|
const dateLabel = formatCardDate(completedAt);
|
|
5849
6333
|
const title = tag ?? dateLabel;
|
|
5850
6334
|
const hasTag = Boolean(tag);
|
|
5851
|
-
return /* @__PURE__ */
|
|
5852
|
-
/* @__PURE__ */
|
|
5853
|
-
|
|
5854
|
-
|
|
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,
|
|
5855
6346
|
{
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
6347
|
+
documentId,
|
|
6348
|
+
onDeleted,
|
|
6349
|
+
provenance,
|
|
6350
|
+
reportId
|
|
5860
6351
|
}
|
|
5861
|
-
)
|
|
5862
|
-
|
|
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
|
-
)
|
|
6352
|
+
)
|
|
6353
|
+
] })
|
|
5917
6354
|
] });
|
|
5918
6355
|
}
|
|
5919
6356
|
|
|
5920
6357
|
// src/components/report-detail/ThreeLayerTable.tsx
|
|
5921
6358
|
import React5 from "react";
|
|
5922
|
-
import { Badge as Badge21, Card as Card22, Flex as
|
|
5923
|
-
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";
|
|
5924
6361
|
function ThreeLayerTable({ scores }) {
|
|
5925
6362
|
const filtered = scores.filter((s) => s.actualScore != null);
|
|
5926
6363
|
if (filtered.length === 0) return null;
|
|
5927
6364
|
const hasInverted = filtered.some((s) => s.invertedRetrievalGap);
|
|
5928
|
-
return /* @__PURE__ */
|
|
5929
|
-
/* @__PURE__ */
|
|
5930
|
-
/* @__PURE__ */
|
|
5931
|
-
/* @__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" })
|
|
5932
6369
|
] }),
|
|
5933
|
-
/* @__PURE__ */
|
|
6370
|
+
/* @__PURE__ */ jsxs33(
|
|
5934
6371
|
"div",
|
|
5935
6372
|
{
|
|
5936
6373
|
style: {
|
|
@@ -5939,9 +6376,9 @@ function ThreeLayerTable({ scores }) {
|
|
|
5939
6376
|
gridTemplateColumns: "2fr 1fr 1fr 1fr 1fr 1fr"
|
|
5940
6377
|
},
|
|
5941
6378
|
children: [
|
|
5942
|
-
/* @__PURE__ */
|
|
5943
|
-
/* @__PURE__ */
|
|
5944
|
-
/* @__PURE__ */
|
|
6379
|
+
/* @__PURE__ */ jsx46(ColumnHeader, { borderBottom: true, label: "Area" }),
|
|
6380
|
+
/* @__PURE__ */ jsx46(ColumnHeader, { borderBottom: true, label: "Floor", tooltip: GLOSSARY.floor }),
|
|
6381
|
+
/* @__PURE__ */ jsx46(
|
|
5945
6382
|
ColumnHeader,
|
|
5946
6383
|
{
|
|
5947
6384
|
borderBottom: true,
|
|
@@ -5949,8 +6386,8 @@ function ThreeLayerTable({ scores }) {
|
|
|
5949
6386
|
tooltip: GLOSSARY.ceiling
|
|
5950
6387
|
}
|
|
5951
6388
|
),
|
|
5952
|
-
/* @__PURE__ */
|
|
5953
|
-
/* @__PURE__ */
|
|
6389
|
+
/* @__PURE__ */ jsx46(ColumnHeader, { borderBottom: true, label: "Actual", tooltip: GLOSSARY.actual }),
|
|
6390
|
+
/* @__PURE__ */ jsx46(
|
|
5954
6391
|
ColumnHeader,
|
|
5955
6392
|
{
|
|
5956
6393
|
borderBottom: true,
|
|
@@ -5958,7 +6395,7 @@ function ThreeLayerTable({ scores }) {
|
|
|
5958
6395
|
tooltip: GLOSSARY.retGap
|
|
5959
6396
|
}
|
|
5960
6397
|
),
|
|
5961
|
-
/* @__PURE__ */
|
|
6398
|
+
/* @__PURE__ */ jsx46(
|
|
5962
6399
|
ColumnHeader,
|
|
5963
6400
|
{
|
|
5964
6401
|
borderBottom: true,
|
|
@@ -5966,8 +6403,8 @@ function ThreeLayerTable({ scores }) {
|
|
|
5966
6403
|
tooltip: GLOSSARY.efficiency
|
|
5967
6404
|
}
|
|
5968
6405
|
),
|
|
5969
|
-
filtered.map((score, i) => /* @__PURE__ */
|
|
5970
|
-
/* @__PURE__ */
|
|
6406
|
+
filtered.map((score, i) => /* @__PURE__ */ jsxs33(React5.Fragment, { children: [
|
|
6407
|
+
/* @__PURE__ */ jsx46(
|
|
5971
6408
|
"div",
|
|
5972
6409
|
{
|
|
5973
6410
|
style: {
|
|
@@ -5975,10 +6412,10 @@ function ThreeLayerTable({ scores }) {
|
|
|
5975
6412
|
borderRadius: 4,
|
|
5976
6413
|
padding: "8px 0 8px 4px"
|
|
5977
6414
|
},
|
|
5978
|
-
children: /* @__PURE__ */
|
|
6415
|
+
children: /* @__PURE__ */ jsx46(Text32, { size: 2, weight: "medium", children: score.feature })
|
|
5979
6416
|
}
|
|
5980
6417
|
),
|
|
5981
|
-
/* @__PURE__ */
|
|
6418
|
+
/* @__PURE__ */ jsx46(
|
|
5982
6419
|
"div",
|
|
5983
6420
|
{
|
|
5984
6421
|
style: {
|
|
@@ -5986,10 +6423,10 @@ function ThreeLayerTable({ scores }) {
|
|
|
5986
6423
|
display: "flex",
|
|
5987
6424
|
padding: "2px 0"
|
|
5988
6425
|
},
|
|
5989
|
-
children: /* @__PURE__ */
|
|
6426
|
+
children: /* @__PURE__ */ jsx46(ScoreCell, { score: score.floorScore ?? 0 })
|
|
5990
6427
|
}
|
|
5991
6428
|
),
|
|
5992
|
-
/* @__PURE__ */
|
|
6429
|
+
/* @__PURE__ */ jsx46(
|
|
5993
6430
|
"div",
|
|
5994
6431
|
{
|
|
5995
6432
|
style: {
|
|
@@ -5997,10 +6434,10 @@ function ThreeLayerTable({ scores }) {
|
|
|
5997
6434
|
display: "flex",
|
|
5998
6435
|
padding: "2px 0"
|
|
5999
6436
|
},
|
|
6000
|
-
children: /* @__PURE__ */
|
|
6437
|
+
children: /* @__PURE__ */ jsx46(ScoreCell, { score: score.ceilingScore ?? score.totalScore })
|
|
6001
6438
|
}
|
|
6002
6439
|
),
|
|
6003
|
-
/* @__PURE__ */
|
|
6440
|
+
/* @__PURE__ */ jsx46(
|
|
6004
6441
|
"div",
|
|
6005
6442
|
{
|
|
6006
6443
|
style: {
|
|
@@ -6008,10 +6445,10 @@ function ThreeLayerTable({ scores }) {
|
|
|
6008
6445
|
display: "flex",
|
|
6009
6446
|
padding: "2px 0"
|
|
6010
6447
|
},
|
|
6011
|
-
children: /* @__PURE__ */
|
|
6448
|
+
children: /* @__PURE__ */ jsx46(ScoreCell, { score: score.actualScore ?? 0 })
|
|
6012
6449
|
}
|
|
6013
6450
|
),
|
|
6014
|
-
/* @__PURE__ */
|
|
6451
|
+
/* @__PURE__ */ jsx46(
|
|
6015
6452
|
"div",
|
|
6016
6453
|
{
|
|
6017
6454
|
style: {
|
|
@@ -6020,10 +6457,10 @@ function ThreeLayerTable({ scores }) {
|
|
|
6020
6457
|
display: "flex",
|
|
6021
6458
|
padding: "6px 0"
|
|
6022
6459
|
},
|
|
6023
|
-
children: /* @__PURE__ */
|
|
6460
|
+
children: /* @__PURE__ */ jsx46(Text32, { size: 2, children: score.retrievalGap != null ? score.retrievalGap.toFixed(1) : "\u2014" })
|
|
6024
6461
|
}
|
|
6025
6462
|
),
|
|
6026
|
-
/* @__PURE__ */
|
|
6463
|
+
/* @__PURE__ */ jsx46(
|
|
6027
6464
|
"div",
|
|
6028
6465
|
{
|
|
6029
6466
|
style: {
|
|
@@ -6032,7 +6469,7 @@ function ThreeLayerTable({ scores }) {
|
|
|
6032
6469
|
display: "flex",
|
|
6033
6470
|
padding: "6px 0"
|
|
6034
6471
|
},
|
|
6035
|
-
children: /* @__PURE__ */
|
|
6472
|
+
children: /* @__PURE__ */ jsxs33(Text32, { size: 2, children: [
|
|
6036
6473
|
formatPercent(score.infrastructureEfficiency),
|
|
6037
6474
|
score.invertedRetrievalGap && " \u26A0\uFE0F"
|
|
6038
6475
|
] })
|
|
@@ -6042,12 +6479,12 @@ function ThreeLayerTable({ scores }) {
|
|
|
6042
6479
|
]
|
|
6043
6480
|
}
|
|
6044
6481
|
),
|
|
6045
|
-
hasInverted && /* @__PURE__ */
|
|
6482
|
+
hasInverted && /* @__PURE__ */ jsx46(Text32, { muted: true, size: 1, children: GLOSSARY.invertedRetGap })
|
|
6046
6483
|
] }) });
|
|
6047
6484
|
}
|
|
6048
6485
|
|
|
6049
6486
|
// src/components/report-detail/ReportDetail.tsx
|
|
6050
|
-
import { jsx as
|
|
6487
|
+
import { jsx as jsx47, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
6051
6488
|
var OVERVIEW_TAB = { id: "overview", label: "Overview" };
|
|
6052
6489
|
var DIAGNOSTICS_TAB = { id: "diagnostics", label: "Diagnostics" };
|
|
6053
6490
|
var ACTIVITY_TAB = { id: "activity", label: "Agent Activity" };
|
|
@@ -6061,9 +6498,9 @@ function ReportDetail({
|
|
|
6061
6498
|
onTabChange,
|
|
6062
6499
|
reportId
|
|
6063
6500
|
}) {
|
|
6064
|
-
const client =
|
|
6065
|
-
const [loading, setLoading] =
|
|
6066
|
-
const [report, setReport] =
|
|
6501
|
+
const client = useClient11({ apiVersion: API_VERSION });
|
|
6502
|
+
const [loading, setLoading] = useState14(true);
|
|
6503
|
+
const [report, setReport] = useState14(null);
|
|
6067
6504
|
useEffect8(() => {
|
|
6068
6505
|
let cancelled = false;
|
|
6069
6506
|
setLoading(true);
|
|
@@ -6079,11 +6516,6 @@ function ReportDetail({
|
|
|
6079
6516
|
cancelled = true;
|
|
6080
6517
|
};
|
|
6081
6518
|
}, [client, reportId]);
|
|
6082
|
-
const handleCopyReportId = useCallback13(() => {
|
|
6083
|
-
if (!report) return;
|
|
6084
|
-
navigator.clipboard.writeText(report.reportId).catch(() => {
|
|
6085
|
-
});
|
|
6086
|
-
}, [report]);
|
|
6087
6519
|
const { summary } = report ?? {};
|
|
6088
6520
|
const hasDiagnostics = Boolean(
|
|
6089
6521
|
summary?.recommendations && summary.recommendations.gaps.length > 0 || summary?.lowScoringJudgments && summary.lowScoringJudgments.length > 0
|
|
@@ -6106,19 +6538,19 @@ function ReportDetail({
|
|
|
6106
6538
|
if (disabledTabs.has(parsed)) return "overview";
|
|
6107
6539
|
return tabs.some((t) => t.id === parsed) ? parsed : "overview";
|
|
6108
6540
|
}, [activeTab, disabledTabs, tabs]);
|
|
6109
|
-
const handleTabClick =
|
|
6541
|
+
const handleTabClick = useCallback19(
|
|
6110
6542
|
(tabId) => {
|
|
6111
6543
|
onTabChange(tabId === "overview" ? null : tabId);
|
|
6112
6544
|
},
|
|
6113
6545
|
[onTabChange]
|
|
6114
6546
|
);
|
|
6115
6547
|
if (loading) {
|
|
6116
|
-
return /* @__PURE__ */
|
|
6548
|
+
return /* @__PURE__ */ jsx47(LoadingState, { message: "Loading report\u2026" });
|
|
6117
6549
|
}
|
|
6118
6550
|
if (!report || !summary) {
|
|
6119
|
-
return /* @__PURE__ */
|
|
6120
|
-
/* @__PURE__ */
|
|
6121
|
-
|
|
6551
|
+
return /* @__PURE__ */ jsx47(Box15, { padding: 5, children: /* @__PURE__ */ jsxs34(Stack24, { space: 4, children: [
|
|
6552
|
+
/* @__PURE__ */ jsx47(
|
|
6553
|
+
Button5,
|
|
6122
6554
|
{
|
|
6123
6555
|
icon: ArrowLeftIcon2,
|
|
6124
6556
|
mode: "bleed",
|
|
@@ -6126,29 +6558,31 @@ function ReportDetail({
|
|
|
6126
6558
|
text: "Back"
|
|
6127
6559
|
}
|
|
6128
6560
|
),
|
|
6129
|
-
/* @__PURE__ */
|
|
6561
|
+
/* @__PURE__ */ jsx47(Text33, { align: "center", muted: true, size: 3, children: "Report not found" })
|
|
6130
6562
|
] }) });
|
|
6131
6563
|
}
|
|
6132
6564
|
const { comparison, provenance } = report;
|
|
6133
6565
|
const totalTests = summary.scores.reduce((n, s) => n + s.testCount, 0);
|
|
6134
6566
|
const isFullMode = summary.evaluationMode === "full" || summary.scores.some((s) => s.actualScore != null);
|
|
6135
|
-
return /* @__PURE__ */
|
|
6136
|
-
/* @__PURE__ */
|
|
6567
|
+
return /* @__PURE__ */ jsx47(Box15, { padding: 4, children: /* @__PURE__ */ jsxs34(Stack24, { space: 5, children: [
|
|
6568
|
+
/* @__PURE__ */ jsx47(
|
|
6137
6569
|
ReportHeader,
|
|
6138
6570
|
{
|
|
6139
6571
|
completedAt: report.completedAt,
|
|
6572
|
+
documentId: report._id,
|
|
6140
6573
|
mode: provenance.mode,
|
|
6141
6574
|
onBack,
|
|
6142
|
-
|
|
6575
|
+
onDeleted: onBack,
|
|
6576
|
+
provenance,
|
|
6143
6577
|
reportId: report.reportId,
|
|
6144
6578
|
sourceName: provenance.source.name,
|
|
6145
6579
|
tag: report.tag
|
|
6146
6580
|
}
|
|
6147
6581
|
),
|
|
6148
|
-
/* @__PURE__ */
|
|
6582
|
+
/* @__PURE__ */ jsx47(TabList, { space: 1, children: tabs.map((tab) => {
|
|
6149
6583
|
const isDisabled = disabledTabs.has(tab.id);
|
|
6150
6584
|
const tooltip = getDisabledTabTooltip(tab.id, summary);
|
|
6151
|
-
const tabElement = /* @__PURE__ */
|
|
6585
|
+
const tabElement = /* @__PURE__ */ jsx47(
|
|
6152
6586
|
Tab,
|
|
6153
6587
|
{
|
|
6154
6588
|
"aria-controls": `panel-${tab.id}`,
|
|
@@ -6159,25 +6593,25 @@ function ReportDetail({
|
|
|
6159
6593
|
selected: currentTab === tab.id
|
|
6160
6594
|
}
|
|
6161
6595
|
);
|
|
6162
|
-
return isDisabled && tooltip ? /* @__PURE__ */
|
|
6163
|
-
|
|
6596
|
+
return isDisabled && tooltip ? /* @__PURE__ */ jsx47(
|
|
6597
|
+
Tooltip8,
|
|
6164
6598
|
{
|
|
6165
|
-
content: /* @__PURE__ */
|
|
6599
|
+
content: /* @__PURE__ */ jsx47(Box15, { padding: 2, style: { maxWidth: 280 }, children: tooltip }),
|
|
6166
6600
|
placement: "bottom",
|
|
6167
6601
|
portal: true,
|
|
6168
|
-
children: /* @__PURE__ */
|
|
6602
|
+
children: /* @__PURE__ */ jsx47("span", { style: { display: "inline-block" }, children: tabElement })
|
|
6169
6603
|
},
|
|
6170
6604
|
tab.id
|
|
6171
|
-
) : /* @__PURE__ */
|
|
6605
|
+
) : /* @__PURE__ */ jsx47("span", { children: tabElement }, tab.id);
|
|
6172
6606
|
}) }),
|
|
6173
|
-
currentTab === "overview" && /* @__PURE__ */
|
|
6607
|
+
currentTab === "overview" && /* @__PURE__ */ jsx47(
|
|
6174
6608
|
TabPanel,
|
|
6175
6609
|
{
|
|
6176
6610
|
"aria-labelledby": "tab-overview",
|
|
6177
6611
|
hidden: currentTab !== "overview",
|
|
6178
6612
|
id: "panel-overview",
|
|
6179
|
-
children: /* @__PURE__ */
|
|
6180
|
-
/* @__PURE__ */
|
|
6613
|
+
children: /* @__PURE__ */ jsxs34(Stack24, { space: 5, children: [
|
|
6614
|
+
/* @__PURE__ */ jsx47(
|
|
6181
6615
|
OverviewStats,
|
|
6182
6616
|
{
|
|
6183
6617
|
durationMs: report.durationMs,
|
|
@@ -6186,37 +6620,37 @@ function ReportDetail({
|
|
|
6186
6620
|
totalTests
|
|
6187
6621
|
}
|
|
6188
6622
|
),
|
|
6189
|
-
isFullMode && /* @__PURE__ */
|
|
6190
|
-
/* @__PURE__ */
|
|
6191
|
-
comparison && /* @__PURE__ */
|
|
6192
|
-
/* @__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 })
|
|
6193
6627
|
] })
|
|
6194
6628
|
}
|
|
6195
6629
|
),
|
|
6196
|
-
currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */
|
|
6630
|
+
currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */ jsx47(
|
|
6197
6631
|
TabPanel,
|
|
6198
6632
|
{
|
|
6199
6633
|
"aria-labelledby": "tab-diagnostics",
|
|
6200
6634
|
hidden: currentTab !== "diagnostics",
|
|
6201
6635
|
id: "panel-diagnostics",
|
|
6202
|
-
children: /* @__PURE__ */
|
|
6203
|
-
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(
|
|
6204
6638
|
RecommendationsSection,
|
|
6205
6639
|
{
|
|
6206
6640
|
recommendations: summary.recommendations
|
|
6207
6641
|
}
|
|
6208
6642
|
),
|
|
6209
|
-
summary.lowScoringJudgments && summary.lowScoringJudgments.length > 0 && /* @__PURE__ */
|
|
6643
|
+
summary.lowScoringJudgments && summary.lowScoringJudgments.length > 0 && /* @__PURE__ */ jsx47(JudgmentList, { judgments: summary.lowScoringJudgments })
|
|
6210
6644
|
] })
|
|
6211
6645
|
}
|
|
6212
6646
|
),
|
|
6213
|
-
currentTab === "activity" && hasAgentActivity && /* @__PURE__ */
|
|
6647
|
+
currentTab === "activity" && hasAgentActivity && /* @__PURE__ */ jsx47(
|
|
6214
6648
|
TabPanel,
|
|
6215
6649
|
{
|
|
6216
6650
|
"aria-labelledby": "tab-activity",
|
|
6217
6651
|
hidden: currentTab !== "activity",
|
|
6218
6652
|
id: "panel-activity",
|
|
6219
|
-
children: /* @__PURE__ */
|
|
6653
|
+
children: /* @__PURE__ */ jsx47(
|
|
6220
6654
|
AgentActivitySection,
|
|
6221
6655
|
{
|
|
6222
6656
|
agentBehavior: summary.agentBehavior,
|
|
@@ -6238,27 +6672,27 @@ function getDisabledTabTooltip(tabId, summary) {
|
|
|
6238
6672
|
if (!summary) return null;
|
|
6239
6673
|
switch (tabId) {
|
|
6240
6674
|
case "diagnostics":
|
|
6241
|
-
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." });
|
|
6242
6676
|
case "activity":
|
|
6243
|
-
return summary.evaluationMode === "baseline" ? /* @__PURE__ */
|
|
6677
|
+
return summary.evaluationMode === "baseline" ? /* @__PURE__ */ jsxs34(Text33, { muted: true, size: 2, children: [
|
|
6244
6678
|
"Not available for baseline-only evaluations. Run with",
|
|
6245
6679
|
" ",
|
|
6246
|
-
/* @__PURE__ */
|
|
6680
|
+
/* @__PURE__ */ jsx47("code", { style: inlineCodeStyle, children: "--mode full" }),
|
|
6247
6681
|
" or",
|
|
6248
6682
|
" ",
|
|
6249
|
-
/* @__PURE__ */
|
|
6683
|
+
/* @__PURE__ */ jsx47("code", { style: inlineCodeStyle, children: "--mode agentic" }),
|
|
6250
6684
|
" to capture agent browsing behavior."
|
|
6251
|
-
] }) : /* @__PURE__ */
|
|
6685
|
+
] }) : /* @__PURE__ */ jsx47(Text33, { muted: true, size: 2, children: "No agent activity data was recorded for this evaluation." });
|
|
6252
6686
|
default:
|
|
6253
6687
|
return null;
|
|
6254
6688
|
}
|
|
6255
6689
|
}
|
|
6256
6690
|
|
|
6257
6691
|
// src/components/ScoreTimeline.tsx
|
|
6258
|
-
import { Card as Card23, Flex as
|
|
6259
|
-
import { useCallback as
|
|
6260
|
-
import { useClient as
|
|
6261
|
-
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";
|
|
6262
6696
|
var CHART_HEIGHT = 220;
|
|
6263
6697
|
var CHART_WIDTH = 800;
|
|
6264
6698
|
var PAD_BOTTOM = 30;
|
|
@@ -6292,11 +6726,11 @@ function scoreForPoint(point, area) {
|
|
|
6292
6726
|
return match?.totalScore ?? null;
|
|
6293
6727
|
}
|
|
6294
6728
|
function ScoreTimeline({ mode = null, source = null }) {
|
|
6295
|
-
const client =
|
|
6296
|
-
const [dataPoints, setDataPoints] =
|
|
6297
|
-
const [loading, setLoading] =
|
|
6298
|
-
const [rangeDays, setRangeDays] =
|
|
6299
|
-
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);
|
|
6300
6734
|
const areaNames = useMemo8(() => {
|
|
6301
6735
|
const names = /* @__PURE__ */ new Set();
|
|
6302
6736
|
for (const dp of dataPoints) {
|
|
@@ -6306,7 +6740,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6306
6740
|
}
|
|
6307
6741
|
return Array.from(names).sort();
|
|
6308
6742
|
}, [dataPoints]);
|
|
6309
|
-
const fetchData =
|
|
6743
|
+
const fetchData = useCallback20(async () => {
|
|
6310
6744
|
setLoading(true);
|
|
6311
6745
|
try {
|
|
6312
6746
|
const startDate = rangeDays ? daysAgo(rangeDays) : "1970-01-01T00:00:00Z";
|
|
@@ -6342,14 +6776,14 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6342
6776
|
if (chartPoints.length === 0) return 0;
|
|
6343
6777
|
return chartPoints.reduce((sum, p) => sum + p.score, 0) / chartPoints.length;
|
|
6344
6778
|
}, [chartPoints]);
|
|
6345
|
-
const handleRangeChange =
|
|
6779
|
+
const handleRangeChange = useCallback20(
|
|
6346
6780
|
(e) => {
|
|
6347
6781
|
const val = e.currentTarget.value;
|
|
6348
6782
|
setRangeDays(val === "all" ? null : Number(val));
|
|
6349
6783
|
},
|
|
6350
6784
|
[]
|
|
6351
6785
|
);
|
|
6352
|
-
const handleAreaChange =
|
|
6786
|
+
const handleAreaChange = useCallback20(
|
|
6353
6787
|
(e) => {
|
|
6354
6788
|
const val = e.currentTarget.value;
|
|
6355
6789
|
setSelectedArea(val || null);
|
|
@@ -6357,22 +6791,22 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6357
6791
|
[]
|
|
6358
6792
|
);
|
|
6359
6793
|
const polylinePoints = chartPoints.map((p) => `${p.x},${p.y}`).join(" ");
|
|
6360
|
-
return /* @__PURE__ */
|
|
6361
|
-
/* @__PURE__ */
|
|
6362
|
-
/* @__PURE__ */
|
|
6794
|
+
return /* @__PURE__ */ jsxs35(Stack25, { space: 4, children: [
|
|
6795
|
+
/* @__PURE__ */ jsxs35(Flex27, { gap: 3, children: [
|
|
6796
|
+
/* @__PURE__ */ jsx48(
|
|
6363
6797
|
Select2,
|
|
6364
6798
|
{
|
|
6365
6799
|
onChange: handleRangeChange,
|
|
6366
6800
|
value: rangeDays?.toString() ?? "all",
|
|
6367
|
-
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))
|
|
6368
6802
|
}
|
|
6369
6803
|
),
|
|
6370
|
-
/* @__PURE__ */
|
|
6371
|
-
/* @__PURE__ */
|
|
6372
|
-
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))
|
|
6373
6807
|
] })
|
|
6374
6808
|
] }),
|
|
6375
|
-
/* @__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(
|
|
6376
6810
|
"svg",
|
|
6377
6811
|
{
|
|
6378
6812
|
style: { display: "block", width: "100%" },
|
|
@@ -6380,8 +6814,8 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6380
6814
|
children: [
|
|
6381
6815
|
Y_TICKS.map((tick) => {
|
|
6382
6816
|
const y = PAD_TOP + PLOT_HEIGHT - tick / Y_MAX * PLOT_HEIGHT;
|
|
6383
|
-
return /* @__PURE__ */
|
|
6384
|
-
/* @__PURE__ */
|
|
6817
|
+
return /* @__PURE__ */ jsxs35("g", { children: [
|
|
6818
|
+
/* @__PURE__ */ jsx48(
|
|
6385
6819
|
"line",
|
|
6386
6820
|
{
|
|
6387
6821
|
stroke: "#ccc",
|
|
@@ -6392,7 +6826,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6392
6826
|
y2: y
|
|
6393
6827
|
}
|
|
6394
6828
|
),
|
|
6395
|
-
/* @__PURE__ */
|
|
6829
|
+
/* @__PURE__ */ jsx48(
|
|
6396
6830
|
"text",
|
|
6397
6831
|
{
|
|
6398
6832
|
dominantBaseline: "middle",
|
|
@@ -6412,7 +6846,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6412
6846
|
chartPoints.length - 1
|
|
6413
6847
|
].map((idx) => {
|
|
6414
6848
|
const p = chartPoints[idx];
|
|
6415
|
-
return /* @__PURE__ */
|
|
6849
|
+
return /* @__PURE__ */ jsx48(
|
|
6416
6850
|
"text",
|
|
6417
6851
|
{
|
|
6418
6852
|
fill: "#999",
|
|
@@ -6424,7 +6858,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6424
6858
|
},
|
|
6425
6859
|
idx
|
|
6426
6860
|
);
|
|
6427
|
-
}) : chartPoints.map((p, idx) => /* @__PURE__ */
|
|
6861
|
+
}) : chartPoints.map((p, idx) => /* @__PURE__ */ jsx48(
|
|
6428
6862
|
"text",
|
|
6429
6863
|
{
|
|
6430
6864
|
fill: "#999",
|
|
@@ -6436,7 +6870,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6436
6870
|
},
|
|
6437
6871
|
idx
|
|
6438
6872
|
)),
|
|
6439
|
-
/* @__PURE__ */
|
|
6873
|
+
/* @__PURE__ */ jsx48(
|
|
6440
6874
|
"polyline",
|
|
6441
6875
|
{
|
|
6442
6876
|
fill: "none",
|
|
@@ -6446,7 +6880,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6446
6880
|
strokeWidth: 2.5
|
|
6447
6881
|
}
|
|
6448
6882
|
),
|
|
6449
|
-
chartPoints.map((p, idx) => /* @__PURE__ */
|
|
6883
|
+
chartPoints.map((p, idx) => /* @__PURE__ */ jsx48(
|
|
6450
6884
|
"circle",
|
|
6451
6885
|
{
|
|
6452
6886
|
cx: p.x,
|
|
@@ -6455,7 +6889,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6455
6889
|
r: 4,
|
|
6456
6890
|
stroke: "#fff",
|
|
6457
6891
|
strokeWidth: 1.5,
|
|
6458
|
-
children: /* @__PURE__ */
|
|
6892
|
+
children: /* @__PURE__ */ jsxs35("title", { children: [
|
|
6459
6893
|
formatDate2(p.date),
|
|
6460
6894
|
": ",
|
|
6461
6895
|
Math.round(p.score)
|
|
@@ -6466,7 +6900,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6466
6900
|
]
|
|
6467
6901
|
}
|
|
6468
6902
|
) }),
|
|
6469
|
-
/* @__PURE__ */
|
|
6903
|
+
/* @__PURE__ */ jsxs35(Text34, { muted: true, size: 2, children: [
|
|
6470
6904
|
chartPoints.length,
|
|
6471
6905
|
" data point",
|
|
6472
6906
|
chartPoints.length !== 1 ? "s" : ""
|
|
@@ -6476,19 +6910,19 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6476
6910
|
var ScoreTimeline_default = ScoreTimeline;
|
|
6477
6911
|
|
|
6478
6912
|
// src/components/Dashboard.tsx
|
|
6479
|
-
import { jsx as
|
|
6913
|
+
import { jsx as jsx49, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
6480
6914
|
var VIEW_PARAM_MAP = {
|
|
6481
6915
|
compare: "compare",
|
|
6482
6916
|
timeline: "timeline"
|
|
6483
6917
|
};
|
|
6484
6918
|
function Dashboard() {
|
|
6485
|
-
const client =
|
|
6919
|
+
const client = useClient13({ apiVersion: API_VERSION });
|
|
6486
6920
|
const router = useRouter();
|
|
6487
6921
|
const routerState = router.state;
|
|
6488
6922
|
const reportId = routerState.reportId ?? null;
|
|
6489
6923
|
const isDetail = reportId !== null;
|
|
6490
6924
|
const activeTab = isDetail ? "latest" : VIEW_PARAM_MAP[routerState.view ?? ""] ?? "latest";
|
|
6491
|
-
const navigateToTab =
|
|
6925
|
+
const navigateToTab = useCallback21(
|
|
6492
6926
|
(tab) => {
|
|
6493
6927
|
if (tab === "latest") {
|
|
6494
6928
|
router.navigate({});
|
|
@@ -6498,13 +6932,13 @@ function Dashboard() {
|
|
|
6498
6932
|
},
|
|
6499
6933
|
[router]
|
|
6500
6934
|
);
|
|
6501
|
-
const handleSelectReport =
|
|
6935
|
+
const handleSelectReport = useCallback21(
|
|
6502
6936
|
(id) => {
|
|
6503
6937
|
router.navigate({ reportId: id });
|
|
6504
6938
|
},
|
|
6505
6939
|
[router]
|
|
6506
6940
|
);
|
|
6507
|
-
const handleTabChange =
|
|
6941
|
+
const handleTabChange = useCallback21(
|
|
6508
6942
|
(tab) => {
|
|
6509
6943
|
if (!routerState.reportId) return;
|
|
6510
6944
|
if (tab) {
|
|
@@ -6515,52 +6949,52 @@ function Dashboard() {
|
|
|
6515
6949
|
},
|
|
6516
6950
|
[router, routerState.reportId]
|
|
6517
6951
|
);
|
|
6518
|
-
const handleBack =
|
|
6952
|
+
const handleBack = useCallback21(() => {
|
|
6519
6953
|
router.navigate({});
|
|
6520
6954
|
}, [router]);
|
|
6521
|
-
const [source, setSource] =
|
|
6522
|
-
const [mode, setMode] =
|
|
6523
|
-
const [sources, setSources] =
|
|
6524
|
-
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([]);
|
|
6525
6959
|
useEffect10(() => {
|
|
6526
6960
|
client.fetch(distinctSourcesQuery).then((data) => setSources(data ?? [])).catch(() => setSources([]));
|
|
6527
6961
|
client.fetch(distinctModesQuery).then((data) => setModes(data ?? [])).catch(() => setModes([]));
|
|
6528
6962
|
}, [client]);
|
|
6529
|
-
return /* @__PURE__ */
|
|
6530
|
-
/* @__PURE__ */
|
|
6531
|
-
/* @__PURE__ */
|
|
6532
|
-
/* @__PURE__ */
|
|
6533
|
-
/* @__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" })
|
|
6534
6968
|
] }),
|
|
6535
|
-
!isDetail && /* @__PURE__ */
|
|
6536
|
-
/* @__PURE__ */
|
|
6969
|
+
!isDetail && /* @__PURE__ */ jsxs36(Flex28, { gap: 2, children: [
|
|
6970
|
+
/* @__PURE__ */ jsxs36(
|
|
6537
6971
|
Select3,
|
|
6538
6972
|
{
|
|
6539
6973
|
fontSize: 2,
|
|
6540
6974
|
onChange: (e) => setSource(e.currentTarget.value || null),
|
|
6541
6975
|
value: source ?? "",
|
|
6542
6976
|
children: [
|
|
6543
|
-
/* @__PURE__ */
|
|
6544
|
-
sources.map((s) => /* @__PURE__ */
|
|
6977
|
+
/* @__PURE__ */ jsx49("option", { value: "", children: "All sources" }),
|
|
6978
|
+
sources.map((s) => /* @__PURE__ */ jsx49("option", { value: s, children: s }, s))
|
|
6545
6979
|
]
|
|
6546
6980
|
}
|
|
6547
6981
|
),
|
|
6548
|
-
/* @__PURE__ */
|
|
6982
|
+
/* @__PURE__ */ jsxs36(
|
|
6549
6983
|
Select3,
|
|
6550
6984
|
{
|
|
6551
6985
|
fontSize: 2,
|
|
6552
6986
|
onChange: (e) => setMode(e.currentTarget.value || null),
|
|
6553
6987
|
value: mode ?? "",
|
|
6554
6988
|
children: [
|
|
6555
|
-
/* @__PURE__ */
|
|
6556
|
-
modes.map((m) => /* @__PURE__ */
|
|
6989
|
+
/* @__PURE__ */ jsx49("option", { value: "", children: "All modes" }),
|
|
6990
|
+
modes.map((m) => /* @__PURE__ */ jsx49("option", { value: m, children: m }, m))
|
|
6557
6991
|
]
|
|
6558
6992
|
}
|
|
6559
6993
|
)
|
|
6560
6994
|
] })
|
|
6561
6995
|
] }),
|
|
6562
|
-
!isDetail && /* @__PURE__ */
|
|
6563
|
-
/* @__PURE__ */
|
|
6996
|
+
!isDetail && /* @__PURE__ */ jsxs36(TabList2, { space: 1, children: [
|
|
6997
|
+
/* @__PURE__ */ jsx49(
|
|
6564
6998
|
Tab2,
|
|
6565
6999
|
{
|
|
6566
7000
|
"aria-controls": "latest-panel",
|
|
@@ -6570,7 +7004,7 @@ function Dashboard() {
|
|
|
6570
7004
|
selected: activeTab === "latest"
|
|
6571
7005
|
}
|
|
6572
7006
|
),
|
|
6573
|
-
/* @__PURE__ */
|
|
7007
|
+
/* @__PURE__ */ jsx49(
|
|
6574
7008
|
Tab2,
|
|
6575
7009
|
{
|
|
6576
7010
|
"aria-controls": "timeline-panel",
|
|
@@ -6580,7 +7014,7 @@ function Dashboard() {
|
|
|
6580
7014
|
selected: activeTab === "timeline"
|
|
6581
7015
|
}
|
|
6582
7016
|
),
|
|
6583
|
-
/* @__PURE__ */
|
|
7017
|
+
/* @__PURE__ */ jsx49(
|
|
6584
7018
|
Tab2,
|
|
6585
7019
|
{
|
|
6586
7020
|
"aria-controls": "compare-panel",
|
|
@@ -6591,7 +7025,7 @@ function Dashboard() {
|
|
|
6591
7025
|
}
|
|
6592
7026
|
)
|
|
6593
7027
|
] }),
|
|
6594
|
-
!isDetail && activeTab === "latest" && /* @__PURE__ */
|
|
7028
|
+
!isDetail && activeTab === "latest" && /* @__PURE__ */ jsx49(TabPanel2, { "aria-labelledby": "latest-tab", id: "latest-panel", children: /* @__PURE__ */ jsx49(
|
|
6595
7029
|
LatestReports,
|
|
6596
7030
|
{
|
|
6597
7031
|
mode,
|
|
@@ -6599,9 +7033,9 @@ function Dashboard() {
|
|
|
6599
7033
|
source
|
|
6600
7034
|
}
|
|
6601
7035
|
) }),
|
|
6602
|
-
!isDetail && activeTab === "timeline" && /* @__PURE__ */
|
|
6603
|
-
!isDetail && activeTab === "compare" && /* @__PURE__ */
|
|
6604
|
-
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(
|
|
6605
7039
|
ReportDetail,
|
|
6606
7040
|
{
|
|
6607
7041
|
activeTab: routerState.tab ?? null,
|
|
@@ -6630,23 +7064,23 @@ function ailfTool(options = {}) {
|
|
|
6630
7064
|
|
|
6631
7065
|
// src/actions/RunEvaluationAction.tsx
|
|
6632
7066
|
import { BarChartIcon as BarChartIcon2 } from "@sanity/icons";
|
|
6633
|
-
import { useToast as
|
|
6634
|
-
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";
|
|
6635
7069
|
import {
|
|
6636
7070
|
getReleaseIdFromReleaseDocumentId as getReleaseIdFromReleaseDocumentId4,
|
|
6637
|
-
useClient as
|
|
6638
|
-
useCurrentUser as
|
|
7071
|
+
useClient as useClient14,
|
|
7072
|
+
useCurrentUser as useCurrentUser3,
|
|
6639
7073
|
useDataset as useDataset2,
|
|
6640
7074
|
useProjectId as useProjectId2
|
|
6641
7075
|
} from "sanity";
|
|
6642
7076
|
var API_VERSION2 = "2026-03-11";
|
|
6643
|
-
var
|
|
7077
|
+
var EVAL_REQUEST_TYPE3 = "ailf.evalRequest";
|
|
6644
7078
|
var POLL_INTERVAL_MS2 = 3e4;
|
|
6645
7079
|
var MAX_POLL_MS2 = 30 * 60 * 1e3;
|
|
6646
7080
|
var EVAL_REQUEST_STATUS_QUERY2 = (
|
|
6647
7081
|
/* groq */
|
|
6648
7082
|
`
|
|
6649
|
-
*[_type == "${
|
|
7083
|
+
*[_type == "${EVAL_REQUEST_TYPE3}" && _id == $id][0] {
|
|
6650
7084
|
status,
|
|
6651
7085
|
error,
|
|
6652
7086
|
reportId
|
|
@@ -6657,12 +7091,12 @@ function createRunEvaluationAction(options = {}) {
|
|
|
6657
7091
|
const { mode = "baseline" } = options;
|
|
6658
7092
|
const RunEvaluationAction = (props) => {
|
|
6659
7093
|
const { release } = props;
|
|
6660
|
-
const client =
|
|
7094
|
+
const client = useClient14({ apiVersion: API_VERSION2 });
|
|
6661
7095
|
const dataset = useDataset2();
|
|
6662
7096
|
const projectId = useProjectId2();
|
|
6663
|
-
const currentUser =
|
|
6664
|
-
const toast =
|
|
6665
|
-
const [state, setState] =
|
|
7097
|
+
const currentUser = useCurrentUser3();
|
|
7098
|
+
const toast = useToast8();
|
|
7099
|
+
const [state, setState] = useState17({ status: "loading" });
|
|
6666
7100
|
const requestedAtRef = useRef5(null);
|
|
6667
7101
|
const perspectiveId = getReleaseIdFromReleaseDocumentId4(release._id);
|
|
6668
7102
|
useEffect11(() => {
|
|
@@ -6758,13 +7192,13 @@ function createRunEvaluationAction(options = {}) {
|
|
|
6758
7192
|
}, 15e3);
|
|
6759
7193
|
return () => clearTimeout(timer);
|
|
6760
7194
|
}, [client, perspectiveId, state]);
|
|
6761
|
-
const handleRequest =
|
|
7195
|
+
const handleRequest = useCallback22(async () => {
|
|
6762
7196
|
const releaseTitle = release.metadata?.title ?? perspectiveId ?? "release";
|
|
6763
|
-
const tag = `release-${
|
|
7197
|
+
const tag = `release-${slugify3(releaseTitle)}-${dateStamp3()}`;
|
|
6764
7198
|
const now = Date.now();
|
|
6765
7199
|
try {
|
|
6766
7200
|
const doc = await client.create({
|
|
6767
|
-
_type:
|
|
7201
|
+
_type: EVAL_REQUEST_TYPE3,
|
|
6768
7202
|
dataset,
|
|
6769
7203
|
mode,
|
|
6770
7204
|
perspective: perspectiveId,
|
|
@@ -6858,10 +7292,10 @@ function buildReportQueryParams(perspectiveId) {
|
|
|
6858
7292
|
source: null
|
|
6859
7293
|
};
|
|
6860
7294
|
}
|
|
6861
|
-
function
|
|
7295
|
+
function slugify3(s) {
|
|
6862
7296
|
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
|
|
6863
7297
|
}
|
|
6864
|
-
function
|
|
7298
|
+
function dateStamp3() {
|
|
6865
7299
|
const d = /* @__PURE__ */ new Date();
|
|
6866
7300
|
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
6867
7301
|
}
|