@sanity/ailf-studio 0.1.9 → 0.1.10

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.
Files changed (2) hide show
  1. package/dist/index.js +115 -40
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4460,8 +4460,22 @@ function getDateThreshold(preset) {
4460
4460
 
4461
4461
  // src/components/report-detail/ReportDetail.tsx
4462
4462
  import { ArrowLeftIcon as ArrowLeftIcon2 } from "@sanity/icons";
4463
- import { Box as Box15, Button as Button3, Stack as Stack23, Tab, TabList, TabPanel, Text as Text32 } from "@sanity/ui";
4464
- import { useCallback as useCallback12, useEffect as useEffect7, useMemo as useMemo7, useState as useState9 } from "react";
4463
+ import {
4464
+ Box as Box15,
4465
+ Button as Button3,
4466
+ Stack as Stack23,
4467
+ Tab,
4468
+ TabList,
4469
+ TabPanel,
4470
+ Text as Text32,
4471
+ Tooltip as Tooltip9
4472
+ } from "@sanity/ui";
4473
+ import {
4474
+ useCallback as useCallback12,
4475
+ useEffect as useEffect7,
4476
+ useMemo as useMemo7,
4477
+ useState as useState9
4478
+ } from "react";
4465
4479
  import { useClient as useClient6 } from "sanity";
4466
4480
 
4467
4481
  // src/components/report-detail/AgentActivitySection.tsx
@@ -5060,33 +5074,49 @@ function JudgmentCard({ judgment }) {
5060
5074
  ) }),
5061
5075
  judgment.canonicalDocs && judgment.canonicalDocs.length > 0 && /* @__PURE__ */ jsxs26(Flex20, { align: "center", gap: 2, wrap: "wrap", children: [
5062
5076
  /* @__PURE__ */ jsx31(Text27, { muted: true, size: 0, children: "Docs:" }),
5063
- judgment.canonicalDocs.map((doc) => {
5064
- const badge = /* @__PURE__ */ jsx31(Badge16, { mode: "outline", tone: "primary", children: doc.slug });
5065
- return /* @__PURE__ */ jsx31(
5066
- Tooltip6,
5067
- {
5068
- content: /* @__PURE__ */ jsx31(Box12, { padding: 2, children: /* @__PURE__ */ jsx31(Text27, { size: 1, children: doc.title || doc.slug }) }),
5069
- placement: "bottom",
5070
- portal: true,
5071
- children: doc.documentId ? /* @__PURE__ */ jsx31(
5072
- "a",
5073
- {
5074
- href: `/intent/edit/id=${doc.documentId}`,
5075
- onClick: (e) => e.stopPropagation(),
5076
- style: { textDecoration: "none" },
5077
- children: badge
5078
- }
5079
- ) : badge
5080
- },
5081
- doc.slug
5082
- );
5083
- })
5077
+ judgment.canonicalDocs.map((doc) => /* @__PURE__ */ jsx31(DocBadge, { doc }, doc.slug))
5084
5078
  ] })
5085
5079
  ] })
5086
5080
  ] })
5087
5081
  }
5088
5082
  );
5089
5083
  }
5084
+ var editLinkStyle = {
5085
+ cursor: "pointer",
5086
+ display: "inline-block",
5087
+ textDecoration: "none",
5088
+ transition: "opacity 150ms ease"
5089
+ };
5090
+ function DocBadge({
5091
+ doc
5092
+ }) {
5093
+ const [hovered, setHovered] = useState8(false);
5094
+ const isLinked = Boolean(doc.documentId);
5095
+ const tooltipLabel = isLinked ? `Edit "${doc.title || doc.slug}"` : doc.title || doc.slug;
5096
+ const badge = /* @__PURE__ */ jsx31(Badge16, { mode: "outline", tone: isLinked && hovered ? "caution" : "primary", children: doc.slug });
5097
+ return /* @__PURE__ */ jsx31(
5098
+ Tooltip6,
5099
+ {
5100
+ content: /* @__PURE__ */ jsx31(Box12, { padding: 2, children: /* @__PURE__ */ jsx31(Text27, { size: 1, children: tooltipLabel }) }),
5101
+ placement: "bottom",
5102
+ portal: true,
5103
+ children: isLinked ? /* @__PURE__ */ jsx31(
5104
+ "a",
5105
+ {
5106
+ href: `/intent/edit/id=${doc.documentId}`,
5107
+ onClick: (e) => e.stopPropagation(),
5108
+ onMouseEnter: () => setHovered(true),
5109
+ onMouseLeave: () => setHovered(false),
5110
+ style: {
5111
+ ...editLinkStyle,
5112
+ opacity: hovered ? 0.8 : 1
5113
+ },
5114
+ children: badge
5115
+ }
5116
+ ) : /* @__PURE__ */ jsx31("span", { children: badge })
5117
+ }
5118
+ );
5119
+ }
5090
5120
 
5091
5121
  // src/components/report-detail/OverviewStats.tsx
5092
5122
  import { Grid as Grid4 } from "@sanity/ui";
@@ -5672,16 +5702,21 @@ function ReportDetail({
5672
5702
  const hasAgentActivity = Boolean(
5673
5703
  summary?.agentBehavior && summary.agentBehavior.length > 0
5674
5704
  );
5675
- const tabs = useMemo7(() => {
5676
- const result = [OVERVIEW_TAB];
5677
- if (hasDiagnostics) result.push(DIAGNOSTICS_TAB);
5678
- if (hasAgentActivity) result.push(ACTIVITY_TAB);
5679
- return result;
5705
+ const tabs = useMemo7(
5706
+ () => [OVERVIEW_TAB, DIAGNOSTICS_TAB, ACTIVITY_TAB],
5707
+ []
5708
+ );
5709
+ const disabledTabs = useMemo7(() => {
5710
+ const set2 = /* @__PURE__ */ new Set();
5711
+ if (!hasDiagnostics) set2.add("diagnostics");
5712
+ if (!hasAgentActivity) set2.add("activity");
5713
+ return set2;
5680
5714
  }, [hasDiagnostics, hasAgentActivity]);
5681
5715
  const currentTab = useMemo7(() => {
5682
5716
  const parsed = parseTab(activeTab);
5717
+ if (disabledTabs.has(parsed)) return "overview";
5683
5718
  return tabs.some((t) => t.id === parsed) ? parsed : "overview";
5684
- }, [activeTab, tabs]);
5719
+ }, [activeTab, disabledTabs, tabs]);
5685
5720
  const handleTabClick = useCallback12(
5686
5721
  (tabId) => {
5687
5722
  onTabChange(tabId === "overview" ? null : tabId);
@@ -5721,17 +5756,31 @@ function ReportDetail({
5721
5756
  tag: report.tag
5722
5757
  }
5723
5758
  ),
5724
- tabs.length > 1 && /* @__PURE__ */ jsx37(TabList, { space: 1, children: tabs.map((tab) => /* @__PURE__ */ jsx37(
5725
- Tab,
5726
- {
5727
- "aria-controls": `panel-${tab.id}`,
5728
- id: `tab-${tab.id}`,
5729
- label: tab.label,
5730
- onClick: () => handleTabClick(tab.id),
5731
- selected: currentTab === tab.id
5732
- },
5733
- tab.id
5734
- )) }),
5759
+ /* @__PURE__ */ jsx37(TabList, { space: 1, children: tabs.map((tab) => {
5760
+ const isDisabled = disabledTabs.has(tab.id);
5761
+ const tooltip = getDisabledTabTooltip(tab.id, summary);
5762
+ const tabElement = /* @__PURE__ */ jsx37(
5763
+ Tab,
5764
+ {
5765
+ "aria-controls": `panel-${tab.id}`,
5766
+ disabled: isDisabled,
5767
+ id: `tab-${tab.id}`,
5768
+ label: tab.label,
5769
+ onClick: () => handleTabClick(tab.id),
5770
+ selected: currentTab === tab.id
5771
+ }
5772
+ );
5773
+ return isDisabled && tooltip ? /* @__PURE__ */ jsx37(
5774
+ Tooltip9,
5775
+ {
5776
+ content: /* @__PURE__ */ jsx37(Box15, { padding: 2, style: { maxWidth: 280 }, children: tooltip }),
5777
+ placement: "bottom",
5778
+ portal: true,
5779
+ children: /* @__PURE__ */ jsx37("span", { style: { display: "inline-block" }, children: tabElement })
5780
+ },
5781
+ tab.id
5782
+ ) : /* @__PURE__ */ jsx37("span", { children: tabElement }, tab.id);
5783
+ }) }),
5735
5784
  currentTab === "overview" && /* @__PURE__ */ jsx37(
5736
5785
  TabPanel,
5737
5786
  {
@@ -5789,6 +5838,32 @@ function ReportDetail({
5789
5838
  )
5790
5839
  ] }) });
5791
5840
  }
5841
+ var inlineCodeStyle = {
5842
+ background: "var(--card-code-bg-color, rgba(255,255,255,0.06))",
5843
+ borderRadius: 3,
5844
+ fontFamily: "var(--card-code-font-family, monospace)",
5845
+ fontSize: "0.9em",
5846
+ padding: "0.15em 0.35em"
5847
+ };
5848
+ function getDisabledTabTooltip(tabId, summary) {
5849
+ if (!summary) return null;
5850
+ switch (tabId) {
5851
+ case "diagnostics":
5852
+ return /* @__PURE__ */ jsx37(Text32, { muted: true, size: 1, children: "No diagnostic data available. Diagnostics require low-scoring judgments or gap analysis recommendations." });
5853
+ case "activity":
5854
+ return summary.evaluationMode === "baseline" ? /* @__PURE__ */ jsxs32(Text32, { muted: true, size: 1, children: [
5855
+ "Not available for baseline-only evaluations. Run with",
5856
+ " ",
5857
+ /* @__PURE__ */ jsx37("code", { style: inlineCodeStyle, children: "--mode full" }),
5858
+ " or",
5859
+ " ",
5860
+ /* @__PURE__ */ jsx37("code", { style: inlineCodeStyle, children: "--mode agentic" }),
5861
+ " to capture agent browsing behavior."
5862
+ ] }) : /* @__PURE__ */ jsx37(Text32, { muted: true, size: 1, children: "No agent activity data was recorded for this evaluation." });
5863
+ default:
5864
+ return null;
5865
+ }
5866
+ }
5792
5867
 
5793
5868
  // src/components/ScoreTimeline.tsx
5794
5869
  import { Card as Card23, Flex as Flex25, Select as Select2, Stack as Stack24, Text as Text33 } from "@sanity/ui";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ailf-studio",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "AI Literacy Framework — Sanity Studio dashboard plugin",
5
5
  "type": "module",
6
6
  "license": "MIT",