@sanity/ailf-studio 1.3.0 → 1.3.1

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 CHANGED
@@ -461,7 +461,12 @@ interface RecommendationsData {
461
461
  }
462
462
  /**
463
463
  * Per-test result stored in reports for drill-down and audit.
464
- * Mirrors StoredTestResult from @sanity/ailf-core. See D0029.
464
+ * Mirrors StoredTestResult from @sanity/ailf-core.
465
+ *
466
+ * Per D0030, new reports omit `responseOutput` / `responseOutputTruncated`
467
+ * inline — the full output lives in the `testOutputs` GCS artifact and is
468
+ * fetched via `useArtifactCache`. Both fields remain optional so the
469
+ * reader path tolerates legacy reports that were published before W0045.
465
470
  */
466
471
  interface StoredTestResultData {
467
472
  area: string;
@@ -476,7 +481,7 @@ interface StoredTestResultData {
476
481
  latencyMs?: number;
477
482
  modelId: string;
478
483
  outputFailure?: boolean;
479
- responseOutput: string;
484
+ responseOutput?: string;
480
485
  responseOutputTruncated?: boolean;
481
486
  taskId: string;
482
487
  tokenUsage?: {
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import { useClient, useCurrentUser } from "sanity";
10
10
  // src/lib/constants.ts
11
11
  var API_VERSION = "2026-03-11";
12
12
  var isProduction = process.env.NODE_ENV === "production";
13
- var ARTIFACT_API_BASE_URL = isProduction ? "https://ailf-api.sanity.build/v1" : "http://localhost:4100/v1";
13
+ var ARTIFACT_API_BASE_URL = isProduction ? "https://ailf-api.sanity.build/v1" : "http://localhost:3000/v1";
14
14
 
15
15
  // src/actions/GraduateToNativeAction.tsx
16
16
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1418,17 +1418,6 @@ var reportSchema = defineType4({
1418
1418
  title: "Composite Score",
1419
1419
  type: "number"
1420
1420
  }),
1421
- defineField4({
1422
- description: "The model's generated code/response (truncated to 8000 chars).",
1423
- name: "responseOutput",
1424
- title: "Response Output",
1425
- type: "text"
1426
- }),
1427
- defineField4({
1428
- name: "responseOutputTruncated",
1429
- title: "Truncated",
1430
- type: "boolean"
1431
- }),
1432
1421
  defineField4({
1433
1422
  name: "latencyMs",
1434
1423
  title: "Latency (ms)",
@@ -5901,7 +5890,7 @@ import { useClient as useClient10 } from "sanity";
5901
5890
 
5902
5891
  // src/lib/useArtifactCache.ts
5903
5892
  import { useCallback as useCallback14, useRef as useRef5, useState as useState10 } from "react";
5904
- function useArtifactCache(reportId, artifactRef, client) {
5893
+ function useArtifactCache(reportId, artifactRef) {
5905
5894
  const cacheRef = useRef5(/* @__PURE__ */ new Map());
5906
5895
  const [status, setStatus] = useState10("idle");
5907
5896
  const [error, setError] = useState10(null);
@@ -5913,15 +5902,11 @@ function useArtifactCache(reportId, artifactRef, client) {
5913
5902
  setStatus("loading");
5914
5903
  setError(null);
5915
5904
  try {
5916
- const token = client.config().token;
5917
5905
  const signingRes = await fetch(
5918
5906
  `${ARTIFACT_API_BASE_URL}/artifacts/${encodeURIComponent(reportId)}?type=testOutputs`,
5919
5907
  {
5920
5908
  credentials: "omit",
5921
- headers: {
5922
- Accept: "application/json",
5923
- ...token ? { Authorization: `Bearer ${token}` } : {}
5924
- }
5909
+ headers: { Accept: "application/json" }
5925
5910
  }
5926
5911
  );
5927
5912
  if (!signingRes.ok) {
@@ -5931,12 +5916,12 @@ function useArtifactCache(reportId, artifactRef, client) {
5931
5916
  );
5932
5917
  }
5933
5918
  const envelope = await signingRes.json();
5934
- if (!envelope.ok || !envelope.data?.url) {
5919
+ if (envelope.object === "error" || !envelope.url) {
5935
5920
  throw new Error(
5936
- envelope.error ?? "Invalid signing response \u2014 missing signed URL"
5921
+ envelope.error?.message ?? "Invalid signing response \u2014 missing signed URL"
5937
5922
  );
5938
5923
  }
5939
- const artifactRes = await fetch(envelope.data.url, {
5924
+ const artifactRes = await fetch(envelope.url, {
5940
5925
  credentials: "omit"
5941
5926
  });
5942
5927
  if (!artifactRes.ok) {
@@ -5958,7 +5943,7 @@ function useArtifactCache(reportId, artifactRef, client) {
5958
5943
  } finally {
5959
5944
  fetchingRef.current = false;
5960
5945
  }
5961
- }, [reportId, artifactRef, client]);
5946
+ }, [reportId, artifactRef]);
5962
5947
  const getOutput = useCallback14(
5963
5948
  (taskId, modelId) => {
5964
5949
  return cacheRef.current.get(`${taskId}::${modelId}`) ?? null;
@@ -9340,8 +9325,7 @@ function ReportDetail({
9340
9325
  }, [client, reportId]);
9341
9326
  const artifactCache = useArtifactCache(
9342
9327
  reportId,
9343
- report?.summary?.artifacts?.testOutputs,
9344
- client
9328
+ report?.summary?.artifacts?.testOutputs
9345
9329
  );
9346
9330
  const { summary } = report ?? {};
9347
9331
  const hasWeaknesses = Boolean(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ailf-studio",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "AI Literacy Framework — Sanity Studio dashboard plugin",
5
5
  "type": "module",
6
6
  "license": "MIT",