@meridianlabs/inspect-scout-viewer 0.4.17 → 0.4.19

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/lib/index.js CHANGED
@@ -137183,6 +137183,21 @@ function castColumns(table2) {
137183
137183
  }
137184
137184
  async function expandResultsetRows(columnTable) {
137185
137185
  const colNames = columnTable.columnNames();
137186
+ if (!colNames.includes("identifier")) {
137187
+ const numRows = columnTable.numRows();
137188
+ const identifiers = new Array(numRows);
137189
+ if (colNames.includes("uuid")) {
137190
+ const uuids = columnTable.array("uuid");
137191
+ for (let i4 = 0; i4 < numRows; i4++) {
137192
+ identifiers[i4] = uuids[i4] ?? crypto.randomUUID();
137193
+ }
137194
+ } else {
137195
+ for (let i4 = 0; i4 < numRows; i4++) {
137196
+ identifiers[i4] = crypto.randomUUID();
137197
+ }
137198
+ }
137199
+ columnTable = columnTable.assign({ identifier: identifiers });
137200
+ }
137186
137201
  if (!colNames.includes("value_type") || !colNames.includes("value") || columnTable.numRows() === 0) {
137187
137202
  return columnTable;
137188
137203
  }
@@ -137211,6 +137226,7 @@ async function expandResultsetRows(columnTable) {
137211
137226
  }
137212
137227
  for (const result2 of results) {
137213
137228
  const expandedRow = { ...row2 };
137229
+ expandedRow.identifier = result2.uuid ?? crypto.randomUUID();
137214
137230
  expandedRow.label = result2.label ?? null;
137215
137231
  expandedRow.answer = result2.answer ?? null;
137216
137232
  expandedRow.explanation = result2.explanation ?? null;
@@ -137314,6 +137330,7 @@ async function createSyntheticRows(expandedRows, resultsetRows) {
137314
137330
  templateRow.message_references = maybeSerializeValue([]);
137315
137331
  templateRow.event_references = maybeSerializeValue([]);
137316
137332
  templateRow.uuid = null;
137333
+ templateRow.identifier = crypto.randomUUID();
137317
137334
  templateRow.validation_result = validationResults[label2] ?? null;
137318
137335
  templateRow.scan_error = null;
137319
137336
  templateRow.scan_error_traceback = null;
@@ -137741,6 +137758,7 @@ const parseScanResultData = async (filtered) => {
137741
137758
  transcript_agent_args_raw ? parseJson(transcript_agent_args_raw) : Promise.resolve(void 0),
137742
137759
  transcript_score_raw !== null && transcript_score_raw !== void 0 ? parseJsonValue(transcript_score_raw) : Promise.resolve(void 0)
137743
137760
  ]);
137761
+ const identifier = filtered.get("identifier", 0);
137744
137762
  const uuid = filtered.get("uuid", 0);
137745
137763
  const timestamp2 = getOptionalColumn(filtered, "timestamp");
137746
137764
  const answer = filtered.get("answer", 0);
@@ -137807,6 +137825,7 @@ const parseScanResultData = async (filtered) => {
137807
137825
  "transcript_limit"
137808
137826
  );
137809
137827
  const baseData = {
137828
+ identifier,
137810
137829
  uuid,
137811
137830
  timestamp: timestamp2,
137812
137831
  answer,
@@ -137875,6 +137894,7 @@ const parseScanResultSummaries = async (rowData) => Promise.all(
137875
137894
  parseSimpleValue(r2.value, valueType)
137876
137895
  ]);
137877
137896
  const baseSummary = {
137897
+ identifier: r2.identifier,
137878
137898
  uuid: r2.uuid,
137879
137899
  label: r2.label,
137880
137900
  explanation: r2.explanation,
@@ -138460,7 +138480,7 @@ const renderValue = (index, val, summary2, references, interactive) => {
138460
138480
  return !interactive ? printObject(val, 35) : /* @__PURE__ */ jsxRuntimeExports.jsx(
138461
138481
  RecordTree,
138462
138482
  {
138463
- id: `value-record-${summary2.uuid}-${index}`,
138483
+ id: `value-record-${summary2.identifier}-${index}`,
138464
138484
  record: val
138465
138485
  }
138466
138486
  );
@@ -149576,7 +149596,7 @@ const useMarkdownRefs = (summary2, inputData) => {
149576
149596
  const { scansDir, scanPath } = useScanRoute();
149577
149597
  const [currentSearchParams] = useSearchParams();
149578
149598
  const buildUrl = useMemo(() => {
149579
- if (!summary2?.uuid) {
149599
+ if (!summary2?.identifier) {
149580
149600
  return (queryParams) => `?${queryParams}`;
149581
149601
  }
149582
149602
  return (queryParams) => {
@@ -149588,9 +149608,9 @@ const useMarkdownRefs = (summary2, inputData) => {
149588
149608
  for (const [key2, value2] of newParams) {
149589
149609
  mergedParams.set(key2, value2);
149590
149610
  }
149591
- return `#${scanResultRoute(scansDir, scanPath, summary2.uuid, mergedParams)}`;
149611
+ return `#${scanResultRoute(scansDir, scanPath, summary2.identifier, mergedParams)}`;
149592
149612
  };
149593
- }, [summary2?.uuid, scanPath, scansDir, currentSearchParams]);
149613
+ }, [summary2?.identifier, scanPath, scansDir, currentSearchParams]);
149594
149614
  const refs = summary2 ? toMarkdownRefs(
149595
149615
  summary2,
149596
149616
  (refId, type) => {
@@ -149763,8 +149783,8 @@ const ScannerResultsRowComponent = ({
149763
149783
  const setSelectedScanResult = useStore(
149764
149784
  (state) => state.setSelectedScanResult
149765
149785
  );
149766
- const isNavigable = summary2.uuid !== void 0 && !!scansDir;
149767
- const scanResultUrl = isNavigable ? scanResultRoute(scansDir, scanPath, summary2.uuid, searchParams) : "";
149786
+ const isNavigable = summary2.identifier !== void 0 && !!scansDir;
149787
+ const scanResultUrl = isNavigable ? scanResultRoute(scansDir, scanPath, summary2.identifier, searchParams) : "";
149768
149788
  const navigate = useLoggingNavigate("ScannerResultsRow");
149769
149789
  const hasExplanation = gridDescriptor.columns.includes("result");
149770
149790
  const hasLabel = gridDescriptor.columns.includes("label");
@@ -149781,12 +149801,12 @@ const ScannerResultsRowComponent = ({
149781
149801
  className: clsx(
149782
149802
  styles$t.row,
149783
149803
  !isNavigable ? styles$t.disabled : "",
149784
- selectedScanResult === summary2.uuid ? styles$t.selected : "",
149804
+ selectedScanResult === summary2.identifier ? styles$t.selected : "",
149785
149805
  hasExplanation ? "" : styles$t.noExplanation
149786
149806
  ),
149787
149807
  onClick: () => {
149788
- if (summary2.uuid) {
149789
- setSelectedScanResult(summary2.uuid);
149808
+ if (summary2.identifier) {
149809
+ setSelectedScanResult(summary2.identifier);
149790
149810
  }
149791
149811
  },
149792
149812
  children: [
@@ -149962,23 +149982,25 @@ const ScannerResultsList = ({
149962
149982
  }, [filteredSummaries, groupResultsBy]);
149963
149983
  const currentIndex = useMemo(() => {
149964
149984
  if (selectedScanResult) {
149965
- return filteredSummaries.findIndex((s4) => s4.uuid === selectedScanResult);
149985
+ return filteredSummaries.findIndex(
149986
+ (s4) => s4.identifier === selectedScanResult
149987
+ );
149966
149988
  }
149967
149989
  return -1;
149968
149990
  }, [selectedScanResult, filteredSummaries]);
149969
149991
  const handleNext = useCallback(() => {
149970
149992
  if (currentIndex >= 0 && currentIndex < filteredSummaries.length - 1) {
149971
149993
  const nextResult = filteredSummaries[currentIndex + 1];
149972
- if (nextResult?.uuid) {
149973
- setSelectedScanResult(nextResult.uuid);
149994
+ if (nextResult?.identifier) {
149995
+ setSelectedScanResult(nextResult.identifier);
149974
149996
  }
149975
149997
  }
149976
149998
  }, [currentIndex, filteredSummaries, setSelectedScanResult]);
149977
149999
  const handlePrevious = useCallback(() => {
149978
150000
  if (currentIndex > 0) {
149979
150001
  const previousResult = filteredSummaries[currentIndex - 1];
149980
- if (previousResult?.uuid) {
149981
- setSelectedScanResult(previousResult.uuid);
150002
+ if (previousResult?.identifier) {
150003
+ setSelectedScanResult(previousResult.identifier);
149982
150004
  }
149983
150005
  }
149984
150006
  }, [currentIndex, filteredSummaries, setSelectedScanResult]);
@@ -149991,7 +150013,7 @@ const ScannerResultsList = ({
149991
150013
  const route = scanResultRoute(
149992
150014
  scansDir,
149993
150015
  scanPath,
149994
- selectedResult?.uuid,
150016
+ selectedResult?.identifier,
149995
150017
  searchParams
149996
150018
  );
149997
150019
  if (newWindow) {
@@ -150018,9 +150040,9 @@ const ScannerResultsList = ({
150018
150040
  if (!isInputFocused) {
150019
150041
  if (e3.key === "ArrowUp") {
150020
150042
  if (e3.metaKey || e3.ctrlKey) {
150021
- if (filteredSummaries.length > 0 && filteredSummaries[0]?.uuid) {
150043
+ if (filteredSummaries.length > 0 && filteredSummaries[0]?.identifier) {
150022
150044
  e3.preventDefault();
150023
- setSelectedScanResult(filteredSummaries[0].uuid);
150045
+ setSelectedScanResult(filteredSummaries[0].identifier);
150024
150046
  }
150025
150047
  } else if (hasPrevious) {
150026
150048
  e3.preventDefault();
@@ -150030,9 +150052,9 @@ const ScannerResultsList = ({
150030
150052
  if (e3.metaKey || e3.ctrlKey) {
150031
150053
  if (filteredSummaries.length > 0) {
150032
150054
  e3.preventDefault();
150033
- const uuid = filteredSummaries[filteredSummaries.length - 1]?.uuid;
150034
- if (uuid) {
150035
- setSelectedScanResult(uuid);
150055
+ const identifier = filteredSummaries[filteredSummaries.length - 1]?.identifier;
150056
+ if (identifier) {
150057
+ setSelectedScanResult(identifier);
150036
150058
  }
150037
150059
  }
150038
150060
  } else if (hasNext) {
@@ -150059,8 +150081,8 @@ const ScannerResultsList = ({
150059
150081
  setSelectedScanResult
150060
150082
  ]);
150061
150083
  useEffect(() => {
150062
- if (!selectedScanResult && filteredSummaries.length > 0 && filteredSummaries[0]?.uuid) {
150063
- setSelectedScanResult(filteredSummaries[0].uuid);
150084
+ if (!selectedScanResult && filteredSummaries.length > 0 && filteredSummaries[0]?.identifier) {
150085
+ setSelectedScanResult(filteredSummaries[0].identifier);
150064
150086
  }
150065
150087
  }, [filteredSummaries, selectedScanResult, setSelectedScanResult]);
150066
150088
  useEffect(() => {
@@ -150074,7 +150096,7 @@ const ScannerResultsList = ({
150074
150096
  const selectedItemIndex = useMemo(() => {
150075
150097
  if (selectedScanResult) {
150076
150098
  const selectedIndex = filteredSummaries.findIndex(
150077
- (s4) => s4.uuid === selectedScanResult
150099
+ (s4) => s4.identifier === selectedScanResult
150078
150100
  );
150079
150101
  if (selectedIndex >= 0) {
150080
150102
  return selectedIndex;
@@ -150316,12 +150338,12 @@ const ScannerResultsBody = ({
150316
150338
  showRowNumbers: true,
150317
150339
  wrapText: dataframeWrapText,
150318
150340
  onRowDoubleClicked: (row2) => {
150319
- const uuid = row2.uuid;
150320
- if (uuid && scansDir) {
150341
+ const identifier = row2.identifier;
150342
+ if (identifier && scansDir) {
150321
150343
  const route = scanResultRoute(
150322
150344
  scansDir,
150323
150345
  scanPath,
150324
- uuid,
150346
+ identifier,
150325
150347
  searchParams
150326
150348
  );
150327
150349
  void navigate(route);
@@ -150930,24 +150952,24 @@ const useSelectedScanResultData = (scanResultUuid) => {
150930
150952
  const { data: columnTable } = useSelectedScanDataframe();
150931
150953
  return useScanResultData(columnTable, scanResultUuid);
150932
150954
  };
150933
- const useScanResultData = (columnTable, scanResultUuid) => {
150955
+ const useScanResultData = (columnTable, rowIdentifier) => {
150934
150956
  const [scanResultData, setScanResultData] = useState(void 0);
150935
150957
  const [isLoading, setIsLoading] = useState(false);
150936
150958
  const filtered = useMemo(() => {
150937
- if (!scanResultUuid || !columnTable) {
150959
+ if (!rowIdentifier || !columnTable) {
150938
150960
  return void 0;
150939
150961
  }
150940
150962
  if (columnTable.columnNames().length === 0) {
150941
150963
  return void 0;
150942
150964
  }
150943
- const filtered2 = columnTable.params({ targetUuid: scanResultUuid }).filter(
150944
- (d2, $2) => d2.uuid === $2.targetUuid
150965
+ const filtered2 = columnTable.params({ targetIdentifier: rowIdentifier }).filter(
150966
+ (d2, $2) => d2.identifier === $2.targetIdentifier
150945
150967
  );
150946
150968
  if (filtered2.numRows() === 0) {
150947
150969
  return void 0;
150948
150970
  }
150949
150971
  return filtered2;
150950
- }, [columnTable, scanResultUuid]);
150972
+ }, [columnTable, rowIdentifier]);
150951
150973
  useEffect(() => {
150952
150974
  if (!filtered) {
150953
150975
  setScanResultData(void 0);
@@ -150991,15 +151013,15 @@ const useScanDataframeInput = (params) => {
150991
151013
  staleTime: Infinity
150992
151014
  });
150993
151015
  };
150994
- const useSelectedScanResultInputData = () => {
150995
- const { resolvedScansDir, scanPath, scanResultUuid } = useScanRoute();
151016
+ const useSelectedScanResultInputData = (scanUuid) => {
151017
+ const { resolvedScansDir, scanPath } = useScanRoute();
150996
151018
  const scanner = useSelectedScanner();
150997
151019
  return useScanDataframeInput(
150998
- resolvedScansDir && scanPath && scanner.data && scanResultUuid ? {
151020
+ resolvedScansDir && scanPath && scanner.data && scanUuid ? {
150999
151021
  scansDir: resolvedScansDir,
151000
151022
  scanPath,
151001
151023
  scanner: scanner.data,
151002
- uuid: scanResultUuid
151024
+ uuid: scanUuid
151003
151025
  } : skipToken
151004
151026
  );
151005
151027
  };
@@ -152296,7 +152318,7 @@ const InfoPanel = ({ resultData }) => {
152296
152318
  /* @__PURE__ */ jsxRuntimeExports.jsx(CardBody, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
152297
152319
  RecordTree,
152298
152320
  {
152299
- id: `scan-metadata-${resultData?.uuid}`,
152321
+ id: `scan-metadata-${resultData?.identifier}`,
152300
152322
  record: resultData?.scanMetadata || {}
152301
152323
  }
152302
152324
  ) })
@@ -152314,7 +152336,7 @@ const ScannerInfoPanel = ({ resultData }) => {
152314
152336
  resultData?.scannerParams && Object.keys(resultData.scannerParams).length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(LabeledValue, { label: "Params", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
152315
152337
  RecordTree,
152316
152338
  {
152317
- id: `scanner-params-${resultData?.uuid}`,
152339
+ id: `scanner-params-${resultData?.identifier}`,
152318
152340
  record: resultData?.scannerParams
152319
152341
  }
152320
152342
  ) })
@@ -152353,7 +152375,7 @@ const MetadataPanel = ({ resultData }) => {
152353
152375
  hasMetadata && /* @__PURE__ */ jsxRuntimeExports.jsx(Card, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(CardBody, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(LabeledValue, { label: "Metadata", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
152354
152376
  RecordTree,
152355
152377
  {
152356
- id: `result-metadata-${resultData.uuid}`,
152378
+ id: `result-metadata-${resultData.identifier}`,
152357
152379
  record: resultData.metadata || {}
152358
152380
  }
152359
152381
  ) }) }) })
@@ -152725,7 +152747,7 @@ const InputRenderer = ({
152725
152747
  }
152726
152748
  );
152727
152749
  } else {
152728
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No Transcript Input Available" });
152750
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(NoContentsPanel, { text: "No transcript input available" });
152729
152751
  }
152730
152752
  } else if (isMessagesInput(inputData)) {
152731
152753
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -152797,9 +152819,11 @@ const styles$b = {
152797
152819
  validation,
152798
152820
  validationLabel
152799
152821
  };
152800
- const ResultSidebar = ({ resultData }) => {
152801
- const dfInput = useSelectedScanResultInputData();
152802
- const refs = useMarkdownRefs(resultData, dfInput.data);
152822
+ const ResultSidebar = ({
152823
+ inputData,
152824
+ resultData
152825
+ }) => {
152826
+ const refs = useMarkdownRefs(resultData, inputData);
152803
152827
  if (!resultData) {
152804
152828
  return /* @__PURE__ */ jsxRuntimeExports.jsx(NoContentsPanel, { text: "No result to display." });
152805
152829
  }
@@ -152881,7 +152905,7 @@ const ResultPanel = ({
152881
152905
  transcriptDir,
152882
152906
  hasTranscript
152883
152907
  }) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: clsx(styles$c.container, "text-size-base"), children: [
152884
- /* @__PURE__ */ jsxRuntimeExports.jsx(ResultSidebar, { resultData }),
152908
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ResultSidebar, { inputData, resultData }),
152885
152909
  inputData ? /* @__PURE__ */ jsxRuntimeExports.jsx(
152886
152910
  ResultBody,
152887
152911
  {
@@ -153140,7 +153164,9 @@ const ScannerResultNav = () => {
153140
153164
  if (!visibleScannerResults) {
153141
153165
  return -1;
153142
153166
  }
153143
- return visibleScannerResults.findIndex((s4) => s4.uuid === scanResultUuid);
153167
+ return visibleScannerResults.findIndex(
153168
+ (s4) => s4.identifier === scanResultUuid
153169
+ );
153144
153170
  }, [visibleScannerResults, scanResultUuid]);
153145
153171
  const hasPrevious = currentIndex > 0;
153146
153172
  const hasNext = visibleScannerResults && currentIndex >= 0 && currentIndex < visibleScannerResults.length - 1;
@@ -153155,7 +153181,7 @@ const ScannerResultNav = () => {
153155
153181
  const route = scanResultRoute(
153156
153182
  scansDir,
153157
153183
  scanPath,
153158
- previousResult?.uuid,
153184
+ previousResult?.identifier,
153159
153185
  searchParams
153160
153186
  );
153161
153187
  void navigate(route);
@@ -153171,7 +153197,7 @@ const ScannerResultNav = () => {
153171
153197
  const route = scanResultRoute(
153172
153198
  scansDir,
153173
153199
  scanPath,
153174
- nextResult?.uuid,
153200
+ nextResult?.identifier,
153175
153201
  searchParams
153176
153202
  );
153177
153203
  void navigate(route);
@@ -153289,7 +153315,7 @@ const ScannerResultPanel = () => {
153289
153315
  );
153290
153316
  const setSelectedResultTab = useStore((state) => state.setSelectedResultTab);
153291
153317
  const { data: selectedResult, loading: resultLoading } = useSelectedScanResultData(scanResultUuid);
153292
- const { loading: inputLoading, data: inputData } = useSelectedScanResultInputData();
153318
+ const { loading: inputLoading, data: inputData } = useSelectedScanResultInputData(selectedResult?.uuid);
153293
153319
  const taskName = inputData && isTranscriptInput(inputData) ? getTranscriptDisplayName(inputData.input) : void 0;
153294
153320
  useDocumentTitle(
153295
153321
  taskName,
@@ -153415,7 +153441,7 @@ const ScannerResultPanel = () => {
153415
153441
  handleTabChange(kTabIdResult);
153416
153442
  },
153417
153443
  className: styles$8.fullHeight,
153418
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
153444
+ children: resultData && inputData && /* @__PURE__ */ jsxRuntimeExports.jsx(
153419
153445
  ResultPanel,
153420
153446
  {
153421
153447
  resultData,