@sanity/ailf-studio 0.1.19 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1363 -1904
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2827,17 +2827,154 @@ import { route } from "sanity/router";
|
|
|
2827
2827
|
// src/components/Dashboard.tsx
|
|
2828
2828
|
import {
|
|
2829
2829
|
Container,
|
|
2830
|
-
Flex as
|
|
2831
|
-
|
|
2832
|
-
Stack as Stack27,
|
|
2830
|
+
Flex as Flex22,
|
|
2831
|
+
Stack as Stack24,
|
|
2833
2832
|
Tab as Tab2,
|
|
2834
2833
|
TabList as TabList2,
|
|
2835
2834
|
TabPanel as TabPanel2,
|
|
2836
|
-
Text as
|
|
2835
|
+
Text as Text29
|
|
2837
2836
|
} from "@sanity/ui";
|
|
2838
|
-
import { useCallback as
|
|
2839
|
-
import {
|
|
2840
|
-
|
|
2837
|
+
import { useCallback as useCallback19 } from "react";
|
|
2838
|
+
import { useRouter as useRouter3 } from "sanity/router";
|
|
2839
|
+
|
|
2840
|
+
// src/components/ComparisonView.tsx
|
|
2841
|
+
import { Badge as Badge3, Box as Box7, Card as Card6, Flex as Flex7, Grid, Select, Stack as Stack8, Text as Text11 } from "@sanity/ui";
|
|
2842
|
+
import { useCallback as useCallback6, useEffect as useEffect3, useMemo as useMemo3, useState as useState3 } from "react";
|
|
2843
|
+
import { useClient as useClient3 } from "sanity";
|
|
2844
|
+
|
|
2845
|
+
// src/glossary.ts
|
|
2846
|
+
var GLOSSARY = {
|
|
2847
|
+
// -- Overview stats -------------------------------------------------------
|
|
2848
|
+
overallScore: "A weighted average across all feature areas: Task Completion (50%), Code Correctness (25%), and Doc Coverage (25%).",
|
|
2849
|
+
docLift: "How much the docs help, compared to the model's training data alone. This is the score with docs minus the score without. Higher is better.",
|
|
2850
|
+
actualScore: "How well an AI agent scores when it has to find docs on its own through web search and page fetching. This is the real-world scenario. Only available in full mode.",
|
|
2851
|
+
retrievalGap: "The score lost because agents can't find or use all the relevant docs. Calculated as ceiling minus actual. Lower is better; zero means agents find everything.",
|
|
2852
|
+
infraEfficiency: "What percentage of the docs' potential quality actually reaches agents (actual \xF7 ceiling). 100% means agents find and use all relevant docs perfectly.",
|
|
2853
|
+
// -- Three-layer decomposition columns ------------------------------------
|
|
2854
|
+
floor: "Score without any documentation. This tells you what the model already knows from its training data.",
|
|
2855
|
+
ceiling: "Score with gold-standard docs injected directly into the prompt. This is the best the documentation can do.",
|
|
2856
|
+
actual: "Score when an AI agent finds docs on its own through web search and page fetching. This is the real-world experience.",
|
|
2857
|
+
retGap: "Quality lost to discoverability (ceiling minus actual). The gap between what the docs could deliver and what agents actually get.",
|
|
2858
|
+
efficiency: "What fraction of the docs' quality reaches agents in practice (actual \xF7 ceiling, shown as a percentage).",
|
|
2859
|
+
invertedRetGap: "\u26A0\uFE0F Inverted retrieval gap: agents that can't find the docs actually score higher, because the docs hurt performance. This usually means there's a doc quality problem.",
|
|
2860
|
+
// -- Per-area score columns -----------------------------------------------
|
|
2861
|
+
score: "Weighted score for this feature area: Task Completion \xD7 50% + Code Correctness \xD7 25% + Doc Coverage \xD7 25%.",
|
|
2862
|
+
taskCompletion: "Can the LLM implement the requested feature? Graded 0\u2013100.",
|
|
2863
|
+
codeCorrectness: "Is the generated code idiomatic, correct, and following best practices? Graded 0\u2013100.",
|
|
2864
|
+
docCoverage: "Did the docs provide the information needed to implement the feature? Graded 0\u2013100.",
|
|
2865
|
+
tests: "Number of test cases in this feature area.",
|
|
2866
|
+
// -- Comparison deltas ----------------------------------------------------
|
|
2867
|
+
overallDelta: "Change in overall score between the two runs. Positive means the experiment scored higher.",
|
|
2868
|
+
actualDelta: "Change in actual (agent-retrieved) score between runs. Positive means agents did better.",
|
|
2869
|
+
retGapDelta: "Change in retrieval gap between runs. Negative is good here: it means the gap shrank and agents found more relevant docs.",
|
|
2870
|
+
efficiencyDelta: "Change in infrastructure efficiency between runs. Positive means agents are capturing more of the docs' potential.",
|
|
2871
|
+
// -- Comparison table columns ---------------------------------------------
|
|
2872
|
+
baseline: "The reference run you're comparing against.",
|
|
2873
|
+
experiment: "The new run you're evaluating.",
|
|
2874
|
+
delta: "Difference between experiment and baseline. Positive means improvement, negative means regression.",
|
|
2875
|
+
change: "Whether the change is meaningful: improved, regressed, or unchanged (within the noise threshold).",
|
|
2876
|
+
// -- Grader judgments ------------------------------------------------------
|
|
2877
|
+
lowScoringJudgments: "The grading model's explanations for tests that scored below 70/100.",
|
|
2878
|
+
judgmentReason: "The grading model's natural language explanation of what went wrong.",
|
|
2879
|
+
// -- Recommendations / gap analysis ----------------------------------------
|
|
2880
|
+
recommendations: "Prioritized remediation plan from gap analysis. Each recommendation identifies a documentation problem, the affected feature area, and the estimated score lift from fixing it.",
|
|
2881
|
+
totalPotentialLift: "Aggregate potential score lift if all identified gaps were fixed. This is a conservative estimate \u2014 each gap targets the median of non-bottlenecked dimensions, not 100.",
|
|
2882
|
+
failureMode: "The type of documentation problem: missing-docs (functionality not covered), incorrect-docs (factual errors), outdated-docs (stale API/patterns), or poor-structure (hard to find/understand).",
|
|
2883
|
+
estimatedLift: "Estimated composite score improvement if this gap is fully fixed. Based on raising bottleneck dimensions to the median of non-bottlenecked dimensions.",
|
|
2884
|
+
confidence: "How confident the classifier is in this diagnosis. High = strong keyword + structural signal agreement. Medium = partial agreement. Low = weak signals only.",
|
|
2885
|
+
// -- Agent behavior --------------------------------------------------------
|
|
2886
|
+
agentBehaviorOverview: "How AI agents interacted with your documentation during evaluation: what they searched for, which pages they visited, and how much time they spent on network requests.",
|
|
2887
|
+
searchQueries: "The exact search queries agents used to find documentation. Helps you understand how agents discover your content and whether your docs appear for relevant queries.",
|
|
2888
|
+
docSlugsVisited: "Documentation page slugs that agents actually visited during evaluation. Compare against canonical docs to see if agents found the right pages.",
|
|
2889
|
+
externalDomains: "Non-Sanity domains that agents contacted during evaluation. High external domain counts may indicate agents couldn't find what they needed in your docs.",
|
|
2890
|
+
avgDocPagesVisited: "Average number of documentation pages visited per test. Higher counts can mean agents need to consult many pages (complex task) or can't find the right one quickly.",
|
|
2891
|
+
avgSearchesPerformed: "Average number of web searches performed per test. High search counts can indicate docs are hard to discover through search engines.",
|
|
2892
|
+
avgNetworkTimeMs: "Average time spent on network requests per test. Includes page fetches, search queries, and API calls.",
|
|
2893
|
+
totalRequests: "Total number of HTTP requests the agent made during the test, including searches, page visits, and API calls.",
|
|
2894
|
+
totalBytesDownloaded: "Total bytes downloaded by the agent. Large downloads may indicate the agent is fetching many pages or very large documents.",
|
|
2895
|
+
// -- Dimension deltas -----------------------------------------------------
|
|
2896
|
+
dimTaskCompletion: "Change in task completion between runs. Positive means implementations are more complete.",
|
|
2897
|
+
dimCodeCorrectness: "Change in code correctness between runs. Positive means better code quality.",
|
|
2898
|
+
dimDocCoverage: "Change in doc coverage between runs. Positive means the docs are providing more useful information."
|
|
2899
|
+
};
|
|
2900
|
+
|
|
2901
|
+
// src/lib/comparison.ts
|
|
2902
|
+
function scoreMap(summary) {
|
|
2903
|
+
return new Map(summary.scores.map((s) => [s.feature, s]));
|
|
2904
|
+
}
|
|
2905
|
+
function allAreas(baseline, experiment) {
|
|
2906
|
+
const set2 = /* @__PURE__ */ new Set([
|
|
2907
|
+
...baseline.scores.map((s) => s.feature),
|
|
2908
|
+
...experiment.scores.map((s) => s.feature)
|
|
2909
|
+
]);
|
|
2910
|
+
return [...set2].sort();
|
|
2911
|
+
}
|
|
2912
|
+
function classify(delta) {
|
|
2913
|
+
if (delta >= NOISE_THRESHOLD) return "improved";
|
|
2914
|
+
if (delta <= -NOISE_THRESHOLD) return "regressed";
|
|
2915
|
+
return "unchanged";
|
|
2916
|
+
}
|
|
2917
|
+
function changeTone(change) {
|
|
2918
|
+
switch (change) {
|
|
2919
|
+
case "improved":
|
|
2920
|
+
return "positive";
|
|
2921
|
+
case "regressed":
|
|
2922
|
+
return "critical";
|
|
2923
|
+
case "unchanged":
|
|
2924
|
+
return "caution";
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
function computeAreaDeltas(baseline, experiment) {
|
|
2928
|
+
const bMap = scoreMap(baseline);
|
|
2929
|
+
const eMap = scoreMap(experiment);
|
|
2930
|
+
return allAreas(baseline, experiment).map((area) => {
|
|
2931
|
+
const bScore = bMap.get(area)?.totalScore ?? 0;
|
|
2932
|
+
const eScore = eMap.get(area)?.totalScore ?? 0;
|
|
2933
|
+
const delta = eScore - bScore;
|
|
2934
|
+
return {
|
|
2935
|
+
area,
|
|
2936
|
+
baseline: bScore,
|
|
2937
|
+
experiment: eScore,
|
|
2938
|
+
delta,
|
|
2939
|
+
change: classify(delta)
|
|
2940
|
+
};
|
|
2941
|
+
});
|
|
2942
|
+
}
|
|
2943
|
+
function computeThreeLayerDeltas(baseline, experiment) {
|
|
2944
|
+
const bMap = scoreMap(baseline);
|
|
2945
|
+
const eMap = scoreMap(experiment);
|
|
2946
|
+
return allAreas(baseline, experiment).map((area) => {
|
|
2947
|
+
const bItem = bMap.get(area);
|
|
2948
|
+
const eItem = eMap.get(area);
|
|
2949
|
+
const ba = bItem?.actualScore ?? null;
|
|
2950
|
+
const ea = eItem?.actualScore ?? null;
|
|
2951
|
+
return {
|
|
2952
|
+
area,
|
|
2953
|
+
baseActual: ba,
|
|
2954
|
+
expActual: ea,
|
|
2955
|
+
actualDelta: ba != null && ea != null ? ea - ba : null,
|
|
2956
|
+
baseRetGap: bItem?.retrievalGap ?? null,
|
|
2957
|
+
expRetGap: eItem?.retrievalGap ?? null,
|
|
2958
|
+
retGapDelta: bItem?.retrievalGap != null && eItem?.retrievalGap != null ? eItem.retrievalGap - bItem.retrievalGap : null,
|
|
2959
|
+
baseEfficiency: bItem?.infrastructureEfficiency ?? null,
|
|
2960
|
+
expEfficiency: eItem?.infrastructureEfficiency ?? null
|
|
2961
|
+
};
|
|
2962
|
+
});
|
|
2963
|
+
}
|
|
2964
|
+
function computeDimensionDeltas(baseline, experiment) {
|
|
2965
|
+
const bMap = scoreMap(baseline);
|
|
2966
|
+
const eMap = scoreMap(experiment);
|
|
2967
|
+
return allAreas(baseline, experiment).map((area) => {
|
|
2968
|
+
const bItem = bMap.get(area);
|
|
2969
|
+
const eItem = eMap.get(area);
|
|
2970
|
+
return {
|
|
2971
|
+
area,
|
|
2972
|
+
taskDelta: (eItem?.taskCompletion ?? 0) - (bItem?.taskCompletion ?? 0),
|
|
2973
|
+
codeDelta: (eItem?.codeCorrectness ?? 0) - (bItem?.codeCorrectness ?? 0),
|
|
2974
|
+
docDelta: (eItem?.docCoverage ?? 0) - (bItem?.docCoverage ?? 0)
|
|
2975
|
+
};
|
|
2976
|
+
});
|
|
2977
|
+
}
|
|
2841
2978
|
|
|
2842
2979
|
// src/queries.ts
|
|
2843
2980
|
var REPORT_TYPE = "ailf.report";
|
|
@@ -3072,6 +3209,12 @@ var distinctModelsQuery = (
|
|
|
3072
3209
|
array::unique(*[_type == "${REPORT_TYPE}"].provenance.models[].label)
|
|
3073
3210
|
`
|
|
3074
3211
|
);
|
|
3212
|
+
var distinctTriggersQuery = (
|
|
3213
|
+
/* groq */
|
|
3214
|
+
`
|
|
3215
|
+
array::unique(*[_type == "${REPORT_TYPE}"].provenance.trigger.type)
|
|
3216
|
+
`
|
|
3217
|
+
);
|
|
3075
3218
|
function filterModeClause(param) {
|
|
3076
3219
|
return `&& (${param} == null || provenance.mode == ${param})`;
|
|
3077
3220
|
}
|
|
@@ -3079,192 +3222,53 @@ function filterSourceClause(param) {
|
|
|
3079
3222
|
return `&& (${param} == null || provenance.source.name == ${param})`;
|
|
3080
3223
|
}
|
|
3081
3224
|
|
|
3082
|
-
// src/components/
|
|
3083
|
-
import {
|
|
3084
|
-
import {
|
|
3085
|
-
|
|
3225
|
+
// src/components/PageBlurb.tsx
|
|
3226
|
+
import { Card as Card5, Stack as Stack7, Text as Text8 } from "@sanity/ui";
|
|
3227
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
3228
|
+
function PageBlurb({ text }) {
|
|
3229
|
+
return /* @__PURE__ */ jsx9(Card5, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx9(Stack7, { space: 2, children: /* @__PURE__ */ jsx9(Text8, { size: 2, children: text }) }) });
|
|
3230
|
+
}
|
|
3086
3231
|
|
|
3087
|
-
// src/
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
// -- Recommendations / gap analysis ----------------------------------------
|
|
3122
|
-
recommendations: "Prioritized remediation plan from gap analysis. Each recommendation identifies a documentation problem, the affected feature area, and the estimated score lift from fixing it.",
|
|
3123
|
-
totalPotentialLift: "Aggregate potential score lift if all identified gaps were fixed. This is a conservative estimate \u2014 each gap targets the median of non-bottlenecked dimensions, not 100.",
|
|
3124
|
-
failureMode: "The type of documentation problem: missing-docs (functionality not covered), incorrect-docs (factual errors), outdated-docs (stale API/patterns), or poor-structure (hard to find/understand).",
|
|
3125
|
-
estimatedLift: "Estimated composite score improvement if this gap is fully fixed. Based on raising bottleneck dimensions to the median of non-bottlenecked dimensions.",
|
|
3126
|
-
confidence: "How confident the classifier is in this diagnosis. High = strong keyword + structural signal agreement. Medium = partial agreement. Low = weak signals only.",
|
|
3127
|
-
// -- Agent behavior --------------------------------------------------------
|
|
3128
|
-
agentBehaviorOverview: "How AI agents interacted with your documentation during evaluation: what they searched for, which pages they visited, and how much time they spent on network requests.",
|
|
3129
|
-
searchQueries: "The exact search queries agents used to find documentation. Helps you understand how agents discover your content and whether your docs appear for relevant queries.",
|
|
3130
|
-
docSlugsVisited: "Documentation page slugs that agents actually visited during evaluation. Compare against canonical docs to see if agents found the right pages.",
|
|
3131
|
-
externalDomains: "Non-Sanity domains that agents contacted during evaluation. High external domain counts may indicate agents couldn't find what they needed in your docs.",
|
|
3132
|
-
avgDocPagesVisited: "Average number of documentation pages visited per test. Higher counts can mean agents need to consult many pages (complex task) or can't find the right one quickly.",
|
|
3133
|
-
avgSearchesPerformed: "Average number of web searches performed per test. High search counts can indicate docs are hard to discover through search engines.",
|
|
3134
|
-
avgNetworkTimeMs: "Average time spent on network requests per test. Includes page fetches, search queries, and API calls.",
|
|
3135
|
-
totalRequests: "Total number of HTTP requests the agent made during the test, including searches, page visits, and API calls.",
|
|
3136
|
-
totalBytesDownloaded: "Total bytes downloaded by the agent. Large downloads may indicate the agent is fetching many pages or very large documents.",
|
|
3137
|
-
// -- Dimension deltas -----------------------------------------------------
|
|
3138
|
-
dimTaskCompletion: "Change in task completion between runs. Positive means implementations are more complete.",
|
|
3139
|
-
dimCodeCorrectness: "Change in code correctness between runs. Positive means better code quality.",
|
|
3140
|
-
dimDocCoverage: "Change in doc coverage between runs. Positive means the docs are providing more useful information."
|
|
3141
|
-
};
|
|
3232
|
+
// src/components/primitives/ColumnHeader.tsx
|
|
3233
|
+
import { HelpCircleIcon as HelpCircleIcon3 } from "@sanity/icons";
|
|
3234
|
+
import { Box as Box5, Flex as Flex6, Text as Text9, Tooltip as Tooltip2 } from "@sanity/ui";
|
|
3235
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3236
|
+
function ColumnHeader({
|
|
3237
|
+
label,
|
|
3238
|
+
tooltip,
|
|
3239
|
+
borderBottom = false
|
|
3240
|
+
}) {
|
|
3241
|
+
const style = borderBottom ? {
|
|
3242
|
+
borderBottom: "1px solid var(--card-border-color)",
|
|
3243
|
+
paddingBottom: 6
|
|
3244
|
+
} : void 0;
|
|
3245
|
+
return /* @__PURE__ */ jsxs9(Flex6, { align: "center", gap: 1, style, children: [
|
|
3246
|
+
/* @__PURE__ */ jsx10(
|
|
3247
|
+
Text9,
|
|
3248
|
+
{
|
|
3249
|
+
muted: true,
|
|
3250
|
+
size: 2,
|
|
3251
|
+
style: { letterSpacing: "0.05em", textTransform: "uppercase" },
|
|
3252
|
+
weight: "semibold",
|
|
3253
|
+
children: label
|
|
3254
|
+
}
|
|
3255
|
+
),
|
|
3256
|
+
tooltip && /* @__PURE__ */ jsx10(
|
|
3257
|
+
Tooltip2,
|
|
3258
|
+
{
|
|
3259
|
+
content: /* @__PURE__ */ jsx10(Box5, { padding: 2, children: /* @__PURE__ */ jsx10(Text9, { size: 2, children: tooltip }) }),
|
|
3260
|
+
portal: true,
|
|
3261
|
+
children: /* @__PURE__ */ jsx10(Text9, { muted: true, size: 1, children: /* @__PURE__ */ jsx10(HelpCircleIcon3, {}) })
|
|
3262
|
+
}
|
|
3263
|
+
)
|
|
3264
|
+
] });
|
|
3265
|
+
}
|
|
3142
3266
|
|
|
3143
|
-
// src/
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
}
|
|
3147
|
-
|
|
3148
|
-
const set2 = /* @__PURE__ */ new Set([
|
|
3149
|
-
...baseline.scores.map((s) => s.feature),
|
|
3150
|
-
...experiment.scores.map((s) => s.feature)
|
|
3151
|
-
]);
|
|
3152
|
-
return [...set2].sort();
|
|
3153
|
-
}
|
|
3154
|
-
function classify(delta) {
|
|
3155
|
-
if (delta >= NOISE_THRESHOLD) return "improved";
|
|
3156
|
-
if (delta <= -NOISE_THRESHOLD) return "regressed";
|
|
3157
|
-
return "unchanged";
|
|
3158
|
-
}
|
|
3159
|
-
function changeTone(change) {
|
|
3160
|
-
switch (change) {
|
|
3161
|
-
case "improved":
|
|
3162
|
-
return "positive";
|
|
3163
|
-
case "regressed":
|
|
3164
|
-
return "critical";
|
|
3165
|
-
case "unchanged":
|
|
3166
|
-
return "caution";
|
|
3167
|
-
}
|
|
3168
|
-
}
|
|
3169
|
-
function computeAreaDeltas(baseline, experiment) {
|
|
3170
|
-
const bMap = scoreMap(baseline);
|
|
3171
|
-
const eMap = scoreMap(experiment);
|
|
3172
|
-
return allAreas(baseline, experiment).map((area) => {
|
|
3173
|
-
const bScore = bMap.get(area)?.totalScore ?? 0;
|
|
3174
|
-
const eScore = eMap.get(area)?.totalScore ?? 0;
|
|
3175
|
-
const delta = eScore - bScore;
|
|
3176
|
-
return {
|
|
3177
|
-
area,
|
|
3178
|
-
baseline: bScore,
|
|
3179
|
-
experiment: eScore,
|
|
3180
|
-
delta,
|
|
3181
|
-
change: classify(delta)
|
|
3182
|
-
};
|
|
3183
|
-
});
|
|
3184
|
-
}
|
|
3185
|
-
function computeThreeLayerDeltas(baseline, experiment) {
|
|
3186
|
-
const bMap = scoreMap(baseline);
|
|
3187
|
-
const eMap = scoreMap(experiment);
|
|
3188
|
-
return allAreas(baseline, experiment).map((area) => {
|
|
3189
|
-
const bItem = bMap.get(area);
|
|
3190
|
-
const eItem = eMap.get(area);
|
|
3191
|
-
const ba = bItem?.actualScore ?? null;
|
|
3192
|
-
const ea = eItem?.actualScore ?? null;
|
|
3193
|
-
return {
|
|
3194
|
-
area,
|
|
3195
|
-
baseActual: ba,
|
|
3196
|
-
expActual: ea,
|
|
3197
|
-
actualDelta: ba != null && ea != null ? ea - ba : null,
|
|
3198
|
-
baseRetGap: bItem?.retrievalGap ?? null,
|
|
3199
|
-
expRetGap: eItem?.retrievalGap ?? null,
|
|
3200
|
-
retGapDelta: bItem?.retrievalGap != null && eItem?.retrievalGap != null ? eItem.retrievalGap - bItem.retrievalGap : null,
|
|
3201
|
-
baseEfficiency: bItem?.infrastructureEfficiency ?? null,
|
|
3202
|
-
expEfficiency: eItem?.infrastructureEfficiency ?? null
|
|
3203
|
-
};
|
|
3204
|
-
});
|
|
3205
|
-
}
|
|
3206
|
-
function computeDimensionDeltas(baseline, experiment) {
|
|
3207
|
-
const bMap = scoreMap(baseline);
|
|
3208
|
-
const eMap = scoreMap(experiment);
|
|
3209
|
-
return allAreas(baseline, experiment).map((area) => {
|
|
3210
|
-
const bItem = bMap.get(area);
|
|
3211
|
-
const eItem = eMap.get(area);
|
|
3212
|
-
return {
|
|
3213
|
-
area,
|
|
3214
|
-
taskDelta: (eItem?.taskCompletion ?? 0) - (bItem?.taskCompletion ?? 0),
|
|
3215
|
-
codeDelta: (eItem?.codeCorrectness ?? 0) - (bItem?.codeCorrectness ?? 0),
|
|
3216
|
-
docDelta: (eItem?.docCoverage ?? 0) - (bItem?.docCoverage ?? 0)
|
|
3217
|
-
};
|
|
3218
|
-
});
|
|
3219
|
-
}
|
|
3220
|
-
|
|
3221
|
-
// src/components/PageBlurb.tsx
|
|
3222
|
-
import { Card as Card5, Stack as Stack7, Text as Text8 } from "@sanity/ui";
|
|
3223
|
-
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
3224
|
-
function PageBlurb({ text }) {
|
|
3225
|
-
return /* @__PURE__ */ jsx9(Card5, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx9(Stack7, { space: 2, children: /* @__PURE__ */ jsx9(Text8, { size: 2, children: text }) }) });
|
|
3226
|
-
}
|
|
3227
|
-
|
|
3228
|
-
// src/components/primitives/ColumnHeader.tsx
|
|
3229
|
-
import { HelpCircleIcon as HelpCircleIcon3 } from "@sanity/icons";
|
|
3230
|
-
import { Box as Box5, Flex as Flex6, Text as Text9, Tooltip as Tooltip2 } from "@sanity/ui";
|
|
3231
|
-
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3232
|
-
function ColumnHeader({
|
|
3233
|
-
label,
|
|
3234
|
-
tooltip,
|
|
3235
|
-
borderBottom = false
|
|
3236
|
-
}) {
|
|
3237
|
-
const style = borderBottom ? {
|
|
3238
|
-
borderBottom: "1px solid var(--card-border-color)",
|
|
3239
|
-
paddingBottom: 6
|
|
3240
|
-
} : void 0;
|
|
3241
|
-
return /* @__PURE__ */ jsxs9(Flex6, { align: "center", gap: 1, style, children: [
|
|
3242
|
-
/* @__PURE__ */ jsx10(
|
|
3243
|
-
Text9,
|
|
3244
|
-
{
|
|
3245
|
-
muted: true,
|
|
3246
|
-
size: 2,
|
|
3247
|
-
style: { letterSpacing: "0.05em", textTransform: "uppercase" },
|
|
3248
|
-
weight: "semibold",
|
|
3249
|
-
children: label
|
|
3250
|
-
}
|
|
3251
|
-
),
|
|
3252
|
-
tooltip && /* @__PURE__ */ jsx10(
|
|
3253
|
-
Tooltip2,
|
|
3254
|
-
{
|
|
3255
|
-
content: /* @__PURE__ */ jsx10(Box5, { padding: 2, children: /* @__PURE__ */ jsx10(Text9, { size: 2, children: tooltip }) }),
|
|
3256
|
-
portal: true,
|
|
3257
|
-
children: /* @__PURE__ */ jsx10(Text9, { muted: true, size: 1, children: /* @__PURE__ */ jsx10(HelpCircleIcon3, {}) })
|
|
3258
|
-
}
|
|
3259
|
-
)
|
|
3260
|
-
] });
|
|
3261
|
-
}
|
|
3262
|
-
|
|
3263
|
-
// src/components/primitives/LoadingState.tsx
|
|
3264
|
-
import { Box as Box6, Text as Text10 } from "@sanity/ui";
|
|
3265
|
-
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
3266
|
-
function LoadingState({ message = "Loading\u2026" }) {
|
|
3267
|
-
return /* @__PURE__ */ jsx11(Box6, { padding: 4, children: /* @__PURE__ */ jsx11(Text10, { muted: true, children: message }) });
|
|
3267
|
+
// src/components/primitives/LoadingState.tsx
|
|
3268
|
+
import { Box as Box6, Text as Text10 } from "@sanity/ui";
|
|
3269
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
3270
|
+
function LoadingState({ message = "Loading\u2026" }) {
|
|
3271
|
+
return /* @__PURE__ */ jsx11(Box6, { padding: 4, children: /* @__PURE__ */ jsx11(Text10, { muted: true, children: message }) });
|
|
3268
3272
|
}
|
|
3269
3273
|
|
|
3270
3274
|
// src/components/ComparisonView.tsx
|
|
@@ -3500,979 +3504,640 @@ function formatOption(r) {
|
|
|
3500
3504
|
}
|
|
3501
3505
|
|
|
3502
3506
|
// src/components/LatestReports.tsx
|
|
3503
|
-
import {
|
|
3504
|
-
import {
|
|
3505
|
-
Badge as Badge15,
|
|
3506
|
-
Box as Box8,
|
|
3507
|
-
Button,
|
|
3508
|
-
Card as Card12,
|
|
3509
|
-
Flex as Flex17,
|
|
3510
|
-
Menu,
|
|
3511
|
-
MenuButton,
|
|
3512
|
-
MenuItem,
|
|
3513
|
-
Stack as Stack13,
|
|
3514
|
-
Text as Text21
|
|
3515
|
-
} from "@sanity/ui";
|
|
3516
|
-
import { useCallback as useCallback12, useEffect as useEffect7, useMemo as useMemo5, useState as useState7 } from "react";
|
|
3517
|
-
import { useClient as useClient6 } from "sanity";
|
|
3518
|
-
|
|
3519
|
-
// src/components/content-filters/DocumentFilter.tsx
|
|
3520
|
-
import { SearchIcon as SearchIcon2 } from "@sanity/icons";
|
|
3521
|
-
import { Autocomplete as Autocomplete2, Badge as Badge4, Card as Card7, Flex as Flex8, Stack as Stack9, Text as Text12 } from "@sanity/ui";
|
|
3522
|
-
import { useCallback as useCallback7, useEffect as useEffect4, useRef as useRef3, useState as useState4 } from "react";
|
|
3507
|
+
import { Button, Card as Card7, Flex as Flex10, Stack as Stack10, Text as Text14 } from "@sanity/ui";
|
|
3508
|
+
import { useCallback as useCallback9, useEffect as useEffect4, useMemo as useMemo4, useState as useState4 } from "react";
|
|
3523
3509
|
import { useClient as useClient4 } from "sanity";
|
|
3510
|
+
import { useRouter } from "sanity/router";
|
|
3511
|
+
|
|
3512
|
+
// src/components/report-table/FilterBar.tsx
|
|
3513
|
+
import { Flex as Flex8, Text as Text12, TextInput } from "@sanity/ui";
|
|
3514
|
+
import { ResetIcon, SearchIcon as SearchIcon2, ThListIcon } from "@sanity/icons";
|
|
3515
|
+
import { useCallback as useCallback7 } from "react";
|
|
3524
3516
|
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3525
|
-
var
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3517
|
+
var BAR_STYLE = {
|
|
3518
|
+
alignItems: "center",
|
|
3519
|
+
background: "var(--card-bg-color)",
|
|
3520
|
+
display: "flex",
|
|
3521
|
+
gap: 12,
|
|
3522
|
+
padding: "8px 12px"
|
|
3523
|
+
};
|
|
3524
|
+
var PILL_GROUP_STYLE = {
|
|
3525
|
+
background: "var(--card-muted-bg-color)",
|
|
3526
|
+
borderRadius: 6,
|
|
3527
|
+
display: "inline-flex",
|
|
3528
|
+
gap: 0,
|
|
3529
|
+
padding: 2
|
|
3530
|
+
};
|
|
3531
|
+
var PILL_BASE = {
|
|
3532
|
+
border: "none",
|
|
3533
|
+
borderRadius: 4,
|
|
3534
|
+
cursor: "pointer",
|
|
3535
|
+
fontFamily: "inherit",
|
|
3536
|
+
fontSize: 13,
|
|
3537
|
+
fontWeight: 500,
|
|
3538
|
+
lineHeight: 1,
|
|
3539
|
+
padding: "6px 10px",
|
|
3540
|
+
transition: "all 0.1s ease",
|
|
3541
|
+
whiteSpace: "nowrap"
|
|
3542
|
+
};
|
|
3543
|
+
var PILL_ACTIVE = {
|
|
3544
|
+
...PILL_BASE,
|
|
3545
|
+
background: "var(--card-bg-color)",
|
|
3546
|
+
boxShadow: "0 1px 2px rgba(0,0,0,0.2)",
|
|
3547
|
+
color: "var(--card-fg-color)"
|
|
3548
|
+
};
|
|
3549
|
+
var PILL_INACTIVE = {
|
|
3550
|
+
...PILL_BASE,
|
|
3551
|
+
background: "transparent",
|
|
3552
|
+
color: "var(--card-muted-fg-color)"
|
|
3553
|
+
};
|
|
3554
|
+
function FilterBar({
|
|
3555
|
+
query,
|
|
3556
|
+
onQueryChange,
|
|
3557
|
+
mode,
|
|
3558
|
+
modes,
|
|
3559
|
+
onModeChange,
|
|
3560
|
+
source,
|
|
3561
|
+
sources,
|
|
3562
|
+
onSourceChange,
|
|
3563
|
+
trigger,
|
|
3564
|
+
triggers,
|
|
3565
|
+
onTriggerChange,
|
|
3566
|
+
onReset,
|
|
3567
|
+
filteredCount,
|
|
3568
|
+
totalCount
|
|
3530
3569
|
}) {
|
|
3531
|
-
const
|
|
3532
|
-
const [options, setOptions] = useState4([]);
|
|
3533
|
-
const [loading, setLoading] = useState4(false);
|
|
3534
|
-
const timer = useRef3(null);
|
|
3535
|
-
useEffect4(() => {
|
|
3536
|
-
return () => {
|
|
3537
|
-
if (timer.current) clearTimeout(timer.current);
|
|
3538
|
-
};
|
|
3539
|
-
}, []);
|
|
3570
|
+
const hasActiveFilters = query.trim() !== "" || mode !== null || source !== null || trigger !== null;
|
|
3540
3571
|
const handleQueryChange = useCallback7(
|
|
3541
|
-
(
|
|
3542
|
-
|
|
3543
|
-
const trimmed = (query ?? "").trim();
|
|
3544
|
-
if (trimmed.length < 2) {
|
|
3545
|
-
setOptions([]);
|
|
3546
|
-
setLoading(false);
|
|
3547
|
-
return;
|
|
3548
|
-
}
|
|
3549
|
-
setLoading(true);
|
|
3550
|
-
timer.current = setTimeout(() => {
|
|
3551
|
-
client.fetch(articleSearchQuery, { query: trimmed }).then((data) => {
|
|
3552
|
-
const result = (data ?? []).map((doc) => {
|
|
3553
|
-
const { provenance, releaseId } = classifyDocId(doc._id);
|
|
3554
|
-
const path = doc.section?.slug ? `${doc.section.slug}/${doc.slug}` : doc.slug;
|
|
3555
|
-
return {
|
|
3556
|
-
payload: {
|
|
3557
|
-
path,
|
|
3558
|
-
provenance,
|
|
3559
|
-
releaseId,
|
|
3560
|
-
slug: doc.slug,
|
|
3561
|
-
title: doc.title
|
|
3562
|
-
},
|
|
3563
|
-
value: doc._id
|
|
3564
|
-
};
|
|
3565
|
-
});
|
|
3566
|
-
const order = {
|
|
3567
|
-
published: 0,
|
|
3568
|
-
release: 1,
|
|
3569
|
-
draft: 2
|
|
3570
|
-
};
|
|
3571
|
-
result.sort(
|
|
3572
|
-
(a, b) => order[a.payload.provenance] - order[b.payload.provenance]
|
|
3573
|
-
);
|
|
3574
|
-
setOptions(result);
|
|
3575
|
-
setLoading(false);
|
|
3576
|
-
}).catch(() => {
|
|
3577
|
-
setOptions([]);
|
|
3578
|
-
setLoading(false);
|
|
3579
|
-
});
|
|
3580
|
-
}, SEARCH_DEBOUNCE_MS);
|
|
3572
|
+
(e) => {
|
|
3573
|
+
onQueryChange(e.currentTarget.value);
|
|
3581
3574
|
},
|
|
3582
|
-
[
|
|
3575
|
+
[onQueryChange]
|
|
3583
3576
|
);
|
|
3584
|
-
|
|
3585
|
-
(
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3577
|
+
return /* @__PURE__ */ jsxs11("div", { style: BAR_STYLE, children: [
|
|
3578
|
+
/* @__PURE__ */ jsx13("div", { style: { maxWidth: 320, minWidth: 180, flex: "0 1 320px" }, children: /* @__PURE__ */ jsx13(
|
|
3579
|
+
TextInput,
|
|
3580
|
+
{
|
|
3581
|
+
fontSize: 2,
|
|
3582
|
+
icon: SearchIcon2,
|
|
3583
|
+
onChange: handleQueryChange,
|
|
3584
|
+
placeholder: "Search reports...",
|
|
3585
|
+
value: query
|
|
3591
3586
|
}
|
|
3592
|
-
},
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3587
|
+
) }),
|
|
3588
|
+
modes.length > 0 && /* @__PURE__ */ jsx13(
|
|
3589
|
+
PillGroup,
|
|
3590
|
+
{
|
|
3591
|
+
label: "Mode",
|
|
3592
|
+
onChange: onModeChange,
|
|
3593
|
+
options: modes,
|
|
3594
|
+
value: mode
|
|
3595
|
+
}
|
|
3596
|
+
),
|
|
3597
|
+
sources.length > 0 && /* @__PURE__ */ jsx13(
|
|
3598
|
+
PillGroup,
|
|
3599
|
+
{
|
|
3600
|
+
label: "Source",
|
|
3601
|
+
onChange: onSourceChange,
|
|
3602
|
+
options: sources,
|
|
3603
|
+
value: source
|
|
3604
|
+
}
|
|
3605
|
+
),
|
|
3606
|
+
triggers.length > 0 && /* @__PURE__ */ jsx13(
|
|
3607
|
+
PillGroup,
|
|
3608
|
+
{
|
|
3609
|
+
label: "Trigger",
|
|
3610
|
+
onChange: onTriggerChange,
|
|
3611
|
+
options: triggers,
|
|
3612
|
+
value: trigger
|
|
3613
|
+
}
|
|
3614
|
+
),
|
|
3615
|
+
/* @__PURE__ */ jsx13("div", { style: { flex: 1 } }),
|
|
3616
|
+
hasActiveFilters && /* @__PURE__ */ jsxs11(
|
|
3617
|
+
"button",
|
|
3618
|
+
{
|
|
3619
|
+
onClick: onReset,
|
|
3620
|
+
style: {
|
|
3621
|
+
...PILL_BASE,
|
|
3622
|
+
alignItems: "center",
|
|
3623
|
+
background: "transparent",
|
|
3624
|
+
color: "var(--card-muted-fg-color)",
|
|
3625
|
+
display: "inline-flex",
|
|
3626
|
+
gap: 4
|
|
3627
|
+
},
|
|
3628
|
+
type: "button",
|
|
3629
|
+
children: [
|
|
3630
|
+
/* @__PURE__ */ jsx13(ResetIcon, { style: { fontSize: 14 } }),
|
|
3631
|
+
"Reset"
|
|
3632
|
+
]
|
|
3633
|
+
}
|
|
3634
|
+
),
|
|
3635
|
+
/* @__PURE__ */ jsxs11(Flex8, { align: "center", gap: 2, shrink: 0, children: [
|
|
3636
|
+
/* @__PURE__ */ jsx13(ThListIcon, { style: { opacity: 0.5 } }),
|
|
3637
|
+
/* @__PURE__ */ jsx13(Text12, { muted: true, size: 2, children: filteredCount === totalCount ? `${totalCount} of ${totalCount}` : `${filteredCount} of ${totalCount}` })
|
|
3638
|
+
] })
|
|
3639
|
+
] });
|
|
3629
3640
|
}
|
|
3630
|
-
function
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3641
|
+
function PillGroup({
|
|
3642
|
+
label,
|
|
3643
|
+
options,
|
|
3644
|
+
value,
|
|
3645
|
+
onChange
|
|
3646
|
+
}) {
|
|
3647
|
+
return /* @__PURE__ */ jsxs11(Flex8, { align: "center", gap: 2, children: [
|
|
3648
|
+
/* @__PURE__ */ jsx13(
|
|
3649
|
+
Text12,
|
|
3650
|
+
{
|
|
3651
|
+
muted: true,
|
|
3652
|
+
size: 1,
|
|
3653
|
+
style: {
|
|
3654
|
+
letterSpacing: "0.05em",
|
|
3655
|
+
textTransform: "uppercase",
|
|
3656
|
+
whiteSpace: "nowrap"
|
|
3657
|
+
},
|
|
3658
|
+
weight: "semibold",
|
|
3659
|
+
children: label
|
|
3660
|
+
}
|
|
3661
|
+
),
|
|
3662
|
+
/* @__PURE__ */ jsxs11("div", { style: PILL_GROUP_STYLE, children: [
|
|
3663
|
+
/* @__PURE__ */ jsx13(
|
|
3664
|
+
"button",
|
|
3665
|
+
{
|
|
3666
|
+
onClick: () => onChange(null),
|
|
3667
|
+
style: value === null ? PILL_ACTIVE : PILL_INACTIVE,
|
|
3668
|
+
type: "button",
|
|
3669
|
+
children: "All"
|
|
3670
|
+
}
|
|
3671
|
+
),
|
|
3672
|
+
options.map((opt) => /* @__PURE__ */ jsx13(
|
|
3673
|
+
"button",
|
|
3674
|
+
{
|
|
3675
|
+
onClick: () => onChange(opt),
|
|
3676
|
+
style: value === opt ? PILL_ACTIVE : PILL_INACTIVE,
|
|
3677
|
+
type: "button",
|
|
3678
|
+
children: capitalize(opt)
|
|
3679
|
+
},
|
|
3680
|
+
opt
|
|
3681
|
+
))
|
|
3682
|
+
] })
|
|
3683
|
+
] });
|
|
3684
|
+
}
|
|
3685
|
+
function capitalize(s) {
|
|
3686
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
3640
3687
|
}
|
|
3641
3688
|
|
|
3642
|
-
// src/components/
|
|
3643
|
-
import {
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
}));
|
|
3687
|
-
return result;
|
|
3688
|
-
}, [activeReleases, archivedReleases, reportPerspectives]);
|
|
3689
|
+
// src/components/report-table/OutlineBadge.tsx
|
|
3690
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
3691
|
+
var TONE_PALETTE = {
|
|
3692
|
+
default: {
|
|
3693
|
+
border: "rgba(255, 255, 255, 0.2)",
|
|
3694
|
+
bg: "rgba(255, 255, 255, 0.06)",
|
|
3695
|
+
fg: "rgba(255, 255, 255, 0.6)"
|
|
3696
|
+
},
|
|
3697
|
+
primary: {
|
|
3698
|
+
border: "rgba(86, 154, 237, 0.4)",
|
|
3699
|
+
bg: "rgba(86, 154, 237, 0.08)",
|
|
3700
|
+
fg: "#569aed"
|
|
3701
|
+
},
|
|
3702
|
+
positive: {
|
|
3703
|
+
border: "rgba(46, 204, 113, 0.4)",
|
|
3704
|
+
bg: "rgba(46, 204, 113, 0.08)",
|
|
3705
|
+
fg: "#2ecc71"
|
|
3706
|
+
},
|
|
3707
|
+
caution: {
|
|
3708
|
+
border: "rgba(241, 196, 15, 0.4)",
|
|
3709
|
+
bg: "rgba(241, 196, 15, 0.08)",
|
|
3710
|
+
fg: "#f1c40f"
|
|
3711
|
+
},
|
|
3712
|
+
critical: {
|
|
3713
|
+
border: "rgba(231, 76, 60, 0.4)",
|
|
3714
|
+
bg: "rgba(231, 76, 60, 0.08)",
|
|
3715
|
+
fg: "#e74c3c"
|
|
3716
|
+
},
|
|
3717
|
+
cyan: {
|
|
3718
|
+
border: "rgba(52, 211, 211, 0.4)",
|
|
3719
|
+
bg: "rgba(52, 211, 211, 0.08)",
|
|
3720
|
+
fg: "#34d3d3"
|
|
3721
|
+
},
|
|
3722
|
+
purple: {
|
|
3723
|
+
border: "rgba(168, 130, 255, 0.4)",
|
|
3724
|
+
bg: "rgba(168, 130, 255, 0.08)",
|
|
3725
|
+
fg: "#a882ff"
|
|
3726
|
+
}
|
|
3727
|
+
};
|
|
3728
|
+
function OutlineBadge({
|
|
3729
|
+
children,
|
|
3730
|
+
tone = "default"
|
|
3731
|
+
}) {
|
|
3732
|
+
const colors = TONE_PALETTE[tone];
|
|
3689
3733
|
return /* @__PURE__ */ jsx14(
|
|
3690
|
-
|
|
3734
|
+
"span",
|
|
3691
3735
|
{
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
const opt = option;
|
|
3704
|
-
return /* @__PURE__ */ jsx14(Card8, { as: "button", padding: 3, children: /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 2, children: [
|
|
3705
|
-
/* @__PURE__ */ jsxs12(Stack10, { flex: 1, space: 1, children: [
|
|
3706
|
-
/* @__PURE__ */ jsx14(Text13, { size: 2, weight: "semibold", children: opt.payload.title }),
|
|
3707
|
-
opt.payload.title !== opt.value && /* @__PURE__ */ jsx14(Text13, { muted: true, size: 2, children: opt.value })
|
|
3708
|
-
] }),
|
|
3709
|
-
opt.payload.hasReport && /* @__PURE__ */ jsx14(Badge5, { fontSize: 1, tone: "positive", children: "Has reports" })
|
|
3710
|
-
] }) });
|
|
3711
|
-
},
|
|
3712
|
-
renderValue: (v, option) => {
|
|
3713
|
-
const opt = option;
|
|
3714
|
-
if (opt?.payload?.title && opt.payload.title !== v) {
|
|
3715
|
-
return `${opt.payload.title} (${v})`;
|
|
3716
|
-
}
|
|
3717
|
-
return v;
|
|
3736
|
+
style: {
|
|
3737
|
+
background: colors.bg,
|
|
3738
|
+
border: `1px solid ${colors.border}`,
|
|
3739
|
+
borderRadius: 4,
|
|
3740
|
+
color: colors.fg,
|
|
3741
|
+
display: "inline-block",
|
|
3742
|
+
fontSize: 12,
|
|
3743
|
+
fontWeight: 500,
|
|
3744
|
+
lineHeight: 1,
|
|
3745
|
+
padding: "3px 6px",
|
|
3746
|
+
whiteSpace: "nowrap"
|
|
3718
3747
|
},
|
|
3719
|
-
|
|
3748
|
+
children
|
|
3720
3749
|
}
|
|
3721
3750
|
);
|
|
3722
3751
|
}
|
|
3723
3752
|
|
|
3724
|
-
// src/components/report-
|
|
3725
|
-
import {
|
|
3753
|
+
// src/components/report-table/ReportTable.tsx
|
|
3754
|
+
import {
|
|
3755
|
+
Badge as Badge4,
|
|
3756
|
+
Code,
|
|
3757
|
+
Flex as Flex9,
|
|
3758
|
+
Inline,
|
|
3759
|
+
Stack as Stack9,
|
|
3760
|
+
Text as Text13
|
|
3761
|
+
} from "@sanity/ui";
|
|
3762
|
+
import { ClockIcon, TrendUpwardIcon } from "@sanity/icons";
|
|
3726
3763
|
import { useCallback as useCallback8 } from "react";
|
|
3727
3764
|
|
|
3728
|
-
// src/components/
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3765
|
+
// src/components/report-card/types.ts
|
|
3766
|
+
function formatCardDate(iso) {
|
|
3767
|
+
return new Date(iso).toLocaleDateString("en-US", {
|
|
3768
|
+
day: "numeric",
|
|
3769
|
+
hour: "2-digit",
|
|
3770
|
+
minute: "2-digit",
|
|
3771
|
+
month: "short",
|
|
3772
|
+
year: "numeric"
|
|
3773
|
+
});
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3776
|
+
// src/components/report-table/ReportTable.tsx
|
|
3777
|
+
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3778
|
+
function GitBranchIcon({ style }) {
|
|
3779
|
+
return /* @__PURE__ */ jsxs12(
|
|
3780
|
+
"svg",
|
|
3734
3781
|
{
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3782
|
+
"aria-hidden": "true",
|
|
3783
|
+
fill: "none",
|
|
3784
|
+
height: 12,
|
|
3785
|
+
stroke: "currentColor",
|
|
3786
|
+
strokeLinecap: "round",
|
|
3787
|
+
strokeLinejoin: "round",
|
|
3788
|
+
strokeWidth: 2,
|
|
3789
|
+
style,
|
|
3790
|
+
viewBox: "0 0 24 24",
|
|
3791
|
+
width: 12,
|
|
3792
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3793
|
+
children: [
|
|
3794
|
+
/* @__PURE__ */ jsx15("path", { d: "M15 6a9 9 0 0 0-9 9V3" }),
|
|
3795
|
+
/* @__PURE__ */ jsx15("circle", { cx: 18, cy: 6, r: 3 }),
|
|
3796
|
+
/* @__PURE__ */ jsx15("circle", { cx: 6, cy: 18, r: 3 })
|
|
3797
|
+
]
|
|
3740
3798
|
}
|
|
3741
3799
|
);
|
|
3742
3800
|
}
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
const prUrl = git.prNumber ? `https://github.com/${git.repo}/pull/${git.prNumber}` : null;
|
|
3749
|
-
return /* @__PURE__ */ jsxs13(Flex10, { align: "center", gap: 2, children: [
|
|
3750
|
-
/* @__PURE__ */ jsx16(
|
|
3751
|
-
Text15,
|
|
3752
|
-
{
|
|
3753
|
-
muted: true,
|
|
3754
|
-
size: 1,
|
|
3755
|
-
style: { fontFamily: "monospace", whiteSpace: "nowrap" },
|
|
3756
|
-
title: `${git.repo} @ ${git.sha.slice(0, 7)} (${git.branch})`,
|
|
3757
|
-
children: git.repo
|
|
3758
|
-
}
|
|
3759
|
-
),
|
|
3760
|
-
prUrl && /* @__PURE__ */ jsx16(
|
|
3761
|
-
"a",
|
|
3762
|
-
{
|
|
3763
|
-
href: prUrl,
|
|
3764
|
-
onClick: stopPropagation,
|
|
3765
|
-
rel: "noopener noreferrer",
|
|
3766
|
-
style: { textDecoration: "none" },
|
|
3767
|
-
target: "_blank",
|
|
3768
|
-
children: /* @__PURE__ */ jsxs13(Badge6, { fontSize: 1, mode: "outline", tone: "primary", children: [
|
|
3769
|
-
"#",
|
|
3770
|
-
git.prNumber
|
|
3771
|
-
] })
|
|
3772
|
-
}
|
|
3773
|
-
)
|
|
3774
|
-
] });
|
|
3775
|
-
}
|
|
3776
|
-
function stopPropagation(e) {
|
|
3777
|
-
e.stopPropagation();
|
|
3778
|
-
}
|
|
3779
|
-
|
|
3780
|
-
// src/components/report-card/ModeBadge.tsx
|
|
3781
|
-
import { Badge as Badge7 } from "@sanity/ui";
|
|
3782
|
-
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
3783
|
-
var modeTone = {
|
|
3784
|
-
agentic: "positive",
|
|
3785
|
-
baseline: "default",
|
|
3786
|
-
full: "primary",
|
|
3787
|
-
observed: "caution"
|
|
3788
|
-
};
|
|
3789
|
-
function ModeBadge({ mode }) {
|
|
3790
|
-
const tone = modeTone[mode] ?? "default";
|
|
3791
|
-
return /* @__PURE__ */ jsx17(Badge7, { fontSize: 1, tone, children: mode });
|
|
3792
|
-
}
|
|
3793
|
-
|
|
3794
|
-
// src/components/report-card/ReportMeta.tsx
|
|
3795
|
-
import { Stack as Stack11, Text as Text16 } from "@sanity/ui";
|
|
3796
|
-
|
|
3797
|
-
// src/components/report-card/AreaTags.tsx
|
|
3798
|
-
import { Badge as Badge8, Flex as Flex11 } from "@sanity/ui";
|
|
3799
|
-
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3800
|
-
function AreaTags({ areas, targetDocuments }) {
|
|
3801
|
-
const hasAreas = areas && areas.length > 0;
|
|
3802
|
-
const hasDocs = targetDocuments && targetDocuments.length > 0;
|
|
3803
|
-
if (!hasAreas && !hasDocs) return null;
|
|
3804
|
-
return /* @__PURE__ */ jsxs14(Flex11, { gap: 1, paddingTop: 1, wrap: "wrap", children: [
|
|
3805
|
-
hasAreas && areas.map((area) => /* @__PURE__ */ jsx18(
|
|
3806
|
-
Badge8,
|
|
3807
|
-
{
|
|
3808
|
-
fontSize: 1,
|
|
3809
|
-
mode: "outline",
|
|
3810
|
-
tone: "default",
|
|
3811
|
-
children: area
|
|
3812
|
-
},
|
|
3813
|
-
`area-${area}`
|
|
3814
|
-
)),
|
|
3815
|
-
hasDocs && targetDocuments.map((doc) => /* @__PURE__ */ jsx18(Badge8, { fontSize: 1, mode: "outline", tone: "primary", children: doc }, `doc-${doc}`))
|
|
3816
|
-
] });
|
|
3817
|
-
}
|
|
3818
|
-
|
|
3819
|
-
// src/components/report-card/types.ts
|
|
3820
|
-
function fromReportListItem(item) {
|
|
3821
|
-
return {
|
|
3822
|
-
_id: item._id,
|
|
3823
|
-
reportId: item.reportId,
|
|
3824
|
-
completedAt: item.completedAt,
|
|
3825
|
-
overall: item.overall,
|
|
3826
|
-
mode: item.mode,
|
|
3827
|
-
source: item.source,
|
|
3828
|
-
tag: item.tag,
|
|
3829
|
-
models: item.models,
|
|
3830
|
-
areas: item.areas,
|
|
3831
|
-
trigger: item.trigger,
|
|
3832
|
-
targetDocuments: item.targetDocuments,
|
|
3833
|
-
perspective: item.perspective,
|
|
3834
|
-
durationMs: item.durationMs,
|
|
3835
|
-
comparisonDelta: item.comparisonDelta,
|
|
3836
|
-
regressed: item.regressed,
|
|
3837
|
-
improved: item.improved,
|
|
3838
|
-
scores: item.scores,
|
|
3839
|
-
git: item.git,
|
|
3840
|
-
docLift: item.docLift,
|
|
3841
|
-
actualScore: item.actualScore,
|
|
3842
|
-
retrievalGap: item.retrievalGap,
|
|
3843
|
-
evaluationMode: item.evaluationMode,
|
|
3844
|
-
promptfooUrl: item.promptfooUrl,
|
|
3845
|
-
promptfooUrls: item.promptfooUrls
|
|
3846
|
-
};
|
|
3847
|
-
}
|
|
3848
|
-
function formatCardDate(iso) {
|
|
3849
|
-
return new Date(iso).toLocaleDateString("en-US", {
|
|
3850
|
-
day: "numeric",
|
|
3851
|
-
hour: "2-digit",
|
|
3852
|
-
minute: "2-digit",
|
|
3853
|
-
month: "short",
|
|
3854
|
-
year: "numeric"
|
|
3855
|
-
});
|
|
3856
|
-
}
|
|
3857
|
-
|
|
3858
|
-
// src/components/report-card/ReportMeta.tsx
|
|
3859
|
-
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3860
|
-
function ReportMeta({ data }) {
|
|
3861
|
-
const segments = [];
|
|
3862
|
-
if (data.models && data.models.length > 0) {
|
|
3863
|
-
segments.push(data.models.join(", "));
|
|
3864
|
-
}
|
|
3865
|
-
if (data.perspective) {
|
|
3866
|
-
segments.push(data.perspective);
|
|
3867
|
-
}
|
|
3868
|
-
if (data.durationMs && data.durationMs > 0) {
|
|
3869
|
-
segments.push(formatDuration(data.durationMs));
|
|
3870
|
-
}
|
|
3871
|
-
return /* @__PURE__ */ jsxs15(Stack11, { flex: 1, space: 1, children: [
|
|
3872
|
-
/* @__PURE__ */ jsx19(Text16, { size: 3, weight: "semibold", children: data.tag ?? formatCardDate(data.completedAt) }),
|
|
3873
|
-
segments.length > 0 && /* @__PURE__ */ jsx19(Text16, { muted: true, size: 2, children: segments.join(" \xB7 ") }),
|
|
3874
|
-
/* @__PURE__ */ jsx19(AreaTags, { areas: data.areas, targetDocuments: data.targetDocuments })
|
|
3875
|
-
] });
|
|
3876
|
-
}
|
|
3877
|
-
|
|
3878
|
-
// src/components/primitives/ScoreBadge.tsx
|
|
3879
|
-
import { Badge as Badge9 } from "@sanity/ui";
|
|
3880
|
-
|
|
3881
|
-
// src/lib/scoring.ts
|
|
3882
|
-
var TONE_MAP = {
|
|
3883
|
-
good: "positive",
|
|
3884
|
-
warning: "caution",
|
|
3885
|
-
"needs-work": "default",
|
|
3886
|
-
critical: "critical"
|
|
3801
|
+
var SCORE_COLORS = {
|
|
3802
|
+
good: { bg: "rgba(46, 204, 113, 0.15)", fg: "#2ecc71" },
|
|
3803
|
+
warning: { bg: "rgba(241, 196, 15, 0.15)", fg: "#f1c40f" },
|
|
3804
|
+
"needs-work": { bg: "rgba(230, 126, 34, 0.15)", fg: "#e67e22" },
|
|
3805
|
+
critical: { bg: "rgba(231, 76, 60, 0.15)", fg: "#e74c3c" }
|
|
3887
3806
|
};
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
good: "#2ecc71",
|
|
3896
|
-
warning: "#f1c40f",
|
|
3897
|
-
"needs-work": "#e67e22",
|
|
3898
|
-
critical: "#e74c3c"
|
|
3807
|
+
var GRID_COLUMNS = "72px 1fr 130px 100px 100px 100px";
|
|
3808
|
+
var HEADER_STYLE = {
|
|
3809
|
+
borderBottom: "1px solid var(--card-border-color)",
|
|
3810
|
+
display: "grid",
|
|
3811
|
+
gap: "0 16px",
|
|
3812
|
+
gridTemplateColumns: GRID_COLUMNS,
|
|
3813
|
+
padding: "12px 12px 8px"
|
|
3899
3814
|
};
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
}
|
|
3909
|
-
|
|
3910
|
-
// src/components/primitives/ScoreBadge.tsx
|
|
3911
|
-
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
3912
|
-
function ScoreBadge({ score, fontSize = 2 }) {
|
|
3913
|
-
const rounded = Math.round(score);
|
|
3914
|
-
return /* @__PURE__ */ jsx20(
|
|
3915
|
-
Badge9,
|
|
3916
|
-
{
|
|
3917
|
-
fontSize,
|
|
3918
|
-
style: { minWidth: 48, textAlign: "center" },
|
|
3919
|
-
tone: scoreTone(rounded),
|
|
3920
|
-
children: rounded
|
|
3921
|
-
}
|
|
3922
|
-
);
|
|
3923
|
-
}
|
|
3924
|
-
|
|
3925
|
-
// src/components/report-card/SourceBadge.tsx
|
|
3926
|
-
import { Badge as Badge10 } from "@sanity/ui";
|
|
3927
|
-
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3928
|
-
var sourceTone = {
|
|
3929
|
-
branch: "primary",
|
|
3930
|
-
local: "default",
|
|
3931
|
-
production: "caution"
|
|
3815
|
+
var ROW_STYLE = {
|
|
3816
|
+
alignItems: "start",
|
|
3817
|
+
borderBottom: "1px solid var(--card-border-color)",
|
|
3818
|
+
cursor: "pointer",
|
|
3819
|
+
display: "grid",
|
|
3820
|
+
gap: "0 16px",
|
|
3821
|
+
gridTemplateColumns: GRID_COLUMNS,
|
|
3822
|
+
padding: "14px 12px"
|
|
3932
3823
|
};
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3824
|
+
var TABLE_HOVER_STYLES = `
|
|
3825
|
+
.ailf-row:hover { background: var(--card-muted-bg-color); }
|
|
3826
|
+
`;
|
|
3827
|
+
function ReportTable({
|
|
3828
|
+
reports,
|
|
3829
|
+
onSelectReport,
|
|
3830
|
+
sort,
|
|
3831
|
+
onSortChange
|
|
3832
|
+
}) {
|
|
3833
|
+
return /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
3834
|
+
/* @__PURE__ */ jsx15("style", { children: TABLE_HOVER_STYLES }),
|
|
3835
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
3836
|
+
/* @__PURE__ */ jsxs12("div", { style: HEADER_STYLE, children: [
|
|
3837
|
+
/* @__PURE__ */ jsx15("div", {}),
|
|
3838
|
+
/* @__PURE__ */ jsx15(
|
|
3839
|
+
ColHeader,
|
|
3840
|
+
{
|
|
3841
|
+
active: sort.field === "name",
|
|
3842
|
+
direction: sort.direction,
|
|
3843
|
+
label: "Report",
|
|
3844
|
+
onClick: () => onSortChange("name")
|
|
3845
|
+
}
|
|
3846
|
+
),
|
|
3847
|
+
/* @__PURE__ */ jsx15(
|
|
3848
|
+
ColHeader,
|
|
3849
|
+
{
|
|
3850
|
+
active: sort.field === "score",
|
|
3851
|
+
direction: sort.direction,
|
|
3852
|
+
label: "Change",
|
|
3853
|
+
onClick: () => onSortChange("score")
|
|
3854
|
+
}
|
|
3855
|
+
),
|
|
3856
|
+
/* @__PURE__ */ jsx15(ColHeader, { label: "Mode" }),
|
|
3857
|
+
/* @__PURE__ */ jsx15(ColHeader, { label: "Trigger" }),
|
|
3858
|
+
/* @__PURE__ */ jsx15(
|
|
3859
|
+
ColHeader,
|
|
3860
|
+
{
|
|
3861
|
+
active: sort.field === "date",
|
|
3862
|
+
direction: sort.direction,
|
|
3863
|
+
label: "Time",
|
|
3864
|
+
onClick: () => onSortChange("date"),
|
|
3865
|
+
align: "right"
|
|
3866
|
+
}
|
|
3867
|
+
)
|
|
3868
|
+
] }),
|
|
3869
|
+
reports.map((report) => /* @__PURE__ */ jsx15(
|
|
3870
|
+
ReportRow,
|
|
3871
|
+
{
|
|
3872
|
+
onSelect: onSelectReport,
|
|
3873
|
+
report
|
|
3874
|
+
},
|
|
3875
|
+
report._id
|
|
3876
|
+
))
|
|
3953
3877
|
] })
|
|
3954
3878
|
] });
|
|
3955
3879
|
}
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3880
|
+
function ReportRow({
|
|
3881
|
+
report,
|
|
3882
|
+
onSelect
|
|
3883
|
+
}) {
|
|
3960
3884
|
const handleClick = useCallback8(() => {
|
|
3961
|
-
|
|
3962
|
-
}, [
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3885
|
+
onSelect(report.reportId);
|
|
3886
|
+
}, [onSelect, report.reportId]);
|
|
3887
|
+
const rounded = Math.round(report.overall);
|
|
3888
|
+
const grade = scoreGrade(rounded);
|
|
3889
|
+
const colors = SCORE_COLORS[grade];
|
|
3890
|
+
const hasDelta = report.comparisonDelta != null && report.comparisonDelta !== 0;
|
|
3891
|
+
const delta = report.comparisonDelta ?? 0;
|
|
3892
|
+
const deltaUp = delta > 0;
|
|
3893
|
+
const regressedCount = report.regressed?.length ?? 0;
|
|
3894
|
+
const improvedCount = report.improved?.length ?? 0;
|
|
3895
|
+
const hasAreas = report.areas && report.areas.length > 0;
|
|
3896
|
+
const hasDocs = report.targetDocuments && report.targetDocuments.length > 0;
|
|
3897
|
+
const git = report.git;
|
|
3898
|
+
return /* @__PURE__ */ jsxs12("div", { className: "ailf-row", onClick: handleClick, style: ROW_STYLE, children: [
|
|
3899
|
+
/* @__PURE__ */ jsx15(Flex9, { align: "center", justify: "center", style: { paddingTop: 2 }, children: /* @__PURE__ */ jsx15(
|
|
3900
|
+
"div",
|
|
3901
|
+
{
|
|
3902
|
+
style: {
|
|
3903
|
+
alignItems: "center",
|
|
3904
|
+
background: colors.bg,
|
|
3905
|
+
border: `1px solid ${colors.fg}40`,
|
|
3906
|
+
borderRadius: 8,
|
|
3907
|
+
color: colors.fg,
|
|
3908
|
+
display: "flex",
|
|
3909
|
+
fontSize: 22,
|
|
3910
|
+
fontWeight: 700,
|
|
3911
|
+
height: 48,
|
|
3912
|
+
justifyContent: "center",
|
|
3913
|
+
lineHeight: 1,
|
|
3914
|
+
width: 56
|
|
3915
|
+
},
|
|
3916
|
+
children: rounded
|
|
3917
|
+
}
|
|
3918
|
+
) }),
|
|
3919
|
+
/* @__PURE__ */ jsxs12(Stack9, { space: 2, children: [
|
|
3920
|
+
/* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
3921
|
+
/* @__PURE__ */ jsx15(Text13, { size: 3, weight: "semibold", children: report.tag ?? formatCardDate(report.completedAt) }),
|
|
3922
|
+
git && /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 2, children: [
|
|
3923
|
+
/* @__PURE__ */ jsxs12(Inline, { space: 1, children: [
|
|
3924
|
+
/* @__PURE__ */ jsx15(GitBranchIcon, { style: { opacity: 0.6 } }),
|
|
3925
|
+
/* @__PURE__ */ jsx15(Code, { size: 2, children: git.branch })
|
|
3978
3926
|
] }),
|
|
3979
|
-
/* @__PURE__ */
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
/* @__PURE__ */ jsx22(
|
|
3983
|
-
Text17,
|
|
3984
|
-
{
|
|
3985
|
-
muted: true,
|
|
3986
|
-
size: 1,
|
|
3987
|
-
title: new Date(data.completedAt).toISOString(),
|
|
3988
|
-
children: formatRelativeTime(data.completedAt)
|
|
3989
|
-
}
|
|
3990
|
-
),
|
|
3991
|
-
data.trigger && /* @__PURE__ */ jsx22(Badge12, { fontSize: 1, tone: "default", children: data.trigger })
|
|
3927
|
+
git.prNumber && /* @__PURE__ */ jsxs12(Text13, { muted: true, size: 2, children: [
|
|
3928
|
+
"#",
|
|
3929
|
+
git.prNumber
|
|
3992
3930
|
] }),
|
|
3993
|
-
|
|
3931
|
+
/* @__PURE__ */ jsx15(Code, { size: 1, style: { opacity: 0.5 }, children: git.sha.slice(0, 7) })
|
|
3994
3932
|
] })
|
|
3995
|
-
] })
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
// src/components/search-bar/SearchBar.tsx
|
|
4001
|
-
import { SearchIcon as SearchIcon4 } from "@sanity/icons";
|
|
4002
|
-
import { Card as Card11, Flex as Flex16, Text as Text20 } from "@sanity/ui";
|
|
4003
|
-
import {
|
|
4004
|
-
useCallback as useCallback11,
|
|
4005
|
-
useEffect as useEffect6,
|
|
4006
|
-
useRef as useRef4,
|
|
4007
|
-
useState as useState6
|
|
4008
|
-
} from "react";
|
|
4009
|
-
|
|
4010
|
-
// src/components/search-bar/types.ts
|
|
4011
|
-
var DIMENSIONS = [
|
|
4012
|
-
{
|
|
4013
|
-
key: "model",
|
|
4014
|
-
categoryLabel: "Models",
|
|
4015
|
-
prefix: "model:",
|
|
4016
|
-
tone: "primary",
|
|
4017
|
-
multi: false
|
|
4018
|
-
},
|
|
4019
|
-
{
|
|
4020
|
-
key: "area",
|
|
4021
|
-
categoryLabel: "Areas",
|
|
4022
|
-
prefix: "area:",
|
|
4023
|
-
tone: "positive",
|
|
4024
|
-
multi: true
|
|
4025
|
-
},
|
|
4026
|
-
{
|
|
4027
|
-
key: "date",
|
|
4028
|
-
categoryLabel: "Date range",
|
|
4029
|
-
prefix: "date:",
|
|
4030
|
-
tone: "caution",
|
|
4031
|
-
multi: false
|
|
4032
|
-
}
|
|
4033
|
-
];
|
|
4034
|
-
var DATE_SUGGESTIONS = [
|
|
4035
|
-
{ label: "Today", value: "today" },
|
|
4036
|
-
{ label: "Yesterday", value: "yesterday" },
|
|
4037
|
-
{ label: "Last 7 days", value: "7d" },
|
|
4038
|
-
{ label: "Last 30 days", value: "30d" },
|
|
4039
|
-
{ label: "Last 90 days", value: "90d" }
|
|
4040
|
-
];
|
|
4041
|
-
var nextTokenId = 0;
|
|
4042
|
-
function createToken(dimension, value, label) {
|
|
4043
|
-
return {
|
|
4044
|
-
id: `token-${++nextTokenId}`,
|
|
4045
|
-
dimension,
|
|
4046
|
-
value,
|
|
4047
|
-
label: label ?? value
|
|
4048
|
-
};
|
|
4049
|
-
}
|
|
4050
|
-
|
|
4051
|
-
// src/components/search-bar/suggestions.ts
|
|
4052
|
-
function computeSuggestions(input) {
|
|
4053
|
-
const { query, activeTokens, models, areas } = input;
|
|
4054
|
-
const trimmed = query.trim().toLowerCase();
|
|
4055
|
-
const scopedDimension = detectScopedDimension(trimmed);
|
|
4056
|
-
if (scopedDimension) {
|
|
4057
|
-
const afterPrefix = trimmed.slice(scopedDimension.prefix.length).trim();
|
|
4058
|
-
return getScopedSuggestions(
|
|
4059
|
-
scopedDimension,
|
|
4060
|
-
afterPrefix,
|
|
4061
|
-
activeTokens,
|
|
4062
|
-
models,
|
|
4063
|
-
areas
|
|
4064
|
-
);
|
|
4065
|
-
}
|
|
4066
|
-
if (trimmed.length === 0) {
|
|
4067
|
-
return getDimensionHints(activeTokens);
|
|
4068
|
-
}
|
|
4069
|
-
return getUnscopedSuggestions(trimmed, activeTokens, models, areas);
|
|
4070
|
-
}
|
|
4071
|
-
function detectScopedDimension(query) {
|
|
4072
|
-
return DIMENSIONS.find((d) => query.startsWith(d.prefix));
|
|
4073
|
-
}
|
|
4074
|
-
function getScopedSuggestions(dim, afterPrefix, activeTokens, models, areas) {
|
|
4075
|
-
const values = getValuesForDimension(dim.key, models, areas);
|
|
4076
|
-
const filtered = filterAndExclude(values, afterPrefix, dim, activeTokens);
|
|
4077
|
-
return filtered.map((v) => ({
|
|
4078
|
-
dimension: dim.key,
|
|
4079
|
-
value: v.value,
|
|
4080
|
-
label: v.label,
|
|
4081
|
-
category: dim.categoryLabel
|
|
4082
|
-
}));
|
|
4083
|
-
}
|
|
4084
|
-
function getUnscopedSuggestions(query, activeTokens, models, areas) {
|
|
4085
|
-
const results = [];
|
|
4086
|
-
for (const dim of DIMENSIONS) {
|
|
4087
|
-
const values = getValuesForDimension(dim.key, models, areas);
|
|
4088
|
-
const matching = filterAndExclude(values, query, dim, activeTokens);
|
|
4089
|
-
for (const v of matching.slice(0, 3)) {
|
|
4090
|
-
results.push({
|
|
4091
|
-
dimension: dim.key,
|
|
4092
|
-
value: v.value,
|
|
4093
|
-
label: v.label,
|
|
4094
|
-
category: dim.categoryLabel
|
|
4095
|
-
});
|
|
4096
|
-
}
|
|
4097
|
-
}
|
|
4098
|
-
for (const dim of DIMENSIONS) {
|
|
4099
|
-
if (dim.prefix.startsWith(query) && query.length > 0 && query.length < dim.prefix.length) {
|
|
4100
|
-
results.push({
|
|
4101
|
-
dimension: dim.key,
|
|
4102
|
-
value: dim.prefix,
|
|
4103
|
-
label: `Type "${dim.prefix}" to filter by ${dim.categoryLabel.toLowerCase()}`,
|
|
4104
|
-
category: "Filters"
|
|
4105
|
-
});
|
|
4106
|
-
}
|
|
4107
|
-
}
|
|
4108
|
-
return results;
|
|
4109
|
-
}
|
|
4110
|
-
function getDimensionHints(activeTokens) {
|
|
4111
|
-
return DIMENSIONS.filter((dim) => {
|
|
4112
|
-
if (!dim.multi && activeTokens.some((t) => t.dimension === dim.key)) {
|
|
4113
|
-
return false;
|
|
4114
|
-
}
|
|
4115
|
-
return true;
|
|
4116
|
-
}).map((dim) => ({
|
|
4117
|
-
dimension: dim.key,
|
|
4118
|
-
value: dim.prefix,
|
|
4119
|
-
label: `${dim.prefix} \u2014 filter by ${dim.categoryLabel.toLowerCase()}`,
|
|
4120
|
-
category: "Filters"
|
|
4121
|
-
}));
|
|
4122
|
-
}
|
|
4123
|
-
function getValuesForDimension(key, models, areas) {
|
|
4124
|
-
switch (key) {
|
|
4125
|
-
case "model":
|
|
4126
|
-
return models.map((m) => ({ label: m, value: m }));
|
|
4127
|
-
case "area":
|
|
4128
|
-
return areas.map((a) => ({ label: a, value: a }));
|
|
4129
|
-
case "date":
|
|
4130
|
-
return DATE_SUGGESTIONS;
|
|
4131
|
-
}
|
|
4132
|
-
}
|
|
4133
|
-
function filterAndExclude(values, query, dim, activeTokens) {
|
|
4134
|
-
const activeDimValues = new Set(
|
|
4135
|
-
activeTokens.filter((t) => t.dimension === dim.key).map((t) => t.value)
|
|
4136
|
-
);
|
|
4137
|
-
return values.filter((v) => {
|
|
4138
|
-
if (activeDimValues.has(v.value)) return false;
|
|
4139
|
-
if (!dim.multi && activeDimValues.size > 0) return false;
|
|
4140
|
-
if (!query) return true;
|
|
4141
|
-
return v.label.toLowerCase().includes(query);
|
|
4142
|
-
});
|
|
4143
|
-
}
|
|
4144
|
-
|
|
4145
|
-
// src/components/search-bar/FilterBadge.tsx
|
|
4146
|
-
import { CloseIcon } from "@sanity/icons";
|
|
4147
|
-
import { Badge as Badge13, Flex as Flex14, Text as Text18 } from "@sanity/ui";
|
|
4148
|
-
import { useCallback as useCallback9 } from "react";
|
|
4149
|
-
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4150
|
-
function FilterBadge({ token, onRemove }) {
|
|
4151
|
-
const dim = DIMENSIONS.find((d) => d.key === token.dimension);
|
|
4152
|
-
const tone = dim?.tone ?? "default";
|
|
4153
|
-
const handleRemove = useCallback9(
|
|
4154
|
-
(e) => {
|
|
4155
|
-
e.stopPropagation();
|
|
4156
|
-
onRemove(token.id);
|
|
4157
|
-
},
|
|
4158
|
-
[onRemove, token.id]
|
|
4159
|
-
);
|
|
4160
|
-
return /* @__PURE__ */ jsx23(
|
|
4161
|
-
Badge13,
|
|
4162
|
-
{
|
|
4163
|
-
fontSize: 1,
|
|
4164
|
-
style: {
|
|
4165
|
-
cursor: "default",
|
|
4166
|
-
flexShrink: 0,
|
|
4167
|
-
userSelect: "none"
|
|
4168
|
-
},
|
|
4169
|
-
tone,
|
|
4170
|
-
children: /* @__PURE__ */ jsxs18(Flex14, { align: "center", gap: 1, children: [
|
|
4171
|
-
/* @__PURE__ */ jsxs18(Text18, { size: 1, children: [
|
|
4172
|
-
token.dimension,
|
|
4173
|
-
":",
|
|
4174
|
-
token.label
|
|
4175
|
-
] }),
|
|
4176
|
-
/* @__PURE__ */ jsx23(
|
|
4177
|
-
Text18,
|
|
4178
|
-
{
|
|
4179
|
-
muted: true,
|
|
4180
|
-
onClick: handleRemove,
|
|
4181
|
-
size: 1,
|
|
4182
|
-
style: { cursor: "pointer", lineHeight: 1 },
|
|
4183
|
-
children: /* @__PURE__ */ jsx23(CloseIcon, {})
|
|
4184
|
-
}
|
|
4185
|
-
)
|
|
4186
|
-
] })
|
|
4187
|
-
}
|
|
4188
|
-
);
|
|
4189
|
-
}
|
|
4190
|
-
|
|
4191
|
-
// src/components/search-bar/SuggestionList.tsx
|
|
4192
|
-
import { Badge as Badge14, Card as Card10, Flex as Flex15, Stack as Stack12, Text as Text19 } from "@sanity/ui";
|
|
4193
|
-
import { useCallback as useCallback10 } from "react";
|
|
4194
|
-
import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4195
|
-
function SuggestionList({
|
|
4196
|
-
suggestions,
|
|
4197
|
-
activeIndex,
|
|
4198
|
-
onSelect
|
|
4199
|
-
}) {
|
|
4200
|
-
if (suggestions.length === 0) return null;
|
|
4201
|
-
const groups = groupByCategory(suggestions);
|
|
4202
|
-
let globalIndex = -1;
|
|
4203
|
-
return /* @__PURE__ */ jsx24(
|
|
4204
|
-
Card10,
|
|
4205
|
-
{
|
|
4206
|
-
overflow: "auto",
|
|
4207
|
-
radius: 2,
|
|
4208
|
-
shadow: 2,
|
|
4209
|
-
style: {
|
|
4210
|
-
left: 0,
|
|
4211
|
-
maxHeight: 300,
|
|
4212
|
-
position: "absolute",
|
|
4213
|
-
right: 0,
|
|
4214
|
-
top: "100%",
|
|
4215
|
-
zIndex: 100
|
|
4216
|
-
},
|
|
4217
|
-
children: /* @__PURE__ */ jsx24(Stack12, { padding: 1, space: 1, children: groups.map(([category, items]) => /* @__PURE__ */ jsxs19(Stack12, { space: 0, children: [
|
|
4218
|
-
/* @__PURE__ */ jsx24(
|
|
4219
|
-
Text19,
|
|
3933
|
+
] }),
|
|
3934
|
+
/* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
3935
|
+
report.source && /* @__PURE__ */ jsx15(
|
|
3936
|
+
Badge4,
|
|
4220
3937
|
{
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
textTransform: "uppercase"
|
|
4227
|
-
},
|
|
4228
|
-
weight: "semibold",
|
|
4229
|
-
children: category
|
|
3938
|
+
fontSize: 1,
|
|
3939
|
+
padding: 1,
|
|
3940
|
+
radius: 1,
|
|
3941
|
+
tone: SOURCE_TONE[report.source] ?? "default",
|
|
3942
|
+
children: report.source
|
|
4230
3943
|
}
|
|
4231
3944
|
),
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
}
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
suggestion
|
|
4253
|
-
}) {
|
|
4254
|
-
const dim = DIMENSIONS.find((d) => d.key === suggestion.dimension);
|
|
4255
|
-
const tone = dim?.tone ?? "default";
|
|
4256
|
-
const isHint = suggestion.category === "Filters";
|
|
4257
|
-
const handleClick = useCallback10(() => {
|
|
4258
|
-
onSelect(suggestion);
|
|
4259
|
-
}, [onSelect, suggestion]);
|
|
4260
|
-
return /* @__PURE__ */ jsx24(
|
|
4261
|
-
Card10,
|
|
4262
|
-
{
|
|
4263
|
-
onClick: handleClick,
|
|
4264
|
-
padding: 2,
|
|
4265
|
-
radius: 2,
|
|
4266
|
-
style: { cursor: "pointer" },
|
|
4267
|
-
tone: active ? "primary" : "default",
|
|
4268
|
-
children: /* @__PURE__ */ jsxs19(Flex15, { align: "center", gap: 2, children: [
|
|
4269
|
-
!isHint && /* @__PURE__ */ jsx24(Badge14, { fontSize: 1, tone, children: suggestion.dimension }),
|
|
4270
|
-
/* @__PURE__ */ jsx24(Text19, { size: 2, children: suggestion.label })
|
|
3945
|
+
report.models?.map((model) => /* @__PURE__ */ jsx15(
|
|
3946
|
+
Badge4,
|
|
3947
|
+
{
|
|
3948
|
+
fontSize: 1,
|
|
3949
|
+
padding: 1,
|
|
3950
|
+
radius: 1,
|
|
3951
|
+
tone: "default",
|
|
3952
|
+
children: model
|
|
3953
|
+
},
|
|
3954
|
+
model
|
|
3955
|
+
)),
|
|
3956
|
+
report.perspective && /* @__PURE__ */ jsx15(OutlineBadge, { tone: "cyan", children: report.perspective }),
|
|
3957
|
+
report.durationMs != null && report.durationMs > 0 && /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 1, children: [
|
|
3958
|
+
/* @__PURE__ */ jsx15(ClockIcon, { style: { fontSize: 13, opacity: 0.5 } }),
|
|
3959
|
+
/* @__PURE__ */ jsx15(Text13, { muted: true, size: 1, children: formatDuration(report.durationMs) })
|
|
3960
|
+
] })
|
|
3961
|
+
] }),
|
|
3962
|
+
(hasAreas || hasDocs) && /* @__PURE__ */ jsxs12(Flex9, { gap: 2, wrap: "wrap", children: [
|
|
3963
|
+
hasAreas && report.areas.map((area) => /* @__PURE__ */ jsx15(OutlineBadge, { tone: "purple", children: area }, `a-${area}`)),
|
|
3964
|
+
hasDocs && report.targetDocuments.map((doc) => /* @__PURE__ */ jsx15(OutlineBadge, { tone: "positive", children: doc }, `d-${doc}`))
|
|
4271
3965
|
] })
|
|
4272
|
-
}
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
function groupByCategory(suggestions) {
|
|
4276
|
-
const map = /* @__PURE__ */ new Map();
|
|
4277
|
-
for (const s of suggestions) {
|
|
4278
|
-
if (!map.has(s.category)) map.set(s.category, []);
|
|
4279
|
-
map.get(s.category).push(s);
|
|
4280
|
-
}
|
|
4281
|
-
return [...map.entries()];
|
|
4282
|
-
}
|
|
4283
|
-
|
|
4284
|
-
// src/components/search-bar/SearchBar.tsx
|
|
4285
|
-
import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4286
|
-
function SearchBar({
|
|
4287
|
-
tokens,
|
|
4288
|
-
query,
|
|
4289
|
-
models,
|
|
4290
|
-
areas,
|
|
4291
|
-
onQueryChange,
|
|
4292
|
-
onTokenAdd,
|
|
4293
|
-
onTokenRemove
|
|
4294
|
-
}) {
|
|
4295
|
-
const [focused, setFocused] = useState6(false);
|
|
4296
|
-
const [activeIndex, setActiveIndex] = useState6(-1);
|
|
4297
|
-
const inputRef = useRef4(null);
|
|
4298
|
-
const blurTimerRef = useRef4(null);
|
|
4299
|
-
useEffect6(() => {
|
|
4300
|
-
return () => {
|
|
4301
|
-
if (blurTimerRef.current) {
|
|
4302
|
-
clearTimeout(blurTimerRef.current);
|
|
4303
|
-
}
|
|
4304
|
-
};
|
|
4305
|
-
}, []);
|
|
4306
|
-
const suggestions = focused ? computeSuggestions({ query, activeTokens: tokens, models, areas }) : [];
|
|
4307
|
-
useEffect6(() => {
|
|
4308
|
-
setActiveIndex(-1);
|
|
4309
|
-
}, [query, tokens.length]);
|
|
4310
|
-
const handleTokenRemove = useCallback11(
|
|
4311
|
-
(id) => {
|
|
4312
|
-
onTokenRemove(id);
|
|
4313
|
-
requestAnimationFrame(() => {
|
|
4314
|
-
inputRef.current?.focus();
|
|
4315
|
-
});
|
|
4316
|
-
},
|
|
4317
|
-
[onTokenRemove]
|
|
4318
|
-
);
|
|
4319
|
-
const handleSuggestionSelect = useCallback11(
|
|
4320
|
-
(suggestion) => {
|
|
4321
|
-
if (suggestion.category === "Filters") {
|
|
4322
|
-
onQueryChange(suggestion.value);
|
|
4323
|
-
inputRef.current?.focus();
|
|
4324
|
-
return;
|
|
4325
|
-
}
|
|
4326
|
-
const token = createToken(
|
|
4327
|
-
suggestion.dimension,
|
|
4328
|
-
suggestion.value,
|
|
4329
|
-
suggestion.label
|
|
4330
|
-
);
|
|
4331
|
-
onTokenAdd(token);
|
|
4332
|
-
onQueryChange("");
|
|
4333
|
-
setActiveIndex(-1);
|
|
4334
|
-
inputRef.current?.focus();
|
|
4335
|
-
},
|
|
4336
|
-
[onTokenAdd, onQueryChange]
|
|
4337
|
-
);
|
|
4338
|
-
const handleKeyDown = useCallback11(
|
|
4339
|
-
(e) => {
|
|
4340
|
-
if (e.key === "ArrowDown") {
|
|
4341
|
-
e.preventDefault();
|
|
4342
|
-
setActiveIndex((prev) => prev < suggestions.length - 1 ? prev + 1 : 0);
|
|
4343
|
-
} else if (e.key === "ArrowUp") {
|
|
4344
|
-
e.preventDefault();
|
|
4345
|
-
setActiveIndex((prev) => prev > 0 ? prev - 1 : suggestions.length - 1);
|
|
4346
|
-
} else if (e.key === "Enter" && activeIndex >= 0) {
|
|
4347
|
-
e.preventDefault();
|
|
4348
|
-
const selected = suggestions[activeIndex];
|
|
4349
|
-
if (selected) handleSuggestionSelect(selected);
|
|
4350
|
-
} else if (e.key === "Escape") {
|
|
4351
|
-
setFocused(false);
|
|
4352
|
-
inputRef.current?.blur();
|
|
4353
|
-
} else if (e.key === "Backspace" && query === "" && tokens.length > 0) {
|
|
4354
|
-
handleTokenRemove(tokens[tokens.length - 1].id);
|
|
4355
|
-
}
|
|
4356
|
-
},
|
|
4357
|
-
[
|
|
4358
|
-
activeIndex,
|
|
4359
|
-
suggestions,
|
|
4360
|
-
query,
|
|
4361
|
-
tokens,
|
|
4362
|
-
handleTokenRemove,
|
|
4363
|
-
handleSuggestionSelect
|
|
4364
|
-
]
|
|
4365
|
-
);
|
|
4366
|
-
const handleInputChange = useCallback11(
|
|
4367
|
-
(e) => {
|
|
4368
|
-
const value = e.target.value;
|
|
4369
|
-
onQueryChange(value);
|
|
4370
|
-
},
|
|
4371
|
-
[onQueryChange]
|
|
4372
|
-
);
|
|
4373
|
-
const handleBlur = useCallback11(() => {
|
|
4374
|
-
blurTimerRef.current = setTimeout(() => {
|
|
4375
|
-
blurTimerRef.current = null;
|
|
4376
|
-
setFocused(false);
|
|
4377
|
-
}, 200);
|
|
4378
|
-
}, []);
|
|
4379
|
-
const handleFocus = useCallback11(() => {
|
|
4380
|
-
if (blurTimerRef.current) {
|
|
4381
|
-
clearTimeout(blurTimerRef.current);
|
|
4382
|
-
blurTimerRef.current = null;
|
|
4383
|
-
}
|
|
4384
|
-
setFocused(true);
|
|
4385
|
-
}, []);
|
|
4386
|
-
const handleBarClick = useCallback11(() => {
|
|
4387
|
-
inputRef.current?.focus();
|
|
4388
|
-
}, []);
|
|
4389
|
-
return /* @__PURE__ */ jsxs20("div", { style: { position: "relative" }, children: [
|
|
4390
|
-
/* @__PURE__ */ jsx25(
|
|
4391
|
-
Card11,
|
|
3966
|
+
] }),
|
|
3967
|
+
/* @__PURE__ */ jsxs12(
|
|
3968
|
+
Flex9,
|
|
4392
3969
|
{
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
)
|
|
4432
|
-
]
|
|
3970
|
+
align: "flex-start",
|
|
3971
|
+
direction: "column",
|
|
3972
|
+
gap: 2,
|
|
3973
|
+
style: { paddingTop: 2 },
|
|
3974
|
+
children: [
|
|
3975
|
+
hasDelta && /* @__PURE__ */ jsxs12(Flex9, { align: "center", gap: 1, children: [
|
|
3976
|
+
/* @__PURE__ */ jsx15(
|
|
3977
|
+
TrendUpwardIcon,
|
|
3978
|
+
{
|
|
3979
|
+
style: {
|
|
3980
|
+
color: deltaUp ? "var(--card-badge-positive-dot-color)" : "var(--card-badge-critical-dot-color)",
|
|
3981
|
+
fontSize: 17,
|
|
3982
|
+
transform: deltaUp ? void 0 : "scaleY(-1)"
|
|
3983
|
+
}
|
|
3984
|
+
}
|
|
3985
|
+
),
|
|
3986
|
+
/* @__PURE__ */ jsxs12(
|
|
3987
|
+
Text13,
|
|
3988
|
+
{
|
|
3989
|
+
size: 3,
|
|
3990
|
+
style: {
|
|
3991
|
+
color: deltaUp ? "var(--card-badge-positive-dot-color)" : "var(--card-badge-critical-dot-color)",
|
|
3992
|
+
fontWeight: 600
|
|
3993
|
+
},
|
|
3994
|
+
children: [
|
|
3995
|
+
deltaUp ? "+" : "",
|
|
3996
|
+
Math.round(delta)
|
|
3997
|
+
]
|
|
3998
|
+
}
|
|
3999
|
+
)
|
|
4000
|
+
] }),
|
|
4001
|
+
improvedCount > 0 && /* @__PURE__ */ jsxs12(OutlineBadge, { tone: "positive", children: [
|
|
4002
|
+
improvedCount,
|
|
4003
|
+
" improved"
|
|
4004
|
+
] }),
|
|
4005
|
+
regressedCount > 0 && /* @__PURE__ */ jsxs12(OutlineBadge, { tone: "critical", children: [
|
|
4006
|
+
regressedCount,
|
|
4007
|
+
" regressed"
|
|
4008
|
+
] })
|
|
4009
|
+
]
|
|
4433
4010
|
}
|
|
4434
4011
|
),
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4012
|
+
/* @__PURE__ */ jsx15("div", { style: { paddingTop: 2 }, children: /* @__PURE__ */ jsx15(OutlineBadge, { tone: MODE_TONE[report.mode] ?? "default", children: report.mode }) }),
|
|
4013
|
+
/* @__PURE__ */ jsx15("div", { style: { paddingTop: 2 }, children: report.trigger && /* @__PURE__ */ jsx15(OutlineBadge, { tone: TRIGGER_TONE[report.trigger] ?? "default", children: report.trigger }) }),
|
|
4014
|
+
/* @__PURE__ */ jsx15("div", { style: { paddingTop: 2, textAlign: "right" }, children: /* @__PURE__ */ jsx15(Text13, { muted: true, size: 2, title: new Date(report.completedAt).toISOString(), children: formatRelativeTime(report.completedAt) }) })
|
|
4015
|
+
] });
|
|
4016
|
+
}
|
|
4017
|
+
var MODE_TONE = {
|
|
4018
|
+
agentic: "positive",
|
|
4019
|
+
baseline: "default",
|
|
4020
|
+
full: "primary",
|
|
4021
|
+
observed: "caution",
|
|
4022
|
+
debug: "purple"
|
|
4023
|
+
};
|
|
4024
|
+
var SOURCE_TONE = {
|
|
4025
|
+
branch: "primary",
|
|
4026
|
+
local: "default",
|
|
4027
|
+
production: "caution"
|
|
4028
|
+
};
|
|
4029
|
+
var TRIGGER_TONE = {
|
|
4030
|
+
ci: "cyan",
|
|
4031
|
+
"cross-repo": "purple",
|
|
4032
|
+
manual: "caution",
|
|
4033
|
+
schedule: "default",
|
|
4034
|
+
webhook: "positive"
|
|
4035
|
+
};
|
|
4036
|
+
function ColHeader({
|
|
4037
|
+
label,
|
|
4038
|
+
active,
|
|
4039
|
+
direction,
|
|
4040
|
+
onClick,
|
|
4041
|
+
align
|
|
4042
|
+
}) {
|
|
4043
|
+
const handleKeyDown = useCallback8(
|
|
4044
|
+
(e) => {
|
|
4045
|
+
if (onClick && (e.key === "Enter" || e.key === " ")) {
|
|
4046
|
+
e.preventDefault();
|
|
4047
|
+
onClick();
|
|
4441
4048
|
}
|
|
4442
|
-
|
|
4443
|
-
|
|
4049
|
+
},
|
|
4050
|
+
[onClick]
|
|
4051
|
+
);
|
|
4052
|
+
const arrow = active ? direction === "asc" ? " \u2191" : " \u2193" : "";
|
|
4053
|
+
return /* @__PURE__ */ jsx15(
|
|
4054
|
+
"div",
|
|
4055
|
+
{
|
|
4056
|
+
onClick,
|
|
4057
|
+
onKeyDown: onClick ? handleKeyDown : void 0,
|
|
4058
|
+
role: onClick ? "button" : void 0,
|
|
4059
|
+
style: {
|
|
4060
|
+
cursor: onClick ? "pointer" : "default",
|
|
4061
|
+
textAlign: align,
|
|
4062
|
+
userSelect: "none"
|
|
4063
|
+
},
|
|
4064
|
+
tabIndex: onClick ? 0 : void 0,
|
|
4065
|
+
children: /* @__PURE__ */ jsxs12(
|
|
4066
|
+
Text13,
|
|
4067
|
+
{
|
|
4068
|
+
muted: true,
|
|
4069
|
+
size: 1,
|
|
4070
|
+
style: {
|
|
4071
|
+
letterSpacing: "0.08em",
|
|
4072
|
+
textTransform: "uppercase"
|
|
4073
|
+
},
|
|
4074
|
+
weight: "semibold",
|
|
4075
|
+
children: [
|
|
4076
|
+
label,
|
|
4077
|
+
arrow
|
|
4078
|
+
]
|
|
4079
|
+
}
|
|
4080
|
+
)
|
|
4081
|
+
}
|
|
4082
|
+
);
|
|
4444
4083
|
}
|
|
4445
4084
|
|
|
4446
4085
|
// src/components/LatestReports.tsx
|
|
4447
|
-
import { jsx as
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
}
|
|
4086
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4087
|
+
function readParam(params, key) {
|
|
4088
|
+
if (!params) return null;
|
|
4089
|
+
const pair = params.find(([k]) => k === key);
|
|
4090
|
+
return pair ? pair[1] : null;
|
|
4091
|
+
}
|
|
4092
|
+
function buildSearchParams(filters) {
|
|
4093
|
+
const params = [];
|
|
4094
|
+
if (filters.q) params.push(["q", filters.q]);
|
|
4095
|
+
if (filters.mode) params.push(["mode", filters.mode]);
|
|
4096
|
+
if (filters.source) params.push(["source", filters.source]);
|
|
4097
|
+
if (filters.trigger) params.push(["trigger", filters.trigger]);
|
|
4098
|
+
return params;
|
|
4099
|
+
}
|
|
4453
4100
|
function LatestReports({
|
|
4454
|
-
mode = null,
|
|
4455
4101
|
onSelectReport,
|
|
4456
|
-
pageSize = 20
|
|
4457
|
-
source = null
|
|
4102
|
+
pageSize = 20
|
|
4458
4103
|
}) {
|
|
4459
|
-
const client =
|
|
4460
|
-
const
|
|
4461
|
-
const
|
|
4462
|
-
const
|
|
4463
|
-
const [
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
const [
|
|
4467
|
-
|
|
4468
|
-
|
|
4104
|
+
const client = useClient4({ apiVersion: API_VERSION });
|
|
4105
|
+
const router = useRouter();
|
|
4106
|
+
const routerState = router.state;
|
|
4107
|
+
const urlParams = routerState._searchParams;
|
|
4108
|
+
const [searchQuery, setSearchQuery] = useState4(
|
|
4109
|
+
() => readParam(urlParams, "q") ?? ""
|
|
4110
|
+
);
|
|
4111
|
+
const [mode, setMode] = useState4(
|
|
4112
|
+
() => readParam(urlParams, "mode")
|
|
4113
|
+
);
|
|
4114
|
+
const [source, setSource] = useState4(
|
|
4115
|
+
() => readParam(urlParams, "source")
|
|
4116
|
+
);
|
|
4117
|
+
const [trigger, setTrigger] = useState4(
|
|
4118
|
+
() => readParam(urlParams, "trigger")
|
|
4119
|
+
);
|
|
4120
|
+
useEffect4(() => {
|
|
4121
|
+
const params = buildSearchParams({
|
|
4122
|
+
q: searchQuery,
|
|
4123
|
+
mode,
|
|
4124
|
+
source,
|
|
4125
|
+
trigger
|
|
4126
|
+
});
|
|
4127
|
+
router.navigate({ ...router.state, _searchParams: params });
|
|
4128
|
+
}, [searchQuery, mode, source, trigger]);
|
|
4129
|
+
const [initialLoading, setInitialLoading] = useState4(true);
|
|
4130
|
+
const [loadingMore, setLoadingMore] = useState4(false);
|
|
4131
|
+
const [reports, setReports] = useState4([]);
|
|
4132
|
+
const [hasMore, setHasMore] = useState4(true);
|
|
4133
|
+
const [modes, setModes] = useState4([]);
|
|
4134
|
+
const [sources, setSources] = useState4([]);
|
|
4135
|
+
const [triggers, setTriggers] = useState4([]);
|
|
4136
|
+
const [sort, setSort] = useState4({
|
|
4469
4137
|
direction: "desc",
|
|
4470
4138
|
field: "date"
|
|
4471
4139
|
});
|
|
4472
|
-
|
|
4473
|
-
const [availableAreas, setAvailableAreas] = useState7([]);
|
|
4474
|
-
useEffect7(() => {
|
|
4475
|
-
setInitialLoading(true);
|
|
4140
|
+
useEffect4(() => {
|
|
4476
4141
|
setHasMore(true);
|
|
4477
4142
|
client.fetch(latestReportsQuery, {
|
|
4478
4143
|
limit: pageSize,
|
|
@@ -4489,7 +4154,7 @@ function LatestReports({
|
|
|
4489
4154
|
setInitialLoading(false);
|
|
4490
4155
|
});
|
|
4491
4156
|
}, [client, pageSize, mode, source]);
|
|
4492
|
-
const handleLoadMore =
|
|
4157
|
+
const handleLoadMore = useCallback9(() => {
|
|
4493
4158
|
if (loadingMore || !hasMore) return;
|
|
4494
4159
|
setLoadingMore(true);
|
|
4495
4160
|
const nextLimit = reports.length + pageSize;
|
|
@@ -4506,29 +4171,16 @@ function LatestReports({
|
|
|
4506
4171
|
setLoadingMore(false);
|
|
4507
4172
|
});
|
|
4508
4173
|
}, [client, hasMore, loadingMore, mode, pageSize, reports.length, source]);
|
|
4509
|
-
|
|
4510
|
-
client.fetch(
|
|
4511
|
-
client.fetch(
|
|
4174
|
+
useEffect4(() => {
|
|
4175
|
+
client.fetch(distinctModesQuery).then((data) => setModes((data ?? []).sort())).catch(() => setModes([]));
|
|
4176
|
+
client.fetch(distinctSourcesQuery).then((data) => setSources((data ?? []).sort())).catch(() => setSources([]));
|
|
4177
|
+
client.fetch(distinctTriggersQuery).then((data) => setTriggers((data ?? []).sort())).catch(() => setTriggers([]));
|
|
4512
4178
|
}, [client]);
|
|
4513
|
-
const
|
|
4514
|
-
const result = { models: [], areas: [], datePreset: null };
|
|
4515
|
-
for (const token of filterTokens) {
|
|
4516
|
-
switch (token.dimension) {
|
|
4517
|
-
case "model":
|
|
4518
|
-
result.models.push(token.value);
|
|
4519
|
-
break;
|
|
4520
|
-
case "area":
|
|
4521
|
-
result.areas.push(token.value);
|
|
4522
|
-
break;
|
|
4523
|
-
case "date":
|
|
4524
|
-
result.datePreset = token.value;
|
|
4525
|
-
break;
|
|
4526
|
-
}
|
|
4527
|
-
}
|
|
4528
|
-
return result;
|
|
4529
|
-
}, [filterTokens]);
|
|
4530
|
-
const filteredReports = useMemo5(() => {
|
|
4179
|
+
const filteredReports = useMemo4(() => {
|
|
4531
4180
|
let result = reports;
|
|
4181
|
+
if (trigger) {
|
|
4182
|
+
result = result.filter((r) => r.trigger === trigger);
|
|
4183
|
+
}
|
|
4532
4184
|
if (searchQuery.trim()) {
|
|
4533
4185
|
const query = searchQuery.toLowerCase().trim();
|
|
4534
4186
|
result = result.filter((r) => {
|
|
@@ -4538,48 +4190,19 @@ function LatestReports({
|
|
|
4538
4190
|
r.source,
|
|
4539
4191
|
r.trigger,
|
|
4540
4192
|
...r.models,
|
|
4541
|
-
...r.areas ?? []
|
|
4542
|
-
formatDate(r.completedAt)
|
|
4193
|
+
...r.areas ?? []
|
|
4543
4194
|
].filter(Boolean).join(" ").toLowerCase();
|
|
4544
4195
|
return searchable.includes(query);
|
|
4545
4196
|
});
|
|
4546
4197
|
}
|
|
4547
|
-
if (activeFilters.datePreset) {
|
|
4548
|
-
const threshold = getDateThreshold(activeFilters.datePreset);
|
|
4549
|
-
if (threshold) {
|
|
4550
|
-
const thresholdMs = threshold.getTime();
|
|
4551
|
-
result = result.filter(
|
|
4552
|
-
(r) => new Date(r.completedAt).getTime() >= thresholdMs
|
|
4553
|
-
);
|
|
4554
|
-
}
|
|
4555
|
-
}
|
|
4556
|
-
if (activeFilters.models.length > 0) {
|
|
4557
|
-
result = result.filter(
|
|
4558
|
-
(r) => activeFilters.models.some((m) => r.models.includes(m))
|
|
4559
|
-
);
|
|
4560
|
-
}
|
|
4561
|
-
if (activeFilters.areas.length > 0) {
|
|
4562
|
-
result = result.filter(
|
|
4563
|
-
(r) => r.areas && activeFilters.areas.some((a) => r.areas.includes(a))
|
|
4564
|
-
);
|
|
4565
|
-
}
|
|
4566
|
-
if (documentSlug.trim()) {
|
|
4567
|
-
const slug = documentSlug.trim().toLowerCase();
|
|
4568
|
-
result = result.filter(
|
|
4569
|
-
(r) => r.targetDocuments && r.targetDocuments.some((d) => d.toLowerCase().includes(slug))
|
|
4570
|
-
);
|
|
4571
|
-
}
|
|
4572
|
-
if (perspective.trim()) {
|
|
4573
|
-
result = result.filter((r) => r.perspective === perspective.trim());
|
|
4574
|
-
}
|
|
4575
4198
|
const dir = sort.direction === "asc" ? 1 : -1;
|
|
4576
4199
|
result = [...result].sort((a, b) => {
|
|
4577
4200
|
switch (sort.field) {
|
|
4578
4201
|
case "date":
|
|
4579
4202
|
return dir * (new Date(a.completedAt).getTime() - new Date(b.completedAt).getTime());
|
|
4580
4203
|
case "name": {
|
|
4581
|
-
const nameA = (a.tag ??
|
|
4582
|
-
const nameB = (b.tag ??
|
|
4204
|
+
const nameA = (a.tag ?? a.completedAt).toLowerCase();
|
|
4205
|
+
const nameB = (b.tag ?? b.completedAt).toLowerCase();
|
|
4583
4206
|
return dir * nameA.localeCompare(nameB);
|
|
4584
4207
|
}
|
|
4585
4208
|
case "score":
|
|
@@ -4589,182 +4212,65 @@ function LatestReports({
|
|
|
4589
4212
|
}
|
|
4590
4213
|
});
|
|
4591
4214
|
return result;
|
|
4592
|
-
}, [reports, searchQuery,
|
|
4593
|
-
const
|
|
4594
|
-
setFilterTokens((prev) => {
|
|
4595
|
-
const dim = token.dimension;
|
|
4596
|
-
const isMulti = dim === "area";
|
|
4597
|
-
if (!isMulti) {
|
|
4598
|
-
return [...prev.filter((t) => t.dimension !== dim), token];
|
|
4599
|
-
}
|
|
4600
|
-
return [...prev, token];
|
|
4601
|
-
});
|
|
4602
|
-
}, []);
|
|
4603
|
-
const handleTokenRemove = useCallback12((id) => {
|
|
4604
|
-
setFilterTokens((prev) => prev.filter((t) => t.id !== id));
|
|
4605
|
-
}, []);
|
|
4606
|
-
const toggleSortDirection = useCallback12(() => {
|
|
4607
|
-
setSort((prev) => ({
|
|
4608
|
-
...prev,
|
|
4609
|
-
direction: prev.direction === "asc" ? "desc" : "asc"
|
|
4610
|
-
}));
|
|
4611
|
-
}, []);
|
|
4612
|
-
const handleSortFieldChange = useCallback12((field) => {
|
|
4215
|
+
}, [reports, searchQuery, trigger, sort]);
|
|
4216
|
+
const handleSortFieldChange = useCallback9((field) => {
|
|
4613
4217
|
setSort(
|
|
4614
4218
|
(prev) => prev.field === field ? { ...prev, direction: prev.direction === "asc" ? "desc" : "asc" } : { direction: "desc", field }
|
|
4615
4219
|
);
|
|
4616
4220
|
}, []);
|
|
4617
|
-
const
|
|
4618
|
-
const handleClearFilters = useCallback12(() => {
|
|
4221
|
+
const handleReset = useCallback9(() => {
|
|
4619
4222
|
setSearchQuery("");
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4223
|
+
setMode(null);
|
|
4224
|
+
setSource(null);
|
|
4225
|
+
setTrigger(null);
|
|
4623
4226
|
}, []);
|
|
4624
4227
|
if (initialLoading) {
|
|
4625
|
-
return /* @__PURE__ */
|
|
4228
|
+
return /* @__PURE__ */ jsx16(Card7, { padding: 4, children: /* @__PURE__ */ jsx16(Text14, { muted: true, children: "Loading reports\u2026" }) });
|
|
4626
4229
|
}
|
|
4627
|
-
if (reports.length === 0) {
|
|
4628
|
-
return /* @__PURE__ */
|
|
4230
|
+
if (reports.length === 0 && !mode && !source) {
|
|
4231
|
+
return /* @__PURE__ */ jsx16(Card7, { padding: 4, children: /* @__PURE__ */ jsx16(Text14, { muted: true, children: "No reports found. Run the pipeline with --publish to create reports." }) });
|
|
4629
4232
|
}
|
|
4630
|
-
return /* @__PURE__ */
|
|
4631
|
-
/* @__PURE__ */
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
onChange: setDocumentSlug,
|
|
4654
|
-
onPerspectiveHint: setPerspective,
|
|
4655
|
-
value: documentSlug
|
|
4656
|
-
}
|
|
4657
|
-
)
|
|
4658
|
-
] }) }),
|
|
4659
|
-
/* @__PURE__ */ jsx26(Box8, { flex: 1, children: /* @__PURE__ */ jsxs21(Stack13, { space: 1, children: [
|
|
4660
|
-
/* @__PURE__ */ jsx26(Text21, { muted: true, size: 1, children: "Content release" }),
|
|
4661
|
-
/* @__PURE__ */ jsx26(
|
|
4662
|
-
PerspectiveFilter,
|
|
4663
|
-
{
|
|
4664
|
-
onChange: setPerspective,
|
|
4665
|
-
value: perspective
|
|
4666
|
-
}
|
|
4667
|
-
)
|
|
4668
|
-
] }) })
|
|
4669
|
-
] }),
|
|
4670
|
-
(documentSlug.trim() || perspective.trim()) && /* @__PURE__ */ jsxs21(Flex17, { align: "center", gap: 1, children: [
|
|
4671
|
-
documentSlug.trim() && /* @__PURE__ */ jsxs21(Badge15, { fontSize: 1, tone: "primary", children: [
|
|
4672
|
-
"Document: ",
|
|
4673
|
-
documentSlug.trim()
|
|
4674
|
-
] }),
|
|
4675
|
-
perspective.trim() && /* @__PURE__ */ jsxs21(Badge15, { fontSize: 1, tone: "primary", children: [
|
|
4676
|
-
"Perspective: ",
|
|
4677
|
-
perspective.trim()
|
|
4678
|
-
] })
|
|
4679
|
-
] })
|
|
4680
|
-
] }) }),
|
|
4681
|
-
/* @__PURE__ */ jsxs21(Flex17, { align: "center", gap: 2, paddingX: 1, wrap: "wrap", children: [
|
|
4682
|
-
/* @__PURE__ */ jsx26(Text21, { muted: true, size: 2, children: filteredReports.length === reports.length ? `${reports.length} reports` : `${filteredReports.length} of ${reports.length} reports` }),
|
|
4683
|
-
hasActiveFilters && /* @__PURE__ */ jsx26(
|
|
4684
|
-
Button,
|
|
4685
|
-
{
|
|
4686
|
-
fontSize: 1,
|
|
4687
|
-
mode: "bleed",
|
|
4688
|
-
onClick: handleClearFilters,
|
|
4689
|
-
text: "Clear all filters",
|
|
4690
|
-
tone: "critical"
|
|
4691
|
-
}
|
|
4692
|
-
),
|
|
4693
|
-
/* @__PURE__ */ jsxs21(Flex17, { align: "center", gap: 1, style: { marginLeft: "auto" }, children: [
|
|
4694
|
-
/* @__PURE__ */ jsx26(
|
|
4695
|
-
MenuButton,
|
|
4696
|
-
{
|
|
4697
|
-
button: /* @__PURE__ */ jsx26(
|
|
4698
|
-
Button,
|
|
4699
|
-
{
|
|
4700
|
-
fontSize: 2,
|
|
4701
|
-
icon: SortIcon,
|
|
4702
|
-
mode: "bleed",
|
|
4703
|
-
text: `Sort: ${SORT_LABELS[sort.field]}`
|
|
4704
|
-
}
|
|
4705
|
-
),
|
|
4706
|
-
id: "sort-menu",
|
|
4707
|
-
menu: /* @__PURE__ */ jsxs21(Menu, { children: [
|
|
4708
|
-
/* @__PURE__ */ jsx26(
|
|
4709
|
-
MenuItem,
|
|
4710
|
-
{
|
|
4711
|
-
onClick: () => handleSortFieldChange("date"),
|
|
4712
|
-
pressed: sort.field === "date",
|
|
4713
|
-
text: "Date"
|
|
4714
|
-
}
|
|
4715
|
-
),
|
|
4716
|
-
/* @__PURE__ */ jsx26(
|
|
4717
|
-
MenuItem,
|
|
4718
|
-
{
|
|
4719
|
-
onClick: () => handleSortFieldChange("score"),
|
|
4720
|
-
pressed: sort.field === "score",
|
|
4721
|
-
text: "Score"
|
|
4722
|
-
}
|
|
4723
|
-
),
|
|
4724
|
-
/* @__PURE__ */ jsx26(
|
|
4725
|
-
MenuItem,
|
|
4726
|
-
{
|
|
4727
|
-
onClick: () => handleSortFieldChange("name"),
|
|
4728
|
-
pressed: sort.field === "name",
|
|
4729
|
-
text: "Name"
|
|
4730
|
-
}
|
|
4731
|
-
)
|
|
4732
|
-
] }),
|
|
4733
|
-
popover: { portal: true }
|
|
4734
|
-
}
|
|
4735
|
-
),
|
|
4736
|
-
/* @__PURE__ */ jsx26(
|
|
4737
|
-
Button,
|
|
4738
|
-
{
|
|
4739
|
-
fontSize: 2,
|
|
4740
|
-
mode: "bleed",
|
|
4741
|
-
onClick: toggleSortDirection,
|
|
4742
|
-
text: sort.direction === "asc" ? "\u2191" : "\u2193",
|
|
4743
|
-
title: sort.direction === "asc" ? "Ascending" : "Descending"
|
|
4744
|
-
}
|
|
4745
|
-
)
|
|
4746
|
-
] })
|
|
4747
|
-
] }),
|
|
4748
|
-
filteredReports.length === 0 ? /* @__PURE__ */ jsx26(Card12, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs21(Stack13, { space: 3, children: [
|
|
4749
|
-
/* @__PURE__ */ jsx26(Text21, { align: "center", muted: true, size: 3, children: "No reports match the current filters." }),
|
|
4750
|
-
/* @__PURE__ */ jsx26(Flex17, { justify: "center", children: /* @__PURE__ */ jsx26(
|
|
4233
|
+
return /* @__PURE__ */ jsxs13(Stack10, { space: 0, children: [
|
|
4234
|
+
/* @__PURE__ */ jsx16(
|
|
4235
|
+
FilterBar,
|
|
4236
|
+
{
|
|
4237
|
+
filteredCount: filteredReports.length,
|
|
4238
|
+
mode,
|
|
4239
|
+
modes,
|
|
4240
|
+
onModeChange: setMode,
|
|
4241
|
+
onQueryChange: setSearchQuery,
|
|
4242
|
+
onReset: handleReset,
|
|
4243
|
+
onSourceChange: setSource,
|
|
4244
|
+
onTriggerChange: setTrigger,
|
|
4245
|
+
query: searchQuery,
|
|
4246
|
+
source,
|
|
4247
|
+
sources,
|
|
4248
|
+
totalCount: reports.length,
|
|
4249
|
+
trigger,
|
|
4250
|
+
triggers
|
|
4251
|
+
}
|
|
4252
|
+
),
|
|
4253
|
+
filteredReports.length === 0 ? /* @__PURE__ */ jsx16(Card7, { padding: 4, radius: 2, children: /* @__PURE__ */ jsxs13(Stack10, { space: 3, children: [
|
|
4254
|
+
/* @__PURE__ */ jsx16(Text14, { align: "center", muted: true, size: 3, children: "No reports match the current filters." }),
|
|
4255
|
+
/* @__PURE__ */ jsx16(Flex10, { justify: "center", children: /* @__PURE__ */ jsx16(
|
|
4751
4256
|
Button,
|
|
4752
4257
|
{
|
|
4753
4258
|
fontSize: 2,
|
|
4754
4259
|
mode: "ghost",
|
|
4755
|
-
onClick:
|
|
4756
|
-
text: "Clear
|
|
4260
|
+
onClick: handleReset,
|
|
4261
|
+
text: "Clear filters"
|
|
4757
4262
|
}
|
|
4758
4263
|
) })
|
|
4759
|
-
] }) }) : /* @__PURE__ */
|
|
4760
|
-
|
|
4264
|
+
] }) }) : /* @__PURE__ */ jsx16(
|
|
4265
|
+
ReportTable,
|
|
4761
4266
|
{
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4267
|
+
onSelectReport,
|
|
4268
|
+
onSortChange: handleSortFieldChange,
|
|
4269
|
+
reports: filteredReports,
|
|
4270
|
+
sort
|
|
4271
|
+
}
|
|
4272
|
+
),
|
|
4273
|
+
hasMore && /* @__PURE__ */ jsx16(Flex10, { justify: "center", paddingY: 3, children: /* @__PURE__ */ jsx16(
|
|
4768
4274
|
Button,
|
|
4769
4275
|
{
|
|
4770
4276
|
disabled: loadingMore,
|
|
@@ -4776,79 +4282,46 @@ function LatestReports({
|
|
|
4776
4282
|
) })
|
|
4777
4283
|
] });
|
|
4778
4284
|
}
|
|
4779
|
-
function formatDate(iso) {
|
|
4780
|
-
return new Date(iso).toLocaleDateString("en-US", {
|
|
4781
|
-
day: "numeric",
|
|
4782
|
-
hour: "2-digit",
|
|
4783
|
-
minute: "2-digit",
|
|
4784
|
-
month: "short",
|
|
4785
|
-
year: "numeric"
|
|
4786
|
-
});
|
|
4787
|
-
}
|
|
4788
|
-
function getDateThreshold(preset) {
|
|
4789
|
-
const now = /* @__PURE__ */ new Date();
|
|
4790
|
-
switch (preset) {
|
|
4791
|
-
case "7d":
|
|
4792
|
-
return new Date(now.getTime() - 7 * 864e5);
|
|
4793
|
-
case "30d":
|
|
4794
|
-
return new Date(now.getTime() - 30 * 864e5);
|
|
4795
|
-
case "90d":
|
|
4796
|
-
return new Date(now.getTime() - 90 * 864e5);
|
|
4797
|
-
case "today": {
|
|
4798
|
-
const start = new Date(now);
|
|
4799
|
-
start.setHours(0, 0, 0, 0);
|
|
4800
|
-
return start;
|
|
4801
|
-
}
|
|
4802
|
-
case "yesterday": {
|
|
4803
|
-
const start = new Date(now);
|
|
4804
|
-
start.setDate(start.getDate() - 1);
|
|
4805
|
-
start.setHours(0, 0, 0, 0);
|
|
4806
|
-
return start;
|
|
4807
|
-
}
|
|
4808
|
-
default:
|
|
4809
|
-
return null;
|
|
4810
|
-
}
|
|
4811
|
-
}
|
|
4812
4285
|
|
|
4813
4286
|
// src/components/report-detail/ReportDetail.tsx
|
|
4814
4287
|
import { ArrowLeftIcon as ArrowLeftIcon2 } from "@sanity/icons";
|
|
4815
4288
|
import {
|
|
4816
|
-
Box as
|
|
4289
|
+
Box as Box14,
|
|
4817
4290
|
Button as Button5,
|
|
4818
|
-
Stack as
|
|
4291
|
+
Stack as Stack22,
|
|
4819
4292
|
Tab,
|
|
4820
4293
|
TabList,
|
|
4821
4294
|
TabPanel,
|
|
4822
|
-
Text as
|
|
4295
|
+
Text as Text27,
|
|
4823
4296
|
Tooltip as Tooltip8
|
|
4824
4297
|
} from "@sanity/ui";
|
|
4825
4298
|
import {
|
|
4826
|
-
useCallback as
|
|
4827
|
-
useEffect as
|
|
4828
|
-
useMemo as
|
|
4829
|
-
useState as
|
|
4299
|
+
useCallback as useCallback17,
|
|
4300
|
+
useEffect as useEffect6,
|
|
4301
|
+
useMemo as useMemo6,
|
|
4302
|
+
useState as useState12
|
|
4830
4303
|
} from "react";
|
|
4831
|
-
import { useClient as
|
|
4304
|
+
import { useClient as useClient10 } from "sanity";
|
|
4832
4305
|
|
|
4833
4306
|
// src/components/report-detail/AgentActivitySection.tsx
|
|
4834
|
-
import { useMemo as
|
|
4835
|
-
import { HelpCircleIcon as HelpCircleIcon5, SearchIcon as
|
|
4307
|
+
import { useMemo as useMemo5, useState as useState5 } from "react";
|
|
4308
|
+
import { HelpCircleIcon as HelpCircleIcon5, SearchIcon as SearchIcon3 } from "@sanity/icons";
|
|
4836
4309
|
import {
|
|
4837
|
-
Badge as
|
|
4838
|
-
Box as
|
|
4839
|
-
Card as
|
|
4840
|
-
Flex as
|
|
4310
|
+
Badge as Badge5,
|
|
4311
|
+
Box as Box9,
|
|
4312
|
+
Card as Card9,
|
|
4313
|
+
Flex as Flex11,
|
|
4841
4314
|
Grid as Grid2,
|
|
4842
|
-
Stack as
|
|
4843
|
-
Text as
|
|
4844
|
-
TextInput,
|
|
4315
|
+
Stack as Stack12,
|
|
4316
|
+
Text as Text16,
|
|
4317
|
+
TextInput as TextInput2,
|
|
4845
4318
|
Tooltip as Tooltip4
|
|
4846
4319
|
} from "@sanity/ui";
|
|
4847
4320
|
|
|
4848
4321
|
// src/components/primitives/StatCard.tsx
|
|
4849
4322
|
import { HelpCircleIcon as HelpCircleIcon4 } from "@sanity/icons";
|
|
4850
|
-
import { Box as
|
|
4851
|
-
import { Fragment as
|
|
4323
|
+
import { Box as Box8, Card as Card8, Stack as Stack11, Text as Text15, Tooltip as Tooltip3 } from "@sanity/ui";
|
|
4324
|
+
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4852
4325
|
function StatCard({
|
|
4853
4326
|
label,
|
|
4854
4327
|
value,
|
|
@@ -4856,24 +4329,24 @@ function StatCard({
|
|
|
4856
4329
|
suffix,
|
|
4857
4330
|
tone = "default"
|
|
4858
4331
|
}) {
|
|
4859
|
-
return /* @__PURE__ */
|
|
4860
|
-
/* @__PURE__ */
|
|
4332
|
+
return /* @__PURE__ */ jsx17(Card8, { padding: 3, radius: 2, shadow: 1, tone, children: /* @__PURE__ */ jsxs14(Stack11, { space: 2, children: [
|
|
4333
|
+
/* @__PURE__ */ jsxs14(Text15, { muted: true, size: 2, children: [
|
|
4861
4334
|
label,
|
|
4862
|
-
tooltip && /* @__PURE__ */
|
|
4335
|
+
tooltip && /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
4863
4336
|
" ",
|
|
4864
|
-
/* @__PURE__ */
|
|
4337
|
+
/* @__PURE__ */ jsx17(
|
|
4865
4338
|
Tooltip3,
|
|
4866
4339
|
{
|
|
4867
|
-
content: /* @__PURE__ */
|
|
4340
|
+
content: /* @__PURE__ */ jsx17(Box8, { padding: 2, children: /* @__PURE__ */ jsx17(Text15, { size: 2, children: tooltip }) }),
|
|
4868
4341
|
portal: true,
|
|
4869
|
-
children: /* @__PURE__ */
|
|
4342
|
+
children: /* @__PURE__ */ jsx17("span", { style: { cursor: "help" }, children: /* @__PURE__ */ jsx17(HelpCircleIcon4, {}) })
|
|
4870
4343
|
}
|
|
4871
4344
|
)
|
|
4872
4345
|
] })
|
|
4873
4346
|
] }),
|
|
4874
|
-
/* @__PURE__ */
|
|
4347
|
+
/* @__PURE__ */ jsxs14(Text15, { size: 4, weight: "bold", children: [
|
|
4875
4348
|
value,
|
|
4876
|
-
suffix && /* @__PURE__ */
|
|
4349
|
+
suffix && /* @__PURE__ */ jsxs14("span", { style: { fontSize: "0.6em", fontWeight: 400 }, children: [
|
|
4877
4350
|
" ",
|
|
4878
4351
|
suffix
|
|
4879
4352
|
] })
|
|
@@ -4882,24 +4355,24 @@ function StatCard({
|
|
|
4882
4355
|
}
|
|
4883
4356
|
|
|
4884
4357
|
// src/components/report-detail/AgentActivitySection.tsx
|
|
4885
|
-
import { jsx as
|
|
4358
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4886
4359
|
function AgentActivitySection({
|
|
4887
4360
|
agentBehavior,
|
|
4888
4361
|
overall
|
|
4889
4362
|
}) {
|
|
4890
|
-
return /* @__PURE__ */
|
|
4891
|
-
overall && /* @__PURE__ */
|
|
4892
|
-
agentBehavior.map((ab) => /* @__PURE__ */
|
|
4363
|
+
return /* @__PURE__ */ jsxs15(Stack12, { space: 5, children: [
|
|
4364
|
+
overall && /* @__PURE__ */ jsx18(OverviewGrid, { overall }),
|
|
4365
|
+
agentBehavior.map((ab) => /* @__PURE__ */ jsx18(FeatureActivityCard, { behavior: ab }, ab.feature))
|
|
4893
4366
|
] });
|
|
4894
4367
|
}
|
|
4895
4368
|
function OverviewGrid({ overall }) {
|
|
4896
|
-
return /* @__PURE__ */
|
|
4897
|
-
/* @__PURE__ */
|
|
4898
|
-
/* @__PURE__ */
|
|
4899
|
-
/* @__PURE__ */
|
|
4369
|
+
return /* @__PURE__ */ jsx18(Card9, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs15(Stack12, { space: 4, children: [
|
|
4370
|
+
/* @__PURE__ */ jsxs15(Flex11, { align: "center", gap: 3, children: [
|
|
4371
|
+
/* @__PURE__ */ jsx18(Text16, { size: 3, weight: "semibold", children: "Agent Activity Overview" }),
|
|
4372
|
+
/* @__PURE__ */ jsx18(GlossaryTip, { text: GLOSSARY.agentBehaviorOverview })
|
|
4900
4373
|
] }),
|
|
4901
|
-
/* @__PURE__ */
|
|
4902
|
-
/* @__PURE__ */
|
|
4374
|
+
/* @__PURE__ */ jsxs15(Grid2, { columns: [1, 2, 3], gap: 3, children: [
|
|
4375
|
+
/* @__PURE__ */ jsx18(
|
|
4903
4376
|
StatCard,
|
|
4904
4377
|
{
|
|
4905
4378
|
label: "Avg Pages Visited",
|
|
@@ -4907,7 +4380,7 @@ function OverviewGrid({ overall }) {
|
|
|
4907
4380
|
value: overall.avgDocPagesVisited.toFixed(1)
|
|
4908
4381
|
}
|
|
4909
4382
|
),
|
|
4910
|
-
/* @__PURE__ */
|
|
4383
|
+
/* @__PURE__ */ jsx18(
|
|
4911
4384
|
StatCard,
|
|
4912
4385
|
{
|
|
4913
4386
|
label: "Avg Searches",
|
|
@@ -4915,7 +4388,7 @@ function OverviewGrid({ overall }) {
|
|
|
4915
4388
|
value: overall.avgSearchesPerformed.toFixed(1)
|
|
4916
4389
|
}
|
|
4917
4390
|
),
|
|
4918
|
-
/* @__PURE__ */
|
|
4391
|
+
/* @__PURE__ */ jsx18(
|
|
4919
4392
|
StatCard,
|
|
4920
4393
|
{
|
|
4921
4394
|
label: "Avg Network Time",
|
|
@@ -4923,7 +4396,7 @@ function OverviewGrid({ overall }) {
|
|
|
4923
4396
|
value: formatDuration(overall.avgNetworkTimeMs)
|
|
4924
4397
|
}
|
|
4925
4398
|
),
|
|
4926
|
-
/* @__PURE__ */
|
|
4399
|
+
/* @__PURE__ */ jsx18(
|
|
4927
4400
|
StatCard,
|
|
4928
4401
|
{
|
|
4929
4402
|
label: "Unique Doc Slugs",
|
|
@@ -4931,7 +4404,7 @@ function OverviewGrid({ overall }) {
|
|
|
4931
4404
|
value: String(overall.totalUniqueDocSlugs)
|
|
4932
4405
|
}
|
|
4933
4406
|
),
|
|
4934
|
-
/* @__PURE__ */
|
|
4407
|
+
/* @__PURE__ */ jsx18(
|
|
4935
4408
|
StatCard,
|
|
4936
4409
|
{
|
|
4937
4410
|
label: "Unique Search Queries",
|
|
@@ -4939,7 +4412,7 @@ function OverviewGrid({ overall }) {
|
|
|
4939
4412
|
value: String(overall.totalUniqueSearchQueries)
|
|
4940
4413
|
}
|
|
4941
4414
|
),
|
|
4942
|
-
/* @__PURE__ */
|
|
4415
|
+
/* @__PURE__ */ jsx18(
|
|
4943
4416
|
StatCard,
|
|
4944
4417
|
{
|
|
4945
4418
|
label: "Tests with Data",
|
|
@@ -4952,31 +4425,31 @@ function OverviewGrid({ overall }) {
|
|
|
4952
4425
|
function FeatureActivityCard({
|
|
4953
4426
|
behavior
|
|
4954
4427
|
}) {
|
|
4955
|
-
return /* @__PURE__ */
|
|
4956
|
-
/* @__PURE__ */
|
|
4957
|
-
/* @__PURE__ */
|
|
4958
|
-
/* @__PURE__ */
|
|
4428
|
+
return /* @__PURE__ */ jsx18(Card9, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs15(Stack12, { space: 4, children: [
|
|
4429
|
+
/* @__PURE__ */ jsxs15(Flex11, { align: "center", gap: 3, wrap: "wrap", children: [
|
|
4430
|
+
/* @__PURE__ */ jsx18(Text16, { size: 3, weight: "semibold", children: behavior.feature }),
|
|
4431
|
+
/* @__PURE__ */ jsxs15(Badge5, { tone: "primary", children: [
|
|
4959
4432
|
behavior.tasksWithBehaviorData,
|
|
4960
4433
|
" test",
|
|
4961
4434
|
behavior.tasksWithBehaviorData === 1 ? "" : "s"
|
|
4962
4435
|
] })
|
|
4963
4436
|
] }),
|
|
4964
|
-
/* @__PURE__ */
|
|
4965
|
-
/* @__PURE__ */
|
|
4437
|
+
/* @__PURE__ */ jsxs15(Grid2, { columns: [1, 3], gap: 3, children: [
|
|
4438
|
+
/* @__PURE__ */ jsx18(
|
|
4966
4439
|
MiniStat,
|
|
4967
4440
|
{
|
|
4968
4441
|
label: "Avg pages visited",
|
|
4969
4442
|
value: behavior.avgDocPagesVisited.toFixed(1)
|
|
4970
4443
|
}
|
|
4971
4444
|
),
|
|
4972
|
-
/* @__PURE__ */
|
|
4445
|
+
/* @__PURE__ */ jsx18(
|
|
4973
4446
|
MiniStat,
|
|
4974
4447
|
{
|
|
4975
4448
|
label: "Avg searches",
|
|
4976
4449
|
value: behavior.avgSearchesPerformed.toFixed(1)
|
|
4977
4450
|
}
|
|
4978
4451
|
),
|
|
4979
|
-
/* @__PURE__ */
|
|
4452
|
+
/* @__PURE__ */ jsx18(
|
|
4980
4453
|
MiniStat,
|
|
4981
4454
|
{
|
|
4982
4455
|
label: "Avg network time",
|
|
@@ -4984,8 +4457,8 @@ function FeatureActivityCard({
|
|
|
4984
4457
|
}
|
|
4985
4458
|
)
|
|
4986
4459
|
] }),
|
|
4987
|
-
behavior.searchQueries.length > 0 && /* @__PURE__ */
|
|
4988
|
-
behavior.docSlugsVisited.length > 0 && /* @__PURE__ */
|
|
4460
|
+
behavior.searchQueries.length > 0 && /* @__PURE__ */ jsx18(SearchQueryList, { queries: behavior.searchQueries }),
|
|
4461
|
+
behavior.docSlugsVisited.length > 0 && /* @__PURE__ */ jsx18(
|
|
4989
4462
|
BadgeList,
|
|
4990
4463
|
{
|
|
4991
4464
|
items: behavior.docSlugsVisited,
|
|
@@ -4994,7 +4467,7 @@ function FeatureActivityCard({
|
|
|
4994
4467
|
tooltip: GLOSSARY.docSlugsVisited
|
|
4995
4468
|
}
|
|
4996
4469
|
),
|
|
4997
|
-
behavior.externalDomains.length > 0 && /* @__PURE__ */
|
|
4470
|
+
behavior.externalDomains.length > 0 && /* @__PURE__ */ jsx18(
|
|
4998
4471
|
BadgeList,
|
|
4999
4472
|
{
|
|
5000
4473
|
items: behavior.externalDomains,
|
|
@@ -5006,40 +4479,40 @@ function FeatureActivityCard({
|
|
|
5006
4479
|
] }) });
|
|
5007
4480
|
}
|
|
5008
4481
|
function SearchQueryList({ queries }) {
|
|
5009
|
-
const [filter, setFilter] =
|
|
5010
|
-
const filtered =
|
|
4482
|
+
const [filter, setFilter] = useState5("");
|
|
4483
|
+
const filtered = useMemo5(() => {
|
|
5011
4484
|
if (!filter) return queries;
|
|
5012
4485
|
const lower = filter.toLowerCase();
|
|
5013
4486
|
return queries.filter((q) => q.toLowerCase().includes(lower));
|
|
5014
4487
|
}, [queries, filter]);
|
|
5015
|
-
return /* @__PURE__ */
|
|
5016
|
-
/* @__PURE__ */
|
|
5017
|
-
/* @__PURE__ */
|
|
5018
|
-
/* @__PURE__ */
|
|
5019
|
-
/* @__PURE__ */
|
|
4488
|
+
return /* @__PURE__ */ jsxs15(Stack12, { space: 3, children: [
|
|
4489
|
+
/* @__PURE__ */ jsxs15(Flex11, { align: "center", gap: 3, wrap: "wrap", children: [
|
|
4490
|
+
/* @__PURE__ */ jsx18(Text16, { size: 2, weight: "semibold", children: "Search Queries" }),
|
|
4491
|
+
/* @__PURE__ */ jsx18(GlossaryTip, { text: GLOSSARY.searchQueries }),
|
|
4492
|
+
/* @__PURE__ */ jsx18(Badge5, { tone: "default", children: queries.length })
|
|
5020
4493
|
] }),
|
|
5021
|
-
queries.length > 5 && /* @__PURE__ */
|
|
5022
|
-
|
|
4494
|
+
queries.length > 5 && /* @__PURE__ */ jsx18(
|
|
4495
|
+
TextInput2,
|
|
5023
4496
|
{
|
|
5024
4497
|
fontSize: 2,
|
|
5025
|
-
icon:
|
|
4498
|
+
icon: SearchIcon3,
|
|
5026
4499
|
onChange: (e) => setFilter(e.target.value),
|
|
5027
4500
|
placeholder: "Filter queries\u2026",
|
|
5028
4501
|
value: filter
|
|
5029
4502
|
}
|
|
5030
4503
|
),
|
|
5031
|
-
/* @__PURE__ */
|
|
5032
|
-
|
|
4504
|
+
/* @__PURE__ */ jsx18(
|
|
4505
|
+
Card9,
|
|
5033
4506
|
{
|
|
5034
4507
|
overflow: "auto",
|
|
5035
4508
|
padding: 3,
|
|
5036
4509
|
radius: 2,
|
|
5037
4510
|
style: { maxHeight: 300 },
|
|
5038
4511
|
tone: "transparent",
|
|
5039
|
-
children: /* @__PURE__ */
|
|
5040
|
-
filtered.length === 0 && /* @__PURE__ */
|
|
5041
|
-
filtered.map((query, i) => /* @__PURE__ */
|
|
5042
|
-
|
|
4512
|
+
children: /* @__PURE__ */ jsxs15(Stack12, { space: 2, children: [
|
|
4513
|
+
filtered.length === 0 && /* @__PURE__ */ jsx18(Text16, { muted: true, size: 2, children: "No matching queries" }),
|
|
4514
|
+
filtered.map((query, i) => /* @__PURE__ */ jsx18(
|
|
4515
|
+
Text16,
|
|
5043
4516
|
{
|
|
5044
4517
|
muted: true,
|
|
5045
4518
|
size: 2,
|
|
@@ -5063,19 +4536,19 @@ function BadgeList({
|
|
|
5063
4536
|
tone,
|
|
5064
4537
|
tooltip
|
|
5065
4538
|
}) {
|
|
5066
|
-
return /* @__PURE__ */
|
|
5067
|
-
/* @__PURE__ */
|
|
5068
|
-
/* @__PURE__ */
|
|
5069
|
-
tooltip && /* @__PURE__ */
|
|
5070
|
-
/* @__PURE__ */
|
|
4539
|
+
return /* @__PURE__ */ jsxs15(Stack12, { space: 3, children: [
|
|
4540
|
+
/* @__PURE__ */ jsxs15(Flex11, { align: "center", gap: 3, wrap: "wrap", children: [
|
|
4541
|
+
/* @__PURE__ */ jsx18(Text16, { size: 2, weight: "semibold", children: label }),
|
|
4542
|
+
tooltip && /* @__PURE__ */ jsx18(GlossaryTip, { text: tooltip }),
|
|
4543
|
+
/* @__PURE__ */ jsx18(Badge5, { tone: "default", children: items.length })
|
|
5071
4544
|
] }),
|
|
5072
|
-
/* @__PURE__ */
|
|
4545
|
+
/* @__PURE__ */ jsx18(Flex11, { gap: 2, wrap: "wrap", children: items.map((item) => /* @__PURE__ */ jsx18(Badge5, { mode: "outline", tone, children: item }, item)) })
|
|
5073
4546
|
] });
|
|
5074
4547
|
}
|
|
5075
4548
|
function MiniStat({ label, value }) {
|
|
5076
|
-
return /* @__PURE__ */
|
|
5077
|
-
/* @__PURE__ */
|
|
5078
|
-
|
|
4549
|
+
return /* @__PURE__ */ jsxs15(Stack12, { space: 1, children: [
|
|
4550
|
+
/* @__PURE__ */ jsx18(
|
|
4551
|
+
Text16,
|
|
5079
4552
|
{
|
|
5080
4553
|
muted: true,
|
|
5081
4554
|
size: 1,
|
|
@@ -5084,32 +4557,61 @@ function MiniStat({ label, value }) {
|
|
|
5084
4557
|
children: label
|
|
5085
4558
|
}
|
|
5086
4559
|
),
|
|
5087
|
-
/* @__PURE__ */
|
|
4560
|
+
/* @__PURE__ */ jsx18(Text16, { size: 3, weight: "bold", children: value })
|
|
5088
4561
|
] });
|
|
5089
4562
|
}
|
|
5090
4563
|
function GlossaryTip({ text }) {
|
|
5091
|
-
return /* @__PURE__ */
|
|
4564
|
+
return /* @__PURE__ */ jsx18(
|
|
5092
4565
|
Tooltip4,
|
|
5093
4566
|
{
|
|
5094
|
-
content: /* @__PURE__ */
|
|
4567
|
+
content: /* @__PURE__ */ jsx18(Box9, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx18(Text16, { size: 2, children: text }) }),
|
|
5095
4568
|
placement: "bottom",
|
|
5096
4569
|
portal: true,
|
|
5097
|
-
children: /* @__PURE__ */
|
|
4570
|
+
children: /* @__PURE__ */ jsx18(Text16, { muted: true, size: 1, children: /* @__PURE__ */ jsx18(HelpCircleIcon5, {}) })
|
|
5098
4571
|
}
|
|
5099
4572
|
);
|
|
5100
4573
|
}
|
|
5101
4574
|
|
|
5102
4575
|
// src/components/report-detail/AreaScoreTable.tsx
|
|
5103
4576
|
import React2 from "react";
|
|
5104
|
-
import { Card as
|
|
4577
|
+
import { Card as Card11, Stack as Stack13, Text as Text18 } from "@sanity/ui";
|
|
4578
|
+
|
|
4579
|
+
// src/lib/scoring.ts
|
|
4580
|
+
var TONE_MAP = {
|
|
4581
|
+
good: "positive",
|
|
4582
|
+
warning: "caution",
|
|
4583
|
+
"needs-work": "default",
|
|
4584
|
+
critical: "critical"
|
|
4585
|
+
};
|
|
4586
|
+
function gradeTone(grade) {
|
|
4587
|
+
return TONE_MAP[grade];
|
|
4588
|
+
}
|
|
4589
|
+
function scoreTone(score) {
|
|
4590
|
+
return gradeTone(scoreGrade(Math.round(score)));
|
|
4591
|
+
}
|
|
4592
|
+
var HEX_MAP = {
|
|
4593
|
+
good: "#2ecc71",
|
|
4594
|
+
warning: "#f1c40f",
|
|
4595
|
+
"needs-work": "#e67e22",
|
|
4596
|
+
critical: "#e74c3c"
|
|
4597
|
+
};
|
|
4598
|
+
function gradeHex(grade) {
|
|
4599
|
+
return HEX_MAP[grade];
|
|
4600
|
+
}
|
|
4601
|
+
function scoreHex(score) {
|
|
4602
|
+
return gradeHex(scoreGrade(Math.round(score)));
|
|
4603
|
+
}
|
|
4604
|
+
function rowBackground(index) {
|
|
4605
|
+
return index % 2 === 1 ? "var(--card-muted-bg-color)" : void 0;
|
|
4606
|
+
}
|
|
5105
4607
|
|
|
5106
4608
|
// src/components/primitives/ScoreCell.tsx
|
|
5107
|
-
import { Card as
|
|
5108
|
-
import { jsx as
|
|
4609
|
+
import { Card as Card10, Text as Text17 } from "@sanity/ui";
|
|
4610
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
5109
4611
|
function ScoreCell({ score, size = 2 }) {
|
|
5110
4612
|
const rounded = Math.round(score);
|
|
5111
|
-
return /* @__PURE__ */
|
|
5112
|
-
|
|
4613
|
+
return /* @__PURE__ */ jsx19(
|
|
4614
|
+
Card10,
|
|
5113
4615
|
{
|
|
5114
4616
|
padding: 1,
|
|
5115
4617
|
radius: 2,
|
|
@@ -5120,17 +4622,17 @@ function ScoreCell({ score, size = 2 }) {
|
|
|
5120
4622
|
justifyContent: "center"
|
|
5121
4623
|
},
|
|
5122
4624
|
tone: scoreTone(rounded),
|
|
5123
|
-
children: /* @__PURE__ */
|
|
4625
|
+
children: /* @__PURE__ */ jsx19(Text17, { align: "center", size, weight: "medium", children: rounded })
|
|
5124
4626
|
}
|
|
5125
4627
|
);
|
|
5126
4628
|
}
|
|
5127
4629
|
|
|
5128
4630
|
// src/components/report-detail/AreaScoreTable.tsx
|
|
5129
|
-
import { jsx as
|
|
4631
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5130
4632
|
function AreaScoreTable({ scores }) {
|
|
5131
|
-
return /* @__PURE__ */
|
|
5132
|
-
/* @__PURE__ */
|
|
5133
|
-
/* @__PURE__ */
|
|
4633
|
+
return /* @__PURE__ */ jsx20(Card11, { overflow: "auto", padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs16(Stack13, { space: 4, children: [
|
|
4634
|
+
/* @__PURE__ */ jsx20(Text18, { size: 3, weight: "semibold", children: "Per-Area Scores" }),
|
|
4635
|
+
/* @__PURE__ */ jsxs16(
|
|
5134
4636
|
"div",
|
|
5135
4637
|
{
|
|
5136
4638
|
style: {
|
|
@@ -5139,9 +4641,9 @@ function AreaScoreTable({ scores }) {
|
|
|
5139
4641
|
gridTemplateColumns: "2fr 1fr 1fr 1fr 1fr 1fr 1fr"
|
|
5140
4642
|
},
|
|
5141
4643
|
children: [
|
|
5142
|
-
/* @__PURE__ */
|
|
5143
|
-
/* @__PURE__ */
|
|
5144
|
-
/* @__PURE__ */
|
|
4644
|
+
/* @__PURE__ */ jsx20(ColumnHeader, { borderBottom: true, label: "Area" }),
|
|
4645
|
+
/* @__PURE__ */ jsx20(ColumnHeader, { borderBottom: true, label: "Score", tooltip: GLOSSARY.score }),
|
|
4646
|
+
/* @__PURE__ */ jsx20(
|
|
5145
4647
|
ColumnHeader,
|
|
5146
4648
|
{
|
|
5147
4649
|
borderBottom: true,
|
|
@@ -5149,7 +4651,7 @@ function AreaScoreTable({ scores }) {
|
|
|
5149
4651
|
tooltip: GLOSSARY.taskCompletion
|
|
5150
4652
|
}
|
|
5151
4653
|
),
|
|
5152
|
-
/* @__PURE__ */
|
|
4654
|
+
/* @__PURE__ */ jsx20(
|
|
5153
4655
|
ColumnHeader,
|
|
5154
4656
|
{
|
|
5155
4657
|
borderBottom: true,
|
|
@@ -5157,7 +4659,7 @@ function AreaScoreTable({ scores }) {
|
|
|
5157
4659
|
tooltip: GLOSSARY.codeCorrectness
|
|
5158
4660
|
}
|
|
5159
4661
|
),
|
|
5160
|
-
/* @__PURE__ */
|
|
4662
|
+
/* @__PURE__ */ jsx20(
|
|
5161
4663
|
ColumnHeader,
|
|
5162
4664
|
{
|
|
5163
4665
|
borderBottom: true,
|
|
@@ -5165,10 +4667,10 @@ function AreaScoreTable({ scores }) {
|
|
|
5165
4667
|
tooltip: GLOSSARY.docCoverage
|
|
5166
4668
|
}
|
|
5167
4669
|
),
|
|
5168
|
-
/* @__PURE__ */
|
|
5169
|
-
/* @__PURE__ */
|
|
5170
|
-
scores.map((score, i) => /* @__PURE__ */
|
|
5171
|
-
/* @__PURE__ */
|
|
4670
|
+
/* @__PURE__ */ jsx20(ColumnHeader, { borderBottom: true, label: "Lift", tooltip: GLOSSARY.docLift }),
|
|
4671
|
+
/* @__PURE__ */ jsx20(ColumnHeader, { borderBottom: true, label: "Tests", tooltip: GLOSSARY.tests }),
|
|
4672
|
+
scores.map((score, i) => /* @__PURE__ */ jsxs16(React2.Fragment, { children: [
|
|
4673
|
+
/* @__PURE__ */ jsx20(
|
|
5172
4674
|
"div",
|
|
5173
4675
|
{
|
|
5174
4676
|
style: {
|
|
@@ -5176,10 +4678,10 @@ function AreaScoreTable({ scores }) {
|
|
|
5176
4678
|
borderRadius: 4,
|
|
5177
4679
|
padding: "8px 0 8px 4px"
|
|
5178
4680
|
},
|
|
5179
|
-
children: /* @__PURE__ */
|
|
4681
|
+
children: /* @__PURE__ */ jsx20(Text18, { size: 2, weight: "medium", children: score.feature })
|
|
5180
4682
|
}
|
|
5181
4683
|
),
|
|
5182
|
-
/* @__PURE__ */
|
|
4684
|
+
/* @__PURE__ */ jsx20(
|
|
5183
4685
|
"div",
|
|
5184
4686
|
{
|
|
5185
4687
|
style: {
|
|
@@ -5187,10 +4689,10 @@ function AreaScoreTable({ scores }) {
|
|
|
5187
4689
|
display: "flex",
|
|
5188
4690
|
padding: "2px 0"
|
|
5189
4691
|
},
|
|
5190
|
-
children: /* @__PURE__ */
|
|
4692
|
+
children: /* @__PURE__ */ jsx20(ScoreCell, { score: score.totalScore })
|
|
5191
4693
|
}
|
|
5192
4694
|
),
|
|
5193
|
-
/* @__PURE__ */
|
|
4695
|
+
/* @__PURE__ */ jsx20(
|
|
5194
4696
|
"div",
|
|
5195
4697
|
{
|
|
5196
4698
|
style: {
|
|
@@ -5198,10 +4700,10 @@ function AreaScoreTable({ scores }) {
|
|
|
5198
4700
|
display: "flex",
|
|
5199
4701
|
padding: "2px 0"
|
|
5200
4702
|
},
|
|
5201
|
-
children: /* @__PURE__ */
|
|
4703
|
+
children: /* @__PURE__ */ jsx20(ScoreCell, { score: score.taskCompletion })
|
|
5202
4704
|
}
|
|
5203
4705
|
),
|
|
5204
|
-
/* @__PURE__ */
|
|
4706
|
+
/* @__PURE__ */ jsx20(
|
|
5205
4707
|
"div",
|
|
5206
4708
|
{
|
|
5207
4709
|
style: {
|
|
@@ -5209,10 +4711,10 @@ function AreaScoreTable({ scores }) {
|
|
|
5209
4711
|
display: "flex",
|
|
5210
4712
|
padding: "2px 0"
|
|
5211
4713
|
},
|
|
5212
|
-
children: /* @__PURE__ */
|
|
4714
|
+
children: /* @__PURE__ */ jsx20(ScoreCell, { score: score.codeCorrectness })
|
|
5213
4715
|
}
|
|
5214
4716
|
),
|
|
5215
|
-
/* @__PURE__ */
|
|
4717
|
+
/* @__PURE__ */ jsx20(
|
|
5216
4718
|
"div",
|
|
5217
4719
|
{
|
|
5218
4720
|
style: {
|
|
@@ -5220,10 +4722,10 @@ function AreaScoreTable({ scores }) {
|
|
|
5220
4722
|
display: "flex",
|
|
5221
4723
|
padding: "2px 0"
|
|
5222
4724
|
},
|
|
5223
|
-
children: /* @__PURE__ */
|
|
4725
|
+
children: /* @__PURE__ */ jsx20(ScoreCell, { score: score.docCoverage })
|
|
5224
4726
|
}
|
|
5225
4727
|
),
|
|
5226
|
-
/* @__PURE__ */
|
|
4728
|
+
/* @__PURE__ */ jsx20(
|
|
5227
4729
|
"div",
|
|
5228
4730
|
{
|
|
5229
4731
|
style: {
|
|
@@ -5231,10 +4733,10 @@ function AreaScoreTable({ scores }) {
|
|
|
5231
4733
|
background: rowBackground(i),
|
|
5232
4734
|
display: "flex"
|
|
5233
4735
|
},
|
|
5234
|
-
children: /* @__PURE__ */
|
|
4736
|
+
children: /* @__PURE__ */ jsx20(Text18, { size: 2, children: formatDelta(score.docLift) })
|
|
5235
4737
|
}
|
|
5236
4738
|
),
|
|
5237
|
-
/* @__PURE__ */
|
|
4739
|
+
/* @__PURE__ */ jsx20(
|
|
5238
4740
|
"div",
|
|
5239
4741
|
{
|
|
5240
4742
|
style: {
|
|
@@ -5242,7 +4744,7 @@ function AreaScoreTable({ scores }) {
|
|
|
5242
4744
|
background: rowBackground(i),
|
|
5243
4745
|
display: "flex"
|
|
5244
4746
|
},
|
|
5245
|
-
children: /* @__PURE__ */
|
|
4747
|
+
children: /* @__PURE__ */ jsx20(Text18, { muted: true, size: 2, children: score.testCount })
|
|
5246
4748
|
}
|
|
5247
4749
|
)
|
|
5248
4750
|
] }, score.feature))
|
|
@@ -5253,13 +4755,13 @@ function AreaScoreTable({ scores }) {
|
|
|
5253
4755
|
}
|
|
5254
4756
|
|
|
5255
4757
|
// src/components/report-detail/ComparisonSummary.tsx
|
|
5256
|
-
import { Badge as
|
|
5257
|
-
import { jsx as
|
|
4758
|
+
import { Badge as Badge6, Box as Box10, Card as Card12, Flex as Flex12, Grid as Grid3, Stack as Stack14, Text as Text19, Tooltip as Tooltip5 } from "@sanity/ui";
|
|
4759
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5258
4760
|
function ComparisonSummary({ comparison }) {
|
|
5259
|
-
return /* @__PURE__ */
|
|
5260
|
-
/* @__PURE__ */
|
|
5261
|
-
/* @__PURE__ */
|
|
5262
|
-
/* @__PURE__ */
|
|
4761
|
+
return /* @__PURE__ */ jsx21(Card12, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs17(Stack14, { space: 4, children: [
|
|
4762
|
+
/* @__PURE__ */ jsxs17(Flex12, { align: "center", gap: 3, wrap: "wrap", children: [
|
|
4763
|
+
/* @__PURE__ */ jsx21(Text19, { size: 3, weight: "semibold", children: "Comparison" }),
|
|
4764
|
+
/* @__PURE__ */ jsx21(
|
|
5263
4765
|
DeltaCard,
|
|
5264
4766
|
{
|
|
5265
4767
|
delta: comparison.deltas.overall,
|
|
@@ -5267,7 +4769,7 @@ function ComparisonSummary({ comparison }) {
|
|
|
5267
4769
|
tooltip: GLOSSARY.overallDelta
|
|
5268
4770
|
}
|
|
5269
4771
|
),
|
|
5270
|
-
comparison.deltas.actualDelta != null && /* @__PURE__ */
|
|
4772
|
+
comparison.deltas.actualDelta != null && /* @__PURE__ */ jsx21(
|
|
5271
4773
|
DeltaCard,
|
|
5272
4774
|
{
|
|
5273
4775
|
delta: comparison.deltas.actualDelta,
|
|
@@ -5275,7 +4777,7 @@ function ComparisonSummary({ comparison }) {
|
|
|
5275
4777
|
tooltip: GLOSSARY.actualDelta
|
|
5276
4778
|
}
|
|
5277
4779
|
),
|
|
5278
|
-
comparison.deltas.retrievalGapDelta != null && /* @__PURE__ */
|
|
4780
|
+
comparison.deltas.retrievalGapDelta != null && /* @__PURE__ */ jsx21(
|
|
5279
4781
|
DeltaCard,
|
|
5280
4782
|
{
|
|
5281
4783
|
delta: comparison.deltas.retrievalGapDelta,
|
|
@@ -5285,8 +4787,8 @@ function ComparisonSummary({ comparison }) {
|
|
|
5285
4787
|
}
|
|
5286
4788
|
)
|
|
5287
4789
|
] }),
|
|
5288
|
-
/* @__PURE__ */
|
|
5289
|
-
comparison.improved.length > 0 && /* @__PURE__ */
|
|
4790
|
+
/* @__PURE__ */ jsxs17(Grid3, { columns: [1, 1, 3], gap: 3, children: [
|
|
4791
|
+
comparison.improved.length > 0 && /* @__PURE__ */ jsx21(
|
|
5290
4792
|
AreaBadgeGroup,
|
|
5291
4793
|
{
|
|
5292
4794
|
areas: comparison.improved,
|
|
@@ -5294,7 +4796,7 @@ function ComparisonSummary({ comparison }) {
|
|
|
5294
4796
|
tone: "positive"
|
|
5295
4797
|
}
|
|
5296
4798
|
),
|
|
5297
|
-
comparison.regressed.length > 0 && /* @__PURE__ */
|
|
4799
|
+
comparison.regressed.length > 0 && /* @__PURE__ */ jsx21(
|
|
5298
4800
|
AreaBadgeGroup,
|
|
5299
4801
|
{
|
|
5300
4802
|
areas: comparison.regressed,
|
|
@@ -5302,7 +4804,7 @@ function ComparisonSummary({ comparison }) {
|
|
|
5302
4804
|
tone: "critical"
|
|
5303
4805
|
}
|
|
5304
4806
|
),
|
|
5305
|
-
comparison.unchanged.length > 0 && /* @__PURE__ */
|
|
4807
|
+
comparison.unchanged.length > 0 && /* @__PURE__ */ jsx21(
|
|
5306
4808
|
AreaBadgeGroup,
|
|
5307
4809
|
{
|
|
5308
4810
|
areas: comparison.unchanged,
|
|
@@ -5321,19 +4823,19 @@ function DeltaCard({
|
|
|
5321
4823
|
}) {
|
|
5322
4824
|
const isPositive = invertedPolarity ? delta < 0 : delta > 0;
|
|
5323
4825
|
const isNegative = invertedPolarity ? delta > 0 : delta < 0;
|
|
5324
|
-
return /* @__PURE__ */
|
|
4826
|
+
return /* @__PURE__ */ jsx21(
|
|
5325
4827
|
Tooltip5,
|
|
5326
4828
|
{
|
|
5327
|
-
content: /* @__PURE__ */
|
|
4829
|
+
content: /* @__PURE__ */ jsx21(Box10, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx21(Text19, { size: 2, children: tooltip }) }),
|
|
5328
4830
|
placement: "bottom",
|
|
5329
4831
|
portal: true,
|
|
5330
|
-
children: /* @__PURE__ */
|
|
5331
|
-
|
|
4832
|
+
children: /* @__PURE__ */ jsx21(
|
|
4833
|
+
Card12,
|
|
5332
4834
|
{
|
|
5333
4835
|
padding: 2,
|
|
5334
4836
|
radius: 2,
|
|
5335
4837
|
tone: isPositive ? "positive" : isNegative ? "critical" : "default",
|
|
5336
|
-
children: /* @__PURE__ */
|
|
4838
|
+
children: /* @__PURE__ */ jsxs17(Text19, { size: 2, weight: "bold", children: [
|
|
5337
4839
|
formatDelta(delta),
|
|
5338
4840
|
" ",
|
|
5339
4841
|
label
|
|
@@ -5348,9 +4850,9 @@ function AreaBadgeGroup({
|
|
|
5348
4850
|
label,
|
|
5349
4851
|
tone
|
|
5350
4852
|
}) {
|
|
5351
|
-
return /* @__PURE__ */
|
|
5352
|
-
/* @__PURE__ */
|
|
5353
|
-
|
|
4853
|
+
return /* @__PURE__ */ jsxs17(Stack14, { space: 2, children: [
|
|
4854
|
+
/* @__PURE__ */ jsx21(
|
|
4855
|
+
Text19,
|
|
5354
4856
|
{
|
|
5355
4857
|
muted: true,
|
|
5356
4858
|
size: 1,
|
|
@@ -5359,17 +4861,17 @@ function AreaBadgeGroup({
|
|
|
5359
4861
|
children: label
|
|
5360
4862
|
}
|
|
5361
4863
|
),
|
|
5362
|
-
/* @__PURE__ */
|
|
4864
|
+
/* @__PURE__ */ jsx21(Flex12, { gap: 1, wrap: "wrap", children: areas.map((a) => /* @__PURE__ */ jsx21(Badge6, { tone, children: a }, a)) })
|
|
5363
4865
|
] });
|
|
5364
4866
|
}
|
|
5365
4867
|
|
|
5366
4868
|
// src/components/report-detail/LineageCard.tsx
|
|
5367
4869
|
import { LinkIcon as LinkIcon2 } from "@sanity/icons";
|
|
5368
|
-
import { Badge as
|
|
5369
|
-
import { useCallback as
|
|
5370
|
-
import { useClient as
|
|
5371
|
-
import { useRouter } from "sanity/router";
|
|
5372
|
-
import { jsx as
|
|
4870
|
+
import { Badge as Badge7, Card as Card13, Flex as Flex13, Stack as Stack15, Text as Text20 } from "@sanity/ui";
|
|
4871
|
+
import { useCallback as useCallback10, useEffect as useEffect5, useState as useState6 } from "react";
|
|
4872
|
+
import { useClient as useClient5 } from "sanity";
|
|
4873
|
+
import { useRouter as useRouter2 } from "sanity/router";
|
|
4874
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5373
4875
|
var REPORT_TYPE2 = "ailf.report";
|
|
5374
4876
|
var SPAWNED_REPORTS_QUERY = (
|
|
5375
4877
|
/* groq */
|
|
@@ -5383,10 +4885,10 @@ var SPAWNED_REPORTS_QUERY = (
|
|
|
5383
4885
|
);
|
|
5384
4886
|
function LineageCard({ provenance, reportId }) {
|
|
5385
4887
|
const { lineage } = provenance;
|
|
5386
|
-
const router =
|
|
5387
|
-
const client =
|
|
5388
|
-
const [spawned, setSpawned] =
|
|
5389
|
-
|
|
4888
|
+
const router = useRouter2();
|
|
4889
|
+
const client = useClient5({ apiVersion: API_VERSION });
|
|
4890
|
+
const [spawned, setSpawned] = useState6([]);
|
|
4891
|
+
useEffect5(() => {
|
|
5390
4892
|
let cancelled = false;
|
|
5391
4893
|
client.fetch(SPAWNED_REPORTS_QUERY, {
|
|
5392
4894
|
reportId,
|
|
@@ -5401,12 +4903,12 @@ function LineageCard({ provenance, reportId }) {
|
|
|
5401
4903
|
}, [client, reportId]);
|
|
5402
4904
|
const hasLineage = lineage?.rerunOf || lineage?.comparedAgainst;
|
|
5403
4905
|
if (!hasLineage && spawned.length === 0) return null;
|
|
5404
|
-
return /* @__PURE__ */
|
|
5405
|
-
/* @__PURE__ */
|
|
5406
|
-
/* @__PURE__ */
|
|
4906
|
+
return /* @__PURE__ */ jsx22(Card13, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs18(Stack15, { space: 4, children: [
|
|
4907
|
+
/* @__PURE__ */ jsx22(Flex13, { align: "center", gap: 2, children: /* @__PURE__ */ jsxs18(Text20, { size: 3, weight: "semibold", children: [
|
|
4908
|
+
/* @__PURE__ */ jsx22(LinkIcon2, {}),
|
|
5407
4909
|
" Lineage"
|
|
5408
4910
|
] }) }),
|
|
5409
|
-
lineage?.rerunOf && /* @__PURE__ */
|
|
4911
|
+
lineage?.rerunOf && /* @__PURE__ */ jsx22(
|
|
5410
4912
|
LineageLink,
|
|
5411
4913
|
{
|
|
5412
4914
|
label: "Re-run of",
|
|
@@ -5414,7 +4916,7 @@ function LineageCard({ provenance, reportId }) {
|
|
|
5414
4916
|
router
|
|
5415
4917
|
}
|
|
5416
4918
|
),
|
|
5417
|
-
lineage?.comparedAgainst && /* @__PURE__ */
|
|
4919
|
+
lineage?.comparedAgainst && /* @__PURE__ */ jsx22(
|
|
5418
4920
|
LineageLink,
|
|
5419
4921
|
{
|
|
5420
4922
|
label: "Compared against",
|
|
@@ -5422,9 +4924,9 @@ function LineageCard({ provenance, reportId }) {
|
|
|
5422
4924
|
router
|
|
5423
4925
|
}
|
|
5424
4926
|
),
|
|
5425
|
-
spawned.length > 0 && /* @__PURE__ */
|
|
5426
|
-
/* @__PURE__ */
|
|
5427
|
-
spawned.map((s) => /* @__PURE__ */
|
|
4927
|
+
spawned.length > 0 && /* @__PURE__ */ jsxs18(Stack15, { space: 2, children: [
|
|
4928
|
+
/* @__PURE__ */ jsx22(Text20, { muted: true, size: 1, weight: "semibold", children: "SPAWNED RE-RUNS" }),
|
|
4929
|
+
spawned.map((s) => /* @__PURE__ */ jsx22(SpawnedReportRow, { report: s, router }, s.reportId))
|
|
5428
4930
|
] })
|
|
5429
4931
|
] }) });
|
|
5430
4932
|
}
|
|
@@ -5433,15 +4935,15 @@ function LineageLink({
|
|
|
5433
4935
|
reportId,
|
|
5434
4936
|
router
|
|
5435
4937
|
}) {
|
|
5436
|
-
const handleClick =
|
|
4938
|
+
const handleClick = useCallback10(() => {
|
|
5437
4939
|
router.navigate({ reportId });
|
|
5438
4940
|
}, [reportId, router]);
|
|
5439
|
-
return /* @__PURE__ */
|
|
5440
|
-
/* @__PURE__ */
|
|
4941
|
+
return /* @__PURE__ */ jsxs18(Flex13, { align: "center", gap: 2, children: [
|
|
4942
|
+
/* @__PURE__ */ jsxs18(Text20, { muted: true, size: 2, weight: "semibold", children: [
|
|
5441
4943
|
label,
|
|
5442
4944
|
":"
|
|
5443
4945
|
] }),
|
|
5444
|
-
/* @__PURE__ */
|
|
4946
|
+
/* @__PURE__ */ jsx22(Text20, { size: 2, children: /* @__PURE__ */ jsxs18(
|
|
5445
4947
|
"a",
|
|
5446
4948
|
{
|
|
5447
4949
|
href: "#",
|
|
@@ -5462,13 +4964,13 @@ function SpawnedReportRow({
|
|
|
5462
4964
|
report,
|
|
5463
4965
|
router
|
|
5464
4966
|
}) {
|
|
5465
|
-
const handleClick =
|
|
4967
|
+
const handleClick = useCallback10(() => {
|
|
5466
4968
|
router.navigate({ reportId: report.reportId });
|
|
5467
4969
|
}, [report.reportId, router]);
|
|
5468
4970
|
const dateLabel = formatShortDate(report.completedAt);
|
|
5469
4971
|
const label = report.tag ?? dateLabel;
|
|
5470
|
-
return /* @__PURE__ */
|
|
5471
|
-
/* @__PURE__ */
|
|
4972
|
+
return /* @__PURE__ */ jsxs18(Flex13, { align: "center", gap: 2, children: [
|
|
4973
|
+
/* @__PURE__ */ jsx22(Text20, { size: 2, children: /* @__PURE__ */ jsx22(
|
|
5472
4974
|
"a",
|
|
5473
4975
|
{
|
|
5474
4976
|
href: "#",
|
|
@@ -5480,8 +4982,8 @@ function SpawnedReportRow({
|
|
|
5480
4982
|
children: label
|
|
5481
4983
|
}
|
|
5482
4984
|
) }),
|
|
5483
|
-
report.tag && /* @__PURE__ */
|
|
5484
|
-
/* @__PURE__ */
|
|
4985
|
+
report.tag && /* @__PURE__ */ jsx22(Text20, { muted: true, size: 1, children: dateLabel }),
|
|
4986
|
+
/* @__PURE__ */ jsx22(Badge7, { fontSize: 1, mode: "outline", tone: "default", children: report.reportId.slice(0, 8) })
|
|
5485
4987
|
] });
|
|
5486
4988
|
}
|
|
5487
4989
|
function formatShortDate(iso) {
|
|
@@ -5497,16 +4999,16 @@ function formatShortDate(iso) {
|
|
|
5497
4999
|
}
|
|
5498
5000
|
|
|
5499
5001
|
// src/components/report-detail/JudgmentList.tsx
|
|
5500
|
-
import { useState as
|
|
5002
|
+
import { useState as useState7 } from "react";
|
|
5501
5003
|
import { HelpCircleIcon as HelpCircleIcon6 } from "@sanity/icons";
|
|
5502
|
-
import { Badge as
|
|
5004
|
+
import { Badge as Badge8, Box as Box11, Card as Card14, Flex as Flex14, Stack as Stack16, Text as Text21, Tooltip as Tooltip6 } from "@sanity/ui";
|
|
5503
5005
|
|
|
5504
5006
|
// src/components/primitives/InlineCode.tsx
|
|
5505
|
-
import { Fragment as
|
|
5007
|
+
import { Fragment as Fragment6, jsx as jsx23 } from "react/jsx-runtime";
|
|
5506
5008
|
function InlineCode({ text }) {
|
|
5507
5009
|
const parts = text.split(/`([^`]+)`/);
|
|
5508
|
-
return /* @__PURE__ */
|
|
5509
|
-
(part, i) => i % 2 === 1 ? /* @__PURE__ */
|
|
5010
|
+
return /* @__PURE__ */ jsx23(Fragment6, { children: parts.map(
|
|
5011
|
+
(part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx23(
|
|
5510
5012
|
"code",
|
|
5511
5013
|
{
|
|
5512
5014
|
style: {
|
|
@@ -5518,12 +5020,12 @@ function InlineCode({ text }) {
|
|
|
5518
5020
|
children: part
|
|
5519
5021
|
},
|
|
5520
5022
|
i
|
|
5521
|
-
) : /* @__PURE__ */
|
|
5023
|
+
) : /* @__PURE__ */ jsx23("span", { children: part }, i)
|
|
5522
5024
|
) });
|
|
5523
5025
|
}
|
|
5524
5026
|
|
|
5525
5027
|
// src/components/report-detail/JudgmentList.tsx
|
|
5526
|
-
import { jsx as
|
|
5028
|
+
import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5527
5029
|
function groupByArea(judgments) {
|
|
5528
5030
|
const byArea = /* @__PURE__ */ new Map();
|
|
5529
5031
|
for (const j of judgments) {
|
|
@@ -5538,56 +5040,56 @@ var DIMENSION_LABELS = DIMENSION_LABELS_KEBAB;
|
|
|
5538
5040
|
function JudgmentList({ judgments }) {
|
|
5539
5041
|
if (judgments.length === 0) return null;
|
|
5540
5042
|
const grouped = groupByArea(judgments);
|
|
5541
|
-
return /* @__PURE__ */
|
|
5542
|
-
/* @__PURE__ */
|
|
5543
|
-
/* @__PURE__ */
|
|
5544
|
-
/* @__PURE__ */
|
|
5043
|
+
return /* @__PURE__ */ jsx24(Card14, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs19(Stack16, { space: 4, children: [
|
|
5044
|
+
/* @__PURE__ */ jsxs19(Flex14, { align: "center", gap: 3, wrap: "wrap", children: [
|
|
5045
|
+
/* @__PURE__ */ jsx24(Text21, { size: 3, weight: "semibold", children: "Low-Scoring Judgments" }),
|
|
5046
|
+
/* @__PURE__ */ jsx24(
|
|
5545
5047
|
Tooltip6,
|
|
5546
5048
|
{
|
|
5547
|
-
content: /* @__PURE__ */
|
|
5049
|
+
content: /* @__PURE__ */ jsx24(Box11, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx24(Text21, { size: 2, children: GLOSSARY.lowScoringJudgments }) }),
|
|
5548
5050
|
placement: "bottom",
|
|
5549
5051
|
portal: true,
|
|
5550
|
-
children: /* @__PURE__ */
|
|
5052
|
+
children: /* @__PURE__ */ jsx24(Text21, { muted: true, size: 1, children: /* @__PURE__ */ jsx24(HelpCircleIcon6, {}) })
|
|
5551
5053
|
}
|
|
5552
5054
|
),
|
|
5553
|
-
/* @__PURE__ */
|
|
5055
|
+
/* @__PURE__ */ jsx24(Card14, { padding: 2, radius: 2, tone: "critical", children: /* @__PURE__ */ jsxs19(Text21, { size: 2, weight: "bold", children: [
|
|
5554
5056
|
judgments.length,
|
|
5555
5057
|
" judgment",
|
|
5556
5058
|
judgments.length === 1 ? "" : "s",
|
|
5557
5059
|
" below 70"
|
|
5558
5060
|
] }) })
|
|
5559
5061
|
] }),
|
|
5560
|
-
grouped.map(([area, areaJudgments]) => /* @__PURE__ */
|
|
5561
|
-
/* @__PURE__ */
|
|
5062
|
+
grouped.map(([area, areaJudgments]) => /* @__PURE__ */ jsx24(Card14, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs19(Stack16, { space: 3, children: [
|
|
5063
|
+
/* @__PURE__ */ jsxs19(Text21, { size: 2, weight: "semibold", children: [
|
|
5562
5064
|
area,
|
|
5563
5065
|
" ",
|
|
5564
|
-
/* @__PURE__ */
|
|
5066
|
+
/* @__PURE__ */ jsxs19(Text21, { muted: true, size: 2, weight: "regular", as: "span", children: [
|
|
5565
5067
|
"(",
|
|
5566
5068
|
areaJudgments.length,
|
|
5567
5069
|
")"
|
|
5568
5070
|
] })
|
|
5569
5071
|
] }),
|
|
5570
|
-
areaJudgments.map((j, i) => /* @__PURE__ */
|
|
5072
|
+
areaJudgments.map((j, i) => /* @__PURE__ */ jsx24(JudgmentCard, { judgment: j }, `${area}-${i}`))
|
|
5571
5073
|
] }) }, area))
|
|
5572
5074
|
] }) });
|
|
5573
5075
|
}
|
|
5574
5076
|
function JudgmentCard({ judgment }) {
|
|
5575
|
-
const [expanded, setExpanded] =
|
|
5077
|
+
const [expanded, setExpanded] = useState7(false);
|
|
5576
5078
|
const dimLabel = DIMENSION_LABELS[judgment.dimension] ?? judgment.dimension;
|
|
5577
5079
|
const sep = judgment.taskId.indexOf(" - ");
|
|
5578
5080
|
const taskName = sep > 0 ? judgment.taskId.substring(sep + 3) : judgment.taskId;
|
|
5579
|
-
return /* @__PURE__ */
|
|
5580
|
-
|
|
5081
|
+
return /* @__PURE__ */ jsx24(
|
|
5082
|
+
Card14,
|
|
5581
5083
|
{
|
|
5582
5084
|
padding: 3,
|
|
5583
5085
|
radius: 2,
|
|
5584
5086
|
shadow: 1,
|
|
5585
5087
|
style: { cursor: "pointer" },
|
|
5586
5088
|
onClick: () => setExpanded(!expanded),
|
|
5587
|
-
children: /* @__PURE__ */
|
|
5588
|
-
/* @__PURE__ */
|
|
5589
|
-
/* @__PURE__ */
|
|
5590
|
-
|
|
5089
|
+
children: /* @__PURE__ */ jsxs19(Stack16, { space: 3, children: [
|
|
5090
|
+
/* @__PURE__ */ jsxs19(Flex14, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
5091
|
+
/* @__PURE__ */ jsx24(Card14, { padding: 2, radius: 2, tone: scoreTone(judgment.score), children: /* @__PURE__ */ jsx24(
|
|
5092
|
+
Text21,
|
|
5591
5093
|
{
|
|
5592
5094
|
align: "center",
|
|
5593
5095
|
size: 2,
|
|
@@ -5596,24 +5098,24 @@ function JudgmentCard({ judgment }) {
|
|
|
5596
5098
|
children: judgment.score
|
|
5597
5099
|
}
|
|
5598
5100
|
) }),
|
|
5599
|
-
/* @__PURE__ */
|
|
5600
|
-
/* @__PURE__ */
|
|
5601
|
-
/* @__PURE__ */
|
|
5602
|
-
/* @__PURE__ */
|
|
5101
|
+
/* @__PURE__ */ jsx24(Badge8, { tone: "default", children: dimLabel }),
|
|
5102
|
+
/* @__PURE__ */ jsx24(Text21, { size: 2, weight: "medium", children: taskName }),
|
|
5103
|
+
/* @__PURE__ */ jsx24(Text21, { muted: true, size: 1, children: judgment.modelId }),
|
|
5104
|
+
/* @__PURE__ */ jsx24(Text21, { muted: true, size: 1, style: { marginLeft: "auto" }, children: expanded ? "\u25B2" : "\u25BC" })
|
|
5603
5105
|
] }),
|
|
5604
|
-
expanded && /* @__PURE__ */
|
|
5605
|
-
/* @__PURE__ */
|
|
5606
|
-
|
|
5106
|
+
expanded && /* @__PURE__ */ jsxs19(Stack16, { space: 3, children: [
|
|
5107
|
+
/* @__PURE__ */ jsx24(Card14, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx24(
|
|
5108
|
+
Text21,
|
|
5607
5109
|
{
|
|
5608
5110
|
muted: true,
|
|
5609
5111
|
size: 2,
|
|
5610
5112
|
style: { lineHeight: 1.6, whiteSpace: "pre-wrap" },
|
|
5611
|
-
children: /* @__PURE__ */
|
|
5113
|
+
children: /* @__PURE__ */ jsx24(InlineCode, { text: judgment.reason })
|
|
5612
5114
|
}
|
|
5613
5115
|
) }),
|
|
5614
|
-
judgment.canonicalDocs && judgment.canonicalDocs.length > 0 && /* @__PURE__ */
|
|
5615
|
-
/* @__PURE__ */
|
|
5616
|
-
judgment.canonicalDocs.map((doc) => /* @__PURE__ */
|
|
5116
|
+
judgment.canonicalDocs && judgment.canonicalDocs.length > 0 && /* @__PURE__ */ jsxs19(Flex14, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
5117
|
+
/* @__PURE__ */ jsx24(Text21, { muted: true, size: 1, children: "Docs:" }),
|
|
5118
|
+
judgment.canonicalDocs.map((doc) => /* @__PURE__ */ jsx24(DocBadge, { doc }, doc.slug))
|
|
5617
5119
|
] })
|
|
5618
5120
|
] })
|
|
5619
5121
|
] })
|
|
@@ -5629,17 +5131,17 @@ var editLinkStyle = {
|
|
|
5629
5131
|
function DocBadge({
|
|
5630
5132
|
doc
|
|
5631
5133
|
}) {
|
|
5632
|
-
const [hovered, setHovered] =
|
|
5134
|
+
const [hovered, setHovered] = useState7(false);
|
|
5633
5135
|
const isLinked = Boolean(doc.documentId);
|
|
5634
5136
|
const tooltipLabel = isLinked ? `Edit "${doc.title || doc.slug}"` : doc.title || doc.slug;
|
|
5635
|
-
const badge = /* @__PURE__ */
|
|
5636
|
-
return /* @__PURE__ */
|
|
5137
|
+
const badge = /* @__PURE__ */ jsx24(Badge8, { mode: "outline", tone: isLinked && hovered ? "caution" : "primary", children: doc.slug });
|
|
5138
|
+
return /* @__PURE__ */ jsx24(
|
|
5637
5139
|
Tooltip6,
|
|
5638
5140
|
{
|
|
5639
|
-
content: /* @__PURE__ */
|
|
5141
|
+
content: /* @__PURE__ */ jsx24(Box11, { padding: 2, children: /* @__PURE__ */ jsx24(Text21, { size: 2, children: tooltipLabel }) }),
|
|
5640
5142
|
placement: "bottom",
|
|
5641
5143
|
portal: true,
|
|
5642
|
-
children: isLinked ? /* @__PURE__ */
|
|
5144
|
+
children: isLinked ? /* @__PURE__ */ jsx24(
|
|
5643
5145
|
"a",
|
|
5644
5146
|
{
|
|
5645
5147
|
href: `/intent/edit/id=${doc.documentId}`,
|
|
@@ -5652,14 +5154,14 @@ function DocBadge({
|
|
|
5652
5154
|
},
|
|
5653
5155
|
children: badge
|
|
5654
5156
|
}
|
|
5655
|
-
) : /* @__PURE__ */
|
|
5157
|
+
) : /* @__PURE__ */ jsx24("span", { children: badge })
|
|
5656
5158
|
}
|
|
5657
5159
|
);
|
|
5658
5160
|
}
|
|
5659
5161
|
|
|
5660
5162
|
// src/components/report-detail/OverviewStats.tsx
|
|
5661
5163
|
import { Grid as Grid4 } from "@sanity/ui";
|
|
5662
|
-
import { jsx as
|
|
5164
|
+
import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5663
5165
|
function OverviewStats({
|
|
5664
5166
|
overall,
|
|
5665
5167
|
durationMs,
|
|
@@ -5667,8 +5169,8 @@ function OverviewStats({
|
|
|
5667
5169
|
isFullMode
|
|
5668
5170
|
}) {
|
|
5669
5171
|
const overallTone = scoreTone(overall.avgScore);
|
|
5670
|
-
return /* @__PURE__ */
|
|
5671
|
-
/* @__PURE__ */
|
|
5172
|
+
return /* @__PURE__ */ jsxs20(Grid4, { columns: [1, 1, 2, isFullMode ? 4 : 4], gap: 3, children: [
|
|
5173
|
+
/* @__PURE__ */ jsx25(
|
|
5672
5174
|
StatCard,
|
|
5673
5175
|
{
|
|
5674
5176
|
label: "Overall Score",
|
|
@@ -5677,7 +5179,7 @@ function OverviewStats({
|
|
|
5677
5179
|
value: overall.avgScore.toFixed(1)
|
|
5678
5180
|
}
|
|
5679
5181
|
),
|
|
5680
|
-
/* @__PURE__ */
|
|
5182
|
+
/* @__PURE__ */ jsx25(
|
|
5681
5183
|
StatCard,
|
|
5682
5184
|
{
|
|
5683
5185
|
label: "Doc Lift",
|
|
@@ -5686,7 +5188,7 @@ function OverviewStats({
|
|
|
5686
5188
|
value: overall.avgDocLift.toFixed(1)
|
|
5687
5189
|
}
|
|
5688
5190
|
),
|
|
5689
|
-
isFullMode && overall.avgActualScore != null && /* @__PURE__ */
|
|
5191
|
+
isFullMode && overall.avgActualScore != null && /* @__PURE__ */ jsx25(
|
|
5690
5192
|
StatCard,
|
|
5691
5193
|
{
|
|
5692
5194
|
label: "Actual Score",
|
|
@@ -5695,7 +5197,7 @@ function OverviewStats({
|
|
|
5695
5197
|
value: overall.avgActualScore.toFixed(1)
|
|
5696
5198
|
}
|
|
5697
5199
|
),
|
|
5698
|
-
isFullMode && overall.avgRetrievalGap != null && /* @__PURE__ */
|
|
5200
|
+
isFullMode && overall.avgRetrievalGap != null && /* @__PURE__ */ jsx25(
|
|
5699
5201
|
StatCard,
|
|
5700
5202
|
{
|
|
5701
5203
|
label: "Retrieval Gap",
|
|
@@ -5705,7 +5207,7 @@ function OverviewStats({
|
|
|
5705
5207
|
value: overall.avgRetrievalGap.toFixed(1)
|
|
5706
5208
|
}
|
|
5707
5209
|
),
|
|
5708
|
-
isFullMode && overall.avgInfrastructureEfficiency != null && /* @__PURE__ */
|
|
5210
|
+
isFullMode && overall.avgInfrastructureEfficiency != null && /* @__PURE__ */ jsx25(
|
|
5709
5211
|
StatCard,
|
|
5710
5212
|
{
|
|
5711
5213
|
label: "Infra Efficiency",
|
|
@@ -5713,8 +5215,8 @@ function OverviewStats({
|
|
|
5713
5215
|
value: formatPercent(overall.avgInfrastructureEfficiency)
|
|
5714
5216
|
}
|
|
5715
5217
|
),
|
|
5716
|
-
/* @__PURE__ */
|
|
5717
|
-
/* @__PURE__ */
|
|
5218
|
+
/* @__PURE__ */ jsx25(StatCard, { label: "Duration", value: formatDuration(durationMs) }),
|
|
5219
|
+
/* @__PURE__ */ jsx25(
|
|
5718
5220
|
StatCard,
|
|
5719
5221
|
{
|
|
5720
5222
|
label: "Tests",
|
|
@@ -5726,31 +5228,31 @@ function OverviewStats({
|
|
|
5726
5228
|
}
|
|
5727
5229
|
|
|
5728
5230
|
// src/components/report-detail/ProvenanceCard.tsx
|
|
5729
|
-
import { Card as
|
|
5730
|
-
import { jsx as
|
|
5231
|
+
import { Card as Card15, Flex as Flex15, Grid as Grid5, Stack as Stack17, Text as Text22 } from "@sanity/ui";
|
|
5232
|
+
import { jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5731
5233
|
var VIEWABLE_PROMPTFOO_MODES = /* @__PURE__ */ new Set(["agentic", "observed"]);
|
|
5732
5234
|
function ProvenanceCard({ provenance }) {
|
|
5733
|
-
return /* @__PURE__ */
|
|
5734
|
-
/* @__PURE__ */
|
|
5735
|
-
/* @__PURE__ */
|
|
5736
|
-
/* @__PURE__ */
|
|
5737
|
-
/* @__PURE__ */
|
|
5738
|
-
/* @__PURE__ */
|
|
5235
|
+
return /* @__PURE__ */ jsx26(Card15, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs21(Stack17, { space: 4, children: [
|
|
5236
|
+
/* @__PURE__ */ jsx26(Text22, { size: 3, weight: "semibold", children: "Provenance" }),
|
|
5237
|
+
/* @__PURE__ */ jsxs21(Grid5, { columns: [1, 2, 3], gap: 4, children: [
|
|
5238
|
+
/* @__PURE__ */ jsx26(Field, { label: "Mode", value: provenance.mode }),
|
|
5239
|
+
/* @__PURE__ */ jsx26(Field, { label: "Source", value: provenance.source.name }),
|
|
5240
|
+
/* @__PURE__ */ jsx26(
|
|
5739
5241
|
Field,
|
|
5740
5242
|
{
|
|
5741
5243
|
label: "Trigger",
|
|
5742
5244
|
value: provenance.trigger.type + (provenance.trigger.workflow ? ` (${provenance.trigger.workflow})` : "")
|
|
5743
5245
|
}
|
|
5744
5246
|
),
|
|
5745
|
-
/* @__PURE__ */
|
|
5247
|
+
/* @__PURE__ */ jsx26(
|
|
5746
5248
|
Field,
|
|
5747
5249
|
{
|
|
5748
5250
|
label: "Models",
|
|
5749
5251
|
value: provenance.models.map((m) => m.label).join(", ")
|
|
5750
5252
|
}
|
|
5751
5253
|
),
|
|
5752
|
-
/* @__PURE__ */
|
|
5753
|
-
provenance.contextHash && /* @__PURE__ */
|
|
5254
|
+
/* @__PURE__ */ jsx26(Field, { label: "Grader Model", mono: true, value: provenance.graderModel }),
|
|
5255
|
+
provenance.contextHash && /* @__PURE__ */ jsx26(
|
|
5754
5256
|
Field,
|
|
5755
5257
|
{
|
|
5756
5258
|
label: "Context Hash",
|
|
@@ -5759,8 +5261,8 @@ function ProvenanceCard({ provenance }) {
|
|
|
5759
5261
|
}
|
|
5760
5262
|
)
|
|
5761
5263
|
] }),
|
|
5762
|
-
provenance.git && /* @__PURE__ */
|
|
5763
|
-
/* @__PURE__ */
|
|
5264
|
+
provenance.git && /* @__PURE__ */ jsx26(GitInfo, { git: provenance.git }),
|
|
5265
|
+
/* @__PURE__ */ jsx26(PromptfooLinks, { provenance })
|
|
5764
5266
|
] }) });
|
|
5765
5267
|
}
|
|
5766
5268
|
function Field({
|
|
@@ -5768,9 +5270,9 @@ function Field({
|
|
|
5768
5270
|
mono,
|
|
5769
5271
|
value
|
|
5770
5272
|
}) {
|
|
5771
|
-
return /* @__PURE__ */
|
|
5772
|
-
/* @__PURE__ */
|
|
5773
|
-
|
|
5273
|
+
return /* @__PURE__ */ jsxs21(Stack17, { space: 1, children: [
|
|
5274
|
+
/* @__PURE__ */ jsx26(
|
|
5275
|
+
Text22,
|
|
5774
5276
|
{
|
|
5775
5277
|
muted: true,
|
|
5776
5278
|
size: 1,
|
|
@@ -5779,7 +5281,7 @@ function Field({
|
|
|
5779
5281
|
children: label
|
|
5780
5282
|
}
|
|
5781
5283
|
),
|
|
5782
|
-
/* @__PURE__ */
|
|
5284
|
+
/* @__PURE__ */ jsx26(Text22, { size: 2, style: mono ? { fontFamily: "monospace" } : void 0, children: value })
|
|
5783
5285
|
] });
|
|
5784
5286
|
}
|
|
5785
5287
|
function GitInfo({ git }) {
|
|
@@ -5787,15 +5289,15 @@ function GitInfo({ git }) {
|
|
|
5787
5289
|
const branchUrl = `${repoUrl}/tree/${git.branch}`;
|
|
5788
5290
|
const commitUrl = `${repoUrl}/commit/${git.sha}`;
|
|
5789
5291
|
const prUrl = git.prNumber ? `${repoUrl}/pull/${git.prNumber}` : null;
|
|
5790
|
-
return /* @__PURE__ */
|
|
5791
|
-
/* @__PURE__ */
|
|
5792
|
-
/* @__PURE__ */
|
|
5793
|
-
/* @__PURE__ */
|
|
5292
|
+
return /* @__PURE__ */ jsx26(Card15, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsxs21(Flex15, { align: "center", gap: 3, wrap: "wrap", children: [
|
|
5293
|
+
/* @__PURE__ */ jsx26(Text22, { muted: true, size: 2, weight: "semibold", children: "Git" }),
|
|
5294
|
+
/* @__PURE__ */ jsxs21(Text22, { size: 2, children: [
|
|
5295
|
+
/* @__PURE__ */ jsx26("a", { href: repoUrl, rel: "noopener noreferrer", target: "_blank", children: git.repo }),
|
|
5794
5296
|
" / ",
|
|
5795
|
-
/* @__PURE__ */
|
|
5297
|
+
/* @__PURE__ */ jsx26("a", { href: branchUrl, rel: "noopener noreferrer", target: "_blank", children: git.branch })
|
|
5796
5298
|
] }),
|
|
5797
|
-
/* @__PURE__ */
|
|
5798
|
-
prUrl && /* @__PURE__ */
|
|
5299
|
+
/* @__PURE__ */ jsx26(Text22, { muted: true, size: 2, style: { fontFamily: "monospace" }, children: /* @__PURE__ */ jsx26("a", { href: commitUrl, rel: "noopener noreferrer", target: "_blank", children: git.sha.slice(0, 12) }) }),
|
|
5300
|
+
prUrl && /* @__PURE__ */ jsx26(Text22, { size: 2, children: /* @__PURE__ */ jsxs21("a", { href: prUrl, rel: "noopener noreferrer", target: "_blank", children: [
|
|
5799
5301
|
"PR #",
|
|
5800
5302
|
git.prNumber,
|
|
5801
5303
|
" \u2192"
|
|
@@ -5810,14 +5312,14 @@ function PromptfooLinks({
|
|
|
5810
5312
|
(e) => VIEWABLE_PROMPTFOO_MODES.has(e.mode)
|
|
5811
5313
|
);
|
|
5812
5314
|
if (viewable.length === 0) return null;
|
|
5813
|
-
return /* @__PURE__ */
|
|
5315
|
+
return /* @__PURE__ */ jsx26(Flex15, { gap: 3, wrap: "wrap", children: viewable.map((entry) => /* @__PURE__ */ jsx26(Text22, { size: 2, children: /* @__PURE__ */ jsxs21("a", { href: entry.url, rel: "noopener noreferrer", target: "_blank", children: [
|
|
5814
5316
|
"View in Promptfoo (",
|
|
5815
5317
|
entry.mode,
|
|
5816
5318
|
") \u2192"
|
|
5817
5319
|
] }) }, entry.mode)) });
|
|
5818
5320
|
}
|
|
5819
5321
|
if (provenance.promptfooUrl && VIEWABLE_PROMPTFOO_MODES.has(provenance.mode)) {
|
|
5820
|
-
return /* @__PURE__ */
|
|
5322
|
+
return /* @__PURE__ */ jsx26(Text22, { size: 2, children: /* @__PURE__ */ jsx26(
|
|
5821
5323
|
"a",
|
|
5822
5324
|
{
|
|
5823
5325
|
href: provenance.promptfooUrl,
|
|
@@ -5832,32 +5334,32 @@ function PromptfooLinks({
|
|
|
5832
5334
|
|
|
5833
5335
|
// src/components/report-detail/RecommendationsSection.tsx
|
|
5834
5336
|
import React4 from "react";
|
|
5835
|
-
import { Badge as
|
|
5337
|
+
import { Badge as Badge9, Box as Box12, Card as Card16, Flex as Flex16, Stack as Stack18, Text as Text23, Tooltip as Tooltip7 } from "@sanity/ui";
|
|
5836
5338
|
import { HelpCircleIcon as HelpCircleIcon7 } from "@sanity/icons";
|
|
5837
|
-
import { jsx as
|
|
5339
|
+
import { jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5838
5340
|
function RecommendationsSection({
|
|
5839
5341
|
recommendations
|
|
5840
5342
|
}) {
|
|
5841
5343
|
if (recommendations.gaps.length === 0) return null;
|
|
5842
|
-
return /* @__PURE__ */
|
|
5843
|
-
/* @__PURE__ */
|
|
5844
|
-
/* @__PURE__ */
|
|
5845
|
-
/* @__PURE__ */
|
|
5344
|
+
return /* @__PURE__ */ jsx27(Card16, { padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs22(Stack18, { space: 4, children: [
|
|
5345
|
+
/* @__PURE__ */ jsxs22(Flex16, { align: "center", gap: 3, wrap: "wrap", children: [
|
|
5346
|
+
/* @__PURE__ */ jsx27(Text23, { size: 3, weight: "semibold", children: "Recommendations" }),
|
|
5347
|
+
/* @__PURE__ */ jsx27(
|
|
5846
5348
|
Tooltip7,
|
|
5847
5349
|
{
|
|
5848
|
-
content: /* @__PURE__ */
|
|
5350
|
+
content: /* @__PURE__ */ jsx27(Box12, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx27(Text23, { size: 2, children: GLOSSARY.recommendations }) }),
|
|
5849
5351
|
placement: "bottom",
|
|
5850
5352
|
portal: true,
|
|
5851
|
-
children: /* @__PURE__ */
|
|
5353
|
+
children: /* @__PURE__ */ jsx27(Text23, { muted: true, size: 1, children: /* @__PURE__ */ jsx27(HelpCircleIcon7, {}) })
|
|
5852
5354
|
}
|
|
5853
5355
|
),
|
|
5854
|
-
/* @__PURE__ */
|
|
5356
|
+
/* @__PURE__ */ jsx27(
|
|
5855
5357
|
Tooltip7,
|
|
5856
5358
|
{
|
|
5857
|
-
content: /* @__PURE__ */
|
|
5359
|
+
content: /* @__PURE__ */ jsx27(Box12, { padding: 2, style: { maxWidth: 260 }, children: /* @__PURE__ */ jsx27(Text23, { size: 2, children: GLOSSARY.totalPotentialLift }) }),
|
|
5858
5360
|
placement: "bottom",
|
|
5859
5361
|
portal: true,
|
|
5860
|
-
children: /* @__PURE__ */
|
|
5362
|
+
children: /* @__PURE__ */ jsx27(Card16, { padding: 2, radius: 2, tone: "positive", children: /* @__PURE__ */ jsxs22(Text23, { size: 2, weight: "bold", children: [
|
|
5861
5363
|
"+",
|
|
5862
5364
|
recommendations.totalPotentialLift.toFixed(1),
|
|
5863
5365
|
" pts potential lift"
|
|
@@ -5865,7 +5367,7 @@ function RecommendationsSection({
|
|
|
5865
5367
|
}
|
|
5866
5368
|
)
|
|
5867
5369
|
] }),
|
|
5868
|
-
/* @__PURE__ */
|
|
5370
|
+
/* @__PURE__ */ jsxs22(
|
|
5869
5371
|
"div",
|
|
5870
5372
|
{
|
|
5871
5373
|
style: {
|
|
@@ -5874,9 +5376,9 @@ function RecommendationsSection({
|
|
|
5874
5376
|
gridTemplateColumns: "auto 2fr 2fr 1fr 1fr 1fr"
|
|
5875
5377
|
},
|
|
5876
5378
|
children: [
|
|
5877
|
-
/* @__PURE__ */
|
|
5878
|
-
/* @__PURE__ */
|
|
5879
|
-
/* @__PURE__ */
|
|
5379
|
+
/* @__PURE__ */ jsx27(ColumnHeader, { borderBottom: true, label: "#" }),
|
|
5380
|
+
/* @__PURE__ */ jsx27(ColumnHeader, { borderBottom: true, label: "Area" }),
|
|
5381
|
+
/* @__PURE__ */ jsx27(
|
|
5880
5382
|
ColumnHeader,
|
|
5881
5383
|
{
|
|
5882
5384
|
borderBottom: true,
|
|
@@ -5884,8 +5386,8 @@ function RecommendationsSection({
|
|
|
5884
5386
|
tooltip: GLOSSARY.failureMode
|
|
5885
5387
|
}
|
|
5886
5388
|
),
|
|
5887
|
-
/* @__PURE__ */
|
|
5888
|
-
/* @__PURE__ */
|
|
5389
|
+
/* @__PURE__ */ jsx27(ColumnHeader, { borderBottom: true, label: "Action" }),
|
|
5390
|
+
/* @__PURE__ */ jsx27(
|
|
5889
5391
|
ColumnHeader,
|
|
5890
5392
|
{
|
|
5891
5393
|
borderBottom: true,
|
|
@@ -5893,7 +5395,7 @@ function RecommendationsSection({
|
|
|
5893
5395
|
tooltip: GLOSSARY.estimatedLift
|
|
5894
5396
|
}
|
|
5895
5397
|
),
|
|
5896
|
-
/* @__PURE__ */
|
|
5398
|
+
/* @__PURE__ */ jsx27(
|
|
5897
5399
|
ColumnHeader,
|
|
5898
5400
|
{
|
|
5899
5401
|
borderBottom: true,
|
|
@@ -5901,7 +5403,7 @@ function RecommendationsSection({
|
|
|
5901
5403
|
tooltip: GLOSSARY.confidence
|
|
5902
5404
|
}
|
|
5903
5405
|
),
|
|
5904
|
-
recommendations.gaps.map((gap, i) => /* @__PURE__ */
|
|
5406
|
+
recommendations.gaps.map((gap, i) => /* @__PURE__ */ jsx27(RecommendationRow, { gap, index: i }, `gap-${i}`))
|
|
5905
5407
|
]
|
|
5906
5408
|
}
|
|
5907
5409
|
)
|
|
@@ -5913,8 +5415,8 @@ function RecommendationRow({
|
|
|
5913
5415
|
}) {
|
|
5914
5416
|
const confIcon = gap.confidence === "high" ? "\u{1F7E2}" : gap.confidence === "medium" ? "\u{1F7E1}" : "\u{1F534}";
|
|
5915
5417
|
const bg = rowBackground(index);
|
|
5916
|
-
return /* @__PURE__ */
|
|
5917
|
-
/* @__PURE__ */
|
|
5418
|
+
return /* @__PURE__ */ jsxs22(React4.Fragment, { children: [
|
|
5419
|
+
/* @__PURE__ */ jsx27(
|
|
5918
5420
|
"div",
|
|
5919
5421
|
{
|
|
5920
5422
|
style: {
|
|
@@ -5924,10 +5426,10 @@ function RecommendationRow({
|
|
|
5924
5426
|
display: "flex",
|
|
5925
5427
|
padding: "8px 4px"
|
|
5926
5428
|
},
|
|
5927
|
-
children: /* @__PURE__ */
|
|
5429
|
+
children: /* @__PURE__ */ jsx27(Text23, { muted: true, size: 2, children: index + 1 })
|
|
5928
5430
|
}
|
|
5929
5431
|
),
|
|
5930
|
-
/* @__PURE__ */
|
|
5432
|
+
/* @__PURE__ */ jsx27(
|
|
5931
5433
|
"div",
|
|
5932
5434
|
{
|
|
5933
5435
|
style: {
|
|
@@ -5936,10 +5438,10 @@ function RecommendationRow({
|
|
|
5936
5438
|
display: "flex",
|
|
5937
5439
|
padding: "8px 0"
|
|
5938
5440
|
},
|
|
5939
|
-
children: /* @__PURE__ */
|
|
5441
|
+
children: /* @__PURE__ */ jsx27(Text23, { size: 2, weight: "medium", children: gap.area })
|
|
5940
5442
|
}
|
|
5941
5443
|
),
|
|
5942
|
-
/* @__PURE__ */
|
|
5444
|
+
/* @__PURE__ */ jsx27(
|
|
5943
5445
|
"div",
|
|
5944
5446
|
{
|
|
5945
5447
|
style: {
|
|
@@ -5948,8 +5450,8 @@ function RecommendationRow({
|
|
|
5948
5450
|
display: "flex",
|
|
5949
5451
|
padding: "8px 0"
|
|
5950
5452
|
},
|
|
5951
|
-
children: /* @__PURE__ */
|
|
5952
|
-
|
|
5453
|
+
children: /* @__PURE__ */ jsx27(
|
|
5454
|
+
Badge9,
|
|
5953
5455
|
{
|
|
5954
5456
|
tone: gap.failureMode === "missing-docs" ? "critical" : gap.failureMode === "incorrect-docs" ? "critical" : gap.failureMode === "outdated-docs" ? "caution" : "default",
|
|
5955
5457
|
children: gap.failureMode
|
|
@@ -5957,7 +5459,7 @@ function RecommendationRow({
|
|
|
5957
5459
|
)
|
|
5958
5460
|
}
|
|
5959
5461
|
),
|
|
5960
|
-
/* @__PURE__ */
|
|
5462
|
+
/* @__PURE__ */ jsx27(
|
|
5961
5463
|
"div",
|
|
5962
5464
|
{
|
|
5963
5465
|
style: {
|
|
@@ -5966,10 +5468,10 @@ function RecommendationRow({
|
|
|
5966
5468
|
display: "flex",
|
|
5967
5469
|
padding: "8px 0"
|
|
5968
5470
|
},
|
|
5969
|
-
children: /* @__PURE__ */
|
|
5471
|
+
children: /* @__PURE__ */ jsx27(Text23, { muted: true, size: 2, children: gap.remediation })
|
|
5970
5472
|
}
|
|
5971
5473
|
),
|
|
5972
|
-
/* @__PURE__ */
|
|
5474
|
+
/* @__PURE__ */ jsx27(
|
|
5973
5475
|
"div",
|
|
5974
5476
|
{
|
|
5975
5477
|
style: {
|
|
@@ -5978,13 +5480,13 @@ function RecommendationRow({
|
|
|
5978
5480
|
display: "flex",
|
|
5979
5481
|
padding: "8px 0"
|
|
5980
5482
|
},
|
|
5981
|
-
children: /* @__PURE__ */
|
|
5483
|
+
children: /* @__PURE__ */ jsx27(Card16, { padding: 2, radius: 2, tone: "positive", children: /* @__PURE__ */ jsxs22(Text23, { align: "center", size: 2, weight: "medium", children: [
|
|
5982
5484
|
"+",
|
|
5983
5485
|
gap.estimatedLift.toFixed(1)
|
|
5984
5486
|
] }) })
|
|
5985
5487
|
}
|
|
5986
5488
|
),
|
|
5987
|
-
/* @__PURE__ */
|
|
5489
|
+
/* @__PURE__ */ jsx27(
|
|
5988
5490
|
"div",
|
|
5989
5491
|
{
|
|
5990
5492
|
style: {
|
|
@@ -5993,7 +5495,7 @@ function RecommendationRow({
|
|
|
5993
5495
|
display: "flex",
|
|
5994
5496
|
padding: "8px 0"
|
|
5995
5497
|
},
|
|
5996
|
-
children: /* @__PURE__ */
|
|
5498
|
+
children: /* @__PURE__ */ jsxs22(Text23, { size: 2, children: [
|
|
5997
5499
|
confIcon,
|
|
5998
5500
|
" ",
|
|
5999
5501
|
gap.confidence
|
|
@@ -6005,32 +5507,32 @@ function RecommendationRow({
|
|
|
6005
5507
|
|
|
6006
5508
|
// src/components/report-detail/ReportHeader.tsx
|
|
6007
5509
|
import { ArrowLeftIcon } from "@sanity/icons";
|
|
6008
|
-
import { Badge as
|
|
5510
|
+
import { Badge as Badge10, Button as Button4, Flex as Flex19, Stack as Stack20, Text as Text25 } from "@sanity/ui";
|
|
6009
5511
|
|
|
6010
5512
|
// src/components/report-detail/report-actions/ReportActions.tsx
|
|
6011
5513
|
import { ChevronDownIcon, CopyIcon as CopyIcon2 } from "@sanity/icons";
|
|
6012
5514
|
import {
|
|
6013
5515
|
Button as Button3,
|
|
6014
|
-
Flex as
|
|
6015
|
-
Menu
|
|
6016
|
-
MenuButton
|
|
5516
|
+
Flex as Flex18,
|
|
5517
|
+
Menu,
|
|
5518
|
+
MenuButton,
|
|
6017
5519
|
MenuDivider,
|
|
6018
5520
|
useToast as useToast7
|
|
6019
5521
|
} from "@sanity/ui";
|
|
6020
|
-
import { useCallback as
|
|
6021
|
-
import { useClient as
|
|
5522
|
+
import { useCallback as useCallback16, useState as useState11 } from "react";
|
|
5523
|
+
import { useClient as useClient9 } from "sanity";
|
|
6022
5524
|
|
|
6023
5525
|
// src/components/report-detail/report-actions/CopyReportAction.tsx
|
|
6024
5526
|
import { ClipboardIcon } from "@sanity/icons";
|
|
6025
|
-
import { MenuItem
|
|
6026
|
-
import { useCallback as
|
|
6027
|
-
import { useClient as
|
|
6028
|
-
import { jsx as
|
|
5527
|
+
import { MenuItem, useToast as useToast2 } from "@sanity/ui";
|
|
5528
|
+
import { useCallback as useCallback11, useState as useState8 } from "react";
|
|
5529
|
+
import { useClient as useClient6 } from "sanity";
|
|
5530
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
6029
5531
|
function CopyReportAction({ documentId }) {
|
|
6030
|
-
const client =
|
|
5532
|
+
const client = useClient6({ apiVersion: API_VERSION });
|
|
6031
5533
|
const toast = useToast2();
|
|
6032
|
-
const [copying, setCopying] =
|
|
6033
|
-
const handleClick =
|
|
5534
|
+
const [copying, setCopying] = useState8(false);
|
|
5535
|
+
const handleClick = useCallback11(async () => {
|
|
6034
5536
|
setCopying(true);
|
|
6035
5537
|
try {
|
|
6036
5538
|
const doc = await client.fetch(
|
|
@@ -6062,8 +5564,8 @@ function CopyReportAction({ documentId }) {
|
|
|
6062
5564
|
setCopying(false);
|
|
6063
5565
|
}
|
|
6064
5566
|
}, [client, documentId, toast]);
|
|
6065
|
-
return /* @__PURE__ */
|
|
6066
|
-
|
|
5567
|
+
return /* @__PURE__ */ jsx28(
|
|
5568
|
+
MenuItem,
|
|
6067
5569
|
{
|
|
6068
5570
|
disabled: copying,
|
|
6069
5571
|
icon: ClipboardIcon,
|
|
@@ -6075,12 +5577,12 @@ function CopyReportAction({ documentId }) {
|
|
|
6075
5577
|
|
|
6076
5578
|
// src/components/report-detail/report-actions/CopyReportIdAction.tsx
|
|
6077
5579
|
import { CopyIcon } from "@sanity/icons";
|
|
6078
|
-
import { MenuItem as
|
|
6079
|
-
import { useCallback as
|
|
6080
|
-
import { jsx as
|
|
5580
|
+
import { MenuItem as MenuItem2, useToast as useToast3 } from "@sanity/ui";
|
|
5581
|
+
import { useCallback as useCallback12 } from "react";
|
|
5582
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
6081
5583
|
function CopyReportIdAction({ reportId }) {
|
|
6082
5584
|
const toast = useToast3();
|
|
6083
|
-
const handleClick =
|
|
5585
|
+
const handleClick = useCallback12(() => {
|
|
6084
5586
|
navigator.clipboard.writeText(reportId).then(
|
|
6085
5587
|
() => {
|
|
6086
5588
|
toast.push({
|
|
@@ -6098,19 +5600,19 @@ function CopyReportIdAction({ reportId }) {
|
|
|
6098
5600
|
}
|
|
6099
5601
|
);
|
|
6100
5602
|
}, [reportId, toast]);
|
|
6101
|
-
return /* @__PURE__ */
|
|
5603
|
+
return /* @__PURE__ */ jsx29(MenuItem2, { icon: CopyIcon, onClick: handleClick, text: "Copy report ID" });
|
|
6102
5604
|
}
|
|
6103
5605
|
|
|
6104
5606
|
// src/components/report-detail/report-actions/CopyVisionQueryAction.tsx
|
|
6105
|
-
import { SearchIcon as
|
|
6106
|
-
import { MenuItem as
|
|
6107
|
-
import { useCallback as
|
|
6108
|
-
import { jsx as
|
|
5607
|
+
import { SearchIcon as SearchIcon4 } from "@sanity/icons";
|
|
5608
|
+
import { MenuItem as MenuItem3, useToast as useToast4 } from "@sanity/ui";
|
|
5609
|
+
import { useCallback as useCallback13 } from "react";
|
|
5610
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
6109
5611
|
function CopyVisionQueryAction({
|
|
6110
5612
|
reportId
|
|
6111
5613
|
}) {
|
|
6112
5614
|
const toast = useToast4();
|
|
6113
|
-
const handleClick =
|
|
5615
|
+
const handleClick = useCallback13(() => {
|
|
6114
5616
|
const query = `*[_type == "ailf.report" && reportId == "${reportId}"][0]`;
|
|
6115
5617
|
navigator.clipboard.writeText(query).then(
|
|
6116
5618
|
() => {
|
|
@@ -6130,10 +5632,10 @@ function CopyVisionQueryAction({
|
|
|
6130
5632
|
}
|
|
6131
5633
|
);
|
|
6132
5634
|
}, [reportId, toast]);
|
|
6133
|
-
return /* @__PURE__ */
|
|
6134
|
-
|
|
5635
|
+
return /* @__PURE__ */ jsx30(
|
|
5636
|
+
MenuItem3,
|
|
6135
5637
|
{
|
|
6136
|
-
icon:
|
|
5638
|
+
icon: SearchIcon4,
|
|
6137
5639
|
onClick: handleClick,
|
|
6138
5640
|
text: "Copy Vision query"
|
|
6139
5641
|
}
|
|
@@ -6141,25 +5643,25 @@ function CopyVisionQueryAction({
|
|
|
6141
5643
|
}
|
|
6142
5644
|
|
|
6143
5645
|
// src/components/report-detail/report-actions/DeleteConfirmDialog.tsx
|
|
6144
|
-
import { Box as
|
|
6145
|
-
import { jsx as
|
|
5646
|
+
import { Box as Box13, Button as Button2, Card as Card17, Dialog, Flex as Flex17, Stack as Stack19, Text as Text24 } from "@sanity/ui";
|
|
5647
|
+
import { jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6146
5648
|
function DeleteConfirmDialog({
|
|
6147
5649
|
isDeleting,
|
|
6148
5650
|
onClose,
|
|
6149
5651
|
onConfirm,
|
|
6150
5652
|
reportId
|
|
6151
5653
|
}) {
|
|
6152
|
-
return /* @__PURE__ */
|
|
5654
|
+
return /* @__PURE__ */ jsx31(
|
|
6153
5655
|
Dialog,
|
|
6154
5656
|
{
|
|
6155
5657
|
header: "Delete Report",
|
|
6156
5658
|
id: "delete-report-dialog",
|
|
6157
5659
|
onClose,
|
|
6158
5660
|
width: 1,
|
|
6159
|
-
children: /* @__PURE__ */
|
|
6160
|
-
/* @__PURE__ */
|
|
6161
|
-
/* @__PURE__ */
|
|
6162
|
-
|
|
5661
|
+
children: /* @__PURE__ */ jsx31(Box13, { padding: 4, children: /* @__PURE__ */ jsxs23(Stack19, { space: 4, children: [
|
|
5662
|
+
/* @__PURE__ */ jsx31(Text24, { children: "Are you sure you want to delete this report? This action cannot be undone." }),
|
|
5663
|
+
/* @__PURE__ */ jsx31(Card17, { border: true, padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ jsx31(
|
|
5664
|
+
Text24,
|
|
6163
5665
|
{
|
|
6164
5666
|
muted: true,
|
|
6165
5667
|
size: 1,
|
|
@@ -6167,8 +5669,8 @@ function DeleteConfirmDialog({
|
|
|
6167
5669
|
children: reportId
|
|
6168
5670
|
}
|
|
6169
5671
|
) }),
|
|
6170
|
-
/* @__PURE__ */
|
|
6171
|
-
/* @__PURE__ */
|
|
5672
|
+
/* @__PURE__ */ jsxs23(Flex17, { gap: 2, justify: "flex-end", children: [
|
|
5673
|
+
/* @__PURE__ */ jsx31(
|
|
6172
5674
|
Button2,
|
|
6173
5675
|
{
|
|
6174
5676
|
disabled: isDeleting,
|
|
@@ -6177,7 +5679,7 @@ function DeleteConfirmDialog({
|
|
|
6177
5679
|
text: "Cancel"
|
|
6178
5680
|
}
|
|
6179
5681
|
),
|
|
6180
|
-
/* @__PURE__ */
|
|
5682
|
+
/* @__PURE__ */ jsx31(
|
|
6181
5683
|
Button2,
|
|
6182
5684
|
{
|
|
6183
5685
|
disabled: isDeleting,
|
|
@@ -6194,13 +5696,13 @@ function DeleteConfirmDialog({
|
|
|
6194
5696
|
|
|
6195
5697
|
// src/components/report-detail/report-actions/DeleteReportAction.tsx
|
|
6196
5698
|
import { TrashIcon } from "@sanity/icons";
|
|
6197
|
-
import { MenuItem as
|
|
6198
|
-
import { jsx as
|
|
5699
|
+
import { MenuItem as MenuItem4 } from "@sanity/ui";
|
|
5700
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
6199
5701
|
function DeleteReportAction({
|
|
6200
5702
|
onRequestDelete
|
|
6201
5703
|
}) {
|
|
6202
|
-
return /* @__PURE__ */
|
|
6203
|
-
|
|
5704
|
+
return /* @__PURE__ */ jsx32(
|
|
5705
|
+
MenuItem4,
|
|
6204
5706
|
{
|
|
6205
5707
|
icon: TrashIcon,
|
|
6206
5708
|
onClick: onRequestDelete,
|
|
@@ -6212,18 +5714,18 @@ function DeleteReportAction({
|
|
|
6212
5714
|
|
|
6213
5715
|
// src/components/report-detail/report-actions/DownloadReportAction.tsx
|
|
6214
5716
|
import { DownloadIcon } from "@sanity/icons";
|
|
6215
|
-
import { MenuItem as
|
|
6216
|
-
import { useCallback as
|
|
6217
|
-
import { useClient as
|
|
6218
|
-
import { jsx as
|
|
5717
|
+
import { MenuItem as MenuItem5, useToast as useToast5 } from "@sanity/ui";
|
|
5718
|
+
import { useCallback as useCallback14, useState as useState9 } from "react";
|
|
5719
|
+
import { useClient as useClient7 } from "sanity";
|
|
5720
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
6219
5721
|
function DownloadReportAction({
|
|
6220
5722
|
documentId,
|
|
6221
5723
|
reportId
|
|
6222
5724
|
}) {
|
|
6223
|
-
const client =
|
|
5725
|
+
const client = useClient7({ apiVersion: API_VERSION });
|
|
6224
5726
|
const toast = useToast5();
|
|
6225
|
-
const [downloading, setDownloading] =
|
|
6226
|
-
const handleClick =
|
|
5727
|
+
const [downloading, setDownloading] = useState9(false);
|
|
5728
|
+
const handleClick = useCallback14(async () => {
|
|
6227
5729
|
setDownloading(true);
|
|
6228
5730
|
try {
|
|
6229
5731
|
const doc = await client.fetch(
|
|
@@ -6263,8 +5765,8 @@ function DownloadReportAction({
|
|
|
6263
5765
|
setDownloading(false);
|
|
6264
5766
|
}
|
|
6265
5767
|
}, [client, documentId, reportId, toast]);
|
|
6266
|
-
return /* @__PURE__ */
|
|
6267
|
-
|
|
5768
|
+
return /* @__PURE__ */ jsx33(
|
|
5769
|
+
MenuItem5,
|
|
6268
5770
|
{
|
|
6269
5771
|
disabled: downloading,
|
|
6270
5772
|
icon: DownloadIcon,
|
|
@@ -6276,9 +5778,9 @@ function DownloadReportAction({
|
|
|
6276
5778
|
|
|
6277
5779
|
// src/components/report-detail/report-actions/RerunEvaluationAction.tsx
|
|
6278
5780
|
import { PlayIcon as PlayIcon2 } from "@sanity/icons";
|
|
6279
|
-
import { MenuItem as
|
|
6280
|
-
import { useCallback as
|
|
6281
|
-
import { useClient as
|
|
5781
|
+
import { MenuItem as MenuItem6, useToast as useToast6 } from "@sanity/ui";
|
|
5782
|
+
import { useCallback as useCallback15, useState as useState10 } from "react";
|
|
5783
|
+
import { useClient as useClient8, useCurrentUser as useCurrentUser2 } from "sanity";
|
|
6282
5784
|
|
|
6283
5785
|
// src/lib/eval-scope.ts
|
|
6284
5786
|
function extractEvalScope(provenance) {
|
|
@@ -6293,7 +5795,7 @@ function extractEvalScope(provenance) {
|
|
|
6293
5795
|
}
|
|
6294
5796
|
|
|
6295
5797
|
// src/components/report-detail/report-actions/RerunEvaluationAction.tsx
|
|
6296
|
-
import { jsx as
|
|
5798
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
6297
5799
|
var EVAL_REQUEST_TYPE2 = "ailf.evalRequest";
|
|
6298
5800
|
function slugify2(s) {
|
|
6299
5801
|
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
|
|
@@ -6329,11 +5831,11 @@ function RerunEvaluationAction({
|
|
|
6329
5831
|
provenance,
|
|
6330
5832
|
reportId
|
|
6331
5833
|
}) {
|
|
6332
|
-
const client =
|
|
5834
|
+
const client = useClient8({ apiVersion: API_VERSION });
|
|
6333
5835
|
const currentUser = useCurrentUser2();
|
|
6334
5836
|
const toast = useToast6();
|
|
6335
|
-
const [requesting, setRequesting] =
|
|
6336
|
-
const handleClick =
|
|
5837
|
+
const [requesting, setRequesting] = useState10(false);
|
|
5838
|
+
const handleClick = useCallback15(async () => {
|
|
6337
5839
|
setRequesting(true);
|
|
6338
5840
|
try {
|
|
6339
5841
|
const scope = extractEvalScope(provenance);
|
|
@@ -6360,8 +5862,8 @@ function RerunEvaluationAction({
|
|
|
6360
5862
|
setRequesting(false);
|
|
6361
5863
|
}
|
|
6362
5864
|
}, [client, currentUser?.id, provenance, reportId, toast]);
|
|
6363
|
-
return /* @__PURE__ */
|
|
6364
|
-
|
|
5865
|
+
return /* @__PURE__ */ jsx34(
|
|
5866
|
+
MenuItem6,
|
|
6365
5867
|
{
|
|
6366
5868
|
disabled: requesting,
|
|
6367
5869
|
icon: PlayIcon2,
|
|
@@ -6372,16 +5874,16 @@ function RerunEvaluationAction({
|
|
|
6372
5874
|
}
|
|
6373
5875
|
|
|
6374
5876
|
// src/components/report-detail/report-actions/ReportActions.tsx
|
|
6375
|
-
import { Fragment as
|
|
5877
|
+
import { Fragment as Fragment7, jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6376
5878
|
function ReportActions({
|
|
6377
5879
|
documentId,
|
|
6378
5880
|
onDeleted,
|
|
6379
5881
|
provenance,
|
|
6380
5882
|
reportId
|
|
6381
5883
|
}) {
|
|
6382
|
-
const client =
|
|
5884
|
+
const client = useClient9({ apiVersion: API_VERSION });
|
|
6383
5885
|
const toast = useToast7();
|
|
6384
|
-
const handleCopyId =
|
|
5886
|
+
const handleCopyId = useCallback16(() => {
|
|
6385
5887
|
navigator.clipboard.writeText(reportId).then(
|
|
6386
5888
|
() => {
|
|
6387
5889
|
toast.push({
|
|
@@ -6399,15 +5901,15 @@ function ReportActions({
|
|
|
6399
5901
|
}
|
|
6400
5902
|
);
|
|
6401
5903
|
}, [reportId, toast]);
|
|
6402
|
-
const [deleteDialogOpen, setDeleteDialogOpen] =
|
|
6403
|
-
const [deleting, setDeleting] =
|
|
6404
|
-
const handleRequestDelete =
|
|
5904
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState11(false);
|
|
5905
|
+
const [deleting, setDeleting] = useState11(false);
|
|
5906
|
+
const handleRequestDelete = useCallback16(() => {
|
|
6405
5907
|
setDeleteDialogOpen(true);
|
|
6406
5908
|
}, []);
|
|
6407
|
-
const handleDeleteClose =
|
|
5909
|
+
const handleDeleteClose = useCallback16(() => {
|
|
6408
5910
|
if (!deleting) setDeleteDialogOpen(false);
|
|
6409
5911
|
}, [deleting]);
|
|
6410
|
-
const handleDeleteConfirm =
|
|
5912
|
+
const handleDeleteConfirm = useCallback16(async () => {
|
|
6411
5913
|
setDeleting(true);
|
|
6412
5914
|
try {
|
|
6413
5915
|
await client.delete(documentId);
|
|
@@ -6428,9 +5930,9 @@ function ReportActions({
|
|
|
6428
5930
|
setDeleting(false);
|
|
6429
5931
|
}
|
|
6430
5932
|
}, [client, documentId, onDeleted, toast]);
|
|
6431
|
-
return /* @__PURE__ */
|
|
6432
|
-
/* @__PURE__ */
|
|
6433
|
-
/* @__PURE__ */
|
|
5933
|
+
return /* @__PURE__ */ jsxs24(Fragment7, { children: [
|
|
5934
|
+
/* @__PURE__ */ jsxs24(Flex18, { children: [
|
|
5935
|
+
/* @__PURE__ */ jsx35(
|
|
6434
5936
|
Button3,
|
|
6435
5937
|
{
|
|
6436
5938
|
icon: CopyIcon2,
|
|
@@ -6444,10 +5946,10 @@ function ReportActions({
|
|
|
6444
5946
|
text: "Copy Report ID"
|
|
6445
5947
|
}
|
|
6446
5948
|
),
|
|
6447
|
-
/* @__PURE__ */
|
|
6448
|
-
|
|
5949
|
+
/* @__PURE__ */ jsx35(
|
|
5950
|
+
MenuButton,
|
|
6449
5951
|
{
|
|
6450
|
-
button: /* @__PURE__ */
|
|
5952
|
+
button: /* @__PURE__ */ jsx35(
|
|
6451
5953
|
Button3,
|
|
6452
5954
|
{
|
|
6453
5955
|
icon: ChevronDownIcon,
|
|
@@ -6460,33 +5962,33 @@ function ReportActions({
|
|
|
6460
5962
|
}
|
|
6461
5963
|
),
|
|
6462
5964
|
id: "report-actions-menu",
|
|
6463
|
-
menu: /* @__PURE__ */
|
|
6464
|
-
/* @__PURE__ */
|
|
6465
|
-
/* @__PURE__ */
|
|
5965
|
+
menu: /* @__PURE__ */ jsxs24(Menu, { children: [
|
|
5966
|
+
/* @__PURE__ */ jsx35(CopyReportIdAction, { reportId }),
|
|
5967
|
+
/* @__PURE__ */ jsx35(
|
|
6466
5968
|
RerunEvaluationAction,
|
|
6467
5969
|
{
|
|
6468
5970
|
provenance,
|
|
6469
5971
|
reportId
|
|
6470
5972
|
}
|
|
6471
5973
|
),
|
|
6472
|
-
/* @__PURE__ */
|
|
6473
|
-
/* @__PURE__ */
|
|
5974
|
+
/* @__PURE__ */ jsx35(MenuDivider, {}),
|
|
5975
|
+
/* @__PURE__ */ jsx35(
|
|
6474
5976
|
DownloadReportAction,
|
|
6475
5977
|
{
|
|
6476
5978
|
documentId,
|
|
6477
5979
|
reportId
|
|
6478
5980
|
}
|
|
6479
5981
|
),
|
|
6480
|
-
/* @__PURE__ */
|
|
6481
|
-
/* @__PURE__ */
|
|
6482
|
-
/* @__PURE__ */
|
|
6483
|
-
/* @__PURE__ */
|
|
5982
|
+
/* @__PURE__ */ jsx35(CopyReportAction, { documentId }),
|
|
5983
|
+
/* @__PURE__ */ jsx35(CopyVisionQueryAction, { reportId }),
|
|
5984
|
+
/* @__PURE__ */ jsx35(MenuDivider, {}),
|
|
5985
|
+
/* @__PURE__ */ jsx35(DeleteReportAction, { onRequestDelete: handleRequestDelete })
|
|
6484
5986
|
] }),
|
|
6485
5987
|
popover: { placement: "bottom-end", portal: true }
|
|
6486
5988
|
}
|
|
6487
5989
|
)
|
|
6488
5990
|
] }),
|
|
6489
|
-
deleteDialogOpen && /* @__PURE__ */
|
|
5991
|
+
deleteDialogOpen && /* @__PURE__ */ jsx35(
|
|
6490
5992
|
DeleteConfirmDialog,
|
|
6491
5993
|
{
|
|
6492
5994
|
isDeleting: deleting,
|
|
@@ -6499,7 +6001,7 @@ function ReportActions({
|
|
|
6499
6001
|
}
|
|
6500
6002
|
|
|
6501
6003
|
// src/components/report-detail/ReportHeader.tsx
|
|
6502
|
-
import { jsx as
|
|
6004
|
+
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6503
6005
|
function ReportHeader({
|
|
6504
6006
|
completedAt,
|
|
6505
6007
|
documentId,
|
|
@@ -6514,16 +6016,16 @@ function ReportHeader({
|
|
|
6514
6016
|
const dateLabel = formatCardDate(completedAt);
|
|
6515
6017
|
const title = tag ?? dateLabel;
|
|
6516
6018
|
const hasTag = Boolean(tag);
|
|
6517
|
-
return /* @__PURE__ */
|
|
6518
|
-
/* @__PURE__ */
|
|
6519
|
-
/* @__PURE__ */
|
|
6520
|
-
/* @__PURE__ */
|
|
6521
|
-
hasTag && /* @__PURE__ */
|
|
6019
|
+
return /* @__PURE__ */ jsxs25(Flex19, { align: "center", gap: 3, children: [
|
|
6020
|
+
/* @__PURE__ */ jsx36(Button4, { icon: ArrowLeftIcon, mode: "bleed", onClick: onBack, text: "Back" }),
|
|
6021
|
+
/* @__PURE__ */ jsxs25(Stack20, { flex: 1, space: 1, children: [
|
|
6022
|
+
/* @__PURE__ */ jsx36(Text25, { size: 4, weight: "bold", children: title }),
|
|
6023
|
+
hasTag && /* @__PURE__ */ jsx36(Text25, { muted: true, size: 2, children: dateLabel })
|
|
6522
6024
|
] }),
|
|
6523
|
-
/* @__PURE__ */
|
|
6524
|
-
/* @__PURE__ */
|
|
6525
|
-
/* @__PURE__ */
|
|
6526
|
-
/* @__PURE__ */
|
|
6025
|
+
/* @__PURE__ */ jsxs25(Flex19, { align: "center", gap: 2, children: [
|
|
6026
|
+
/* @__PURE__ */ jsx36(Badge10, { mode: "outline", tone: "default", children: sourceName }),
|
|
6027
|
+
/* @__PURE__ */ jsx36(Badge10, { tone: "primary", children: mode }),
|
|
6028
|
+
/* @__PURE__ */ jsx36(
|
|
6527
6029
|
ReportActions,
|
|
6528
6030
|
{
|
|
6529
6031
|
documentId,
|
|
@@ -6538,18 +6040,18 @@ function ReportHeader({
|
|
|
6538
6040
|
|
|
6539
6041
|
// src/components/report-detail/ThreeLayerTable.tsx
|
|
6540
6042
|
import React5 from "react";
|
|
6541
|
-
import { Badge as
|
|
6542
|
-
import { jsx as
|
|
6043
|
+
import { Badge as Badge11, Card as Card18, Flex as Flex20, Stack as Stack21, Text as Text26 } from "@sanity/ui";
|
|
6044
|
+
import { jsx as jsx37, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6543
6045
|
function ThreeLayerTable({ scores }) {
|
|
6544
6046
|
const filtered = scores.filter((s) => s.actualScore != null);
|
|
6545
6047
|
if (filtered.length === 0) return null;
|
|
6546
6048
|
const hasInverted = filtered.some((s) => s.invertedRetrievalGap);
|
|
6547
|
-
return /* @__PURE__ */
|
|
6548
|
-
/* @__PURE__ */
|
|
6549
|
-
/* @__PURE__ */
|
|
6550
|
-
/* @__PURE__ */
|
|
6049
|
+
return /* @__PURE__ */ jsx37(Card18, { overflow: "auto", padding: 4, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxs26(Stack21, { space: 4, children: [
|
|
6050
|
+
/* @__PURE__ */ jsxs26(Flex20, { align: "center", gap: 3, children: [
|
|
6051
|
+
/* @__PURE__ */ jsx37(Text26, { size: 3, weight: "semibold", children: "Three-Layer Decomposition" }),
|
|
6052
|
+
/* @__PURE__ */ jsx37(Badge11, { tone: "primary", children: "full mode" })
|
|
6551
6053
|
] }),
|
|
6552
|
-
/* @__PURE__ */
|
|
6054
|
+
/* @__PURE__ */ jsxs26(
|
|
6553
6055
|
"div",
|
|
6554
6056
|
{
|
|
6555
6057
|
style: {
|
|
@@ -6558,9 +6060,9 @@ function ThreeLayerTable({ scores }) {
|
|
|
6558
6060
|
gridTemplateColumns: "2fr 1fr 1fr 1fr 1fr 1fr"
|
|
6559
6061
|
},
|
|
6560
6062
|
children: [
|
|
6561
|
-
/* @__PURE__ */
|
|
6562
|
-
/* @__PURE__ */
|
|
6563
|
-
/* @__PURE__ */
|
|
6063
|
+
/* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "Area" }),
|
|
6064
|
+
/* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "Floor", tooltip: GLOSSARY.floor }),
|
|
6065
|
+
/* @__PURE__ */ jsx37(
|
|
6564
6066
|
ColumnHeader,
|
|
6565
6067
|
{
|
|
6566
6068
|
borderBottom: true,
|
|
@@ -6568,8 +6070,8 @@ function ThreeLayerTable({ scores }) {
|
|
|
6568
6070
|
tooltip: GLOSSARY.ceiling
|
|
6569
6071
|
}
|
|
6570
6072
|
),
|
|
6571
|
-
/* @__PURE__ */
|
|
6572
|
-
/* @__PURE__ */
|
|
6073
|
+
/* @__PURE__ */ jsx37(ColumnHeader, { borderBottom: true, label: "Actual", tooltip: GLOSSARY.actual }),
|
|
6074
|
+
/* @__PURE__ */ jsx37(
|
|
6573
6075
|
ColumnHeader,
|
|
6574
6076
|
{
|
|
6575
6077
|
borderBottom: true,
|
|
@@ -6577,7 +6079,7 @@ function ThreeLayerTable({ scores }) {
|
|
|
6577
6079
|
tooltip: GLOSSARY.retGap
|
|
6578
6080
|
}
|
|
6579
6081
|
),
|
|
6580
|
-
/* @__PURE__ */
|
|
6082
|
+
/* @__PURE__ */ jsx37(
|
|
6581
6083
|
ColumnHeader,
|
|
6582
6084
|
{
|
|
6583
6085
|
borderBottom: true,
|
|
@@ -6585,8 +6087,8 @@ function ThreeLayerTable({ scores }) {
|
|
|
6585
6087
|
tooltip: GLOSSARY.efficiency
|
|
6586
6088
|
}
|
|
6587
6089
|
),
|
|
6588
|
-
filtered.map((score, i) => /* @__PURE__ */
|
|
6589
|
-
/* @__PURE__ */
|
|
6090
|
+
filtered.map((score, i) => /* @__PURE__ */ jsxs26(React5.Fragment, { children: [
|
|
6091
|
+
/* @__PURE__ */ jsx37(
|
|
6590
6092
|
"div",
|
|
6591
6093
|
{
|
|
6592
6094
|
style: {
|
|
@@ -6594,10 +6096,10 @@ function ThreeLayerTable({ scores }) {
|
|
|
6594
6096
|
borderRadius: 4,
|
|
6595
6097
|
padding: "8px 0 8px 4px"
|
|
6596
6098
|
},
|
|
6597
|
-
children: /* @__PURE__ */
|
|
6099
|
+
children: /* @__PURE__ */ jsx37(Text26, { size: 2, weight: "medium", children: score.feature })
|
|
6598
6100
|
}
|
|
6599
6101
|
),
|
|
6600
|
-
/* @__PURE__ */
|
|
6102
|
+
/* @__PURE__ */ jsx37(
|
|
6601
6103
|
"div",
|
|
6602
6104
|
{
|
|
6603
6105
|
style: {
|
|
@@ -6605,10 +6107,10 @@ function ThreeLayerTable({ scores }) {
|
|
|
6605
6107
|
display: "flex",
|
|
6606
6108
|
padding: "2px 0"
|
|
6607
6109
|
},
|
|
6608
|
-
children: /* @__PURE__ */
|
|
6110
|
+
children: /* @__PURE__ */ jsx37(ScoreCell, { score: score.floorScore ?? 0 })
|
|
6609
6111
|
}
|
|
6610
6112
|
),
|
|
6611
|
-
/* @__PURE__ */
|
|
6113
|
+
/* @__PURE__ */ jsx37(
|
|
6612
6114
|
"div",
|
|
6613
6115
|
{
|
|
6614
6116
|
style: {
|
|
@@ -6616,10 +6118,10 @@ function ThreeLayerTable({ scores }) {
|
|
|
6616
6118
|
display: "flex",
|
|
6617
6119
|
padding: "2px 0"
|
|
6618
6120
|
},
|
|
6619
|
-
children: /* @__PURE__ */
|
|
6121
|
+
children: /* @__PURE__ */ jsx37(ScoreCell, { score: score.ceilingScore ?? score.totalScore })
|
|
6620
6122
|
}
|
|
6621
6123
|
),
|
|
6622
|
-
/* @__PURE__ */
|
|
6124
|
+
/* @__PURE__ */ jsx37(
|
|
6623
6125
|
"div",
|
|
6624
6126
|
{
|
|
6625
6127
|
style: {
|
|
@@ -6627,10 +6129,10 @@ function ThreeLayerTable({ scores }) {
|
|
|
6627
6129
|
display: "flex",
|
|
6628
6130
|
padding: "2px 0"
|
|
6629
6131
|
},
|
|
6630
|
-
children: /* @__PURE__ */
|
|
6132
|
+
children: /* @__PURE__ */ jsx37(ScoreCell, { score: score.actualScore ?? 0 })
|
|
6631
6133
|
}
|
|
6632
6134
|
),
|
|
6633
|
-
/* @__PURE__ */
|
|
6135
|
+
/* @__PURE__ */ jsx37(
|
|
6634
6136
|
"div",
|
|
6635
6137
|
{
|
|
6636
6138
|
style: {
|
|
@@ -6639,10 +6141,10 @@ function ThreeLayerTable({ scores }) {
|
|
|
6639
6141
|
display: "flex",
|
|
6640
6142
|
padding: "6px 0"
|
|
6641
6143
|
},
|
|
6642
|
-
children: /* @__PURE__ */
|
|
6144
|
+
children: /* @__PURE__ */ jsx37(Text26, { size: 2, children: score.retrievalGap != null ? score.retrievalGap.toFixed(1) : "\u2014" })
|
|
6643
6145
|
}
|
|
6644
6146
|
),
|
|
6645
|
-
/* @__PURE__ */
|
|
6147
|
+
/* @__PURE__ */ jsx37(
|
|
6646
6148
|
"div",
|
|
6647
6149
|
{
|
|
6648
6150
|
style: {
|
|
@@ -6651,7 +6153,7 @@ function ThreeLayerTable({ scores }) {
|
|
|
6651
6153
|
display: "flex",
|
|
6652
6154
|
padding: "6px 0"
|
|
6653
6155
|
},
|
|
6654
|
-
children: /* @__PURE__ */
|
|
6156
|
+
children: /* @__PURE__ */ jsxs26(Text26, { size: 2, children: [
|
|
6655
6157
|
formatPercent(score.infrastructureEfficiency),
|
|
6656
6158
|
score.invertedRetrievalGap && " \u26A0\uFE0F"
|
|
6657
6159
|
] })
|
|
@@ -6661,12 +6163,12 @@ function ThreeLayerTable({ scores }) {
|
|
|
6661
6163
|
]
|
|
6662
6164
|
}
|
|
6663
6165
|
),
|
|
6664
|
-
hasInverted && /* @__PURE__ */
|
|
6166
|
+
hasInverted && /* @__PURE__ */ jsx37(Text26, { muted: true, size: 1, children: GLOSSARY.invertedRetGap })
|
|
6665
6167
|
] }) });
|
|
6666
6168
|
}
|
|
6667
6169
|
|
|
6668
6170
|
// src/components/report-detail/ReportDetail.tsx
|
|
6669
|
-
import { jsx as
|
|
6171
|
+
import { jsx as jsx38, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6670
6172
|
var OVERVIEW_TAB = { id: "overview", label: "Overview" };
|
|
6671
6173
|
var DIAGNOSTICS_TAB = { id: "diagnostics", label: "Diagnostics" };
|
|
6672
6174
|
var ACTIVITY_TAB = { id: "activity", label: "Agent Activity" };
|
|
@@ -6680,10 +6182,10 @@ function ReportDetail({
|
|
|
6680
6182
|
onTabChange,
|
|
6681
6183
|
reportId
|
|
6682
6184
|
}) {
|
|
6683
|
-
const client =
|
|
6684
|
-
const [loading, setLoading] =
|
|
6685
|
-
const [report, setReport] =
|
|
6686
|
-
|
|
6185
|
+
const client = useClient10({ apiVersion: API_VERSION });
|
|
6186
|
+
const [loading, setLoading] = useState12(true);
|
|
6187
|
+
const [report, setReport] = useState12(null);
|
|
6188
|
+
useEffect6(() => {
|
|
6687
6189
|
let cancelled = false;
|
|
6688
6190
|
setLoading(true);
|
|
6689
6191
|
client.fetch(reportDetailQuery, { reportId }).then((data) => {
|
|
@@ -6705,33 +6207,33 @@ function ReportDetail({
|
|
|
6705
6207
|
const hasAgentActivity = Boolean(
|
|
6706
6208
|
summary?.agentBehavior && summary.agentBehavior.length > 0
|
|
6707
6209
|
);
|
|
6708
|
-
const tabs =
|
|
6210
|
+
const tabs = useMemo6(
|
|
6709
6211
|
() => [OVERVIEW_TAB, DIAGNOSTICS_TAB, ACTIVITY_TAB],
|
|
6710
6212
|
[]
|
|
6711
6213
|
);
|
|
6712
|
-
const disabledTabs =
|
|
6214
|
+
const disabledTabs = useMemo6(() => {
|
|
6713
6215
|
const set2 = /* @__PURE__ */ new Set();
|
|
6714
6216
|
if (!hasDiagnostics) set2.add("diagnostics");
|
|
6715
6217
|
if (!hasAgentActivity) set2.add("activity");
|
|
6716
6218
|
return set2;
|
|
6717
6219
|
}, [hasDiagnostics, hasAgentActivity]);
|
|
6718
|
-
const currentTab =
|
|
6220
|
+
const currentTab = useMemo6(() => {
|
|
6719
6221
|
const parsed = parseTab(activeTab);
|
|
6720
6222
|
if (disabledTabs.has(parsed)) return "overview";
|
|
6721
6223
|
return tabs.some((t) => t.id === parsed) ? parsed : "overview";
|
|
6722
6224
|
}, [activeTab, disabledTabs, tabs]);
|
|
6723
|
-
const handleTabClick =
|
|
6225
|
+
const handleTabClick = useCallback17(
|
|
6724
6226
|
(tabId) => {
|
|
6725
6227
|
onTabChange(tabId === "overview" ? null : tabId);
|
|
6726
6228
|
},
|
|
6727
6229
|
[onTabChange]
|
|
6728
6230
|
);
|
|
6729
6231
|
if (loading) {
|
|
6730
|
-
return /* @__PURE__ */
|
|
6232
|
+
return /* @__PURE__ */ jsx38(LoadingState, { message: "Loading report\u2026" });
|
|
6731
6233
|
}
|
|
6732
6234
|
if (!report || !summary) {
|
|
6733
|
-
return /* @__PURE__ */
|
|
6734
|
-
/* @__PURE__ */
|
|
6235
|
+
return /* @__PURE__ */ jsx38(Box14, { padding: 5, children: /* @__PURE__ */ jsxs27(Stack22, { space: 4, children: [
|
|
6236
|
+
/* @__PURE__ */ jsx38(
|
|
6735
6237
|
Button5,
|
|
6736
6238
|
{
|
|
6737
6239
|
icon: ArrowLeftIcon2,
|
|
@@ -6740,14 +6242,14 @@ function ReportDetail({
|
|
|
6740
6242
|
text: "Back"
|
|
6741
6243
|
}
|
|
6742
6244
|
),
|
|
6743
|
-
/* @__PURE__ */
|
|
6245
|
+
/* @__PURE__ */ jsx38(Text27, { align: "center", muted: true, size: 3, children: "Report not found" })
|
|
6744
6246
|
] }) });
|
|
6745
6247
|
}
|
|
6746
6248
|
const { comparison, provenance } = report;
|
|
6747
6249
|
const totalTests = summary.scores.reduce((n, s) => n + s.testCount, 0);
|
|
6748
6250
|
const isFullMode = summary.evaluationMode === "full" || summary.scores.some((s) => s.actualScore != null);
|
|
6749
|
-
return /* @__PURE__ */
|
|
6750
|
-
/* @__PURE__ */
|
|
6251
|
+
return /* @__PURE__ */ jsx38(Box14, { padding: 4, children: /* @__PURE__ */ jsxs27(Stack22, { space: 5, children: [
|
|
6252
|
+
/* @__PURE__ */ jsx38(
|
|
6751
6253
|
ReportHeader,
|
|
6752
6254
|
{
|
|
6753
6255
|
completedAt: report.completedAt,
|
|
@@ -6761,10 +6263,10 @@ function ReportDetail({
|
|
|
6761
6263
|
tag: report.tag
|
|
6762
6264
|
}
|
|
6763
6265
|
),
|
|
6764
|
-
/* @__PURE__ */
|
|
6266
|
+
/* @__PURE__ */ jsx38(TabList, { space: 1, children: tabs.map((tab) => {
|
|
6765
6267
|
const isDisabled = disabledTabs.has(tab.id);
|
|
6766
6268
|
const tooltip = getDisabledTabTooltip(tab.id, summary);
|
|
6767
|
-
const tabElement = /* @__PURE__ */
|
|
6269
|
+
const tabElement = /* @__PURE__ */ jsx38(
|
|
6768
6270
|
Tab,
|
|
6769
6271
|
{
|
|
6770
6272
|
"aria-controls": `panel-${tab.id}`,
|
|
@@ -6775,25 +6277,25 @@ function ReportDetail({
|
|
|
6775
6277
|
selected: currentTab === tab.id
|
|
6776
6278
|
}
|
|
6777
6279
|
);
|
|
6778
|
-
return isDisabled && tooltip ? /* @__PURE__ */
|
|
6280
|
+
return isDisabled && tooltip ? /* @__PURE__ */ jsx38(
|
|
6779
6281
|
Tooltip8,
|
|
6780
6282
|
{
|
|
6781
|
-
content: /* @__PURE__ */
|
|
6283
|
+
content: /* @__PURE__ */ jsx38(Box14, { padding: 2, style: { maxWidth: 280 }, children: tooltip }),
|
|
6782
6284
|
placement: "bottom",
|
|
6783
6285
|
portal: true,
|
|
6784
|
-
children: /* @__PURE__ */
|
|
6286
|
+
children: /* @__PURE__ */ jsx38("span", { style: { display: "inline-block" }, children: tabElement })
|
|
6785
6287
|
},
|
|
6786
6288
|
tab.id
|
|
6787
|
-
) : /* @__PURE__ */
|
|
6289
|
+
) : /* @__PURE__ */ jsx38("span", { children: tabElement }, tab.id);
|
|
6788
6290
|
}) }),
|
|
6789
|
-
currentTab === "overview" && /* @__PURE__ */
|
|
6291
|
+
currentTab === "overview" && /* @__PURE__ */ jsx38(
|
|
6790
6292
|
TabPanel,
|
|
6791
6293
|
{
|
|
6792
6294
|
"aria-labelledby": "tab-overview",
|
|
6793
6295
|
hidden: currentTab !== "overview",
|
|
6794
6296
|
id: "panel-overview",
|
|
6795
|
-
children: /* @__PURE__ */
|
|
6796
|
-
/* @__PURE__ */
|
|
6297
|
+
children: /* @__PURE__ */ jsxs27(Stack22, { space: 5, children: [
|
|
6298
|
+
/* @__PURE__ */ jsx38(
|
|
6797
6299
|
OverviewStats,
|
|
6798
6300
|
{
|
|
6799
6301
|
durationMs: report.durationMs,
|
|
@@ -6802,38 +6304,38 @@ function ReportDetail({
|
|
|
6802
6304
|
totalTests
|
|
6803
6305
|
}
|
|
6804
6306
|
),
|
|
6805
|
-
isFullMode && /* @__PURE__ */
|
|
6806
|
-
/* @__PURE__ */
|
|
6807
|
-
comparison && /* @__PURE__ */
|
|
6808
|
-
/* @__PURE__ */
|
|
6809
|
-
/* @__PURE__ */
|
|
6307
|
+
isFullMode && /* @__PURE__ */ jsx38(ThreeLayerTable, { scores: summary.scores }),
|
|
6308
|
+
/* @__PURE__ */ jsx38(AreaScoreTable, { scores: summary.scores }),
|
|
6309
|
+
comparison && /* @__PURE__ */ jsx38(ComparisonSummary, { comparison }),
|
|
6310
|
+
/* @__PURE__ */ jsx38(LineageCard, { provenance, reportId: report.reportId }),
|
|
6311
|
+
/* @__PURE__ */ jsx38(ProvenanceCard, { provenance })
|
|
6810
6312
|
] })
|
|
6811
6313
|
}
|
|
6812
6314
|
),
|
|
6813
|
-
currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */
|
|
6315
|
+
currentTab === "diagnostics" && hasDiagnostics && /* @__PURE__ */ jsx38(
|
|
6814
6316
|
TabPanel,
|
|
6815
6317
|
{
|
|
6816
6318
|
"aria-labelledby": "tab-diagnostics",
|
|
6817
6319
|
hidden: currentTab !== "diagnostics",
|
|
6818
6320
|
id: "panel-diagnostics",
|
|
6819
|
-
children: /* @__PURE__ */
|
|
6820
|
-
summary.recommendations && summary.recommendations.gaps.length > 0 && /* @__PURE__ */
|
|
6321
|
+
children: /* @__PURE__ */ jsxs27(Stack22, { space: 5, children: [
|
|
6322
|
+
summary.recommendations && summary.recommendations.gaps.length > 0 && /* @__PURE__ */ jsx38(
|
|
6821
6323
|
RecommendationsSection,
|
|
6822
6324
|
{
|
|
6823
6325
|
recommendations: summary.recommendations
|
|
6824
6326
|
}
|
|
6825
6327
|
),
|
|
6826
|
-
summary.lowScoringJudgments && summary.lowScoringJudgments.length > 0 && /* @__PURE__ */
|
|
6328
|
+
summary.lowScoringJudgments && summary.lowScoringJudgments.length > 0 && /* @__PURE__ */ jsx38(JudgmentList, { judgments: summary.lowScoringJudgments })
|
|
6827
6329
|
] })
|
|
6828
6330
|
}
|
|
6829
6331
|
),
|
|
6830
|
-
currentTab === "activity" && hasAgentActivity && /* @__PURE__ */
|
|
6332
|
+
currentTab === "activity" && hasAgentActivity && /* @__PURE__ */ jsx38(
|
|
6831
6333
|
TabPanel,
|
|
6832
6334
|
{
|
|
6833
6335
|
"aria-labelledby": "tab-activity",
|
|
6834
6336
|
hidden: currentTab !== "activity",
|
|
6835
6337
|
id: "panel-activity",
|
|
6836
|
-
children: /* @__PURE__ */
|
|
6338
|
+
children: /* @__PURE__ */ jsx38(
|
|
6837
6339
|
AgentActivitySection,
|
|
6838
6340
|
{
|
|
6839
6341
|
agentBehavior: summary.agentBehavior,
|
|
@@ -6855,27 +6357,27 @@ function getDisabledTabTooltip(tabId, summary) {
|
|
|
6855
6357
|
if (!summary) return null;
|
|
6856
6358
|
switch (tabId) {
|
|
6857
6359
|
case "diagnostics":
|
|
6858
|
-
return /* @__PURE__ */
|
|
6360
|
+
return /* @__PURE__ */ jsx38(Text27, { muted: true, size: 2, children: "No diagnostic data available. Diagnostics require low-scoring judgments or gap analysis recommendations." });
|
|
6859
6361
|
case "activity":
|
|
6860
|
-
return summary.evaluationMode === "baseline" ? /* @__PURE__ */
|
|
6362
|
+
return summary.evaluationMode === "baseline" ? /* @__PURE__ */ jsxs27(Text27, { muted: true, size: 2, children: [
|
|
6861
6363
|
"Not available for baseline-only evaluations. Run with",
|
|
6862
6364
|
" ",
|
|
6863
|
-
/* @__PURE__ */
|
|
6365
|
+
/* @__PURE__ */ jsx38("code", { style: inlineCodeStyle, children: "--mode full" }),
|
|
6864
6366
|
" or",
|
|
6865
6367
|
" ",
|
|
6866
|
-
/* @__PURE__ */
|
|
6368
|
+
/* @__PURE__ */ jsx38("code", { style: inlineCodeStyle, children: "--mode agentic" }),
|
|
6867
6369
|
" to capture agent browsing behavior."
|
|
6868
|
-
] }) : /* @__PURE__ */
|
|
6370
|
+
] }) : /* @__PURE__ */ jsx38(Text27, { muted: true, size: 2, children: "No agent activity data was recorded for this evaluation." });
|
|
6869
6371
|
default:
|
|
6870
6372
|
return null;
|
|
6871
6373
|
}
|
|
6872
6374
|
}
|
|
6873
6375
|
|
|
6874
6376
|
// src/components/ScoreTimeline.tsx
|
|
6875
|
-
import { Card as
|
|
6876
|
-
import { useCallback as
|
|
6877
|
-
import { useClient as
|
|
6878
|
-
import { jsx as
|
|
6377
|
+
import { Card as Card19, Flex as Flex21, Select as Select2, Stack as Stack23, Text as Text28 } from "@sanity/ui";
|
|
6378
|
+
import { useCallback as useCallback18, useEffect as useEffect7, useMemo as useMemo7, useState as useState13 } from "react";
|
|
6379
|
+
import { useClient as useClient11 } from "sanity";
|
|
6380
|
+
import { jsx as jsx39, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6879
6381
|
var CHART_HEIGHT = 220;
|
|
6880
6382
|
var CHART_WIDTH = 800;
|
|
6881
6383
|
var PAD_BOTTOM = 30;
|
|
@@ -6897,7 +6399,7 @@ function daysAgo(n) {
|
|
|
6897
6399
|
d.setDate(d.getDate() - n);
|
|
6898
6400
|
return d.toISOString();
|
|
6899
6401
|
}
|
|
6900
|
-
function
|
|
6402
|
+
function formatDate(iso) {
|
|
6901
6403
|
return new Date(iso).toLocaleDateString(void 0, {
|
|
6902
6404
|
day: "numeric",
|
|
6903
6405
|
month: "short"
|
|
@@ -6909,12 +6411,12 @@ function scoreForPoint(point, area) {
|
|
|
6909
6411
|
return match?.totalScore ?? null;
|
|
6910
6412
|
}
|
|
6911
6413
|
function ScoreTimeline({ mode = null, source = null }) {
|
|
6912
|
-
const client =
|
|
6913
|
-
const [dataPoints, setDataPoints] =
|
|
6914
|
-
const [loading, setLoading] =
|
|
6915
|
-
const [rangeDays, setRangeDays] =
|
|
6916
|
-
const [selectedArea, setSelectedArea] =
|
|
6917
|
-
const areaNames =
|
|
6414
|
+
const client = useClient11({ apiVersion: API_VERSION });
|
|
6415
|
+
const [dataPoints, setDataPoints] = useState13([]);
|
|
6416
|
+
const [loading, setLoading] = useState13(true);
|
|
6417
|
+
const [rangeDays, setRangeDays] = useState13(30);
|
|
6418
|
+
const [selectedArea, setSelectedArea] = useState13(null);
|
|
6419
|
+
const areaNames = useMemo7(() => {
|
|
6918
6420
|
const names = /* @__PURE__ */ new Set();
|
|
6919
6421
|
for (const dp of dataPoints) {
|
|
6920
6422
|
for (const s of dp.scores) {
|
|
@@ -6923,7 +6425,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6923
6425
|
}
|
|
6924
6426
|
return Array.from(names).sort();
|
|
6925
6427
|
}, [dataPoints]);
|
|
6926
|
-
const fetchData =
|
|
6428
|
+
const fetchData = useCallback18(async () => {
|
|
6927
6429
|
setLoading(true);
|
|
6928
6430
|
try {
|
|
6929
6431
|
const startDate = rangeDays ? daysAgo(rangeDays) : "1970-01-01T00:00:00Z";
|
|
@@ -6938,10 +6440,10 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6938
6440
|
setLoading(false);
|
|
6939
6441
|
}
|
|
6940
6442
|
}, [client, mode, rangeDays, source]);
|
|
6941
|
-
|
|
6443
|
+
useEffect7(() => {
|
|
6942
6444
|
void fetchData();
|
|
6943
6445
|
}, [fetchData]);
|
|
6944
|
-
const chartPoints =
|
|
6446
|
+
const chartPoints = useMemo7(() => {
|
|
6945
6447
|
const pts = [];
|
|
6946
6448
|
const scored = dataPoints.map((dp) => ({
|
|
6947
6449
|
date: dp.completedAt,
|
|
@@ -6955,18 +6457,18 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6955
6457
|
});
|
|
6956
6458
|
return pts;
|
|
6957
6459
|
}, [dataPoints, selectedArea]);
|
|
6958
|
-
const avgScore =
|
|
6460
|
+
const avgScore = useMemo7(() => {
|
|
6959
6461
|
if (chartPoints.length === 0) return 0;
|
|
6960
6462
|
return chartPoints.reduce((sum, p) => sum + p.score, 0) / chartPoints.length;
|
|
6961
6463
|
}, [chartPoints]);
|
|
6962
|
-
const handleRangeChange =
|
|
6464
|
+
const handleRangeChange = useCallback18(
|
|
6963
6465
|
(e) => {
|
|
6964
6466
|
const val = e.currentTarget.value;
|
|
6965
6467
|
setRangeDays(val === "all" ? null : Number(val));
|
|
6966
6468
|
},
|
|
6967
6469
|
[]
|
|
6968
6470
|
);
|
|
6969
|
-
const handleAreaChange =
|
|
6471
|
+
const handleAreaChange = useCallback18(
|
|
6970
6472
|
(e) => {
|
|
6971
6473
|
const val = e.currentTarget.value;
|
|
6972
6474
|
setSelectedArea(val || null);
|
|
@@ -6974,22 +6476,22 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6974
6476
|
[]
|
|
6975
6477
|
);
|
|
6976
6478
|
const polylinePoints = chartPoints.map((p) => `${p.x},${p.y}`).join(" ");
|
|
6977
|
-
return /* @__PURE__ */
|
|
6978
|
-
/* @__PURE__ */
|
|
6979
|
-
/* @__PURE__ */
|
|
6479
|
+
return /* @__PURE__ */ jsxs28(Stack23, { space: 4, children: [
|
|
6480
|
+
/* @__PURE__ */ jsxs28(Flex21, { gap: 3, children: [
|
|
6481
|
+
/* @__PURE__ */ jsx39(
|
|
6980
6482
|
Select2,
|
|
6981
6483
|
{
|
|
6982
6484
|
onChange: handleRangeChange,
|
|
6983
6485
|
value: rangeDays?.toString() ?? "all",
|
|
6984
|
-
children: TIME_RANGES.map((r) => /* @__PURE__ */
|
|
6486
|
+
children: TIME_RANGES.map((r) => /* @__PURE__ */ jsx39("option", { value: r.days?.toString() ?? "all", children: r.label }, r.label))
|
|
6985
6487
|
}
|
|
6986
6488
|
),
|
|
6987
|
-
/* @__PURE__ */
|
|
6988
|
-
/* @__PURE__ */
|
|
6989
|
-
areaNames.map((name) => /* @__PURE__ */
|
|
6489
|
+
/* @__PURE__ */ jsxs28(Select2, { onChange: handleAreaChange, value: selectedArea ?? "", children: [
|
|
6490
|
+
/* @__PURE__ */ jsx39("option", { value: "", children: "Overall" }),
|
|
6491
|
+
areaNames.map((name) => /* @__PURE__ */ jsx39("option", { value: name, children: name }, name))
|
|
6990
6492
|
] })
|
|
6991
6493
|
] }),
|
|
6992
|
-
/* @__PURE__ */
|
|
6494
|
+
/* @__PURE__ */ jsx39(Card19, { padding: 3, radius: 2, shadow: 1, children: loading ? /* @__PURE__ */ jsx39(Flex21, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx39(Text28, { muted: true, size: 2, children: "Loading\u2026" }) }) : chartPoints.length === 0 ? /* @__PURE__ */ jsx39(Flex21, { align: "center", justify: "center", style: { height: 200 }, children: /* @__PURE__ */ jsx39(Text28, { muted: true, size: 2, children: "No reports found for this time range" }) }) : /* @__PURE__ */ jsxs28(
|
|
6993
6495
|
"svg",
|
|
6994
6496
|
{
|
|
6995
6497
|
style: { display: "block", width: "100%" },
|
|
@@ -6997,8 +6499,8 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
6997
6499
|
children: [
|
|
6998
6500
|
Y_TICKS.map((tick) => {
|
|
6999
6501
|
const y = PAD_TOP + PLOT_HEIGHT - tick / Y_MAX * PLOT_HEIGHT;
|
|
7000
|
-
return /* @__PURE__ */
|
|
7001
|
-
/* @__PURE__ */
|
|
6502
|
+
return /* @__PURE__ */ jsxs28("g", { children: [
|
|
6503
|
+
/* @__PURE__ */ jsx39(
|
|
7002
6504
|
"line",
|
|
7003
6505
|
{
|
|
7004
6506
|
stroke: "#ccc",
|
|
@@ -7009,7 +6511,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
7009
6511
|
y2: y
|
|
7010
6512
|
}
|
|
7011
6513
|
),
|
|
7012
|
-
/* @__PURE__ */
|
|
6514
|
+
/* @__PURE__ */ jsx39(
|
|
7013
6515
|
"text",
|
|
7014
6516
|
{
|
|
7015
6517
|
dominantBaseline: "middle",
|
|
@@ -7029,7 +6531,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
7029
6531
|
chartPoints.length - 1
|
|
7030
6532
|
].map((idx) => {
|
|
7031
6533
|
const p = chartPoints[idx];
|
|
7032
|
-
return /* @__PURE__ */
|
|
6534
|
+
return /* @__PURE__ */ jsx39(
|
|
7033
6535
|
"text",
|
|
7034
6536
|
{
|
|
7035
6537
|
fill: "#999",
|
|
@@ -7037,11 +6539,11 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
7037
6539
|
textAnchor: "middle",
|
|
7038
6540
|
x: p.x,
|
|
7039
6541
|
y: CHART_HEIGHT - 6,
|
|
7040
|
-
children:
|
|
6542
|
+
children: formatDate(p.date)
|
|
7041
6543
|
},
|
|
7042
6544
|
idx
|
|
7043
6545
|
);
|
|
7044
|
-
}) : chartPoints.map((p, idx) => /* @__PURE__ */
|
|
6546
|
+
}) : chartPoints.map((p, idx) => /* @__PURE__ */ jsx39(
|
|
7045
6547
|
"text",
|
|
7046
6548
|
{
|
|
7047
6549
|
fill: "#999",
|
|
@@ -7049,11 +6551,11 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
7049
6551
|
textAnchor: "middle",
|
|
7050
6552
|
x: p.x,
|
|
7051
6553
|
y: CHART_HEIGHT - 6,
|
|
7052
|
-
children:
|
|
6554
|
+
children: formatDate(p.date)
|
|
7053
6555
|
},
|
|
7054
6556
|
idx
|
|
7055
6557
|
)),
|
|
7056
|
-
/* @__PURE__ */
|
|
6558
|
+
/* @__PURE__ */ jsx39(
|
|
7057
6559
|
"polyline",
|
|
7058
6560
|
{
|
|
7059
6561
|
fill: "none",
|
|
@@ -7063,7 +6565,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
7063
6565
|
strokeWidth: 2.5
|
|
7064
6566
|
}
|
|
7065
6567
|
),
|
|
7066
|
-
chartPoints.map((p, idx) => /* @__PURE__ */
|
|
6568
|
+
chartPoints.map((p, idx) => /* @__PURE__ */ jsx39(
|
|
7067
6569
|
"circle",
|
|
7068
6570
|
{
|
|
7069
6571
|
cx: p.x,
|
|
@@ -7072,8 +6574,8 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
7072
6574
|
r: 4,
|
|
7073
6575
|
stroke: "#fff",
|
|
7074
6576
|
strokeWidth: 1.5,
|
|
7075
|
-
children: /* @__PURE__ */
|
|
7076
|
-
|
|
6577
|
+
children: /* @__PURE__ */ jsxs28("title", { children: [
|
|
6578
|
+
formatDate(p.date),
|
|
7077
6579
|
": ",
|
|
7078
6580
|
Math.round(p.score)
|
|
7079
6581
|
] })
|
|
@@ -7083,7 +6585,7 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
7083
6585
|
]
|
|
7084
6586
|
}
|
|
7085
6587
|
) }),
|
|
7086
|
-
/* @__PURE__ */
|
|
6588
|
+
/* @__PURE__ */ jsxs28(Text28, { muted: true, size: 2, children: [
|
|
7087
6589
|
chartPoints.length,
|
|
7088
6590
|
" data point",
|
|
7089
6591
|
chartPoints.length !== 1 ? "s" : ""
|
|
@@ -7093,19 +6595,18 @@ function ScoreTimeline({ mode = null, source = null }) {
|
|
|
7093
6595
|
var ScoreTimeline_default = ScoreTimeline;
|
|
7094
6596
|
|
|
7095
6597
|
// src/components/Dashboard.tsx
|
|
7096
|
-
import { jsx as
|
|
6598
|
+
import { jsx as jsx40, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7097
6599
|
var VIEW_PARAM_MAP = {
|
|
7098
6600
|
compare: "compare",
|
|
7099
6601
|
timeline: "timeline"
|
|
7100
6602
|
};
|
|
7101
6603
|
function Dashboard() {
|
|
7102
|
-
const
|
|
7103
|
-
const router = useRouter2();
|
|
6604
|
+
const router = useRouter3();
|
|
7104
6605
|
const routerState = router.state;
|
|
7105
6606
|
const reportId = routerState.reportId ?? null;
|
|
7106
6607
|
const isDetail = reportId !== null;
|
|
7107
6608
|
const activeTab = isDetail ? "latest" : VIEW_PARAM_MAP[routerState.view ?? ""] ?? "latest";
|
|
7108
|
-
const navigateToTab =
|
|
6609
|
+
const navigateToTab = useCallback19(
|
|
7109
6610
|
(tab) => {
|
|
7110
6611
|
if (tab === "latest") {
|
|
7111
6612
|
router.navigate({});
|
|
@@ -7115,13 +6616,13 @@ function Dashboard() {
|
|
|
7115
6616
|
},
|
|
7116
6617
|
[router]
|
|
7117
6618
|
);
|
|
7118
|
-
const handleSelectReport =
|
|
6619
|
+
const handleSelectReport = useCallback19(
|
|
7119
6620
|
(id) => {
|
|
7120
6621
|
router.navigate({ reportId: id });
|
|
7121
6622
|
},
|
|
7122
6623
|
[router]
|
|
7123
6624
|
);
|
|
7124
|
-
const handleTabChange =
|
|
6625
|
+
const handleTabChange = useCallback19(
|
|
7125
6626
|
(tab) => {
|
|
7126
6627
|
if (!routerState.reportId) return;
|
|
7127
6628
|
if (tab) {
|
|
@@ -7132,52 +6633,16 @@ function Dashboard() {
|
|
|
7132
6633
|
},
|
|
7133
6634
|
[router, routerState.reportId]
|
|
7134
6635
|
);
|
|
7135
|
-
const handleBack =
|
|
6636
|
+
const handleBack = useCallback19(() => {
|
|
7136
6637
|
router.navigate({});
|
|
7137
6638
|
}, [router]);
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
}, [client]);
|
|
7146
|
-
return /* @__PURE__ */ jsx50(Container, { width: 2, children: /* @__PURE__ */ jsxs37(Stack27, { padding: 4, space: 4, children: [
|
|
7147
|
-
/* @__PURE__ */ jsxs37(Flex29, { align: "center", gap: 3, children: [
|
|
7148
|
-
/* @__PURE__ */ jsxs37(Stack27, { flex: 1, space: 1, children: [
|
|
7149
|
-
/* @__PURE__ */ jsx50(Text36, { size: 4, weight: "bold", children: "AI Literacy Framework" }),
|
|
7150
|
-
/* @__PURE__ */ jsx50(Text36, { muted: true, size: 2, children: "Evaluation reports and score trends" })
|
|
7151
|
-
] }),
|
|
7152
|
-
!isDetail && /* @__PURE__ */ jsxs37(Flex29, { gap: 2, children: [
|
|
7153
|
-
/* @__PURE__ */ jsxs37(
|
|
7154
|
-
Select3,
|
|
7155
|
-
{
|
|
7156
|
-
fontSize: 2,
|
|
7157
|
-
onChange: (e) => setSource(e.currentTarget.value || null),
|
|
7158
|
-
value: source ?? "",
|
|
7159
|
-
children: [
|
|
7160
|
-
/* @__PURE__ */ jsx50("option", { value: "", children: "All sources" }),
|
|
7161
|
-
sources.map((s) => /* @__PURE__ */ jsx50("option", { value: s, children: s }, s))
|
|
7162
|
-
]
|
|
7163
|
-
}
|
|
7164
|
-
),
|
|
7165
|
-
/* @__PURE__ */ jsxs37(
|
|
7166
|
-
Select3,
|
|
7167
|
-
{
|
|
7168
|
-
fontSize: 2,
|
|
7169
|
-
onChange: (e) => setMode(e.currentTarget.value || null),
|
|
7170
|
-
value: mode ?? "",
|
|
7171
|
-
children: [
|
|
7172
|
-
/* @__PURE__ */ jsx50("option", { value: "", children: "All modes" }),
|
|
7173
|
-
modes.map((m) => /* @__PURE__ */ jsx50("option", { value: m, children: m }, m))
|
|
7174
|
-
]
|
|
7175
|
-
}
|
|
7176
|
-
)
|
|
7177
|
-
] })
|
|
7178
|
-
] }),
|
|
7179
|
-
!isDetail && /* @__PURE__ */ jsxs37(TabList2, { space: 1, children: [
|
|
7180
|
-
/* @__PURE__ */ jsx50(
|
|
6639
|
+
return /* @__PURE__ */ jsx40(Container, { width: 4, children: /* @__PURE__ */ jsxs29(Stack24, { padding: 4, space: 4, children: [
|
|
6640
|
+
/* @__PURE__ */ jsx40(Flex22, { align: "center", gap: 3, children: /* @__PURE__ */ jsxs29(Stack24, { flex: 1, space: 1, children: [
|
|
6641
|
+
/* @__PURE__ */ jsx40(Text29, { size: 4, weight: "bold", children: "AI Literacy Framework" }),
|
|
6642
|
+
/* @__PURE__ */ jsx40(Text29, { muted: true, size: 2, children: "Evaluation reports and score trends" })
|
|
6643
|
+
] }) }),
|
|
6644
|
+
!isDetail && /* @__PURE__ */ jsxs29(TabList2, { space: 1, children: [
|
|
6645
|
+
/* @__PURE__ */ jsx40(
|
|
7181
6646
|
Tab2,
|
|
7182
6647
|
{
|
|
7183
6648
|
"aria-controls": "latest-panel",
|
|
@@ -7187,7 +6652,7 @@ function Dashboard() {
|
|
|
7187
6652
|
selected: activeTab === "latest"
|
|
7188
6653
|
}
|
|
7189
6654
|
),
|
|
7190
|
-
/* @__PURE__ */
|
|
6655
|
+
/* @__PURE__ */ jsx40(
|
|
7191
6656
|
Tab2,
|
|
7192
6657
|
{
|
|
7193
6658
|
"aria-controls": "timeline-panel",
|
|
@@ -7197,7 +6662,7 @@ function Dashboard() {
|
|
|
7197
6662
|
selected: activeTab === "timeline"
|
|
7198
6663
|
}
|
|
7199
6664
|
),
|
|
7200
|
-
/* @__PURE__ */
|
|
6665
|
+
/* @__PURE__ */ jsx40(
|
|
7201
6666
|
Tab2,
|
|
7202
6667
|
{
|
|
7203
6668
|
"aria-controls": "compare-panel",
|
|
@@ -7208,17 +6673,10 @@ function Dashboard() {
|
|
|
7208
6673
|
}
|
|
7209
6674
|
)
|
|
7210
6675
|
] }),
|
|
7211
|
-
!isDetail && activeTab === "latest" && /* @__PURE__ */
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
onSelectReport: handleSelectReport,
|
|
7216
|
-
source
|
|
7217
|
-
}
|
|
7218
|
-
) }),
|
|
7219
|
-
!isDetail && activeTab === "timeline" && /* @__PURE__ */ jsx50(TabPanel2, { "aria-labelledby": "timeline-tab", id: "timeline-panel", children: /* @__PURE__ */ jsx50(ScoreTimeline_default, { mode, source }) }),
|
|
7220
|
-
!isDetail && activeTab === "compare" && /* @__PURE__ */ jsx50(TabPanel2, { "aria-labelledby": "compare-tab", id: "compare-panel", children: /* @__PURE__ */ jsx50(ComparisonView, {}) }),
|
|
7221
|
-
isDetail && reportId && /* @__PURE__ */ jsx50(
|
|
6676
|
+
!isDetail && activeTab === "latest" && /* @__PURE__ */ jsx40(TabPanel2, { "aria-labelledby": "latest-tab", id: "latest-panel", children: /* @__PURE__ */ jsx40(LatestReports, { onSelectReport: handleSelectReport }) }),
|
|
6677
|
+
!isDetail && activeTab === "timeline" && /* @__PURE__ */ jsx40(TabPanel2, { "aria-labelledby": "timeline-tab", id: "timeline-panel", children: /* @__PURE__ */ jsx40(ScoreTimeline_default, {}) }),
|
|
6678
|
+
!isDetail && activeTab === "compare" && /* @__PURE__ */ jsx40(TabPanel2, { "aria-labelledby": "compare-tab", id: "compare-panel", children: /* @__PURE__ */ jsx40(ComparisonView, {}) }),
|
|
6679
|
+
isDetail && reportId && /* @__PURE__ */ jsx40(
|
|
7222
6680
|
ReportDetail,
|
|
7223
6681
|
{
|
|
7224
6682
|
activeTab: routerState.tab ?? null,
|
|
@@ -7248,10 +6706,10 @@ function ailfTool(options = {}) {
|
|
|
7248
6706
|
// src/actions/RunEvaluationAction.tsx
|
|
7249
6707
|
import { BarChartIcon as BarChartIcon2 } from "@sanity/icons";
|
|
7250
6708
|
import { useToast as useToast8 } from "@sanity/ui";
|
|
7251
|
-
import { useCallback as
|
|
6709
|
+
import { useCallback as useCallback20, useEffect as useEffect8, useRef as useRef3, useState as useState14 } from "react";
|
|
7252
6710
|
import {
|
|
7253
|
-
getReleaseIdFromReleaseDocumentId as
|
|
7254
|
-
useClient as
|
|
6711
|
+
getReleaseIdFromReleaseDocumentId as getReleaseIdFromReleaseDocumentId3,
|
|
6712
|
+
useClient as useClient12,
|
|
7255
6713
|
useCurrentUser as useCurrentUser3,
|
|
7256
6714
|
useDataset as useDataset2,
|
|
7257
6715
|
useProjectId as useProjectId2
|
|
@@ -7274,15 +6732,15 @@ function createRunEvaluationAction(options = {}) {
|
|
|
7274
6732
|
const { mode = "baseline" } = options;
|
|
7275
6733
|
const RunEvaluationAction = (props) => {
|
|
7276
6734
|
const { release } = props;
|
|
7277
|
-
const client =
|
|
6735
|
+
const client = useClient12({ apiVersion: API_VERSION2 });
|
|
7278
6736
|
const dataset = useDataset2();
|
|
7279
6737
|
const projectId = useProjectId2();
|
|
7280
6738
|
const currentUser = useCurrentUser3();
|
|
7281
6739
|
const toast = useToast8();
|
|
7282
|
-
const [state, setState] =
|
|
7283
|
-
const requestedAtRef =
|
|
7284
|
-
const perspectiveId =
|
|
7285
|
-
|
|
6740
|
+
const [state, setState] = useState14({ status: "loading" });
|
|
6741
|
+
const requestedAtRef = useRef3(null);
|
|
6742
|
+
const perspectiveId = getReleaseIdFromReleaseDocumentId3(release._id);
|
|
6743
|
+
useEffect8(() => {
|
|
7286
6744
|
let cancelled = false;
|
|
7287
6745
|
client.fetch(contentImpactQuery, buildReportQueryParams(perspectiveId)).then((results) => {
|
|
7288
6746
|
if (cancelled) return;
|
|
@@ -7305,7 +6763,7 @@ function createRunEvaluationAction(options = {}) {
|
|
|
7305
6763
|
cancelled = true;
|
|
7306
6764
|
};
|
|
7307
6765
|
}, [client, perspectiveId]);
|
|
7308
|
-
|
|
6766
|
+
useEffect8(() => {
|
|
7309
6767
|
if (state.status !== "requested" && state.status !== "polling") return;
|
|
7310
6768
|
const { requestId, startedAt } = state;
|
|
7311
6769
|
if (state.status === "requested") {
|
|
@@ -7355,7 +6813,7 @@ function createRunEvaluationAction(options = {}) {
|
|
|
7355
6813
|
}, POLL_INTERVAL_MS2);
|
|
7356
6814
|
return () => clearInterval(interval);
|
|
7357
6815
|
}, [client, perspectiveId, state]);
|
|
7358
|
-
|
|
6816
|
+
useEffect8(() => {
|
|
7359
6817
|
if (state.status !== "error") return;
|
|
7360
6818
|
const timer = setTimeout(() => {
|
|
7361
6819
|
client.fetch(contentImpactQuery, buildReportQueryParams(perspectiveId)).then((results) => {
|
|
@@ -7375,7 +6833,7 @@ function createRunEvaluationAction(options = {}) {
|
|
|
7375
6833
|
}, 15e3);
|
|
7376
6834
|
return () => clearTimeout(timer);
|
|
7377
6835
|
}, [client, perspectiveId, state]);
|
|
7378
|
-
const handleRequest =
|
|
6836
|
+
const handleRequest = useCallback20(async () => {
|
|
7379
6837
|
const releaseTitle = release.metadata?.title ?? perspectiveId ?? "release";
|
|
7380
6838
|
const tag = `release-${slugify3(releaseTitle)}-${dateStamp3()}`;
|
|
7381
6839
|
const now = Date.now();
|
|
@@ -7526,6 +6984,7 @@ export {
|
|
|
7526
6984
|
distinctPerspectivesQuery,
|
|
7527
6985
|
distinctSourcesQuery,
|
|
7528
6986
|
distinctTargetDocumentsQuery,
|
|
6987
|
+
distinctTriggersQuery,
|
|
7529
6988
|
evalRequestSchema,
|
|
7530
6989
|
featureAreaSchema,
|
|
7531
6990
|
latestReportsQuery,
|