@meridianlabs/log-viewer 0.3.183 → 0.3.184

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 (34) hide show
  1. package/lib/app/samples/SampleDetailComponent.d.ts.map +1 -1
  2. package/lib/app/samples/chat/MessageContents.d.ts.map +1 -1
  3. package/lib/app/samples/chat/tools/substituteToolCallContent.d.ts +7 -0
  4. package/lib/app/samples/chat/tools/substituteToolCallContent.d.ts.map +1 -0
  5. package/lib/app/samples/chat/tools/tool.d.ts +1 -0
  6. package/lib/app/samples/chat/tools/tool.d.ts.map +1 -1
  7. package/lib/app/samples/transcript/ApprovalEventView.d.ts.map +1 -1
  8. package/lib/app/samples/transcript/CompactionEventView.d.ts.map +1 -1
  9. package/lib/app/samples/transcript/InfoEventView.d.ts.map +1 -1
  10. package/lib/app/samples/transcript/LoggerEventView.d.ts.map +1 -1
  11. package/lib/app/samples/transcript/ModelEventView.d.ts.map +1 -1
  12. package/lib/app/samples/transcript/SampleLimitEventView.d.ts.map +1 -1
  13. package/lib/app/samples/transcript/SandboxEventView.d.ts.map +1 -1
  14. package/lib/app/samples/transcript/ScoreEventView.d.ts.map +1 -1
  15. package/lib/app/samples/transcript/SpanEventView.d.ts.map +1 -1
  16. package/lib/app/samples/transcript/StepEventView.d.ts.map +1 -1
  17. package/lib/app/samples/transcript/SubtaskEventView.d.ts.map +1 -1
  18. package/lib/app/samples/transcript/ToolEventView.d.ts.map +1 -1
  19. package/lib/app/samples/transcript/event/utils.d.ts +6 -0
  20. package/lib/app/samples/transcript/event/utils.d.ts.map +1 -1
  21. package/lib/app/samples/transcript/eventSearchText.d.ts.map +1 -1
  22. package/lib/app/usage/UsageCard.d.ts +1 -1
  23. package/lib/app/usage/UsageCard.d.ts.map +1 -1
  24. package/lib/components/ExtendedFindContext.d.ts +3 -0
  25. package/lib/components/ExtendedFindContext.d.ts.map +1 -1
  26. package/lib/components/FindBand.d.ts.map +1 -1
  27. package/lib/components/LiveVirtualList.d.ts.map +1 -1
  28. package/lib/index.js +517 -371
  29. package/lib/index.js.map +1 -1
  30. package/lib/state/sampleSlice.d.ts +1 -0
  31. package/lib/state/sampleSlice.d.ts.map +1 -1
  32. package/lib/state/useLoadSample.d.ts.map +1 -1
  33. package/lib/styles/index.css +14 -16
  34. package/package.json +6 -2
package/lib/index.js CHANGED
@@ -16651,7 +16651,7 @@ const createLogsSlice = (set3, get2, _store) => {
16651
16651
  if (!isInFileList) {
16652
16652
  if (state.replicationService?.isReplicating() && !state.app.singleFileMode) {
16653
16653
  await state.logsActions.syncLogs();
16654
- const logHandle = state.logs.logs.find(
16654
+ const logHandle = get2().logs.logs.find(
16655
16655
  (val) => val.name.endsWith(logFile)
16656
16656
  );
16657
16657
  if (!logHandle) {
@@ -17264,6 +17264,19 @@ const createSampleSlice = (set3, get2, _store) => {
17264
17264
  state.log.selectedSampleHandle = void 0;
17265
17265
  });
17266
17266
  },
17267
+ prepareForSampleLoad: (logFile, id, epoch) => {
17268
+ getSamplePolling().stopPolling();
17269
+ selectedSampleRef.current = void 0;
17270
+ set3((state) => {
17271
+ state.sample.selectedSampleObject = void 0;
17272
+ state.sample.sampleInState = false;
17273
+ state.sample.runningEvents = [];
17274
+ state.sample.sampleStatus = "loading";
17275
+ state.sample.sampleError = void 0;
17276
+ state.sample.sample_identifier = { logFile, id, epoch };
17277
+ state.log.selectedSampleHandle = void 0;
17278
+ });
17279
+ },
17267
17280
  setSampleStatus: (status2) => set3((state) => {
17268
17281
  state.sample.sampleStatus = status2;
17269
17282
  }),
@@ -99729,6 +99742,17 @@ const isCitationWithRange = (citation) => Array.isArray(citation.cited_text);
99729
99742
  const isOpenRouterReasoning = (text2) => {
99730
99743
  return text2.startsWith("[{'format'");
99731
99744
  };
99745
+ const substituteToolCallContent = (content2, args2) => {
99746
+ const replace2 = (text2) => text2.replace(
99747
+ /\{\{(\w+)\}\}/g,
99748
+ (match2, key2) => Object.hasOwn(args2, key2) ? String(args2[key2]) : match2
99749
+ );
99750
+ return {
99751
+ ...content2,
99752
+ title: content2.title ? replace2(content2.title) : content2.title,
99753
+ content: replace2(content2.content)
99754
+ };
99755
+ };
99732
99756
  const kToolTodoContentType = "agent/todo-list";
99733
99757
  const resolveToolInput = (fn3, toolArgs) => {
99734
99758
  const toolName = fn3;
@@ -100131,7 +100155,10 @@ const MessageContents = ({
100131
100155
  contentType,
100132
100156
  output: resolvedToolOutput,
100133
100157
  collapsible: false,
100134
- view: tool_call.view ? tool_call.view : void 0
100158
+ view: tool_call.view ? substituteToolCallContent(
100159
+ tool_call.view,
100160
+ tool_call.arguments
100161
+ ) : void 0
100135
100162
  },
100136
100163
  `tool-call-${idx}`
100137
100164
  );
@@ -104531,11 +104558,11 @@ const useFlowServerData = (dir) => {
104531
104558
  }
104532
104559
  }, [dir, flowDir, api2, updateFlowData]);
104533
104560
  };
104534
- const wrapper$4 = "_wrapper_1tajk_1";
104561
+ const wrapper$3 = "_wrapper_1tajk_1";
104535
104562
  const container$j = "_container_1tajk_12";
104536
104563
  const animate = "_animate_1tajk_21";
104537
104564
  const styles$1f = {
104538
- wrapper: wrapper$4,
104565
+ wrapper: wrapper$3,
104539
104566
  container: container$j,
104540
104567
  animate
104541
104568
  };
@@ -106529,7 +106556,7 @@ const ViewerOptionsPopover = ({
106529
106556
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$1d.fullWidth, styles$1d.fullWidthPadded), children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: styles$1d.logDir, children: logDir2 }) }),
106530
106557
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$1d.spacer) }),
106531
106558
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx("text-style-label", "text-style-secondary"), children: "Version" }),
106532
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(), children: "0.3.183-0-gd05f97fee" }),
106559
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(), children: "0.3.184-0-g924aa90c5" }),
106533
106560
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx("text-style-label", "text-style-secondary"), children: "Schema" }),
106534
106561
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(), children: DB_VERSION }),
106535
106562
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$1d.spacer) }),
@@ -164848,6 +164875,7 @@ const appendPendingItems = (evalSet, tasksWithLogFiles, collapsedLogItems) => {
164848
164875
  };
164849
164876
  const SAMPLE_LIST_KEYS = ["transcript-tree"];
164850
164877
  const log$1 = createLogger("useSampleLoader");
164878
+ let loadGeneration = 0;
164851
164879
  function useLoadSample() {
164852
164880
  const sampleData = useSampleData();
164853
164881
  const logSelection = useLogSelection();
@@ -164877,20 +164905,24 @@ function useLoadSample() {
164877
164905
  if (isSameSample && isLoading) {
164878
164906
  return;
164879
164907
  }
164908
+ const thisGeneration = ++loadGeneration;
164880
164909
  for (const key2 of SAMPLE_LIST_KEYS) {
164881
164910
  clearListPosition(key2);
164882
164911
  }
164883
- sampleActions.setSampleIdentifier(logFile, id, epoch);
164884
- sampleActions.setSampleError(void 0);
164885
- sampleActions.setSampleStatus("loading");
164912
+ sampleActions.prepareForSampleLoad(logFile, id, epoch);
164886
164913
  try {
164887
164914
  if (completed !== false) {
164888
164915
  log$1.debug(`LOADING COMPLETED SAMPLE: ${id}-${epoch}`);
164889
164916
  getSamplePolling().stopPolling();
164890
164917
  const sample2 = await api2?.get_log_sample(logFile, id, epoch);
164891
164918
  log$1.debug(`LOADED COMPLETED SAMPLE: ${id}-${epoch}`);
164919
+ if (thisGeneration !== loadGeneration) {
164920
+ log$1.debug(`Discarding stale sample response: ${id}-${epoch}`);
164921
+ return;
164922
+ }
164892
164923
  if (sample2) {
164893
- if (currentId?.id !== sample2.id || currentId?.epoch !== sample2.epoch || currentId?.logFile !== logFile) {
164924
+ const isNewSample = currentId?.id !== id || currentId?.epoch !== epoch || currentId?.logFile !== logFile;
164925
+ if (isNewSample) {
164894
164926
  sampleActions.clearCollapsedEvents();
164895
164927
  }
164896
164928
  const migratedSample = resolveSample$1(sample2);
@@ -165185,6 +165217,7 @@ const ExtendedFindProvider = ({
165185
165217
  children: children2
165186
165218
  }) => {
165187
165219
  const virtualLists = useRef(/* @__PURE__ */ new Map());
165220
+ const matchCounters = useRef(/* @__PURE__ */ new Map());
165188
165221
  const extendedFindTerm = useCallback(
165189
165222
  async (term, direction) => {
165190
165223
  for (const [, searchFn] of virtualLists.current) {
@@ -165225,9 +165258,27 @@ const ExtendedFindProvider = ({
165225
165258
  },
165226
165259
  []
165227
165260
  );
165261
+ const countAllMatches = useCallback((term) => {
165262
+ let total = 0;
165263
+ for (const [, countFn] of matchCounters.current) {
165264
+ total += countFn(term);
165265
+ }
165266
+ return total;
165267
+ }, []);
165268
+ const registerMatchCounter = useCallback(
165269
+ (id, countFn) => {
165270
+ matchCounters.current.set(id, countFn);
165271
+ return () => {
165272
+ matchCounters.current.delete(id);
165273
+ };
165274
+ },
165275
+ []
165276
+ );
165228
165277
  const contextValue = {
165229
165278
  extendedFindTerm,
165230
- registerVirtualList
165279
+ registerVirtualList,
165280
+ countAllMatches,
165281
+ registerMatchCounter
165231
165282
  };
165232
165283
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ExtendedFindContext.Provider, { value: contextValue, children: children2 });
165233
165284
  };
@@ -165248,16 +165299,20 @@ const findConfig = {
165248
165299
  const FindBand = () => {
165249
165300
  const searchBoxRef = useRef(null);
165250
165301
  const storeHideFind = useStore((state) => state.appActions.hideFind);
165251
- const { extendedFindTerm } = useExtendedFind();
165302
+ const { extendedFindTerm, countAllMatches } = useExtendedFind();
165252
165303
  const lastFoundItem = useRef(null);
165253
165304
  const currentSearchTerm = useRef("");
165254
165305
  const needsCursorRestoreRef = useRef(false);
165255
- const lastNoResultTerm = useRef("");
165256
- const lastNoResultDirection = useRef(null);
165257
165306
  const scrollTimeoutRef = useRef(null);
165258
165307
  const focusTimeoutRef = useRef(null);
165259
165308
  const searchIdRef = useRef(0);
165309
+ const cachedCount = useRef({
165310
+ term: "",
165311
+ count: 0
165312
+ });
165260
165313
  const mutatedPanelsRef = useRef(/* @__PURE__ */ new Map());
165314
+ const [matchCount, setMatchCount] = useState(null);
165315
+ const [currentMatchIndex, setCurrentMatchIndex] = useState(0);
165261
165316
  const getParentExpandablePanel = useCallback(
165262
165317
  (selection) => {
165263
165318
  let node2 = selection.anchorNode;
@@ -165276,23 +165331,26 @@ const FindBand = () => {
165276
165331
  const thisSearchId = ++searchIdRef.current;
165277
165332
  const searchTerm = searchBoxRef.current?.value ?? "";
165278
165333
  if (!searchTerm) {
165334
+ setMatchCount(null);
165335
+ setCurrentMatchIndex(0);
165279
165336
  return;
165280
165337
  }
165281
165338
  if (currentSearchTerm.current !== searchTerm) {
165282
165339
  lastFoundItem.current = null;
165283
165340
  currentSearchTerm.current = searchTerm;
165341
+ setCurrentMatchIndex(0);
165284
165342
  }
165285
- const noResultEl = document.getElementById("inspect-find-no-results");
165286
- if (lastNoResultTerm.current && searchTerm.startsWith(lastNoResultTerm.current) && lastNoResultDirection.current === back) {
165287
- if (noResultEl) {
165288
- noResultEl.style.opacity = "1";
165289
- noResultEl.setAttribute("aria-hidden", "false");
165290
- }
165291
- return;
165343
+ let total;
165344
+ if (cachedCount.current.term === searchTerm) {
165345
+ total = cachedCount.current.count;
165346
+ } else {
165347
+ total = countAllMatches(searchTerm);
165348
+ cachedCount.current = { term: searchTerm, count: total };
165292
165349
  }
165293
- if (lastNoResultTerm.current && (!searchTerm.startsWith(lastNoResultTerm.current) || lastNoResultDirection.current !== back)) {
165294
- lastNoResultTerm.current = "";
165295
- lastNoResultDirection.current = null;
165350
+ setMatchCount(total);
165351
+ if (total === 0) {
165352
+ setCurrentMatchIndex(0);
165353
+ return;
165296
165354
  }
165297
165355
  const focusedElement = document.activeElement;
165298
165356
  const selection = window.getSelection();
@@ -165302,22 +165360,15 @@ const FindBand = () => {
165302
165360
  }
165303
165361
  const savedScrollParent = savedRange ? findScrollableParent(savedRange.startContainer.parentElement) : null;
165304
165362
  const savedScrollTop = savedScrollParent?.scrollTop ?? 0;
165305
- let result2 = await findExtendedInDOM(
165363
+ const result2 = await findExtendedInDOM(
165306
165364
  searchTerm,
165307
165365
  back,
165308
165366
  lastFoundItem.current,
165309
165367
  extendedFindTerm
165310
165368
  );
165311
- if (!noResultEl) {
165312
- return;
165313
- }
165314
165369
  if (searchIdRef.current !== thisSearchId) {
165315
165370
  return;
165316
165371
  }
165317
- noResultEl.style.opacity = result2 ? "0" : "1";
165318
- noResultEl.setAttribute("aria-hidden", result2 ? "true" : "false");
165319
- lastNoResultTerm.current = result2 ? "" : searchTerm;
165320
- lastNoResultDirection.current = result2 ? null : back;
165321
165372
  if (!result2 && savedRange) {
165322
165373
  const sel = window.getSelection();
165323
165374
  if (sel) {
@@ -165333,11 +165384,21 @@ const FindBand = () => {
165333
165384
  if (selection2 && selection2.rangeCount > 0) {
165334
165385
  const range2 = selection2.getRangeAt(0);
165335
165386
  const parentElement = range2.startContainer.parentElement || range2.commonAncestorContainer;
165387
+ const isNewMatch = !isLastFoundItem(range2, lastFoundItem.current);
165336
165388
  lastFoundItem.current = {
165337
165389
  text: range2.toString(),
165338
165390
  offset: range2.startOffset,
165339
165391
  parentElement
165340
165392
  };
165393
+ if (isNewMatch) {
165394
+ setCurrentMatchIndex((prev) => {
165395
+ if (back) {
165396
+ return prev <= 1 ? total : prev - 1;
165397
+ } else {
165398
+ return prev >= total ? 1 : prev + 1;
165399
+ }
165400
+ });
165401
+ }
165341
165402
  const parentPanel = getParentExpandablePanel(selection2);
165342
165403
  if (parentPanel) {
165343
165404
  if (!mutatedPanelsRef.current.has(parentPanel)) {
@@ -165363,7 +165424,7 @@ const FindBand = () => {
165363
165424
  }
165364
165425
  focusedElement?.focus();
165365
165426
  },
165366
- [getParentExpandablePanel, extendedFindTerm]
165427
+ [getParentExpandablePanel, extendedFindTerm, countAllMatches]
165367
165428
  );
165368
165429
  useEffect(() => {
165369
165430
  focusTimeoutRef.current = window.setTimeout(() => {
@@ -165478,6 +165539,11 @@ const FindBand = () => {
165478
165539
  document.removeEventListener("keydown", handleGlobalKeyDown, true);
165479
165540
  };
165480
165541
  }, [handleSearch, restoreCursor]);
165542
+ const matchCountLabel = useMemo(() => {
165543
+ if (matchCount === null) return null;
165544
+ if (matchCount === 0) return "No results";
165545
+ return `${currentMatchIndex} of ${matchCount}`;
165546
+ }, [matchCount, currentMatchIndex]);
165481
165547
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { "data-unsearchable": "true", className: clsx("findBand"), children: [
165482
165548
  /* @__PURE__ */ jsxRuntimeExports.jsx(
165483
165549
  "input",
@@ -165490,7 +165556,16 @@ const FindBand = () => {
165490
165556
  onChange: handleInputChange
165491
165557
  }
165492
165558
  ),
165493
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { id: "inspect-find-no-results", "aria-hidden": "true", children: "No results" }),
165559
+ matchCountLabel !== null && /* @__PURE__ */ jsxRuntimeExports.jsx(
165560
+ "span",
165561
+ {
165562
+ className: clsx(
165563
+ "findBand-match-count",
165564
+ matchCount === 0 && "findBand-no-results"
165565
+ ),
165566
+ children: matchCountLabel
165567
+ }
165568
+ ),
165494
165569
  /* @__PURE__ */ jsxRuntimeExports.jsx(
165495
165570
  "button",
165496
165571
  {
@@ -165523,21 +165598,35 @@ const FindBand = () => {
165523
165598
  )
165524
165599
  ] });
165525
165600
  };
165601
+ function windowFind(searchTerm, back) {
165602
+ return window.find(
165603
+ searchTerm,
165604
+ findConfig.caseSensitive,
165605
+ back,
165606
+ findConfig.wrapAround,
165607
+ findConfig.wholeWord,
165608
+ findConfig.searchInFrames,
165609
+ findConfig.showDialog
165610
+ );
165611
+ }
165612
+ function positionSelectionForWrap(back) {
165613
+ if (!back) return;
165614
+ const sel = window.getSelection();
165615
+ if (sel) {
165616
+ const range2 = document.createRange();
165617
+ range2.selectNodeContents(document.body);
165618
+ range2.collapse(false);
165619
+ sel.removeAllRanges();
165620
+ sel.addRange(range2);
165621
+ }
165622
+ }
165526
165623
  async function findExtendedInDOM(searchTerm, back, lastFoundItem, extendedFindTerm) {
165527
165624
  let result2 = false;
165528
- let attempts = 0;
165529
165625
  let hasTriedExtendedSearch = false;
165626
+ let extendedSearchSucceeded = false;
165530
165627
  const maxAttempts = 25;
165531
- do {
165532
- result2 = window.find(
165533
- searchTerm,
165534
- findConfig.caseSensitive,
165535
- back,
165536
- findConfig.wrapAround,
165537
- findConfig.wholeWord,
165538
- findConfig.searchInFrames,
165539
- findConfig.showDialog
165540
- );
165628
+ for (let attempts = 0; attempts < maxAttempts; attempts++) {
165629
+ result2 = windowFind(searchTerm, back);
165541
165630
  if (result2) {
165542
165631
  const selection = window.getSelection();
165543
165632
  if (selection && selection.rangeCount > 0) {
@@ -165548,24 +165637,74 @@ async function findExtendedInDOM(searchTerm, back, lastFoundItem, extendedFindTe
165548
165637
  break;
165549
165638
  }
165550
165639
  if (isSameAsLast) {
165551
- return false;
165640
+ if (!hasTriedExtendedSearch) {
165641
+ hasTriedExtendedSearch = true;
165642
+ window.getSelection()?.removeAllRanges();
165643
+ const foundInVirtual = await extendedFindTerm(
165644
+ searchTerm,
165645
+ back ? "backward" : "forward"
165646
+ );
165647
+ if (foundInVirtual) {
165648
+ extendedSearchSucceeded = true;
165649
+ continue;
165650
+ }
165651
+ }
165652
+ if (extendedSearchSucceeded) {
165653
+ const sel = window.getSelection();
165654
+ if (sel?.rangeCount) {
165655
+ sel.getRangeAt(0).collapse(!back);
165656
+ }
165657
+ } else {
165658
+ window.getSelection()?.removeAllRanges();
165659
+ positionSelectionForWrap(back);
165660
+ }
165661
+ result2 = windowFind(searchTerm, back);
165662
+ if (result2) {
165663
+ const sel = window.getSelection();
165664
+ if (sel && sel.rangeCount > 0) {
165665
+ const r2 = sel.getRangeAt(0);
165666
+ if (inUnsearchableElement(r2)) {
165667
+ continue;
165668
+ }
165669
+ }
165670
+ }
165671
+ break;
165552
165672
  }
165553
165673
  }
165554
165674
  } else if (!hasTriedExtendedSearch) {
165555
165675
  hasTriedExtendedSearch = true;
165676
+ window.getSelection()?.removeAllRanges();
165556
165677
  const foundInVirtual = await extendedFindTerm(
165557
165678
  searchTerm,
165558
165679
  back ? "backward" : "forward"
165559
165680
  );
165560
- if (foundInVirtual) ;
165561
- else {
165562
- break;
165681
+ if (foundInVirtual) {
165682
+ extendedSearchSucceeded = true;
165683
+ continue;
165563
165684
  }
165685
+ positionSelectionForWrap(back);
165686
+ result2 = windowFind(searchTerm, back);
165687
+ if (result2) {
165688
+ const sel = window.getSelection();
165689
+ if (sel && sel.rangeCount > 0) {
165690
+ const r2 = sel.getRangeAt(0);
165691
+ if (inUnsearchableElement(r2)) {
165692
+ continue;
165693
+ }
165694
+ }
165695
+ }
165696
+ break;
165564
165697
  } else {
165565
165698
  break;
165566
165699
  }
165567
- attempts++;
165568
- } while (attempts < maxAttempts);
165700
+ }
165701
+ if (result2) {
165702
+ const sel = window.getSelection();
165703
+ if (sel?.rangeCount && inUnsearchableElement(sel.getRangeAt(0))) {
165704
+ sel.removeAllRanges();
165705
+ result2 = false;
165706
+ }
165707
+ }
165569
165708
  return result2;
165570
165709
  }
165571
165710
  function isLastFoundItem(range2, lastFoundItem) {
@@ -165990,15 +166129,15 @@ const betterContentText = (content2, excludeToolUsage, excludeReasoning) => {
165990
166129
  const allText = content2.map((c2) => textFromContent(c2, excludeToolUsage, excludeReasoning)).filter((text2) => text2 !== null);
165991
166130
  return allText.join("\n");
165992
166131
  };
165993
- const wrapper$3 = "_wrapper_sq96g_1";
165994
- const col2$2 = "_col2_sq96g_8";
166132
+ const wrapper$2 = "_wrapper_sq96g_1";
166133
+ const col2$1 = "_col2_sq96g_8";
165995
166134
  const col1_3$1 = "_col1_3_sq96g_12";
165996
166135
  const col3$1 = "_col3_sq96g_16";
165997
166136
  const separator$5 = "_separator_sq96g_20";
165998
166137
  const padded$1 = "_padded_sq96g_26";
165999
166138
  const styles$12 = {
166000
- wrapper: wrapper$3,
166001
- col2: col2$2,
166139
+ wrapper: wrapper$2,
166140
+ col2: col2$1,
166002
166141
  col1_3: col1_3$1,
166003
166142
  col3: col3$1,
166004
166143
  separator: separator$5,
@@ -166255,7 +166394,7 @@ const LiveVirtualList = ({
166255
166394
  itemSearchText
166256
166395
  }) => {
166257
166396
  const { getRestoreState, isScrolling, visibleRange, setVisibleRange } = useVirtuosoState(listHandle, `live-virtual-list-${id}`);
166258
- const { registerVirtualList } = useExtendedFind();
166397
+ const { registerVirtualList, registerMatchCounter } = useExtendedFind();
166259
166398
  const pendingSearchCallback = useRef(null);
166260
166399
  const [isCurrentlyScrolling, setIsCurrentlyScrolling] = useState(false);
166261
166400
  const [followOutput, setFollowOutput] = useProperty(
@@ -166350,26 +166489,35 @@ const LiveVirtualList = ({
166350
166489
  },
166351
166490
  [itemSearchText, defaultItemSearchText, searchInText]
166352
166491
  );
166492
+ const scrollToMatch = useCallback(
166493
+ (index, onContentReady) => {
166494
+ pendingSearchCallback.current = onContentReady;
166495
+ listHandle.current?.scrollToIndex({
166496
+ index,
166497
+ behavior: "auto",
166498
+ align: "center"
166499
+ });
166500
+ setTimeout(() => {
166501
+ if (pendingSearchCallback.current === onContentReady) {
166502
+ pendingSearchCallback.current = null;
166503
+ onContentReady();
166504
+ }
166505
+ }, 200);
166506
+ },
166507
+ [listHandle]
166508
+ );
166353
166509
  const searchInData = useCallback(
166354
166510
  async (term, direction, onContentReady) => {
166355
166511
  if (!data.length || !term) return false;
166356
- const currentIndex = direction === "forward" ? visibleRange.endIndex : visibleRange.startIndex;
166357
- const searchStart = direction === "forward" ? Math.max(0, currentIndex + 1) : Math.min(data.length - 1, currentIndex - 1);
166358
- const step = direction === "forward" ? 1 : -1;
166359
- for (let i = searchStart; i >= 0 && i < data.length; i += step) {
166512
+ const isForward = direction === "forward";
166513
+ const currentIndex = isForward ? visibleRange.endIndex : visibleRange.startIndex;
166514
+ const len = data.length;
166515
+ for (let offset2 = 1; offset2 < len; offset2++) {
166516
+ const i = isForward ? (currentIndex + offset2) % len : (currentIndex - offset2 + len) % len;
166517
+ if (i >= visibleRange.startIndex && i <= visibleRange.endIndex)
166518
+ continue;
166360
166519
  if (searchInItem(data[i], term)) {
166361
- pendingSearchCallback.current = onContentReady;
166362
- listHandle.current?.scrollToIndex({
166363
- index: i,
166364
- behavior: "auto",
166365
- align: "center"
166366
- });
166367
- setTimeout(() => {
166368
- if (pendingSearchCallback.current === onContentReady) {
166369
- pendingSearchCallback.current = null;
166370
- onContentReady();
166371
- }
166372
- }, 200);
166520
+ scrollToMatch(i, onContentReady);
166373
166521
  return true;
166374
166522
  }
166375
166523
  }
@@ -166380,13 +166528,45 @@ const LiveVirtualList = ({
166380
166528
  searchInItem,
166381
166529
  visibleRange.endIndex,
166382
166530
  visibleRange.startIndex,
166383
- listHandle
166531
+ scrollToMatch
166384
166532
  ]
166385
166533
  );
166534
+ const countMatchesInData = useCallback(
166535
+ (term) => {
166536
+ if (!term || !data.length) return 0;
166537
+ const lower = term.toLowerCase();
166538
+ let total = 0;
166539
+ const getSearchText = itemSearchText ?? defaultItemSearchText;
166540
+ for (const item2 of data) {
166541
+ const texts = getSearchText(item2);
166542
+ const textArray = Array.isArray(texts) ? texts : [texts];
166543
+ for (const text2 of textArray) {
166544
+ const lowerText = text2.toLowerCase();
166545
+ let pos2 = 0;
166546
+ while ((pos2 = lowerText.indexOf(lower, pos2)) !== -1) {
166547
+ total++;
166548
+ pos2 += lower.length;
166549
+ }
166550
+ }
166551
+ }
166552
+ return total;
166553
+ },
166554
+ [data, itemSearchText, defaultItemSearchText]
166555
+ );
166386
166556
  useEffect(() => {
166387
- const unregister = registerVirtualList(id, searchInData);
166388
- return unregister;
166389
- }, [id, registerVirtualList, searchInData]);
166557
+ const unregisterSearch = registerVirtualList(id, searchInData);
166558
+ const unregisterCount = registerMatchCounter(id, countMatchesInData);
166559
+ return () => {
166560
+ unregisterSearch();
166561
+ unregisterCount();
166562
+ };
166563
+ }, [
166564
+ id,
166565
+ registerVirtualList,
166566
+ registerMatchCounter,
166567
+ searchInData,
166568
+ countMatchesInData
166569
+ ]);
166390
166570
  const Footer = () => {
166391
166571
  return showProgress ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$$.progressContainer), children: /* @__PURE__ */ jsxRuntimeExports.jsx(PulsingDots, { subtle: false, size: "medium" }) }) : void 0;
166392
166572
  };
@@ -168547,6 +168727,95 @@ const EventRow = ({
168547
168727
  const card2 = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx("card", styles$Q.contents), children: contentEl });
168548
168728
  return card2;
168549
168729
  };
168730
+ const sampleLimitTitles = {
168731
+ custom: "Custom Limit Exceeded",
168732
+ time: "Time Limit Exceeded",
168733
+ message: "Message Limit Exceeded",
168734
+ token: "Token Limit Exceeded",
168735
+ operator: "Operator Canceled",
168736
+ working: "Execution Time Limit Exceeded",
168737
+ cost: "Cost Limit Exceeded"
168738
+ };
168739
+ const approvalDecisionLabels = {
168740
+ approve: "Approved",
168741
+ reject: "Rejected",
168742
+ terminate: "Terminated",
168743
+ escalate: "Escalated",
168744
+ modify: "Modified"
168745
+ };
168746
+ const eventTitle = (event) => {
168747
+ switch (event.event) {
168748
+ case "model":
168749
+ return event.role ? `Model Call (${event.role}): ${event.model}` : `Model Call: ${event.model}`;
168750
+ case "tool": {
168751
+ let title2 = event.view?.title || event.function;
168752
+ if (event.view?.title) {
168753
+ title2 = title2.replace(
168754
+ /\{\{(\w+)\}\}/g,
168755
+ (match2, key2) => Object.hasOwn(event.arguments, key2) ? String(event.arguments[key2]) : match2
168756
+ );
168757
+ }
168758
+ return `Tool: ${title2}`;
168759
+ }
168760
+ case "error":
168761
+ return "Error";
168762
+ case "logger":
168763
+ return event.message.level;
168764
+ case "info":
168765
+ return "Info" + (event.source ? ": " + event.source : "");
168766
+ case "compaction": {
168767
+ const source2 = event.source && event.source !== "inspect" ? event.source : "";
168768
+ return "Compaction" + source2;
168769
+ }
168770
+ case "step":
168771
+ if (event.name === kSandboxSignalName) return "Sandbox Events";
168772
+ if (event.name === "init") return "Init";
168773
+ if (event.name === "sample_init") return "Sample Init";
168774
+ return event.type ? `${event.type}: ${event.name}` : `Step: ${event.name}`;
168775
+ case "subtask":
168776
+ return event.type === "fork" ? `Fork: ${event.name}` : `Subtask: ${event.name}`;
168777
+ case "span_begin":
168778
+ if (event.span_id === kSandboxSignalName) return "Sandbox Events";
168779
+ if (event.name === "init") return "Init";
168780
+ if (event.name === "sample_init") return "Sample Init";
168781
+ return event.type ? `${event.type}: ${event.name}` : `Step: ${event.name}`;
168782
+ case "score":
168783
+ return (event.intermediate ? "Intermediate " : "") + "Score";
168784
+ case "score_edit":
168785
+ return "Edit Score";
168786
+ case "sample_init":
168787
+ return "Sample";
168788
+ case "sample_limit":
168789
+ return sampleLimitTitles[event.type] ?? event.type;
168790
+ case "input":
168791
+ return "Input";
168792
+ case "approval":
168793
+ return approvalDecisionLabels[event.decision] ?? event.decision;
168794
+ case "sandbox":
168795
+ return `Sandbox: ${event.action}`;
168796
+ default:
168797
+ return "";
168798
+ }
168799
+ };
168800
+ const formatTiming = (timestamp2, working_start) => {
168801
+ if (working_start) {
168802
+ return `${formatDateTime(new Date(timestamp2))}
168803
+ @ working time: ${formatTime$1(working_start)}`;
168804
+ } else {
168805
+ return formatDateTime(new Date(timestamp2));
168806
+ }
168807
+ };
168808
+ const formatTitle = (title2, total_tokens, working_start) => {
168809
+ const subItems = [];
168810
+ if (total_tokens) {
168811
+ subItems.push(`${formatNumber(total_tokens)} tokens`);
168812
+ }
168813
+ if (working_start) {
168814
+ subItems.push(`${formatTime$1(working_start)}`);
168815
+ }
168816
+ const subtitle = subItems.length > 0 ? ` (${subItems.join(", ")})` : "";
168817
+ return `${title2}${subtitle}`;
168818
+ };
168550
168819
  const ApprovalEventView = ({
168551
168820
  eventNode,
168552
168821
  className: className2
@@ -168555,29 +168824,13 @@ const ApprovalEventView = ({
168555
168824
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
168556
168825
  EventRow,
168557
168826
  {
168558
- title: decisionLabel(event.decision),
168827
+ title: eventTitle(event),
168559
168828
  icon: decisionIcon(event.decision),
168560
168829
  className: className2,
168561
168830
  children: event.explanation || ""
168562
168831
  }
168563
168832
  );
168564
168833
  };
168565
- const decisionLabel = (decision) => {
168566
- switch (decision) {
168567
- case "approve":
168568
- return "Approved";
168569
- case "reject":
168570
- return "Rejected";
168571
- case "terminate":
168572
- return "Terminated";
168573
- case "escalate":
168574
- return "Escalated";
168575
- case "modify":
168576
- return "Modified";
168577
- default:
168578
- return decision;
168579
- }
168580
- };
168581
168834
  const decisionIcon = (decision) => {
168582
168835
  switch (decision) {
168583
168836
  case "approve":
@@ -168974,25 +169227,6 @@ const EventPanel = ({
168974
169227
  function hasDataDefault(node2) {
168975
169228
  return isValidElement(node2) && node2.props !== null && typeof node2.props === "object" && "data-default" in node2.props;
168976
169229
  }
168977
- const formatTiming = (timestamp2, working_start) => {
168978
- if (working_start) {
168979
- return `${formatDateTime(new Date(timestamp2))}
168980
- @ working time: ${formatTime$1(working_start)}`;
168981
- } else {
168982
- return formatDateTime(new Date(timestamp2));
168983
- }
168984
- };
168985
- const formatTitle = (title2, total_tokens, working_start) => {
168986
- const subItems = [];
168987
- if (total_tokens) {
168988
- subItems.push(`${formatNumber(total_tokens)} tokens`);
168989
- }
168990
- if (working_start) {
168991
- subItems.push(`${formatTime$1(working_start)}`);
168992
- }
168993
- const subtitle = subItems.length > 0 ? ` (${subItems.join(", ")})` : "";
168994
- return `${title2}${subtitle}`;
168995
- };
168996
169230
  const ErrorEventView = ({
168997
169231
  eventNode,
168998
169232
  className: className2
@@ -169003,7 +169237,7 @@ const ErrorEventView = ({
169003
169237
  {
169004
169238
  eventNodeId: eventNode.id,
169005
169239
  depth: eventNode.depth,
169006
- title: formatTitle("Error", void 0, event.working_start),
169240
+ title: formatTitle(eventTitle(event), void 0, event.working_start),
169007
169241
  className: className2,
169008
169242
  subTitle: formatDateTime(new Date(event.timestamp)),
169009
169243
  icon: ApplicationIcons.error,
@@ -169049,11 +169283,7 @@ const InfoEventView = ({
169049
169283
  {
169050
169284
  eventNodeId: eventNode.id,
169051
169285
  depth: eventNode.depth,
169052
- title: formatTitle(
169053
- "Info" + (event.source ? ": " + event.source : ""),
169054
- void 0,
169055
- event.working_start
169056
- ),
169286
+ title: formatTitle(eventTitle(event), void 0, event.working_start),
169057
169287
  className: className2,
169058
169288
  subTitle: formatDateTime(new Date(event.timestamp)),
169059
169289
  icon: ApplicationIcons.info,
@@ -169071,7 +169301,7 @@ const InputEventView = ({
169071
169301
  {
169072
169302
  eventNodeId: eventNode.id,
169073
169303
  depth: eventNode.depth,
169074
- title: formatTitle("Input", void 0, event.working_start),
169304
+ title: formatTitle(eventTitle(event), void 0, event.working_start),
169075
169305
  className: className2,
169076
169306
  subTitle: formatDateTime(new Date(event.timestamp)),
169077
169307
  icon: ApplicationIcons.input,
@@ -169101,7 +169331,7 @@ const LoggerEventView = ({
169101
169331
  EventRow,
169102
169332
  {
169103
169333
  className: className2,
169104
- title: event.message.level,
169334
+ title: eventTitle(event),
169105
169335
  icon: ApplicationIcons.logging[event.message.level.toLowerCase()],
169106
169336
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: clsx("text-size-base", styles$L.grid), children: [
169107
169337
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx("text-size-smaller"), children: obj !== void 0 && obj !== null ? /* @__PURE__ */ jsxRuntimeExports.jsx(MetaDataGrid, { entries: obj }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -169172,15 +169402,15 @@ const styles$J = {
169172
169402
  toolChoice,
169173
169403
  traceback
169174
169404
  };
169175
- const wrapper$2 = "_wrapper_cv5sf_1";
169176
- const col2$1 = "_col2_cv5sf_8";
169405
+ const wrapper$1 = "_wrapper_cv5sf_1";
169406
+ const col2 = "_col2_cv5sf_8";
169177
169407
  const col1_3 = "_col1_3_cv5sf_12";
169178
169408
  const col3 = "_col3_cv5sf_16";
169179
169409
  const separator$3 = "_separator_cv5sf_20";
169180
169410
  const topMargin = "_topMargin_cv5sf_26";
169181
169411
  const styles$I = {
169182
- wrapper: wrapper$2,
169183
- col2: col2$1,
169412
+ wrapper: wrapper$1,
169413
+ col2,
169184
169414
  col1_3,
169185
169415
  col3,
169186
169416
  separator: separator$3,
@@ -169312,7 +169542,7 @@ const ModelEventView = ({
169312
169542
  break;
169313
169543
  }
169314
169544
  }
169315
- const panelTitle = event.role ? `Model Call (${event.role}): ${event.model}` : `Model Call: ${event.model}`;
169545
+ const panelTitle = eventTitle(event);
169316
169546
  const turnLabel2 = context?.turnInfo ? `turn ${context.turnInfo.turnNumber}/${context.turnInfo.totalTurns}` : void 0;
169317
169547
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
169318
169548
  EventPanel,
@@ -169495,7 +169725,7 @@ const SampleInitEventView = ({
169495
169725
  eventNodeId: eventNode.id,
169496
169726
  depth: eventNode.depth,
169497
169727
  className: className2,
169498
- title: formatTitle("Sample", void 0, event.working_start),
169728
+ title: formatTitle(eventTitle(event), void 0, event.working_start),
169499
169729
  icon: ApplicationIcons.sample,
169500
169730
  subTitle: formatDateTime(new Date(event.timestamp)),
169501
169731
  children: [
@@ -169537,24 +169767,6 @@ const SampleLimitEventView = ({
169537
169767
  eventNode,
169538
169768
  className: className2
169539
169769
  }) => {
169540
- const resolve_title = (type) => {
169541
- switch (type) {
169542
- case "custom":
169543
- return "Custom Limit Exceeded";
169544
- case "time":
169545
- return "Time Limit Exceeded";
169546
- case "message":
169547
- return "Message Limit Exceeded";
169548
- case "token":
169549
- return "Token Limit Exceeded";
169550
- case "operator":
169551
- return "Operator Canceled";
169552
- case "working":
169553
- return "Execution Time Limit Exceeded";
169554
- case "cost":
169555
- return "Cost Limit Exceeded";
169556
- }
169557
- };
169558
169770
  const resolve_icon = (type) => {
169559
169771
  switch (type) {
169560
169772
  case "custom":
@@ -169573,14 +169785,17 @@ const SampleLimitEventView = ({
169573
169785
  return ApplicationIcons.limits.cost;
169574
169786
  }
169575
169787
  };
169576
- const title2 = resolve_title(eventNode.event.type);
169577
169788
  const icon2 = resolve_icon(eventNode.event.type);
169578
169789
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
169579
169790
  EventPanel,
169580
169791
  {
169581
169792
  eventNodeId: eventNode.id,
169582
169793
  depth: eventNode.depth,
169583
- title: formatTitle(title2, void 0, eventNode.event.working_start),
169794
+ title: formatTitle(
169795
+ eventTitle(eventNode.event),
169796
+ void 0,
169797
+ eventNode.event.working_start
169798
+ ),
169584
169799
  subTitle: formatDateTime(new Date(eventNode.event.timestamp)),
169585
169800
  icon: icon2,
169586
169801
  className: className2,
@@ -169611,11 +169826,7 @@ const SandboxEventView = ({
169611
169826
  eventNodeId: eventNode.id,
169612
169827
  depth: eventNode.depth,
169613
169828
  className: className2,
169614
- title: formatTitle(
169615
- `Sandbox: ${event.action}`,
169616
- void 0,
169617
- event.working_start
169618
- ),
169829
+ title: formatTitle(eventTitle(event), void 0, event.working_start),
169619
169830
  icon: ApplicationIcons.sandbox,
169620
169831
  subTitle: formatTiming(event.timestamp, event.working_start),
169621
169832
  children: event.action === "exec" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ExecView, { id: `${eventNode.id}-exec`, event }) : event.action === "read_file" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ReadFileView, { id: `${eventNode.id}-read-file`, event }) : /* @__PURE__ */ jsxRuntimeExports.jsx(WriteFileView, { id: `${eventNode.id}-write-file`, event })
@@ -169700,11 +169911,7 @@ const ScoreEventView = ({
169700
169911
  {
169701
169912
  eventNodeId: eventNode.id,
169702
169913
  depth: eventNode.depth,
169703
- title: formatTitle(
169704
- (event.intermediate ? "Intermediate " : "") + "Score",
169705
- void 0,
169706
- event.working_start
169707
- ),
169914
+ title: formatTitle(eventTitle(event), void 0, event.working_start),
169708
169915
  className: clsx(className2, "text-size-small"),
169709
169916
  subTitle: formatDateTime(new Date(event.timestamp)),
169710
169917
  icon: ApplicationIcons.scorer,
@@ -178572,7 +178779,7 @@ const StepEventView = ({
178572
178779
  }) => {
178573
178780
  const event = eventNode.event;
178574
178781
  const descriptor = stepDescriptor(event);
178575
- const title2 = descriptor.name || `${event.type ? event.type + ": " : "Step: "}${event.name}`;
178782
+ const title2 = eventTitle(event);
178576
178783
  const text2 = summarize$1(children2);
178577
178784
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
178578
178785
  EventPanel,
@@ -178620,68 +178827,16 @@ const stepDescriptor = (event) => {
178620
178827
  const rootStepDescriptor = {
178621
178828
  endSpace: true
178622
178829
  };
178623
- if (event.type === "solver") {
178624
- switch (event.name) {
178625
- case "chain_of_thought":
178626
- return {
178627
- ...rootStepDescriptor
178628
- };
178629
- case "generate":
178630
- return {
178631
- ...rootStepDescriptor
178632
- };
178633
- case "self_critique":
178634
- return {
178635
- ...rootStepDescriptor
178636
- };
178637
- case "system_message":
178638
- return {
178639
- ...rootStepDescriptor
178640
- };
178641
- case "use_tools":
178642
- return {
178643
- ...rootStepDescriptor
178644
- };
178645
- case "multiple_choice":
178646
- return {
178647
- ...rootStepDescriptor
178648
- };
178649
- default:
178650
- return {
178651
- ...rootStepDescriptor
178652
- };
178653
- }
178654
- } else if (event.type === "scorer") {
178655
- return {
178656
- ...rootStepDescriptor
178657
- };
178830
+ if (event.type === "solver" || event.type === "scorer") {
178831
+ return { ...rootStepDescriptor };
178658
178832
  } else if (event.event === "step") {
178659
- if (event.name === kSandboxSignalName) {
178660
- return {
178661
- ...rootStepDescriptor,
178662
- name: "Sandbox Events"
178663
- };
178664
- } else if (event.name === "init") {
178665
- return {
178666
- ...rootStepDescriptor,
178667
- name: "Init"
178668
- };
178669
- } else {
178670
- return {
178671
- ...rootStepDescriptor
178672
- };
178673
- }
178833
+ return { ...rootStepDescriptor };
178674
178834
  } else {
178675
178835
  switch (event.name) {
178676
178836
  case "sample_init":
178677
- return {
178678
- ...rootStepDescriptor,
178679
- name: "Sample Init"
178680
- };
178837
+ return { ...rootStepDescriptor };
178681
178838
  default:
178682
- return {
178683
- endSpace: false
178684
- };
178839
+ return { endSpace: false };
178685
178840
  }
178686
178841
  }
178687
178842
  };
@@ -178721,18 +178876,13 @@ const SubtaskEventView = ({
178721
178876
  )
178722
178877
  );
178723
178878
  }
178724
- const type = event.type === "fork" ? "Fork" : "Subtask";
178725
178879
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
178726
178880
  EventPanel,
178727
178881
  {
178728
178882
  eventNodeId: eventNode.id,
178729
178883
  depth: eventNode.depth,
178730
178884
  className: className2,
178731
- title: formatTitle(
178732
- `${type}: ${event.name}`,
178733
- void 0,
178734
- event.working_time
178735
- ),
178885
+ title: formatTitle(eventTitle(event), void 0, event.working_time),
178736
178886
  subTitle: formatTiming(event.timestamp, event.working_start),
178737
178887
  childIds: children2.map((child) => child.id),
178738
178888
  collapseControl: "bottom",
@@ -178801,13 +178951,12 @@ const ToolEventView = ({
178801
178951
  lastModelNode: lastModelNode2
178802
178952
  };
178803
178953
  }, [children2]);
178804
- const title2 = `Tool: ${event.view?.title || event.function}`;
178805
178954
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
178806
178955
  EventPanel,
178807
178956
  {
178808
178957
  eventNodeId: eventNode.id,
178809
178958
  depth: eventNode.depth,
178810
- title: formatTitle(title2, void 0, event.working_time),
178959
+ title: formatTitle(eventTitle(event), void 0, event.working_time),
178811
178960
  className: className2,
178812
178961
  subTitle: formatTiming(event.timestamp, event.working_start),
178813
178962
  icon: ApplicationIcons.solvers.use_tools,
@@ -178825,7 +178974,10 @@ const ToolEventView = ({
178825
178974
  contentType,
178826
178975
  output: event.error?.message || event.result,
178827
178976
  mode: "compact",
178828
- view: event.view ? event.view : void 0
178977
+ view: event.view ? substituteToolCallContent(
178978
+ event.view,
178979
+ event.arguments
178980
+ ) : void 0
178829
178981
  }
178830
178982
  ),
178831
178983
  lastModelNode ? /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -178876,7 +179028,7 @@ const ScoreEditEventView = ({
178876
179028
  {
178877
179029
  eventNodeId: eventNode.id,
178878
179030
  depth: eventNode.depth,
178879
- title: formatTitle("Edit Score", void 0, event.working_start),
179031
+ title: formatTitle(eventTitle(event), void 0, event.working_start),
178880
179032
  className: clsx(className2, "text-size-small"),
178881
179033
  subTitle: subtitle,
178882
179034
  collapsibleContent: true,
@@ -178954,7 +179106,7 @@ const SpanEventView = ({
178954
179106
  }) => {
178955
179107
  const event = eventNode.event;
178956
179108
  const descriptor = spanDescriptor(event);
178957
- const title2 = descriptor.name || `${event.type ? event.type + ": " : "Step: "}${event.name}`;
179109
+ const title2 = eventTitle(event);
178958
179110
  const text2 = useMemo(() => summarize(children2), [children2]);
178959
179111
  const childIds = useMemo(() => children2.map((child) => child.id), [children2]);
178960
179112
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -179003,68 +179155,16 @@ const spanDescriptor = (event) => {
179003
179155
  const rootStepDescriptor = {
179004
179156
  endSpace: true
179005
179157
  };
179006
- if (event.type === "solver") {
179007
- switch (event.name) {
179008
- case "chain_of_thought":
179009
- return {
179010
- ...rootStepDescriptor
179011
- };
179012
- case "generate":
179013
- return {
179014
- ...rootStepDescriptor
179015
- };
179016
- case "self_critique":
179017
- return {
179018
- ...rootStepDescriptor
179019
- };
179020
- case "system_message":
179021
- return {
179022
- ...rootStepDescriptor
179023
- };
179024
- case "use_tools":
179025
- return {
179026
- ...rootStepDescriptor
179027
- };
179028
- case "multiple_choice":
179029
- return {
179030
- ...rootStepDescriptor
179031
- };
179032
- default:
179033
- return {
179034
- ...rootStepDescriptor
179035
- };
179036
- }
179037
- } else if (event.type === "scorer") {
179038
- return {
179039
- ...rootStepDescriptor
179040
- };
179158
+ if (event.type === "solver" || event.type === "scorer") {
179159
+ return { ...rootStepDescriptor };
179041
179160
  } else if (event.event === "span_begin") {
179042
- if (event.span_id === kSandboxSignalName) {
179043
- return {
179044
- ...rootStepDescriptor,
179045
- name: "Sandbox Events"
179046
- };
179047
- } else if (event.name === "init") {
179048
- return {
179049
- ...rootStepDescriptor,
179050
- name: "Init"
179051
- };
179052
- } else {
179053
- return {
179054
- ...rootStepDescriptor
179055
- };
179056
- }
179161
+ return { ...rootStepDescriptor };
179057
179162
  } else {
179058
179163
  switch (event.name) {
179059
179164
  case "sample_init":
179060
- return {
179061
- ...rootStepDescriptor,
179062
- name: "Sample Init"
179063
- };
179165
+ return { ...rootStepDescriptor };
179064
179166
  default:
179065
- return {
179066
- endSpace: false
179067
- };
179167
+ return { endSpace: false };
179068
179168
  }
179069
179169
  }
179070
179170
  };
@@ -179081,19 +179181,19 @@ const styles$y = {
179081
179181
  const eventSearchText = (node2) => {
179082
179182
  const texts = [];
179083
179183
  const event = node2.event;
179184
+ const title2 = eventTitle(event);
179185
+ if (title2) {
179186
+ texts.push(title2);
179187
+ }
179084
179188
  switch (event.event) {
179085
179189
  case "model": {
179086
- const modelEvent = event;
179087
- if (modelEvent.model) {
179088
- texts.push(modelEvent.model);
179089
- }
179090
- if (modelEvent.output?.choices) {
179091
- for (const choice of modelEvent.output.choices) {
179190
+ if (event.output?.choices) {
179191
+ for (const choice of event.output.choices) {
179092
179192
  texts.push(...extractContentText(choice.message.content));
179093
179193
  }
179094
179194
  }
179095
- if (modelEvent.input) {
179096
- for (const msg of modelEvent.input) {
179195
+ if (event.input) {
179196
+ for (const msg of event.input) {
179097
179197
  if (msg.role === "user" || msg.role === "system") {
179098
179198
  texts.push(...extractContentText(msg.content));
179099
179199
  }
@@ -179102,103 +179202,147 @@ const eventSearchText = (node2) => {
179102
179202
  break;
179103
179203
  }
179104
179204
  case "tool": {
179105
- const toolEvent = event;
179106
- if (toolEvent.view?.title) {
179107
- texts.push(toolEvent.view.title);
179108
- }
179109
- if (toolEvent.function) {
179110
- texts.push(toolEvent.function);
179205
+ if (event.function) {
179206
+ texts.push(event.function);
179111
179207
  }
179112
- if (toolEvent.arguments) {
179113
- texts.push(JSON.stringify(toolEvent.arguments));
179208
+ if (event.arguments) {
179209
+ texts.push(JSON.stringify(event.arguments));
179114
179210
  }
179115
- if (toolEvent.result) {
179116
- if (typeof toolEvent.result === "string") {
179117
- texts.push(toolEvent.result);
179211
+ if (event.result) {
179212
+ if (typeof event.result === "string") {
179213
+ texts.push(event.result);
179118
179214
  } else {
179119
- texts.push(JSON.stringify(toolEvent.result));
179215
+ texts.push(JSON.stringify(event.result));
179120
179216
  }
179121
179217
  }
179122
- if (toolEvent.error?.message) {
179123
- texts.push(toolEvent.error.message);
179218
+ if (event.error?.message) {
179219
+ texts.push(event.error.message);
179220
+ }
179221
+ if (event.view?.content) {
179222
+ const substituted = substituteToolCallContent(
179223
+ event.view,
179224
+ event.arguments
179225
+ );
179226
+ texts.push(substituted.content);
179124
179227
  }
179125
179228
  break;
179126
179229
  }
179127
179230
  case "error": {
179128
- const errorEvent = event;
179129
- if (errorEvent.error?.message) {
179130
- texts.push(errorEvent.error.message);
179231
+ if (event.error?.message) {
179232
+ texts.push(event.error.message);
179131
179233
  }
179132
- if (errorEvent.error?.traceback) {
179133
- texts.push(errorEvent.error.traceback);
179234
+ if (event.error?.traceback) {
179235
+ texts.push(event.error.traceback);
179134
179236
  }
179135
179237
  break;
179136
179238
  }
179137
179239
  case "logger": {
179138
- const loggerEvent = event;
179139
- if (loggerEvent.message?.message) {
179140
- texts.push(loggerEvent.message.message);
179240
+ if (event.message?.message) {
179241
+ texts.push(event.message.message);
179141
179242
  }
179142
- if (loggerEvent.message?.filename) {
179143
- texts.push(loggerEvent.message.filename);
179243
+ if (event.message?.filename) {
179244
+ texts.push(event.message.filename);
179144
179245
  }
179145
179246
  break;
179146
179247
  }
179147
179248
  case "info": {
179148
- const infoEvent = event;
179149
- if (infoEvent.source) {
179150
- texts.push(infoEvent.source);
179151
- }
179152
- if (infoEvent.data) {
179153
- if (typeof infoEvent.data === "string") {
179154
- texts.push(infoEvent.data);
179249
+ if (event.data) {
179250
+ if (typeof event.data === "string") {
179251
+ texts.push(event.data);
179155
179252
  } else {
179156
- texts.push(JSON.stringify(infoEvent.data));
179253
+ texts.push(JSON.stringify(event.data));
179157
179254
  }
179158
179255
  }
179159
179256
  break;
179160
179257
  }
179161
179258
  case "compaction": {
179162
- const compactionEvent = event;
179163
- if (compactionEvent.source) {
179164
- texts.push(compactionEvent.source);
179259
+ if (event.source) {
179260
+ texts.push(event.source);
179165
179261
  }
179166
- texts.push(JSON.stringify(compactionEvent));
179262
+ texts.push(JSON.stringify(event));
179167
179263
  break;
179168
179264
  }
179169
- case "step": {
179170
- const stepEvent = event;
179171
- if (stepEvent.name) {
179172
- texts.push(stepEvent.name);
179265
+ case "subtask": {
179266
+ if (event.input) {
179267
+ texts.push(JSON.stringify(event.input));
179173
179268
  }
179174
- if (stepEvent.type) {
179175
- texts.push(stepEvent.type);
179269
+ if (event.result) {
179270
+ texts.push(JSON.stringify(event.result));
179176
179271
  }
179177
179272
  break;
179178
179273
  }
179179
- case "subtask": {
179180
- const subtaskEvent = event;
179181
- if (subtaskEvent.name) {
179182
- texts.push(subtaskEvent.name);
179274
+ case "score": {
179275
+ if (event.score.answer) {
179276
+ texts.push(event.score.answer);
179277
+ }
179278
+ if (event.score.explanation) {
179279
+ texts.push(event.score.explanation);
179280
+ }
179281
+ if (event.target) {
179282
+ const target2 = Array.isArray(event.target) ? event.target.join("\n") : event.target;
179283
+ texts.push(target2);
179183
179284
  }
179184
- if (subtaskEvent.type) {
179185
- texts.push(subtaskEvent.type);
179285
+ if (event.score.value != null) {
179286
+ texts.push(
179287
+ typeof event.score.value === "object" ? JSON.stringify(event.score.value) : String(event.score.value)
179288
+ );
179289
+ }
179290
+ break;
179291
+ }
179292
+ case "score_edit": {
179293
+ if (event.edit.answer) {
179294
+ texts.push(event.edit.answer);
179295
+ }
179296
+ if (event.edit.explanation) {
179297
+ texts.push(event.edit.explanation);
179186
179298
  }
179187
- if (subtaskEvent.input) {
179188
- texts.push(JSON.stringify(subtaskEvent.input));
179299
+ if (event.edit.provenance) {
179300
+ if (event.edit.provenance.author) {
179301
+ texts.push(event.edit.provenance.author);
179302
+ }
179303
+ if (event.edit.provenance.reason) {
179304
+ texts.push(event.edit.provenance.reason);
179305
+ }
179189
179306
  }
179190
- if (subtaskEvent.result) {
179191
- texts.push(JSON.stringify(subtaskEvent.result));
179307
+ break;
179308
+ }
179309
+ case "sample_init": {
179310
+ if (event.sample.target) {
179311
+ const target2 = Array.isArray(event.sample.target) ? event.sample.target.join("\n") : event.sample.target;
179312
+ texts.push(target2);
179192
179313
  }
179193
179314
  break;
179194
179315
  }
179195
- case "span_begin": {
179196
- const spanEvent = event;
179197
- if (spanEvent.name) {
179198
- texts.push(spanEvent.name);
179316
+ case "sample_limit": {
179317
+ if (event.message) {
179318
+ texts.push(event.message);
179319
+ }
179320
+ break;
179321
+ }
179322
+ case "input": {
179323
+ if (event.input_ansi) {
179324
+ texts.push(event.input_ansi);
179325
+ }
179326
+ break;
179327
+ }
179328
+ case "approval": {
179329
+ if (event.explanation) {
179330
+ texts.push(event.explanation);
179331
+ }
179332
+ break;
179333
+ }
179334
+ case "sandbox": {
179335
+ if (event.cmd) {
179336
+ texts.push(event.cmd);
179337
+ }
179338
+ if (event.file) {
179339
+ texts.push(event.file);
179199
179340
  }
179200
- if (spanEvent.type) {
179201
- texts.push(spanEvent.type);
179341
+ if (event.input) {
179342
+ texts.push(event.input);
179343
+ }
179344
+ if (event.output) {
179345
+ texts.push(event.output);
179202
179346
  }
179203
179347
  break;
179204
179348
  }
@@ -179216,21 +179360,19 @@ const extractContentText = (content2) => {
179216
179360
  texts.push(item2.text);
179217
179361
  break;
179218
179362
  case "reasoning": {
179219
- const reasoning2 = item2;
179220
- if (reasoning2.reasoning) {
179221
- texts.push(reasoning2.reasoning);
179222
- } else if (reasoning2.summary) {
179223
- texts.push(reasoning2.summary);
179363
+ if (item2.reasoning) {
179364
+ texts.push(item2.reasoning);
179365
+ } else if (item2.summary) {
179366
+ texts.push(item2.summary);
179224
179367
  }
179225
179368
  break;
179226
179369
  }
179227
179370
  case "tool_use": {
179228
- const toolUse = item2;
179229
- if (toolUse.name) {
179230
- texts.push(toolUse.name);
179371
+ if (item2.name) {
179372
+ texts.push(item2.name);
179231
179373
  }
179232
- if (toolUse.arguments) {
179233
- texts.push(JSON.stringify(toolUse.arguments));
179374
+ if (item2.arguments) {
179375
+ texts.push(JSON.stringify(item2.arguments));
179234
179376
  }
179235
179377
  break;
179236
179378
  }
@@ -179377,13 +179519,12 @@ const CompactionEventView = ({
179377
179519
  data["tokens_after"] = event.tokens_after;
179378
179520
  }
179379
179521
  data = { ...data, ...event.metadata || {} };
179380
- const source2 = event.source && event.source !== "inspect" ? event.source : "";
179381
179522
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
179382
179523
  EventPanel,
179383
179524
  {
179384
179525
  eventNodeId: eventNode.id,
179385
179526
  depth: eventNode.depth,
179386
- title: formatTitle("Compaction" + source2, void 0, event.working_start),
179527
+ title: formatTitle(eventTitle(event), void 0, event.working_start),
179387
179528
  className: className2,
179388
179529
  subTitle: formatDateTime(new Date(event.timestamp)),
179389
179530
  icon: ApplicationIcons.info,
@@ -180787,10 +180928,9 @@ const SampleDetailComponent = ({
180787
180928
  const sample2 = useMemo(() => {
180788
180929
  return sampleData.getSelectedSample();
180789
180930
  }, [sampleData]);
180931
+ const sampleStatus2 = useStore((state) => state.sample.sampleStatus);
180790
180932
  const sampleMatchesRequest = useMemo(() => {
180791
- if (!sample2 || !sampleId || !epoch) {
180792
- return true;
180793
- }
180933
+ if (!sample2 || !sampleId || !epoch) return false;
180794
180934
  return String(sample2.id) === sampleId && sample2.epoch === parseInt(epoch, 10);
180795
180935
  }, [sample2, sampleId, epoch]);
180796
180936
  const showFind = useStore((state) => state.app.showFind);
@@ -180903,7 +181043,7 @@ const SampleDetailComponent = ({
180903
181043
  ] })
180904
181044
  }
180905
181045
  ),
180906
- sampleMatchesRequest && /* @__PURE__ */ jsxRuntimeExports.jsx(
181046
+ sampleStatus2 !== "loading" && sample2 && sampleMatchesRequest && /* @__PURE__ */ jsxRuntimeExports.jsx(
180907
181047
  InlineSampleComponent,
180908
181048
  {
180909
181049
  showActivity: false,
@@ -181652,20 +181792,26 @@ const ModelCard = ({ evalSpec }) => {
181652
181792
  }) }) })
181653
181793
  ] });
181654
181794
  };
181655
- const wrapper$1 = "_wrapper_14r3b_1";
181656
- const col2 = "_col2_14r3b_16";
181795
+ const cardsContainer = "_cardsContainer_d0qjo_1";
181657
181796
  const styles$l = {
181658
- wrapper: wrapper$1,
181659
- col2
181797
+ cardsContainer
181660
181798
  };
181661
- const kUsageCardBodyId = "usage-card-body";
181799
+ const kModelUsageCardBodyId = "model-usage-card-body";
181800
+ const kRoleUsageCardBodyId = "role-usage-card-body";
181662
181801
  const UsageCard = ({ stats }) => {
181663
181802
  if (!stats) {
181664
181803
  return null;
181665
181804
  }
181666
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { children: [
181667
- /* @__PURE__ */ jsxRuntimeExports.jsx(CardHeader, { label: "Usage" }),
181668
- /* @__PURE__ */ jsxRuntimeExports.jsx(CardBody, { id: kUsageCardBodyId, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$l.wrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$l.col2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ModelTokenTable, { model_usage: stats.model_usage }) }) }) })
181805
+ const hasRoleUsage = stats.role_usage && Object.keys(stats.role_usage).length > 0;
181806
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$l.cardsContainer, children: [
181807
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { children: [
181808
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CardHeader, { label: "Model Usage" }),
181809
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CardBody, { id: kModelUsageCardBodyId, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ModelTokenTable, { model_usage: stats.model_usage }) })
181810
+ ] }),
181811
+ hasRoleUsage && /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { children: [
181812
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CardHeader, { label: "Role Usage" }),
181813
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CardBody, { id: kRoleUsageCardBodyId, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ModelTokenTable, { model_usage: stats.role_usage }) })
181814
+ ] })
181669
181815
  ] });
181670
181816
  };
181671
181817
  const useModelsTab = (evalSpec, evalStats, evalStatus) => {