inspect-ai 0.3.104__py3-none-any.whl → 0.3.106__py3-none-any.whl

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 (46) hide show
  1. inspect_ai/_eval/context.py +5 -0
  2. inspect_ai/_eval/eval.py +113 -1
  3. inspect_ai/_eval/evalset.py +1 -1
  4. inspect_ai/_eval/task/run.py +64 -38
  5. inspect_ai/_util/eval_task_group.py +15 -0
  6. inspect_ai/_view/server.py +17 -0
  7. inspect_ai/_view/www/dist/assets/index.css +33 -29
  8. inspect_ai/_view/www/dist/assets/index.js +559 -247
  9. inspect_ai/_view/www/src/app/samples/chat/ChatMessage.module.css +4 -0
  10. inspect_ai/_view/www/src/app/samples/chat/ChatMessage.tsx +17 -0
  11. inspect_ai/_view/www/src/app/samples/sample-tools/filters.ts +26 -0
  12. inspect_ai/_view/www/src/app/samples/sample-tools/sample-filter/SampleFilter.tsx +14 -3
  13. inspect_ai/_view/www/src/app/samples/sample-tools/sample-filter/completions.ts +359 -7
  14. inspect_ai/_view/www/src/app/samples/sample-tools/sample-filter/language.ts +6 -0
  15. inspect_ai/_view/www/src/app/samples/transcript/outline/OutlineRow.tsx +1 -1
  16. inspect_ai/_view/www/src/client/api/api-browser.ts +25 -0
  17. inspect_ai/_view/www/src/client/api/api-http.ts +3 -0
  18. inspect_ai/_view/www/src/client/api/api-vscode.ts +6 -0
  19. inspect_ai/_view/www/src/client/api/client-api.ts +3 -0
  20. inspect_ai/_view/www/src/client/api/jsonrpc.ts +1 -0
  21. inspect_ai/_view/www/src/client/api/types.ts +3 -0
  22. inspect_ai/_view/www/src/state/samplePolling.ts +17 -1
  23. inspect_ai/agent/_handoff.py +5 -2
  24. inspect_ai/agent/_react.py +43 -20
  25. inspect_ai/dataset/_dataset.py +1 -1
  26. inspect_ai/log/_samples.py +5 -0
  27. inspect_ai/model/_call_tools.py +4 -4
  28. inspect_ai/model/_providers/_openai_web_search.py +1 -1
  29. inspect_ai/model/_providers/anthropic.py +23 -2
  30. inspect_ai/model/_providers/google.py +5 -1
  31. inspect_ai/model/_providers/groq.py +5 -0
  32. inspect_ai/model/_providers/perplexity.py +27 -1
  33. inspect_ai/model/_providers/providers.py +1 -1
  34. inspect_ai/tool/_tools/_web_search/_web_search.py +8 -3
  35. inspect_ai/util/__init__.py +8 -0
  36. inspect_ai/util/_background.py +64 -0
  37. inspect_ai/util/_limit.py +72 -5
  38. inspect_ai/util/_sandbox/__init__.py +2 -0
  39. inspect_ai/util/_sandbox/service.py +28 -7
  40. inspect_ai/util/_subprocess.py +51 -38
  41. {inspect_ai-0.3.104.dist-info → inspect_ai-0.3.106.dist-info}/METADATA +1 -1
  42. {inspect_ai-0.3.104.dist-info → inspect_ai-0.3.106.dist-info}/RECORD +46 -44
  43. {inspect_ai-0.3.104.dist-info → inspect_ai-0.3.106.dist-info}/WHEEL +0 -0
  44. {inspect_ai-0.3.104.dist-info → inspect_ai-0.3.106.dist-info}/entry_points.txt +0 -0
  45. {inspect_ai-0.3.104.dist-info → inspect_ai-0.3.106.dist-info}/licenses/LICENSE +0 -0
  46. {inspect_ai-0.3.104.dist-info → inspect_ai-0.3.106.dist-info}/top_level.txt +0 -0
@@ -23937,7 +23937,9 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
23937
23937
  processAttachments(sampleDataResponse.sampleData, pollingState);
23938
23938
  const processedEvents = processEvents(
23939
23939
  sampleDataResponse.sampleData,
23940
- pollingState
23940
+ pollingState,
23941
+ api2,
23942
+ logFile
23941
23943
  );
23942
23944
  if (sampleDataResponse.sampleData.attachments.length > 0) {
23943
23945
  const maxAttachment = findMaxId(
@@ -24001,7 +24003,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
24001
24003
  pollingState.attachments[v2.hash] = v2.content;
24002
24004
  });
24003
24005
  }
24004
- function processEvents(sampleData, pollingState) {
24006
+ function processEvents(sampleData, pollingState, api2, log_file) {
24005
24007
  log$4.debug(`Processing ${sampleData.events.length} events`);
24006
24008
  if (sampleData.events.length === 0) {
24007
24009
  return false;
@@ -24017,6 +24019,13 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
24017
24019
  attachmentId,
24018
24020
  available_attachments: Object.keys(pollingState.attachments)
24019
24021
  };
24022
+ if (api2.log_message) {
24023
+ api2.log_message(
24024
+ log_file,
24025
+ `Unable to resolve attachment ${attachmentId}
24026
+ ` + JSON.stringify(snapshot)
24027
+ );
24028
+ }
24020
24029
  console.warn(`Unable to resolve attachment ${attachmentId}`, snapshot);
24021
24030
  }
24022
24031
  );
@@ -38587,150 +38596,38 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
38587
38596
  }
38588
38597
  );
38589
38598
  };
38590
- const directoryRelativeUrl = (file, dir) => {
38591
- if (!dir) {
38592
- return encodeURIComponent(file);
38593
- }
38594
- const normalizedFile = file.replace(/\\/g, "/");
38595
- const normalizedLogDir = dir.replace(/\\/g, "/");
38596
- const dirWithSlash = normalizedLogDir.endsWith("/") ? normalizedLogDir : normalizedLogDir + "/";
38597
- if (normalizedFile.startsWith(dirWithSlash)) {
38598
- const relativePath = normalizedFile.substring(dirWithSlash.length);
38599
- const segments = relativePath.split("/");
38600
- const encodedSegments = segments.map(
38601
- (segment) => encodeURIComponent(segment)
38602
- );
38603
- return encodedSegments.join("/");
38604
- }
38605
- return encodeURIComponent(file);
38606
- };
38607
- const kLogRouteUrlPattern = "/logs/:logPath/:tabId?/:sampleTabId?";
38608
- const kSampleRouteUrlPattern = "/logs/:logPath/samples/sample/:sampleId/:epoch?/:sampleTabId?";
38609
- const baseUrl = (logPath, sampleId, sampleEpoch) => {
38610
- if (sampleId !== void 0 && sampleEpoch !== void 0) {
38611
- return sampleUrl(logPath, sampleId, sampleEpoch);
38612
- } else {
38613
- return logUrl(logPath);
38614
- }
38615
- };
38616
- const sampleUrl = (logPath, sampleId, sampleEpoch, sampleTabId) => {
38617
- if (sampleId !== void 0 && sampleEpoch !== void 0) {
38618
- return `/logs/${encodeURIComponent(logPath)}/samples/sample/${encodeURIComponent(sampleId)}/${sampleEpoch}/${sampleTabId || ""}`;
38619
- } else {
38620
- return `/logs/${encodeURIComponent(logPath)}/samples/${sampleTabId || ""}`;
38621
- }
38622
- };
38623
- const sampleEventUrl = (eventId, logPath, sampleId, sampleEpoch) => {
38624
- const baseUrl2 = sampleUrl(
38625
- logPath,
38626
- sampleId,
38627
- sampleEpoch,
38628
- kSampleTranscriptTabId
38629
- );
38630
- return `${baseUrl2}?event=${eventId}`;
38631
- };
38632
- const useSampleMessageUrl = (messageId, sampleId, sampleEpoch) => {
38633
- const {
38634
- logPath: urlLogPath,
38635
- sampleId: urlSampleId,
38636
- epoch: urlEpoch
38637
- } = useParams();
38638
- const log_file = useStore((state) => state.logs.selectedLogFile);
38639
- const log_dir = useStore((state) => state.logs.logs.log_dir);
38640
- let targetLogPath = urlLogPath;
38641
- if (!targetLogPath && log_file) {
38642
- targetLogPath = makeLogPath(log_file, log_dir);
38643
- }
38644
- const eventUrl = reactExports.useMemo(() => {
38645
- return messageId && targetLogPath ? sampleMessageUrl(
38646
- messageId,
38647
- targetLogPath,
38648
- urlSampleId,
38649
- urlEpoch
38650
- ) : void 0;
38651
- }, [targetLogPath, messageId, sampleId, urlSampleId, sampleEpoch, urlEpoch]);
38652
- return eventUrl;
38653
- };
38654
- const useSampleEventUrl = (eventId, sampleId, sampleEpoch) => {
38655
- const {
38656
- logPath: urlLogPath,
38657
- sampleId: urlSampleId,
38658
- epoch: urlEpoch
38659
- } = useParams();
38660
- const log_file = useStore((state) => state.logs.selectedLogFile);
38661
- const log_dir = useStore((state) => state.logs.logs.log_dir);
38662
- let targetLogPath = urlLogPath;
38663
- if (!targetLogPath && log_file) {
38664
- targetLogPath = makeLogPath(log_file, log_dir);
38665
- }
38666
- const eventUrl = reactExports.useMemo(() => {
38667
- return targetLogPath ? sampleEventUrl(
38668
- eventId,
38669
- targetLogPath,
38670
- urlSampleId,
38671
- urlEpoch
38672
- ) : void 0;
38673
- }, [targetLogPath, eventId, sampleId, urlSampleId, sampleEpoch, urlEpoch]);
38674
- return eventUrl;
38675
- };
38676
- const sampleMessageUrl = (messageId, logPath, sampleId, sampleEpoch) => {
38677
- const baseUrl2 = sampleUrl(
38678
- logPath,
38679
- sampleId,
38680
- sampleEpoch,
38681
- kSampleMessagesTabId
38682
- );
38683
- return `${baseUrl2}?message=${messageId}`;
38684
- };
38685
- const logUrl = (log_file, log_dir, tabId) => {
38686
- return logUrlRaw(makeLogPath(log_file, log_dir), tabId);
38687
- };
38688
- const makeLogPath = (log_file, log_dir) => {
38689
- const pathSegment = directoryRelativeUrl(log_file, log_dir);
38690
- return pathSegment;
38691
- };
38692
- const logUrlRaw = (log_segment, tabId) => {
38693
- if (tabId) {
38694
- return `/logs/${encodeURIComponent(log_segment)}/${tabId}`;
38695
- } else {
38696
- return `/logs/${encodeURIComponent(log_segment)}`;
38697
- }
38698
- };
38699
- const supportsLinking = () => {
38700
- return (
38701
- //location.hostname !== "localhost" &&
38702
- location.hostname !== "127.0.0.1" && location.protocol !== "vscode-webview:"
38599
+ const LabeledValue = ({
38600
+ layout = "column",
38601
+ style: style2,
38602
+ label: label2,
38603
+ children: children2,
38604
+ valueStyle,
38605
+ className: className2
38606
+ }) => {
38607
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
38608
+ "div",
38609
+ {
38610
+ className: clsx(
38611
+ "labeled-value",
38612
+ layout === "column" ? "column" : "row",
38613
+ className2
38614
+ ),
38615
+ style: {
38616
+ ...style2
38617
+ },
38618
+ children: [
38619
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
38620
+ "div",
38621
+ {
38622
+ className: "labeled-value-label text-style-label text-style-secondary",
38623
+ children: label2
38624
+ }
38625
+ ),
38626
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "labeled-value-value", style: { ...valueStyle }, children: children2 })
38627
+ ]
38628
+ }
38703
38629
  );
38704
38630
  };
38705
- const toFullUrl = (path) => {
38706
- return `${window.location.origin}${window.location.pathname}#${path}`;
38707
- };
38708
- const message$1 = "_message_17kai_1";
38709
- const systemRole = "_systemRole_17kai_8";
38710
- const messageGrid = "_messageGrid_17kai_12";
38711
- const messageContents = "_messageContents_17kai_20";
38712
- const indented = "_indented_17kai_25";
38713
- const copyLink$1 = "_copyLink_17kai_29";
38714
- const styles$1p = {
38715
- message: message$1,
38716
- systemRole,
38717
- messageGrid,
38718
- messageContents,
38719
- indented,
38720
- copyLink: copyLink$1
38721
- };
38722
- const webSearch = "_webSearch_1376z_1";
38723
- const query$1 = "_query_1376z_8";
38724
- const styles$1o = {
38725
- webSearch,
38726
- query: query$1
38727
- };
38728
- const WebSearch = ({ query: query2 }) => {
38729
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: clsx(styles$1o.webSearch, "text-size-smaller"), children: [
38730
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: clsx("text-style-label", "text-style-secondary"), children: "Web Search:" }),
38731
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: clsx(styles$1o.query, "text-size-smallest"), children: query2 })
38732
- ] });
38733
- };
38734
38631
  const we = 0, zt = 1, qt = 2, En = 4;
38735
38632
  function ln(t2) {
38736
38633
  return () => t2;
@@ -42049,7 +41946,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
42049
41946
  const key = "_key_1ltuo_1";
42050
41947
  const pre = "_pre_1ltuo_16";
42051
41948
  const treeIcon = "_treeIcon_1ltuo_20";
42052
- const styles$1n = {
41949
+ const styles$1p = {
42053
41950
  keyPairContainer,
42054
41951
  key,
42055
41952
  pre,
@@ -42231,7 +42128,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
42231
42128
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
42232
42129
  "div",
42233
42130
  {
42234
- className: clsx(styles$1n.keyPairContainer, "text-size-small"),
42131
+ className: clsx(styles$1p.keyPairContainer, "text-size-small"),
42235
42132
  style: {
42236
42133
  paddingLeft: `${item2.depth * 20}px`
42237
42134
  },
@@ -42242,7 +42139,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
42242
42139
  "data-index": index2,
42243
42140
  className: clsx(
42244
42141
  kRecordTreeKey,
42245
- styles$1n.key,
42142
+ styles$1p.key,
42246
42143
  "font-monospace",
42247
42144
  "text-style-secondary"
42248
42145
  ),
@@ -42252,16 +42149,16 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
42252
42149
  setCollapsed(item2.id, !(collapsedIds == null ? void 0 : collapsedIds[item2.id]));
42253
42150
  },
42254
42151
  children: [
42255
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: item2.hasChildren ? /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: clsx(styles$1n.pre), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
42152
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: item2.hasChildren ? /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: clsx(styles$1p.pre), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
42256
42153
  "i",
42257
42154
  {
42258
42155
  className: clsx(
42259
42156
  collapsedIds && collapsedIds[item2.id] ? ApplicationIcons.tree.closed : ApplicationIcons.tree.open,
42260
- styles$1n.treeIcon
42157
+ styles$1p.treeIcon
42261
42158
  )
42262
42159
  }
42263
42160
  ) }) : void 0 }),
42264
- /* @__PURE__ */ jsxRuntimeExports.jsxs("pre", { className: clsx(styles$1n.pre), children: [
42161
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("pre", { className: clsx(styles$1p.pre), children: [
42265
42162
  item2.key,
42266
42163
  ":"
42267
42164
  ] })
@@ -42413,6 +42310,152 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
42413
42310
  const isPrimitiveOrNull = (value2) => {
42414
42311
  return value2 === null || value2 === void 0 || typeof value2 === "string" || typeof value2 === "number" || typeof value2 === "boolean";
42415
42312
  };
42313
+ const directoryRelativeUrl = (file, dir) => {
42314
+ if (!dir) {
42315
+ return encodeURIComponent(file);
42316
+ }
42317
+ const normalizedFile = file.replace(/\\/g, "/");
42318
+ const normalizedLogDir = dir.replace(/\\/g, "/");
42319
+ const dirWithSlash = normalizedLogDir.endsWith("/") ? normalizedLogDir : normalizedLogDir + "/";
42320
+ if (normalizedFile.startsWith(dirWithSlash)) {
42321
+ const relativePath = normalizedFile.substring(dirWithSlash.length);
42322
+ const segments = relativePath.split("/");
42323
+ const encodedSegments = segments.map(
42324
+ (segment) => encodeURIComponent(segment)
42325
+ );
42326
+ return encodedSegments.join("/");
42327
+ }
42328
+ return encodeURIComponent(file);
42329
+ };
42330
+ const kLogRouteUrlPattern = "/logs/:logPath/:tabId?/:sampleTabId?";
42331
+ const kSampleRouteUrlPattern = "/logs/:logPath/samples/sample/:sampleId/:epoch?/:sampleTabId?";
42332
+ const baseUrl = (logPath, sampleId, sampleEpoch) => {
42333
+ if (sampleId !== void 0 && sampleEpoch !== void 0) {
42334
+ return sampleUrl(logPath, sampleId, sampleEpoch);
42335
+ } else {
42336
+ return logUrl(logPath);
42337
+ }
42338
+ };
42339
+ const sampleUrl = (logPath, sampleId, sampleEpoch, sampleTabId) => {
42340
+ if (sampleId !== void 0 && sampleEpoch !== void 0) {
42341
+ return `/logs/${encodeURIComponent(logPath)}/samples/sample/${encodeURIComponent(sampleId)}/${sampleEpoch}/${sampleTabId || ""}`;
42342
+ } else {
42343
+ return `/logs/${encodeURIComponent(logPath)}/samples/${sampleTabId || ""}`;
42344
+ }
42345
+ };
42346
+ const sampleEventUrl = (eventId, logPath, sampleId, sampleEpoch) => {
42347
+ const baseUrl2 = sampleUrl(
42348
+ logPath,
42349
+ sampleId,
42350
+ sampleEpoch,
42351
+ kSampleTranscriptTabId
42352
+ );
42353
+ return `${baseUrl2}?event=${eventId}`;
42354
+ };
42355
+ const useSampleMessageUrl = (messageId, sampleId, sampleEpoch) => {
42356
+ const {
42357
+ logPath: urlLogPath,
42358
+ sampleId: urlSampleId,
42359
+ epoch: urlEpoch
42360
+ } = useParams();
42361
+ const log_file = useStore((state) => state.logs.selectedLogFile);
42362
+ const log_dir = useStore((state) => state.logs.logs.log_dir);
42363
+ let targetLogPath = urlLogPath;
42364
+ if (!targetLogPath && log_file) {
42365
+ targetLogPath = makeLogPath(log_file, log_dir);
42366
+ }
42367
+ const eventUrl = reactExports.useMemo(() => {
42368
+ return messageId && targetLogPath ? sampleMessageUrl(
42369
+ messageId,
42370
+ targetLogPath,
42371
+ urlSampleId,
42372
+ urlEpoch
42373
+ ) : void 0;
42374
+ }, [targetLogPath, messageId, sampleId, urlSampleId, sampleEpoch, urlEpoch]);
42375
+ return eventUrl;
42376
+ };
42377
+ const useSampleEventUrl = (eventId, sampleId, sampleEpoch) => {
42378
+ const {
42379
+ logPath: urlLogPath,
42380
+ sampleId: urlSampleId,
42381
+ epoch: urlEpoch
42382
+ } = useParams();
42383
+ const log_file = useStore((state) => state.logs.selectedLogFile);
42384
+ const log_dir = useStore((state) => state.logs.logs.log_dir);
42385
+ let targetLogPath = urlLogPath;
42386
+ if (!targetLogPath && log_file) {
42387
+ targetLogPath = makeLogPath(log_file, log_dir);
42388
+ }
42389
+ const eventUrl = reactExports.useMemo(() => {
42390
+ return targetLogPath ? sampleEventUrl(
42391
+ eventId,
42392
+ targetLogPath,
42393
+ urlSampleId,
42394
+ urlEpoch
42395
+ ) : void 0;
42396
+ }, [targetLogPath, eventId, sampleId, urlSampleId, sampleEpoch, urlEpoch]);
42397
+ return eventUrl;
42398
+ };
42399
+ const sampleMessageUrl = (messageId, logPath, sampleId, sampleEpoch) => {
42400
+ const baseUrl2 = sampleUrl(
42401
+ logPath,
42402
+ sampleId,
42403
+ sampleEpoch,
42404
+ kSampleMessagesTabId
42405
+ );
42406
+ return `${baseUrl2}?message=${messageId}`;
42407
+ };
42408
+ const logUrl = (log_file, log_dir, tabId) => {
42409
+ return logUrlRaw(makeLogPath(log_file, log_dir), tabId);
42410
+ };
42411
+ const makeLogPath = (log_file, log_dir) => {
42412
+ const pathSegment = directoryRelativeUrl(log_file, log_dir);
42413
+ return pathSegment;
42414
+ };
42415
+ const logUrlRaw = (log_segment, tabId) => {
42416
+ if (tabId) {
42417
+ return `/logs/${encodeURIComponent(log_segment)}/${tabId}`;
42418
+ } else {
42419
+ return `/logs/${encodeURIComponent(log_segment)}`;
42420
+ }
42421
+ };
42422
+ const supportsLinking = () => {
42423
+ return (
42424
+ //location.hostname !== "localhost" &&
42425
+ location.hostname !== "127.0.0.1" && location.protocol !== "vscode-webview:"
42426
+ );
42427
+ };
42428
+ const toFullUrl = (path) => {
42429
+ return `${window.location.origin}${window.location.pathname}#${path}`;
42430
+ };
42431
+ const message$1 = "_message_1ivu3_1";
42432
+ const systemRole = "_systemRole_1ivu3_8";
42433
+ const messageGrid = "_messageGrid_1ivu3_12";
42434
+ const messageContents = "_messageContents_1ivu3_20";
42435
+ const indented = "_indented_1ivu3_25";
42436
+ const copyLink$1 = "_copyLink_1ivu3_29";
42437
+ const metadataLabel = "_metadataLabel_1ivu3_39";
42438
+ const styles$1o = {
42439
+ message: message$1,
42440
+ systemRole,
42441
+ messageGrid,
42442
+ messageContents,
42443
+ indented,
42444
+ copyLink: copyLink$1,
42445
+ metadataLabel
42446
+ };
42447
+ const webSearch = "_webSearch_1376z_1";
42448
+ const query$1 = "_query_1376z_8";
42449
+ const styles$1n = {
42450
+ webSearch,
42451
+ query: query$1
42452
+ };
42453
+ const WebSearch = ({ query: query2 }) => {
42454
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: clsx(styles$1n.webSearch, "text-size-smaller"), children: [
42455
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: clsx("text-style-label", "text-style-secondary"), children: "Web Search:" }),
42456
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: clsx(styles$1n.query, "text-size-smallest"), children: query2 })
42457
+ ] });
42458
+ };
42416
42459
  const contentData = "_contentData_1sd1z_1";
42417
42460
  const styles$1m = {
42418
42461
  contentData
@@ -43170,47 +43213,64 @@ ${citation.url}`,
43170
43213
  className: clsx(
43171
43214
  message2.role,
43172
43215
  "text-size-base",
43173
- styles$1p.message,
43174
- message2.role === "system" ? styles$1p.systemRole : void 0,
43175
- message2.role === "user" ? styles$1p.userRole : void 0
43216
+ styles$1o.message,
43217
+ message2.role === "system" ? styles$1o.systemRole : void 0,
43218
+ message2.role === "user" ? styles$1o.userRole : void 0
43176
43219
  ),
43177
43220
  children: [
43178
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: clsx(styles$1p.messageGrid, "text-style-label"), children: [
43221
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: clsx(styles$1o.messageGrid, "text-style-label"), children: [
43179
43222
  message2.role,
43180
43223
  supportsLinking() && messageUrl ? /* @__PURE__ */ jsxRuntimeExports.jsx(
43181
43224
  CopyButton,
43182
43225
  {
43183
43226
  icon: ApplicationIcons.link,
43184
43227
  value: toFullUrl(messageUrl),
43185
- className: clsx(styles$1p.copyLink)
43228
+ className: clsx(styles$1o.copyLink)
43186
43229
  }
43187
43230
  ) : ""
43188
43231
  ] }),
43189
- /* @__PURE__ */ jsxRuntimeExports.jsx(
43232
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
43190
43233
  "div",
43191
43234
  {
43192
43235
  className: clsx(
43193
- styles$1p.messageContents,
43194
- indented2 ? styles$1p.indented : void 0
43236
+ styles$1o.messageContents,
43237
+ indented2 ? styles$1o.indented : void 0
43195
43238
  ),
43196
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
43197
- ExpandablePanel,
43198
- {
43199
- id: `${id}-message`,
43200
- collapse,
43201
- lines: collapse ? 15 : 25,
43202
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
43203
- MessageContents,
43204
- {
43205
- id: `${id}-contents`,
43206
- message: message2,
43207
- toolMessages,
43208
- toolCallStyle
43209
- },
43210
- `${id}-contents`
43211
- )
43212
- }
43213
- )
43239
+ children: [
43240
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
43241
+ ExpandablePanel,
43242
+ {
43243
+ id: `${id}-message`,
43244
+ collapse,
43245
+ lines: collapse ? 15 : 25,
43246
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
43247
+ MessageContents,
43248
+ {
43249
+ id: `${id}-contents`,
43250
+ message: message2,
43251
+ toolMessages,
43252
+ toolCallStyle
43253
+ },
43254
+ `${id}-contents`
43255
+ )
43256
+ }
43257
+ ),
43258
+ message2.metadata && Object.keys(message2.metadata).length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
43259
+ LabeledValue,
43260
+ {
43261
+ label: "Metadata",
43262
+ className: clsx(styles$1o.metadataLabel, "text-size-smaller"),
43263
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
43264
+ RecordTree,
43265
+ {
43266
+ record: message2.metadata,
43267
+ id: `${id}-metadata`,
43268
+ defaultExpandLevel: 1
43269
+ }
43270
+ )
43271
+ }
43272
+ ) : ""
43273
+ ]
43214
43274
  }
43215
43275
  )
43216
43276
  ]
@@ -46592,6 +46652,33 @@ ${citation.url}`,
46592
46652
  }
46593
46653
  };
46594
46654
  }
46655
+ const kSampleIdVariable = "id";
46656
+ const kSampleMetadataVariable = "metadata";
46657
+ const kSampleMetadataPrefix = kSampleMetadataVariable + ".";
46658
+ const KEYWORDS = ["and", "or", "not", "in", "not in", "mod"];
46659
+ const MATH_FUNCTIONS = [
46660
+ ["min", "Minimum of two or more values"],
46661
+ ["max", "Maximum of two or more values"],
46662
+ ["abs", "Absolute value"],
46663
+ ["round", "Round to the nearest integer"],
46664
+ ["floor", "Round down to the nearest integer"],
46665
+ ["ceil", "Round up to the nearest integer"],
46666
+ ["sqrt", "Square root"],
46667
+ ["log", "Natural logarithm"],
46668
+ ["log2", "Base 2 logarithm"],
46669
+ ["log10", "Base 10 logarithm"]
46670
+ ];
46671
+ const SAMPLE_VARIABLES = [
46672
+ ["has_error", "Checks if the sample has an error"],
46673
+ ["has_retries", "Checks if the sample has been retried"],
46674
+ [kSampleIdVariable, "The unique identifier of the sample"],
46675
+ [kSampleMetadataVariable, "Metadata associated with the sample"]
46676
+ ];
46677
+ const SAMPLE_FUNCTIONS = [
46678
+ ["input_contains", "Checks if input contains a regular expression"],
46679
+ ["target_contains", "Checks if target contains a regular expression"],
46680
+ ["error_contains", "Checks if error contains a regular expression"]
46681
+ ];
46595
46682
  const coerceValue = (value2, descriptor) => {
46596
46683
  if (descriptor && descriptor.scoreType === kScoreTypeBoolean) {
46597
46684
  return Boolean(value2);
@@ -46643,10 +46730,24 @@ ${citation.url}`,
46643
46730
  }
46644
46731
  return variables;
46645
46732
  };
46733
+ const getNestedPropertyValue = (obj, path) => {
46734
+ const keys = path.split(".");
46735
+ let current2 = obj;
46736
+ for (const key2 of keys) {
46737
+ if (current2 && typeof current2 === "object" && key2 in current2) {
46738
+ current2 = current2[key2];
46739
+ } else {
46740
+ return void 0;
46741
+ }
46742
+ }
46743
+ return current2;
46744
+ };
46646
46745
  const sampleVariables = (sample2) => {
46647
46746
  return {
46648
46747
  has_error: !!sample2.error,
46649
- has_retries: sample2.retries !== void 0 && sample2.retries > 0
46748
+ has_retries: sample2.retries !== void 0 && sample2.retries > 0,
46749
+ id: sample2.id,
46750
+ metadata: sample2.metadata
46650
46751
  };
46651
46752
  };
46652
46753
  const sampleFilterItems = (evalDescriptor) => {
@@ -46737,6 +46838,11 @@ categories: ${categories.join(" ")}`;
46737
46838
  const value2 = get2(name2);
46738
46839
  return value2;
46739
46840
  }
46841
+ if (name2.startsWith(kSampleMetadataPrefix)) {
46842
+ const propertyPath = name2.substring(kSampleMetadataPrefix.length);
46843
+ const metadata2 = sample2.metadata || {};
46844
+ return getNestedPropertyValue(metadata2, propertyPath);
46845
+ }
46740
46846
  return sample2.error ? void 0 : get2(name2);
46741
46847
  };
46742
46848
  const expression = compileExpression(filterValue, {
@@ -46759,6 +46865,9 @@ categories: ${categories.join(" ")}`;
46759
46865
  const errorObj = error2;
46760
46866
  const propertyName2 = errorObj["propertyName"] || "";
46761
46867
  if (propertyName2) {
46868
+ if (propertyName2.startsWith(kSampleMetadataPrefix)) {
46869
+ return { matches: false, error: void 0 };
46870
+ }
46762
46871
  const regex2 = new RegExp(`\\b${propertyName2}\\b`);
46763
46872
  const match = regex2.exec(filterValue);
46764
46873
  if (match) {
@@ -48745,38 +48854,6 @@ categories: ${categories.join(" ")}`;
48745
48854
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "task-created", style: { display: "none" }, children: evalSpec == null ? void 0 : evalSpec.created })
48746
48855
  ] });
48747
48856
  };
48748
- const LabeledValue = ({
48749
- layout = "column",
48750
- style: style2,
48751
- label: label2,
48752
- children: children2,
48753
- valueStyle,
48754
- className: className2
48755
- }) => {
48756
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
48757
- "div",
48758
- {
48759
- className: clsx(
48760
- "labeled-value",
48761
- layout === "column" ? "column" : "row",
48762
- className2
48763
- ),
48764
- style: {
48765
- ...style2
48766
- },
48767
- children: [
48768
- /* @__PURE__ */ jsxRuntimeExports.jsx(
48769
- "div",
48770
- {
48771
- className: "labeled-value-label text-style-label text-style-secondary",
48772
- children: label2
48773
- }
48774
- ),
48775
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "labeled-value-value", style: { ...valueStyle }, children: children2 })
48776
- ]
48777
- }
48778
- );
48779
- };
48780
48857
  const staticCol = "_staticCol_xzzhl_1";
48781
48858
  const justifyLeft = "_justifyLeft_xzzhl_5";
48782
48859
  const justifyCenter = "_justifyCenter_xzzhl_9";
@@ -49710,6 +49787,27 @@ self.onmessage = function (e) {
49710
49787
  )).parsed;
49711
49788
  return result2;
49712
49789
  }
49790
+ async function log_message$1(log_file, message2) {
49791
+ const params2 = new URLSearchParams();
49792
+ params2.append("log_file", log_file);
49793
+ params2.append("message", message2);
49794
+ const request = {
49795
+ headers: {
49796
+ "Content-Type": "text/plain"
49797
+ },
49798
+ parse: async (text2) => {
49799
+ if (text2 !== "") {
49800
+ throw new Error(`Unexpected response from log_message: ${text2}`);
49801
+ }
49802
+ return;
49803
+ }
49804
+ };
49805
+ await apiRequest(
49806
+ "GET",
49807
+ `/api/log-message?${params2.toString()}`,
49808
+ request
49809
+ );
49810
+ }
49713
49811
  async function apiRequest(method, path, request) {
49714
49812
  const responseHeaders = {
49715
49813
  Accept: "application/json",
@@ -49803,6 +49901,7 @@ self.onmessage = function (e) {
49803
49901
  eval_log_size: eval_log_size$1,
49804
49902
  eval_log_bytes: eval_log_bytes$1,
49805
49903
  eval_log_headers: eval_log_headers$1,
49904
+ log_message: log_message$1,
49806
49905
  download_file: download_file$1,
49807
49906
  open_log_file: open_log_file$1,
49808
49907
  eval_pending_samples: eval_pending_samples$1,
@@ -50626,6 +50725,9 @@ self.onmessage = function (e) {
50626
50725
  }
50627
50726
  return void 0;
50628
50727
  },
50728
+ log_message: async (log_file, message2) => {
50729
+ console.log(`[CLIENT MESSAGE] (${log_file}): ${message2}`);
50730
+ },
50629
50731
  eval_log: async (log_file, _headerOnly, _capabilities) => {
50630
50732
  const response = await fetchLogFile(log_file);
50631
50733
  if (response) {
@@ -50742,6 +50844,7 @@ self.onmessage = function (e) {
50742
50844
  const kMethodEvalLogHeaders = "eval_log_headers";
50743
50845
  const kMethodPendingSamples = "eval_log_pending_samples";
50744
50846
  const kMethodSampleData = "eval_log_sample_data";
50847
+ const kMethodLogMessage = "log_message";
50745
50848
  const kJsonRpcVersion = "2.0";
50746
50849
  function webViewJsonRpcClient(vscode2) {
50747
50850
  const target2 = {
@@ -50910,6 +51013,9 @@ self.onmessage = function (e) {
50910
51013
  throw new Error(`Unable to load live sample data ${log_file}.`);
50911
51014
  }
50912
51015
  }
51016
+ async function log_message(log_file, message2) {
51017
+ await vscodeClient(kMethodLogMessage, [log_file, message2]);
51018
+ }
50913
51019
  async function download_file() {
50914
51020
  throw Error("Downloading files is not supported in VS Code");
50915
51021
  }
@@ -50929,6 +51035,7 @@ self.onmessage = function (e) {
50929
51035
  eval_log_size,
50930
51036
  eval_log_bytes,
50931
51037
  eval_log_headers,
51038
+ log_message,
50932
51039
  download_file,
50933
51040
  open_log_file,
50934
51041
  eval_pending_samples,
@@ -51357,6 +51464,9 @@ self.onmessage = function (e) {
51357
51464
  download_file: (download_file2, file_contents) => {
51358
51465
  return api2.download_file(download_file2, file_contents);
51359
51466
  },
51467
+ log_message: (log_file2, message2) => {
51468
+ return api2.log_message(log_file2, message2);
51469
+ },
51360
51470
  get_log_pending_samples: api2.eval_pending_samples ? get_log_pending_samples : void 0,
51361
51471
  get_log_sample_data: api2.eval_log_sample_data ? get_log_sample_data : void 0
51362
51472
  };
@@ -55233,7 +55343,7 @@ self.onmessage = function (e) {
55233
55343
  {
55234
55344
  className: clsx(
55235
55345
  styles$y.eventRow,
55236
- "text-size-smallest",
55346
+ "text-size-smaller",
55237
55347
  selected2 ? styles$y.selected : ""
55238
55348
  ),
55239
55349
  style: { paddingLeft: `${node2.depth * 0.4}em` },
@@ -85542,28 +85652,6 @@ ${events}
85542
85652
  ...historyKeymap
85543
85653
  ])
85544
85654
  ])();
85545
- const KEYWORDS = ["and", "or", "not", "in", "not in", "mod"];
85546
- const MATH_FUNCTIONS = [
85547
- ["min", "Minimum of two or more values"],
85548
- ["max", "Maximum of two or more values"],
85549
- ["abs", "Absolute value"],
85550
- ["round", "Round to the nearest integer"],
85551
- ["floor", "Round down to the nearest integer"],
85552
- ["ceil", "Round up to the nearest integer"],
85553
- ["sqrt", "Square root"],
85554
- ["log", "Natural logarithm"],
85555
- ["log2", "Base 2 logarithm"],
85556
- ["log10", "Base 10 logarithm"]
85557
- ];
85558
- const SAMPLE_VARIABLES = [
85559
- ["has_error", "Checks if the sample has an error"],
85560
- ["has_retries", "Checks if the sample has been retried"]
85561
- ];
85562
- const SAMPLE_FUNCTIONS = [
85563
- ["input_contains", "Checks if input contains a regular expression"],
85564
- ["target_contains", "Checks if target contains a regular expression"],
85565
- ["error_contains", "Checks if error contains a regular expression"]
85566
- ];
85567
85655
  const TOKEN_PATTERNS = {
85568
85656
  STRING: /^"[^"]*"/,
85569
85657
  UNTERMINATED_STRING: /^"[^"]*/,
@@ -85640,6 +85728,20 @@ ${events}
85640
85728
  selection: { anchor: from + completion.label.length + 1 }
85641
85729
  });
85642
85730
  };
85731
+ const applyWithDot = (view, completion, from, to2) => {
85732
+ view.dispatch({
85733
+ changes: { from, to: to2, insert: `${completion.label}.` },
85734
+ selection: { anchor: from + completion.label.length + 1 }
85735
+ });
85736
+ setTimeout(() => startCompletion(view), 0);
85737
+ };
85738
+ const applyWithSpace = (view, completion, from, to2) => {
85739
+ view.dispatch({
85740
+ changes: { from, to: to2, insert: `${completion.label} ` },
85741
+ selection: { anchor: from + completion.label.length + 1 }
85742
+ });
85743
+ setTimeout(() => startCompletion(view), 0);
85744
+ };
85643
85745
  const makeKeywordCompletion = (k) => ({
85644
85746
  label: k,
85645
85747
  type: "keyword",
@@ -85663,6 +85765,7 @@ ${events}
85663
85765
  label: label2,
85664
85766
  type: "variable",
85665
85767
  info,
85768
+ apply: label2 === kSampleMetadataVariable ? applyWithDot : label2 === kSampleIdVariable ? applyWithSpace : void 0,
85666
85769
  boost: 10
85667
85770
  });
85668
85771
  const makeLiteralCompletion = (k) => ({
@@ -85689,8 +85792,139 @@ ${events}
85689
85792
  var _a2;
85690
85793
  return (_a2 = item2 == null ? void 0 : item2.qualifiedName) == null ? void 0 : _a2.startsWith(`${scorer2}.`);
85691
85794
  });
85692
- function getCompletions(context, filterItems) {
85693
- var _a2, _b2, _c, _d, _e2, _f, _g, _h, _i, _j, _k;
85795
+ const getSampleIds = (samples) => {
85796
+ const ids = /* @__PURE__ */ new Set();
85797
+ for (const sample2 of samples) {
85798
+ ids.add(sample2.id);
85799
+ }
85800
+ return ids;
85801
+ };
85802
+ const getMetadataPropertyValues = (samples, propertyPath) => {
85803
+ const values = /* @__PURE__ */ new Set();
85804
+ for (const sample2 of samples) {
85805
+ if (sample2.metadata) {
85806
+ const value2 = getNestedProperty(sample2.metadata, propertyPath);
85807
+ if (value2 !== void 0 && value2 !== null) {
85808
+ values.add(value2);
85809
+ }
85810
+ }
85811
+ }
85812
+ return values;
85813
+ };
85814
+ const getNestedProperty = (obj, path) => {
85815
+ const keys = path.split(".");
85816
+ let current2 = obj;
85817
+ for (const key2 of keys) {
85818
+ if (current2 && typeof current2 === "object" && key2 in current2) {
85819
+ current2 = current2[key2];
85820
+ } else {
85821
+ return void 0;
85822
+ }
85823
+ }
85824
+ return current2;
85825
+ };
85826
+ const buildMetadataPath = (tokens, currentTokenIndex) => {
85827
+ var _a2;
85828
+ const parts = [];
85829
+ let index2 = 2;
85830
+ while (index2 <= currentTokenIndex) {
85831
+ const token2 = tokens[currentTokenIndex - index2];
85832
+ if ((token2 == null ? void 0 : token2.text) === kSampleMetadataVariable) {
85833
+ return parts.reverse().join(".");
85834
+ } else if ((token2 == null ? void 0 : token2.type) === "variable") {
85835
+ parts.push(token2.text);
85836
+ index2++;
85837
+ if (((_a2 = tokens[currentTokenIndex - index2]) == null ? void 0 : _a2.text) === ".") {
85838
+ index2++;
85839
+ } else {
85840
+ break;
85841
+ }
85842
+ } else {
85843
+ break;
85844
+ }
85845
+ }
85846
+ return null;
85847
+ };
85848
+ const getMetadataKeysForPath = (samples, parentPath) => {
85849
+ const keys = /* @__PURE__ */ new Set();
85850
+ for (const sample2 of samples) {
85851
+ if (sample2.metadata) {
85852
+ const parentObj = parentPath ? getNestedProperty(sample2.metadata, parentPath) : sample2.metadata;
85853
+ if (parentObj && typeof parentObj === "object" && !Array.isArray(parentObj)) {
85854
+ for (const key2 of Object.keys(parentObj)) {
85855
+ keys.add(key2);
85856
+ }
85857
+ }
85858
+ }
85859
+ }
85860
+ return keys;
85861
+ };
85862
+ const buildMetadataPropertyPath = (tokens, currentTokenIndex) => {
85863
+ const parts = [];
85864
+ let index2 = 2;
85865
+ while (index2 <= currentTokenIndex) {
85866
+ const token2 = tokens[currentTokenIndex - index2];
85867
+ if (!token2) break;
85868
+ if (token2.type === "variable") {
85869
+ if (token2.text === kSampleMetadataVariable) {
85870
+ return parts.reverse().join(".");
85871
+ } else {
85872
+ parts.push(token2.text);
85873
+ }
85874
+ } else if (token2.text !== ".") {
85875
+ break;
85876
+ }
85877
+ index2++;
85878
+ }
85879
+ return null;
85880
+ };
85881
+ const isMetadataProperty = (tokens, currentTokenIndex) => {
85882
+ let index2 = 2;
85883
+ while (index2 <= currentTokenIndex) {
85884
+ const token2 = tokens[currentTokenIndex - index2];
85885
+ if (!token2) break;
85886
+ if (token2.text === kSampleMetadataVariable) {
85887
+ return true;
85888
+ } else if (token2.text === "." || token2.type === "variable") {
85889
+ index2++;
85890
+ } else {
85891
+ break;
85892
+ }
85893
+ }
85894
+ return false;
85895
+ };
85896
+ const makeMetadataKeyCompletion = (key2) => ({
85897
+ label: key2,
85898
+ type: "property",
85899
+ info: `Metadata property: ${key2}`,
85900
+ boost: 25
85901
+ });
85902
+ const makeSampleIdCompletion = (id) => ({
85903
+ label: typeof id === "string" ? `"${id}"` : String(id),
85904
+ type: "text",
85905
+ info: `Sample ID: ${id}`,
85906
+ boost: 25
85907
+ });
85908
+ const makeMetadataValueCompletion = (value2) => {
85909
+ let label2;
85910
+ if (typeof value2 === "string") {
85911
+ label2 = `"${value2}"`;
85912
+ } else if (typeof value2 === "boolean") {
85913
+ label2 = value2 ? "True" : "False";
85914
+ } else if (value2 === null) {
85915
+ label2 = "None";
85916
+ } else {
85917
+ label2 = String(value2);
85918
+ }
85919
+ return {
85920
+ label: label2,
85921
+ type: "text",
85922
+ info: `Metadata value: ${value2}`,
85923
+ boost: 25
85924
+ };
85925
+ };
85926
+ function getCompletions(context, filterItems, samples) {
85927
+ var _a2, _b2, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m;
85694
85928
  const keywordCompletionItems = KEYWORDS.map(makeKeywordCompletion);
85695
85929
  const mathFunctionCompletionItems = MATH_FUNCTIONS.map(
85696
85930
  makeMathFunctionCompletion
@@ -85698,7 +85932,15 @@ ${events}
85698
85932
  const sampleFunctionCompletionItems = SAMPLE_FUNCTIONS.map(
85699
85933
  makeSampleFunctionCompletion
85700
85934
  );
85701
- const sampleVariableCompletionItems = SAMPLE_VARIABLES.map(
85935
+ const availableSampleVariables = SAMPLE_VARIABLES.filter(([label2]) => {
85936
+ if (label2 === kSampleMetadataVariable) {
85937
+ return samples && samples.some(
85938
+ (sample2) => sample2.metadata && Object.keys(sample2.metadata).length > 0
85939
+ );
85940
+ }
85941
+ return true;
85942
+ });
85943
+ const sampleVariableCompletionItems = availableSampleVariables.map(
85702
85944
  makeSampleVariableCompletion
85703
85945
  );
85704
85946
  const variableCompletionItems = filterItems.map(
@@ -85793,7 +86035,7 @@ ${events}
85793
86035
  enforceOrder: true,
85794
86036
  autoSpaceAfter: completingAtEnd
85795
86037
  });
85796
- const descreteRelationCompletions = () => makeCompletions(["==", "!=", "in", "not in"].map(makeKeywordCompletion), {
86038
+ const discreteRelationCompletions = () => makeCompletions(["==", "!=", "in", "not in"].map(makeKeywordCompletion), {
85797
86039
  enforceOrder: true,
85798
86040
  autoSpaceAfter: completingAtEnd
85799
86041
  });
@@ -85808,9 +86050,19 @@ ${events}
85808
86050
  const rhsCompletions = (options2) => makeCompletions(options2.map(makeLiteralCompletion));
85809
86051
  if (!prevToken(1)) return newExpressionCompletions();
85810
86052
  if (((_a2 = prevToken(1)) == null ? void 0 : _a2.text) === ".") {
85811
- const scorer2 = (_b2 = prevToken(2)) == null ? void 0 : _b2.text;
85812
- if (scorer2) {
85813
- return memberAccessCompletions(getMemberScoreItems(filterItems, scorer2));
86053
+ const varName = (_b2 = prevToken(2)) == null ? void 0 : _b2.text;
86054
+ const metadataPath = buildMetadataPath(tokens, currentTokenIndex);
86055
+ if (metadataPath !== null && samples) {
86056
+ const metadataKeys = Array.from(
86057
+ getMetadataKeysForPath(samples, metadataPath)
86058
+ );
86059
+ const metadataCompletions = metadataKeys.map(makeMetadataKeyCompletion);
86060
+ return makeCompletions(metadataCompletions, {
86061
+ autocompleteInTheMiddle: true,
86062
+ includeDefault: false
86063
+ });
86064
+ } else if (varName) {
86065
+ return memberAccessCompletions(getMemberScoreItems(filterItems, varName));
85814
86066
  }
85815
86067
  }
85816
86068
  if (((_c = prevToken(1)) == null ? void 0 : _c.text) === "(") {
@@ -85820,11 +86072,24 @@ ${events}
85820
86072
  }
85821
86073
  if (((_f = prevToken(1)) == null ? void 0 : _f.text) === ")") return noCompletions();
85822
86074
  if (((_g = prevToken(1)) == null ? void 0 : _g.type) === "variable") {
85823
- const scoreType = ((_h = findFilterItem(1)) == null ? void 0 : _h.scoreType) || "";
86075
+ const varName = (_h = prevToken(1)) == null ? void 0 : _h.text;
86076
+ if (isMetadataProperty(tokens, currentTokenIndex)) {
86077
+ return customRelationCompletions();
86078
+ }
86079
+ if (varName === kSampleIdVariable) {
86080
+ return discreteRelationCompletions();
86081
+ }
86082
+ if (varName === kSampleMetadataVariable) {
86083
+ return customRelationCompletions();
86084
+ }
86085
+ if (varName === "has_error" || varName === "has_retries") {
86086
+ return logicalOpCompletions();
86087
+ }
86088
+ const scoreType = ((_i = findFilterItem(1)) == null ? void 0 : _i.scoreType) || "";
85824
86089
  switch (scoreType) {
85825
86090
  case kScoreTypePassFail:
85826
86091
  case kScoreTypeCategorical:
85827
- return descreteRelationCompletions();
86092
+ return discreteRelationCompletions();
85828
86093
  case kScoreTypeNumeric:
85829
86094
  return continuousRelationCompletions();
85830
86095
  case kScoreTypeOther:
@@ -85835,14 +86100,47 @@ ${events}
85835
86100
  return noCompletions();
85836
86101
  }
85837
86102
  }
85838
- if (((_i = prevToken(1)) == null ? void 0 : _i.type) === "relation") {
86103
+ if (((_j = prevToken(1)) == null ? void 0 : _j.type) === "relation") {
86104
+ const varName = (_k = prevToken(2)) == null ? void 0 : _k.text;
86105
+ const metadataPropertyPath = buildMetadataPropertyPath(
86106
+ tokens,
86107
+ currentTokenIndex
86108
+ );
86109
+ if (metadataPropertyPath !== null && samples) {
86110
+ const metadataValues = Array.from(
86111
+ getMetadataPropertyValues(samples, metadataPropertyPath)
86112
+ );
86113
+ const currentQuery = (currentToken == null ? void 0 : currentToken.text) || "";
86114
+ const filteredValues = currentQuery ? metadataValues.filter((value2) => {
86115
+ const label2 = typeof value2 === "string" ? `"${value2}"` : typeof value2 === "boolean" ? value2 ? "True" : "False" : value2 === null ? "None" : String(value2);
86116
+ return label2.toLowerCase().startsWith(currentQuery.toLowerCase());
86117
+ }) : metadataValues;
86118
+ const metadataValueCompletions = filteredValues.map(
86119
+ makeMetadataValueCompletion
86120
+ );
86121
+ return makeCompletions(metadataValueCompletions, {
86122
+ includeDefault: false
86123
+ });
86124
+ }
86125
+ if (varName === kSampleIdVariable && samples) {
86126
+ const sampleIds = Array.from(getSampleIds(samples));
86127
+ const currentQuery = (currentToken == null ? void 0 : currentToken.text) || "";
86128
+ const filteredIds = currentQuery ? sampleIds.filter((id) => {
86129
+ const label2 = typeof id === "string" ? `"${id}"` : String(id);
86130
+ return label2.toLowerCase().startsWith(currentQuery.toLowerCase());
86131
+ }) : sampleIds;
86132
+ const sampleIdCompletions = filteredIds.map(makeSampleIdCompletion);
86133
+ return makeCompletions(sampleIdCompletions, {
86134
+ includeDefault: false
86135
+ });
86136
+ }
85839
86137
  const item2 = findFilterItem(2);
85840
- if ((_j = item2 == null ? void 0 : item2.categories) == null ? void 0 : _j.length) {
86138
+ if ((_l = item2 == null ? void 0 : item2.categories) == null ? void 0 : _l.length) {
85841
86139
  return rhsCompletions(item2.categories);
85842
86140
  }
85843
86141
  return variableCompletions();
85844
86142
  }
85845
- if (isLiteral(prevToken(1)) && ((_k = prevToken(2)) == null ? void 0 : _k.type) === "relation") {
86143
+ if (isLiteral(prevToken(1)) && ((_m = prevToken(2)) == null ? void 0 : _m.type) === "relation") {
85846
86144
  return logicalOpCompletions();
85847
86145
  }
85848
86146
  if (isLogicalOp(prevToken(1))) return newExpressionCompletions();
@@ -85862,6 +86160,8 @@ Filter samples by:
85862
86160
  • Samples with errors: has_error
85863
86161
  • Input, target and error regex search: input_contains, target_contains, error_contains
85864
86162
  • Samples that have been retried: has_retries
86163
+ • Sample Id: e.g. "id == 'sample123'"
86164
+ • Sample metadata: e.g. "metadata.key == 'value'"
85865
86165
 
85866
86166
  Supported expressions:
85867
86167
  • Arithmetic: +, -, *, /, mod, ^
@@ -85916,6 +86216,12 @@ Supported expressions:
85916
86216
  },
85917
86217
  ".cm-scroller": {
85918
86218
  overflow: "hidden"
86219
+ },
86220
+ ".cm-line": {
86221
+ "font-size": "var(--inspect-font-size-smallest) !important"
86222
+ },
86223
+ ".token": {
86224
+ "font-size": "var(--inspect-font-size-smallest) !important"
85919
86225
  }
85920
86226
  });
85921
86227
  const ensureOneLine = (tr2) => {
@@ -85959,6 +86265,12 @@ Supported expressions:
85959
86265
  );
85960
86266
  const filter = useStore((state) => state.log.filter);
85961
86267
  const filterError = useStore((state) => state.log.filterError);
86268
+ const samples = useStore(
86269
+ (state) => {
86270
+ var _a2;
86271
+ return (_a2 = state.log.selectedLogSummary) == null ? void 0 : _a2.sampleSummaries;
86272
+ }
86273
+ );
85962
86274
  const setFilter = useStore((state) => state.logActions.setFilter);
85963
86275
  const handleFocus = reactExports.useCallback((event, view) => {
85964
86276
  if (event.isTrusted && view.state.doc.toString() === "") {
@@ -85967,10 +86279,10 @@ Supported expressions:
85967
86279
  }, []);
85968
86280
  const makeAutocompletion = reactExports.useCallback(
85969
86281
  () => autocompletion({
85970
- override: [(context) => getCompletions(context, filterItems)],
86282
+ override: [(context) => getCompletions(context, filterItems, samples)],
85971
86283
  activateOnCompletion: (c2) => c2.label.endsWith(" ")
85972
86284
  }),
85973
- []
86285
+ [filterItems, samples]
85974
86286
  );
85975
86287
  const makeLinter = reactExports.useCallback(
85976
86288
  () => linter((view) => getLints(view, filterError)),
@@ -86040,7 +86352,7 @@ Supported expressions:
86040
86352
  (_a2 = editorViewRef.current) == null ? void 0 : _a2.dispatch({
86041
86353
  effects: autocompletionCompartment.current.reconfigure(makeAutocompletion())
86042
86354
  });
86043
- }, [filterItems]);
86355
+ }, [filterItems, samples]);
86044
86356
  reactExports.useEffect(() => {
86045
86357
  var _a2;
86046
86358
  (_a2 = editorViewRef.current) == null ? void 0 : _a2.dispatch({