@sanity/ailf-studio 1.17.1 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/index.d.ts +1 -19
- package/dist/index.js +1635 -1173
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1595,87 +1595,6 @@ var reportSchema = defineType4({
|
|
|
1595
1595
|
title: "Document Manifest",
|
|
1596
1596
|
type: "array"
|
|
1597
1597
|
}),
|
|
1598
|
-
defineField4({
|
|
1599
|
-
description: "Prioritized remediation plan from gap analysis. Each gap identifies a failure mode, affected area, estimated score lift, and specific remediation action.",
|
|
1600
|
-
fields: [
|
|
1601
|
-
defineField4({
|
|
1602
|
-
name: "generatedAt",
|
|
1603
|
-
title: "Generated At",
|
|
1604
|
-
type: "string"
|
|
1605
|
-
}),
|
|
1606
|
-
defineField4({
|
|
1607
|
-
name: "totalPotentialLift",
|
|
1608
|
-
title: "Total Potential Lift",
|
|
1609
|
-
description: "Aggregate potential score lift if all identified gaps were fixed.",
|
|
1610
|
-
type: "number"
|
|
1611
|
-
}),
|
|
1612
|
-
defineField4({
|
|
1613
|
-
name: "gaps",
|
|
1614
|
-
of: [
|
|
1615
|
-
{
|
|
1616
|
-
fields: [
|
|
1617
|
-
defineField4({
|
|
1618
|
-
name: "area",
|
|
1619
|
-
title: "Area",
|
|
1620
|
-
type: "string"
|
|
1621
|
-
}),
|
|
1622
|
-
defineField4({
|
|
1623
|
-
name: "failureMode",
|
|
1624
|
-
description: "Per-dimension failure-mode tag \u2014 taxonomy lives in @sanity/ailf packages/eval/src/grader/ and is enumerated by the runtime grader prompt. The Studio dropdown is intentionally unconstrained so taxonomy edits don't require Studio schema PRs (Plan 03-02).",
|
|
1625
|
-
readOnly: true,
|
|
1626
|
-
title: "Failure Mode",
|
|
1627
|
-
type: "string"
|
|
1628
|
-
}),
|
|
1629
|
-
defineField4({
|
|
1630
|
-
name: "remediation",
|
|
1631
|
-
title: "Remediation",
|
|
1632
|
-
description: "Specific action to fix this gap.",
|
|
1633
|
-
type: "string"
|
|
1634
|
-
}),
|
|
1635
|
-
defineField4({
|
|
1636
|
-
name: "estimatedLift",
|
|
1637
|
-
title: "Estimated Lift",
|
|
1638
|
-
description: "Estimated composite score lift if this gap is fully closed.",
|
|
1639
|
-
type: "number"
|
|
1640
|
-
}),
|
|
1641
|
-
defineField4({
|
|
1642
|
-
name: "priority",
|
|
1643
|
-
title: "Priority",
|
|
1644
|
-
description: "Priority score (lift \xD7 affected task count).",
|
|
1645
|
-
type: "number"
|
|
1646
|
-
}),
|
|
1647
|
-
defineField4({
|
|
1648
|
-
name: "confidence",
|
|
1649
|
-
options: {
|
|
1650
|
-
list: ["high", "medium", "low"]
|
|
1651
|
-
},
|
|
1652
|
-
title: "Confidence",
|
|
1653
|
-
type: "string"
|
|
1654
|
-
}),
|
|
1655
|
-
defineField4({
|
|
1656
|
-
name: "bottleneckDimensions",
|
|
1657
|
-
of: [{ type: "string" }],
|
|
1658
|
-
title: "Bottleneck Dimensions",
|
|
1659
|
-
type: "array"
|
|
1660
|
-
}),
|
|
1661
|
-
defineField4({
|
|
1662
|
-
name: "affectedTaskIds",
|
|
1663
|
-
of: [{ type: "string" }],
|
|
1664
|
-
title: "Affected Task IDs",
|
|
1665
|
-
type: "array"
|
|
1666
|
-
})
|
|
1667
|
-
],
|
|
1668
|
-
type: "object"
|
|
1669
|
-
}
|
|
1670
|
-
],
|
|
1671
|
-
title: "Gaps",
|
|
1672
|
-
type: "array"
|
|
1673
|
-
})
|
|
1674
|
-
],
|
|
1675
|
-
name: "recommendations",
|
|
1676
|
-
title: "Recommendations",
|
|
1677
|
-
type: "object"
|
|
1678
|
-
}),
|
|
1679
1598
|
defineField4({
|
|
1680
1599
|
description: "Low-scoring grader judgments (normalized score < 70). The raw reasoning from the grading model explaining why specific tests scored poorly.",
|
|
1681
1600
|
name: "lowScoringJudgments",
|
|
@@ -3696,17 +3615,17 @@ import { route } from "sanity/router";
|
|
|
3696
3615
|
// src/components/Dashboard.tsx
|
|
3697
3616
|
import { HelpCircleIcon as HelpCircleIcon8 } from "@sanity/icons";
|
|
3698
3617
|
import {
|
|
3699
|
-
Box as
|
|
3700
|
-
Button as
|
|
3618
|
+
Box as Box39,
|
|
3619
|
+
Button as Button16,
|
|
3701
3620
|
Container,
|
|
3702
|
-
Flex as
|
|
3703
|
-
Stack as
|
|
3621
|
+
Flex as Flex41,
|
|
3622
|
+
Stack as Stack44,
|
|
3704
3623
|
Tab as Tab3,
|
|
3705
3624
|
TabList as TabList3,
|
|
3706
3625
|
TabPanel as TabPanel3,
|
|
3707
|
-
Text as
|
|
3626
|
+
Text as Text56
|
|
3708
3627
|
} from "@sanity/ui";
|
|
3709
|
-
import { useCallback as
|
|
3628
|
+
import { useCallback as useCallback44, useEffect as useEffect19 } from "react";
|
|
3710
3629
|
import { useRouter as useRouter5 } from "sanity/router";
|
|
3711
3630
|
|
|
3712
3631
|
// src/lib/help-context.ts
|
|
@@ -6946,21 +6865,21 @@ function LatestReports({
|
|
|
6946
6865
|
import { ArrowLeftIcon as ArrowLeftIcon3 } from "@sanity/icons";
|
|
6947
6866
|
import {
|
|
6948
6867
|
Badge as Badge10,
|
|
6949
|
-
Box as
|
|
6950
|
-
Button as
|
|
6951
|
-
Flex as
|
|
6952
|
-
Stack as
|
|
6868
|
+
Box as Box32,
|
|
6869
|
+
Button as Button12,
|
|
6870
|
+
Flex as Flex33,
|
|
6871
|
+
Stack as Stack35,
|
|
6953
6872
|
Tab,
|
|
6954
6873
|
TabList,
|
|
6955
6874
|
TabPanel,
|
|
6956
|
-
Text as
|
|
6875
|
+
Text as Text46,
|
|
6957
6876
|
Tooltip as Tooltip10
|
|
6958
6877
|
} from "@sanity/ui";
|
|
6959
6878
|
import {
|
|
6960
|
-
useCallback as
|
|
6961
|
-
useEffect as
|
|
6962
|
-
useMemo as
|
|
6963
|
-
useState as
|
|
6879
|
+
useCallback as useCallback38,
|
|
6880
|
+
useEffect as useEffect14,
|
|
6881
|
+
useMemo as useMemo17,
|
|
6882
|
+
useState as useState28
|
|
6964
6883
|
} from "react";
|
|
6965
6884
|
import { useClient as useClient12 } from "sanity";
|
|
6966
6885
|
|
|
@@ -6990,135 +6909,427 @@ function findManifestEntry(ref, key) {
|
|
|
6990
6909
|
return ref.entries.find((e) => e.key === key);
|
|
6991
6910
|
}
|
|
6992
6911
|
|
|
6993
|
-
// src/lib/use-
|
|
6994
|
-
import { useMemo as
|
|
6912
|
+
// src/lib/use-diagnosis-artifact.ts
|
|
6913
|
+
import { useEffect as useEffect9, useMemo as useMemo7 } from "react";
|
|
6995
6914
|
|
|
6996
|
-
// src/lib/
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
const task = taskId.slice(0, match.index).trim();
|
|
7003
|
-
return sanitizeEntryKey(`${mode}--${task}--${modelId}`);
|
|
6915
|
+
// src/lib/useArtifactDetail.ts
|
|
6916
|
+
import { useCallback as useCallback17, useEffect as useEffect8, useState as useState13 } from "react";
|
|
6917
|
+
|
|
6918
|
+
// src/lib/artifact-cache-store.ts
|
|
6919
|
+
function cacheKey({ runId, type, key }) {
|
|
6920
|
+
return `${runId}::${type}::${key}`;
|
|
7004
6921
|
}
|
|
7005
|
-
|
|
7006
|
-
|
|
6922
|
+
var hydratedEntries = /* @__PURE__ */ new Map();
|
|
6923
|
+
var inFlight = /* @__PURE__ */ new Map();
|
|
6924
|
+
var knownNotFound = /* @__PURE__ */ new Set();
|
|
6925
|
+
var subscribers = /* @__PURE__ */ new Map();
|
|
6926
|
+
function getCached(k) {
|
|
6927
|
+
const hit = hydratedEntries.get(cacheKey(k));
|
|
6928
|
+
return hit ?? null;
|
|
7007
6929
|
}
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
const { runId, artifactRef, type } = opts;
|
|
7013
|
-
const cacheRef = useRef5(/* @__PURE__ */ new Map());
|
|
7014
|
-
const [status, setStatus] = useState13("idle");
|
|
7015
|
-
const [error, setError] = useState13(null);
|
|
7016
|
-
const inFlight2 = useRef5(/* @__PURE__ */ new Set());
|
|
7017
|
-
const BULK_KEY = "__bulk__";
|
|
7018
|
-
const availableEntries = useMemo7(
|
|
7019
|
-
() => artifactRef?.entries?.map((e) => e.key) ?? [],
|
|
7020
|
-
[artifactRef]
|
|
7021
|
-
);
|
|
7022
|
-
const fetchEntry = useCallback17(
|
|
7023
|
-
async (key) => {
|
|
7024
|
-
if (!artifactRef || !runId) return;
|
|
7025
|
-
if (!artifactRef.layout || artifactRef.layout === "bulk") return;
|
|
7026
|
-
if (cacheRef.current.has(key) || inFlight2.current.has(key)) return;
|
|
7027
|
-
inFlight2.current.add(key);
|
|
7028
|
-
setStatus("loading");
|
|
7029
|
-
setError(null);
|
|
7030
|
-
try {
|
|
7031
|
-
const url = `${ARTIFACT_API_BASE_URL}/runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(type)}/${encodeURIComponent(key)}`;
|
|
7032
|
-
const entry = await signAndFetch(url);
|
|
7033
|
-
cacheRef.current.set(key, entry);
|
|
7034
|
-
setStatus("ready");
|
|
7035
|
-
} catch (err) {
|
|
7036
|
-
setError(err instanceof Error ? err.message : String(err));
|
|
7037
|
-
setStatus("error");
|
|
7038
|
-
} finally {
|
|
7039
|
-
inFlight2.current.delete(key);
|
|
7040
|
-
}
|
|
7041
|
-
},
|
|
7042
|
-
[runId, artifactRef, type]
|
|
7043
|
-
);
|
|
7044
|
-
const fetchAll = useCallback17(async () => {
|
|
7045
|
-
if (!artifactRef || !runId) return;
|
|
7046
|
-
if (inFlight2.current.has(BULK_KEY)) return;
|
|
7047
|
-
if (!artifactRef.layout || artifactRef.layout === "bulk") {
|
|
7048
|
-
if (cacheRef.current.size > 0) return;
|
|
7049
|
-
inFlight2.current.add(BULK_KEY);
|
|
7050
|
-
setStatus("loading");
|
|
7051
|
-
setError(null);
|
|
7052
|
-
try {
|
|
7053
|
-
const url = `${ARTIFACT_API_BASE_URL}/runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(type)}`;
|
|
7054
|
-
const body = await signAndFetch(url);
|
|
7055
|
-
const next = /* @__PURE__ */ new Map();
|
|
7056
|
-
for (const [key, entry] of Object.entries(body.entries)) {
|
|
7057
|
-
next.set(key, entry);
|
|
7058
|
-
}
|
|
7059
|
-
cacheRef.current = next;
|
|
7060
|
-
setStatus("ready");
|
|
7061
|
-
} catch (err) {
|
|
7062
|
-
setError(err instanceof Error ? err.message : String(err));
|
|
7063
|
-
setStatus("error");
|
|
7064
|
-
} finally {
|
|
7065
|
-
inFlight2.current.delete(BULK_KEY);
|
|
7066
|
-
}
|
|
7067
|
-
return;
|
|
7068
|
-
}
|
|
7069
|
-
const keys = artifactRef.entries?.map((e) => e.key) ?? [];
|
|
7070
|
-
await Promise.all(keys.map((k) => fetchEntry(k)));
|
|
7071
|
-
}, [runId, artifactRef, type, fetchEntry]);
|
|
7072
|
-
const getEntry = useCallback17(
|
|
7073
|
-
(key) => cacheRef.current.get(key) ?? null,
|
|
7074
|
-
[]
|
|
7075
|
-
);
|
|
7076
|
-
return useMemo7(
|
|
7077
|
-
() => ({
|
|
7078
|
-
status,
|
|
7079
|
-
error,
|
|
7080
|
-
availableEntries,
|
|
7081
|
-
getEntry,
|
|
7082
|
-
fetchEntry,
|
|
7083
|
-
fetchAll
|
|
7084
|
-
}),
|
|
7085
|
-
[status, error, availableEntries, getEntry, fetchEntry, fetchAll]
|
|
7086
|
-
);
|
|
6930
|
+
function setCached(k, value) {
|
|
6931
|
+
const composite = cacheKey(k);
|
|
6932
|
+
hydratedEntries.set(composite, value);
|
|
6933
|
+
notify(composite);
|
|
7087
6934
|
}
|
|
7088
|
-
|
|
7089
|
-
const
|
|
7090
|
-
|
|
7091
|
-
|
|
6935
|
+
function subscribe(k, fn) {
|
|
6936
|
+
const composite = cacheKey(k);
|
|
6937
|
+
let set2 = subscribers.get(composite);
|
|
6938
|
+
if (!set2) {
|
|
6939
|
+
set2 = /* @__PURE__ */ new Set();
|
|
6940
|
+
subscribers.set(composite, set2);
|
|
6941
|
+
}
|
|
6942
|
+
set2.add(fn);
|
|
6943
|
+
return () => {
|
|
6944
|
+
set2.delete(fn);
|
|
6945
|
+
if (set2.size === 0) subscribers.delete(composite);
|
|
6946
|
+
};
|
|
6947
|
+
}
|
|
6948
|
+
function recordInFlight(k, start) {
|
|
6949
|
+
const composite = cacheKey(k);
|
|
6950
|
+
const existing = inFlight.get(composite);
|
|
6951
|
+
if (existing) return existing;
|
|
6952
|
+
const p = start().finally(() => {
|
|
6953
|
+
inFlight.delete(composite);
|
|
7092
6954
|
});
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
6955
|
+
inFlight.set(composite, p);
|
|
6956
|
+
return p;
|
|
6957
|
+
}
|
|
6958
|
+
function markNotFound(k) {
|
|
6959
|
+
knownNotFound.add(cacheKey(k));
|
|
6960
|
+
}
|
|
6961
|
+
function isKnownNotFound(k) {
|
|
6962
|
+
return knownNotFound.has(cacheKey(k));
|
|
6963
|
+
}
|
|
6964
|
+
function notify(composite) {
|
|
6965
|
+
const set2 = subscribers.get(composite);
|
|
6966
|
+
if (!set2) return;
|
|
6967
|
+
for (const fn of set2) fn();
|
|
6968
|
+
}
|
|
6969
|
+
|
|
6970
|
+
// src/lib/artifact-fetch.ts
|
|
6971
|
+
var ArtifactHttpError = class extends Error {
|
|
6972
|
+
status;
|
|
6973
|
+
constructor(message, status) {
|
|
6974
|
+
super(message);
|
|
6975
|
+
this.name = "ArtifactHttpError";
|
|
6976
|
+
this.status = status;
|
|
6977
|
+
}
|
|
6978
|
+
};
|
|
6979
|
+
function buildSigningUrl(runId, type, entryKey) {
|
|
6980
|
+
const base = `${ARTIFACT_API_BASE_URL}/runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(type)}`;
|
|
6981
|
+
return entryKey === void 0 ? base : `${base}/${encodeURIComponent(entryKey)}`;
|
|
6982
|
+
}
|
|
6983
|
+
async function signAndFetchJson(signingUrl) {
|
|
6984
|
+
const signed = await exchangeSigningUrl(signingUrl);
|
|
6985
|
+
const res = await fetch(signed, { credentials: "omit" });
|
|
6986
|
+
if (!res.ok) {
|
|
6987
|
+
throw new ArtifactHttpError(
|
|
6988
|
+
`GCS artifact fetch failed: ${res.status} ${res.statusText}`,
|
|
6989
|
+
res.status
|
|
7097
6990
|
);
|
|
7098
6991
|
}
|
|
7099
|
-
|
|
7100
|
-
|
|
6992
|
+
return await res.json();
|
|
6993
|
+
}
|
|
6994
|
+
async function signAndFetchNdjson(signingUrl) {
|
|
6995
|
+
const signed = await exchangeSigningUrl(signingUrl);
|
|
6996
|
+
const res = await fetch(signed, { credentials: "omit" });
|
|
6997
|
+
if (!res.ok) {
|
|
6998
|
+
throw new ArtifactHttpError(
|
|
6999
|
+
`GCS artifact fetch failed: ${res.status} ${res.statusText}`,
|
|
7000
|
+
res.status
|
|
7001
|
+
);
|
|
7002
|
+
}
|
|
7003
|
+
const body = await res.text();
|
|
7004
|
+
const rows = [];
|
|
7005
|
+
for (const line of body.split("\n")) {
|
|
7006
|
+
const trimmed = line.trim();
|
|
7007
|
+
if (trimmed.length === 0) continue;
|
|
7008
|
+
try {
|
|
7009
|
+
rows.push(JSON.parse(trimmed));
|
|
7010
|
+
} catch (err) {
|
|
7011
|
+
console.warn(
|
|
7012
|
+
`NDJSON parse skipped a malformed row: ${err instanceof Error ? err.message : String(err)}`
|
|
7013
|
+
);
|
|
7014
|
+
}
|
|
7015
|
+
}
|
|
7016
|
+
return rows;
|
|
7017
|
+
}
|
|
7018
|
+
async function fetchBatchReadUrls(runId, type, keys) {
|
|
7019
|
+
const res = await fetch(
|
|
7020
|
+
`${ARTIFACT_API_BASE_URL}/runs/${encodeURIComponent(runId)}/artifacts/batch/read-urls`,
|
|
7021
|
+
{
|
|
7022
|
+
method: "POST",
|
|
7023
|
+
credentials: "omit",
|
|
7024
|
+
headers: { "Content-Type": "application/json" },
|
|
7025
|
+
body: JSON.stringify({ types: [type], keys: { [type]: keys } })
|
|
7026
|
+
}
|
|
7027
|
+
);
|
|
7028
|
+
if (!res.ok) {
|
|
7029
|
+
const body = await res.text().catch(() => "");
|
|
7101
7030
|
throw new Error(
|
|
7102
|
-
|
|
7031
|
+
`Batch signing failed: ${res.status} ${res.statusText}${body ? ` \u2014 ${body.slice(0, 200)}` : ""}`
|
|
7103
7032
|
);
|
|
7104
7033
|
}
|
|
7105
|
-
const
|
|
7106
|
-
if (!
|
|
7034
|
+
const envelope = await res.json();
|
|
7035
|
+
if (envelope.object === "error" || !envelope.urls) {
|
|
7107
7036
|
throw new Error(
|
|
7108
|
-
|
|
7037
|
+
envelope.error?.message ?? "Invalid batch signing response \u2014 missing urls"
|
|
7109
7038
|
);
|
|
7110
7039
|
}
|
|
7111
|
-
|
|
7112
|
-
}
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7040
|
+
const entries = envelope.urls[type];
|
|
7041
|
+
if (!entries) return {};
|
|
7042
|
+
const out = {};
|
|
7043
|
+
for (const [key, entry] of Object.entries(entries)) {
|
|
7044
|
+
out[key] = entry.url;
|
|
7045
|
+
}
|
|
7046
|
+
return out;
|
|
7047
|
+
}
|
|
7048
|
+
async function exchangeSigningUrl(signingUrl) {
|
|
7049
|
+
const res = await fetch(signingUrl, {
|
|
7050
|
+
credentials: "omit",
|
|
7051
|
+
headers: { Accept: "application/json" }
|
|
7052
|
+
});
|
|
7053
|
+
if (!res.ok) {
|
|
7054
|
+
const body = await res.text().catch(() => "");
|
|
7055
|
+
throw new ArtifactHttpError(
|
|
7056
|
+
`Artifact signing failed: ${res.status} ${res.statusText}${body ? ` \u2014 ${body.slice(0, 200)}` : ""}`,
|
|
7057
|
+
res.status
|
|
7058
|
+
);
|
|
7059
|
+
}
|
|
7060
|
+
const envelope = await res.json();
|
|
7061
|
+
if (envelope.object === "error" || !envelope.url) {
|
|
7062
|
+
throw new Error(
|
|
7063
|
+
envelope.error?.message ?? "Invalid signing response \u2014 missing signed URL"
|
|
7064
|
+
);
|
|
7065
|
+
}
|
|
7066
|
+
return envelope.url;
|
|
7067
|
+
}
|
|
7068
|
+
|
|
7069
|
+
// src/lib/useArtifactDetail.ts
|
|
7070
|
+
var NDJSON_TYPES = /* @__PURE__ */ new Set([
|
|
7071
|
+
"traces"
|
|
7072
|
+
]);
|
|
7073
|
+
function useArtifactDetail(type, key) {
|
|
7074
|
+
const { runId } = useReportArtifactContext();
|
|
7075
|
+
const ref = useArtifactRef(type);
|
|
7076
|
+
const cacheKey2 = key ?? "";
|
|
7077
|
+
const [status, setStatus] = useState13(
|
|
7078
|
+
() => runId && getCached({ runId, type, key: cacheKey2 }) !== null ? "ready" : "idle"
|
|
7079
|
+
);
|
|
7080
|
+
const [, setTick] = useState13(0);
|
|
7081
|
+
useEffect8(() => {
|
|
7082
|
+
if (!runId) return void 0;
|
|
7083
|
+
return subscribe({ runId, type, key: cacheKey2 }, () => {
|
|
7084
|
+
setStatus("ready");
|
|
7085
|
+
setTick((n) => n + 1);
|
|
7086
|
+
});
|
|
7087
|
+
}, [runId, type, cacheKey2]);
|
|
7088
|
+
const request = useCallback17(async () => {
|
|
7089
|
+
if (!runId || !ref) return;
|
|
7090
|
+
if (ref.layout === "per-entry" && !key) return;
|
|
7091
|
+
const cacheId = { runId, type, key: cacheKey2 };
|
|
7092
|
+
if (isKnownNotFound(cacheId)) {
|
|
7093
|
+
setStatus("error");
|
|
7094
|
+
return;
|
|
7095
|
+
}
|
|
7096
|
+
const hit = getCached(cacheId);
|
|
7097
|
+
if (hit !== null) {
|
|
7098
|
+
setStatus("ready");
|
|
7099
|
+
return;
|
|
7100
|
+
}
|
|
7101
|
+
setStatus("loading");
|
|
7102
|
+
try {
|
|
7103
|
+
await recordInFlight(cacheId, async () => {
|
|
7104
|
+
const url = key ? buildSigningUrl(runId, type, key) : buildSigningUrl(runId, type);
|
|
7105
|
+
const body = NDJSON_TYPES.has(type) ? await signAndFetchNdjson(url) : await signAndFetchJson(url);
|
|
7106
|
+
setCached(cacheId, body);
|
|
7107
|
+
return body;
|
|
7108
|
+
});
|
|
7109
|
+
setStatus("ready");
|
|
7110
|
+
} catch (err) {
|
|
7111
|
+
if (err instanceof ArtifactHttpError && err.status === 404) {
|
|
7112
|
+
markNotFound(cacheId);
|
|
7113
|
+
}
|
|
7114
|
+
setStatus("error");
|
|
7115
|
+
}
|
|
7116
|
+
}, [runId, ref, type, key, cacheKey2]);
|
|
7117
|
+
const full = runId ? getCached({ runId, type, key: cacheKey2 }) : null;
|
|
7118
|
+
return [full, status, request];
|
|
7119
|
+
}
|
|
7120
|
+
|
|
7121
|
+
// src/lib/useArtifactEntry.ts
|
|
7122
|
+
function useArtifactEntry(type, key) {
|
|
7123
|
+
const ref = useArtifactRef(type);
|
|
7124
|
+
const entry = findManifestEntry(ref, key);
|
|
7125
|
+
if (!entry) {
|
|
7126
|
+
return {
|
|
7127
|
+
preview: void 0,
|
|
7128
|
+
association: void 0,
|
|
7129
|
+
bytes: void 0,
|
|
7130
|
+
truncated: false,
|
|
7131
|
+
present: false
|
|
7132
|
+
};
|
|
7133
|
+
}
|
|
7134
|
+
return {
|
|
7135
|
+
preview: entry.preview,
|
|
7136
|
+
association: entry.association,
|
|
7137
|
+
bytes: entry.bytes,
|
|
7138
|
+
truncated: entry.truncated ?? false,
|
|
7139
|
+
present: true
|
|
7140
|
+
};
|
|
7141
|
+
}
|
|
7142
|
+
|
|
7143
|
+
// src/lib/use-diagnosis-artifact.ts
|
|
7144
|
+
var EMPTY_NOT_YET_GENERATED = Object.freeze({
|
|
7145
|
+
availability: "not-yet-generated",
|
|
7146
|
+
cards: [],
|
|
7147
|
+
error: null,
|
|
7148
|
+
status: "idle"
|
|
7149
|
+
});
|
|
7150
|
+
function useDiagnosisArtifact(runId, reportId, artifactRef) {
|
|
7151
|
+
const refFromContext = useArtifactRef("diagnosis");
|
|
7152
|
+
const present = Boolean(artifactRef ?? refFromContext);
|
|
7153
|
+
const entryKey = useMemo7(
|
|
7154
|
+
() => `${runId ?? ""}|${reportId ?? ""}`,
|
|
7155
|
+
[runId, reportId]
|
|
7156
|
+
);
|
|
7157
|
+
useArtifactEntry("diagnosis", entryKey);
|
|
7158
|
+
const [full, status, request] = useArtifactDetail("diagnosis", "");
|
|
7159
|
+
const { runId: contextRunId } = useReportArtifactContext();
|
|
7160
|
+
useEffect9(() => {
|
|
7161
|
+
if (!present) return;
|
|
7162
|
+
if (!contextRunId) return;
|
|
7163
|
+
void request();
|
|
7164
|
+
}, [present, contextRunId, request]);
|
|
7165
|
+
return useMemo7(() => {
|
|
7166
|
+
if (!present || !runId || !reportId) {
|
|
7167
|
+
return EMPTY_NOT_YET_GENERATED;
|
|
7168
|
+
}
|
|
7169
|
+
if (status === "error") {
|
|
7170
|
+
return {
|
|
7171
|
+
availability: "missing",
|
|
7172
|
+
cards: [],
|
|
7173
|
+
error: "Diagnosis bulk fetch failed",
|
|
7174
|
+
status: "error"
|
|
7175
|
+
};
|
|
7176
|
+
}
|
|
7177
|
+
if (status !== "ready" || !full) {
|
|
7178
|
+
return {
|
|
7179
|
+
availability: "missing",
|
|
7180
|
+
cards: [],
|
|
7181
|
+
error: null,
|
|
7182
|
+
status
|
|
7183
|
+
};
|
|
7184
|
+
}
|
|
7185
|
+
const cards = full.cards;
|
|
7186
|
+
const availability = classify2(cards);
|
|
7187
|
+
return {
|
|
7188
|
+
availability,
|
|
7189
|
+
cards,
|
|
7190
|
+
error: null,
|
|
7191
|
+
status: "ready"
|
|
7192
|
+
};
|
|
7193
|
+
}, [present, runId, reportId, status, full]);
|
|
7194
|
+
}
|
|
7195
|
+
function classify2(cards) {
|
|
7196
|
+
if (cards.length === 0) return "missing";
|
|
7197
|
+
const hasReady = cards.some((c) => c.status === "ready");
|
|
7198
|
+
if (hasReady) return "ready";
|
|
7199
|
+
const hasDegraded = cards.some((c) => c.status === "degraded");
|
|
7200
|
+
if (hasDegraded) return "degraded";
|
|
7201
|
+
return "missing";
|
|
7202
|
+
}
|
|
7203
|
+
|
|
7204
|
+
// src/lib/use-test-outputs-artifact.ts
|
|
7205
|
+
import { useMemo as useMemo9 } from "react";
|
|
7206
|
+
|
|
7207
|
+
// src/lib/test-outputs-entry-key.ts
|
|
7208
|
+
var VARIANT_SUFFIX_PATTERN = /\s*\((gold|baseline)\)\s*$/i;
|
|
7209
|
+
function testOutputsEntryKey(taskId, modelId) {
|
|
7210
|
+
const match = VARIANT_SUFFIX_PATTERN.exec(taskId);
|
|
7211
|
+
if (!match) return null;
|
|
7212
|
+
const mode = match[1].toLowerCase();
|
|
7213
|
+
const task = taskId.slice(0, match.index).trim();
|
|
7214
|
+
return sanitizeEntryKey(`${mode}--${task}--${modelId}`);
|
|
7215
|
+
}
|
|
7216
|
+
function sanitizeEntryKey(key) {
|
|
7217
|
+
return key.replace(/::/g, "--").replace(/\//g, "_");
|
|
7218
|
+
}
|
|
7219
|
+
|
|
7220
|
+
// src/lib/useArtifactCache.ts
|
|
7221
|
+
import { useCallback as useCallback18, useMemo as useMemo8, useRef as useRef5, useState as useState14 } from "react";
|
|
7222
|
+
function useArtifactCache(opts) {
|
|
7223
|
+
const { runId, artifactRef, type } = opts;
|
|
7224
|
+
const cacheRef = useRef5(/* @__PURE__ */ new Map());
|
|
7225
|
+
const [status, setStatus] = useState14("idle");
|
|
7226
|
+
const [error, setError] = useState14(null);
|
|
7227
|
+
const inFlight2 = useRef5(/* @__PURE__ */ new Set());
|
|
7228
|
+
const BULK_KEY = "__bulk__";
|
|
7229
|
+
const availableEntries = useMemo8(
|
|
7230
|
+
() => artifactRef?.entries?.map((e) => e.key) ?? [],
|
|
7231
|
+
[artifactRef]
|
|
7232
|
+
);
|
|
7233
|
+
const fetchEntry = useCallback18(
|
|
7234
|
+
async (key) => {
|
|
7235
|
+
if (!artifactRef || !runId) return;
|
|
7236
|
+
if (!artifactRef.layout || artifactRef.layout === "bulk") return;
|
|
7237
|
+
if (cacheRef.current.has(key) || inFlight2.current.has(key)) return;
|
|
7238
|
+
inFlight2.current.add(key);
|
|
7239
|
+
setStatus("loading");
|
|
7240
|
+
setError(null);
|
|
7241
|
+
try {
|
|
7242
|
+
const url = `${ARTIFACT_API_BASE_URL}/runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(type)}/${encodeURIComponent(key)}`;
|
|
7243
|
+
const entry = await signAndFetch(url);
|
|
7244
|
+
cacheRef.current.set(key, entry);
|
|
7245
|
+
setStatus("ready");
|
|
7246
|
+
} catch (err) {
|
|
7247
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
7248
|
+
setStatus("error");
|
|
7249
|
+
} finally {
|
|
7250
|
+
inFlight2.current.delete(key);
|
|
7251
|
+
}
|
|
7252
|
+
},
|
|
7253
|
+
[runId, artifactRef, type]
|
|
7254
|
+
);
|
|
7255
|
+
const fetchAll = useCallback18(async () => {
|
|
7256
|
+
if (!artifactRef || !runId) return;
|
|
7257
|
+
if (inFlight2.current.has(BULK_KEY)) return;
|
|
7258
|
+
if (!artifactRef.layout || artifactRef.layout === "bulk") {
|
|
7259
|
+
if (cacheRef.current.size > 0) return;
|
|
7260
|
+
inFlight2.current.add(BULK_KEY);
|
|
7261
|
+
setStatus("loading");
|
|
7262
|
+
setError(null);
|
|
7263
|
+
try {
|
|
7264
|
+
const url = `${ARTIFACT_API_BASE_URL}/runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(type)}`;
|
|
7265
|
+
const body = await signAndFetch(url);
|
|
7266
|
+
const next = /* @__PURE__ */ new Map();
|
|
7267
|
+
for (const [key, entry] of Object.entries(body.entries)) {
|
|
7268
|
+
next.set(key, entry);
|
|
7269
|
+
}
|
|
7270
|
+
cacheRef.current = next;
|
|
7271
|
+
setStatus("ready");
|
|
7272
|
+
} catch (err) {
|
|
7273
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
7274
|
+
setStatus("error");
|
|
7275
|
+
} finally {
|
|
7276
|
+
inFlight2.current.delete(BULK_KEY);
|
|
7277
|
+
}
|
|
7278
|
+
return;
|
|
7279
|
+
}
|
|
7280
|
+
const keys = artifactRef.entries?.map((e) => e.key) ?? [];
|
|
7281
|
+
await Promise.all(keys.map((k) => fetchEntry(k)));
|
|
7282
|
+
}, [runId, artifactRef, type, fetchEntry]);
|
|
7283
|
+
const getEntry = useCallback18(
|
|
7284
|
+
(key) => cacheRef.current.get(key) ?? null,
|
|
7285
|
+
[]
|
|
7286
|
+
);
|
|
7287
|
+
return useMemo8(
|
|
7288
|
+
() => ({
|
|
7289
|
+
status,
|
|
7290
|
+
error,
|
|
7291
|
+
availableEntries,
|
|
7292
|
+
getEntry,
|
|
7293
|
+
fetchEntry,
|
|
7294
|
+
fetchAll
|
|
7295
|
+
}),
|
|
7296
|
+
[status, error, availableEntries, getEntry, fetchEntry, fetchAll]
|
|
7297
|
+
);
|
|
7298
|
+
}
|
|
7299
|
+
async function signAndFetch(signingUrl) {
|
|
7300
|
+
const signingRes = await fetch(signingUrl, {
|
|
7301
|
+
credentials: "omit",
|
|
7302
|
+
headers: { Accept: "application/json" }
|
|
7303
|
+
});
|
|
7304
|
+
if (!signingRes.ok) {
|
|
7305
|
+
const body = await signingRes.text().catch(() => "");
|
|
7306
|
+
throw new Error(
|
|
7307
|
+
`Artifact signing failed: ${signingRes.status} ${signingRes.statusText}${body ? ` \u2014 ${body.slice(0, 200)}` : ""}`
|
|
7308
|
+
);
|
|
7309
|
+
}
|
|
7310
|
+
const envelope = await signingRes.json();
|
|
7311
|
+
if (envelope.object === "error" || !envelope.url) {
|
|
7312
|
+
throw new Error(
|
|
7313
|
+
envelope.error?.message ?? "Invalid signing response \u2014 missing signed URL"
|
|
7314
|
+
);
|
|
7315
|
+
}
|
|
7316
|
+
const artifactRes = await fetch(envelope.url, { credentials: "omit" });
|
|
7317
|
+
if (!artifactRes.ok) {
|
|
7318
|
+
throw new Error(
|
|
7319
|
+
`GCS artifact fetch failed: ${artifactRes.status} ${artifactRes.statusText}`
|
|
7320
|
+
);
|
|
7321
|
+
}
|
|
7322
|
+
return await artifactRes.json();
|
|
7323
|
+
}
|
|
7324
|
+
|
|
7325
|
+
// src/lib/use-test-outputs-artifact.ts
|
|
7326
|
+
function useTestOutputsArtifact(runId, artifactRef) {
|
|
7327
|
+
const cache = useArtifactCache({
|
|
7117
7328
|
runId,
|
|
7118
7329
|
artifactRef,
|
|
7119
7330
|
type: "testOutputs"
|
|
7120
7331
|
});
|
|
7121
|
-
return
|
|
7332
|
+
return useMemo9(() => {
|
|
7122
7333
|
const entryKey = (taskId, modelId) => testOutputsEntryKey(taskId, modelId) ?? `${taskId}::${modelId}`;
|
|
7123
7334
|
return {
|
|
7124
7335
|
status: cache.status,
|
|
@@ -7182,7 +7393,7 @@ function negativeDocLiftSentiment(count) {
|
|
|
7182
7393
|
}
|
|
7183
7394
|
|
|
7184
7395
|
// src/components/report-detail/AgentBehaviorCard.tsx
|
|
7185
|
-
import { useMemo as
|
|
7396
|
+
import { useMemo as useMemo10, useState as useState15 } from "react";
|
|
7186
7397
|
import { HelpCircleIcon as HelpCircleIcon6, SearchIcon as SearchIcon5 } from "@sanity/icons";
|
|
7187
7398
|
import {
|
|
7188
7399
|
Badge as Badge5,
|
|
@@ -7392,8 +7603,8 @@ function SearchQueryList({
|
|
|
7392
7603
|
totalCount,
|
|
7393
7604
|
truncated
|
|
7394
7605
|
}) {
|
|
7395
|
-
const [filter, setFilter] =
|
|
7396
|
-
const filtered =
|
|
7606
|
+
const [filter, setFilter] = useState15("");
|
|
7607
|
+
const filtered = useMemo10(() => {
|
|
7397
7608
|
if (!filter) return queries;
|
|
7398
7609
|
const lower = filter.toLowerCase();
|
|
7399
7610
|
return queries.filter((q) => q.toLowerCase().includes(lower));
|
|
@@ -8237,323 +8448,95 @@ function HealthCard({
|
|
|
8237
8448
|
children: /* @__PURE__ */ jsxs24(Flex15, { align: "center", gap: 3, children: [
|
|
8238
8449
|
/* @__PURE__ */ jsx30("span", { style: { color: textColor, fontSize: 28 }, children: icon }),
|
|
8239
8450
|
/* @__PURE__ */ jsxs24(Stack20, { space: 1, children: [
|
|
8240
|
-
/* @__PURE__ */ jsx30(
|
|
8241
|
-
"span",
|
|
8242
|
-
{
|
|
8243
|
-
style: {
|
|
8244
|
-
color: textColor,
|
|
8245
|
-
fontFamily: "var(--font-code-size, monospace)",
|
|
8246
|
-
fontSize: 36,
|
|
8247
|
-
fontWeight: 700,
|
|
8248
|
-
lineHeight: 1
|
|
8249
|
-
},
|
|
8250
|
-
children: count
|
|
8251
|
-
}
|
|
8252
|
-
),
|
|
8253
|
-
/* @__PURE__ */ jsx30(Text26, { muted: true, size: 2, children: label })
|
|
8254
|
-
] })
|
|
8255
|
-
] })
|
|
8256
|
-
}
|
|
8257
|
-
);
|
|
8258
|
-
}
|
|
8259
|
-
function MetricCard({
|
|
8260
|
-
label,
|
|
8261
|
-
sentiment,
|
|
8262
|
-
value
|
|
8263
|
-
}) {
|
|
8264
|
-
const style = sentiment ? {
|
|
8265
|
-
...sentimentCardStyle(sentiment),
|
|
8266
|
-
padding: 16
|
|
8267
|
-
} : {
|
|
8268
|
-
backgroundColor: "var(--card-bg2-color, var(--card-bg-color))",
|
|
8269
|
-
border: "1px solid var(--card-border-color)",
|
|
8270
|
-
borderRadius: 6,
|
|
8271
|
-
padding: 16
|
|
8272
|
-
};
|
|
8273
|
-
const valueColor = sentiment ? sentimentTextColor(sentiment) : "var(--card-fg-color)";
|
|
8274
|
-
return /* @__PURE__ */ jsx30(Box18, { style, children: /* @__PURE__ */ jsxs24(Stack20, { space: 2, children: [
|
|
8275
|
-
/* @__PURE__ */ jsx30(Text26, { muted: true, size: 2, children: label }),
|
|
8276
|
-
/* @__PURE__ */ jsx30(
|
|
8277
|
-
"span",
|
|
8278
|
-
{
|
|
8279
|
-
style: {
|
|
8280
|
-
color: valueColor,
|
|
8281
|
-
fontFamily: "var(--font-code-size, monospace)",
|
|
8282
|
-
fontSize: 28,
|
|
8283
|
-
fontWeight: 600,
|
|
8284
|
-
lineHeight: 1.2
|
|
8285
|
-
},
|
|
8286
|
-
children: value
|
|
8287
|
-
}
|
|
8288
|
-
)
|
|
8289
|
-
] }) });
|
|
8290
|
-
}
|
|
8291
|
-
function Pill({
|
|
8292
|
-
color,
|
|
8293
|
-
label
|
|
8294
|
-
}) {
|
|
8295
|
-
const colors = {
|
|
8296
|
-
emerald: { bg: "rgba(16,185,129,0.25)", text: "#34d399" },
|
|
8297
|
-
red: { bg: "rgba(239,68,68,0.25)", text: "#f87171" },
|
|
8298
|
-
muted: {
|
|
8299
|
-
bg: "var(--card-muted-bg-color, rgba(255,255,255,0.06))",
|
|
8300
|
-
text: "var(--card-muted-fg-color)"
|
|
8301
|
-
}
|
|
8302
|
-
};
|
|
8303
|
-
const c = colors[color];
|
|
8304
|
-
return /* @__PURE__ */ jsx30(
|
|
8305
|
-
"span",
|
|
8306
|
-
{
|
|
8307
|
-
style: {
|
|
8308
|
-
backgroundColor: c.bg,
|
|
8309
|
-
borderRadius: 4,
|
|
8310
|
-
color: c.text,
|
|
8311
|
-
fontSize: 14,
|
|
8312
|
-
fontWeight: 500,
|
|
8313
|
-
padding: "4px 10px",
|
|
8314
|
-
whiteSpace: "nowrap"
|
|
8315
|
-
},
|
|
8316
|
-
children: label
|
|
8317
|
-
}
|
|
8318
|
-
);
|
|
8319
|
-
}
|
|
8320
|
-
|
|
8321
|
-
// src/components/report-detail/FailureModesPanel.tsx
|
|
8322
|
-
import { Box as Box19, Flex as Flex16, Stack as Stack21, Text as Text27 } from "@sanity/ui";
|
|
8323
|
-
|
|
8324
|
-
// src/lib/useArtifactListRow.ts
|
|
8325
|
-
import { useCallback as useCallback20, useMemo as useMemo11 } from "react";
|
|
8326
|
-
|
|
8327
|
-
// src/lib/useArtifactDetail.ts
|
|
8328
|
-
import { useCallback as useCallback18, useEffect as useEffect8, useState as useState15 } from "react";
|
|
8329
|
-
|
|
8330
|
-
// src/lib/artifact-cache-store.ts
|
|
8331
|
-
function cacheKey({ runId, type, key }) {
|
|
8332
|
-
return `${runId}::${type}::${key}`;
|
|
8333
|
-
}
|
|
8334
|
-
var hydratedEntries = /* @__PURE__ */ new Map();
|
|
8335
|
-
var inFlight = /* @__PURE__ */ new Map();
|
|
8336
|
-
var knownNotFound = /* @__PURE__ */ new Set();
|
|
8337
|
-
var subscribers = /* @__PURE__ */ new Map();
|
|
8338
|
-
function getCached(k) {
|
|
8339
|
-
const hit = hydratedEntries.get(cacheKey(k));
|
|
8340
|
-
return hit ?? null;
|
|
8341
|
-
}
|
|
8342
|
-
function setCached(k, value) {
|
|
8343
|
-
const composite = cacheKey(k);
|
|
8344
|
-
hydratedEntries.set(composite, value);
|
|
8345
|
-
notify(composite);
|
|
8346
|
-
}
|
|
8347
|
-
function subscribe(k, fn) {
|
|
8348
|
-
const composite = cacheKey(k);
|
|
8349
|
-
let set2 = subscribers.get(composite);
|
|
8350
|
-
if (!set2) {
|
|
8351
|
-
set2 = /* @__PURE__ */ new Set();
|
|
8352
|
-
subscribers.set(composite, set2);
|
|
8353
|
-
}
|
|
8354
|
-
set2.add(fn);
|
|
8355
|
-
return () => {
|
|
8356
|
-
set2.delete(fn);
|
|
8357
|
-
if (set2.size === 0) subscribers.delete(composite);
|
|
8358
|
-
};
|
|
8359
|
-
}
|
|
8360
|
-
function recordInFlight(k, start) {
|
|
8361
|
-
const composite = cacheKey(k);
|
|
8362
|
-
const existing = inFlight.get(composite);
|
|
8363
|
-
if (existing) return existing;
|
|
8364
|
-
const p = start().finally(() => {
|
|
8365
|
-
inFlight.delete(composite);
|
|
8366
|
-
});
|
|
8367
|
-
inFlight.set(composite, p);
|
|
8368
|
-
return p;
|
|
8369
|
-
}
|
|
8370
|
-
function markNotFound(k) {
|
|
8371
|
-
knownNotFound.add(cacheKey(k));
|
|
8372
|
-
}
|
|
8373
|
-
function isKnownNotFound(k) {
|
|
8374
|
-
return knownNotFound.has(cacheKey(k));
|
|
8375
|
-
}
|
|
8376
|
-
function notify(composite) {
|
|
8377
|
-
const set2 = subscribers.get(composite);
|
|
8378
|
-
if (!set2) return;
|
|
8379
|
-
for (const fn of set2) fn();
|
|
8380
|
-
}
|
|
8381
|
-
|
|
8382
|
-
// src/lib/artifact-fetch.ts
|
|
8383
|
-
var ArtifactHttpError = class extends Error {
|
|
8384
|
-
status;
|
|
8385
|
-
constructor(message, status) {
|
|
8386
|
-
super(message);
|
|
8387
|
-
this.name = "ArtifactHttpError";
|
|
8388
|
-
this.status = status;
|
|
8389
|
-
}
|
|
8390
|
-
};
|
|
8391
|
-
function buildSigningUrl(runId, type, entryKey) {
|
|
8392
|
-
const base = `${ARTIFACT_API_BASE_URL}/runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(type)}`;
|
|
8393
|
-
return entryKey === void 0 ? base : `${base}/${encodeURIComponent(entryKey)}`;
|
|
8394
|
-
}
|
|
8395
|
-
async function signAndFetchJson(signingUrl) {
|
|
8396
|
-
const signed = await exchangeSigningUrl(signingUrl);
|
|
8397
|
-
const res = await fetch(signed, { credentials: "omit" });
|
|
8398
|
-
if (!res.ok) {
|
|
8399
|
-
throw new ArtifactHttpError(
|
|
8400
|
-
`GCS artifact fetch failed: ${res.status} ${res.statusText}`,
|
|
8401
|
-
res.status
|
|
8402
|
-
);
|
|
8403
|
-
}
|
|
8404
|
-
return await res.json();
|
|
8405
|
-
}
|
|
8406
|
-
async function signAndFetchNdjson(signingUrl) {
|
|
8407
|
-
const signed = await exchangeSigningUrl(signingUrl);
|
|
8408
|
-
const res = await fetch(signed, { credentials: "omit" });
|
|
8409
|
-
if (!res.ok) {
|
|
8410
|
-
throw new ArtifactHttpError(
|
|
8411
|
-
`GCS artifact fetch failed: ${res.status} ${res.statusText}`,
|
|
8412
|
-
res.status
|
|
8413
|
-
);
|
|
8414
|
-
}
|
|
8415
|
-
const body = await res.text();
|
|
8416
|
-
const rows = [];
|
|
8417
|
-
for (const line of body.split("\n")) {
|
|
8418
|
-
const trimmed = line.trim();
|
|
8419
|
-
if (trimmed.length === 0) continue;
|
|
8420
|
-
try {
|
|
8421
|
-
rows.push(JSON.parse(trimmed));
|
|
8422
|
-
} catch (err) {
|
|
8423
|
-
console.warn(
|
|
8424
|
-
`NDJSON parse skipped a malformed row: ${err instanceof Error ? err.message : String(err)}`
|
|
8425
|
-
);
|
|
8426
|
-
}
|
|
8427
|
-
}
|
|
8428
|
-
return rows;
|
|
8429
|
-
}
|
|
8430
|
-
async function fetchBatchReadUrls(runId, type, keys) {
|
|
8431
|
-
const res = await fetch(
|
|
8432
|
-
`${ARTIFACT_API_BASE_URL}/runs/${encodeURIComponent(runId)}/artifacts/batch/read-urls`,
|
|
8433
|
-
{
|
|
8434
|
-
method: "POST",
|
|
8435
|
-
credentials: "omit",
|
|
8436
|
-
headers: { "Content-Type": "application/json" },
|
|
8437
|
-
body: JSON.stringify({ types: [type], keys: { [type]: keys } })
|
|
8438
|
-
}
|
|
8439
|
-
);
|
|
8440
|
-
if (!res.ok) {
|
|
8441
|
-
const body = await res.text().catch(() => "");
|
|
8442
|
-
throw new Error(
|
|
8443
|
-
`Batch signing failed: ${res.status} ${res.statusText}${body ? ` \u2014 ${body.slice(0, 200)}` : ""}`
|
|
8444
|
-
);
|
|
8445
|
-
}
|
|
8446
|
-
const envelope = await res.json();
|
|
8447
|
-
if (envelope.object === "error" || !envelope.urls) {
|
|
8448
|
-
throw new Error(
|
|
8449
|
-
envelope.error?.message ?? "Invalid batch signing response \u2014 missing urls"
|
|
8450
|
-
);
|
|
8451
|
-
}
|
|
8452
|
-
const entries = envelope.urls[type];
|
|
8453
|
-
if (!entries) return {};
|
|
8454
|
-
const out = {};
|
|
8455
|
-
for (const [key, entry] of Object.entries(entries)) {
|
|
8456
|
-
out[key] = entry.url;
|
|
8457
|
-
}
|
|
8458
|
-
return out;
|
|
8459
|
-
}
|
|
8460
|
-
async function exchangeSigningUrl(signingUrl) {
|
|
8461
|
-
const res = await fetch(signingUrl, {
|
|
8462
|
-
credentials: "omit",
|
|
8463
|
-
headers: { Accept: "application/json" }
|
|
8464
|
-
});
|
|
8465
|
-
if (!res.ok) {
|
|
8466
|
-
const body = await res.text().catch(() => "");
|
|
8467
|
-
throw new ArtifactHttpError(
|
|
8468
|
-
`Artifact signing failed: ${res.status} ${res.statusText}${body ? ` \u2014 ${body.slice(0, 200)}` : ""}`,
|
|
8469
|
-
res.status
|
|
8470
|
-
);
|
|
8471
|
-
}
|
|
8472
|
-
const envelope = await res.json();
|
|
8473
|
-
if (envelope.object === "error" || !envelope.url) {
|
|
8474
|
-
throw new Error(
|
|
8475
|
-
envelope.error?.message ?? "Invalid signing response \u2014 missing signed URL"
|
|
8476
|
-
);
|
|
8477
|
-
}
|
|
8478
|
-
return envelope.url;
|
|
8479
|
-
}
|
|
8480
|
-
|
|
8481
|
-
// src/lib/useArtifactDetail.ts
|
|
8482
|
-
var NDJSON_TYPES = /* @__PURE__ */ new Set([
|
|
8483
|
-
"traces"
|
|
8484
|
-
]);
|
|
8485
|
-
function useArtifactDetail(type, key) {
|
|
8486
|
-
const { runId } = useReportArtifactContext();
|
|
8487
|
-
const ref = useArtifactRef(type);
|
|
8488
|
-
const cacheKey2 = key ?? "";
|
|
8489
|
-
const [status, setStatus] = useState15(
|
|
8490
|
-
() => runId && getCached({ runId, type, key: cacheKey2 }) !== null ? "ready" : "idle"
|
|
8491
|
-
);
|
|
8492
|
-
const [, setTick] = useState15(0);
|
|
8493
|
-
useEffect8(() => {
|
|
8494
|
-
if (!runId) return void 0;
|
|
8495
|
-
return subscribe({ runId, type, key: cacheKey2 }, () => {
|
|
8496
|
-
setStatus("ready");
|
|
8497
|
-
setTick((n) => n + 1);
|
|
8498
|
-
});
|
|
8499
|
-
}, [runId, type, cacheKey2]);
|
|
8500
|
-
const request = useCallback18(async () => {
|
|
8501
|
-
if (!runId || !ref) return;
|
|
8502
|
-
if (ref.layout === "per-entry" && !key) return;
|
|
8503
|
-
const cacheId = { runId, type, key: cacheKey2 };
|
|
8504
|
-
if (isKnownNotFound(cacheId)) {
|
|
8505
|
-
setStatus("error");
|
|
8506
|
-
return;
|
|
8507
|
-
}
|
|
8508
|
-
const hit = getCached(cacheId);
|
|
8509
|
-
if (hit !== null) {
|
|
8510
|
-
setStatus("ready");
|
|
8511
|
-
return;
|
|
8451
|
+
/* @__PURE__ */ jsx30(
|
|
8452
|
+
"span",
|
|
8453
|
+
{
|
|
8454
|
+
style: {
|
|
8455
|
+
color: textColor,
|
|
8456
|
+
fontFamily: "var(--font-code-size, monospace)",
|
|
8457
|
+
fontSize: 36,
|
|
8458
|
+
fontWeight: 700,
|
|
8459
|
+
lineHeight: 1
|
|
8460
|
+
},
|
|
8461
|
+
children: count
|
|
8462
|
+
}
|
|
8463
|
+
),
|
|
8464
|
+
/* @__PURE__ */ jsx30(Text26, { muted: true, size: 2, children: label })
|
|
8465
|
+
] })
|
|
8466
|
+
] })
|
|
8512
8467
|
}
|
|
8513
|
-
|
|
8514
|
-
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8468
|
+
);
|
|
8469
|
+
}
|
|
8470
|
+
function MetricCard({
|
|
8471
|
+
label,
|
|
8472
|
+
sentiment,
|
|
8473
|
+
value
|
|
8474
|
+
}) {
|
|
8475
|
+
const style = sentiment ? {
|
|
8476
|
+
...sentimentCardStyle(sentiment),
|
|
8477
|
+
padding: 16
|
|
8478
|
+
} : {
|
|
8479
|
+
backgroundColor: "var(--card-bg2-color, var(--card-bg-color))",
|
|
8480
|
+
border: "1px solid var(--card-border-color)",
|
|
8481
|
+
borderRadius: 6,
|
|
8482
|
+
padding: 16
|
|
8483
|
+
};
|
|
8484
|
+
const valueColor = sentiment ? sentimentTextColor(sentiment) : "var(--card-fg-color)";
|
|
8485
|
+
return /* @__PURE__ */ jsx30(Box18, { style, children: /* @__PURE__ */ jsxs24(Stack20, { space: 2, children: [
|
|
8486
|
+
/* @__PURE__ */ jsx30(Text26, { muted: true, size: 2, children: label }),
|
|
8487
|
+
/* @__PURE__ */ jsx30(
|
|
8488
|
+
"span",
|
|
8489
|
+
{
|
|
8490
|
+
style: {
|
|
8491
|
+
color: valueColor,
|
|
8492
|
+
fontFamily: "var(--font-code-size, monospace)",
|
|
8493
|
+
fontSize: 28,
|
|
8494
|
+
fontWeight: 600,
|
|
8495
|
+
lineHeight: 1.2
|
|
8496
|
+
},
|
|
8497
|
+
children: value
|
|
8525
8498
|
}
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
}, [runId, ref, type, key, cacheKey2]);
|
|
8529
|
-
const full = runId ? getCached({ runId, type, key: cacheKey2 }) : null;
|
|
8530
|
-
return [full, status, request];
|
|
8499
|
+
)
|
|
8500
|
+
] }) });
|
|
8531
8501
|
}
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8535
|
-
|
|
8536
|
-
const
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
present: false
|
|
8544
|
-
};
|
|
8545
|
-
}
|
|
8546
|
-
return {
|
|
8547
|
-
preview: entry.preview,
|
|
8548
|
-
association: entry.association,
|
|
8549
|
-
bytes: entry.bytes,
|
|
8550
|
-
truncated: entry.truncated ?? false,
|
|
8551
|
-
present: true
|
|
8502
|
+
function Pill({
|
|
8503
|
+
color,
|
|
8504
|
+
label
|
|
8505
|
+
}) {
|
|
8506
|
+
const colors = {
|
|
8507
|
+
emerald: { bg: "rgba(16,185,129,0.25)", text: "#34d399" },
|
|
8508
|
+
red: { bg: "rgba(239,68,68,0.25)", text: "#f87171" },
|
|
8509
|
+
muted: {
|
|
8510
|
+
bg: "var(--card-muted-bg-color, rgba(255,255,255,0.06))",
|
|
8511
|
+
text: "var(--card-muted-fg-color)"
|
|
8512
|
+
}
|
|
8552
8513
|
};
|
|
8514
|
+
const c = colors[color];
|
|
8515
|
+
return /* @__PURE__ */ jsx30(
|
|
8516
|
+
"span",
|
|
8517
|
+
{
|
|
8518
|
+
style: {
|
|
8519
|
+
backgroundColor: c.bg,
|
|
8520
|
+
borderRadius: 4,
|
|
8521
|
+
color: c.text,
|
|
8522
|
+
fontSize: 14,
|
|
8523
|
+
fontWeight: 500,
|
|
8524
|
+
padding: "4px 10px",
|
|
8525
|
+
whiteSpace: "nowrap"
|
|
8526
|
+
},
|
|
8527
|
+
children: label
|
|
8528
|
+
}
|
|
8529
|
+
);
|
|
8553
8530
|
}
|
|
8554
8531
|
|
|
8532
|
+
// src/components/report-detail/FailureModesPanel.tsx
|
|
8533
|
+
import { Box as Box19, Flex as Flex16, Stack as Stack21, Text as Text27 } from "@sanity/ui";
|
|
8534
|
+
|
|
8535
|
+
// src/lib/useArtifactListRow.ts
|
|
8536
|
+
import { useCallback as useCallback20, useMemo as useMemo12 } from "react";
|
|
8537
|
+
|
|
8555
8538
|
// src/lib/useArtifactPrefetch.ts
|
|
8556
|
-
import { useCallback as useCallback19, useMemo as
|
|
8539
|
+
import { useCallback as useCallback19, useMemo as useMemo11 } from "react";
|
|
8557
8540
|
var NDJSON_TYPES2 = /* @__PURE__ */ new Set([
|
|
8558
8541
|
"traces"
|
|
8559
8542
|
]);
|
|
@@ -8657,7 +8640,7 @@ function useArtifactPrefetch(type) {
|
|
|
8657
8640
|
},
|
|
8658
8641
|
[runId, ref, type]
|
|
8659
8642
|
);
|
|
8660
|
-
return
|
|
8643
|
+
return useMemo11(
|
|
8661
8644
|
() => ({ prefetch, onHover, prefetchWindow, warmAll }),
|
|
8662
8645
|
[prefetch, onHover, prefetchWindow, warmAll]
|
|
8663
8646
|
);
|
|
@@ -8690,7 +8673,7 @@ function useArtifactListRow(type, key, listKeys) {
|
|
|
8690
8673
|
const entry = useArtifactEntry(type, key);
|
|
8691
8674
|
const [full, status, request] = useArtifactDetail(type, key);
|
|
8692
8675
|
const { onHover, prefetchWindow } = useArtifactPrefetch(type);
|
|
8693
|
-
const onMouseEnter =
|
|
8676
|
+
const onMouseEnter = useMemo12(() => onHover(key), [onHover, key]);
|
|
8694
8677
|
const onFocus = useCallback20(() => {
|
|
8695
8678
|
const idx = listKeys.indexOf(key);
|
|
8696
8679
|
if (idx < 0) return;
|
|
@@ -8832,7 +8815,7 @@ function FailureModeRow({
|
|
|
8832
8815
|
// src/components/report-detail/LineageCard.tsx
|
|
8833
8816
|
import { LinkIcon as LinkIcon2 } from "@sanity/icons";
|
|
8834
8817
|
import { Badge as Badge6, Card as Card13, Flex as Flex17, Stack as Stack22, Text as Text28 } from "@sanity/ui";
|
|
8835
|
-
import { useCallback as useCallback21, useEffect as
|
|
8818
|
+
import { useCallback as useCallback21, useEffect as useEffect10, useState as useState16 } from "react";
|
|
8836
8819
|
import { useClient as useClient7 } from "sanity";
|
|
8837
8820
|
import { useRouter as useRouter3 } from "sanity/router";
|
|
8838
8821
|
import { jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
@@ -8853,7 +8836,7 @@ function LineageCard({ provenance, reportId }) {
|
|
|
8853
8836
|
const router = useRouter3();
|
|
8854
8837
|
const client = useClient7({ apiVersion: API_VERSION });
|
|
8855
8838
|
const [spawned, setSpawned] = useState16([]);
|
|
8856
|
-
|
|
8839
|
+
useEffect10(() => {
|
|
8857
8840
|
let cancelled = false;
|
|
8858
8841
|
client.fetch(SPAWNED_REPORTS_QUERY, {
|
|
8859
8842
|
reportId,
|
|
@@ -8964,7 +8947,7 @@ function formatShortDate(iso) {
|
|
|
8964
8947
|
}
|
|
8965
8948
|
|
|
8966
8949
|
// src/components/report-detail/JudgmentList.tsx
|
|
8967
|
-
import React2, { useCallback as useCallback24, useEffect as
|
|
8950
|
+
import React2, { useCallback as useCallback24, useEffect as useEffect13, useMemo as useMemo13, useRef as useRef7, useState as useState18 } from "react";
|
|
8968
8951
|
import {
|
|
8969
8952
|
ChevronDownIcon as ChevronDownIcon2,
|
|
8970
8953
|
ChevronRightIcon,
|
|
@@ -8974,13 +8957,13 @@ import {
|
|
|
8974
8957
|
import { Box as Box23, Flex as Flex20, Stack as Stack24, Text as Text33, Tooltip as Tooltip9 } from "@sanity/ui";
|
|
8975
8958
|
|
|
8976
8959
|
// src/components/report-detail/PromptReplayDrawer.tsx
|
|
8977
|
-
import { useEffect as
|
|
8960
|
+
import { useEffect as useEffect12 } from "react";
|
|
8978
8961
|
import { Badge as Badge7, Box as Box21, Card as Card14, Dialog, Flex as Flex18, Grid as Grid3, Stack as Stack23, Text as Text30 } from "@sanity/ui";
|
|
8979
8962
|
|
|
8980
8963
|
// src/components/CopyButton.tsx
|
|
8981
8964
|
import {
|
|
8982
8965
|
useCallback as useCallback22,
|
|
8983
|
-
useEffect as
|
|
8966
|
+
useEffect as useEffect11,
|
|
8984
8967
|
useRef as useRef6,
|
|
8985
8968
|
useState as useState17
|
|
8986
8969
|
} from "react";
|
|
@@ -9016,7 +8999,7 @@ function CopyButton({
|
|
|
9016
8999
|
}
|
|
9017
9000
|
);
|
|
9018
9001
|
}, [text, scheduleRevert]);
|
|
9019
|
-
|
|
9002
|
+
useEffect11(() => {
|
|
9020
9003
|
return () => {
|
|
9021
9004
|
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
9022
9005
|
};
|
|
@@ -9071,7 +9054,7 @@ function useArtifactPane(type, entryKey, project) {
|
|
|
9071
9054
|
const isLocalStore = ref?.store === "local";
|
|
9072
9055
|
const entry = useArtifactEntry(type, entryKey ?? "");
|
|
9073
9056
|
const [full, status, request] = useArtifactDetail(type, entryKey ?? "");
|
|
9074
|
-
|
|
9057
|
+
useEffect12(() => {
|
|
9075
9058
|
if (!entryKey) return;
|
|
9076
9059
|
if (isLocalStore) return;
|
|
9077
9060
|
if (status !== "idle") return;
|
|
@@ -9606,7 +9589,7 @@ function JudgmentList({
|
|
|
9606
9589
|
);
|
|
9607
9590
|
const [scoreBand, setScoreBand] = useState18(null);
|
|
9608
9591
|
const [sortOrder, setSortOrder] = useState18("score-desc");
|
|
9609
|
-
const testResultMap =
|
|
9592
|
+
const testResultMap = useMemo13(() => {
|
|
9610
9593
|
const map = /* @__PURE__ */ new Map();
|
|
9611
9594
|
if (!testResults) return map;
|
|
9612
9595
|
for (const tr of testResults) {
|
|
@@ -9616,15 +9599,15 @@ function JudgmentList({
|
|
|
9616
9599
|
}
|
|
9617
9600
|
return map;
|
|
9618
9601
|
}, [testResults]);
|
|
9619
|
-
const pruned =
|
|
9620
|
-
const dimensionOptions =
|
|
9602
|
+
const pruned = useMemo13(() => pruneNoise(judgments), [judgments]);
|
|
9603
|
+
const dimensionOptions = useMemo13(() => {
|
|
9621
9604
|
const counts = /* @__PURE__ */ new Map();
|
|
9622
9605
|
for (const j of pruned) {
|
|
9623
9606
|
counts.set(j.dimension, (counts.get(j.dimension) ?? 0) + 1);
|
|
9624
9607
|
}
|
|
9625
9608
|
return [...counts.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([key, count]) => ({ key, label: dimensionLabel2(key), count }));
|
|
9626
9609
|
}, [pruned]);
|
|
9627
|
-
const filtered =
|
|
9610
|
+
const filtered = useMemo13(() => {
|
|
9628
9611
|
return pruned.filter((j) => {
|
|
9629
9612
|
if (selectedDimensions.size > 0 && !selectedDimensions.has(j.dimension))
|
|
9630
9613
|
return false;
|
|
@@ -9633,17 +9616,17 @@ function JudgmentList({
|
|
|
9633
9616
|
return true;
|
|
9634
9617
|
});
|
|
9635
9618
|
}, [pruned, selectedDimensions, scoreBand, query]);
|
|
9636
|
-
const grouped =
|
|
9619
|
+
const grouped = useMemo13(
|
|
9637
9620
|
() => groupByArea(filtered, sortOrder),
|
|
9638
9621
|
[filtered, sortOrder]
|
|
9639
9622
|
);
|
|
9640
|
-
const groupedWithStats =
|
|
9623
|
+
const groupedWithStats = useMemo13(
|
|
9641
9624
|
() => grouped.map(
|
|
9642
9625
|
([area, list]) => [area, list, computeGroupStats(list)]
|
|
9643
9626
|
),
|
|
9644
9627
|
[grouped]
|
|
9645
9628
|
);
|
|
9646
|
-
const focusedJudgment =
|
|
9629
|
+
const focusedJudgment = useMemo13(() => {
|
|
9647
9630
|
if (!focus) return null;
|
|
9648
9631
|
return pruned.find((j) => judgmentSlug(j) === focus) ?? null;
|
|
9649
9632
|
}, [pruned, focus]);
|
|
@@ -9689,7 +9672,7 @@ function JudgmentList({
|
|
|
9689
9672
|
return next;
|
|
9690
9673
|
});
|
|
9691
9674
|
}, []);
|
|
9692
|
-
|
|
9675
|
+
useEffect13(() => {
|
|
9693
9676
|
if (!focusedJudgment) return;
|
|
9694
9677
|
const area = areaOf(focusedJudgment.taskId);
|
|
9695
9678
|
setCollapsedAreas((prev) => {
|
|
@@ -9700,30 +9683,30 @@ function JudgmentList({
|
|
|
9700
9683
|
});
|
|
9701
9684
|
}, [focusedJudgment]);
|
|
9702
9685
|
const [activeRowSlug, setActiveRowSlug] = useState18(null);
|
|
9703
|
-
const flatSlugs =
|
|
9686
|
+
const flatSlugs = useMemo13(
|
|
9704
9687
|
() => grouped.flatMap(
|
|
9705
9688
|
([, areaJudgments]) => areaJudgments.map((j) => judgmentSlug(j))
|
|
9706
9689
|
),
|
|
9707
9690
|
[grouped]
|
|
9708
9691
|
);
|
|
9709
|
-
const flatKeys =
|
|
9692
|
+
const flatKeys = useMemo13(
|
|
9710
9693
|
() => grouped.flatMap(
|
|
9711
9694
|
([, areaJudgments]) => areaJudgments.map((j) => j.id ?? "")
|
|
9712
9695
|
),
|
|
9713
9696
|
[grouped]
|
|
9714
9697
|
);
|
|
9715
9698
|
const effectiveActiveSlug = activeRowSlug && flatSlugs.includes(activeRowSlug) ? activeRowSlug : flatSlugs[0] ?? null;
|
|
9716
|
-
|
|
9699
|
+
useEffect13(() => {
|
|
9717
9700
|
if (focus) setActiveRowSlug(focus);
|
|
9718
9701
|
}, [focus]);
|
|
9719
|
-
|
|
9702
|
+
useEffect13(() => {
|
|
9720
9703
|
if (activeRowSlug && !flatSlugs.includes(activeRowSlug)) {
|
|
9721
9704
|
setActiveRowSlug(null);
|
|
9722
9705
|
}
|
|
9723
9706
|
}, [flatSlugs, activeRowSlug]);
|
|
9724
9707
|
const { close: closeDrawer, open: openDrawer } = useJudgmentDrawer();
|
|
9725
9708
|
const { runId: artifactRunId, manifest: artifactManifest } = useReportArtifactContext();
|
|
9726
|
-
|
|
9709
|
+
useEffect13(() => {
|
|
9727
9710
|
if (focus && focusedJudgment) {
|
|
9728
9711
|
openDrawer({
|
|
9729
9712
|
artifactCache,
|
|
@@ -9748,7 +9731,7 @@ function JudgmentList({
|
|
|
9748
9731
|
openPromptReplay
|
|
9749
9732
|
]);
|
|
9750
9733
|
const prevFocusRef = useRef7(focus);
|
|
9751
|
-
|
|
9734
|
+
useEffect13(() => {
|
|
9752
9735
|
const prev = prevFocusRef.current;
|
|
9753
9736
|
prevFocusRef.current = focus;
|
|
9754
9737
|
if (prev && !focus) {
|
|
@@ -10037,7 +10020,7 @@ function JudgmentCard({
|
|
|
10037
10020
|
const sep = judgment.taskId.indexOf(" - ");
|
|
10038
10021
|
const rawTaskName = sep > 0 ? judgment.taskId.substring(sep + 3) : judgment.taskId;
|
|
10039
10022
|
const { name: taskName, variant } = splitVariant(rawTaskName);
|
|
10040
|
-
|
|
10023
|
+
useEffect13(() => {
|
|
10041
10024
|
if (focused) {
|
|
10042
10025
|
const timer = setTimeout(() => {
|
|
10043
10026
|
cardRef.current?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -10057,7 +10040,7 @@ function JudgmentCard({
|
|
|
10057
10040
|
},
|
|
10058
10041
|
[handleClick]
|
|
10059
10042
|
);
|
|
10060
|
-
const onHoverTestOutputs =
|
|
10043
|
+
const onHoverTestOutputs = useMemo13(
|
|
10061
10044
|
() => testOutputsKey ? testOutputsPrefetch.onHover(testOutputsKey) : null,
|
|
10062
10045
|
[testOutputsPrefetch, testOutputsKey]
|
|
10063
10046
|
);
|
|
@@ -10728,79 +10711,376 @@ function TaskIdsField({ taskIds }) {
|
|
|
10728
10711
|
),
|
|
10729
10712
|
/* @__PURE__ */ jsxs31(Text35, { muted: true, size: 1, children: [
|
|
10730
10713
|
"(",
|
|
10731
|
-
count,
|
|
10714
|
+
count,
|
|
10715
|
+
")"
|
|
10716
|
+
] })
|
|
10717
|
+
] }),
|
|
10718
|
+
showList && /* @__PURE__ */ jsx39(Stack26, { space: 1, children: taskIds.map((id) => /* @__PURE__ */ jsx39(Text35, { size: 2, style: { fontFamily: "monospace" }, children: id }, id)) }),
|
|
10719
|
+
needsToggle && /* @__PURE__ */ jsx39(
|
|
10720
|
+
Button6,
|
|
10721
|
+
{
|
|
10722
|
+
fontSize: 1,
|
|
10723
|
+
mode: "bleed",
|
|
10724
|
+
onClick: () => setExpanded((prev) => !prev),
|
|
10725
|
+
padding: 1,
|
|
10726
|
+
text: expanded ? "Hide" : `Show all ${count}`
|
|
10727
|
+
}
|
|
10728
|
+
)
|
|
10729
|
+
] });
|
|
10730
|
+
}
|
|
10731
|
+
function GitInfo({ git }) {
|
|
10732
|
+
const repoUrl = `https://github.com/${git.repo}`;
|
|
10733
|
+
const branchUrl = `${repoUrl}/tree/${git.branch}`;
|
|
10734
|
+
const commitUrl = `${repoUrl}/commit/${git.sha}`;
|
|
10735
|
+
const prUrl = git.prNumber ? `${repoUrl}/pull/${git.prNumber}` : null;
|
|
10736
|
+
return /* @__PURE__ */ jsx39(Card16, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs31(Flex22, { align: "center", gap: 3, wrap: "wrap", children: [
|
|
10737
|
+
/* @__PURE__ */ jsx39(Text35, { muted: true, size: 2, weight: "semibold", children: "Git" }),
|
|
10738
|
+
/* @__PURE__ */ jsxs31(Text35, { size: 2, children: [
|
|
10739
|
+
/* @__PURE__ */ jsx39("a", { href: repoUrl, rel: "noopener noreferrer", target: "_blank", children: git.repo }),
|
|
10740
|
+
" / ",
|
|
10741
|
+
/* @__PURE__ */ jsx39("a", { href: branchUrl, rel: "noopener noreferrer", target: "_blank", children: git.branch })
|
|
10742
|
+
] }),
|
|
10743
|
+
/* @__PURE__ */ jsx39(Text35, { muted: true, size: 2, style: { fontFamily: "monospace" }, children: /* @__PURE__ */ jsx39("a", { href: commitUrl, rel: "noopener noreferrer", target: "_blank", children: git.sha.slice(0, 12) }) }),
|
|
10744
|
+
prUrl && /* @__PURE__ */ jsx39(Text35, { size: 2, children: /* @__PURE__ */ jsxs31("a", { href: prUrl, rel: "noopener noreferrer", target: "_blank", children: [
|
|
10745
|
+
"PR #",
|
|
10746
|
+
git.prNumber,
|
|
10747
|
+
" \u2192"
|
|
10748
|
+
] }) })
|
|
10749
|
+
] }) });
|
|
10750
|
+
}
|
|
10751
|
+
function PromptfooLinks({
|
|
10752
|
+
provenance
|
|
10753
|
+
}) {
|
|
10754
|
+
if (provenance.promptfooUrls && provenance.promptfooUrls.length > 0) {
|
|
10755
|
+
return /* @__PURE__ */ jsx39(Flex22, { align: "center", gap: 3, wrap: "wrap", children: provenance.promptfooUrls.map((entry) => /* @__PURE__ */ jsx39(Text35, { size: 2, children: /* @__PURE__ */ jsxs31("a", { href: entry.url, rel: "noopener noreferrer", target: "_blank", children: [
|
|
10756
|
+
"View in Promptfoo (",
|
|
10757
|
+
entry.mode,
|
|
10758
|
+
") \u2192"
|
|
10759
|
+
] }) }, entry.mode)) });
|
|
10760
|
+
}
|
|
10761
|
+
if (provenance.promptfooUrl) {
|
|
10762
|
+
return /* @__PURE__ */ jsx39(Text35, { size: 2, children: /* @__PURE__ */ jsx39(
|
|
10763
|
+
"a",
|
|
10764
|
+
{
|
|
10765
|
+
href: provenance.promptfooUrl,
|
|
10766
|
+
rel: "noopener noreferrer",
|
|
10767
|
+
target: "_blank",
|
|
10768
|
+
children: "View in Promptfoo \u2192"
|
|
10769
|
+
}
|
|
10770
|
+
) });
|
|
10771
|
+
}
|
|
10772
|
+
return /* @__PURE__ */ jsx39(PromptfooUnavailable, { reason: "not-shared" });
|
|
10773
|
+
}
|
|
10774
|
+
var UNAVAILABLE_TOOLTIPS = {
|
|
10775
|
+
"not-shared": "No Promptfoo share link was generated for this report. This usually means the evaluation was run locally without the --share flag."
|
|
10776
|
+
};
|
|
10777
|
+
function PromptfooUnavailable({ reason }) {
|
|
10778
|
+
return /* @__PURE__ */ jsxs31(Flex22, { align: "center", gap: 2, children: [
|
|
10779
|
+
/* @__PURE__ */ jsx39(Text35, { muted: true, size: 2, children: "Promptfoo report not available" }),
|
|
10780
|
+
/* @__PURE__ */ jsx39(InfoTip, { text: UNAVAILABLE_TOOLTIPS[reason] ?? "" })
|
|
10781
|
+
] });
|
|
10782
|
+
}
|
|
10783
|
+
|
|
10784
|
+
// src/components/report-detail/RecommendationsSection.tsx
|
|
10785
|
+
import React3 from "react";
|
|
10786
|
+
import { BoltIcon } from "@sanity/icons";
|
|
10787
|
+
import { Box as Box25, Card as Card17, Flex as Flex23, Stack as Stack27, Text as Text37 } from "@sanity/ui";
|
|
10788
|
+
|
|
10789
|
+
// src/components/report-detail/failure-mode-styling.tsx
|
|
10790
|
+
import { Text as Text36 } from "@sanity/ui";
|
|
10791
|
+
import { jsx as jsx40, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
10792
|
+
var FAILURE_MODE_COLORS = {
|
|
10793
|
+
// Literacy taxonomy
|
|
10794
|
+
"missing-docs": { bg: "rgba(239,68,68,0.2)", text: "#f87171" },
|
|
10795
|
+
"incorrect-docs": { bg: "rgba(239,68,68,0.2)", text: "#f87171" },
|
|
10796
|
+
"outdated-docs": { bg: "rgba(245,158,11,0.2)", text: "#fbbf24" },
|
|
10797
|
+
"poor-structure": { bg: "rgba(245,158,11,0.2)", text: "#fbbf24" },
|
|
10798
|
+
// Cross-cutting (COMMON_FAILURE_MODES)
|
|
10799
|
+
"api-error": { bg: "rgba(107,114,128,0.2)", text: "#9ca3af" },
|
|
10800
|
+
"model-limitation": { bg: "rgba(168,85,247,0.2)", text: "#c084fc" },
|
|
10801
|
+
"false-floor": { bg: "rgba(34,197,94,0.2)", text: "#4ade80" },
|
|
10802
|
+
// MCP / spec adherence
|
|
10803
|
+
"spec-mismatch": { bg: "rgba(239,68,68,0.2)", text: "#f87171" },
|
|
10804
|
+
// Agent-harness / tool use
|
|
10805
|
+
"tool-misuse": { bg: "rgba(245,158,11,0.2)", text: "#fbbf24" },
|
|
10806
|
+
"chaotic-process": { bg: "rgba(245,158,11,0.2)", text: "#fbbf24" },
|
|
10807
|
+
"missing-recovery": { bg: "rgba(245,158,11,0.2)", text: "#fbbf24" },
|
|
10808
|
+
// Knowledge probe
|
|
10809
|
+
"factual-error": { bg: "rgba(239,68,68,0.2)", text: "#f87171" },
|
|
10810
|
+
incompleteness: { bg: "rgba(245,158,11,0.2)", text: "#fbbf24" },
|
|
10811
|
+
"currency-violation": { bg: "rgba(245,158,11,0.2)", text: "#fbbf24" },
|
|
10812
|
+
hallucination: { bg: "rgba(239,68,68,0.2)", text: "#f87171" },
|
|
10813
|
+
"missing-error-handling": { bg: "rgba(245,158,11,0.2)", text: "#fbbf24" },
|
|
10814
|
+
"over-privileged": { bg: "rgba(239,68,68,0.2)", text: "#f87171" }
|
|
10815
|
+
};
|
|
10816
|
+
var FAILURE_MODE_DESCS = {
|
|
10817
|
+
// Literacy taxonomy
|
|
10818
|
+
"missing-docs": "This feature has no documentation at all. AI agents have nothing to reference when implementing it.",
|
|
10819
|
+
"incorrect-docs": "The documentation contains factual errors \u2014 wrong API signatures, incorrect parameters, or misleading examples.",
|
|
10820
|
+
"outdated-docs": "The docs describe old APIs or deprecated patterns. AI agents follow them and produce code that doesn't work with current versions.",
|
|
10821
|
+
"poor-structure": "The docs exist but are hard to find or understand. AI agents struggle to locate the right information or misinterpret it.",
|
|
10822
|
+
// Cross-cutting modes (COMMON_FAILURE_MODES, Plan 03-02)
|
|
10823
|
+
"api-error": "The grader run failed at the infrastructure level (network, provider outage, token exhaustion). Not a documentation problem.",
|
|
10824
|
+
"model-limitation": "Docs were good (high ceiling) but the model still couldn't reach a passing score. Reflects model capability, not docs quality.",
|
|
10825
|
+
"false-floor": "The model already knew the answer without docs. Docs added no measurable lift \u2014 useful signal for prioritization, not a regression.",
|
|
10826
|
+
// MCP / spec adherence
|
|
10827
|
+
"spec-mismatch": "The implementation diverges from the MCP server spec \u2014 wrong tool signatures, missing required fields, or non-conformant response shapes.",
|
|
10828
|
+
// Agent-harness / tool use
|
|
10829
|
+
"tool-misuse": "The agent invoked a tool with wrong arguments or in an inappropriate context. Indicates docs gaps around tool semantics.",
|
|
10830
|
+
"chaotic-process": "The agent thrashed between tools without making progress \u2014 typically a sign that tool selection guidance is missing or unclear.",
|
|
10831
|
+
"missing-recovery": "The agent did not recover from a tool error or unexpected response. Docs should document failure modes alongside happy paths.",
|
|
10832
|
+
// Knowledge probe
|
|
10833
|
+
"factual-error": "The model emitted a factually wrong claim (date, version, identifier, behavior). Compare against canonical docs.",
|
|
10834
|
+
incompleteness: "The answer was on-topic but partial \u2014 covered some but not all of the asked-for facts.",
|
|
10835
|
+
"currency-violation": "The answer used outdated APIs or version-specific facts that no longer apply to the current release.",
|
|
10836
|
+
hallucination: "The answer cited or invoked something that does not exist in the documented surface.",
|
|
10837
|
+
"missing-error-handling": "The implementation omitted error handling for documented failure modes.",
|
|
10838
|
+
"over-privileged": "The implementation requested broader permissions or scopes than the task warranted."
|
|
10839
|
+
};
|
|
10840
|
+
var CONFIDENCE_DESCS = {
|
|
10841
|
+
high: "Grader emission and ceiling-decomposition signal agree (D0049 ceiling-cross-check) \u2014 this diagnosis is reliable.",
|
|
10842
|
+
medium: "Grader emission disagrees with the ceiling-decomposition signal, or the structural pattern is uninformative \u2014 likely correct but worth verifying manually.",
|
|
10843
|
+
low: "Passing score \u2014 the cross-check did not classify. Treat as absent rather than as a confirmed diagnosis."
|
|
10844
|
+
};
|
|
10845
|
+
var fmLabel = {
|
|
10846
|
+
fontWeight: 600
|
|
10847
|
+
};
|
|
10848
|
+
function failureModeTip(mode) {
|
|
10849
|
+
const desc = FAILURE_MODE_DESCS[mode];
|
|
10850
|
+
if (!desc) return GLOSSARY.failureMode;
|
|
10851
|
+
return /* @__PURE__ */ jsxs32(Text36, { size: 2, style: { lineHeight: 1.5 }, children: [
|
|
10852
|
+
/* @__PURE__ */ jsx40("span", { style: fmLabel, children: mode }),
|
|
10853
|
+
" \u2014 ",
|
|
10854
|
+
desc
|
|
10855
|
+
] });
|
|
10856
|
+
}
|
|
10857
|
+
function confidenceTip(level) {
|
|
10858
|
+
const desc = CONFIDENCE_DESCS[level];
|
|
10859
|
+
if (!desc) return GLOSSARY.confidence;
|
|
10860
|
+
const icons = { high: "\u{1F7E2}", medium: "\u{1F7E1}", low: "\u{1F534}" };
|
|
10861
|
+
return /* @__PURE__ */ jsxs32(Text36, { size: 2, style: { lineHeight: 1.5 }, children: [
|
|
10862
|
+
icons[level],
|
|
10863
|
+
" ",
|
|
10864
|
+
/* @__PURE__ */ jsxs32("span", { style: fmLabel, children: [
|
|
10865
|
+
level,
|
|
10866
|
+
" confidence"
|
|
10867
|
+
] }),
|
|
10868
|
+
" \u2014 ",
|
|
10869
|
+
desc
|
|
10870
|
+
] });
|
|
10871
|
+
}
|
|
10872
|
+
function failureModeColor(mode) {
|
|
10873
|
+
return FAILURE_MODE_COLORS[mode] ?? {
|
|
10874
|
+
bg: "var(--card-muted-bg-color)",
|
|
10875
|
+
text: "var(--card-muted-fg-color)"
|
|
10876
|
+
};
|
|
10877
|
+
}
|
|
10878
|
+
|
|
10879
|
+
// src/components/report-detail/RecommendationsSection.tsx
|
|
10880
|
+
import { jsx as jsx41, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
10881
|
+
var ACTION_CARD_TYPES = /* @__PURE__ */ new Set([
|
|
10882
|
+
"top-recommendations",
|
|
10883
|
+
"low-confidence-attribution",
|
|
10884
|
+
"doc-attribution-spotlight",
|
|
10885
|
+
"regression-vs-baseline"
|
|
10886
|
+
]);
|
|
10887
|
+
var CLAMP_4_LINES = {
|
|
10888
|
+
display: "-webkit-box",
|
|
10889
|
+
WebkitLineClamp: 4,
|
|
10890
|
+
WebkitBoxOrient: "vertical",
|
|
10891
|
+
overflow: "hidden"
|
|
10892
|
+
};
|
|
10893
|
+
var PRIORITY_COLORS = {
|
|
10894
|
+
high: { bg: "rgba(239,68,68,0.2)", text: "#f87171" },
|
|
10895
|
+
medium: { bg: "rgba(245,158,11,0.2)", text: "#fbbf24" },
|
|
10896
|
+
low: { bg: "rgba(107,114,128,0.2)", text: "#9ca3af" }
|
|
10897
|
+
};
|
|
10898
|
+
function renderTopRecommendations(body, _meta) {
|
|
10899
|
+
return /* @__PURE__ */ jsx41(Card17, { padding: 3, radius: 2, tone: "default", children: /* @__PURE__ */ jsxs33(Stack27, { space: 3, children: [
|
|
10900
|
+
/* @__PURE__ */ jsxs33(Flex23, { align: "center", gap: 2, children: [
|
|
10901
|
+
/* @__PURE__ */ jsx41(Text37, { size: 1, muted: true, weight: "semibold", children: "Top recommendations" }),
|
|
10902
|
+
/* @__PURE__ */ jsxs33(Text37, { size: 1, muted: true, children: [
|
|
10903
|
+
"(",
|
|
10904
|
+
body.suggestions.length,
|
|
10905
|
+
")"
|
|
10906
|
+
] })
|
|
10907
|
+
] }),
|
|
10908
|
+
/* @__PURE__ */ jsx41(Text37, { size: 2, children: body.summary }),
|
|
10909
|
+
/* @__PURE__ */ jsx41(Stack27, { space: 2, children: body.suggestions.map((s, i) => {
|
|
10910
|
+
const colors = PRIORITY_COLORS[s.priority] ?? {
|
|
10911
|
+
bg: "var(--card-muted-bg-color)",
|
|
10912
|
+
text: "var(--card-muted-fg-color)"
|
|
10913
|
+
};
|
|
10914
|
+
return /* @__PURE__ */ jsx41(
|
|
10915
|
+
Box25,
|
|
10916
|
+
{
|
|
10917
|
+
padding: 2,
|
|
10918
|
+
style: {
|
|
10919
|
+
borderRadius: 4,
|
|
10920
|
+
border: "1px solid var(--card-border-color)"
|
|
10921
|
+
},
|
|
10922
|
+
children: /* @__PURE__ */ jsxs33(Stack27, { space: 2, children: [
|
|
10923
|
+
/* @__PURE__ */ jsxs33(Flex23, { align: "center", gap: 2, children: [
|
|
10924
|
+
/* @__PURE__ */ jsx41(
|
|
10925
|
+
"span",
|
|
10926
|
+
{
|
|
10927
|
+
style: {
|
|
10928
|
+
backgroundColor: colors.bg,
|
|
10929
|
+
borderRadius: 4,
|
|
10930
|
+
color: colors.text,
|
|
10931
|
+
fontSize: 12,
|
|
10932
|
+
fontWeight: 600,
|
|
10933
|
+
padding: "2px 6px",
|
|
10934
|
+
textTransform: "uppercase"
|
|
10935
|
+
},
|
|
10936
|
+
children: s.priority
|
|
10937
|
+
}
|
|
10938
|
+
),
|
|
10939
|
+
/* @__PURE__ */ jsx41(Text37, { size: 2, weight: "semibold", children: s.title })
|
|
10940
|
+
] }),
|
|
10941
|
+
/* @__PURE__ */ jsx41(Text37, { size: 2, muted: true, style: CLAMP_4_LINES, children: s.body }),
|
|
10942
|
+
/* @__PURE__ */ jsxs33(Text37, { size: 1, muted: true, children: [
|
|
10943
|
+
s.docSlug,
|
|
10944
|
+
s.sectionHeading !== null ? ` \xB7 ${s.sectionHeading}` : ""
|
|
10945
|
+
] })
|
|
10946
|
+
] })
|
|
10947
|
+
},
|
|
10948
|
+
`sugg-${i}`
|
|
10949
|
+
);
|
|
10950
|
+
}) })
|
|
10951
|
+
] }) });
|
|
10952
|
+
}
|
|
10953
|
+
function renderLowConfidenceAttribution(body, _meta) {
|
|
10954
|
+
return /* @__PURE__ */ jsx41(Card17, { padding: 3, radius: 2, tone: "default", children: /* @__PURE__ */ jsxs33(Stack27, { space: 2, children: [
|
|
10955
|
+
/* @__PURE__ */ jsxs33(Flex23, { align: "center", gap: 2, children: [
|
|
10956
|
+
/* @__PURE__ */ jsx41(Text37, { size: 1, muted: true, weight: "semibold", children: "Low-confidence attribution" }),
|
|
10957
|
+
/* @__PURE__ */ jsxs33(Text37, { size: 1, muted: true, children: [
|
|
10958
|
+
"(",
|
|
10959
|
+
body.judgmentRefs.length,
|
|
10960
|
+
")"
|
|
10961
|
+
] })
|
|
10962
|
+
] }),
|
|
10963
|
+
/* @__PURE__ */ jsx41(Text37, { size: 2, style: CLAMP_4_LINES, children: body.summary }),
|
|
10964
|
+
/* @__PURE__ */ jsx41(Stack27, { space: 1, children: body.judgmentRefs.map((ref, i) => /* @__PURE__ */ jsxs33(Text37, { size: 1, muted: true, children: [
|
|
10965
|
+
ref.taskId,
|
|
10966
|
+
" \xB7 ",
|
|
10967
|
+
ref.modelId,
|
|
10968
|
+
" \xB7 ",
|
|
10969
|
+
ref.dimension
|
|
10970
|
+
] }, `jref-${i}`)) })
|
|
10971
|
+
] }) });
|
|
10972
|
+
}
|
|
10973
|
+
function renderDocAttributionSpotlight(body, _meta) {
|
|
10974
|
+
return /* @__PURE__ */ jsx41(Card17, { padding: 3, radius: 2, tone: "default", children: /* @__PURE__ */ jsxs33(Stack27, { space: 2, children: [
|
|
10975
|
+
/* @__PURE__ */ jsx41(Text37, { size: 1, muted: true, weight: "semibold", children: "Doc attribution spotlight" }),
|
|
10976
|
+
/* @__PURE__ */ jsx41(Text37, { size: 2, children: body.summary }),
|
|
10977
|
+
/* @__PURE__ */ jsx41(Stack27, { space: 1, children: body.docCitations.map((c, i) => /* @__PURE__ */ jsxs33(Flex23, { align: "center", gap: 2, children: [
|
|
10978
|
+
/* @__PURE__ */ jsx41(Text37, { size: 2, children: c.docSlug }),
|
|
10979
|
+
/* @__PURE__ */ jsx41(Text37, { size: 1, muted: true, children: c.role }),
|
|
10980
|
+
/* @__PURE__ */ jsx41(HoverTip, { text: confidenceTip(c.confidence), children: /* @__PURE__ */ jsx41(Text37, { size: 1, muted: true, children: c.confidence }) })
|
|
10981
|
+
] }, `doc-${i}`)) })
|
|
10982
|
+
] }) });
|
|
10983
|
+
}
|
|
10984
|
+
function renderRegressionVsBaseline(body, _meta) {
|
|
10985
|
+
return /* @__PURE__ */ jsx41(Card17, { padding: 3, radius: 2, tone: "default", children: /* @__PURE__ */ jsxs33(Stack27, { space: 2, children: [
|
|
10986
|
+
/* @__PURE__ */ jsxs33(Flex23, { align: "center", gap: 2, children: [
|
|
10987
|
+
/* @__PURE__ */ jsx41(Text37, { size: 1, muted: true, weight: "semibold", children: "Regression vs baseline" }),
|
|
10988
|
+
/* @__PURE__ */ jsxs33(Text37, { size: 1, muted: true, children: [
|
|
10989
|
+
"(",
|
|
10990
|
+
body.overallTrend,
|
|
10732
10991
|
")"
|
|
10733
10992
|
] })
|
|
10734
10993
|
] }),
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10994
|
+
/* @__PURE__ */ jsx41(Text37, { size: 2, children: body.summary }),
|
|
10995
|
+
/* @__PURE__ */ jsx41(Stack27, { space: 1, children: body.deltas.map((d, i) => {
|
|
10996
|
+
const arrow = d.direction === "improved" ? "\u2191" : d.direction === "regressed" ? "\u2193" : "\u2192";
|
|
10997
|
+
const deltaColor = d.pointsDelta > 0 ? "#34d399" : d.pointsDelta < 0 ? "#f87171" : "var(--card-muted-fg-color)";
|
|
10998
|
+
const driverPreview = d.drivers[0] ?? "";
|
|
10999
|
+
const colors = failureModeColor(driverPreview);
|
|
11000
|
+
return /* @__PURE__ */ jsxs33(Flex23, { align: "center", gap: 2, children: [
|
|
11001
|
+
/* @__PURE__ */ jsx41(Text37, { size: 2, weight: "medium", children: d.area }),
|
|
11002
|
+
/* @__PURE__ */ jsxs33(
|
|
11003
|
+
"span",
|
|
11004
|
+
{
|
|
11005
|
+
style: {
|
|
11006
|
+
color: deltaColor,
|
|
11007
|
+
fontFamily: "var(--font-code-size, monospace)",
|
|
11008
|
+
fontSize: 14,
|
|
11009
|
+
fontWeight: 600
|
|
11010
|
+
},
|
|
11011
|
+
children: [
|
|
11012
|
+
arrow,
|
|
11013
|
+
" ",
|
|
11014
|
+
d.pointsDelta > 0 ? "+" : "",
|
|
11015
|
+
d.pointsDelta.toFixed(1)
|
|
11016
|
+
]
|
|
11017
|
+
}
|
|
11018
|
+
),
|
|
11019
|
+
driverPreview && /* @__PURE__ */ jsx41(
|
|
11020
|
+
"span",
|
|
11021
|
+
{
|
|
11022
|
+
style: {
|
|
11023
|
+
backgroundColor: colors.bg,
|
|
11024
|
+
borderRadius: 4,
|
|
11025
|
+
color: colors.text,
|
|
11026
|
+
fontSize: 12,
|
|
11027
|
+
padding: "2px 6px"
|
|
11028
|
+
},
|
|
11029
|
+
children: driverPreview
|
|
11030
|
+
}
|
|
11031
|
+
)
|
|
11032
|
+
] }, `delta-${i}`);
|
|
11033
|
+
}) })
|
|
11034
|
+
] }) });
|
|
10747
11035
|
}
|
|
10748
|
-
function
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
/* @__PURE__ */ jsxs31(Text35, { size: 2, children: [
|
|
10756
|
-
/* @__PURE__ */ jsx39("a", { href: repoUrl, rel: "noopener noreferrer", target: "_blank", children: git.repo }),
|
|
10757
|
-
" / ",
|
|
10758
|
-
/* @__PURE__ */ jsx39("a", { href: branchUrl, rel: "noopener noreferrer", target: "_blank", children: git.branch })
|
|
10759
|
-
] }),
|
|
10760
|
-
/* @__PURE__ */ jsx39(Text35, { muted: true, size: 2, style: { fontFamily: "monospace" }, children: /* @__PURE__ */ jsx39("a", { href: commitUrl, rel: "noopener noreferrer", target: "_blank", children: git.sha.slice(0, 12) }) }),
|
|
10761
|
-
prUrl && /* @__PURE__ */ jsx39(Text35, { size: 2, children: /* @__PURE__ */ jsxs31("a", { href: prUrl, rel: "noopener noreferrer", target: "_blank", children: [
|
|
10762
|
-
"PR #",
|
|
10763
|
-
git.prNumber,
|
|
10764
|
-
" \u2192"
|
|
10765
|
-
] }) })
|
|
11036
|
+
function renderDegradedCard(card) {
|
|
11037
|
+
return /* @__PURE__ */ jsx41(Card17, { padding: 2, radius: 2, tone: "caution", children: /* @__PURE__ */ jsxs33(Text37, { size: 1, muted: true, children: [
|
|
11038
|
+
"Card unavailable: ",
|
|
11039
|
+
card.cardType,
|
|
11040
|
+
" (",
|
|
11041
|
+
card.reason,
|
|
11042
|
+
")"
|
|
10766
11043
|
] }) });
|
|
10767
11044
|
}
|
|
10768
|
-
function
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
return /* @__PURE__ */ jsx39(Flex22, { align: "center", gap: 3, wrap: "wrap", children: provenance.promptfooUrls.map((entry) => /* @__PURE__ */ jsx39(Text35, { size: 2, children: /* @__PURE__ */ jsxs31("a", { href: entry.url, rel: "noopener noreferrer", target: "_blank", children: [
|
|
10773
|
-
"View in Promptfoo (",
|
|
10774
|
-
entry.mode,
|
|
10775
|
-
") \u2192"
|
|
10776
|
-
] }) }, entry.mode)) });
|
|
11045
|
+
function RecommendationsSection(props) {
|
|
11046
|
+
const { cards, availability } = props;
|
|
11047
|
+
if (availability !== "ready" && availability !== "degraded") {
|
|
11048
|
+
return null;
|
|
10777
11049
|
}
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
11050
|
+
const matched = cards.filter(
|
|
11051
|
+
(c) => (c.status === "ready" || c.status === "degraded") && ACTION_CARD_TYPES.has(c.cardType)
|
|
11052
|
+
);
|
|
11053
|
+
if (matched.length === 0) return null;
|
|
11054
|
+
return /* @__PURE__ */ jsx41(Card17, { padding: 4, radius: 2, shadow: 1, style: neutralCardStyle, children: /* @__PURE__ */ jsxs33(Stack27, { space: 4, children: [
|
|
11055
|
+
/* @__PURE__ */ jsxs33(Flex23, { align: "center", gap: 2, children: [
|
|
11056
|
+
/* @__PURE__ */ jsx41(BoltIcon, { style: { color: "#fbbf24" } }),
|
|
11057
|
+
/* @__PURE__ */ jsx41(Text37, { size: 2, weight: "semibold", children: "Recommendations" })
|
|
11058
|
+
] }),
|
|
11059
|
+
/* @__PURE__ */ jsx41(Box25, { style: dividerStyle }),
|
|
11060
|
+
/* @__PURE__ */ jsx41(Stack27, { space: 3, children: matched.map((card, idx) => {
|
|
11061
|
+
const key = `action-${idx}`;
|
|
11062
|
+
if (card.status === "degraded") {
|
|
11063
|
+
return /* @__PURE__ */ jsx41(React3.Fragment, { children: renderDegradedCard(card) }, key);
|
|
10786
11064
|
}
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
};
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
11065
|
+
switch (card.cardType) {
|
|
11066
|
+
case "top-recommendations":
|
|
11067
|
+
return /* @__PURE__ */ jsx41(React3.Fragment, { children: renderTopRecommendations(card.body, card.meta) }, key);
|
|
11068
|
+
case "low-confidence-attribution":
|
|
11069
|
+
return /* @__PURE__ */ jsx41(React3.Fragment, { children: renderLowConfidenceAttribution(card.body, card.meta) }, key);
|
|
11070
|
+
case "doc-attribution-spotlight":
|
|
11071
|
+
return /* @__PURE__ */ jsx41(React3.Fragment, { children: renderDocAttributionSpotlight(card.body, card.meta) }, key);
|
|
11072
|
+
case "regression-vs-baseline":
|
|
11073
|
+
return /* @__PURE__ */ jsx41(React3.Fragment, { children: renderRegressionVsBaseline(card.body, card.meta) }, key);
|
|
11074
|
+
default:
|
|
11075
|
+
return null;
|
|
11076
|
+
}
|
|
11077
|
+
}) })
|
|
11078
|
+
] }) });
|
|
10799
11079
|
}
|
|
10800
11080
|
|
|
10801
11081
|
// src/components/report-detail/report-actions/ActionButton.tsx
|
|
10802
11082
|
import { Button as Button7, useToast as useToast2 } from "@sanity/ui";
|
|
10803
|
-
import { jsx as
|
|
11083
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
10804
11084
|
|
|
10805
11085
|
// src/components/report-detail/report-actions/JudgmentActions.tsx
|
|
10806
11086
|
import { DocumentTextIcon, LinkIcon as LinkIcon3 } from "@sanity/icons";
|
|
@@ -10809,16 +11089,16 @@ import { useCallback as useCallback26 } from "react";
|
|
|
10809
11089
|
|
|
10810
11090
|
// src/components/report-detail/report-actions/SplitActionButton.tsx
|
|
10811
11091
|
import { ChevronDownIcon as ChevronDownIcon4 } from "@sanity/icons";
|
|
10812
|
-
import { Button as Button8, Flex as
|
|
10813
|
-
import { jsx as
|
|
11092
|
+
import { Button as Button8, Flex as Flex24, Menu as Menu2, MenuButton as MenuButton2 } from "@sanity/ui";
|
|
11093
|
+
import { jsx as jsx43, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
10814
11094
|
function SplitActionButton({
|
|
10815
11095
|
menu,
|
|
10816
11096
|
menuId,
|
|
10817
11097
|
placement = "bottom-end",
|
|
10818
11098
|
primary
|
|
10819
11099
|
}) {
|
|
10820
|
-
return /* @__PURE__ */
|
|
10821
|
-
/* @__PURE__ */
|
|
11100
|
+
return /* @__PURE__ */ jsxs34(Flex24, { children: [
|
|
11101
|
+
/* @__PURE__ */ jsx43(
|
|
10822
11102
|
Button8,
|
|
10823
11103
|
{
|
|
10824
11104
|
fontSize: primary.fontSize,
|
|
@@ -10835,10 +11115,10 @@ function SplitActionButton({
|
|
|
10835
11115
|
text: primary.text
|
|
10836
11116
|
}
|
|
10837
11117
|
),
|
|
10838
|
-
/* @__PURE__ */
|
|
11118
|
+
/* @__PURE__ */ jsx43(
|
|
10839
11119
|
MenuButton2,
|
|
10840
11120
|
{
|
|
10841
|
-
button: /* @__PURE__ */
|
|
11121
|
+
button: /* @__PURE__ */ jsx43(
|
|
10842
11122
|
Button8,
|
|
10843
11123
|
{
|
|
10844
11124
|
icon: ChevronDownIcon4,
|
|
@@ -10852,7 +11132,7 @@ function SplitActionButton({
|
|
|
10852
11132
|
}
|
|
10853
11133
|
),
|
|
10854
11134
|
id: menuId,
|
|
10855
|
-
menu: /* @__PURE__ */
|
|
11135
|
+
menu: /* @__PURE__ */ jsx43(Menu2, { children: menu }),
|
|
10856
11136
|
popover: { placement, portal: true }
|
|
10857
11137
|
}
|
|
10858
11138
|
)
|
|
@@ -10860,7 +11140,7 @@ function SplitActionButton({
|
|
|
10860
11140
|
}
|
|
10861
11141
|
|
|
10862
11142
|
// src/components/report-detail/report-actions/JudgmentActions.tsx
|
|
10863
|
-
import { Fragment as Fragment12, jsx as
|
|
11143
|
+
import { Fragment as Fragment12, jsx as jsx44, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
10864
11144
|
function JudgmentActions({ onShowPrompts } = {}) {
|
|
10865
11145
|
const toast = useToast3();
|
|
10866
11146
|
const handleCopyLink = useCallback26(() => {
|
|
@@ -10881,12 +11161,12 @@ function JudgmentActions({ onShowPrompts } = {}) {
|
|
|
10881
11161
|
}
|
|
10882
11162
|
);
|
|
10883
11163
|
}, [toast]);
|
|
10884
|
-
return /* @__PURE__ */
|
|
11164
|
+
return /* @__PURE__ */ jsx44(
|
|
10885
11165
|
SplitActionButton,
|
|
10886
11166
|
{
|
|
10887
|
-
menu: /* @__PURE__ */
|
|
10888
|
-
onShowPrompts && /* @__PURE__ */
|
|
10889
|
-
/* @__PURE__ */
|
|
11167
|
+
menu: /* @__PURE__ */ jsxs35(Fragment12, { children: [
|
|
11168
|
+
onShowPrompts && /* @__PURE__ */ jsxs35(Fragment12, { children: [
|
|
11169
|
+
/* @__PURE__ */ jsx44(
|
|
10890
11170
|
MenuItem2,
|
|
10891
11171
|
{
|
|
10892
11172
|
icon: DocumentTextIcon,
|
|
@@ -10894,9 +11174,9 @@ function JudgmentActions({ onShowPrompts } = {}) {
|
|
|
10894
11174
|
text: "Show prompts"
|
|
10895
11175
|
}
|
|
10896
11176
|
),
|
|
10897
|
-
/* @__PURE__ */
|
|
11177
|
+
/* @__PURE__ */ jsx44(MenuDivider2, {})
|
|
10898
11178
|
] }),
|
|
10899
|
-
/* @__PURE__ */
|
|
11179
|
+
/* @__PURE__ */ jsx44(MenuItem2, { icon: LinkIcon3, onClick: handleCopyLink, text: "Copy link" })
|
|
10900
11180
|
] }),
|
|
10901
11181
|
menuId: "judgment-actions-menu",
|
|
10902
11182
|
primary: {
|
|
@@ -10921,7 +11201,7 @@ import { ClipboardIcon } from "@sanity/icons";
|
|
|
10921
11201
|
import { MenuItem as MenuItem3, useToast as useToast4 } from "@sanity/ui";
|
|
10922
11202
|
import { useCallback as useCallback27, useState as useState21 } from "react";
|
|
10923
11203
|
import { useClient as useClient8 } from "sanity";
|
|
10924
|
-
import { jsx as
|
|
11204
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
10925
11205
|
function CopyReportAction({ documentId }) {
|
|
10926
11206
|
const client = useClient8({ apiVersion: API_VERSION });
|
|
10927
11207
|
const toast = useToast4();
|
|
@@ -10958,7 +11238,7 @@ function CopyReportAction({ documentId }) {
|
|
|
10958
11238
|
setCopying(false);
|
|
10959
11239
|
}
|
|
10960
11240
|
}, [client, documentId, toast]);
|
|
10961
|
-
return /* @__PURE__ */
|
|
11241
|
+
return /* @__PURE__ */ jsx45(
|
|
10962
11242
|
MenuItem3,
|
|
10963
11243
|
{
|
|
10964
11244
|
disabled: copying,
|
|
@@ -10973,7 +11253,7 @@ function CopyReportAction({ documentId }) {
|
|
|
10973
11253
|
import { CopyIcon as CopyIcon2 } from "@sanity/icons";
|
|
10974
11254
|
import { MenuItem as MenuItem4, useToast as useToast5 } from "@sanity/ui";
|
|
10975
11255
|
import { useCallback as useCallback28 } from "react";
|
|
10976
|
-
import { jsx as
|
|
11256
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
10977
11257
|
function CopyReportIdAction({ reportId }) {
|
|
10978
11258
|
const toast = useToast5();
|
|
10979
11259
|
const handleClick = useCallback28(() => {
|
|
@@ -10994,14 +11274,14 @@ function CopyReportIdAction({ reportId }) {
|
|
|
10994
11274
|
}
|
|
10995
11275
|
);
|
|
10996
11276
|
}, [reportId, toast]);
|
|
10997
|
-
return /* @__PURE__ */
|
|
11277
|
+
return /* @__PURE__ */ jsx46(MenuItem4, { icon: CopyIcon2, onClick: handleClick, text: "Copy report ID" });
|
|
10998
11278
|
}
|
|
10999
11279
|
|
|
11000
11280
|
// src/components/report-detail/report-actions/CopyVisionQueryAction.tsx
|
|
11001
11281
|
import { SearchIcon as SearchIcon7 } from "@sanity/icons";
|
|
11002
11282
|
import { MenuItem as MenuItem5, useToast as useToast6 } from "@sanity/ui";
|
|
11003
11283
|
import { useCallback as useCallback29 } from "react";
|
|
11004
|
-
import { jsx as
|
|
11284
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
11005
11285
|
function CopyVisionQueryAction({
|
|
11006
11286
|
reportId
|
|
11007
11287
|
}) {
|
|
@@ -11026,7 +11306,7 @@ function CopyVisionQueryAction({
|
|
|
11026
11306
|
}
|
|
11027
11307
|
);
|
|
11028
11308
|
}, [reportId, toast]);
|
|
11029
|
-
return /* @__PURE__ */
|
|
11309
|
+
return /* @__PURE__ */ jsx47(
|
|
11030
11310
|
MenuItem5,
|
|
11031
11311
|
{
|
|
11032
11312
|
icon: SearchIcon7,
|
|
@@ -11037,25 +11317,25 @@ function CopyVisionQueryAction({
|
|
|
11037
11317
|
}
|
|
11038
11318
|
|
|
11039
11319
|
// src/components/report-detail/report-actions/DeleteConfirmDialog.tsx
|
|
11040
|
-
import { Box as
|
|
11041
|
-
import { jsx as
|
|
11320
|
+
import { Box as Box26, Button as Button9, Card as Card18, Dialog as Dialog2, Flex as Flex25, Stack as Stack28, Text as Text38 } from "@sanity/ui";
|
|
11321
|
+
import { jsx as jsx48, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
11042
11322
|
function DeleteConfirmDialog({
|
|
11043
11323
|
isDeleting,
|
|
11044
11324
|
onClose,
|
|
11045
11325
|
onConfirm,
|
|
11046
11326
|
reportId
|
|
11047
11327
|
}) {
|
|
11048
|
-
return /* @__PURE__ */
|
|
11328
|
+
return /* @__PURE__ */ jsx48(
|
|
11049
11329
|
Dialog2,
|
|
11050
11330
|
{
|
|
11051
11331
|
header: "Delete Report",
|
|
11052
11332
|
id: "delete-report-dialog",
|
|
11053
11333
|
onClose,
|
|
11054
11334
|
width: 1,
|
|
11055
|
-
children: /* @__PURE__ */
|
|
11056
|
-
/* @__PURE__ */
|
|
11057
|
-
/* @__PURE__ */
|
|
11058
|
-
|
|
11335
|
+
children: /* @__PURE__ */ jsx48(Box26, { padding: 4, children: /* @__PURE__ */ jsxs36(Stack28, { space: 4, children: [
|
|
11336
|
+
/* @__PURE__ */ jsx48(Text38, { children: "Are you sure you want to delete this report? This action cannot be undone." }),
|
|
11337
|
+
/* @__PURE__ */ jsx48(Card18, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx48(
|
|
11338
|
+
Text38,
|
|
11059
11339
|
{
|
|
11060
11340
|
muted: true,
|
|
11061
11341
|
size: 1,
|
|
@@ -11063,8 +11343,8 @@ function DeleteConfirmDialog({
|
|
|
11063
11343
|
children: reportId
|
|
11064
11344
|
}
|
|
11065
11345
|
) }),
|
|
11066
|
-
/* @__PURE__ */
|
|
11067
|
-
/* @__PURE__ */
|
|
11346
|
+
/* @__PURE__ */ jsxs36(Flex25, { gap: 2, justify: "flex-end", children: [
|
|
11347
|
+
/* @__PURE__ */ jsx48(
|
|
11068
11348
|
Button9,
|
|
11069
11349
|
{
|
|
11070
11350
|
disabled: isDeleting,
|
|
@@ -11073,7 +11353,7 @@ function DeleteConfirmDialog({
|
|
|
11073
11353
|
text: "Cancel"
|
|
11074
11354
|
}
|
|
11075
11355
|
),
|
|
11076
|
-
/* @__PURE__ */
|
|
11356
|
+
/* @__PURE__ */ jsx48(
|
|
11077
11357
|
Button9,
|
|
11078
11358
|
{
|
|
11079
11359
|
disabled: isDeleting,
|
|
@@ -11091,11 +11371,11 @@ function DeleteConfirmDialog({
|
|
|
11091
11371
|
// src/components/report-detail/report-actions/DeleteReportAction.tsx
|
|
11092
11372
|
import { TrashIcon } from "@sanity/icons";
|
|
11093
11373
|
import { MenuItem as MenuItem6 } from "@sanity/ui";
|
|
11094
|
-
import { jsx as
|
|
11374
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
11095
11375
|
function DeleteReportAction({
|
|
11096
11376
|
onRequestDelete
|
|
11097
11377
|
}) {
|
|
11098
|
-
return /* @__PURE__ */
|
|
11378
|
+
return /* @__PURE__ */ jsx49(
|
|
11099
11379
|
MenuItem6,
|
|
11100
11380
|
{
|
|
11101
11381
|
icon: TrashIcon,
|
|
@@ -11111,7 +11391,7 @@ import { DownloadIcon } from "@sanity/icons";
|
|
|
11111
11391
|
import { MenuItem as MenuItem7, useToast as useToast7 } from "@sanity/ui";
|
|
11112
11392
|
import { useCallback as useCallback30, useState as useState22 } from "react";
|
|
11113
11393
|
import { useClient as useClient9 } from "sanity";
|
|
11114
|
-
import { jsx as
|
|
11394
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
11115
11395
|
function DownloadReportAction({
|
|
11116
11396
|
documentId,
|
|
11117
11397
|
reportId
|
|
@@ -11159,7 +11439,7 @@ function DownloadReportAction({
|
|
|
11159
11439
|
setDownloading(false);
|
|
11160
11440
|
}
|
|
11161
11441
|
}, [client, documentId, reportId, toast]);
|
|
11162
|
-
return /* @__PURE__ */
|
|
11442
|
+
return /* @__PURE__ */ jsx50(
|
|
11163
11443
|
MenuItem7,
|
|
11164
11444
|
{
|
|
11165
11445
|
disabled: downloading,
|
|
@@ -11189,7 +11469,7 @@ function extractEvalScope(provenance) {
|
|
|
11189
11469
|
}
|
|
11190
11470
|
|
|
11191
11471
|
// src/components/report-detail/report-actions/RerunEvaluationAction.tsx
|
|
11192
|
-
import { jsx as
|
|
11472
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
11193
11473
|
var EVAL_REQUEST_TYPE2 = "ailf.evalRequest";
|
|
11194
11474
|
function slugify2(s) {
|
|
11195
11475
|
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
|
|
@@ -11256,7 +11536,7 @@ function RerunEvaluationAction({
|
|
|
11256
11536
|
setRequesting(false);
|
|
11257
11537
|
}
|
|
11258
11538
|
}, [client, currentUser?.id, provenance, reportId, toast]);
|
|
11259
|
-
return /* @__PURE__ */
|
|
11539
|
+
return /* @__PURE__ */ jsx51(
|
|
11260
11540
|
MenuItem8,
|
|
11261
11541
|
{
|
|
11262
11542
|
disabled: requesting,
|
|
@@ -11271,7 +11551,7 @@ function RerunEvaluationAction({
|
|
|
11271
11551
|
import { LaunchIcon } from "@sanity/icons";
|
|
11272
11552
|
import { MenuItem as MenuItem9 } from "@sanity/ui";
|
|
11273
11553
|
import { useCallback as useCallback32 } from "react";
|
|
11274
|
-
import { jsx as
|
|
11554
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
11275
11555
|
function commonPathPrefix(paths) {
|
|
11276
11556
|
if (paths.length === 0) return "";
|
|
11277
11557
|
const segmented = paths.map((p) => p.split("/").filter(Boolean));
|
|
@@ -11309,7 +11589,7 @@ function ViewArtifactsAction({ manifest }) {
|
|
|
11309
11589
|
if (url) window.open(url, "_blank", "noopener,noreferrer");
|
|
11310
11590
|
}, [url]);
|
|
11311
11591
|
if (!url) return null;
|
|
11312
|
-
return /* @__PURE__ */
|
|
11592
|
+
return /* @__PURE__ */ jsx52(
|
|
11313
11593
|
MenuItem9,
|
|
11314
11594
|
{
|
|
11315
11595
|
icon: LaunchIcon,
|
|
@@ -11320,7 +11600,7 @@ function ViewArtifactsAction({ manifest }) {
|
|
|
11320
11600
|
}
|
|
11321
11601
|
|
|
11322
11602
|
// src/components/report-detail/report-actions/ReportActions.tsx
|
|
11323
|
-
import { Fragment as Fragment13, jsx as
|
|
11603
|
+
import { Fragment as Fragment13, jsx as jsx53, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
11324
11604
|
function ReportActions({
|
|
11325
11605
|
artifactManifest,
|
|
11326
11606
|
documentId,
|
|
@@ -11377,26 +11657,26 @@ function ReportActions({
|
|
|
11377
11657
|
setDeleting(false);
|
|
11378
11658
|
}
|
|
11379
11659
|
}, [client, documentId, onDeleted, toast]);
|
|
11380
|
-
return /* @__PURE__ */
|
|
11381
|
-
/* @__PURE__ */
|
|
11660
|
+
return /* @__PURE__ */ jsxs37(Fragment13, { children: [
|
|
11661
|
+
/* @__PURE__ */ jsx53(
|
|
11382
11662
|
SplitActionButton,
|
|
11383
11663
|
{
|
|
11384
|
-
menu: /* @__PURE__ */
|
|
11385
|
-
/* @__PURE__ */
|
|
11386
|
-
/* @__PURE__ */
|
|
11664
|
+
menu: /* @__PURE__ */ jsxs37(Fragment13, { children: [
|
|
11665
|
+
/* @__PURE__ */ jsx53(CopyReportIdAction, { reportId }),
|
|
11666
|
+
/* @__PURE__ */ jsx53(
|
|
11387
11667
|
RerunEvaluationAction,
|
|
11388
11668
|
{
|
|
11389
11669
|
provenance,
|
|
11390
11670
|
reportId
|
|
11391
11671
|
}
|
|
11392
11672
|
),
|
|
11393
|
-
/* @__PURE__ */
|
|
11394
|
-
/* @__PURE__ */
|
|
11395
|
-
/* @__PURE__ */
|
|
11396
|
-
/* @__PURE__ */
|
|
11397
|
-
/* @__PURE__ */
|
|
11398
|
-
/* @__PURE__ */
|
|
11399
|
-
/* @__PURE__ */
|
|
11673
|
+
/* @__PURE__ */ jsx53(MenuDivider3, {}),
|
|
11674
|
+
/* @__PURE__ */ jsx53(DownloadReportAction, { documentId, reportId }),
|
|
11675
|
+
/* @__PURE__ */ jsx53(ViewArtifactsAction, { manifest: artifactManifest }),
|
|
11676
|
+
/* @__PURE__ */ jsx53(CopyReportAction, { documentId }),
|
|
11677
|
+
/* @__PURE__ */ jsx53(CopyVisionQueryAction, { reportId }),
|
|
11678
|
+
/* @__PURE__ */ jsx53(MenuDivider3, {}),
|
|
11679
|
+
/* @__PURE__ */ jsx53(DeleteReportAction, { onRequestDelete: handleRequestDelete })
|
|
11400
11680
|
] }),
|
|
11401
11681
|
menuId: "report-actions-menu",
|
|
11402
11682
|
primary: {
|
|
@@ -11406,7 +11686,7 @@ function ReportActions({
|
|
|
11406
11686
|
}
|
|
11407
11687
|
}
|
|
11408
11688
|
),
|
|
11409
|
-
deleteDialogOpen && /* @__PURE__ */
|
|
11689
|
+
deleteDialogOpen && /* @__PURE__ */ jsx53(
|
|
11410
11690
|
DeleteConfirmDialog,
|
|
11411
11691
|
{
|
|
11412
11692
|
isDeleting: deleting,
|
|
@@ -11420,8 +11700,8 @@ function ReportActions({
|
|
|
11420
11700
|
|
|
11421
11701
|
// src/components/report-detail/ReportHeader.tsx
|
|
11422
11702
|
import { ArrowLeftIcon as ArrowLeftIcon2 } from "@sanity/icons";
|
|
11423
|
-
import { Button as Button10, Flex as
|
|
11424
|
-
import { jsx as
|
|
11703
|
+
import { Button as Button10, Flex as Flex26, Stack as Stack29, Text as Text39 } from "@sanity/ui";
|
|
11704
|
+
import { jsx as jsx54, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
11425
11705
|
function ReportHeader({
|
|
11426
11706
|
completedAt,
|
|
11427
11707
|
onBack,
|
|
@@ -11431,29 +11711,149 @@ function ReportHeader({
|
|
|
11431
11711
|
const dateLabel = formatCardDate(completedAt);
|
|
11432
11712
|
const displayTitle = title ?? tag ?? dateLabel;
|
|
11433
11713
|
const hasSubtitle = Boolean(title ?? tag);
|
|
11434
|
-
return /* @__PURE__ */
|
|
11435
|
-
/* @__PURE__ */
|
|
11436
|
-
/* @__PURE__ */
|
|
11437
|
-
/* @__PURE__ */
|
|
11438
|
-
hasSubtitle && /* @__PURE__ */
|
|
11714
|
+
return /* @__PURE__ */ jsxs38(Flex26, { align: "center", gap: 3, children: [
|
|
11715
|
+
/* @__PURE__ */ jsx54(Button10, { icon: ArrowLeftIcon2, mode: "bleed", onClick: onBack, text: "Back" }),
|
|
11716
|
+
/* @__PURE__ */ jsxs38(Stack29, { flex: 1, space: 1, children: [
|
|
11717
|
+
/* @__PURE__ */ jsx54(Text39, { size: 4, weight: "bold", children: displayTitle }),
|
|
11718
|
+
hasSubtitle && /* @__PURE__ */ jsx54(Text39, { muted: true, size: 2, children: dateLabel })
|
|
11439
11719
|
] })
|
|
11440
11720
|
] });
|
|
11441
11721
|
}
|
|
11442
11722
|
|
|
11723
|
+
// src/components/report-detail/ScoreInterpretationPanel.tsx
|
|
11724
|
+
import React4 from "react";
|
|
11725
|
+
import { Box as Box27, Card as Card19, Flex as Flex27, Stack as Stack30, Text as Text40 } from "@sanity/ui";
|
|
11726
|
+
import { jsx as jsx55, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
11727
|
+
var INTERPRETIVE_CARD_TYPES = /* @__PURE__ */ new Set([
|
|
11728
|
+
"area-summary",
|
|
11729
|
+
"failure-mode-summary",
|
|
11730
|
+
"weakest-area"
|
|
11731
|
+
]);
|
|
11732
|
+
var CLAMP_5_LINES = {
|
|
11733
|
+
display: "-webkit-box",
|
|
11734
|
+
WebkitLineClamp: 5,
|
|
11735
|
+
WebkitBoxOrient: "vertical",
|
|
11736
|
+
overflow: "hidden"
|
|
11737
|
+
};
|
|
11738
|
+
function renderAreaSummary(body, _meta) {
|
|
11739
|
+
return /* @__PURE__ */ jsx55(Card19, { padding: 3, radius: 2, tone: "default", children: /* @__PURE__ */ jsxs39(Stack30, { space: 2, children: [
|
|
11740
|
+
/* @__PURE__ */ jsx55(Text40, { size: 1, muted: true, weight: "semibold", children: "Area summary" }),
|
|
11741
|
+
/* @__PURE__ */ jsx55(Text40, { size: 2, children: body.summary })
|
|
11742
|
+
] }) });
|
|
11743
|
+
}
|
|
11744
|
+
function renderFailureModeSummary(body, _meta) {
|
|
11745
|
+
const colors = failureModeColor(body.failureMode);
|
|
11746
|
+
return /* @__PURE__ */ jsx55(Card19, { padding: 3, radius: 2, tone: "default", children: /* @__PURE__ */ jsxs39(Stack30, { space: 2, children: [
|
|
11747
|
+
/* @__PURE__ */ jsxs39(Flex27, { align: "center", gap: 2, children: [
|
|
11748
|
+
/* @__PURE__ */ jsx55(Text40, { size: 1, muted: true, weight: "semibold", children: "Failure mode" }),
|
|
11749
|
+
/* @__PURE__ */ jsx55(HoverTip, { text: failureModeTip(body.failureMode), children: /* @__PURE__ */ jsx55(
|
|
11750
|
+
"span",
|
|
11751
|
+
{
|
|
11752
|
+
style: {
|
|
11753
|
+
backgroundColor: colors.bg,
|
|
11754
|
+
borderRadius: 4,
|
|
11755
|
+
color: colors.text,
|
|
11756
|
+
fontSize: 13,
|
|
11757
|
+
fontWeight: 500,
|
|
11758
|
+
padding: "3px 8px"
|
|
11759
|
+
},
|
|
11760
|
+
children: body.failureMode
|
|
11761
|
+
}
|
|
11762
|
+
) }),
|
|
11763
|
+
/* @__PURE__ */ jsxs39(Text40, { size: 1, muted: true, children: [
|
|
11764
|
+
body.dimension,
|
|
11765
|
+
" \xB7 ",
|
|
11766
|
+
body.count,
|
|
11767
|
+
" / ",
|
|
11768
|
+
body.sampleSize
|
|
11769
|
+
] })
|
|
11770
|
+
] }),
|
|
11771
|
+
/* @__PURE__ */ jsx55(Text40, { size: 2, children: body.summary })
|
|
11772
|
+
] }) });
|
|
11773
|
+
}
|
|
11774
|
+
function renderWeakestArea(body, _meta) {
|
|
11775
|
+
const colors = failureModeColor(body.failureMode);
|
|
11776
|
+
return /* @__PURE__ */ jsx55(Card19, { padding: 3, radius: 2, tone: "default", children: /* @__PURE__ */ jsxs39(Stack30, { space: 2, children: [
|
|
11777
|
+
/* @__PURE__ */ jsxs39(Flex27, { align: "center", gap: 2, children: [
|
|
11778
|
+
/* @__PURE__ */ jsx55(Text40, { size: 1, muted: true, weight: "semibold", children: "Weakest area" }),
|
|
11779
|
+
/* @__PURE__ */ jsx55(Text40, { size: 2, weight: "semibold", children: body.area }),
|
|
11780
|
+
/* @__PURE__ */ jsx55(HoverTip, { text: failureModeTip(body.failureMode), children: /* @__PURE__ */ jsx55(
|
|
11781
|
+
"span",
|
|
11782
|
+
{
|
|
11783
|
+
style: {
|
|
11784
|
+
backgroundColor: colors.bg,
|
|
11785
|
+
borderRadius: 4,
|
|
11786
|
+
color: colors.text,
|
|
11787
|
+
fontSize: 13,
|
|
11788
|
+
fontWeight: 500,
|
|
11789
|
+
padding: "3px 8px"
|
|
11790
|
+
},
|
|
11791
|
+
children: body.failureMode
|
|
11792
|
+
}
|
|
11793
|
+
) }),
|
|
11794
|
+
/* @__PURE__ */ jsx55(HoverTip, { text: confidenceTip(body.confidence), children: /* @__PURE__ */ jsxs39(Text40, { size: 1, muted: true, children: [
|
|
11795
|
+
body.confidence,
|
|
11796
|
+
" confidence \xB7 n=",
|
|
11797
|
+
body.sampleSize
|
|
11798
|
+
] }) })
|
|
11799
|
+
] }),
|
|
11800
|
+
/* @__PURE__ */ jsx55(Text40, { size: 2, style: CLAMP_5_LINES, children: body.summary })
|
|
11801
|
+
] }) });
|
|
11802
|
+
}
|
|
11803
|
+
function renderDegradedCard2(card) {
|
|
11804
|
+
return /* @__PURE__ */ jsx55(Card19, { padding: 2, radius: 2, tone: "caution", children: /* @__PURE__ */ jsxs39(Text40, { size: 1, muted: true, children: [
|
|
11805
|
+
"Card unavailable: ",
|
|
11806
|
+
card.cardType,
|
|
11807
|
+
" (",
|
|
11808
|
+
card.reason,
|
|
11809
|
+
")"
|
|
11810
|
+
] }) });
|
|
11811
|
+
}
|
|
11812
|
+
function ScoreInterpretationPanel(props) {
|
|
11813
|
+
const { cards, availability } = props;
|
|
11814
|
+
if (availability !== "ready" && availability !== "degraded") {
|
|
11815
|
+
return null;
|
|
11816
|
+
}
|
|
11817
|
+
const matched = cards.filter(
|
|
11818
|
+
(c) => (c.status === "ready" || c.status === "degraded") && INTERPRETIVE_CARD_TYPES.has(c.cardType)
|
|
11819
|
+
);
|
|
11820
|
+
if (matched.length === 0) return null;
|
|
11821
|
+
return /* @__PURE__ */ jsx55(Card19, { padding: 4, radius: 2, shadow: 1, style: neutralCardStyle, children: /* @__PURE__ */ jsxs39(Stack30, { space: 4, children: [
|
|
11822
|
+
/* @__PURE__ */ jsx55(Text40, { size: 2, weight: "semibold", children: "Score Interpretation" }),
|
|
11823
|
+
/* @__PURE__ */ jsx55(Box27, { style: dividerStyle }),
|
|
11824
|
+
/* @__PURE__ */ jsx55(Stack30, { space: 3, children: matched.map((card, idx) => {
|
|
11825
|
+
const key = `interp-${idx}`;
|
|
11826
|
+
if (card.status === "degraded") {
|
|
11827
|
+
return /* @__PURE__ */ jsx55(React4.Fragment, { children: renderDegradedCard2(card) }, key);
|
|
11828
|
+
}
|
|
11829
|
+
switch (card.cardType) {
|
|
11830
|
+
case "area-summary":
|
|
11831
|
+
return /* @__PURE__ */ jsx55(React4.Fragment, { children: renderAreaSummary(card.body, card.meta) }, key);
|
|
11832
|
+
case "failure-mode-summary":
|
|
11833
|
+
return /* @__PURE__ */ jsx55(React4.Fragment, { children: renderFailureModeSummary(card.body, card.meta) }, key);
|
|
11834
|
+
case "weakest-area":
|
|
11835
|
+
return /* @__PURE__ */ jsx55(React4.Fragment, { children: renderWeakestArea(card.body, card.meta) }, key);
|
|
11836
|
+
default:
|
|
11837
|
+
return null;
|
|
11838
|
+
}
|
|
11839
|
+
}) })
|
|
11840
|
+
] }) });
|
|
11841
|
+
}
|
|
11842
|
+
|
|
11443
11843
|
// src/components/report-detail/StrengthsList.tsx
|
|
11444
|
-
import { useMemo as
|
|
11844
|
+
import { useMemo as useMemo16 } from "react";
|
|
11445
11845
|
import { CheckmarkCircleIcon as CheckmarkCircleIcon2, SearchIcon as SearchIcon8 } from "@sanity/icons";
|
|
11446
|
-
import { Box as
|
|
11846
|
+
import { Box as Box29, Flex as Flex30, Stack as Stack32, Text as Text43 } from "@sanity/ui";
|
|
11447
11847
|
|
|
11448
11848
|
// src/components/report-detail/AreaScoresGrid.tsx
|
|
11449
|
-
import
|
|
11849
|
+
import React5, {
|
|
11450
11850
|
useCallback as useCallback34,
|
|
11451
|
-
useMemo as
|
|
11851
|
+
useMemo as useMemo14,
|
|
11452
11852
|
useState as useState25
|
|
11453
11853
|
} from "react";
|
|
11454
11854
|
import { WarningOutlineIcon as WarningOutlineIcon2 } from "@sanity/icons";
|
|
11455
|
-
import { Box as
|
|
11456
|
-
import { Fragment as Fragment14, jsx as
|
|
11855
|
+
import { Box as Box28, Flex as Flex28, Stack as Stack31, Text as Text41 } from "@sanity/ui";
|
|
11856
|
+
import { Fragment as Fragment14, jsx as jsx56, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
11457
11857
|
var DIMENSION_TOOLTIPS2 = {
|
|
11458
11858
|
agentOutput: "Quality and completeness of the agent's output. Graded 0\u2013100.",
|
|
11459
11859
|
assertionPassRate: "Fraction of structural assertions that passed. Graded 0\u2013100.",
|
|
@@ -11493,12 +11893,12 @@ function AreaScoresGrid({
|
|
|
11493
11893
|
}) {
|
|
11494
11894
|
const { ref: containerRef, width } = useContainerWidth();
|
|
11495
11895
|
const tier = tableTier(width);
|
|
11496
|
-
const hasActual =
|
|
11896
|
+
const hasActual = useMemo14(
|
|
11497
11897
|
() => scores.some((s) => s.actualScore != null),
|
|
11498
11898
|
[scores]
|
|
11499
11899
|
);
|
|
11500
11900
|
const showLift = isLiteracyMode(mode);
|
|
11501
|
-
const dimKeys =
|
|
11901
|
+
const dimKeys = useMemo14(() => collectDimensionKeys(scores), [scores]);
|
|
11502
11902
|
const [sortField, setSortField] = useState25("score");
|
|
11503
11903
|
const [sortDir, setSortDir] = useState25("desc");
|
|
11504
11904
|
const handleSort = useCallback34(
|
|
@@ -11512,7 +11912,7 @@ function AreaScoresGrid({
|
|
|
11512
11912
|
},
|
|
11513
11913
|
[sortField]
|
|
11514
11914
|
);
|
|
11515
|
-
const sorted =
|
|
11915
|
+
const sorted = useMemo14(() => {
|
|
11516
11916
|
const dir = sortDir === "asc" ? 1 : -1;
|
|
11517
11917
|
return [...scores].sort((a, b) => {
|
|
11518
11918
|
switch (sortField) {
|
|
@@ -11527,7 +11927,7 @@ function AreaScoresGrid({
|
|
|
11527
11927
|
}
|
|
11528
11928
|
});
|
|
11529
11929
|
}, [scores, sortField, sortDir]);
|
|
11530
|
-
const modelScoresByFeature =
|
|
11930
|
+
const modelScoresByFeature = useMemo14(() => {
|
|
11531
11931
|
if (!perModel) return null;
|
|
11532
11932
|
const map = /* @__PURE__ */ new Map();
|
|
11533
11933
|
for (const model of perModel) {
|
|
@@ -11545,8 +11945,8 @@ function AreaScoresGrid({
|
|
|
11545
11945
|
}
|
|
11546
11946
|
return map;
|
|
11547
11947
|
}, [perModel]);
|
|
11548
|
-
return /* @__PURE__ */
|
|
11549
|
-
/* @__PURE__ */
|
|
11948
|
+
return /* @__PURE__ */ jsxs40(Box28, { ref: containerRef, style: { ...neutralCardStyle, overflow: "auto" }, children: [
|
|
11949
|
+
/* @__PURE__ */ jsxs40(
|
|
11550
11950
|
"div",
|
|
11551
11951
|
{
|
|
11552
11952
|
style: {
|
|
@@ -11562,7 +11962,7 @@ function AreaScoresGrid({
|
|
|
11562
11962
|
padding: "12px 16px 8px"
|
|
11563
11963
|
},
|
|
11564
11964
|
children: [
|
|
11565
|
-
/* @__PURE__ */
|
|
11965
|
+
/* @__PURE__ */ jsx56(
|
|
11566
11966
|
ColHeader2,
|
|
11567
11967
|
{
|
|
11568
11968
|
active: sortField === "score",
|
|
@@ -11572,7 +11972,7 @@ function AreaScoresGrid({
|
|
|
11572
11972
|
tooltip: GLOSSARY.score
|
|
11573
11973
|
}
|
|
11574
11974
|
),
|
|
11575
|
-
/* @__PURE__ */
|
|
11975
|
+
/* @__PURE__ */ jsx56(
|
|
11576
11976
|
ColHeader2,
|
|
11577
11977
|
{
|
|
11578
11978
|
active: sortField === "area",
|
|
@@ -11581,7 +11981,7 @@ function AreaScoresGrid({
|
|
|
11581
11981
|
onClick: () => handleSort("area")
|
|
11582
11982
|
}
|
|
11583
11983
|
),
|
|
11584
|
-
dimKeys.map((key) => /* @__PURE__ */
|
|
11984
|
+
dimKeys.map((key) => /* @__PURE__ */ jsx56(
|
|
11585
11985
|
ColHeader2,
|
|
11586
11986
|
{
|
|
11587
11987
|
active: sortField === key,
|
|
@@ -11592,7 +11992,7 @@ function AreaScoresGrid({
|
|
|
11592
11992
|
},
|
|
11593
11993
|
key
|
|
11594
11994
|
)),
|
|
11595
|
-
tier !== "narrow" && showLift && /* @__PURE__ */
|
|
11995
|
+
tier !== "narrow" && showLift && /* @__PURE__ */ jsx56(
|
|
11596
11996
|
ColHeader2,
|
|
11597
11997
|
{
|
|
11598
11998
|
active: sortField === "lift",
|
|
@@ -11602,12 +12002,12 @@ function AreaScoresGrid({
|
|
|
11602
12002
|
tooltip: GLOSSARY.docLift
|
|
11603
12003
|
}
|
|
11604
12004
|
),
|
|
11605
|
-
tier === "full" && hasActual && /* @__PURE__ */
|
|
12005
|
+
tier === "full" && hasActual && /* @__PURE__ */ jsx56(ColHeader2, { label: "Actual", tooltip: GLOSSARY.actualScore })
|
|
11606
12006
|
]
|
|
11607
12007
|
}
|
|
11608
12008
|
),
|
|
11609
|
-
sorted.map((area) => /* @__PURE__ */
|
|
11610
|
-
/* @__PURE__ */
|
|
12009
|
+
sorted.map((area) => /* @__PURE__ */ jsxs40(React5.Fragment, { children: [
|
|
12010
|
+
/* @__PURE__ */ jsx56(
|
|
11611
12011
|
AreaRow,
|
|
11612
12012
|
{
|
|
11613
12013
|
area,
|
|
@@ -11618,7 +12018,7 @@ function AreaScoresGrid({
|
|
|
11618
12018
|
tier
|
|
11619
12019
|
}
|
|
11620
12020
|
),
|
|
11621
|
-
modelScoresByFeature && /* @__PURE__ */
|
|
12021
|
+
modelScoresByFeature && /* @__PURE__ */ jsx56(
|
|
11622
12022
|
ModelSubRows,
|
|
11623
12023
|
{
|
|
11624
12024
|
dimKeys,
|
|
@@ -11639,7 +12039,7 @@ function ModelSubRows({
|
|
|
11639
12039
|
tier
|
|
11640
12040
|
}) {
|
|
11641
12041
|
if (!models || models.length === 0) return null;
|
|
11642
|
-
return /* @__PURE__ */
|
|
12042
|
+
return /* @__PURE__ */ jsx56(Fragment14, { children: models.map((entry) => /* @__PURE__ */ jsx56(
|
|
11643
12043
|
ModelRow2,
|
|
11644
12044
|
{
|
|
11645
12045
|
dimKeys,
|
|
@@ -11661,7 +12061,7 @@ function ModelRow2({
|
|
|
11661
12061
|
tier
|
|
11662
12062
|
}) {
|
|
11663
12063
|
const isNarrow = tier === "narrow";
|
|
11664
|
-
return /* @__PURE__ */
|
|
12064
|
+
return /* @__PURE__ */ jsxs40(
|
|
11665
12065
|
"div",
|
|
11666
12066
|
{
|
|
11667
12067
|
style: {
|
|
@@ -11679,8 +12079,8 @@ function ModelRow2({
|
|
|
11679
12079
|
padding: isNarrow ? "6px 12px 6px 20px" : "6px 16px 6px 28px"
|
|
11680
12080
|
},
|
|
11681
12081
|
children: [
|
|
11682
|
-
/* @__PURE__ */
|
|
11683
|
-
|
|
12082
|
+
/* @__PURE__ */ jsx56(Flex28, { align: "center", children: /* @__PURE__ */ jsx56(
|
|
12083
|
+
Text41,
|
|
11684
12084
|
{
|
|
11685
12085
|
size: 1,
|
|
11686
12086
|
style: {
|
|
@@ -11691,8 +12091,8 @@ function ModelRow2({
|
|
|
11691
12091
|
children: Math.round(scores.totalScore)
|
|
11692
12092
|
}
|
|
11693
12093
|
) }),
|
|
11694
|
-
/* @__PURE__ */
|
|
11695
|
-
dimKeys.map((key) => /* @__PURE__ */
|
|
12094
|
+
/* @__PURE__ */ jsx56(Flex28, { align: "center", gap: 2, children: /* @__PURE__ */ jsx56(Text41, { muted: true, size: 1, children: label }) }),
|
|
12095
|
+
dimKeys.map((key) => /* @__PURE__ */ jsx56(
|
|
11696
12096
|
DimCell,
|
|
11697
12097
|
{
|
|
11698
12098
|
area: label,
|
|
@@ -11702,8 +12102,8 @@ function ModelRow2({
|
|
|
11702
12102
|
},
|
|
11703
12103
|
key
|
|
11704
12104
|
)),
|
|
11705
|
-
!isNarrow && showLift && /* @__PURE__ */
|
|
11706
|
-
|
|
12105
|
+
!isNarrow && showLift && /* @__PURE__ */ jsxs40(
|
|
12106
|
+
Text41,
|
|
11707
12107
|
{
|
|
11708
12108
|
size: 1,
|
|
11709
12109
|
style: {
|
|
@@ -11717,8 +12117,8 @@ function ModelRow2({
|
|
|
11717
12117
|
]
|
|
11718
12118
|
}
|
|
11719
12119
|
),
|
|
11720
|
-
tier === "full" && hasActual && /* @__PURE__ */
|
|
11721
|
-
|
|
12120
|
+
tier === "full" && hasActual && /* @__PURE__ */ jsx56(
|
|
12121
|
+
Text41,
|
|
11722
12122
|
{
|
|
11723
12123
|
size: 1,
|
|
11724
12124
|
style: {
|
|
@@ -11742,7 +12142,7 @@ function AreaRow({
|
|
|
11742
12142
|
tier
|
|
11743
12143
|
}) {
|
|
11744
12144
|
const isNarrow = tier === "narrow";
|
|
11745
|
-
return /* @__PURE__ */
|
|
12145
|
+
return /* @__PURE__ */ jsxs40(
|
|
11746
12146
|
"div",
|
|
11747
12147
|
{
|
|
11748
12148
|
style: {
|
|
@@ -11759,15 +12159,15 @@ function AreaRow({
|
|
|
11759
12159
|
padding: isNarrow ? "8px 12px" : "10px 16px"
|
|
11760
12160
|
},
|
|
11761
12161
|
children: [
|
|
11762
|
-
/* @__PURE__ */
|
|
11763
|
-
/* @__PURE__ */
|
|
12162
|
+
/* @__PURE__ */ jsxs40(Flex28, { align: "center", gap: isNarrow ? 0 : 2, children: [
|
|
12163
|
+
/* @__PURE__ */ jsx56(
|
|
11764
12164
|
HoverTip,
|
|
11765
12165
|
{
|
|
11766
|
-
text: /* @__PURE__ */
|
|
11767
|
-
/* @__PURE__ */
|
|
12166
|
+
text: /* @__PURE__ */ jsxs40(Text41, { size: 2, style: { lineHeight: 1.5 }, children: [
|
|
12167
|
+
/* @__PURE__ */ jsx56("span", { style: { fontWeight: 600 }, children: area.feature }),
|
|
11768
12168
|
" score:",
|
|
11769
12169
|
" ",
|
|
11770
|
-
/* @__PURE__ */
|
|
12170
|
+
/* @__PURE__ */ jsx56(
|
|
11771
12171
|
"span",
|
|
11772
12172
|
{
|
|
11773
12173
|
style: {
|
|
@@ -11778,12 +12178,12 @@ function AreaRow({
|
|
|
11778
12178
|
children: Math.round(area.totalScore)
|
|
11779
12179
|
}
|
|
11780
12180
|
),
|
|
11781
|
-
/* @__PURE__ */
|
|
12181
|
+
/* @__PURE__ */ jsx56("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
|
|
11782
12182
|
".",
|
|
11783
12183
|
" ",
|
|
11784
12184
|
GLOSSARY.score
|
|
11785
12185
|
] }),
|
|
11786
|
-
children: /* @__PURE__ */
|
|
12186
|
+
children: /* @__PURE__ */ jsx56(
|
|
11787
12187
|
"div",
|
|
11788
12188
|
{
|
|
11789
12189
|
style: {
|
|
@@ -11804,11 +12204,11 @@ function AreaRow({
|
|
|
11804
12204
|
)
|
|
11805
12205
|
}
|
|
11806
12206
|
),
|
|
11807
|
-
!isNarrow && delta != null && delta !== 0 && /* @__PURE__ */
|
|
12207
|
+
!isNarrow && delta != null && delta !== 0 && /* @__PURE__ */ jsx56(HoverTip, { text: GLOSSARY.areaDelta, children: /* @__PURE__ */ jsx56(DeltaIndicator, { delta, icon: true, size: 1 }) })
|
|
11808
12208
|
] }),
|
|
11809
|
-
/* @__PURE__ */
|
|
11810
|
-
/* @__PURE__ */
|
|
11811
|
-
area.negativeDocLift && showLift && /* @__PURE__ */
|
|
12209
|
+
/* @__PURE__ */ jsxs40(Flex28, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
12210
|
+
/* @__PURE__ */ jsx56(Text41, { size: 2, weight: "medium", children: area.feature }),
|
|
12211
|
+
area.negativeDocLift && showLift && /* @__PURE__ */ jsx56(HoverTip, { text: GLOSSARY.docsHurt, children: /* @__PURE__ */ jsx56(
|
|
11812
12212
|
"span",
|
|
11813
12213
|
{
|
|
11814
12214
|
style: {
|
|
@@ -11821,11 +12221,11 @@ function AreaRow({
|
|
|
11821
12221
|
gap: 3,
|
|
11822
12222
|
padding: "1px 5px"
|
|
11823
12223
|
},
|
|
11824
|
-
children: /* @__PURE__ */
|
|
12224
|
+
children: /* @__PURE__ */ jsx56(WarningOutlineIcon2, {})
|
|
11825
12225
|
}
|
|
11826
12226
|
) })
|
|
11827
12227
|
] }),
|
|
11828
|
-
dimKeys.map((key) => /* @__PURE__ */
|
|
12228
|
+
dimKeys.map((key) => /* @__PURE__ */ jsx56(
|
|
11829
12229
|
DimCell,
|
|
11830
12230
|
{
|
|
11831
12231
|
area: area.feature,
|
|
@@ -11834,14 +12234,14 @@ function AreaRow({
|
|
|
11834
12234
|
},
|
|
11835
12235
|
key
|
|
11836
12236
|
)),
|
|
11837
|
-
!isNarrow && showLift && /* @__PURE__ */
|
|
12237
|
+
!isNarrow && showLift && /* @__PURE__ */ jsx56(
|
|
11838
12238
|
HoverTip,
|
|
11839
12239
|
{
|
|
11840
|
-
text: /* @__PURE__ */
|
|
11841
|
-
/* @__PURE__ */
|
|
12240
|
+
text: /* @__PURE__ */ jsxs40(Text41, { size: 2, style: { lineHeight: 1.5 }, children: [
|
|
12241
|
+
/* @__PURE__ */ jsx56("span", { style: { fontWeight: 600 }, children: area.feature }),
|
|
11842
12242
|
" doc lift:",
|
|
11843
12243
|
" ",
|
|
11844
|
-
/* @__PURE__ */
|
|
12244
|
+
/* @__PURE__ */ jsxs40(
|
|
11845
12245
|
"span",
|
|
11846
12246
|
{
|
|
11847
12247
|
style: {
|
|
@@ -11859,8 +12259,8 @@ function AreaRow({
|
|
|
11859
12259
|
"pts. ",
|
|
11860
12260
|
GLOSSARY.docLift
|
|
11861
12261
|
] }),
|
|
11862
|
-
children: /* @__PURE__ */
|
|
11863
|
-
|
|
12262
|
+
children: /* @__PURE__ */ jsxs40(
|
|
12263
|
+
Text41,
|
|
11864
12264
|
{
|
|
11865
12265
|
size: 2,
|
|
11866
12266
|
style: {
|
|
@@ -11876,12 +12276,12 @@ function AreaRow({
|
|
|
11876
12276
|
)
|
|
11877
12277
|
}
|
|
11878
12278
|
),
|
|
11879
|
-
tier === "full" && hasActual && /* @__PURE__ */
|
|
12279
|
+
tier === "full" && hasActual && /* @__PURE__ */ jsx56(
|
|
11880
12280
|
HoverTip,
|
|
11881
12281
|
{
|
|
11882
12282
|
text: area.actualScore != null ? `${area.feature} actual score: ${Math.round(area.actualScore)}/100. ${GLOSSARY.actualScore}` : `No agentic data for ${area.feature}.`,
|
|
11883
|
-
children: /* @__PURE__ */
|
|
11884
|
-
|
|
12283
|
+
children: /* @__PURE__ */ jsx56(
|
|
12284
|
+
Text41,
|
|
11885
12285
|
{
|
|
11886
12286
|
size: 2,
|
|
11887
12287
|
style: {
|
|
@@ -11910,17 +12310,17 @@ function DimCell({
|
|
|
11910
12310
|
const tooltip = dimKey ? DIMENSION_TOOLTIPS2[dimKey] : "";
|
|
11911
12311
|
const textSize = size === "small" ? 0 : 1;
|
|
11912
12312
|
const barHeight = size === "small" ? 3 : 4;
|
|
11913
|
-
return /* @__PURE__ */
|
|
12313
|
+
return /* @__PURE__ */ jsx56(
|
|
11914
12314
|
HoverTip,
|
|
11915
12315
|
{
|
|
11916
|
-
text: /* @__PURE__ */
|
|
11917
|
-
/* @__PURE__ */
|
|
12316
|
+
text: /* @__PURE__ */ jsxs40(Text41, { size: 2, style: { lineHeight: 1.5 }, children: [
|
|
12317
|
+
/* @__PURE__ */ jsx56("span", { style: { fontWeight: 600 }, children: area }),
|
|
11918
12318
|
" \u2192",
|
|
11919
12319
|
" ",
|
|
11920
|
-
/* @__PURE__ */
|
|
12320
|
+
/* @__PURE__ */ jsx56("span", { style: { fontWeight: 600 }, children: dim }),
|
|
11921
12321
|
":",
|
|
11922
12322
|
" ",
|
|
11923
|
-
/* @__PURE__ */
|
|
12323
|
+
/* @__PURE__ */ jsx56(
|
|
11924
12324
|
"span",
|
|
11925
12325
|
{
|
|
11926
12326
|
style: {
|
|
@@ -11931,14 +12331,14 @@ function DimCell({
|
|
|
11931
12331
|
children: Math.round(value)
|
|
11932
12332
|
}
|
|
11933
12333
|
),
|
|
11934
|
-
/* @__PURE__ */
|
|
12334
|
+
/* @__PURE__ */ jsx56("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
|
|
11935
12335
|
".",
|
|
11936
12336
|
" ",
|
|
11937
12337
|
tooltip
|
|
11938
12338
|
] }),
|
|
11939
|
-
children: /* @__PURE__ */
|
|
11940
|
-
/* @__PURE__ */
|
|
11941
|
-
|
|
12339
|
+
children: /* @__PURE__ */ jsxs40(Stack31, { space: 1, style: { width: "100%" }, children: [
|
|
12340
|
+
/* @__PURE__ */ jsx56(
|
|
12341
|
+
Text41,
|
|
11942
12342
|
{
|
|
11943
12343
|
size: textSize,
|
|
11944
12344
|
style: {
|
|
@@ -11949,7 +12349,7 @@ function DimCell({
|
|
|
11949
12349
|
children: Math.round(value)
|
|
11950
12350
|
}
|
|
11951
12351
|
),
|
|
11952
|
-
/* @__PURE__ */
|
|
12352
|
+
/* @__PURE__ */ jsx56(
|
|
11953
12353
|
"div",
|
|
11954
12354
|
{
|
|
11955
12355
|
style: {
|
|
@@ -11959,7 +12359,7 @@ function DimCell({
|
|
|
11959
12359
|
overflow: "hidden",
|
|
11960
12360
|
width: "100%"
|
|
11961
12361
|
},
|
|
11962
|
-
children: /* @__PURE__ */
|
|
12362
|
+
children: /* @__PURE__ */ jsx56(
|
|
11963
12363
|
"div",
|
|
11964
12364
|
{
|
|
11965
12365
|
style: {
|
|
@@ -11994,8 +12394,8 @@ function ColHeader2({
|
|
|
11994
12394
|
[onClick]
|
|
11995
12395
|
);
|
|
11996
12396
|
const arrow = active ? direction === "asc" ? " \u2191" : " \u2193" : "";
|
|
11997
|
-
return /* @__PURE__ */
|
|
11998
|
-
/* @__PURE__ */
|
|
12397
|
+
return /* @__PURE__ */ jsxs40(Flex28, { align: "center", gap: 1, children: [
|
|
12398
|
+
/* @__PURE__ */ jsx56(
|
|
11999
12399
|
"div",
|
|
12000
12400
|
{
|
|
12001
12401
|
onClick,
|
|
@@ -12006,8 +12406,8 @@ function ColHeader2({
|
|
|
12006
12406
|
userSelect: "none"
|
|
12007
12407
|
},
|
|
12008
12408
|
tabIndex: onClick ? 0 : void 0,
|
|
12009
|
-
children: /* @__PURE__ */
|
|
12010
|
-
|
|
12409
|
+
children: /* @__PURE__ */ jsxs40(
|
|
12410
|
+
Text41,
|
|
12011
12411
|
{
|
|
12012
12412
|
muted: true,
|
|
12013
12413
|
size: 1,
|
|
@@ -12024,14 +12424,14 @@ function ColHeader2({
|
|
|
12024
12424
|
)
|
|
12025
12425
|
}
|
|
12026
12426
|
),
|
|
12027
|
-
tooltip && /* @__PURE__ */
|
|
12427
|
+
tooltip && /* @__PURE__ */ jsx56(InfoTip, { text: tooltip })
|
|
12028
12428
|
] });
|
|
12029
12429
|
}
|
|
12030
12430
|
|
|
12031
12431
|
// src/components/report-detail/ModelSelector.tsx
|
|
12032
12432
|
import { useCallback as useCallback35 } from "react";
|
|
12033
|
-
import { Flex as
|
|
12034
|
-
import { jsx as
|
|
12433
|
+
import { Flex as Flex29, Text as Text42 } from "@sanity/ui";
|
|
12434
|
+
import { jsx as jsx57, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
12035
12435
|
var pillBase = {
|
|
12036
12436
|
borderColor: "var(--card-border-color)",
|
|
12037
12437
|
borderRadius: 999,
|
|
@@ -12062,8 +12462,8 @@ function ModelSelector({
|
|
|
12062
12462
|
selection,
|
|
12063
12463
|
onChange
|
|
12064
12464
|
}) {
|
|
12065
|
-
return /* @__PURE__ */
|
|
12066
|
-
/* @__PURE__ */
|
|
12465
|
+
return /* @__PURE__ */ jsxs41(Flex29, { align: "center", gap: 1, wrap: "wrap", children: [
|
|
12466
|
+
/* @__PURE__ */ jsx57(
|
|
12067
12467
|
Pill2,
|
|
12068
12468
|
{
|
|
12069
12469
|
isSelected: selection === null,
|
|
@@ -12071,7 +12471,7 @@ function ModelSelector({
|
|
|
12071
12471
|
onClick: () => onChange(null)
|
|
12072
12472
|
}
|
|
12073
12473
|
),
|
|
12074
|
-
models.map((model) => /* @__PURE__ */
|
|
12474
|
+
models.map((model) => /* @__PURE__ */ jsx57(
|
|
12075
12475
|
Pill2,
|
|
12076
12476
|
{
|
|
12077
12477
|
isSelected: selection === model.modelId,
|
|
@@ -12080,7 +12480,7 @@ function ModelSelector({
|
|
|
12080
12480
|
},
|
|
12081
12481
|
model.modelId
|
|
12082
12482
|
)),
|
|
12083
|
-
/* @__PURE__ */
|
|
12483
|
+
/* @__PURE__ */ jsx57(
|
|
12084
12484
|
"div",
|
|
12085
12485
|
{
|
|
12086
12486
|
style: {
|
|
@@ -12091,7 +12491,7 @@ function ModelSelector({
|
|
|
12091
12491
|
}
|
|
12092
12492
|
}
|
|
12093
12493
|
),
|
|
12094
|
-
/* @__PURE__ */
|
|
12494
|
+
/* @__PURE__ */ jsx57(
|
|
12095
12495
|
Pill2,
|
|
12096
12496
|
{
|
|
12097
12497
|
isSelected: selection === "expanded",
|
|
@@ -12115,7 +12515,7 @@ function Pill2({
|
|
|
12115
12515
|
},
|
|
12116
12516
|
[onClick]
|
|
12117
12517
|
);
|
|
12118
|
-
return /* @__PURE__ */
|
|
12518
|
+
return /* @__PURE__ */ jsx57(
|
|
12119
12519
|
"span",
|
|
12120
12520
|
{
|
|
12121
12521
|
onClick,
|
|
@@ -12123,8 +12523,8 @@ function Pill2({
|
|
|
12123
12523
|
role: "button",
|
|
12124
12524
|
style: isSelected ? pillSelected : pillDefault,
|
|
12125
12525
|
tabIndex: 0,
|
|
12126
|
-
children: /* @__PURE__ */
|
|
12127
|
-
|
|
12526
|
+
children: /* @__PURE__ */ jsx57(
|
|
12527
|
+
Text42,
|
|
12128
12528
|
{
|
|
12129
12529
|
size: 1,
|
|
12130
12530
|
style: {
|
|
@@ -12139,7 +12539,7 @@ function Pill2({
|
|
|
12139
12539
|
}
|
|
12140
12540
|
|
|
12141
12541
|
// src/components/report-detail/useModelSelection.ts
|
|
12142
|
-
import { useCallback as useCallback36, useMemo as
|
|
12542
|
+
import { useCallback as useCallback36, useMemo as useMemo15, useState as useState26 } from "react";
|
|
12143
12543
|
function useModelSelection({
|
|
12144
12544
|
scores,
|
|
12145
12545
|
perModel
|
|
@@ -12150,7 +12550,7 @@ function useModelSelection({
|
|
|
12150
12550
|
}, []);
|
|
12151
12551
|
const isExpanded = selection === "expanded";
|
|
12152
12552
|
const hasModels = perModel != null && perModel.length > 1;
|
|
12153
|
-
const resolvedScores =
|
|
12553
|
+
const resolvedScores = useMemo15(() => {
|
|
12154
12554
|
if (isExpanded || selection === null || !perModel) return scores;
|
|
12155
12555
|
const model = perModel.find((m) => m.modelId === selection);
|
|
12156
12556
|
return model?.scores ?? scores;
|
|
@@ -12167,7 +12567,7 @@ function useModelSelection({
|
|
|
12167
12567
|
}
|
|
12168
12568
|
|
|
12169
12569
|
// src/components/report-detail/StrengthsList.tsx
|
|
12170
|
-
import { jsx as
|
|
12570
|
+
import { jsx as jsx58, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
12171
12571
|
function StrengthsList({
|
|
12172
12572
|
mode,
|
|
12173
12573
|
scores,
|
|
@@ -12181,7 +12581,7 @@ function StrengthsList({
|
|
|
12181
12581
|
hasModels,
|
|
12182
12582
|
expandedPerModel
|
|
12183
12583
|
} = useModelSelection({ scores, perModel });
|
|
12184
|
-
const displayedScores =
|
|
12584
|
+
const displayedScores = useMemo16(
|
|
12185
12585
|
() => resolvedScores.filter((s) => s.totalScore >= SCORE_CAUTION),
|
|
12186
12586
|
[resolvedScores]
|
|
12187
12587
|
);
|
|
@@ -12191,13 +12591,13 @@ function StrengthsList({
|
|
|
12191
12591
|
(a, b) => (b.infrastructureEfficiency ?? 0) - (a.infrastructureEfficiency ?? 0)
|
|
12192
12592
|
);
|
|
12193
12593
|
if (displayedScores.length === 0) return null;
|
|
12194
|
-
return /* @__PURE__ */
|
|
12195
|
-
/* @__PURE__ */
|
|
12196
|
-
/* @__PURE__ */
|
|
12197
|
-
/* @__PURE__ */
|
|
12198
|
-
/* @__PURE__ */
|
|
12199
|
-
/* @__PURE__ */
|
|
12200
|
-
hasModels && /* @__PURE__ */
|
|
12594
|
+
return /* @__PURE__ */ jsxs42(Stack32, { space: 5, children: [
|
|
12595
|
+
/* @__PURE__ */ jsxs42(Stack32, { space: 3, children: [
|
|
12596
|
+
/* @__PURE__ */ jsxs42(Flex30, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
12597
|
+
/* @__PURE__ */ jsx58(CheckmarkCircleIcon2, { style: { color: "#34d399" } }),
|
|
12598
|
+
/* @__PURE__ */ jsx58(Text43, { size: 2, weight: "medium", children: "Strong Areas (70+)" }),
|
|
12599
|
+
/* @__PURE__ */ jsx58(InfoTip, { text: GLOSSARY.strengths }),
|
|
12600
|
+
hasModels && /* @__PURE__ */ jsx58(Box29, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx58(
|
|
12201
12601
|
ModelSelector,
|
|
12202
12602
|
{
|
|
12203
12603
|
models: perModel,
|
|
@@ -12206,7 +12606,7 @@ function StrengthsList({
|
|
|
12206
12606
|
}
|
|
12207
12607
|
) })
|
|
12208
12608
|
] }),
|
|
12209
|
-
/* @__PURE__ */
|
|
12609
|
+
/* @__PURE__ */ jsx58(
|
|
12210
12610
|
AreaScoresGrid,
|
|
12211
12611
|
{
|
|
12212
12612
|
mode,
|
|
@@ -12216,33 +12616,33 @@ function StrengthsList({
|
|
|
12216
12616
|
}
|
|
12217
12617
|
)
|
|
12218
12618
|
] }),
|
|
12219
|
-
retrievalSuccesses.length > 0 && /* @__PURE__ */
|
|
12220
|
-
/* @__PURE__ */
|
|
12221
|
-
|
|
12619
|
+
retrievalSuccesses.length > 0 && /* @__PURE__ */ jsxs42(Box29, { style: neutralCardStyle, children: [
|
|
12620
|
+
/* @__PURE__ */ jsx58(
|
|
12621
|
+
Box29,
|
|
12222
12622
|
{
|
|
12223
12623
|
padding: 4,
|
|
12224
12624
|
style: { borderBottom: "1px solid var(--card-border-color)" },
|
|
12225
|
-
children: /* @__PURE__ */
|
|
12226
|
-
/* @__PURE__ */
|
|
12227
|
-
/* @__PURE__ */
|
|
12625
|
+
children: /* @__PURE__ */ jsxs42(Flex30, { align: "center", gap: 2, children: [
|
|
12626
|
+
/* @__PURE__ */ jsx58(SearchIcon8, { style: { color: "#34d399" } }),
|
|
12627
|
+
/* @__PURE__ */ jsxs42(Text43, { size: 2, weight: "medium", children: [
|
|
12228
12628
|
"Retrieval Successes (",
|
|
12229
12629
|
Math.round(EFFICIENCY_POSITIVE * 100),
|
|
12230
12630
|
"%+ efficiency)"
|
|
12231
12631
|
] }),
|
|
12232
|
-
/* @__PURE__ */
|
|
12632
|
+
/* @__PURE__ */ jsx58(InfoTip, { text: GLOSSARY.retrievalExcellence })
|
|
12233
12633
|
] })
|
|
12234
12634
|
}
|
|
12235
12635
|
),
|
|
12236
|
-
/* @__PURE__ */
|
|
12237
|
-
|
|
12636
|
+
/* @__PURE__ */ jsx58(Stack32, { children: retrievalSuccesses.map((area, i) => /* @__PURE__ */ jsxs42(
|
|
12637
|
+
Flex30,
|
|
12238
12638
|
{
|
|
12239
12639
|
align: "center",
|
|
12240
12640
|
justify: "space-between",
|
|
12241
12641
|
padding: 4,
|
|
12242
12642
|
style: i > 0 ? dividerStyle : void 0,
|
|
12243
12643
|
children: [
|
|
12244
|
-
/* @__PURE__ */
|
|
12245
|
-
/* @__PURE__ */
|
|
12644
|
+
/* @__PURE__ */ jsx58(Text43, { size: 2, children: area.feature }),
|
|
12645
|
+
/* @__PURE__ */ jsx58(
|
|
12246
12646
|
"span",
|
|
12247
12647
|
{
|
|
12248
12648
|
style: {
|
|
@@ -12264,16 +12664,62 @@ function StrengthsList({
|
|
|
12264
12664
|
] });
|
|
12265
12665
|
}
|
|
12266
12666
|
|
|
12667
|
+
// src/components/report-detail/SynthesisNotGeneratedCTA.tsx
|
|
12668
|
+
import { useCallback as useCallback37, useState as useState27 } from "react";
|
|
12669
|
+
import { CopyIcon as CopyIcon4 } from "@sanity/icons";
|
|
12670
|
+
import { Box as Box30, Button as Button11, Card as Card20, Code as Code3, Flex as Flex31, Stack as Stack33, Text as Text44 } from "@sanity/ui";
|
|
12671
|
+
import { jsx as jsx59, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
12672
|
+
function SynthesisNotGeneratedCTA(props) {
|
|
12673
|
+
const { reportId } = props;
|
|
12674
|
+
const command = `ailf interpret ${reportId}`;
|
|
12675
|
+
const [copied, setCopied] = useState27(false);
|
|
12676
|
+
const handleCopy = useCallback37(async () => {
|
|
12677
|
+
try {
|
|
12678
|
+
await navigator.clipboard.writeText(command);
|
|
12679
|
+
setCopied(true);
|
|
12680
|
+
window.setTimeout(() => setCopied(false), 1500);
|
|
12681
|
+
} catch {
|
|
12682
|
+
}
|
|
12683
|
+
}, [command]);
|
|
12684
|
+
return /* @__PURE__ */ jsx59(
|
|
12685
|
+
Card20,
|
|
12686
|
+
{
|
|
12687
|
+
padding: 4,
|
|
12688
|
+
radius: 2,
|
|
12689
|
+
shadow: 1,
|
|
12690
|
+
style: neutralCardStyle,
|
|
12691
|
+
tone: "primary",
|
|
12692
|
+
children: /* @__PURE__ */ jsxs43(Stack33, { space: 3, children: [
|
|
12693
|
+
/* @__PURE__ */ jsx59(Text44, { size: 2, weight: "semibold", children: "Synthesis not yet generated" }),
|
|
12694
|
+
/* @__PURE__ */ jsx59(Text44, { size: 1, muted: true, children: "Run the command below to generate diagnosis cards for this report." }),
|
|
12695
|
+
/* @__PURE__ */ jsxs43(Flex31, { align: "center", gap: 2, children: [
|
|
12696
|
+
/* @__PURE__ */ jsx59(Box30, { flex: 1, children: /* @__PURE__ */ jsx59(Code3, { size: 1, language: "sh", children: command }) }),
|
|
12697
|
+
/* @__PURE__ */ jsx59(
|
|
12698
|
+
Button11,
|
|
12699
|
+
{
|
|
12700
|
+
icon: CopyIcon4,
|
|
12701
|
+
mode: "ghost",
|
|
12702
|
+
tone: "default",
|
|
12703
|
+
text: copied ? "Copied" : "Copy",
|
|
12704
|
+
onClick: handleCopy
|
|
12705
|
+
}
|
|
12706
|
+
)
|
|
12707
|
+
] })
|
|
12708
|
+
] })
|
|
12709
|
+
}
|
|
12710
|
+
);
|
|
12711
|
+
}
|
|
12712
|
+
|
|
12267
12713
|
// src/components/report-detail/WeaknessesList.tsx
|
|
12268
12714
|
import {
|
|
12269
12715
|
ErrorOutlineIcon as ErrorOutlineIcon3,
|
|
12270
12716
|
SearchIcon as SearchIcon9,
|
|
12271
12717
|
WarningOutlineIcon as WarningOutlineIcon3,
|
|
12272
|
-
BoltIcon,
|
|
12718
|
+
BoltIcon as BoltIcon2,
|
|
12273
12719
|
ArrowDownIcon as ArrowDownIcon2
|
|
12274
12720
|
} from "@sanity/icons";
|
|
12275
|
-
import { Box as
|
|
12276
|
-
import { jsx as
|
|
12721
|
+
import { Box as Box31, Flex as Flex32, Stack as Stack34, Text as Text45 } from "@sanity/ui";
|
|
12722
|
+
import { jsx as jsx60, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
12277
12723
|
function WeaknessesList({
|
|
12278
12724
|
mode,
|
|
12279
12725
|
scores,
|
|
@@ -12303,13 +12749,13 @@ function WeaknessesList({
|
|
|
12303
12749
|
);
|
|
12304
12750
|
const hasContent = weakAreas.length > 0 || docsHurt.length > 0 || retrievalIssues.length > 0 || dimWeaknesses.length > 0 || FEATURE_FLAGS.showRegressedSinceLastRun.enabled && regressed.length > 0 || efficiencyAnomalies.length > 0;
|
|
12305
12751
|
if (!hasContent) return null;
|
|
12306
|
-
return /* @__PURE__ */
|
|
12307
|
-
weakAreas.length > 0 && /* @__PURE__ */
|
|
12308
|
-
/* @__PURE__ */
|
|
12309
|
-
/* @__PURE__ */
|
|
12310
|
-
/* @__PURE__ */
|
|
12311
|
-
/* @__PURE__ */
|
|
12312
|
-
hasModels && /* @__PURE__ */
|
|
12752
|
+
return /* @__PURE__ */ jsxs44(Stack34, { space: 5, children: [
|
|
12753
|
+
weakAreas.length > 0 && /* @__PURE__ */ jsxs44(Stack34, { space: 3, children: [
|
|
12754
|
+
/* @__PURE__ */ jsxs44(Flex32, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
12755
|
+
/* @__PURE__ */ jsx60(ErrorOutlineIcon3, { style: { color: "#f87171" } }),
|
|
12756
|
+
/* @__PURE__ */ jsx60(Text45, { size: 2, weight: "medium", children: "Weak Areas (<70)" }),
|
|
12757
|
+
/* @__PURE__ */ jsx60(InfoTip, { text: GLOSSARY.weakAreas }),
|
|
12758
|
+
hasModels && /* @__PURE__ */ jsx60(Box31, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx60(
|
|
12313
12759
|
ModelSelector,
|
|
12314
12760
|
{
|
|
12315
12761
|
models: perModel,
|
|
@@ -12318,7 +12764,7 @@ function WeaknessesList({
|
|
|
12318
12764
|
}
|
|
12319
12765
|
) })
|
|
12320
12766
|
] }),
|
|
12321
|
-
/* @__PURE__ */
|
|
12767
|
+
/* @__PURE__ */ jsx60(
|
|
12322
12768
|
AreaScoresGrid,
|
|
12323
12769
|
{
|
|
12324
12770
|
mode,
|
|
@@ -12328,22 +12774,22 @@ function WeaknessesList({
|
|
|
12328
12774
|
}
|
|
12329
12775
|
)
|
|
12330
12776
|
] }),
|
|
12331
|
-
docsHurt.length > 0 && /* @__PURE__ */
|
|
12332
|
-
/* @__PURE__ */
|
|
12333
|
-
/* @__PURE__ */
|
|
12334
|
-
/* @__PURE__ */
|
|
12335
|
-
/* @__PURE__ */
|
|
12777
|
+
docsHurt.length > 0 && /* @__PURE__ */ jsxs44(Stack34, { space: 3, children: [
|
|
12778
|
+
/* @__PURE__ */ jsxs44(Flex32, { align: "center", gap: 2, children: [
|
|
12779
|
+
/* @__PURE__ */ jsx60(ErrorOutlineIcon3, { style: { color: "#f87171" } }),
|
|
12780
|
+
/* @__PURE__ */ jsx60(Text45, { size: 2, weight: "medium", children: "Docs Hurt Performance (Negative Doc Lift)" }),
|
|
12781
|
+
/* @__PURE__ */ jsx60(InfoTip, { text: GLOSSARY.docsHurt })
|
|
12336
12782
|
] }),
|
|
12337
|
-
/* @__PURE__ */
|
|
12338
|
-
|
|
12783
|
+
/* @__PURE__ */ jsx60(Box31, { style: sectionStyle("red"), children: docsHurt.map((area, i) => /* @__PURE__ */ jsxs44(
|
|
12784
|
+
Box31,
|
|
12339
12785
|
{
|
|
12340
12786
|
padding: 4,
|
|
12341
12787
|
style: i > 0 ? { borderTop: "1px solid rgba(239,68,68,0.2)" } : void 0,
|
|
12342
12788
|
children: [
|
|
12343
|
-
/* @__PURE__ */
|
|
12344
|
-
/* @__PURE__ */
|
|
12345
|
-
/* @__PURE__ */
|
|
12346
|
-
/* @__PURE__ */
|
|
12789
|
+
/* @__PURE__ */ jsxs44(Flex32, { align: "center", justify: "space-between", wrap: "wrap", children: [
|
|
12790
|
+
/* @__PURE__ */ jsxs44(Flex32, { align: "center", gap: 2, children: [
|
|
12791
|
+
/* @__PURE__ */ jsx60(Text45, { size: 2, weight: "medium", children: area.feature }),
|
|
12792
|
+
/* @__PURE__ */ jsx60(
|
|
12347
12793
|
"span",
|
|
12348
12794
|
{
|
|
12349
12795
|
style: {
|
|
@@ -12358,7 +12804,7 @@ function WeaknessesList({
|
|
|
12358
12804
|
}
|
|
12359
12805
|
)
|
|
12360
12806
|
] }),
|
|
12361
|
-
/* @__PURE__ */
|
|
12807
|
+
/* @__PURE__ */ jsx60(
|
|
12362
12808
|
"span",
|
|
12363
12809
|
{
|
|
12364
12810
|
style: {
|
|
@@ -12371,8 +12817,8 @@ function WeaknessesList({
|
|
|
12371
12817
|
}
|
|
12372
12818
|
)
|
|
12373
12819
|
] }),
|
|
12374
|
-
/* @__PURE__ */
|
|
12375
|
-
area.invertedRetrievalGap && /* @__PURE__ */
|
|
12820
|
+
/* @__PURE__ */ jsx60(Box31, { paddingTop: 2, children: /* @__PURE__ */ jsxs44(Text45, { muted: true, size: 2, children: [
|
|
12821
|
+
area.invertedRetrievalGap && /* @__PURE__ */ jsxs44("span", { style: { color: "#fbbf24" }, children: [
|
|
12376
12822
|
"Agent does better by NOT finding these docs.",
|
|
12377
12823
|
" "
|
|
12378
12824
|
] }),
|
|
@@ -12387,22 +12833,22 @@ function WeaknessesList({
|
|
|
12387
12833
|
area.feature
|
|
12388
12834
|
)) })
|
|
12389
12835
|
] }),
|
|
12390
|
-
retrievalIssues.length > 0 && /* @__PURE__ */
|
|
12391
|
-
/* @__PURE__ */
|
|
12392
|
-
/* @__PURE__ */
|
|
12393
|
-
/* @__PURE__ */
|
|
12394
|
-
/* @__PURE__ */
|
|
12836
|
+
retrievalIssues.length > 0 && /* @__PURE__ */ jsxs44(Stack34, { space: 3, children: [
|
|
12837
|
+
/* @__PURE__ */ jsxs44(Flex32, { align: "center", gap: 2, children: [
|
|
12838
|
+
/* @__PURE__ */ jsx60(SearchIcon9, { style: { color: "#fbbf24" } }),
|
|
12839
|
+
/* @__PURE__ */ jsx60(Text45, { size: 2, weight: "medium", children: "Retrieval Issues (<70% efficiency)" }),
|
|
12840
|
+
/* @__PURE__ */ jsx60(InfoTip, { text: GLOSSARY.retrievalIssues })
|
|
12395
12841
|
] }),
|
|
12396
|
-
/* @__PURE__ */
|
|
12397
|
-
|
|
12842
|
+
/* @__PURE__ */ jsx60(Box31, { style: sectionStyle("amber"), children: retrievalIssues.map((area, i) => /* @__PURE__ */ jsxs44(
|
|
12843
|
+
Box31,
|
|
12398
12844
|
{
|
|
12399
12845
|
padding: 4,
|
|
12400
12846
|
style: i > 0 ? { borderTop: "1px solid rgba(245,158,11,0.2)" } : void 0,
|
|
12401
12847
|
children: [
|
|
12402
|
-
/* @__PURE__ */
|
|
12403
|
-
/* @__PURE__ */
|
|
12404
|
-
/* @__PURE__ */
|
|
12405
|
-
/* @__PURE__ */
|
|
12848
|
+
/* @__PURE__ */ jsxs44(Flex32, { align: "center", justify: "space-between", wrap: "wrap", children: [
|
|
12849
|
+
/* @__PURE__ */ jsxs44(Flex32, { align: "center", gap: 2, children: [
|
|
12850
|
+
/* @__PURE__ */ jsx60(Text45, { size: 2, weight: "medium", children: area.feature }),
|
|
12851
|
+
/* @__PURE__ */ jsx60(
|
|
12406
12852
|
"span",
|
|
12407
12853
|
{
|
|
12408
12854
|
style: {
|
|
@@ -12417,7 +12863,7 @@ function WeaknessesList({
|
|
|
12417
12863
|
}
|
|
12418
12864
|
)
|
|
12419
12865
|
] }),
|
|
12420
|
-
/* @__PURE__ */
|
|
12866
|
+
/* @__PURE__ */ jsx60(
|
|
12421
12867
|
"span",
|
|
12422
12868
|
{
|
|
12423
12869
|
style: {
|
|
@@ -12430,7 +12876,7 @@ function WeaknessesList({
|
|
|
12430
12876
|
}
|
|
12431
12877
|
)
|
|
12432
12878
|
] }),
|
|
12433
|
-
/* @__PURE__ */
|
|
12879
|
+
/* @__PURE__ */ jsx60(Box31, { paddingTop: 2, children: /* @__PURE__ */ jsxs44(Text45, { muted: true, size: 2, children: [
|
|
12434
12880
|
"Actual score (",
|
|
12435
12881
|
Math.round(area.actualScore ?? 0),
|
|
12436
12882
|
") is much lower than ceiling (",
|
|
@@ -12445,21 +12891,21 @@ function WeaknessesList({
|
|
|
12445
12891
|
area.feature
|
|
12446
12892
|
)) })
|
|
12447
12893
|
] }),
|
|
12448
|
-
dimWeaknesses.length > 0 && /* @__PURE__ */
|
|
12449
|
-
/* @__PURE__ */
|
|
12450
|
-
/* @__PURE__ */
|
|
12451
|
-
/* @__PURE__ */
|
|
12452
|
-
/* @__PURE__ */
|
|
12894
|
+
dimWeaknesses.length > 0 && /* @__PURE__ */ jsxs44(Stack34, { space: 3, children: [
|
|
12895
|
+
/* @__PURE__ */ jsxs44(Flex32, { align: "center", gap: 2, children: [
|
|
12896
|
+
/* @__PURE__ */ jsx60(WarningOutlineIcon3, { style: { color: "#fbbf24" } }),
|
|
12897
|
+
/* @__PURE__ */ jsx60(Text45, { size: 2, weight: "medium", children: "Dimension Weaknesses (<50)" }),
|
|
12898
|
+
/* @__PURE__ */ jsx60(InfoTip, { text: GLOSSARY.dimWeaknesses })
|
|
12453
12899
|
] }),
|
|
12454
|
-
/* @__PURE__ */
|
|
12455
|
-
|
|
12900
|
+
/* @__PURE__ */ jsx60(Box31, { style: neutralCardStyle, children: dimWeaknesses.map(({ area, dims }, i) => /* @__PURE__ */ jsxs44(
|
|
12901
|
+
Box31,
|
|
12456
12902
|
{
|
|
12457
12903
|
padding: 4,
|
|
12458
12904
|
style: i > 0 ? dividerStyle : void 0,
|
|
12459
12905
|
children: [
|
|
12460
|
-
/* @__PURE__ */
|
|
12461
|
-
/* @__PURE__ */
|
|
12462
|
-
/* @__PURE__ */
|
|
12906
|
+
/* @__PURE__ */ jsxs44(Flex32, { align: "center", gap: 2, paddingBottom: 2, children: [
|
|
12907
|
+
/* @__PURE__ */ jsx60(Text45, { size: 2, weight: "medium", children: area.feature }),
|
|
12908
|
+
/* @__PURE__ */ jsx60(
|
|
12463
12909
|
"span",
|
|
12464
12910
|
{
|
|
12465
12911
|
style: {
|
|
@@ -12474,7 +12920,7 @@ function WeaknessesList({
|
|
|
12474
12920
|
}
|
|
12475
12921
|
)
|
|
12476
12922
|
] }),
|
|
12477
|
-
/* @__PURE__ */
|
|
12923
|
+
/* @__PURE__ */ jsx60(Flex32, { gap: 2, wrap: "wrap", children: dims.map((w) => /* @__PURE__ */ jsx60(HoverTip, { text: w.tip, children: /* @__PURE__ */ jsxs44(
|
|
12478
12924
|
"span",
|
|
12479
12925
|
{
|
|
12480
12926
|
style: {
|
|
@@ -12496,35 +12942,35 @@ function WeaknessesList({
|
|
|
12496
12942
|
area.feature
|
|
12497
12943
|
)) })
|
|
12498
12944
|
] }),
|
|
12499
|
-
FEATURE_FLAGS.showRegressedSinceLastRun.enabled && regressed.length > 0 && /* @__PURE__ */
|
|
12500
|
-
/* @__PURE__ */
|
|
12501
|
-
|
|
12945
|
+
FEATURE_FLAGS.showRegressedSinceLastRun.enabled && regressed.length > 0 && /* @__PURE__ */ jsxs44(Box31, { style: neutralCardStyle, children: [
|
|
12946
|
+
/* @__PURE__ */ jsx60(
|
|
12947
|
+
Box31,
|
|
12502
12948
|
{
|
|
12503
12949
|
padding: 4,
|
|
12504
12950
|
style: { borderBottom: "1px solid var(--card-border-color)" },
|
|
12505
|
-
children: /* @__PURE__ */
|
|
12506
|
-
/* @__PURE__ */
|
|
12507
|
-
/* @__PURE__ */
|
|
12951
|
+
children: /* @__PURE__ */ jsxs44(Flex32, { align: "center", gap: 2, children: [
|
|
12952
|
+
/* @__PURE__ */ jsx60(ArrowDownIcon2, { style: { color: "#f87171" } }),
|
|
12953
|
+
/* @__PURE__ */ jsx60(Text45, { size: 2, weight: "medium", children: "Regressed Since Last Run" })
|
|
12508
12954
|
] })
|
|
12509
12955
|
}
|
|
12510
12956
|
),
|
|
12511
|
-
/* @__PURE__ */
|
|
12957
|
+
/* @__PURE__ */ jsx60(Stack34, { children: regressed.map((featureName, i) => {
|
|
12512
12958
|
const area = scores.find((s) => s.feature === featureName);
|
|
12513
12959
|
const areaDelta = perArea.find(
|
|
12514
12960
|
(p) => p.area === featureName
|
|
12515
12961
|
)?.delta;
|
|
12516
|
-
return /* @__PURE__ */
|
|
12517
|
-
|
|
12962
|
+
return /* @__PURE__ */ jsxs44(
|
|
12963
|
+
Flex32,
|
|
12518
12964
|
{
|
|
12519
12965
|
align: "center",
|
|
12520
12966
|
justify: "space-between",
|
|
12521
12967
|
padding: 4,
|
|
12522
12968
|
style: i > 0 ? dividerStyle : void 0,
|
|
12523
12969
|
children: [
|
|
12524
|
-
/* @__PURE__ */
|
|
12525
|
-
/* @__PURE__ */
|
|
12526
|
-
areaDelta != null && /* @__PURE__ */
|
|
12527
|
-
area && /* @__PURE__ */
|
|
12970
|
+
/* @__PURE__ */ jsx60(Text45, { size: 2, children: featureName }),
|
|
12971
|
+
/* @__PURE__ */ jsxs44(Flex32, { align: "center", gap: 3, children: [
|
|
12972
|
+
areaDelta != null && /* @__PURE__ */ jsx60(DeltaIndicator, { delta: areaDelta, icon: true }),
|
|
12973
|
+
area && /* @__PURE__ */ jsx60(
|
|
12528
12974
|
"span",
|
|
12529
12975
|
{
|
|
12530
12976
|
style: {
|
|
@@ -12546,32 +12992,32 @@ function WeaknessesList({
|
|
|
12546
12992
|
);
|
|
12547
12993
|
}) })
|
|
12548
12994
|
] }),
|
|
12549
|
-
efficiencyAnomalies.length > 0 && /* @__PURE__ */
|
|
12550
|
-
/* @__PURE__ */
|
|
12551
|
-
|
|
12995
|
+
efficiencyAnomalies.length > 0 && /* @__PURE__ */ jsxs44(Box31, { style: neutralCardStyle, children: [
|
|
12996
|
+
/* @__PURE__ */ jsx60(
|
|
12997
|
+
Box31,
|
|
12552
12998
|
{
|
|
12553
12999
|
padding: 4,
|
|
12554
13000
|
style: { borderBottom: "1px solid var(--card-border-color)" },
|
|
12555
|
-
children: /* @__PURE__ */
|
|
12556
|
-
/* @__PURE__ */
|
|
12557
|
-
/* @__PURE__ */
|
|
12558
|
-
/* @__PURE__ */
|
|
12559
|
-
/* @__PURE__ */
|
|
13001
|
+
children: /* @__PURE__ */ jsxs44(Stack34, { space: 2, children: [
|
|
13002
|
+
/* @__PURE__ */ jsxs44(Flex32, { align: "center", gap: 2, children: [
|
|
13003
|
+
/* @__PURE__ */ jsx60(BoltIcon2, { style: { color: "#fbbf24" } }),
|
|
13004
|
+
/* @__PURE__ */ jsx60(Text45, { size: 2, weight: "medium", children: "Efficiency Anomalies (>100%)" }),
|
|
13005
|
+
/* @__PURE__ */ jsx60(InfoTip, { text: GLOSSARY.efficiencyAnomalies })
|
|
12560
13006
|
] }),
|
|
12561
|
-
/* @__PURE__ */
|
|
13007
|
+
/* @__PURE__ */ jsx60(Text45, { muted: true, size: 2, children: "Agent outperforms injected docs \u2014 may indicate doc quality issues or agent memorization." })
|
|
12562
13008
|
] })
|
|
12563
13009
|
}
|
|
12564
13010
|
),
|
|
12565
|
-
/* @__PURE__ */
|
|
12566
|
-
|
|
13011
|
+
/* @__PURE__ */ jsx60(Stack34, { children: efficiencyAnomalies.map((area, i) => /* @__PURE__ */ jsxs44(
|
|
13012
|
+
Flex32,
|
|
12567
13013
|
{
|
|
12568
13014
|
align: "center",
|
|
12569
13015
|
justify: "space-between",
|
|
12570
13016
|
padding: 4,
|
|
12571
13017
|
style: i > 0 ? dividerStyle : void 0,
|
|
12572
13018
|
children: [
|
|
12573
|
-
/* @__PURE__ */
|
|
12574
|
-
/* @__PURE__ */
|
|
13019
|
+
/* @__PURE__ */ jsx60(Text45, { size: 2, children: area.feature }),
|
|
13020
|
+
/* @__PURE__ */ jsx60(
|
|
12575
13021
|
"span",
|
|
12576
13022
|
{
|
|
12577
13023
|
style: {
|
|
@@ -12599,12 +13045,12 @@ var tipArea = {
|
|
|
12599
13045
|
fontWeight: 600
|
|
12600
13046
|
};
|
|
12601
13047
|
function dimTip(area, dim, score, description) {
|
|
12602
|
-
return /* @__PURE__ */
|
|
12603
|
-
/* @__PURE__ */
|
|
13048
|
+
return /* @__PURE__ */ jsxs44(Text45, { size: 2, style: { lineHeight: 1.5 }, children: [
|
|
13049
|
+
/* @__PURE__ */ jsx60("span", { style: tipArea, children: area }),
|
|
12604
13050
|
" scores",
|
|
12605
13051
|
" ",
|
|
12606
|
-
/* @__PURE__ */
|
|
12607
|
-
/* @__PURE__ */
|
|
13052
|
+
/* @__PURE__ */ jsx60("span", { style: tipValue, children: score }),
|
|
13053
|
+
/* @__PURE__ */ jsx60("span", { style: { color: "var(--card-muted-fg-color)" }, children: "/100" }),
|
|
12608
13054
|
" on",
|
|
12609
13055
|
" ",
|
|
12610
13056
|
dim.toLowerCase(),
|
|
@@ -12633,7 +13079,7 @@ function getDimensionWeaknesses(area) {
|
|
|
12633
13079
|
}
|
|
12634
13080
|
|
|
12635
13081
|
// src/components/report-detail/ReportDetail.tsx
|
|
12636
|
-
import { jsx as
|
|
13082
|
+
import { Fragment as Fragment15, jsx as jsx61, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
12637
13083
|
var OVERVIEW_TAB = { id: "overview", label: "Overview" };
|
|
12638
13084
|
var DIAGNOSTICS_TAB = { id: "diagnostics", label: "Diagnostics" };
|
|
12639
13085
|
var ACTIVITY_TAB = { id: "activity", label: "Agent Activity" };
|
|
@@ -12650,9 +13096,9 @@ function ReportDetail({
|
|
|
12650
13096
|
subTab
|
|
12651
13097
|
}) {
|
|
12652
13098
|
const client = useClient12({ apiVersion: API_VERSION });
|
|
12653
|
-
const [loading, setLoading] =
|
|
12654
|
-
const [report, setReport] =
|
|
12655
|
-
|
|
13099
|
+
const [loading, setLoading] = useState28(true);
|
|
13100
|
+
const [report, setReport] = useState28(null);
|
|
13101
|
+
useEffect14(() => {
|
|
12656
13102
|
let cancelled = false;
|
|
12657
13103
|
setLoading(true);
|
|
12658
13104
|
client.fetch(reportDetailQuery, { reportId }).then((data) => {
|
|
@@ -12671,6 +13117,11 @@ function ReportDetail({
|
|
|
12671
13117
|
report?.provenance?.runId,
|
|
12672
13118
|
report?.summary?.artifactManifest?.testOutputs
|
|
12673
13119
|
);
|
|
13120
|
+
const diagnosisView = useDiagnosisArtifact(
|
|
13121
|
+
report?.provenance?.runId,
|
|
13122
|
+
reportId,
|
|
13123
|
+
report?.summary?.artifactManifest?.diagnosis
|
|
13124
|
+
);
|
|
12674
13125
|
const { summary } = report ?? {};
|
|
12675
13126
|
const hasWeaknesses = Boolean(
|
|
12676
13127
|
summary?.lowScoringJudgments && summary.lowScoringJudgments.length > 0
|
|
@@ -12681,34 +13132,34 @@ function ReportDetail({
|
|
|
12681
13132
|
const hasAgentActivity = Boolean(
|
|
12682
13133
|
summary?.agentBehavior && summary.agentBehavior.length > 0
|
|
12683
13134
|
);
|
|
12684
|
-
const tabs =
|
|
13135
|
+
const tabs = useMemo17(
|
|
12685
13136
|
() => [OVERVIEW_TAB, DIAGNOSTICS_TAB, ACTIVITY_TAB],
|
|
12686
13137
|
[]
|
|
12687
13138
|
);
|
|
12688
|
-
const disabledTabs =
|
|
13139
|
+
const disabledTabs = useMemo17(() => {
|
|
12689
13140
|
const set2 = /* @__PURE__ */ new Set();
|
|
12690
13141
|
if (!hasDiagnostics) set2.add("diagnostics");
|
|
12691
13142
|
if (!hasAgentActivity) set2.add("activity");
|
|
12692
13143
|
return set2;
|
|
12693
13144
|
}, [hasDiagnostics, hasAgentActivity]);
|
|
12694
|
-
const currentTab =
|
|
13145
|
+
const currentTab = useMemo17(() => {
|
|
12695
13146
|
const parsed = parseTab(activeTab);
|
|
12696
13147
|
if (disabledTabs.has(parsed)) return "overview";
|
|
12697
13148
|
return tabs.some((t) => t.id === parsed) ? parsed : "overview";
|
|
12698
13149
|
}, [activeTab, disabledTabs, tabs]);
|
|
12699
|
-
const handleTabClick =
|
|
13150
|
+
const handleTabClick = useCallback38(
|
|
12700
13151
|
(tabId) => {
|
|
12701
13152
|
onTabChange(tabId === "overview" ? null : tabId, null, null);
|
|
12702
13153
|
},
|
|
12703
13154
|
[onTabChange]
|
|
12704
13155
|
);
|
|
12705
13156
|
if (loading) {
|
|
12706
|
-
return /* @__PURE__ */
|
|
13157
|
+
return /* @__PURE__ */ jsx61(LoadingState, { message: "Loading report\u2026" });
|
|
12707
13158
|
}
|
|
12708
13159
|
if (!report || !summary) {
|
|
12709
|
-
return /* @__PURE__ */
|
|
12710
|
-
/* @__PURE__ */
|
|
12711
|
-
|
|
13160
|
+
return /* @__PURE__ */ jsx61(Box32, { padding: 5, children: /* @__PURE__ */ jsxs45(Stack35, { space: 4, children: [
|
|
13161
|
+
/* @__PURE__ */ jsx61(
|
|
13162
|
+
Button12,
|
|
12712
13163
|
{
|
|
12713
13164
|
icon: ArrowLeftIcon3,
|
|
12714
13165
|
mode: "bleed",
|
|
@@ -12716,18 +13167,18 @@ function ReportDetail({
|
|
|
12716
13167
|
text: "Back"
|
|
12717
13168
|
}
|
|
12718
13169
|
),
|
|
12719
|
-
/* @__PURE__ */
|
|
13170
|
+
/* @__PURE__ */ jsx61(Text46, { align: "center", muted: true, size: 3, children: "Report not found" })
|
|
12720
13171
|
] }) });
|
|
12721
13172
|
}
|
|
12722
13173
|
const { comparison, provenance } = report;
|
|
12723
13174
|
const totalTests = summary.scores.reduce((n, s) => n + s.testCount, 0);
|
|
12724
|
-
return /* @__PURE__ */
|
|
13175
|
+
return /* @__PURE__ */ jsx61(
|
|
12725
13176
|
ReportArtifactProvider,
|
|
12726
13177
|
{
|
|
12727
13178
|
runId: report.provenance?.runId,
|
|
12728
13179
|
manifest: summary?.artifactManifest,
|
|
12729
|
-
children: /* @__PURE__ */
|
|
12730
|
-
/* @__PURE__ */
|
|
13180
|
+
children: /* @__PURE__ */ jsx61(Box32, { padding: 4, children: /* @__PURE__ */ jsxs45(Stack35, { space: 5, children: [
|
|
13181
|
+
/* @__PURE__ */ jsx61(
|
|
12731
13182
|
ReportHeader,
|
|
12732
13183
|
{
|
|
12733
13184
|
completedAt: report.completedAt,
|
|
@@ -12736,11 +13187,11 @@ function ReportDetail({
|
|
|
12736
13187
|
title: report.title
|
|
12737
13188
|
}
|
|
12738
13189
|
),
|
|
12739
|
-
/* @__PURE__ */
|
|
12740
|
-
/* @__PURE__ */
|
|
13190
|
+
/* @__PURE__ */ jsxs45(Flex33, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
13191
|
+
/* @__PURE__ */ jsx61(TabList, { space: 1, children: tabs.map((tab) => {
|
|
12741
13192
|
const isDisabled = disabledTabs.has(tab.id);
|
|
12742
13193
|
const tooltip = getDisabledTabTooltip(tab.id, summary);
|
|
12743
|
-
const tabElement = /* @__PURE__ */
|
|
13194
|
+
const tabElement = /* @__PURE__ */ jsx61(
|
|
12744
13195
|
Tab,
|
|
12745
13196
|
{
|
|
12746
13197
|
"aria-controls": `panel-${tab.id}`,
|
|
@@ -12751,27 +13202,27 @@ function ReportDetail({
|
|
|
12751
13202
|
selected: currentTab === tab.id
|
|
12752
13203
|
}
|
|
12753
13204
|
);
|
|
12754
|
-
return isDisabled && tooltip ? /* @__PURE__ */
|
|
13205
|
+
return isDisabled && tooltip ? /* @__PURE__ */ jsx61(
|
|
12755
13206
|
Tooltip10,
|
|
12756
13207
|
{
|
|
12757
|
-
content: /* @__PURE__ */
|
|
13208
|
+
content: /* @__PURE__ */ jsx61(Box32, { padding: 2, style: { maxWidth: 280 }, children: tooltip }),
|
|
12758
13209
|
placement: "bottom",
|
|
12759
13210
|
portal: true,
|
|
12760
|
-
children: /* @__PURE__ */
|
|
13211
|
+
children: /* @__PURE__ */ jsx61("span", { style: { display: "inline-block" }, children: tabElement })
|
|
12761
13212
|
},
|
|
12762
13213
|
tab.id
|
|
12763
|
-
) : /* @__PURE__ */
|
|
13214
|
+
) : /* @__PURE__ */ jsx61("span", { children: tabElement }, tab.id);
|
|
12764
13215
|
}) }),
|
|
12765
|
-
/* @__PURE__ */
|
|
12766
|
-
/* @__PURE__ */
|
|
13216
|
+
/* @__PURE__ */ jsxs45(Flex33, { align: "center", gap: 2, style: { marginLeft: "auto" }, children: [
|
|
13217
|
+
/* @__PURE__ */ jsx61(
|
|
12767
13218
|
HoverTip,
|
|
12768
13219
|
{
|
|
12769
13220
|
text: SOURCE_TIP[provenance.source.name] ?? GLOSSARY.reportMode,
|
|
12770
|
-
children: /* @__PURE__ */
|
|
13221
|
+
children: /* @__PURE__ */ jsx61(Badge10, { mode: "outline", tone: "default", children: provenance.source.name })
|
|
12771
13222
|
}
|
|
12772
13223
|
),
|
|
12773
|
-
/* @__PURE__ */
|
|
12774
|
-
/* @__PURE__ */
|
|
13224
|
+
/* @__PURE__ */ jsx61(HoverTip, { text: MODE_TIP2[provenance.mode] ?? GLOSSARY.reportMode, children: /* @__PURE__ */ jsx61(Badge10, { tone: "primary", children: provenance.mode }) }),
|
|
13225
|
+
/* @__PURE__ */ jsx61(
|
|
12775
13226
|
ReportActions,
|
|
12776
13227
|
{
|
|
12777
13228
|
artifactManifest: summary.artifactManifest,
|
|
@@ -12783,14 +13234,14 @@ function ReportDetail({
|
|
|
12783
13234
|
)
|
|
12784
13235
|
] })
|
|
12785
13236
|
] }),
|
|
12786
|
-
currentTab === "overview" && /* @__PURE__ */
|
|
13237
|
+
currentTab === "overview" && /* @__PURE__ */ jsx61(
|
|
12787
13238
|
TabPanel,
|
|
12788
13239
|
{
|
|
12789
13240
|
"aria-labelledby": "tab-overview",
|
|
12790
13241
|
hidden: currentTab !== "overview",
|
|
12791
13242
|
id: "panel-overview",
|
|
12792
|
-
children: /* @__PURE__ */
|
|
12793
|
-
/* @__PURE__ */
|
|
13243
|
+
children: /* @__PURE__ */ jsxs45(Stack35, { space: 5, children: [
|
|
13244
|
+
/* @__PURE__ */ jsx61(
|
|
12794
13245
|
DiagnosticsOverview,
|
|
12795
13246
|
{
|
|
12796
13247
|
comparison,
|
|
@@ -12801,20 +13252,36 @@ function ReportDetail({
|
|
|
12801
13252
|
totalTests
|
|
12802
13253
|
}
|
|
12803
13254
|
),
|
|
12804
|
-
/* @__PURE__ */
|
|
12805
|
-
|
|
13255
|
+
diagnosisView.availability === "not-yet-generated" ? /* @__PURE__ */ jsx61(SynthesisNotGeneratedCTA, { reportId }) : /* @__PURE__ */ jsxs45(Fragment15, { children: [
|
|
13256
|
+
/* @__PURE__ */ jsx61(
|
|
13257
|
+
ScoreInterpretationPanel,
|
|
13258
|
+
{
|
|
13259
|
+
availability: diagnosisView.availability,
|
|
13260
|
+
cards: diagnosisView.cards
|
|
13261
|
+
}
|
|
13262
|
+
),
|
|
13263
|
+
/* @__PURE__ */ jsx61(
|
|
13264
|
+
RecommendationsSection,
|
|
13265
|
+
{
|
|
13266
|
+
availability: diagnosisView.availability,
|
|
13267
|
+
cards: diagnosisView.cards
|
|
13268
|
+
}
|
|
13269
|
+
)
|
|
13270
|
+
] }),
|
|
13271
|
+
/* @__PURE__ */ jsx61(CostLatencyPanel, { testResults: summary.testResults }),
|
|
13272
|
+
/* @__PURE__ */ jsx61(
|
|
12806
13273
|
LineageCard,
|
|
12807
13274
|
{
|
|
12808
13275
|
provenance,
|
|
12809
13276
|
reportId: report.reportId
|
|
12810
13277
|
}
|
|
12811
13278
|
),
|
|
12812
|
-
/* @__PURE__ */
|
|
12813
|
-
/* @__PURE__ */
|
|
13279
|
+
/* @__PURE__ */ jsx61(ProvenanceCard, { provenance }),
|
|
13280
|
+
/* @__PURE__ */ jsx61(PipelineExecutionPanel, {})
|
|
12814
13281
|
] })
|
|
12815
13282
|
}
|
|
12816
13283
|
),
|
|
12817
|
-
currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */
|
|
13284
|
+
currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */ jsx61(
|
|
12818
13285
|
DiagnosticsPanel,
|
|
12819
13286
|
{
|
|
12820
13287
|
artifactCache,
|
|
@@ -12830,13 +13297,13 @@ function ReportDetail({
|
|
|
12830
13297
|
testResults: summary.testResults
|
|
12831
13298
|
}
|
|
12832
13299
|
),
|
|
12833
|
-
currentTab === "activity" && hasAgentActivity && /* @__PURE__ */
|
|
13300
|
+
currentTab === "activity" && hasAgentActivity && /* @__PURE__ */ jsx61(
|
|
12834
13301
|
TabPanel,
|
|
12835
13302
|
{
|
|
12836
13303
|
"aria-labelledby": "tab-activity",
|
|
12837
13304
|
hidden: currentTab !== "activity",
|
|
12838
13305
|
id: "panel-activity",
|
|
12839
|
-
children: /* @__PURE__ */
|
|
13306
|
+
children: /* @__PURE__ */ jsx61(
|
|
12840
13307
|
AgentBehaviorCard,
|
|
12841
13308
|
{
|
|
12842
13309
|
agentBehavior: summary.agentBehavior,
|
|
@@ -12874,9 +13341,9 @@ function DiagnosticsPanel({
|
|
|
12874
13341
|
const issueCount = scores.filter((s) => s.totalScore < SCORE_CAUTION).length + scores.filter((s) => s.negativeDocLift).length + scores.filter(
|
|
12875
13342
|
(s) => s.infrastructureEfficiency != null && s.infrastructureEfficiency < EFFICIENCY_CAUTION && !s.invertedRetrievalGap
|
|
12876
13343
|
).length;
|
|
12877
|
-
return /* @__PURE__ */
|
|
12878
|
-
/* @__PURE__ */
|
|
12879
|
-
|
|
13344
|
+
return /* @__PURE__ */ jsx61(TabPanel, { "aria-labelledby": "tab-diagnostics", id: "panel-diagnostics", children: /* @__PURE__ */ jsxs45(Stack35, { space: 4, children: [
|
|
13345
|
+
/* @__PURE__ */ jsx61(
|
|
13346
|
+
Flex33,
|
|
12880
13347
|
{
|
|
12881
13348
|
align: "center",
|
|
12882
13349
|
gap: 1,
|
|
@@ -12885,7 +13352,7 @@ function DiagnosticsPanel({
|
|
|
12885
13352
|
paddingBottom: 8
|
|
12886
13353
|
},
|
|
12887
13354
|
wrap: "wrap",
|
|
12888
|
-
children: DIAG_TABS.map((tab) => /* @__PURE__ */
|
|
13355
|
+
children: DIAG_TABS.map((tab) => /* @__PURE__ */ jsxs45(
|
|
12889
13356
|
"button",
|
|
12890
13357
|
{
|
|
12891
13358
|
onClick: () => onNavigate(tab.id === "strengths" ? null : tab.id, null),
|
|
@@ -12905,7 +13372,7 @@ function DiagnosticsPanel({
|
|
|
12905
13372
|
type: "button",
|
|
12906
13373
|
children: [
|
|
12907
13374
|
tab.label,
|
|
12908
|
-
tab.id === "issues" && issueCount > 0 && /* @__PURE__ */
|
|
13375
|
+
tab.id === "issues" && issueCount > 0 && /* @__PURE__ */ jsx61(
|
|
12909
13376
|
"span",
|
|
12910
13377
|
{
|
|
12911
13378
|
style: {
|
|
@@ -12925,7 +13392,7 @@ function DiagnosticsPanel({
|
|
|
12925
13392
|
))
|
|
12926
13393
|
}
|
|
12927
13394
|
),
|
|
12928
|
-
subTab === "strengths" && /* @__PURE__ */
|
|
13395
|
+
subTab === "strengths" && /* @__PURE__ */ jsx61(
|
|
12929
13396
|
StrengthsList,
|
|
12930
13397
|
{
|
|
12931
13398
|
comparison,
|
|
@@ -12934,8 +13401,8 @@ function DiagnosticsPanel({
|
|
|
12934
13401
|
scores
|
|
12935
13402
|
}
|
|
12936
13403
|
),
|
|
12937
|
-
subTab === "issues" && /* @__PURE__ */
|
|
12938
|
-
/* @__PURE__ */
|
|
13404
|
+
subTab === "issues" && /* @__PURE__ */ jsxs45(Stack35, { space: 5, children: [
|
|
13405
|
+
/* @__PURE__ */ jsx61(
|
|
12939
13406
|
WeaknessesList,
|
|
12940
13407
|
{
|
|
12941
13408
|
comparison,
|
|
@@ -12944,8 +13411,8 @@ function DiagnosticsPanel({
|
|
|
12944
13411
|
scores
|
|
12945
13412
|
}
|
|
12946
13413
|
),
|
|
12947
|
-
FEATURE_FLAGS.showFailureModes.enabled && /* @__PURE__ */
|
|
12948
|
-
judgments && judgments.length > 0 && /* @__PURE__ */
|
|
13414
|
+
FEATURE_FLAGS.showFailureModes.enabled && /* @__PURE__ */ jsx61(FailureModesPanel, { failureModes }),
|
|
13415
|
+
judgments && judgments.length > 0 && /* @__PURE__ */ jsx61(
|
|
12949
13416
|
JudgmentList,
|
|
12950
13417
|
{
|
|
12951
13418
|
artifactCache,
|
|
@@ -12981,17 +13448,17 @@ function getDisabledTabTooltip(tabId, summary) {
|
|
|
12981
13448
|
if (!summary) return null;
|
|
12982
13449
|
switch (tabId) {
|
|
12983
13450
|
case "diagnostics":
|
|
12984
|
-
return /* @__PURE__ */
|
|
13451
|
+
return /* @__PURE__ */ jsx61(Text46, { muted: true, size: 2, children: "No diagnostic data available. Diagnostics require at least one scored feature area." });
|
|
12985
13452
|
case "activity":
|
|
12986
|
-
return summary.evaluationMode === "baseline" ? /* @__PURE__ */
|
|
13453
|
+
return summary.evaluationMode === "baseline" ? /* @__PURE__ */ jsxs45(Text46, { muted: true, size: 2, children: [
|
|
12987
13454
|
"Not available for baseline-only evaluations. Run with",
|
|
12988
13455
|
" ",
|
|
12989
|
-
/* @__PURE__ */
|
|
13456
|
+
/* @__PURE__ */ jsx61("code", { style: inlineCodeStyle, children: "--mode full" }),
|
|
12990
13457
|
" or",
|
|
12991
13458
|
" ",
|
|
12992
|
-
/* @__PURE__ */
|
|
13459
|
+
/* @__PURE__ */ jsx61("code", { style: inlineCodeStyle, children: "--mode agentic" }),
|
|
12993
13460
|
" to capture agent browsing behavior."
|
|
12994
|
-
] }) : /* @__PURE__ */
|
|
13461
|
+
] }) : /* @__PURE__ */ jsx61(Text46, { muted: true, size: 2, children: "No agent activity data was recorded for this evaluation." });
|
|
12995
13462
|
default:
|
|
12996
13463
|
return null;
|
|
12997
13464
|
}
|
|
@@ -12999,12 +13466,12 @@ function getDisabledTabTooltip(tabId, summary) {
|
|
|
12999
13466
|
|
|
13000
13467
|
// src/components/report-detail/AreaScoreRow.tsx
|
|
13001
13468
|
import { WarningOutlineIcon as WarningOutlineIcon4 } from "@sanity/icons";
|
|
13002
|
-
import { Box as
|
|
13003
|
-
import { jsx as
|
|
13469
|
+
import { Box as Box33, Flex as Flex34, Stack as Stack36, Text as Text47 } from "@sanity/ui";
|
|
13470
|
+
import { jsx as jsx62, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
13004
13471
|
|
|
13005
13472
|
// src/components/report-detail/AreaScoreTable.tsx
|
|
13006
|
-
import
|
|
13007
|
-
import { Card as
|
|
13473
|
+
import React6 from "react";
|
|
13474
|
+
import { Card as Card22, Stack as Stack37, Text as Text49 } from "@sanity/ui";
|
|
13008
13475
|
|
|
13009
13476
|
// src/lib/scoring.ts
|
|
13010
13477
|
var TONE_MAP = {
|
|
@@ -13033,49 +13500,44 @@ function scoreHex(score) {
|
|
|
13033
13500
|
}
|
|
13034
13501
|
|
|
13035
13502
|
// src/components/primitives/ScoreCell.tsx
|
|
13036
|
-
import { Card as
|
|
13037
|
-
import { jsx as
|
|
13503
|
+
import { Card as Card21, Text as Text48 } from "@sanity/ui";
|
|
13504
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
13038
13505
|
|
|
13039
13506
|
// src/components/report-detail/AreaScoreTable.tsx
|
|
13040
|
-
import { jsx as
|
|
13507
|
+
import { jsx as jsx64, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
13041
13508
|
|
|
13042
13509
|
// src/components/report-detail/AutoComparisonCard.tsx
|
|
13043
|
-
import { Badge as Badge11, Box as
|
|
13044
|
-
import { jsx as
|
|
13510
|
+
import { Badge as Badge11, Box as Box34, Card as Card23, Flex as Flex35, Grid as Grid5, Stack as Stack38, Text as Text50, Tooltip as Tooltip11 } from "@sanity/ui";
|
|
13511
|
+
import { jsx as jsx65, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
13045
13512
|
|
|
13046
13513
|
// src/components/report-detail/OverviewStats.tsx
|
|
13047
13514
|
import { Grid as Grid6 } from "@sanity/ui";
|
|
13048
|
-
import { jsx as
|
|
13049
|
-
|
|
13050
|
-
// src/components/report-detail/RecommendationsSection.tsx
|
|
13051
|
-
import { BoltIcon as BoltIcon2 } from "@sanity/icons";
|
|
13052
|
-
import { Box as Box32, Flex as Flex33, Stack as Stack36, Text as Text47 } from "@sanity/ui";
|
|
13053
|
-
import { jsx as jsx63, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
13515
|
+
import { jsx as jsx66, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
13054
13516
|
|
|
13055
13517
|
// src/components/report-detail/ThreeLayerTable.tsx
|
|
13056
|
-
import
|
|
13057
|
-
import { Badge as Badge12, Card as
|
|
13058
|
-
import { jsx as
|
|
13518
|
+
import React7 from "react";
|
|
13519
|
+
import { Badge as Badge12, Card as Card24, Flex as Flex36, Stack as Stack39, Text as Text51 } from "@sanity/ui";
|
|
13520
|
+
import { jsx as jsx67, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
13059
13521
|
|
|
13060
13522
|
// src/components/report-detail/JudgmentDetailDrawerOutlet.tsx
|
|
13061
|
-
import { Card as
|
|
13062
|
-
import { useCallback as
|
|
13523
|
+
import { Card as Card25 } from "@sanity/ui";
|
|
13524
|
+
import { useCallback as useCallback39, useEffect as useEffect16, useRef as useRef8, useState as useState30 } from "react";
|
|
13063
13525
|
|
|
13064
13526
|
// src/components/report-detail/JudgmentDetailDrawer.tsx
|
|
13065
|
-
import { useEffect as
|
|
13527
|
+
import { useEffect as useEffect15, useState as useState29 } from "react";
|
|
13066
13528
|
import { CloseIcon as CloseIcon3 } from "@sanity/icons";
|
|
13067
13529
|
import {
|
|
13068
|
-
Box as
|
|
13069
|
-
Button as
|
|
13070
|
-
Flex as
|
|
13071
|
-
Stack as
|
|
13530
|
+
Box as Box35,
|
|
13531
|
+
Button as Button13,
|
|
13532
|
+
Flex as Flex37,
|
|
13533
|
+
Stack as Stack40,
|
|
13072
13534
|
Tab as Tab2,
|
|
13073
13535
|
TabList as TabList2,
|
|
13074
13536
|
TabPanel as TabPanel2,
|
|
13075
|
-
Text as
|
|
13537
|
+
Text as Text52,
|
|
13076
13538
|
Tooltip as Tooltip12
|
|
13077
13539
|
} from "@sanity/ui";
|
|
13078
|
-
import { jsx as
|
|
13540
|
+
import { jsx as jsx68, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
13079
13541
|
var HEADER_STYLE = {
|
|
13080
13542
|
borderBottom: "1px solid var(--card-border-color)"
|
|
13081
13543
|
};
|
|
@@ -13111,10 +13573,10 @@ var COPY_BUTTON_SLOT_STYLE = {
|
|
|
13111
13573
|
function DocBadge({
|
|
13112
13574
|
doc
|
|
13113
13575
|
}) {
|
|
13114
|
-
const [hovered, setHovered] =
|
|
13576
|
+
const [hovered, setHovered] = useState29(false);
|
|
13115
13577
|
const isLinked = Boolean(doc.documentId);
|
|
13116
13578
|
const tooltipLabel = isLinked ? `Edit "${doc.title || doc.slug}"` : doc.title || doc.slug;
|
|
13117
|
-
const badge = /* @__PURE__ */
|
|
13579
|
+
const badge = /* @__PURE__ */ jsx68(
|
|
13118
13580
|
"span",
|
|
13119
13581
|
{
|
|
13120
13582
|
style: {
|
|
@@ -13127,13 +13589,13 @@ function DocBadge({
|
|
|
13127
13589
|
children: doc.slug
|
|
13128
13590
|
}
|
|
13129
13591
|
);
|
|
13130
|
-
return /* @__PURE__ */
|
|
13592
|
+
return /* @__PURE__ */ jsx68(
|
|
13131
13593
|
Tooltip12,
|
|
13132
13594
|
{
|
|
13133
|
-
content: /* @__PURE__ */
|
|
13595
|
+
content: /* @__PURE__ */ jsx68(Box35, { padding: 2, children: /* @__PURE__ */ jsx68(Text52, { size: 2, children: tooltipLabel }) }),
|
|
13134
13596
|
placement: "bottom",
|
|
13135
13597
|
portal: true,
|
|
13136
|
-
children: isLinked ? /* @__PURE__ */
|
|
13598
|
+
children: isLinked ? /* @__PURE__ */ jsx68(
|
|
13137
13599
|
"a",
|
|
13138
13600
|
{
|
|
13139
13601
|
href: `/intent/edit/id=${doc.documentId}`,
|
|
@@ -13148,7 +13610,7 @@ function DocBadge({
|
|
|
13148
13610
|
},
|
|
13149
13611
|
children: badge
|
|
13150
13612
|
}
|
|
13151
|
-
) : /* @__PURE__ */
|
|
13613
|
+
) : /* @__PURE__ */ jsx68("span", { children: badge })
|
|
13152
13614
|
}
|
|
13153
13615
|
);
|
|
13154
13616
|
}
|
|
@@ -13159,14 +13621,14 @@ function JudgmentDetailDrawer({
|
|
|
13159
13621
|
onShowPrompts,
|
|
13160
13622
|
testResult
|
|
13161
13623
|
}) {
|
|
13162
|
-
const [tab, setTab] =
|
|
13624
|
+
const [tab, setTab] = useState29("reasoning");
|
|
13163
13625
|
const sep = judgment.taskId.indexOf(" - ");
|
|
13164
13626
|
const rawTaskName = sep > 0 ? judgment.taskId.substring(sep + 3) : judgment.taskId;
|
|
13165
13627
|
const { name: taskName, variant } = splitVariant(rawTaskName);
|
|
13166
13628
|
const dimLabel = dimensionLabel2(judgment.dimension);
|
|
13167
13629
|
const judgmentId = judgment.id ?? "";
|
|
13168
13630
|
const [fullJudgment, fullStatus, requestFullJudgment] = useArtifactDetail("graderJudgments", judgmentId);
|
|
13169
|
-
|
|
13631
|
+
useEffect15(() => {
|
|
13170
13632
|
if (!judgmentId) return;
|
|
13171
13633
|
if (fullStatus !== "idle") return;
|
|
13172
13634
|
void requestFullJudgment();
|
|
@@ -13174,11 +13636,11 @@ function JudgmentDetailDrawer({
|
|
|
13174
13636
|
const fullReason = typeof fullJudgment?.reason === "string" && fullJudgment.reason.length > 0 ? fullJudgment.reason : null;
|
|
13175
13637
|
const reasoningText = fullReason ?? judgment.reason;
|
|
13176
13638
|
const reasoningIsPreview = fullReason === null && judgmentId.length > 0 && fullStatus !== "error";
|
|
13177
|
-
|
|
13639
|
+
useEffect15(() => {
|
|
13178
13640
|
setTab("reasoning");
|
|
13179
13641
|
}, [judgment.taskId, judgment.dimension, judgment.modelId]);
|
|
13180
|
-
const [fetchDispatched, setFetchDispatched] =
|
|
13181
|
-
|
|
13642
|
+
const [fetchDispatched, setFetchDispatched] = useState29(false);
|
|
13643
|
+
useEffect15(() => {
|
|
13182
13644
|
setFetchDispatched(false);
|
|
13183
13645
|
}, [judgment.taskId, judgment.dimension, judgment.modelId]);
|
|
13184
13646
|
const inlineOutput = testResult?.responseOutput;
|
|
@@ -13193,7 +13655,7 @@ function JudgmentDetailDrawer({
|
|
|
13193
13655
|
const fetchFailed = canAttemptFetch && artifactCache?.status === "error";
|
|
13194
13656
|
const entryUnavailable = canAttemptFetch && fetchDispatched && !fetchInFlight && !fetchFailed;
|
|
13195
13657
|
const hasOutputTab = resolvedOutput != null || canAttemptFetch;
|
|
13196
|
-
|
|
13658
|
+
useEffect15(() => {
|
|
13197
13659
|
if (tab === "output" && canAttemptFetch && !fetchDispatched) {
|
|
13198
13660
|
setFetchDispatched(true);
|
|
13199
13661
|
void artifactCache.fetchOutput(judgment.taskId, judgment.modelId);
|
|
@@ -13206,22 +13668,22 @@ function JudgmentDetailDrawer({
|
|
|
13206
13668
|
judgment.taskId,
|
|
13207
13669
|
judgment.modelId
|
|
13208
13670
|
]);
|
|
13209
|
-
|
|
13671
|
+
useEffect15(() => {
|
|
13210
13672
|
const onKeyDown = (e) => {
|
|
13211
13673
|
if (e.key === "Escape") onClose();
|
|
13212
13674
|
};
|
|
13213
13675
|
window.addEventListener("keydown", onKeyDown);
|
|
13214
13676
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
13215
13677
|
}, [onClose]);
|
|
13216
|
-
return /* @__PURE__ */
|
|
13217
|
-
|
|
13678
|
+
return /* @__PURE__ */ jsxs51(
|
|
13679
|
+
Flex37,
|
|
13218
13680
|
{
|
|
13219
13681
|
"aria-label": `Judgment detail: ${judgment.score} ${dimLabel}, ${taskName}`,
|
|
13220
13682
|
direction: "column",
|
|
13221
13683
|
role: "dialog",
|
|
13222
13684
|
style: { flex: 1, height: "100%", minHeight: 0, overflow: "hidden" },
|
|
13223
13685
|
children: [
|
|
13224
|
-
/* @__PURE__ */
|
|
13686
|
+
/* @__PURE__ */ jsx68(
|
|
13225
13687
|
"div",
|
|
13226
13688
|
{
|
|
13227
13689
|
"aria-hidden": true,
|
|
@@ -13234,10 +13696,10 @@ function JudgmentDetailDrawer({
|
|
|
13234
13696
|
}
|
|
13235
13697
|
}
|
|
13236
13698
|
),
|
|
13237
|
-
/* @__PURE__ */
|
|
13238
|
-
/* @__PURE__ */
|
|
13239
|
-
/* @__PURE__ */
|
|
13240
|
-
/* @__PURE__ */
|
|
13699
|
+
/* @__PURE__ */ jsxs51(Flex37, { align: "flex-start", gap: 2, padding: 4, style: HEADER_STYLE, children: [
|
|
13700
|
+
/* @__PURE__ */ jsxs51(Stack40, { flex: 1, space: 2, children: [
|
|
13701
|
+
/* @__PURE__ */ jsxs51(Flex37, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
13702
|
+
/* @__PURE__ */ jsx68(
|
|
13241
13703
|
"span",
|
|
13242
13704
|
{
|
|
13243
13705
|
style: {
|
|
@@ -13252,7 +13714,7 @@ function JudgmentDetailDrawer({
|
|
|
13252
13714
|
children: judgment.score
|
|
13253
13715
|
}
|
|
13254
13716
|
),
|
|
13255
|
-
/* @__PURE__ */
|
|
13717
|
+
/* @__PURE__ */ jsx68(
|
|
13256
13718
|
"span",
|
|
13257
13719
|
{
|
|
13258
13720
|
style: {
|
|
@@ -13265,13 +13727,13 @@ function JudgmentDetailDrawer({
|
|
|
13265
13727
|
children: dimLabel
|
|
13266
13728
|
}
|
|
13267
13729
|
),
|
|
13268
|
-
/* @__PURE__ */
|
|
13730
|
+
/* @__PURE__ */ jsx68(
|
|
13269
13731
|
Tooltip12,
|
|
13270
13732
|
{
|
|
13271
|
-
content: /* @__PURE__ */
|
|
13733
|
+
content: /* @__PURE__ */ jsx68(Box35, { padding: 2, children: /* @__PURE__ */ jsx68(Text52, { size: 1, children: judgment.modelId }) }),
|
|
13272
13734
|
placement: "bottom",
|
|
13273
13735
|
portal: true,
|
|
13274
|
-
children: /* @__PURE__ */
|
|
13736
|
+
children: /* @__PURE__ */ jsx68(
|
|
13275
13737
|
"span",
|
|
13276
13738
|
{
|
|
13277
13739
|
style: {
|
|
@@ -13288,7 +13750,7 @@ function JudgmentDetailDrawer({
|
|
|
13288
13750
|
)
|
|
13289
13751
|
}
|
|
13290
13752
|
),
|
|
13291
|
-
(testResult?.latencyMs != null || testResult?.cost != null && testResult.cost > 0) && /* @__PURE__ */
|
|
13753
|
+
(testResult?.latencyMs != null || testResult?.cost != null && testResult.cost > 0) && /* @__PURE__ */ jsx68(
|
|
13292
13754
|
"span",
|
|
13293
13755
|
{
|
|
13294
13756
|
"aria-hidden": true,
|
|
@@ -13300,38 +13762,38 @@ function JudgmentDetailDrawer({
|
|
|
13300
13762
|
}
|
|
13301
13763
|
}
|
|
13302
13764
|
),
|
|
13303
|
-
testResult?.latencyMs != null && /* @__PURE__ */
|
|
13765
|
+
testResult?.latencyMs != null && /* @__PURE__ */ jsx68(
|
|
13304
13766
|
Tooltip12,
|
|
13305
13767
|
{
|
|
13306
|
-
content: /* @__PURE__ */
|
|
13768
|
+
content: /* @__PURE__ */ jsx68(Box35, { padding: 2, children: /* @__PURE__ */ jsx68(Text52, { size: 1, children: "End-to-end generation latency for this model call." }) }),
|
|
13307
13769
|
placement: "bottom",
|
|
13308
13770
|
portal: true,
|
|
13309
|
-
children: /* @__PURE__ */
|
|
13771
|
+
children: /* @__PURE__ */ jsxs51(Text52, { muted: true, size: 1, children: [
|
|
13310
13772
|
(testResult.latencyMs / 1e3).toFixed(1),
|
|
13311
13773
|
"s"
|
|
13312
13774
|
] })
|
|
13313
13775
|
}
|
|
13314
13776
|
),
|
|
13315
|
-
testResult?.cost != null && testResult.cost > 0 && /* @__PURE__ */
|
|
13777
|
+
testResult?.cost != null && testResult.cost > 0 && /* @__PURE__ */ jsx68(
|
|
13316
13778
|
Tooltip12,
|
|
13317
13779
|
{
|
|
13318
|
-
content: /* @__PURE__ */
|
|
13780
|
+
content: /* @__PURE__ */ jsx68(Box35, { padding: 2, children: /* @__PURE__ */ jsx68(Text52, { size: 1, children: "Provider-reported cost for this model call." }) }),
|
|
13319
13781
|
placement: "bottom",
|
|
13320
13782
|
portal: true,
|
|
13321
|
-
children: /* @__PURE__ */
|
|
13783
|
+
children: /* @__PURE__ */ jsxs51(Text52, { muted: true, size: 1, children: [
|
|
13322
13784
|
"$",
|
|
13323
13785
|
testResult.cost.toFixed(4)
|
|
13324
13786
|
] })
|
|
13325
13787
|
}
|
|
13326
13788
|
)
|
|
13327
13789
|
] }),
|
|
13328
|
-
/* @__PURE__ */
|
|
13329
|
-
/* @__PURE__ */
|
|
13330
|
-
/* @__PURE__ */
|
|
13790
|
+
/* @__PURE__ */ jsxs51(Flex37, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
13791
|
+
/* @__PURE__ */ jsx68(Text52, { size: 2, weight: "medium", children: taskName }),
|
|
13792
|
+
/* @__PURE__ */ jsx68(VariantBadge, { variant })
|
|
13331
13793
|
] })
|
|
13332
13794
|
] }),
|
|
13333
|
-
/* @__PURE__ */
|
|
13334
|
-
/* @__PURE__ */
|
|
13795
|
+
/* @__PURE__ */ jsxs51(Flex37, { align: "center", gap: 1, children: [
|
|
13796
|
+
/* @__PURE__ */ jsx68(
|
|
13335
13797
|
"span",
|
|
13336
13798
|
{
|
|
13337
13799
|
style: {
|
|
@@ -13349,8 +13811,8 @@ function JudgmentDetailDrawer({
|
|
|
13349
13811
|
children: "Esc"
|
|
13350
13812
|
}
|
|
13351
13813
|
),
|
|
13352
|
-
/* @__PURE__ */
|
|
13353
|
-
|
|
13814
|
+
/* @__PURE__ */ jsx68(
|
|
13815
|
+
Button13,
|
|
13354
13816
|
{
|
|
13355
13817
|
"aria-label": "Close (Esc)",
|
|
13356
13818
|
autoFocus: true,
|
|
@@ -13362,8 +13824,8 @@ function JudgmentDetailDrawer({
|
|
|
13362
13824
|
)
|
|
13363
13825
|
] })
|
|
13364
13826
|
] }),
|
|
13365
|
-
/* @__PURE__ */
|
|
13366
|
-
|
|
13827
|
+
/* @__PURE__ */ jsxs51(
|
|
13828
|
+
Flex37,
|
|
13367
13829
|
{
|
|
13368
13830
|
align: "center",
|
|
13369
13831
|
gap: 2,
|
|
@@ -13372,8 +13834,8 @@ function JudgmentDetailDrawer({
|
|
|
13372
13834
|
paddingY: 2,
|
|
13373
13835
|
style: TAB_BAR_STYLE,
|
|
13374
13836
|
children: [
|
|
13375
|
-
/* @__PURE__ */
|
|
13376
|
-
/* @__PURE__ */
|
|
13837
|
+
/* @__PURE__ */ jsx68(Box35, { flex: 1, style: { minWidth: 0 }, children: /* @__PURE__ */ jsxs51(TabList2, { space: 2, children: [
|
|
13838
|
+
/* @__PURE__ */ jsx68(
|
|
13377
13839
|
Tab2,
|
|
13378
13840
|
{
|
|
13379
13841
|
"aria-controls": "judgment-panel-reasoning",
|
|
@@ -13383,7 +13845,7 @@ function JudgmentDetailDrawer({
|
|
|
13383
13845
|
selected: tab === "reasoning"
|
|
13384
13846
|
}
|
|
13385
13847
|
),
|
|
13386
|
-
hasOutputTab && /* @__PURE__ */
|
|
13848
|
+
hasOutputTab && /* @__PURE__ */ jsx68(
|
|
13387
13849
|
Tab2,
|
|
13388
13850
|
{
|
|
13389
13851
|
"aria-controls": "judgment-panel-output",
|
|
@@ -13394,7 +13856,7 @@ function JudgmentDetailDrawer({
|
|
|
13394
13856
|
}
|
|
13395
13857
|
)
|
|
13396
13858
|
] }) }),
|
|
13397
|
-
/* @__PURE__ */
|
|
13859
|
+
/* @__PURE__ */ jsx68(
|
|
13398
13860
|
JudgmentActions,
|
|
13399
13861
|
{
|
|
13400
13862
|
onShowPrompts: onShowPrompts ? () => onShowPrompts(judgment) : void 0
|
|
@@ -13403,15 +13865,15 @@ function JudgmentDetailDrawer({
|
|
|
13403
13865
|
]
|
|
13404
13866
|
}
|
|
13405
13867
|
),
|
|
13406
|
-
/* @__PURE__ */
|
|
13407
|
-
/* @__PURE__ */
|
|
13868
|
+
/* @__PURE__ */ jsxs51(Box35, { padding: 4, style: CONTENT_STYLE, children: [
|
|
13869
|
+
/* @__PURE__ */ jsx68(
|
|
13408
13870
|
TabPanel2,
|
|
13409
13871
|
{
|
|
13410
13872
|
"aria-labelledby": "judgment-tab-reasoning",
|
|
13411
13873
|
hidden: tab !== "reasoning",
|
|
13412
13874
|
id: "judgment-panel-reasoning",
|
|
13413
|
-
children: /* @__PURE__ */
|
|
13414
|
-
/* @__PURE__ */
|
|
13875
|
+
children: /* @__PURE__ */ jsxs51(Box35, { style: COPYABLE_BLOCK_STYLE, children: [
|
|
13876
|
+
/* @__PURE__ */ jsx68(Box35, { style: COPY_BUTTON_SLOT_STYLE, children: /* @__PURE__ */ jsx68(
|
|
13415
13877
|
CopyButton,
|
|
13416
13878
|
{
|
|
13417
13879
|
copiedLabel: "Reasoning copied",
|
|
@@ -13419,26 +13881,26 @@ function JudgmentDetailDrawer({
|
|
|
13419
13881
|
text: reasoningText
|
|
13420
13882
|
}
|
|
13421
13883
|
) }),
|
|
13422
|
-
/* @__PURE__ */
|
|
13423
|
-
reasoningIsPreview && /* @__PURE__ */
|
|
13884
|
+
/* @__PURE__ */ jsx68(Markdown, { content: reasoningText }),
|
|
13885
|
+
reasoningIsPreview && /* @__PURE__ */ jsx68(Text52, { muted: true, size: 1, style: { marginTop: 8 }, children: fullStatus === "loading" ? "Loading full reasoning\u2026" : "Showing preview (280 chars). Full reasoning not yet loaded." })
|
|
13424
13886
|
] })
|
|
13425
13887
|
}
|
|
13426
13888
|
),
|
|
13427
|
-
hasOutputTab && /* @__PURE__ */
|
|
13889
|
+
hasOutputTab && /* @__PURE__ */ jsxs51(
|
|
13428
13890
|
TabPanel2,
|
|
13429
13891
|
{
|
|
13430
13892
|
"aria-labelledby": "judgment-tab-output",
|
|
13431
13893
|
hidden: tab !== "output",
|
|
13432
13894
|
id: "judgment-panel-output",
|
|
13433
13895
|
children: [
|
|
13434
|
-
!resolvedOutput && fetchInFlight && /* @__PURE__ */
|
|
13435
|
-
!resolvedOutput && fetchFailed && /* @__PURE__ */
|
|
13896
|
+
!resolvedOutput && fetchInFlight && /* @__PURE__ */ jsx68(Text52, { muted: true, size: 1, children: "Fetching model output\u2026" }),
|
|
13897
|
+
!resolvedOutput && fetchFailed && /* @__PURE__ */ jsxs51(Text52, { muted: true, size: 1, style: { color: "#f87171" }, children: [
|
|
13436
13898
|
"Failed to load model output",
|
|
13437
13899
|
artifactCache?.error ? `: ${artifactCache.error}` : ""
|
|
13438
13900
|
] }),
|
|
13439
|
-
!resolvedOutput && entryUnavailable && /* @__PURE__ */
|
|
13440
|
-
resolvedOutput && /* @__PURE__ */
|
|
13441
|
-
/* @__PURE__ */
|
|
13901
|
+
!resolvedOutput && entryUnavailable && /* @__PURE__ */ jsx68(Text52, { muted: true, size: 1, children: "Model output not available for this entry." }),
|
|
13902
|
+
resolvedOutput && /* @__PURE__ */ jsxs51(Box35, { style: COPYABLE_BLOCK_STYLE, children: [
|
|
13903
|
+
/* @__PURE__ */ jsx68(Box35, { style: COPY_BUTTON_SLOT_STYLE, children: /* @__PURE__ */ jsx68(
|
|
13442
13904
|
CopyButton,
|
|
13443
13905
|
{
|
|
13444
13906
|
copiedLabel: "Output copied",
|
|
@@ -13446,7 +13908,7 @@ function JudgmentDetailDrawer({
|
|
|
13446
13908
|
text: resolvedOutput
|
|
13447
13909
|
}
|
|
13448
13910
|
) }),
|
|
13449
|
-
/* @__PURE__ */
|
|
13911
|
+
/* @__PURE__ */ jsx68(Markdown, { content: resolvedOutput })
|
|
13450
13912
|
] })
|
|
13451
13913
|
]
|
|
13452
13914
|
}
|
|
@@ -13454,9 +13916,9 @@ function JudgmentDetailDrawer({
|
|
|
13454
13916
|
] }),
|
|
13455
13917
|
(() => {
|
|
13456
13918
|
const docs = judgment.contextDocs ?? judgment.canonicalDocs;
|
|
13457
|
-
return docs && docs.length > 0 ? /* @__PURE__ */
|
|
13458
|
-
/* @__PURE__ */
|
|
13459
|
-
docs.map((doc) => /* @__PURE__ */
|
|
13919
|
+
return docs && docs.length > 0 ? /* @__PURE__ */ jsx68(Box35, { padding: 4, style: RELATED_DOCS_STYLE, children: /* @__PURE__ */ jsxs51(Flex37, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
13920
|
+
/* @__PURE__ */ jsx68("span", { style: SECTION_LABEL_STYLE, children: "Related docs" }),
|
|
13921
|
+
docs.map((doc) => /* @__PURE__ */ jsx68(DocBadge, { doc }, doc.slug))
|
|
13460
13922
|
] }) }) : null;
|
|
13461
13923
|
})()
|
|
13462
13924
|
]
|
|
@@ -13465,7 +13927,7 @@ function JudgmentDetailDrawer({
|
|
|
13465
13927
|
}
|
|
13466
13928
|
|
|
13467
13929
|
// src/components/report-detail/JudgmentDetailDrawerOutlet.tsx
|
|
13468
|
-
import { jsx as
|
|
13930
|
+
import { jsx as jsx69, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
13469
13931
|
var MIN_WIDTH2 = 480;
|
|
13470
13932
|
var MAX_WIDTH2 = 900;
|
|
13471
13933
|
var OVERLAY_BREAKPOINT2 = 1024;
|
|
@@ -13475,10 +13937,10 @@ function computeDefaultWidth() {
|
|
|
13475
13937
|
return Math.min(MAX_WIDTH2, Math.max(MIN_WIDTH2, target));
|
|
13476
13938
|
}
|
|
13477
13939
|
function useIsNarrow2() {
|
|
13478
|
-
const [narrow, setNarrow] =
|
|
13940
|
+
const [narrow, setNarrow] = useState30(
|
|
13479
13941
|
() => typeof window !== "undefined" && window.innerWidth < OVERLAY_BREAKPOINT2
|
|
13480
13942
|
);
|
|
13481
|
-
|
|
13943
|
+
useEffect16(() => {
|
|
13482
13944
|
function handleResize() {
|
|
13483
13945
|
setNarrow(window.innerWidth < OVERLAY_BREAKPOINT2);
|
|
13484
13946
|
}
|
|
@@ -13488,11 +13950,11 @@ function useIsNarrow2() {
|
|
|
13488
13950
|
return narrow;
|
|
13489
13951
|
}
|
|
13490
13952
|
function useResizable2(defaultWidth) {
|
|
13491
|
-
const [width, setWidth] =
|
|
13953
|
+
const [width, setWidth] = useState30(defaultWidth);
|
|
13492
13954
|
const dragging = useRef8(false);
|
|
13493
13955
|
const startX = useRef8(0);
|
|
13494
13956
|
const startWidth = useRef8(0);
|
|
13495
|
-
const handleMouseDown =
|
|
13957
|
+
const handleMouseDown = useCallback39(
|
|
13496
13958
|
(e) => {
|
|
13497
13959
|
e.preventDefault();
|
|
13498
13960
|
dragging.current = true;
|
|
@@ -13503,7 +13965,7 @@ function useResizable2(defaultWidth) {
|
|
|
13503
13965
|
},
|
|
13504
13966
|
[width]
|
|
13505
13967
|
);
|
|
13506
|
-
|
|
13968
|
+
useEffect16(() => {
|
|
13507
13969
|
function handleMouseMove(e) {
|
|
13508
13970
|
if (!dragging.current) return;
|
|
13509
13971
|
const delta = startX.current - e.clientX;
|
|
@@ -13535,7 +13997,7 @@ function JudgmentDetailDrawerOutlet({
|
|
|
13535
13997
|
const isNarrow = useIsNarrow2();
|
|
13536
13998
|
const { handleMouseDown, width } = useResizable2(computeDefaultWidth());
|
|
13537
13999
|
if (!isOpen || !active) return null;
|
|
13538
|
-
return /* @__PURE__ */
|
|
14000
|
+
return /* @__PURE__ */ jsxs52(
|
|
13539
14001
|
"div",
|
|
13540
14002
|
{
|
|
13541
14003
|
style: isNarrow ? {
|
|
@@ -13561,7 +14023,7 @@ function JudgmentDetailDrawerOutlet({
|
|
|
13561
14023
|
width
|
|
13562
14024
|
},
|
|
13563
14025
|
children: [
|
|
13564
|
-
!isNarrow && /* @__PURE__ */
|
|
14026
|
+
!isNarrow && /* @__PURE__ */ jsx69(
|
|
13565
14027
|
"div",
|
|
13566
14028
|
{
|
|
13567
14029
|
"aria-label": "Resize judgment drawer",
|
|
@@ -13586,8 +14048,8 @@ function JudgmentDetailDrawerOutlet({
|
|
|
13586
14048
|
}
|
|
13587
14049
|
}
|
|
13588
14050
|
),
|
|
13589
|
-
/* @__PURE__ */
|
|
13590
|
-
|
|
14051
|
+
/* @__PURE__ */ jsx69(
|
|
14052
|
+
Card25,
|
|
13591
14053
|
{
|
|
13592
14054
|
borderLeft: !isNarrow,
|
|
13593
14055
|
style: {
|
|
@@ -13596,7 +14058,7 @@ function JudgmentDetailDrawerOutlet({
|
|
|
13596
14058
|
flexDirection: "column",
|
|
13597
14059
|
overflow: "hidden"
|
|
13598
14060
|
},
|
|
13599
|
-
children: /* @__PURE__ */
|
|
14061
|
+
children: /* @__PURE__ */ jsx69(ReportArtifactProvider, { runId: active.runId, manifest: active.manifest, children: /* @__PURE__ */ jsx69(
|
|
13600
14062
|
JudgmentDetailDrawer,
|
|
13601
14063
|
{
|
|
13602
14064
|
artifactCache: active.artifactCache,
|
|
@@ -13614,18 +14076,18 @@ function JudgmentDetailDrawerOutlet({
|
|
|
13614
14076
|
}
|
|
13615
14077
|
|
|
13616
14078
|
// src/components/ScoreTimeline.tsx
|
|
13617
|
-
import { Card as
|
|
13618
|
-
import { useCallback as
|
|
14079
|
+
import { Card as Card28, Flex as Flex40, Spinner, Stack as Stack43, Text as Text55 } from "@sanity/ui";
|
|
14080
|
+
import { useCallback as useCallback43, useMemo as useMemo20, useState as useState33 } from "react";
|
|
13619
14081
|
import { useRouter as useRouter4 } from "sanity/router";
|
|
13620
14082
|
|
|
13621
14083
|
// src/components/timeline/TimelineChart.tsx
|
|
13622
|
-
import { Box as
|
|
14084
|
+
import { Box as Box36, Card as Card26, Flex as Flex38, Stack as Stack41, Text as Text53 } from "@sanity/ui";
|
|
13623
14085
|
import {
|
|
13624
|
-
useCallback as
|
|
13625
|
-
useEffect as
|
|
13626
|
-
useMemo as
|
|
14086
|
+
useCallback as useCallback40,
|
|
14087
|
+
useEffect as useEffect17,
|
|
14088
|
+
useMemo as useMemo18,
|
|
13627
14089
|
useRef as useRef9,
|
|
13628
|
-
useState as
|
|
14090
|
+
useState as useState31
|
|
13629
14091
|
} from "react";
|
|
13630
14092
|
|
|
13631
14093
|
// src/components/timeline/lib.ts
|
|
@@ -13869,7 +14331,7 @@ function effectiveStartDate(rangeDays, floor = TIMELINE_DATA_START_DATE) {
|
|
|
13869
14331
|
}
|
|
13870
14332
|
|
|
13871
14333
|
// src/components/timeline/TimelineChart.tsx
|
|
13872
|
-
import { jsx as
|
|
14334
|
+
import { jsx as jsx70, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
13873
14335
|
var CHART_HEIGHT = 280;
|
|
13874
14336
|
var PAD_BOTTOM = 36;
|
|
13875
14337
|
var PAD_LEFT = 44;
|
|
@@ -13886,10 +14348,10 @@ function TimelineChart({
|
|
|
13886
14348
|
showMovingAverage
|
|
13887
14349
|
}) {
|
|
13888
14350
|
const containerRef = useRef9(null);
|
|
13889
|
-
const [width, setWidth] =
|
|
13890
|
-
const [hoverIdx, setHoverIdx] =
|
|
13891
|
-
const [focusIdx, setFocusIdx] =
|
|
13892
|
-
|
|
14351
|
+
const [width, setWidth] = useState31(800);
|
|
14352
|
+
const [hoverIdx, setHoverIdx] = useState31(null);
|
|
14353
|
+
const [focusIdx, setFocusIdx] = useState31(null);
|
|
14354
|
+
useEffect17(() => {
|
|
13893
14355
|
const node = containerRef.current;
|
|
13894
14356
|
if (!node || typeof ResizeObserver === "undefined") return;
|
|
13895
14357
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -13903,15 +14365,15 @@ function TimelineChart({
|
|
|
13903
14365
|
}, []);
|
|
13904
14366
|
const plotWidth = width - PAD_LEFT - PAD_RIGHT;
|
|
13905
14367
|
const plotHeight = CHART_HEIGHT - PAD_TOP - PAD_BOTTOM;
|
|
13906
|
-
const xFor =
|
|
14368
|
+
const xFor = useCallback40(
|
|
13907
14369
|
(i, n) => PAD_LEFT + (n === 1 ? plotWidth / 2 : i / (n - 1) * plotWidth),
|
|
13908
14370
|
[plotWidth]
|
|
13909
14371
|
);
|
|
13910
|
-
const yFor =
|
|
14372
|
+
const yFor = useCallback40(
|
|
13911
14373
|
(score) => PAD_TOP + plotHeight - score / Y_MAX * plotHeight,
|
|
13912
14374
|
[plotHeight]
|
|
13913
14375
|
);
|
|
13914
|
-
const computed =
|
|
14376
|
+
const computed = useMemo18(
|
|
13915
14377
|
() => points.map((p, i) => ({
|
|
13916
14378
|
...p,
|
|
13917
14379
|
x: xFor(i, points.length),
|
|
@@ -13919,20 +14381,20 @@ function TimelineChart({
|
|
|
13919
14381
|
})),
|
|
13920
14382
|
[points, xFor, yFor]
|
|
13921
14383
|
);
|
|
13922
|
-
const polylinePoints =
|
|
14384
|
+
const polylinePoints = useMemo18(
|
|
13923
14385
|
() => computed.map((p) => `${p.x},${p.y}`).join(" "),
|
|
13924
14386
|
[computed]
|
|
13925
14387
|
);
|
|
13926
|
-
const maPoints =
|
|
14388
|
+
const maPoints = useMemo18(() => {
|
|
13927
14389
|
if (!showMovingAverage || movingAverage.length !== computed.length)
|
|
13928
14390
|
return "";
|
|
13929
14391
|
return computed.map((p, i) => `${p.x},${yFor(movingAverage[i] ?? p.score)}`).join(" ");
|
|
13930
14392
|
}, [computed, movingAverage, showMovingAverage, yFor]);
|
|
13931
|
-
const avgScore =
|
|
14393
|
+
const avgScore = useMemo18(() => {
|
|
13932
14394
|
if (computed.length === 0) return 0;
|
|
13933
14395
|
return computed.reduce((acc, p) => acc + p.score, 0) / computed.length;
|
|
13934
14396
|
}, [computed]);
|
|
13935
|
-
const xLabelIndexes =
|
|
14397
|
+
const xLabelIndexes = useMemo18(() => {
|
|
13936
14398
|
if (computed.length === 0) return [];
|
|
13937
14399
|
if (computed.length <= X_LABEL_TARGET) return computed.map((_, i) => i);
|
|
13938
14400
|
const step = (computed.length - 1) / (X_LABEL_TARGET - 1);
|
|
@@ -13942,7 +14404,7 @@ function TimelineChart({
|
|
|
13942
14404
|
}
|
|
13943
14405
|
return Array.from(new Set(out));
|
|
13944
14406
|
}, [computed]);
|
|
13945
|
-
const findNearestIndex =
|
|
14407
|
+
const findNearestIndex = useCallback40(
|
|
13946
14408
|
(clientX, rect) => {
|
|
13947
14409
|
if (computed.length === 0) return null;
|
|
13948
14410
|
const localX = (clientX - rect.left) * width / rect.width;
|
|
@@ -13959,7 +14421,7 @@ function TimelineChart({
|
|
|
13959
14421
|
},
|
|
13960
14422
|
[computed, width]
|
|
13961
14423
|
);
|
|
13962
|
-
const handleMouseMove =
|
|
14424
|
+
const handleMouseMove = useCallback40(
|
|
13963
14425
|
(e) => {
|
|
13964
14426
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
13965
14427
|
const idx = findNearestIndex(e.clientX, rect);
|
|
@@ -13967,10 +14429,10 @@ function TimelineChart({
|
|
|
13967
14429
|
},
|
|
13968
14430
|
[findNearestIndex]
|
|
13969
14431
|
);
|
|
13970
|
-
const handleMouseLeave =
|
|
14432
|
+
const handleMouseLeave = useCallback40(() => {
|
|
13971
14433
|
setHoverIdx(null);
|
|
13972
14434
|
}, []);
|
|
13973
|
-
const handlePointClick =
|
|
14435
|
+
const handlePointClick = useCallback40(
|
|
13974
14436
|
(idx) => {
|
|
13975
14437
|
const datum = computed[idx];
|
|
13976
14438
|
if (!datum) return;
|
|
@@ -13978,14 +14440,14 @@ function TimelineChart({
|
|
|
13978
14440
|
},
|
|
13979
14441
|
[computed, onSelectPoint]
|
|
13980
14442
|
);
|
|
13981
|
-
const handleFocus =
|
|
14443
|
+
const handleFocus = useCallback40(() => {
|
|
13982
14444
|
setFocusIdx((prev) => prev ?? 0);
|
|
13983
14445
|
}, []);
|
|
13984
|
-
const moveTo =
|
|
14446
|
+
const moveTo = useCallback40((idx) => {
|
|
13985
14447
|
setFocusIdx(idx);
|
|
13986
14448
|
setHoverIdx(idx);
|
|
13987
14449
|
}, []);
|
|
13988
|
-
const handleKey =
|
|
14450
|
+
const handleKey = useCallback40(
|
|
13989
14451
|
(e) => {
|
|
13990
14452
|
if (computed.length === 0) return;
|
|
13991
14453
|
const last = computed.length - 1;
|
|
@@ -14018,11 +14480,11 @@ function TimelineChart({
|
|
|
14018
14480
|
const activeIdx = hoverIdx ?? focusIdx;
|
|
14019
14481
|
const active = activeIdx !== null ? computed[activeIdx] : null;
|
|
14020
14482
|
if (computed.length === 0) {
|
|
14021
|
-
return /* @__PURE__ */
|
|
14483
|
+
return /* @__PURE__ */ jsx70(Card26, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsx70(Flex38, { align: "center", justify: "center", style: { height: 220 }, children: /* @__PURE__ */ jsx70(Text53, { muted: true, size: 2, children: "No reports found in this window. Adjust the filters or extend the time range." }) }) });
|
|
14022
14484
|
}
|
|
14023
|
-
return /* @__PURE__ */
|
|
14024
|
-
/* @__PURE__ */
|
|
14025
|
-
/* @__PURE__ */
|
|
14485
|
+
return /* @__PURE__ */ jsx70(Card26, { padding: 3, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs53(Stack41, { space: 2, children: [
|
|
14486
|
+
/* @__PURE__ */ jsxs53(Box36, { ref: containerRef, style: { position: "relative", width: "100%" }, children: [
|
|
14487
|
+
/* @__PURE__ */ jsxs53(
|
|
14026
14488
|
"svg",
|
|
14027
14489
|
{
|
|
14028
14490
|
"aria-label": "Score timeline chart",
|
|
@@ -14037,8 +14499,8 @@ function TimelineChart({
|
|
|
14037
14499
|
children: [
|
|
14038
14500
|
Y_TICKS.map((tick) => {
|
|
14039
14501
|
const y = yFor(tick);
|
|
14040
|
-
return /* @__PURE__ */
|
|
14041
|
-
/* @__PURE__ */
|
|
14502
|
+
return /* @__PURE__ */ jsxs53("g", { children: [
|
|
14503
|
+
/* @__PURE__ */ jsx70(
|
|
14042
14504
|
"line",
|
|
14043
14505
|
{
|
|
14044
14506
|
stroke: "var(--card-border-color, #ddd)",
|
|
@@ -14049,7 +14511,7 @@ function TimelineChart({
|
|
|
14049
14511
|
y2: y
|
|
14050
14512
|
}
|
|
14051
14513
|
),
|
|
14052
|
-
/* @__PURE__ */
|
|
14514
|
+
/* @__PURE__ */ jsx70(
|
|
14053
14515
|
"text",
|
|
14054
14516
|
{
|
|
14055
14517
|
dominantBaseline: "middle",
|
|
@@ -14063,7 +14525,7 @@ function TimelineChart({
|
|
|
14063
14525
|
)
|
|
14064
14526
|
] }, tick);
|
|
14065
14527
|
}),
|
|
14066
|
-
avgScore > 0 ? /* @__PURE__ */
|
|
14528
|
+
avgScore > 0 ? /* @__PURE__ */ jsx70(
|
|
14067
14529
|
"rect",
|
|
14068
14530
|
{
|
|
14069
14531
|
fill: scoreHex(avgScore),
|
|
@@ -14080,7 +14542,7 @@ function TimelineChart({
|
|
|
14080
14542
|
xLabelIndexes.map((i) => {
|
|
14081
14543
|
const p = computed[i];
|
|
14082
14544
|
if (!p) return null;
|
|
14083
|
-
return /* @__PURE__ */
|
|
14545
|
+
return /* @__PURE__ */ jsx70(
|
|
14084
14546
|
"text",
|
|
14085
14547
|
{
|
|
14086
14548
|
fill: "var(--card-muted-fg-color, #999)",
|
|
@@ -14093,7 +14555,7 @@ function TimelineChart({
|
|
|
14093
14555
|
i
|
|
14094
14556
|
);
|
|
14095
14557
|
}),
|
|
14096
|
-
showMovingAverage && maPoints ? /* @__PURE__ */
|
|
14558
|
+
showMovingAverage && maPoints ? /* @__PURE__ */ jsx70(
|
|
14097
14559
|
"polyline",
|
|
14098
14560
|
{
|
|
14099
14561
|
fill: "none",
|
|
@@ -14104,7 +14566,7 @@ function TimelineChart({
|
|
|
14104
14566
|
strokeWidth: 1.5
|
|
14105
14567
|
}
|
|
14106
14568
|
) : null,
|
|
14107
|
-
/* @__PURE__ */
|
|
14569
|
+
/* @__PURE__ */ jsx70(
|
|
14108
14570
|
"polyline",
|
|
14109
14571
|
{
|
|
14110
14572
|
fill: "none",
|
|
@@ -14114,7 +14576,7 @@ function TimelineChart({
|
|
|
14114
14576
|
strokeWidth: 2.5
|
|
14115
14577
|
}
|
|
14116
14578
|
),
|
|
14117
|
-
active ? /* @__PURE__ */
|
|
14579
|
+
active ? /* @__PURE__ */ jsx70(
|
|
14118
14580
|
"line",
|
|
14119
14581
|
{
|
|
14120
14582
|
stroke: "var(--card-border-color, #bbb)",
|
|
@@ -14127,7 +14589,7 @@ function TimelineChart({
|
|
|
14127
14589
|
) : null,
|
|
14128
14590
|
computed.map((p, idx) => {
|
|
14129
14591
|
const isActive = idx === activeIdx;
|
|
14130
|
-
return /* @__PURE__ */
|
|
14592
|
+
return /* @__PURE__ */ jsx70(
|
|
14131
14593
|
"circle",
|
|
14132
14594
|
{
|
|
14133
14595
|
cx: p.x,
|
|
@@ -14145,11 +14607,11 @@ function TimelineChart({
|
|
|
14145
14607
|
]
|
|
14146
14608
|
}
|
|
14147
14609
|
),
|
|
14148
|
-
active ? /* @__PURE__ */
|
|
14610
|
+
active ? /* @__PURE__ */ jsx70(Tooltip13, { active, chartWidth: width }) : null
|
|
14149
14611
|
] }),
|
|
14150
|
-
/* @__PURE__ */
|
|
14151
|
-
/* @__PURE__ */
|
|
14152
|
-
showMovingAverage ? /* @__PURE__ */
|
|
14612
|
+
/* @__PURE__ */ jsxs53(Flex38, { gap: 3, align: "center", children: [
|
|
14613
|
+
/* @__PURE__ */ jsx70(LegendDot, { color: scoreHex(avgScore), label: "Score" }),
|
|
14614
|
+
showMovingAverage ? /* @__PURE__ */ jsx70(
|
|
14153
14615
|
LegendDot,
|
|
14154
14616
|
{
|
|
14155
14617
|
color: "var(--card-muted-fg-color, #888)",
|
|
@@ -14157,7 +14619,7 @@ function TimelineChart({
|
|
|
14157
14619
|
label: "5-point moving average"
|
|
14158
14620
|
}
|
|
14159
14621
|
) : null,
|
|
14160
|
-
/* @__PURE__ */
|
|
14622
|
+
/* @__PURE__ */ jsx70(Text53, { muted: true, size: 1, children: "Click a point to open the report" })
|
|
14161
14623
|
] })
|
|
14162
14624
|
] }) });
|
|
14163
14625
|
}
|
|
@@ -14166,8 +14628,8 @@ function LegendDot({
|
|
|
14166
14628
|
dashed = false,
|
|
14167
14629
|
label
|
|
14168
14630
|
}) {
|
|
14169
|
-
return /* @__PURE__ */
|
|
14170
|
-
/* @__PURE__ */
|
|
14631
|
+
return /* @__PURE__ */ jsxs53(Flex38, { align: "center", gap: 2, children: [
|
|
14632
|
+
/* @__PURE__ */ jsx70("svg", { height: "10", width: "22", children: /* @__PURE__ */ jsx70(
|
|
14171
14633
|
"line",
|
|
14172
14634
|
{
|
|
14173
14635
|
stroke: color,
|
|
@@ -14179,15 +14641,15 @@ function LegendDot({
|
|
|
14179
14641
|
y2: "5"
|
|
14180
14642
|
}
|
|
14181
14643
|
) }),
|
|
14182
|
-
/* @__PURE__ */
|
|
14644
|
+
/* @__PURE__ */ jsx70(Text53, { muted: true, size: 1, children: label })
|
|
14183
14645
|
] });
|
|
14184
14646
|
}
|
|
14185
14647
|
function Tooltip13({ active, chartWidth }) {
|
|
14186
14648
|
const cssX = active.x;
|
|
14187
14649
|
const isRightEdge = cssX > chartWidth - 220;
|
|
14188
14650
|
const left = isRightEdge ? cssX - 220 : cssX + 12;
|
|
14189
|
-
return /* @__PURE__ */
|
|
14190
|
-
|
|
14651
|
+
return /* @__PURE__ */ jsx70(
|
|
14652
|
+
Box36,
|
|
14191
14653
|
{
|
|
14192
14654
|
style: {
|
|
14193
14655
|
background: "var(--card-bg-color, #fff)",
|
|
@@ -14202,11 +14664,11 @@ function Tooltip13({ active, chartWidth }) {
|
|
|
14202
14664
|
position: "absolute",
|
|
14203
14665
|
top: 8
|
|
14204
14666
|
},
|
|
14205
|
-
children: /* @__PURE__ */
|
|
14206
|
-
/* @__PURE__ */
|
|
14207
|
-
/* @__PURE__ */
|
|
14208
|
-
/* @__PURE__ */
|
|
14209
|
-
|
|
14667
|
+
children: /* @__PURE__ */ jsxs53(Stack41, { space: 2, children: [
|
|
14668
|
+
/* @__PURE__ */ jsx70(Text53, { size: 1, weight: "semibold", children: formatDateTime(active.date) }),
|
|
14669
|
+
/* @__PURE__ */ jsxs53(Flex38, { gap: 2, align: "center", children: [
|
|
14670
|
+
/* @__PURE__ */ jsx70(
|
|
14671
|
+
Box36,
|
|
14210
14672
|
{
|
|
14211
14673
|
style: {
|
|
14212
14674
|
background: scoreHex(active.score),
|
|
@@ -14216,19 +14678,19 @@ function Tooltip13({ active, chartWidth }) {
|
|
|
14216
14678
|
}
|
|
14217
14679
|
}
|
|
14218
14680
|
),
|
|
14219
|
-
/* @__PURE__ */
|
|
14220
|
-
active.count > 1 ? /* @__PURE__ */
|
|
14681
|
+
/* @__PURE__ */ jsx70(Text53, { size: 2, weight: "bold", children: Math.round(active.score) }),
|
|
14682
|
+
active.count > 1 ? /* @__PURE__ */ jsxs53(Text53, { muted: true, size: 1, children: [
|
|
14221
14683
|
"avg of ",
|
|
14222
14684
|
active.count,
|
|
14223
14685
|
" reports"
|
|
14224
14686
|
] }) : null
|
|
14225
14687
|
] }),
|
|
14226
|
-
active.source.title ? /* @__PURE__ */
|
|
14227
|
-
/* @__PURE__ */
|
|
14688
|
+
active.source.title ? /* @__PURE__ */ jsx70(Text53, { size: 1, children: active.source.title }) : null,
|
|
14689
|
+
/* @__PURE__ */ jsxs53(Text53, { muted: true, size: 1, children: [
|
|
14228
14690
|
active.source.mode,
|
|
14229
14691
|
active.source.source ? ` \xB7 ${active.source.source}` : ""
|
|
14230
14692
|
] }),
|
|
14231
|
-
active.source.tag ? /* @__PURE__ */
|
|
14693
|
+
active.source.tag ? /* @__PURE__ */ jsxs53(Text53, { muted: true, size: 1, children: [
|
|
14232
14694
|
"tag: ",
|
|
14233
14695
|
active.source.tag
|
|
14234
14696
|
] }) : null
|
|
@@ -14244,14 +14706,14 @@ import {
|
|
|
14244
14706
|
LinkIcon as LinkIcon4,
|
|
14245
14707
|
RefreshIcon
|
|
14246
14708
|
} from "@sanity/icons";
|
|
14247
|
-
import { Box as
|
|
14248
|
-
import { useCallback as
|
|
14709
|
+
import { Box as Box37, Button as Button15, Inline as Inline3, MenuDivider as MenuDivider4, MenuItem as MenuItem11 } from "@sanity/ui";
|
|
14710
|
+
import { useCallback as useCallback41 } from "react";
|
|
14249
14711
|
|
|
14250
14712
|
// src/components/timeline/SelectChip.tsx
|
|
14251
14713
|
import { ChevronDownIcon as ChevronDownIcon5 } from "@sanity/icons";
|
|
14252
|
-
import { Button as
|
|
14714
|
+
import { Button as Button14, Menu as Menu3, MenuButton as MenuButton3, MenuItem as MenuItem10 } from "@sanity/ui";
|
|
14253
14715
|
import { useId as useId2 } from "react";
|
|
14254
|
-
import { jsx as
|
|
14716
|
+
import { jsx as jsx71 } from "react/jsx-runtime";
|
|
14255
14717
|
function SelectChip({
|
|
14256
14718
|
defaultValue,
|
|
14257
14719
|
label,
|
|
@@ -14263,11 +14725,11 @@ function SelectChip({
|
|
|
14263
14725
|
const current = options.find((o) => o.value === value);
|
|
14264
14726
|
const displayValue = current?.label ?? value;
|
|
14265
14727
|
const isActive = defaultValue !== void 0 && value !== defaultValue;
|
|
14266
|
-
return /* @__PURE__ */
|
|
14728
|
+
return /* @__PURE__ */ jsx71(
|
|
14267
14729
|
MenuButton3,
|
|
14268
14730
|
{
|
|
14269
|
-
button: /* @__PURE__ */
|
|
14270
|
-
|
|
14731
|
+
button: /* @__PURE__ */ jsx71(
|
|
14732
|
+
Button14,
|
|
14271
14733
|
{
|
|
14272
14734
|
fontSize: 1,
|
|
14273
14735
|
iconRight: ChevronDownIcon5,
|
|
@@ -14279,7 +14741,7 @@ function SelectChip({
|
|
|
14279
14741
|
}
|
|
14280
14742
|
),
|
|
14281
14743
|
id: menuId,
|
|
14282
|
-
menu: /* @__PURE__ */
|
|
14744
|
+
menu: /* @__PURE__ */ jsx71(Menu3, { style: { minWidth: 160 }, children: options.map((opt) => /* @__PURE__ */ jsx71(
|
|
14283
14745
|
MenuItem10,
|
|
14284
14746
|
{
|
|
14285
14747
|
onClick: () => onChange(opt.value),
|
|
@@ -14299,7 +14761,7 @@ function SelectChip({
|
|
|
14299
14761
|
}
|
|
14300
14762
|
|
|
14301
14763
|
// src/components/timeline/TimelineFilters.tsx
|
|
14302
|
-
import { Fragment as
|
|
14764
|
+
import { Fragment as Fragment16, jsx as jsx72, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
14303
14765
|
var BAR_STYLE2 = {
|
|
14304
14766
|
alignItems: "center",
|
|
14305
14767
|
background: "var(--card-bg-color)",
|
|
@@ -14336,11 +14798,11 @@ function TimelineFilters(props) {
|
|
|
14336
14798
|
source,
|
|
14337
14799
|
sourceOptions
|
|
14338
14800
|
} = props;
|
|
14339
|
-
const handleMaToggle =
|
|
14801
|
+
const handleMaToggle = useCallback41(() => {
|
|
14340
14802
|
onShowMovingAverageChange(!showMovingAverage);
|
|
14341
14803
|
}, [onShowMovingAverageChange, showMovingAverage]);
|
|
14342
|
-
return /* @__PURE__ */
|
|
14343
|
-
/* @__PURE__ */
|
|
14804
|
+
return /* @__PURE__ */ jsxs54("div", { style: BAR_STYLE2, children: [
|
|
14805
|
+
/* @__PURE__ */ jsx72(
|
|
14344
14806
|
SelectChip,
|
|
14345
14807
|
{
|
|
14346
14808
|
defaultValue: DEFAULT_RANGE,
|
|
@@ -14350,7 +14812,7 @@ function TimelineFilters(props) {
|
|
|
14350
14812
|
value: range
|
|
14351
14813
|
}
|
|
14352
14814
|
),
|
|
14353
|
-
/* @__PURE__ */
|
|
14815
|
+
/* @__PURE__ */ jsx72(
|
|
14354
14816
|
SelectChip,
|
|
14355
14817
|
{
|
|
14356
14818
|
defaultValue: DEFAULT_GRANULARITY,
|
|
@@ -14360,7 +14822,7 @@ function TimelineFilters(props) {
|
|
|
14360
14822
|
value: granularity
|
|
14361
14823
|
}
|
|
14362
14824
|
),
|
|
14363
|
-
areaOptions.length > 0 && /* @__PURE__ */
|
|
14825
|
+
areaOptions.length > 0 && /* @__PURE__ */ jsx72(
|
|
14364
14826
|
FilterChip,
|
|
14365
14827
|
{
|
|
14366
14828
|
label: "Area",
|
|
@@ -14370,7 +14832,7 @@ function TimelineFilters(props) {
|
|
|
14370
14832
|
value: area
|
|
14371
14833
|
}
|
|
14372
14834
|
),
|
|
14373
|
-
modeOptions.length > 0 && /* @__PURE__ */
|
|
14835
|
+
modeOptions.length > 0 && /* @__PURE__ */ jsx72(
|
|
14374
14836
|
FilterChip,
|
|
14375
14837
|
{
|
|
14376
14838
|
label: "Mode",
|
|
@@ -14379,7 +14841,7 @@ function TimelineFilters(props) {
|
|
|
14379
14841
|
value: mode
|
|
14380
14842
|
}
|
|
14381
14843
|
),
|
|
14382
|
-
sourceOptions.length > 0 && /* @__PURE__ */
|
|
14844
|
+
sourceOptions.length > 0 && /* @__PURE__ */ jsx72(
|
|
14383
14845
|
FilterChip,
|
|
14384
14846
|
{
|
|
14385
14847
|
label: "Source",
|
|
@@ -14388,7 +14850,7 @@ function TimelineFilters(props) {
|
|
|
14388
14850
|
value: source
|
|
14389
14851
|
}
|
|
14390
14852
|
),
|
|
14391
|
-
ownerTeamOptions.length > 0 && /* @__PURE__ */
|
|
14853
|
+
ownerTeamOptions.length > 0 && /* @__PURE__ */ jsx72(
|
|
14392
14854
|
FilterChip,
|
|
14393
14855
|
{
|
|
14394
14856
|
label: "Team",
|
|
@@ -14398,10 +14860,10 @@ function TimelineFilters(props) {
|
|
|
14398
14860
|
value: ownerTeam
|
|
14399
14861
|
}
|
|
14400
14862
|
),
|
|
14401
|
-
/* @__PURE__ */
|
|
14402
|
-
/* @__PURE__ */
|
|
14403
|
-
/* @__PURE__ */
|
|
14404
|
-
|
|
14863
|
+
/* @__PURE__ */ jsx72(Box37, { style: { flex: "1 0 0px" } }),
|
|
14864
|
+
/* @__PURE__ */ jsxs54(Inline3, { space: 1, children: [
|
|
14865
|
+
/* @__PURE__ */ jsx72(
|
|
14866
|
+
Button15,
|
|
14405
14867
|
{
|
|
14406
14868
|
fontSize: 1,
|
|
14407
14869
|
mode: showMovingAverage ? "default" : "ghost",
|
|
@@ -14412,8 +14874,8 @@ function TimelineFilters(props) {
|
|
|
14412
14874
|
tone: showMovingAverage ? "primary" : "default"
|
|
14413
14875
|
}
|
|
14414
14876
|
),
|
|
14415
|
-
/* @__PURE__ */
|
|
14416
|
-
|
|
14877
|
+
/* @__PURE__ */ jsx72(
|
|
14878
|
+
Button15,
|
|
14417
14879
|
{
|
|
14418
14880
|
fontSize: 1,
|
|
14419
14881
|
icon: RefreshIcon,
|
|
@@ -14425,12 +14887,12 @@ function TimelineFilters(props) {
|
|
|
14425
14887
|
text: "Refresh"
|
|
14426
14888
|
}
|
|
14427
14889
|
),
|
|
14428
|
-
/* @__PURE__ */
|
|
14890
|
+
/* @__PURE__ */ jsx72(
|
|
14429
14891
|
SplitActionButton,
|
|
14430
14892
|
{
|
|
14431
14893
|
menuId: "timeline-share-actions",
|
|
14432
|
-
menu: /* @__PURE__ */
|
|
14433
|
-
/* @__PURE__ */
|
|
14894
|
+
menu: /* @__PURE__ */ jsxs54(Fragment16, { children: [
|
|
14895
|
+
/* @__PURE__ */ jsx72(
|
|
14434
14896
|
MenuItem11,
|
|
14435
14897
|
{
|
|
14436
14898
|
icon: ClipboardIcon2,
|
|
@@ -14438,8 +14900,8 @@ function TimelineFilters(props) {
|
|
|
14438
14900
|
text: "Copy CSV to clipboard"
|
|
14439
14901
|
}
|
|
14440
14902
|
),
|
|
14441
|
-
/* @__PURE__ */
|
|
14442
|
-
/* @__PURE__ */
|
|
14903
|
+
/* @__PURE__ */ jsx72(MenuDivider4, {}),
|
|
14904
|
+
/* @__PURE__ */ jsx72(
|
|
14443
14905
|
MenuItem11,
|
|
14444
14906
|
{
|
|
14445
14907
|
icon: DownloadIcon2,
|
|
@@ -14462,25 +14924,25 @@ function TimelineFilters(props) {
|
|
|
14462
14924
|
}
|
|
14463
14925
|
|
|
14464
14926
|
// src/components/timeline/TimelineSummary.tsx
|
|
14465
|
-
import { Badge as Badge13, Box as
|
|
14466
|
-
import { jsx as
|
|
14927
|
+
import { Badge as Badge13, Box as Box38, Card as Card27, Flex as Flex39, Grid as Grid7, Stack as Stack42, Text as Text54 } from "@sanity/ui";
|
|
14928
|
+
import { jsx as jsx73, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
14467
14929
|
function TimelineSummary({ area, stats }) {
|
|
14468
14930
|
if (stats.count === 0) return null;
|
|
14469
|
-
return /* @__PURE__ */
|
|
14470
|
-
/* @__PURE__ */
|
|
14471
|
-
/* @__PURE__ */
|
|
14472
|
-
/* @__PURE__ */
|
|
14931
|
+
return /* @__PURE__ */ jsx73(Card27, { padding: 3, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs55(Stack42, { space: 3, children: [
|
|
14932
|
+
/* @__PURE__ */ jsxs55(Flex39, { align: "center", gap: 2, children: [
|
|
14933
|
+
/* @__PURE__ */ jsx73(Text54, { size: 1, weight: "semibold", children: "Summary" }),
|
|
14934
|
+
/* @__PURE__ */ jsxs55(Text54, { muted: true, size: 1, children: [
|
|
14473
14935
|
area ? `Area: ${area}` : "Overall score",
|
|
14474
14936
|
" \xB7 ",
|
|
14475
14937
|
stats.count,
|
|
14476
14938
|
" report",
|
|
14477
14939
|
stats.count === 1 ? "" : "s"
|
|
14478
14940
|
] }),
|
|
14479
|
-
/* @__PURE__ */
|
|
14480
|
-
/* @__PURE__ */
|
|
14941
|
+
/* @__PURE__ */ jsx73(Box38, { flex: 1 }),
|
|
14942
|
+
/* @__PURE__ */ jsx73(TrendPill, { stats })
|
|
14481
14943
|
] }),
|
|
14482
|
-
/* @__PURE__ */
|
|
14483
|
-
/* @__PURE__ */
|
|
14944
|
+
/* @__PURE__ */ jsxs55(Grid7, { columns: [2, 2, 4], gap: 3, children: [
|
|
14945
|
+
/* @__PURE__ */ jsx73(
|
|
14484
14946
|
StatTile,
|
|
14485
14947
|
{
|
|
14486
14948
|
label: "Mean",
|
|
@@ -14488,8 +14950,8 @@ function TimelineSummary({ area, stats }) {
|
|
|
14488
14950
|
sub: stats.stdev !== null ? `\xB1 ${stats.stdev.toFixed(1)} stdev` : null
|
|
14489
14951
|
}
|
|
14490
14952
|
),
|
|
14491
|
-
/* @__PURE__ */
|
|
14492
|
-
/* @__PURE__ */
|
|
14953
|
+
/* @__PURE__ */ jsx73(StatTile, { label: "Median", score: stats.median, sub: null }),
|
|
14954
|
+
/* @__PURE__ */ jsx73(
|
|
14493
14955
|
StatTile,
|
|
14494
14956
|
{
|
|
14495
14957
|
label: "Best",
|
|
@@ -14497,7 +14959,7 @@ function TimelineSummary({ area, stats }) {
|
|
|
14497
14959
|
sub: stats.max ? formatDateShort(stats.max.date) : null
|
|
14498
14960
|
}
|
|
14499
14961
|
),
|
|
14500
|
-
/* @__PURE__ */
|
|
14962
|
+
/* @__PURE__ */ jsx73(
|
|
14501
14963
|
StatTile,
|
|
14502
14964
|
{
|
|
14503
14965
|
label: "Worst",
|
|
@@ -14510,10 +14972,10 @@ function TimelineSummary({ area, stats }) {
|
|
|
14510
14972
|
}
|
|
14511
14973
|
function TrendPill({ stats }) {
|
|
14512
14974
|
if (stats.delta === null || stats.count < 2) {
|
|
14513
|
-
return /* @__PURE__ */
|
|
14975
|
+
return /* @__PURE__ */ jsx73(Badge13, { fontSize: 1, mode: "outline", tone: "default", children: "Single data point" });
|
|
14514
14976
|
}
|
|
14515
14977
|
const { label, tone } = trendBadgeContent(stats.trend, stats.delta);
|
|
14516
|
-
return /* @__PURE__ */
|
|
14978
|
+
return /* @__PURE__ */ jsx73(Badge13, { fontSize: 1, mode: "default", tone, children: label });
|
|
14517
14979
|
}
|
|
14518
14980
|
function trendBadgeContent(trend, delta) {
|
|
14519
14981
|
switch (trend) {
|
|
@@ -14530,15 +14992,15 @@ function StatTile({
|
|
|
14530
14992
|
score,
|
|
14531
14993
|
sub
|
|
14532
14994
|
}) {
|
|
14533
|
-
return /* @__PURE__ */
|
|
14534
|
-
/* @__PURE__ */
|
|
14535
|
-
score === null ? /* @__PURE__ */
|
|
14536
|
-
score !== null && sub ? /* @__PURE__ */
|
|
14995
|
+
return /* @__PURE__ */ jsxs55(Stack42, { space: 2, children: [
|
|
14996
|
+
/* @__PURE__ */ jsx73(Text54, { muted: true, size: 1, weight: "medium", children: label }),
|
|
14997
|
+
score === null ? /* @__PURE__ */ jsx73(Text54, { muted: true, size: 3, children: "\u2014" }) : /* @__PURE__ */ jsx73(Badge13, { fontSize: 2, mode: "default", tone: scoreTone(score), children: score.toFixed(1) }),
|
|
14998
|
+
score !== null && sub ? /* @__PURE__ */ jsx73(Text54, { muted: true, size: 1, children: sub }) : null
|
|
14537
14999
|
] });
|
|
14538
15000
|
}
|
|
14539
15001
|
|
|
14540
15002
|
// src/components/timeline/useTimelineData.ts
|
|
14541
|
-
import { useCallback as
|
|
15003
|
+
import { useCallback as useCallback42, useEffect as useEffect18, useMemo as useMemo19, useState as useState32 } from "react";
|
|
14542
15004
|
import { useClient as useClient13 } from "sanity";
|
|
14543
15005
|
function useTimelineData({
|
|
14544
15006
|
mode,
|
|
@@ -14547,18 +15009,18 @@ function useTimelineData({
|
|
|
14547
15009
|
source
|
|
14548
15010
|
}) {
|
|
14549
15011
|
const client = useClient13({ apiVersion: API_VERSION });
|
|
14550
|
-
const [dataPoints, setDataPoints] =
|
|
14551
|
-
const [loading, setLoading] =
|
|
14552
|
-
const [error, setError] =
|
|
14553
|
-
const [reloadCounter, setReloadCounter] =
|
|
14554
|
-
const refresh =
|
|
15012
|
+
const [dataPoints, setDataPoints] = useState32([]);
|
|
15013
|
+
const [loading, setLoading] = useState32(true);
|
|
15014
|
+
const [error, setError] = useState32(null);
|
|
15015
|
+
const [reloadCounter, setReloadCounter] = useState32(0);
|
|
15016
|
+
const refresh = useCallback42(() => {
|
|
14555
15017
|
setReloadCounter((n) => n + 1);
|
|
14556
15018
|
}, []);
|
|
14557
|
-
const effectiveStart =
|
|
15019
|
+
const effectiveStart = useMemo19(
|
|
14558
15020
|
() => effectiveStartDate(rangeDays),
|
|
14559
15021
|
[rangeDays]
|
|
14560
15022
|
);
|
|
14561
|
-
|
|
15023
|
+
useEffect18(() => {
|
|
14562
15024
|
let cancelled = false;
|
|
14563
15025
|
setLoading(true);
|
|
14564
15026
|
setError(null);
|
|
@@ -14593,7 +15055,7 @@ function useTimelineData({
|
|
|
14593
15055
|
}
|
|
14594
15056
|
|
|
14595
15057
|
// src/components/ScoreTimeline.tsx
|
|
14596
|
-
import { Fragment as
|
|
15058
|
+
import { Fragment as Fragment17, jsx as jsx74, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
14597
15059
|
function buildSearchParams2(filters) {
|
|
14598
15060
|
const params = [];
|
|
14599
15061
|
if (filters.range !== DEFAULT_RANGE) params.push(["range", filters.range]);
|
|
@@ -14614,27 +15076,27 @@ function ScoreTimeline({
|
|
|
14614
15076
|
const router = useRouter4();
|
|
14615
15077
|
const routerState = router.state;
|
|
14616
15078
|
const urlParams = routerState._searchParams;
|
|
14617
|
-
const [range, setRange] =
|
|
15079
|
+
const [range, setRange] = useState33(() => {
|
|
14618
15080
|
const v = readSearchParam(urlParams, "range");
|
|
14619
15081
|
return v && isRangePreset(v) ? v : DEFAULT_RANGE;
|
|
14620
15082
|
});
|
|
14621
|
-
const [granularity, setGranularity] =
|
|
15083
|
+
const [granularity, setGranularity] = useState33(() => {
|
|
14622
15084
|
const v = readSearchParam(urlParams, "granularity");
|
|
14623
15085
|
return v && isGranularity(v) ? v : DEFAULT_GRANULARITY;
|
|
14624
15086
|
});
|
|
14625
|
-
const [area, setArea] =
|
|
15087
|
+
const [area, setArea] = useState33(
|
|
14626
15088
|
() => readSearchParam(urlParams, "area")
|
|
14627
15089
|
);
|
|
14628
|
-
const [mode, setMode] =
|
|
15090
|
+
const [mode, setMode] = useState33(
|
|
14629
15091
|
() => readSearchParam(urlParams, "mode") ?? defaultMode
|
|
14630
15092
|
);
|
|
14631
|
-
const [source, setSource] =
|
|
15093
|
+
const [source, setSource] = useState33(
|
|
14632
15094
|
() => readSearchParam(urlParams, "source") ?? defaultSource
|
|
14633
15095
|
);
|
|
14634
|
-
const [ownerTeam, setOwnerTeam] =
|
|
15096
|
+
const [ownerTeam, setOwnerTeam] = useState33(
|
|
14635
15097
|
() => readSearchParam(urlParams, "ownerTeam")
|
|
14636
15098
|
);
|
|
14637
|
-
const [showMovingAverage, setShowMovingAverage] =
|
|
15099
|
+
const [showMovingAverage, setShowMovingAverage] = useState33(
|
|
14638
15100
|
() => readSearchParam(urlParams, "ma") === "1"
|
|
14639
15101
|
);
|
|
14640
15102
|
useSyncSearchParams(
|
|
@@ -14656,48 +15118,48 @@ function ScoreTimeline({
|
|
|
14656
15118
|
rangeDays,
|
|
14657
15119
|
source
|
|
14658
15120
|
});
|
|
14659
|
-
const areaOptions =
|
|
15121
|
+
const areaOptions = useMemo20(
|
|
14660
15122
|
() => uniqueSorted(dataPoints, (dp) => dp.scores.map((s) => s.feature)),
|
|
14661
15123
|
[dataPoints]
|
|
14662
15124
|
);
|
|
14663
|
-
const modeOptions =
|
|
15125
|
+
const modeOptions = useMemo20(
|
|
14664
15126
|
() => uniqueSorted(dataPoints, (dp) => [dp.mode]),
|
|
14665
15127
|
[dataPoints]
|
|
14666
15128
|
);
|
|
14667
|
-
const sourceOptions =
|
|
15129
|
+
const sourceOptions = useMemo20(
|
|
14668
15130
|
() => uniqueSorted(dataPoints, (dp) => [dp.source]),
|
|
14669
15131
|
[dataPoints]
|
|
14670
15132
|
);
|
|
14671
|
-
const ownerTeamOptions =
|
|
15133
|
+
const ownerTeamOptions = useMemo20(
|
|
14672
15134
|
() => uniqueSorted(dataPoints, (dp) => [dp.ownerTeam]),
|
|
14673
15135
|
[dataPoints]
|
|
14674
15136
|
);
|
|
14675
|
-
const chartPoints =
|
|
15137
|
+
const chartPoints = useMemo20(
|
|
14676
15138
|
() => aggregate(dataPoints, area, granularity),
|
|
14677
15139
|
[area, dataPoints, granularity]
|
|
14678
15140
|
);
|
|
14679
|
-
const stats =
|
|
14680
|
-
const handleSelectPoint =
|
|
15141
|
+
const stats = useMemo20(() => computeStats(chartPoints, 5), [chartPoints]);
|
|
15142
|
+
const handleSelectPoint = useCallback43(
|
|
14681
15143
|
(point) => {
|
|
14682
15144
|
const id = point.reportId ?? point._id;
|
|
14683
15145
|
router.navigate({ reportId: id });
|
|
14684
15146
|
},
|
|
14685
15147
|
[router]
|
|
14686
15148
|
);
|
|
14687
|
-
const handleCopyUrl =
|
|
15149
|
+
const handleCopyUrl = useCallback43(() => {
|
|
14688
15150
|
if (typeof window === "undefined") return;
|
|
14689
15151
|
void copyTextToClipboard(window.location.href);
|
|
14690
15152
|
}, []);
|
|
14691
|
-
const handleCopyCsv =
|
|
15153
|
+
const handleCopyCsv = useCallback43(() => {
|
|
14692
15154
|
void copyTextToClipboard(toCsv(dataPoints, area));
|
|
14693
15155
|
}, [area, dataPoints]);
|
|
14694
|
-
const handleExportCsv =
|
|
15156
|
+
const handleExportCsv = useCallback43(() => {
|
|
14695
15157
|
const csv = toCsv(dataPoints, area);
|
|
14696
15158
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-").slice(0, 19);
|
|
14697
15159
|
downloadCsv(csv, `score-timeline-${ts}.csv`);
|
|
14698
15160
|
}, [area, dataPoints]);
|
|
14699
|
-
return /* @__PURE__ */
|
|
14700
|
-
/* @__PURE__ */
|
|
15161
|
+
return /* @__PURE__ */ jsxs56(Stack43, { space: 4, children: [
|
|
15162
|
+
/* @__PURE__ */ jsx74(
|
|
14701
15163
|
TimelineFilters,
|
|
14702
15164
|
{
|
|
14703
15165
|
area,
|
|
@@ -14725,15 +15187,15 @@ function ScoreTimeline({
|
|
|
14725
15187
|
sourceOptions
|
|
14726
15188
|
}
|
|
14727
15189
|
),
|
|
14728
|
-
error ? /* @__PURE__ */
|
|
15190
|
+
error ? /* @__PURE__ */ jsx74(Card28, { padding: 4, radius: 2, tone: "critical", children: /* @__PURE__ */ jsxs56(Text55, { size: 2, children: [
|
|
14729
15191
|
"Failed to load timeline: ",
|
|
14730
15192
|
error
|
|
14731
15193
|
] }) }) : null,
|
|
14732
|
-
loading ? /* @__PURE__ */
|
|
14733
|
-
/* @__PURE__ */
|
|
14734
|
-
/* @__PURE__ */
|
|
14735
|
-
] }) }) : /* @__PURE__ */
|
|
14736
|
-
/* @__PURE__ */
|
|
15194
|
+
loading ? /* @__PURE__ */ jsx74(Card28, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs56(Flex40, { align: "center", gap: 2, justify: "center", style: { height: 220 }, children: [
|
|
15195
|
+
/* @__PURE__ */ jsx74(Spinner, { muted: true }),
|
|
15196
|
+
/* @__PURE__ */ jsx74(Text55, { muted: true, size: 2, children: "Loading timeline\u2026" })
|
|
15197
|
+
] }) }) : /* @__PURE__ */ jsxs56(Fragment17, { children: [
|
|
15198
|
+
/* @__PURE__ */ jsx74(
|
|
14737
15199
|
TimelineChart,
|
|
14738
15200
|
{
|
|
14739
15201
|
movingAverage: stats.movingAverage,
|
|
@@ -14742,30 +15204,30 @@ function ScoreTimeline({
|
|
|
14742
15204
|
showMovingAverage
|
|
14743
15205
|
}
|
|
14744
15206
|
),
|
|
14745
|
-
/* @__PURE__ */
|
|
15207
|
+
/* @__PURE__ */ jsx74(TimelineSummary, { area, stats })
|
|
14746
15208
|
] })
|
|
14747
15209
|
] });
|
|
14748
15210
|
}
|
|
14749
15211
|
var ScoreTimeline_default = ScoreTimeline;
|
|
14750
15212
|
|
|
14751
15213
|
// src/components/Dashboard.tsx
|
|
14752
|
-
import { jsx as
|
|
15214
|
+
import { jsx as jsx75, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
14753
15215
|
var VIEW_PARAM_MAP = {
|
|
14754
15216
|
compare: "compare",
|
|
14755
15217
|
timeline: "timeline"
|
|
14756
15218
|
};
|
|
14757
15219
|
function Dashboard() {
|
|
14758
|
-
return /* @__PURE__ */
|
|
15220
|
+
return /* @__PURE__ */ jsx75(HelpProvider, { children: /* @__PURE__ */ jsx75(JudgmentDrawerProvider, { children: /* @__PURE__ */ jsx75(DashboardShell, {}) }) });
|
|
14759
15221
|
}
|
|
14760
15222
|
function DashboardShell() {
|
|
14761
15223
|
const router = useRouter5();
|
|
14762
15224
|
const { close: closeDrawer } = useJudgmentDrawer();
|
|
14763
15225
|
const routerState = router.state;
|
|
14764
15226
|
const reportId = routerState.reportId ?? null;
|
|
14765
|
-
|
|
15227
|
+
useEffect19(() => {
|
|
14766
15228
|
if (!reportId) closeDrawer();
|
|
14767
15229
|
}, [reportId, closeDrawer]);
|
|
14768
|
-
const handleJudgmentDrawerClose =
|
|
15230
|
+
const handleJudgmentDrawerClose = useCallback44(() => {
|
|
14769
15231
|
closeDrawer();
|
|
14770
15232
|
const state = { ...router.state };
|
|
14771
15233
|
if (state.focus) {
|
|
@@ -14773,10 +15235,10 @@ function DashboardShell() {
|
|
|
14773
15235
|
router.navigate(state);
|
|
14774
15236
|
}
|
|
14775
15237
|
}, [closeDrawer, router]);
|
|
14776
|
-
return /* @__PURE__ */
|
|
14777
|
-
/* @__PURE__ */
|
|
14778
|
-
/* @__PURE__ */
|
|
14779
|
-
/* @__PURE__ */
|
|
15238
|
+
return /* @__PURE__ */ jsxs57(Flex41, { style: { height: "100%" }, children: [
|
|
15239
|
+
/* @__PURE__ */ jsx75(Box39, { flex: 1, overflow: "auto", children: /* @__PURE__ */ jsx75(DashboardContent, {}) }),
|
|
15240
|
+
/* @__PURE__ */ jsx75(JudgmentDetailDrawerOutlet, { onClose: handleJudgmentDrawerClose }),
|
|
15241
|
+
/* @__PURE__ */ jsx75(HelpDrawer, {})
|
|
14780
15242
|
] });
|
|
14781
15243
|
}
|
|
14782
15244
|
function DashboardContent() {
|
|
@@ -14787,7 +15249,7 @@ function DashboardContent() {
|
|
|
14787
15249
|
const isDetail = reportId !== null;
|
|
14788
15250
|
const activeTab = isDetail ? "latest" : VIEW_PARAM_MAP[routerState.view ?? ""] ?? "latest";
|
|
14789
15251
|
const defaultTopic = deriveHelpTopic(routerState);
|
|
14790
|
-
const navigateToTab =
|
|
15252
|
+
const navigateToTab = useCallback44(
|
|
14791
15253
|
(tab) => {
|
|
14792
15254
|
if (tab === "latest") {
|
|
14793
15255
|
router.navigate({});
|
|
@@ -14797,13 +15259,13 @@ function DashboardContent() {
|
|
|
14797
15259
|
},
|
|
14798
15260
|
[router]
|
|
14799
15261
|
);
|
|
14800
|
-
const handleSelectReport =
|
|
15262
|
+
const handleSelectReport = useCallback44(
|
|
14801
15263
|
(id) => {
|
|
14802
15264
|
router.navigate({ reportId: id });
|
|
14803
15265
|
},
|
|
14804
15266
|
[router]
|
|
14805
15267
|
);
|
|
14806
|
-
const handleTabChange =
|
|
15268
|
+
const handleTabChange = useCallback44(
|
|
14807
15269
|
(tab, subTab, focus) => {
|
|
14808
15270
|
if (!routerState.reportId) return;
|
|
14809
15271
|
const state = {
|
|
@@ -14816,20 +15278,20 @@ function DashboardContent() {
|
|
|
14816
15278
|
},
|
|
14817
15279
|
[router, routerState.reportId]
|
|
14818
15280
|
);
|
|
14819
|
-
const handleBack =
|
|
15281
|
+
const handleBack = useCallback44(() => {
|
|
14820
15282
|
router.navigate({});
|
|
14821
15283
|
}, [router]);
|
|
14822
|
-
const handleOpenHelp =
|
|
15284
|
+
const handleOpenHelp = useCallback44(() => {
|
|
14823
15285
|
openHelp(defaultTopic);
|
|
14824
15286
|
}, [openHelp, defaultTopic]);
|
|
14825
|
-
return /* @__PURE__ */
|
|
14826
|
-
/* @__PURE__ */
|
|
14827
|
-
/* @__PURE__ */
|
|
14828
|
-
/* @__PURE__ */
|
|
14829
|
-
/* @__PURE__ */
|
|
15287
|
+
return /* @__PURE__ */ jsx75(Container, { width: 4, children: /* @__PURE__ */ jsxs57(Stack44, { padding: 4, space: 4, children: [
|
|
15288
|
+
/* @__PURE__ */ jsxs57(Flex41, { align: "center", gap: 3, children: [
|
|
15289
|
+
/* @__PURE__ */ jsxs57(Stack44, { flex: 1, space: 1, children: [
|
|
15290
|
+
/* @__PURE__ */ jsx75(Text56, { size: 4, weight: "bold", children: "AI Literacy Framework" }),
|
|
15291
|
+
/* @__PURE__ */ jsx75(Text56, { muted: true, size: 2, children: "Evaluation reports and score trends" })
|
|
14830
15292
|
] }),
|
|
14831
|
-
/* @__PURE__ */
|
|
14832
|
-
|
|
15293
|
+
/* @__PURE__ */ jsx75(
|
|
15294
|
+
Button16,
|
|
14833
15295
|
{
|
|
14834
15296
|
icon: HelpCircleIcon8,
|
|
14835
15297
|
mode: "bleed",
|
|
@@ -14839,8 +15301,8 @@ function DashboardContent() {
|
|
|
14839
15301
|
}
|
|
14840
15302
|
)
|
|
14841
15303
|
] }),
|
|
14842
|
-
!isDetail && /* @__PURE__ */
|
|
14843
|
-
/* @__PURE__ */
|
|
15304
|
+
!isDetail && /* @__PURE__ */ jsxs57(TabList3, { space: 1, children: [
|
|
15305
|
+
/* @__PURE__ */ jsx75(
|
|
14844
15306
|
Tab3,
|
|
14845
15307
|
{
|
|
14846
15308
|
"aria-controls": "latest-panel",
|
|
@@ -14850,7 +15312,7 @@ function DashboardContent() {
|
|
|
14850
15312
|
selected: activeTab === "latest"
|
|
14851
15313
|
}
|
|
14852
15314
|
),
|
|
14853
|
-
/* @__PURE__ */
|
|
15315
|
+
/* @__PURE__ */ jsx75(
|
|
14854
15316
|
Tab3,
|
|
14855
15317
|
{
|
|
14856
15318
|
"aria-controls": "timeline-panel",
|
|
@@ -14860,7 +15322,7 @@ function DashboardContent() {
|
|
|
14860
15322
|
selected: activeTab === "timeline"
|
|
14861
15323
|
}
|
|
14862
15324
|
),
|
|
14863
|
-
/* @__PURE__ */
|
|
15325
|
+
/* @__PURE__ */ jsx75(
|
|
14864
15326
|
Tab3,
|
|
14865
15327
|
{
|
|
14866
15328
|
"aria-controls": "compare-panel",
|
|
@@ -14871,10 +15333,10 @@ function DashboardContent() {
|
|
|
14871
15333
|
}
|
|
14872
15334
|
)
|
|
14873
15335
|
] }),
|
|
14874
|
-
!isDetail && activeTab === "latest" && /* @__PURE__ */
|
|
14875
|
-
!isDetail && activeTab === "timeline" && /* @__PURE__ */
|
|
14876
|
-
!isDetail && activeTab === "compare" && /* @__PURE__ */
|
|
14877
|
-
isDetail && reportId && /* @__PURE__ */
|
|
15336
|
+
!isDetail && activeTab === "latest" && /* @__PURE__ */ jsx75(TabPanel3, { "aria-labelledby": "latest-tab", id: "latest-panel", children: /* @__PURE__ */ jsx75(LatestReports, { onSelectReport: handleSelectReport }) }),
|
|
15337
|
+
!isDetail && activeTab === "timeline" && /* @__PURE__ */ jsx75(TabPanel3, { "aria-labelledby": "timeline-tab", id: "timeline-panel", children: /* @__PURE__ */ jsx75(ScoreTimeline_default, {}) }),
|
|
15338
|
+
!isDetail && activeTab === "compare" && /* @__PURE__ */ jsx75(TabPanel3, { "aria-labelledby": "compare-tab", id: "compare-panel", children: /* @__PURE__ */ jsx75(ComparisonView, {}) }),
|
|
15339
|
+
isDetail && reportId && /* @__PURE__ */ jsx75(
|
|
14878
15340
|
ReportDetail,
|
|
14879
15341
|
{
|
|
14880
15342
|
activeTab: routerState.tab ?? null,
|
|
@@ -14942,7 +15404,7 @@ var ailfStructure = (S) => S.list().id("root").title("Content").items([
|
|
|
14942
15404
|
// src/actions/RunEvaluationAction.tsx
|
|
14943
15405
|
import { BarChartIcon as BarChartIcon2 } from "@sanity/icons";
|
|
14944
15406
|
import { useToast as useToast10 } from "@sanity/ui";
|
|
14945
|
-
import { useCallback as
|
|
15407
|
+
import { useCallback as useCallback45, useEffect as useEffect20, useRef as useRef10, useState as useState34 } from "react";
|
|
14946
15408
|
import {
|
|
14947
15409
|
getReleaseIdFromReleaseDocumentId as getReleaseIdFromReleaseDocumentId3,
|
|
14948
15410
|
useClient as useClient14,
|
|
@@ -14973,10 +15435,10 @@ function createRunEvaluationAction(options = {}) {
|
|
|
14973
15435
|
const projectId = useProjectId2();
|
|
14974
15436
|
const currentUser = useCurrentUser4();
|
|
14975
15437
|
const toast = useToast10();
|
|
14976
|
-
const [state, setState] =
|
|
15438
|
+
const [state, setState] = useState34({ status: "loading" });
|
|
14977
15439
|
const requestedAtRef = useRef10(null);
|
|
14978
15440
|
const perspectiveId = getReleaseIdFromReleaseDocumentId3(release._id);
|
|
14979
|
-
|
|
15441
|
+
useEffect20(() => {
|
|
14980
15442
|
let cancelled = false;
|
|
14981
15443
|
client.fetch(contentImpactQuery, buildReportQueryParams(perspectiveId)).then((results) => {
|
|
14982
15444
|
if (cancelled) return;
|
|
@@ -14999,7 +15461,7 @@ function createRunEvaluationAction(options = {}) {
|
|
|
14999
15461
|
cancelled = true;
|
|
15000
15462
|
};
|
|
15001
15463
|
}, [client, perspectiveId]);
|
|
15002
|
-
|
|
15464
|
+
useEffect20(() => {
|
|
15003
15465
|
if (state.status !== "requested" && state.status !== "polling") return;
|
|
15004
15466
|
const { requestId, startedAt } = state;
|
|
15005
15467
|
if (state.status === "requested") {
|
|
@@ -15049,7 +15511,7 @@ function createRunEvaluationAction(options = {}) {
|
|
|
15049
15511
|
}, POLL_INTERVAL_MS2);
|
|
15050
15512
|
return () => clearInterval(interval);
|
|
15051
15513
|
}, [client, perspectiveId, state]);
|
|
15052
|
-
|
|
15514
|
+
useEffect20(() => {
|
|
15053
15515
|
if (state.status !== "error") return;
|
|
15054
15516
|
const timer = setTimeout(() => {
|
|
15055
15517
|
client.fetch(contentImpactQuery, buildReportQueryParams(perspectiveId)).then((results) => {
|
|
@@ -15069,7 +15531,7 @@ function createRunEvaluationAction(options = {}) {
|
|
|
15069
15531
|
}, 15e3);
|
|
15070
15532
|
return () => clearTimeout(timer);
|
|
15071
15533
|
}, [client, perspectiveId, state]);
|
|
15072
|
-
const handleRequest =
|
|
15534
|
+
const handleRequest = useCallback45(async () => {
|
|
15073
15535
|
const releaseTitle = release.metadata?.title ?? perspectiveId ?? "release";
|
|
15074
15536
|
const tag = `release-${slugify3(releaseTitle)}-${dateStamp3()}`;
|
|
15075
15537
|
const now = Date.now();
|