@mastra/playground-ui 20.0.1-alpha.2 → 20.0.2-alpha.0

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 (61) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/index.cjs.js +1915 -104
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.css +174 -5
  5. package/dist/index.es.js +1900 -100
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/src/domains/logs/components/log-details.d.ts +12 -0
  8. package/dist/src/domains/logs/components/logs-date-range-selector.d.ts +12 -0
  9. package/dist/src/domains/logs/components/logs-list.d.ts +20 -0
  10. package/dist/src/domains/logs/components/logs-toolbar.d.ts +17 -0
  11. package/dist/src/domains/logs/components/no-logs-info.d.ts +1 -0
  12. package/dist/src/domains/logs/components/span-details.d.ts +6 -0
  13. package/dist/src/domains/logs/components/trace/format-hierarchical-spans.d.ts +3 -0
  14. package/dist/src/domains/logs/components/trace/format-logs-as-spans.d.ts +10 -0
  15. package/dist/src/domains/logs/components/trace/get-descendant-ids.d.ts +3 -0
  16. package/dist/src/domains/logs/components/trace/shared.d.ts +3 -0
  17. package/dist/src/domains/logs/components/trace/span-type-icon.d.ts +6 -0
  18. package/dist/src/domains/logs/components/trace/timeline-expand-col.d.ts +13 -0
  19. package/dist/src/domains/logs/components/trace/timeline-name-col.d.ts +15 -0
  20. package/dist/src/domains/logs/components/trace/timeline-structure-sign.d.ts +5 -0
  21. package/dist/src/domains/logs/components/trace/timeline-timing-col.d.ts +11 -0
  22. package/dist/src/domains/logs/components/trace/trace-timeline-span.d.ts +17 -0
  23. package/dist/src/domains/logs/components/trace/trace-timeline.d.ts +13 -0
  24. package/dist/src/domains/logs/components/trace/types.d.ts +17 -0
  25. package/dist/src/domains/logs/components/trace-details.d.ts +8 -0
  26. package/dist/src/domains/logs/hooks/use-logs-filters.d.ts +25 -0
  27. package/dist/src/domains/logs/hooks/use-trace-spans.d.ts +44 -0
  28. package/dist/src/domains/logs/index.d.ts +7 -0
  29. package/dist/src/domains/logs/types.d.ts +32 -0
  30. package/dist/src/ds/components/DataDetailsPanel/data-details-panel-close-button.d.ts +6 -0
  31. package/dist/src/ds/components/DataDetailsPanel/data-details-panel-code-section.d.ts +8 -0
  32. package/dist/src/ds/components/DataDetailsPanel/data-details-panel-content.d.ts +5 -0
  33. package/dist/src/ds/components/DataDetailsPanel/data-details-panel-header.d.ts +5 -0
  34. package/dist/src/ds/components/DataDetailsPanel/data-details-panel-heading.d.ts +5 -0
  35. package/dist/src/ds/components/DataDetailsPanel/data-details-panel-key-value-list.d.ts +26 -0
  36. package/dist/src/ds/components/DataDetailsPanel/data-details-panel-loading-data.d.ts +5 -0
  37. package/dist/src/ds/components/DataDetailsPanel/data-details-panel-no-data.d.ts +4 -0
  38. package/dist/src/ds/components/DataDetailsPanel/data-details-panel.d.ts +5 -0
  39. package/dist/src/ds/components/DataDetailsPanel/index.d.ts +32 -0
  40. package/dist/src/ds/components/DataFilter/index.d.ts +2 -0
  41. package/dist/src/ds/components/DataFilter/select-data-filter.d.ts +40 -0
  42. package/dist/src/ds/components/DataList/data-list-cells.d.ts +10 -0
  43. package/dist/src/ds/components/DataList/data-list-next-page-loading.d.ts +8 -0
  44. package/dist/src/ds/components/DataList/data-list-no-match.d.ts +5 -0
  45. package/dist/src/ds/components/DataList/data-list-root.d.ts +7 -0
  46. package/dist/src/ds/components/DataList/data-list-row-button.d.ts +7 -0
  47. package/dist/src/ds/components/DataList/data-list-row-link.d.ts +7 -0
  48. package/dist/src/ds/components/DataList/data-list-row.d.ts +6 -0
  49. package/dist/src/ds/components/DataList/data-list-skeleton.d.ts +5 -0
  50. package/dist/src/ds/components/DataList/data-list-top-cell.d.ts +20 -0
  51. package/dist/src/ds/components/DataList/data-list-top.d.ts +6 -0
  52. package/dist/src/ds/components/DataList/data-list.d.ts +24 -0
  53. package/dist/src/ds/components/DataList/index.d.ts +2 -0
  54. package/dist/src/ds/components/DataList/shared.d.ts +1 -0
  55. package/dist/src/ds/components/FormFieldBlocks/fields/search-field-block.d.ts +3 -1
  56. package/dist/src/ds/components/ListSearch/list-search.d.ts +3 -1
  57. package/dist/src/ds/components/LogsDataList/index.d.ts +2 -0
  58. package/dist/src/ds/components/LogsDataList/logs-data-list-cells.d.ts +26 -0
  59. package/dist/src/ds/components/LogsDataList/logs-data-list.d.ts +26 -0
  60. package/dist/src/index.d.ts +4 -0
  61. package/package.json +8 -8
package/dist/index.cjs.js CHANGED
@@ -5757,7 +5757,7 @@ function buildLightTheme() {
5757
5757
  ]);
5758
5758
  return [editorTheme, language.syntaxHighlighting(highlightStyle)];
5759
5759
  }
5760
- const useCodemirrorTheme$1 = () => {
5760
+ const useCodemirrorTheme$2 = () => {
5761
5761
  const isDark = useIsDarkMode();
5762
5762
  return React.useMemo(() => isDark ? buildDarkTheme() : buildLightTheme(), [isDark]);
5763
5763
  };
@@ -5776,7 +5776,7 @@ const CodeEditor = React.forwardRef(
5776
5776
  lineNumbers = true,
5777
5777
  ...props
5778
5778
  }, ref) => {
5779
- const theme = useCodemirrorTheme$1();
5779
+ const theme = useCodemirrorTheme$2();
5780
5780
  const formattedCode = data ? JSON.stringify(data, null, 2) : value ?? "";
5781
5781
  const extensions = React.useMemo(() => {
5782
5782
  const exts = [];
@@ -8389,7 +8389,7 @@ const CodeDialogContent = ({
8389
8389
  data,
8390
8390
  language = "auto"
8391
8391
  }) => {
8392
- const theme = useCodemirrorTheme$1();
8392
+ const theme = useCodemirrorTheme$2();
8393
8393
  const getExtensions = (content) => {
8394
8394
  if (language === "javascript") {
8395
8395
  return [langJavascript.javascript(), view.EditorView.lineWrapping];
@@ -10384,7 +10384,7 @@ const JsonField = ({
10384
10384
  helperText,
10385
10385
  exampleCode
10386
10386
  }) => {
10387
- const theme = useCodemirrorTheme$1();
10387
+ const theme = useCodemirrorTheme$2();
10388
10388
  const { handleCopy } = useCopyToClipboard$1({ text: value });
10389
10389
  const { handleCopy: handleCopyExample } = useCopyToClipboard$1({ text: exampleCode ?? "{}" });
10390
10390
  const [fieldError, setFieldError] = React.useState(null);
@@ -12866,7 +12866,7 @@ function EntityListTopCellWithTooltip({ children, tooltip, className }) {
12866
12866
  /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: tooltip })
12867
12867
  ] });
12868
12868
  }
12869
- const breakpointClasses = {
12869
+ const breakpointClasses$1 = {
12870
12870
  sm: { show: "hidden sm:inline-flex", hide: "inline-flex sm:hidden" },
12871
12871
  md: { show: "hidden md:inline-flex", hide: "inline-flex md:hidden" },
12872
12872
  lg: { show: "hidden lg:inline-flex", hide: "inline-flex lg:hidden" },
@@ -12881,7 +12881,7 @@ function EntityListTopCellSmart({
12881
12881
  className
12882
12882
  }) {
12883
12883
  const tooltipText = tooltip ?? (typeof long === "string" ? long : void 0);
12884
- const bp = breakpointClasses[breakpoint];
12884
+ const bp = breakpointClasses$1[breakpoint];
12885
12885
  const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12886
12886
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("items-center gap-1", bp.show), children: long }),
12887
12887
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("items-center gap-1", bp.hide), children: short })
@@ -12914,14 +12914,14 @@ const EntityList = Object.assign(EntityListRoot, {
12914
12914
  NoMatch: EntityListNoMatch
12915
12915
  });
12916
12916
 
12917
- const widths$2 = ["75%", "50%", "65%", "90%", "60%", "80%"];
12917
+ const widths$3 = ["75%", "50%", "65%", "90%", "60%", "80%"];
12918
12918
  function EntityListSkeleton({ columns, numberOfRows = 3 }) {
12919
12919
  const columnParts = columns.trim().split(/\s+/);
12920
12920
  const columnCount = columnParts.length;
12921
12921
  const skeletonColumns = columnParts.map((col) => col === "auto" ? "minmax(6rem, auto)" : col).join(" ");
12922
12922
  const getPseudoRandomWidth = (rowIdx, colIdx) => {
12923
- const index = (rowIdx + colIdx + columnCount + numberOfRows) % widths$2.length;
12924
- return widths$2[index];
12923
+ const index = (rowIdx + colIdx + columnCount + numberOfRows) % widths$3.length;
12924
+ return widths$3[index];
12925
12925
  };
12926
12926
  return /* @__PURE__ */ jsxRuntime.jsx(EntityListRoot, { columns: skeletonColumns, children: Array.from({ length: numberOfRows }).map((_, rowIdx) => /* @__PURE__ */ jsxRuntime.jsx(
12927
12927
  "div",
@@ -13112,7 +13112,7 @@ const WorkflowRunOptions = () => {
13112
13112
  };
13113
13113
 
13114
13114
  const TracingRunOptions = () => {
13115
- const theme = useCodemirrorTheme$1();
13115
+ const theme = useCodemirrorTheme$2();
13116
13116
  const { settings, setSettings, entityType } = useTracingSettings();
13117
13117
  const handleChange = (value) => {
13118
13118
  if (!value) {
@@ -17878,7 +17878,7 @@ const AgentAdvancedSettings = () => {
17878
17878
  const [providerOptionsValue, setProviderOptionsValue] = React.useState("");
17879
17879
  const [saved, setSaved] = React.useState(false);
17880
17880
  const [error, setError] = React.useState(null);
17881
- const theme = useCodemirrorTheme$1();
17881
+ const theme = useCodemirrorTheme$2();
17882
17882
  const { handleCopy } = useCopyToClipboard$1({ text: providerOptionsValue });
17883
17883
  const providerOptionsStr = JSON.stringify(settings?.modelSettings?.providerOptions ?? {});
17884
17884
  React.useEffect(() => {
@@ -18498,7 +18498,7 @@ const EmptyAgentsTable = () => {
18498
18498
  const RequestContext = () => {
18499
18499
  const { requestContext, setRequestContext } = usePlaygroundStore();
18500
18500
  const [requestContextValue, setRequestContextValue] = React.useState("");
18501
- const theme = useCodemirrorTheme$1();
18501
+ const theme = useCodemirrorTheme$2();
18502
18502
  const presets = useRequestContextPresets();
18503
18503
  const [selectedPreset, setSelectedPreset] = React.useState(() => {
18504
18504
  if (!presets || !requestContext) return "__custom__";
@@ -19081,11 +19081,11 @@ const EntryList = Object.assign(EntryListRoot, {
19081
19081
  EntryStatus: EntryListEntryStatusCol
19082
19082
  });
19083
19083
 
19084
- const widths$1 = ["75%", "50%", "65%", "90%", "60%", "80%"];
19084
+ const widths$2 = ["75%", "50%", "65%", "90%", "60%", "80%"];
19085
19085
  function EntryListEntriesSkeleton({ columns, numberOfRows = 3 }) {
19086
19086
  const getPseudoRandomWidth = (rowIdx, colIdx) => {
19087
- const index = (rowIdx + colIdx + (columns?.length || 0) + (numberOfRows || 0)) % widths$1.length;
19088
- return widths$1[index];
19087
+ const index = (rowIdx + colIdx + (columns?.length || 0) + (numberOfRows || 0)) % widths$2.length;
19088
+ return widths$2[index];
19089
19089
  };
19090
19090
  return /* @__PURE__ */ jsxRuntime.jsx(EntryListEntries, { children: Array.from({ length: numberOfRows }).map((_, rowIdx) => /* @__PURE__ */ jsxRuntime.jsx(EntryListEntry, { columns, children: (columns || []).map((col, colIdx) => {
19091
19091
  const key = `${col.name}-${colIdx}`;
@@ -19305,17 +19305,17 @@ function buildSideDialogLightTheme() {
19305
19305
  ]);
19306
19306
  return [editorTheme, language.syntaxHighlighting(highlightStyle)];
19307
19307
  }
19308
- const useCodemirrorTheme = () => {
19308
+ const useCodemirrorTheme$1 = () => {
19309
19309
  const isDark = useIsDarkMode();
19310
19310
  return React.useMemo(() => isDark ? buildSideDialogDarkTheme() : buildSideDialogLightTheme(), [isDark]);
19311
19311
  };
19312
19312
  function SideDialogCodeSection({ codeStr = "", title, icon, simplified = false }) {
19313
- const theme = useCodemirrorTheme();
19313
+ const theme = useCodemirrorTheme$1();
19314
19314
  const [showAsMultilineText, setShowAsMultilineText] = React.useState(false);
19315
19315
  const hasMultilineText = React.useMemo(() => {
19316
19316
  try {
19317
19317
  const parsed = JSON.parse(codeStr);
19318
- return containsInnerNewline(parsed || "");
19318
+ return containsInnerNewline$1(parsed || "");
19319
19319
  } catch {
19320
19320
  return false;
19321
19321
  }
@@ -19335,14 +19335,14 @@ function SideDialogCodeSection({ codeStr = "", title, icon, simplified = false }
19335
19335
  codeStr && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dark:bg-black/20 bg-surface3 p-4 overflow-hidden rounded-xl border dark:border-white/10 border-border1 text-neutral4 text-ui-md break-all max-h-[30vh] overflow-y-auto", children: simplified ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-neutral4 font-mono break-all px-2", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-wrap", children: codeStr }) }) : /* @__PURE__ */ jsxRuntime.jsx(CodeMirror, { extensions: [langJson.json(), view.EditorView.lineWrapping], theme, value: finalCodeStr }) })
19336
19336
  ] });
19337
19337
  }
19338
- function containsInnerNewline(obj) {
19338
+ function containsInnerNewline$1(obj) {
19339
19339
  if (typeof obj === "string") {
19340
19340
  const idx = obj.indexOf("\n");
19341
19341
  return idx !== -1 && idx !== obj.length - 1;
19342
19342
  } else if (Array.isArray(obj)) {
19343
- return obj.some((item) => containsInnerNewline(item));
19343
+ return obj.some((item) => containsInnerNewline$1(item));
19344
19344
  } else if (obj && typeof obj === "object") {
19345
- return Object.values(obj).some((value) => containsInnerNewline(value));
19345
+ return Object.values(obj).some((value) => containsInnerNewline$1(value));
19346
19346
  }
19347
19347
  return false;
19348
19348
  }
@@ -22094,7 +22094,7 @@ const AgentMetadata = ({ agentId }) => {
22094
22094
  const { data: memory, isLoading: isMemoryLoading } = useMemory(agentId);
22095
22095
  const { mutate: reorderModelList } = useReorderModelList(agentId);
22096
22096
  const { mutateAsync: updateModelInModelList } = useUpdateModelInModelList(agentId);
22097
- const codemirrorTheme = useCodemirrorTheme$1();
22097
+ const codemirrorTheme = useCodemirrorTheme$2();
22098
22098
  const hasMemoryEnabled = Boolean(memory?.result);
22099
22099
  if (isLoading || isMemoryLoading) {
22100
22100
  return /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-full" });
@@ -22813,7 +22813,7 @@ const ToolExecutorContent = ({
22813
22813
  toolType,
22814
22814
  requestContextSchema
22815
22815
  }) => {
22816
- const theme = useCodemirrorTheme$1();
22816
+ const theme = useCodemirrorTheme$2();
22817
22817
  const code = JSON.stringify(result ?? {}, null, 2);
22818
22818
  const [selectedTab, setSelectedTab] = React.useState("input-data");
22819
22819
  const { schemaValues } = useSchemaRequestContext();
@@ -24594,7 +24594,7 @@ function removeFieldAtPath(fields, path, fieldId) {
24594
24594
  });
24595
24595
  }
24596
24596
 
24597
- function Root({
24597
+ function Root$1({
24598
24598
  onChange,
24599
24599
  onFieldsChange,
24600
24600
  defaultValue,
@@ -24875,7 +24875,7 @@ function AddField({ children, ...props }) {
24875
24875
  }
24876
24876
 
24877
24877
  const JSONSchemaForm = {
24878
- Root: Root,
24878
+ Root: Root$1,
24879
24879
  Field: Field,
24880
24880
  FieldList: FieldList,
24881
24881
  FieldName: FieldName,
@@ -33139,7 +33139,7 @@ const useScoresByExperimentId = (experimentId, experimentStatus) => {
33139
33139
  });
33140
33140
  };
33141
33141
 
33142
- const formatHierarchicalSpans = (spans) => {
33142
+ const formatHierarchicalSpans$1 = (spans) => {
33143
33143
  if (!spans || spans.length === 0) {
33144
33144
  return [];
33145
33145
  }
@@ -33339,7 +33339,7 @@ Token usage: ${inputTokens} input + ${outputTokens} output = ${totalTokens} tota
33339
33339
  return `The model stopped generating because it reached the maximum token limit (${totalTokens} tokens). The response was truncated and may be incomplete.`;
33340
33340
  }
33341
33341
 
33342
- function SpanDetails({ span }) {
33342
+ function SpanDetails$1({ span }) {
33343
33343
  if (!span) {
33344
33344
  return null;
33345
33345
  }
@@ -33631,7 +33631,7 @@ function SpanTabs({
33631
33631
  /* @__PURE__ */ jsxRuntime.jsx(TabContent, { value: "details", children: /* @__PURE__ */ jsxRuntime.jsxs(Sections, { children: [
33632
33632
  span?.attributes?.usage ? /* @__PURE__ */ jsxRuntime.jsx(TraceSpanUsage, { spanUsage: span.attributes.usage }) : null,
33633
33633
  /* @__PURE__ */ jsxRuntime.jsx(KeyValueList, { data: spanInfo }),
33634
- /* @__PURE__ */ jsxRuntime.jsx(SpanDetails, { span })
33634
+ /* @__PURE__ */ jsxRuntime.jsx(SpanDetails$1, { span })
33635
33635
  ] }) }),
33636
33636
  /* @__PURE__ */ jsxRuntime.jsx(TabContent, { value: "scores", children: /* @__PURE__ */ jsxRuntime.jsxs(Sections, { children: [
33637
33637
  /* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
@@ -33779,20 +33779,20 @@ function TraceAsItemDialog({ traceDetails, traceId, isOpen, onClose, level = 2 }
33779
33779
  );
33780
33780
  }
33781
33781
 
33782
- function getSpanDescendantIds$1(span) {
33782
+ function getSpanDescendantIds$2(span) {
33783
33783
  if (!span.spans || span.spans.length === 0) {
33784
33784
  return [];
33785
33785
  }
33786
33786
  const descendantIds = [];
33787
33787
  span.spans.forEach((childSpan) => {
33788
33788
  descendantIds.push(childSpan.id);
33789
- descendantIds.push(...getSpanDescendantIds$1(childSpan));
33789
+ descendantIds.push(...getSpanDescendantIds$2(childSpan));
33790
33790
  });
33791
33791
  return descendantIds;
33792
33792
  }
33793
33793
 
33794
33794
  const spanTypePrefixes$1 = ["agent", "workflow", "model", "mcp", "tool", "other"];
33795
- function getSpanTypeUi(type) {
33795
+ function getSpanTypeUi$1(type) {
33796
33796
  const typePrefix = type?.toLowerCase().split("_")[0];
33797
33797
  const spanTypeToUiElements = {
33798
33798
  agent: {
@@ -33839,7 +33839,7 @@ function getSpanTypeUi(type) {
33839
33839
  };
33840
33840
  }
33841
33841
 
33842
- function TimelineExpandCol({
33842
+ function TimelineExpandCol$1({
33843
33843
  isSelected,
33844
33844
  isFaded,
33845
33845
  isExpanded,
@@ -33857,12 +33857,12 @@ function TimelineExpandCol({
33857
33857
  "bg-surface4": isSelected
33858
33858
  }),
33859
33859
  children: numOfChildren && numOfChildren > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1", children: [
33860
- /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton$1, { onClick: () => toggleChildren?.(), children: [
33860
+ /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton$2, { onClick: () => toggleChildren?.(), children: [
33861
33861
  allDescendantsExpanded ? totalDescendants : numOfChildren,
33862
33862
  " ",
33863
33863
  isExpanded ? allDescendantsExpanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, {})
33864
33864
  ] }),
33865
- totalDescendants > numOfChildren && !allDescendantsExpanded && /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton$1, { onClick: () => expandAllDescendants?.(), children: [
33865
+ totalDescendants > numOfChildren && !allDescendantsExpanded && /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton$2, { onClick: () => expandAllDescendants?.(), children: [
33866
33866
  totalDescendants,
33867
33867
  " ",
33868
33868
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsDownIcon, {})
@@ -33871,7 +33871,7 @@ function TimelineExpandCol({
33871
33871
  }
33872
33872
  );
33873
33873
  }
33874
- function ExpandButton$1({ onClick, children, className }) {
33874
+ function ExpandButton$2({ onClick, children, className }) {
33875
33875
  return /* @__PURE__ */ jsxRuntime.jsx("button", { onClick, className: cn("h-full", className), children: /* @__PURE__ */ jsxRuntime.jsx(
33876
33876
  "div",
33877
33877
  {
@@ -33899,7 +33899,7 @@ function SpanTypeIcon({ icon, color }) {
33899
33899
  );
33900
33900
  }
33901
33901
 
33902
- function TimelineStructureSign({
33902
+ function TimelineStructureSign$1({
33903
33903
  isLastChild,
33904
33904
  hasChildren = false,
33905
33905
  expanded = false
@@ -33931,7 +33931,7 @@ function TimelineStructureSign({
33931
33931
  );
33932
33932
  }
33933
33933
 
33934
- function TimelineNameCol({
33934
+ function TimelineNameCol$1({
33935
33935
  span,
33936
33936
  spanUI,
33937
33937
  isFaded,
@@ -33963,7 +33963,7 @@ function TimelineNameCol({
33963
33963
  "cursor-default": !hasChildren,
33964
33964
  "cursor-pointer": hasChildren
33965
33965
  }),
33966
- children: /* @__PURE__ */ jsxRuntime.jsx(TimelineStructureSign, { isLastChild, hasChildren: Boolean(hasChildren), expanded: isExpanded })
33966
+ children: /* @__PURE__ */ jsxRuntime.jsx(TimelineStructureSign$1, { isLastChild, hasChildren: Boolean(hasChildren), expanded: isExpanded })
33967
33967
  }
33968
33968
  ),
33969
33969
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -33987,7 +33987,7 @@ function TimelineNameCol({
33987
33987
  );
33988
33988
  }
33989
33989
 
33990
- function TimelineTimingCol({
33990
+ function TimelineTimingCol$1({
33991
33991
  span,
33992
33992
  selectedSpanId,
33993
33993
  isFaded,
@@ -34090,7 +34090,7 @@ function TimelineTimingCol({
34090
34090
  ] });
34091
34091
  }
34092
34092
 
34093
- function TraceTimelineSpan({
34093
+ function TraceTimelineSpan$1({
34094
34094
  span,
34095
34095
  depth = 0,
34096
34096
  onSpanClick,
@@ -34107,10 +34107,10 @@ function TraceTimelineSpan({
34107
34107
  }) {
34108
34108
  const hasChildren = span.spans && span.spans.length > 0;
34109
34109
  const numOfChildren = span.spans ? span.spans.length : 0;
34110
- const allDescendantIds = getSpanDescendantIds$1(span);
34110
+ const allDescendantIds = getSpanDescendantIds$2(span);
34111
34111
  const totalDescendants = allDescendantIds.length;
34112
34112
  const isRootSpan = depth === 0;
34113
- const spanUI = getSpanTypeUi(span?.type);
34113
+ const spanUI = getSpanTypeUi$1(span?.type);
34114
34114
  const isExpanded = expandedSpanIds ? expandedSpanIds.includes(span.id) : false;
34115
34115
  const isFadedBySearch = featuredSpanIds && featuredSpanIds.length > 0 ? !featuredSpanIds.includes(span.id) : false;
34116
34116
  const isFadedByType = fadedTypes && fadedTypes.length > 0 ? fadedTypes.includes(spanUI?.typePrefix || "") : false;
@@ -34141,7 +34141,7 @@ function TraceTimelineSpan({
34141
34141
  const allDescendantsExpanded = allDescendantIds.every((id) => expandedSpanIds?.includes(id));
34142
34142
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
34143
34143
  /* @__PURE__ */ jsxRuntime.jsx(
34144
- TimelineNameCol,
34144
+ TimelineNameCol$1,
34145
34145
  {
34146
34146
  span,
34147
34147
  spanUI,
@@ -34157,7 +34157,7 @@ function TraceTimelineSpan({
34157
34157
  }
34158
34158
  ),
34159
34159
  /* @__PURE__ */ jsxRuntime.jsx(
34160
- TimelineExpandCol,
34160
+ TimelineExpandCol$1,
34161
34161
  {
34162
34162
  isSelected: selectedSpanId === span.id,
34163
34163
  isFaded,
@@ -34171,7 +34171,7 @@ function TraceTimelineSpan({
34171
34171
  }
34172
34172
  ),
34173
34173
  /* @__PURE__ */ jsxRuntime.jsx(
34174
- TimelineTimingCol,
34174
+ TimelineTimingCol$1,
34175
34175
  {
34176
34176
  span,
34177
34177
  selectedSpanId,
@@ -34185,7 +34185,7 @@ function TraceTimelineSpan({
34185
34185
  hasChildren && isExpanded && span.spans?.map((childSpan, idx, array) => {
34186
34186
  const isLastChild2 = idx === array.length - 1;
34187
34187
  return /* @__PURE__ */ jsxRuntime.jsx(
34188
- TraceTimelineSpan,
34188
+ TraceTimelineSpan$1,
34189
34189
  {
34190
34190
  span: childSpan,
34191
34191
  depth: depth + 1,
@@ -34206,7 +34206,7 @@ function TraceTimelineSpan({
34206
34206
  ] });
34207
34207
  }
34208
34208
 
34209
- function TraceTimeline({
34209
+ function TraceTimeline$1({
34210
34210
  hierarchicalSpans = [],
34211
34211
  onSpanClick,
34212
34212
  selectedSpanId,
@@ -34239,7 +34239,7 @@ function TraceTimeline({
34239
34239
  "xl:grid-cols-[2fr_auto_1fr]": overallEndTime
34240
34240
  }),
34241
34241
  children: hierarchicalSpans?.map((span) => /* @__PURE__ */ jsxRuntime.jsx(
34242
- TraceTimelineSpan,
34242
+ TraceTimelineSpan$1,
34243
34243
  {
34244
34244
  span,
34245
34245
  onSpanClick,
@@ -34286,7 +34286,8 @@ function SearchFieldBlock({
34286
34286
  placeholder = "Search...",
34287
34287
  onChange,
34288
34288
  onReset,
34289
- className
34289
+ className,
34290
+ size
34290
34291
  }) {
34291
34292
  return /* @__PURE__ */ jsxRuntime.jsxs(FieldBlock.Layout, { layout, className, children: [
34292
34293
  layout === "horizontal" ? /* @__PURE__ */ jsxRuntime.jsx(FieldBlock.Column, { children: /* @__PURE__ */ jsxRuntime.jsx(FieldBlock.Label, { name, required, children: labelIsHidden ? /* @__PURE__ */ jsxRuntime.jsx(VisuallyHidden.VisuallyHidden, { children: label }) : label }) }) : null,
@@ -34301,6 +34302,7 @@ function SearchFieldBlock({
34301
34302
  value,
34302
34303
  placeholder,
34303
34304
  onChange,
34305
+ size,
34304
34306
  className: "pl-10"
34305
34307
  }
34306
34308
  ),
@@ -34376,7 +34378,7 @@ function TraceTimelineTools({
34376
34378
  ) }),
34377
34379
  /* @__PURE__ */ jsxRuntime.jsxs(CombinedButtons, { children: [
34378
34380
  usedSpanTypes.map((item) => {
34379
- const spanUI = getSpanTypeUi(item);
34381
+ const spanUI = getSpanTypeUi$1(item);
34380
34382
  const isFaded = fadedTypes?.includes(item);
34381
34383
  return /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
34382
34384
  Button,
@@ -34462,7 +34464,7 @@ function TraceDialog({
34462
34464
  }
34463
34465
  }, [selectedSpanId]);
34464
34466
  const hierarchicalSpans = React.useMemo(() => {
34465
- return formatHierarchicalSpans(traceSpans);
34467
+ return formatHierarchicalSpans$1(traceSpans);
34466
34468
  }, [traceSpans]);
34467
34469
  const flatSpans = React.useMemo(() => {
34468
34470
  const flattenSpans = (spans) => {
@@ -34639,7 +34641,7 @@ function TraceDialog({
34639
34641
  }
34640
34642
  ),
34641
34643
  /* @__PURE__ */ jsxRuntime.jsx(
34642
- TraceTimeline,
34644
+ TraceTimeline$1,
34643
34645
  {
34644
34646
  hierarchicalSpans,
34645
34647
  onSpanClick: handleSpanClick,
@@ -39452,7 +39454,7 @@ const EntityListPageLayout = Object.assign(EntityListPageLayoutRoot, {
39452
39454
  Top: EntityListPageLayoutTop
39453
39455
  });
39454
39456
 
39455
- const ListSearch = ({ onSearch, label, placeholder, debounceMs = 300 }) => {
39457
+ const ListSearch = ({ onSearch, label, placeholder, debounceMs = 300, size }) => {
39456
39458
  const id = React.useId();
39457
39459
  const [value, setValue] = React.useState("");
39458
39460
  const debouncedSearch = useDebounce.useDebouncedCallback((val) => {
@@ -39481,6 +39483,7 @@ const ListSearch = ({ onSearch, label, placeholder, debounceMs = 300 }) => {
39481
39483
  value,
39482
39484
  onChange: handleChange,
39483
39485
  onReset: handleReset,
39486
+ size,
39484
39487
  className: "w-full max-w-[30rem]"
39485
39488
  }
39486
39489
  );
@@ -40452,7 +40455,7 @@ function ProcessorPanel({ processorId }) {
40452
40455
  return /* @__PURE__ */ jsxRuntime.jsx(ProcessorDetailPanel, { processor });
40453
40456
  }
40454
40457
  function ProcessorDetailPanel({ processor }) {
40455
- const theme = useCodemirrorTheme$1();
40458
+ const theme = useCodemirrorTheme$2();
40456
40459
  const formId = React.useId();
40457
40460
  const [selectedPhase, setSelectedPhase] = React.useState(processor.phases[0] || "input");
40458
40461
  const [selectedAgentId, setSelectedAgentId] = React.useState(processor.configurations[0]?.agentId || "");
@@ -41649,14 +41652,14 @@ function TemplateFailure({ errorMsg, validationErrors }) {
41649
41652
  ] });
41650
41653
  }
41651
41654
 
41652
- const DATE_PRESETS$2 = [
41655
+ const DATE_PRESETS$3 = [
41653
41656
  { label: "Last 24 hours", value: "24h" },
41654
41657
  { label: "Last 3 days", value: "3d" },
41655
41658
  { label: "Last 7 days", value: "7d" },
41656
41659
  { label: "Last 14 days", value: "14d" },
41657
41660
  { label: "Last 30 days", value: "30d" }
41658
41661
  ];
41659
- const VALID_PRESETS = new Set(DATE_PRESETS$2.map((p) => p.value));
41662
+ const VALID_PRESETS = new Set(DATE_PRESETS$3.map((p) => p.value));
41660
41663
  function isValidPreset(value) {
41661
41664
  return typeof value === "string" && (VALID_PRESETS.has(value) || value === "custom");
41662
41665
  }
@@ -41703,7 +41706,7 @@ function useMetrics() {
41703
41706
  }
41704
41707
  function getDateRangeLabel(preset, customRange) {
41705
41708
  if (preset !== "custom") {
41706
- return DATE_PRESETS$2.find((p) => p.value === preset).label;
41709
+ return DATE_PRESETS$3.find((p) => p.value === preset).label;
41707
41710
  }
41708
41711
  if (customRange?.from) {
41709
41712
  if (customRange.to) {
@@ -42929,7 +42932,7 @@ function MetricsDashboard() {
42929
42932
  ] });
42930
42933
  }
42931
42934
 
42932
- const DATE_PRESETS$1 = [
42935
+ const DATE_PRESETS$2 = [
42933
42936
  { label: "Last 24 hours", value: "24h" },
42934
42937
  { label: "Last 3 days", value: "3d" },
42935
42938
  { label: "Last 7 days", value: "7d" },
@@ -42944,7 +42947,7 @@ function DateRangeSelector() {
42944
42947
  name: "date-range",
42945
42948
  labelIsHidden: true,
42946
42949
  value: datePreset,
42947
- options: DATE_PRESETS$1,
42950
+ options: DATE_PRESETS$2,
42948
42951
  onValueChange: (value) => setDatePreset(value)
42949
42952
  }
42950
42953
  );
@@ -43025,7 +43028,7 @@ const CONTEXT_FILTER_CATEGORIES = CONTEXT_FIELD_IDS.map((id) => ({
43025
43028
  id,
43026
43029
  ...CONTEXT_FIELD_META[id]
43027
43030
  }));
43028
- const DATE_PRESETS = [
43031
+ const DATE_PRESETS$1 = [
43029
43032
  { value: "all", label: "All" },
43030
43033
  { value: "last-24h", label: "Last 24 hours", ms: 24 * 60 * 60 * 1e3 },
43031
43034
  { value: "last-3d", label: "Last 3 days", ms: 3 * 24 * 60 * 60 * 1e3 },
@@ -43039,17 +43042,17 @@ function buildDateWithTime(date, timeStr) {
43039
43042
  const combined = dateFns.parse(timeStr, "h:mm a", dateOnly);
43040
43043
  return dateFns.isValid(combined) ? combined : null;
43041
43044
  }
43042
- const subContentClass = cn(
43045
+ const subContentClass$1 = cn(
43043
43046
  "bg-surface5 backdrop-blur-xl z-50 min-w-32 overflow-auto rounded-lg p-2 shadow-md",
43044
43047
  "data-[state=open]:animate-in data-[state=closed]:animate-out",
43045
43048
  "data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0",
43046
43049
  "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"
43047
43050
  );
43048
- function PortalSubContent({ className, children, ...props }) {
43049
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive.SubContent, { className: cn(subContentClass, className), ...props, children }) });
43051
+ function PortalSubContent$1({ className, children, ...props }) {
43052
+ return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive.SubContent, { className: cn(subContentClass$1, className), ...props, children }) });
43050
43053
  }
43051
- const SUBMENU_SEARCH_THRESHOLD = 6;
43052
- function SubMenuSearch({
43054
+ const SUBMENU_SEARCH_THRESHOLD$1 = 6;
43055
+ function SubMenuSearch$1({
43053
43056
  value,
43054
43057
  onChange,
43055
43058
  label = "Search"
@@ -43124,7 +43127,7 @@ function TracesTools({
43124
43127
  },
43125
43128
  []
43126
43129
  );
43127
- const datePresetLabel = DATE_PRESETS.find((p) => p.value === datePreset)?.label ?? "All";
43130
+ const datePresetLabel = DATE_PRESETS$1.find((p) => p.value === datePreset)?.label ?? "All";
43128
43131
  const handleDatePresetSelect = (preset) => {
43129
43132
  onDatePresetChange?.(preset);
43130
43133
  if (preset === "custom") {
@@ -43135,7 +43138,7 @@ function TracesTools({
43135
43138
  setCustomRangeOpen(true);
43136
43139
  return;
43137
43140
  }
43138
- const entry = DATE_PRESETS.find((p) => p.value === preset);
43141
+ const entry = DATE_PRESETS$1.find((p) => p.value === preset);
43139
43142
  if (entry?.ms) {
43140
43143
  onDateChange?.(new Date(Date.now() - entry.ms), "from");
43141
43144
  onDateChange?.(void 0, "to");
@@ -43279,7 +43282,7 @@ function TracesTools({
43279
43282
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, {}),
43280
43283
  datePresetLabel
43281
43284
  ] }) }),
43282
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.Content, { align: "start", children: DATE_PRESETS.map((preset) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.Item, { onSelect: () => handleDatePresetSelect(preset.value), children: preset.label }, preset.value)) })
43285
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.Content, { align: "start", children: DATE_PRESETS$1.map((preset) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.Item, { onSelect: () => handleDatePresetSelect(preset.value), children: preset.label }, preset.value)) })
43283
43286
  ] }),
43284
43287
  /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { modal: false, children: [
43285
43288
  /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "md", disabled: isLoading, children: [
@@ -43328,7 +43331,7 @@ function TracesTools({
43328
43331
  "Status",
43329
43332
  errorOnly && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("ml-auto text-ui-sm text-accent1"), children: "1" })
43330
43333
  ] }),
43331
- /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent, { children: [
43334
+ /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent$1, { children: [
43332
43335
  /* @__PURE__ */ jsxRuntime.jsx(
43333
43336
  DropdownMenu.CheckboxItem,
43334
43337
  {
@@ -43354,8 +43357,8 @@ function TracesTools({
43354
43357
  "Entity Type",
43355
43358
  selectedEntity && selectedEntity.value !== "all" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("ml-auto text-ui-sm text-accent1"), children: "1" })
43356
43359
  ] }),
43357
- /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent, { children: [
43358
- entityOptions.length >= SUBMENU_SEARCH_THRESHOLD && /* @__PURE__ */ jsxRuntime.jsx(SubMenuSearch, { value: entitySearch, onChange: setEntitySearch, label: "Search entity types" }),
43360
+ /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent$1, { children: [
43361
+ entityOptions.length >= SUBMENU_SEARCH_THRESHOLD$1 && /* @__PURE__ */ jsxRuntime.jsx(SubMenuSearch$1, { value: entitySearch, onChange: setEntitySearch, label: "Search entity types" }),
43359
43362
  /* @__PURE__ */ jsxRuntime.jsx(
43360
43363
  DropdownMenu.RadioGroup,
43361
43364
  {
@@ -43376,8 +43379,8 @@ function TracesTools({
43376
43379
  "Tags",
43377
43380
  (selectedTags ?? []).length > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("ml-auto text-ui-sm text-accent1"), children: selectedTags?.length })
43378
43381
  ] }),
43379
- /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent, { children: [
43380
- (availableTags ?? []).length >= SUBMENU_SEARCH_THRESHOLD && /* @__PURE__ */ jsxRuntime.jsx(SubMenuSearch, { value: tagSearch, onChange: setTagSearch, label: "Search tags" }),
43382
+ /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent$1, { children: [
43383
+ (availableTags ?? []).length >= SUBMENU_SEARCH_THRESHOLD$1 && /* @__PURE__ */ jsxRuntime.jsx(SubMenuSearch$1, { value: tagSearch, onChange: setTagSearch, label: "Search tags" }),
43381
43384
  (availableTags ?? []).filter((tag) => !tagSearch || tag.toLowerCase().includes(tagSearch.toLowerCase())).map((tag) => /* @__PURE__ */ jsxRuntime.jsx(
43382
43385
  DropdownMenu.CheckboxItem,
43383
43386
  {
@@ -43401,9 +43404,9 @@ function TracesTools({
43401
43404
  "Metadata",
43402
43405
  metadataCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("ml-auto text-ui-sm text-accent1"), children: metadataCount })
43403
43406
  ] }),
43404
- /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent, { className: cn("max-h-80"), children: [
43405
- metadataKeys.length >= SUBMENU_SEARCH_THRESHOLD && /* @__PURE__ */ jsxRuntime.jsx(
43406
- SubMenuSearch,
43407
+ /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent$1, { className: cn("max-h-80"), children: [
43408
+ metadataKeys.length >= SUBMENU_SEARCH_THRESHOLD$1 && /* @__PURE__ */ jsxRuntime.jsx(
43409
+ SubMenuSearch$1,
43407
43410
  {
43408
43411
  value: metadataKeySearch,
43409
43412
  onChange: setMetadataKeySearch,
@@ -43418,9 +43421,9 @@ function TracesTools({
43418
43421
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("truncate"), children: key }),
43419
43422
  selectedValue && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("ml-auto text-ui-sm text-accent1"), children: "1" })
43420
43423
  ] }),
43421
- /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent, { className: cn("max-h-80"), children: [
43422
- values.length >= SUBMENU_SEARCH_THRESHOLD && /* @__PURE__ */ jsxRuntime.jsx(
43423
- SubMenuSearch,
43424
+ /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent$1, { className: cn("max-h-80"), children: [
43425
+ values.length >= SUBMENU_SEARCH_THRESHOLD$1 && /* @__PURE__ */ jsxRuntime.jsx(
43426
+ SubMenuSearch$1,
43424
43427
  {
43425
43428
  value: subValueSearch,
43426
43429
  onChange: setSubValueSearch,
@@ -43478,9 +43481,9 @@ function TracesTools({
43478
43481
  group,
43479
43482
  activeInGroup > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("ml-auto text-ui-sm text-accent1"), children: activeInGroup })
43480
43483
  ] }),
43481
- /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent, { className: cn("max-h-80"), children: [
43482
- fieldsWithValues.length >= SUBMENU_SEARCH_THRESHOLD && /* @__PURE__ */ jsxRuntime.jsx(
43483
- SubMenuSearch,
43484
+ /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent$1, { className: cn("max-h-80"), children: [
43485
+ fieldsWithValues.length >= SUBMENU_SEARCH_THRESHOLD$1 && /* @__PURE__ */ jsxRuntime.jsx(
43486
+ SubMenuSearch$1,
43484
43487
  {
43485
43488
  value: contextFieldSearch,
43486
43489
  onChange: setContextFieldSearch,
@@ -43497,9 +43500,9 @@ function TracesTools({
43497
43500
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("truncate"), children: field.label }),
43498
43501
  selectedValue && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("ml-auto text-ui-sm text-accent1"), children: "1" })
43499
43502
  ] }),
43500
- /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent, { className: cn("max-h-80"), children: [
43501
- values.length >= SUBMENU_SEARCH_THRESHOLD && /* @__PURE__ */ jsxRuntime.jsx(
43502
- SubMenuSearch,
43503
+ /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent$1, { className: cn("max-h-80"), children: [
43504
+ values.length >= SUBMENU_SEARCH_THRESHOLD$1 && /* @__PURE__ */ jsxRuntime.jsx(
43505
+ SubMenuSearch$1,
43503
43506
  {
43504
43507
  value: subValueSearch,
43505
43508
  onChange: setSubValueSearch,
@@ -43555,7 +43558,7 @@ function TracesTools({
43555
43558
  ] })
43556
43559
  ] })
43557
43560
  ] }),
43558
- onReset && /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "md", disabled: isLoading, onClick: () => onReset(), children: [
43561
+ onReset && /* @__PURE__ */ jsxRuntime.jsxs(Button, { disabled: isLoading, size: "md", onClick: () => onReset(), children: [
43559
43562
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
43560
43563
  "Reset"
43561
43564
  ] }),
@@ -46248,11 +46251,11 @@ const ItemList = Object.assign(ItemListRoot, {
46248
46251
  LabelCell: ItemListLabelCell
46249
46252
  });
46250
46253
 
46251
- const widths = ["75%", "50%", "65%", "90%", "60%", "80%"];
46254
+ const widths$1 = ["75%", "50%", "65%", "90%", "60%", "80%"];
46252
46255
  function ItemListItemsSkeleton({ columns, numberOfRows = 3 }) {
46253
46256
  const getPseudoRandomWidth = (rowIdx, colIdx) => {
46254
- const index = (rowIdx + colIdx + (columns?.length || 0) + (numberOfRows || 0)) % widths.length;
46255
- return widths[index];
46257
+ const index = (rowIdx + colIdx + (columns?.length || 0) + (numberOfRows || 0)) % widths$1.length;
46258
+ return widths$1[index];
46256
46259
  };
46257
46260
  return /* @__PURE__ */ jsxRuntime.jsx(ItemListItems, { children: Array.from({ length: numberOfRows }).map((_, rowIdx) => /* @__PURE__ */ jsxRuntime.jsx(ItemListRow, { children: /* @__PURE__ */ jsxRuntime.jsx(ItemListRowButton, { columns, children: (columns || []).map((col, colIdx) => {
46258
46261
  const key = `${col.name}-${colIdx}`;
@@ -49675,14 +49678,14 @@ const formatTraceSpans = (spans) => {
49675
49678
  return sortedRootSpans;
49676
49679
  };
49677
49680
 
49678
- function getSpanDescendantIds(span) {
49681
+ function getSpanDescendantIds$1(span) {
49679
49682
  if (!span.spans || span.spans.length === 0) {
49680
49683
  return [];
49681
49684
  }
49682
49685
  const descendantIds = [];
49683
49686
  span.spans.forEach((childSpan) => {
49684
49687
  descendantIds.push(childSpan.id);
49685
- descendantIds.push(...getSpanDescendantIds(childSpan));
49688
+ descendantIds.push(...getSpanDescendantIds$1(childSpan));
49686
49689
  });
49687
49690
  return descendantIds;
49688
49691
  }
@@ -49753,12 +49756,12 @@ function ExperimentTraceTimelineExpandCol({
49753
49756
  "bg-surface4": isSelected
49754
49757
  }),
49755
49758
  children: numOfChildren && numOfChildren > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1", children: [
49756
- /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton, { onClick: () => toggleChildren?.(), children: [
49759
+ /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton$1, { onClick: () => toggleChildren?.(), children: [
49757
49760
  allDescendantsExpanded ? totalDescendants : numOfChildren,
49758
49761
  " ",
49759
49762
  isExpanded ? allDescendantsExpanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, {})
49760
49763
  ] }),
49761
- totalDescendants > (numOfChildren ?? 0) && !allDescendantsExpanded && /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton, { onClick: () => expandAllDescendants?.(), children: [
49764
+ totalDescendants > (numOfChildren ?? 0) && !allDescendantsExpanded && /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton$1, { onClick: () => expandAllDescendants?.(), children: [
49762
49765
  totalDescendants,
49763
49766
  " ",
49764
49767
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsDownIcon, {})
@@ -49767,7 +49770,7 @@ function ExperimentTraceTimelineExpandCol({
49767
49770
  }
49768
49771
  );
49769
49772
  }
49770
- function ExpandButton({ onClick, children, className }) {
49773
+ function ExpandButton$1({ onClick, children, className }) {
49771
49774
  return /* @__PURE__ */ jsxRuntime.jsx("button", { onClick, className: cn("h-full", className), children: /* @__PURE__ */ jsxRuntime.jsx(
49772
49775
  "div",
49773
49776
  {
@@ -49877,7 +49880,7 @@ function ExperimentTraceTimelineSpan({
49877
49880
  }) {
49878
49881
  const hasChildren = span.spans && span.spans.length > 0;
49879
49882
  const numOfChildren = span.spans ? span.spans.length : 0;
49880
- const allDescendantIds = getSpanDescendantIds(span);
49883
+ const allDescendantIds = getSpanDescendantIds$1(span);
49881
49884
  const totalDescendants = allDescendantIds.length;
49882
49885
  const isRootSpan = depth === 0;
49883
49886
  const spanUI = getExperimentSpanTypeUi(span?.type);
@@ -51409,6 +51412,1803 @@ function DatasetCompareVersionsList({
51409
51412
  }) }) }) });
51410
51413
  }
51411
51414
 
51415
+ function DataDetailsPanel$1({ collapsed, children }) {
51416
+ return /* @__PURE__ */ jsxRuntime.jsx(
51417
+ "section",
51418
+ {
51419
+ className: cn(
51420
+ "flex flex-col bg-surface2 border border-border1 rounded-xl overflow-hidden",
51421
+ collapsed ? "h-auto" : "h-full"
51422
+ ),
51423
+ children
51424
+ }
51425
+ );
51426
+ }
51427
+
51428
+ function DataDetailsPanelCloseButton({
51429
+ onClick,
51430
+ tooltip = "Close panel",
51431
+ className
51432
+ }) {
51433
+ return /* @__PURE__ */ jsxRuntime.jsx(
51434
+ ButtonWithTooltip,
51435
+ {
51436
+ size: "md",
51437
+ onClick,
51438
+ "aria-label": "Close Panel",
51439
+ tooltipContent: tooltip,
51440
+ className,
51441
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {})
51442
+ }
51443
+ );
51444
+ }
51445
+
51446
+ const useCodemirrorTheme = () => {
51447
+ return React.useMemo(
51448
+ () => codemirrorThemeDracula.draculaInit({
51449
+ settings: {
51450
+ fontFamily: "var(--geist-mono)",
51451
+ fontSize: "0.75rem",
51452
+ lineHighlight: "transparent",
51453
+ gutterBackground: "transparent",
51454
+ gutterForeground: "#939393",
51455
+ background: "transparent"
51456
+ },
51457
+ styles: [{ tag: [highlight$1.tags.className, highlight$1.tags.propertyName] }]
51458
+ }),
51459
+ []
51460
+ );
51461
+ };
51462
+ function DataDetailsPanelCodeSection({
51463
+ codeStr = "",
51464
+ title,
51465
+ icon,
51466
+ simplified = false,
51467
+ className
51468
+ }) {
51469
+ const theme = useCodemirrorTheme();
51470
+ const [showAsMultilineText, setShowAsMultilineText] = React.useState(false);
51471
+ const hasMultilineText = React.useMemo(() => {
51472
+ try {
51473
+ const parsed = JSON.parse(codeStr);
51474
+ return containsInnerNewline(parsed || "");
51475
+ } catch {
51476
+ return false;
51477
+ }
51478
+ }, [codeStr]);
51479
+ const finalCodeStr = showAsMultilineText ? codeStr?.replace(/\\n/g, "\n") : codeStr;
51480
+ const usePlainTextView = simplified || showAsMultilineText;
51481
+ if (!codeStr || codeStr === "null") return null;
51482
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-2", className), children: [
51483
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
51484
+ /* @__PURE__ */ jsxRuntime.jsxs(
51485
+ "div",
51486
+ {
51487
+ className: cn(
51488
+ "flex items-center gap-1.5 text-ui-xs uppercase tracking-widest text-neutral2",
51489
+ "[&>svg]:size-3.5"
51490
+ ),
51491
+ children: [
51492
+ icon,
51493
+ title
51494
+ ]
51495
+ }
51496
+ ),
51497
+ /* @__PURE__ */ jsxRuntime.jsxs(ButtonsGroup, { children: [
51498
+ /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: codeStr || "No content", size: "sm" }),
51499
+ hasMultilineText && /* @__PURE__ */ jsxRuntime.jsx(
51500
+ Button,
51501
+ {
51502
+ size: "sm",
51503
+ "aria-label": showAsMultilineText ? "Show escaped newlines" : "Show multiline text",
51504
+ onClick: () => setShowAsMultilineText((v) => !v),
51505
+ children: showAsMultilineText ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignLeftIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignJustifyIcon, {})
51506
+ }
51507
+ )
51508
+ ] })
51509
+ ] }),
51510
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-black/20 p-3 overflow-hidden rounded-lg border border-white/10 text-neutral4 text-ui-sm break-all max-h-[30vh] overflow-y-auto", children: usePlainTextView ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-neutral4 font-mono break-all", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-wrap", children: finalCodeStr }) }) : /* @__PURE__ */ jsxRuntime.jsx(
51511
+ CodeMirror,
51512
+ {
51513
+ extensions: [langJson.json(), CodeMirror.EditorView.lineWrapping],
51514
+ theme,
51515
+ value: codeStr,
51516
+ editable: false
51517
+ }
51518
+ ) })
51519
+ ] });
51520
+ }
51521
+ function containsInnerNewline(obj) {
51522
+ if (typeof obj === "string") {
51523
+ const idx = obj.indexOf("\n");
51524
+ return idx !== -1 && idx !== obj.length - 1;
51525
+ } else if (Array.isArray(obj)) {
51526
+ return obj.some((item) => containsInnerNewline(item));
51527
+ } else if (obj && typeof obj === "object") {
51528
+ return Object.values(obj).some((value) => containsInnerNewline(value));
51529
+ }
51530
+ return false;
51531
+ }
51532
+
51533
+ function DataDetailsPanelContent({ children }) {
51534
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 p-4 overflow-y-auto", children });
51535
+ }
51536
+
51537
+ function DataDetailsPanelHeader({ className, children }) {
51538
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center justify-between gap-2 border-b border-border1 mx-4 py-3", className), children });
51539
+ }
51540
+
51541
+ function DataDetailsPanelHeading({ className, children }) {
51542
+ return /* @__PURE__ */ jsxRuntime.jsx("h3", { className: cn("flex gap-2 text-ui-md text-neutral3 [&>b]:text-neutral2 [&>b]:font-normal", className), children });
51543
+ }
51544
+
51545
+ function Root({ className, children }) {
51546
+ return /* @__PURE__ */ jsxRuntime.jsx("dl", { className: cn("grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5", className), children });
51547
+ }
51548
+ function Key({ className, children }) {
51549
+ return /* @__PURE__ */ jsxRuntime.jsx("dt", { className: cn("text-ui-smd text-neutral2 shrink-0 py-0.5", className), children });
51550
+ }
51551
+ function Value({ className, children }) {
51552
+ return /* @__PURE__ */ jsxRuntime.jsx("dd", { className: cn("text-ui-smd text-neutral3 truncate min-w-0 py-0.5", className), children });
51553
+ }
51554
+ function Header$1({ className, children }) {
51555
+ return /* @__PURE__ */ jsxRuntime.jsx("dt", { className: cn("col-span-2 text-ui-sm uppercase tracking-widest text-neutral2 py-3", className), children });
51556
+ }
51557
+ const DataDetailsPanelKeyValueList = Object.assign(Root, {
51558
+ Key,
51559
+ Value,
51560
+ Header: Header$1
51561
+ });
51562
+
51563
+ function DataDetailsPanelLoadingData({ children }) {
51564
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-2 px-4 py-6 text-ui-sm text-neutral3", children: [
51565
+ /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}),
51566
+ " ",
51567
+ children ?? "Loading..."
51568
+ ] });
51569
+ }
51570
+
51571
+ function DataDetailsPanelNoData({ children }) {
51572
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-4 py-6 text-ui-sm text-neutral2", children: children ?? "No data found." });
51573
+ }
51574
+
51575
+ const DataDetailsPanel = Object.assign(DataDetailsPanel$1, {
51576
+ Header: DataDetailsPanelHeader,
51577
+ Heading: DataDetailsPanelHeading,
51578
+ CloseButton: DataDetailsPanelCloseButton,
51579
+ LoadingData: DataDetailsPanelLoadingData,
51580
+ NoData: DataDetailsPanelNoData,
51581
+ Content: DataDetailsPanelContent,
51582
+ KeyValueList: DataDetailsPanelKeyValueList,
51583
+ CodeSection: DataDetailsPanelCodeSection
51584
+ });
51585
+
51586
+ const KV$1 = DataDetailsPanel.KeyValueList;
51587
+ function toDate$1(value) {
51588
+ return value instanceof Date ? value : new Date(value);
51589
+ }
51590
+ function LogDetails({
51591
+ log,
51592
+ onClose,
51593
+ onTraceClick,
51594
+ onSpanClick,
51595
+ onPrevious,
51596
+ onNext,
51597
+ collapsed: controlledCollapsed,
51598
+ onCollapsedChange
51599
+ }) {
51600
+ const [internalCollapsed, setInternalCollapsed] = React.useState(false);
51601
+ const collapsed = controlledCollapsed ?? internalCollapsed;
51602
+ const setCollapsed = onCollapsedChange ?? setInternalCollapsed;
51603
+ const date = toDate$1(log.timestamp);
51604
+ return /* @__PURE__ */ jsxRuntime.jsxs(DataDetailsPanel, { collapsed, children: [
51605
+ /* @__PURE__ */ jsxRuntime.jsxs(DataDetailsPanel.Header, { children: [
51606
+ /* @__PURE__ */ jsxRuntime.jsxs(DataDetailsPanel.Heading, { children: [
51607
+ "Log ",
51608
+ /* @__PURE__ */ jsxRuntime.jsx("b", { children: dateFns.format(date, "MMM dd, HH:mm:ss.SSS") })
51609
+ ] }),
51610
+ /* @__PURE__ */ jsxRuntime.jsxs(ButtonsGroup, { className: "ml-auto shrink-0", children: [
51611
+ onCollapsedChange && /* @__PURE__ */ jsxRuntime.jsx(
51612
+ ButtonWithTooltip,
51613
+ {
51614
+ size: "md",
51615
+ tooltipContent: collapsed ? "Expand panel" : "Collapse panel",
51616
+ onClick: () => setCollapsed(!collapsed),
51617
+ children: collapsed ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDownIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsDownUpIcon, {})
51618
+ }
51619
+ ),
51620
+ /* @__PURE__ */ jsxRuntime.jsxs(ButtonsGroup, { spacing: "close", children: [
51621
+ /* @__PURE__ */ jsxRuntime.jsx(ButtonWithTooltip, { size: "md", tooltipContent: "Previous log", onClick: onPrevious, disabled: !onPrevious, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpIcon, {}) }),
51622
+ /* @__PURE__ */ jsxRuntime.jsx(ButtonWithTooltip, { size: "md", tooltipContent: "Next log", onClick: onNext, disabled: !onNext, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDownIcon, {}) })
51623
+ ] }),
51624
+ /* @__PURE__ */ jsxRuntime.jsx(DataDetailsPanel.CloseButton, { onClick: onClose })
51625
+ ] })
51626
+ ] }),
51627
+ !collapsed && /* @__PURE__ */ jsxRuntime.jsxs(DataDetailsPanel.Content, { children: [
51628
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-ui-md text-neutral4 font-mono wrap-break-word whitespace-pre-wrap", children: log.message }),
51629
+ (log.traceId || log.spanId) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("grid gap-2 my-8", "[&>button]:justify-between [&>button]:overflow-hidden"), children: [
51630
+ log.traceId && /* @__PURE__ */ jsxRuntime.jsxs(ButtonsGroup, { spacing: "close", className: "min-w-0 w-full", children: [
51631
+ /* @__PURE__ */ jsxRuntime.jsxs(
51632
+ Button,
51633
+ {
51634
+ size: "md",
51635
+ className: "min-w-0 flex-1 overflow-hidden",
51636
+ onClick: () => onTraceClick?.(log.traceId),
51637
+ children: [
51638
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRightIcon, {}),
51639
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Trace" }),
51640
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: " ml-auto text-ui-sm text-neutral2 min-w-0 truncate", children: [
51641
+ "# ",
51642
+ log.traceId
51643
+ ] })
51644
+ ]
51645
+ }
51646
+ ),
51647
+ /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: log.traceId, size: "md", tooltip: "Copy Trace ID to clipboard" })
51648
+ ] }),
51649
+ log.spanId && /* @__PURE__ */ jsxRuntime.jsxs(ButtonsGroup, { spacing: "close", className: "min-w-0 w-full", children: [
51650
+ /* @__PURE__ */ jsxRuntime.jsxs(
51651
+ Button,
51652
+ {
51653
+ size: "md",
51654
+ className: "min-w-0 flex-1 overflow-hidden",
51655
+ disabled: !log.traceId || !onSpanClick,
51656
+ onClick: () => log.traceId && onSpanClick?.(log.traceId, log.spanId),
51657
+ children: [
51658
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRightIcon, {}),
51659
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Span" }),
51660
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: " ml-auto text-ui-sm text-neutral2 min-w-0 truncate", children: [
51661
+ "# ",
51662
+ log.spanId
51663
+ ] })
51664
+ ]
51665
+ }
51666
+ ),
51667
+ /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { content: log.spanId, size: "md", tooltip: "Copy Span ID to clipboard" })
51668
+ ] })
51669
+ ] }),
51670
+ /* @__PURE__ */ jsxRuntime.jsxs(KV$1, { className: "mb-6", children: [
51671
+ log.entityType && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
51672
+ /* @__PURE__ */ jsxRuntime.jsx(KV$1.Key, { children: "Entity Type" }),
51673
+ /* @__PURE__ */ jsxRuntime.jsx(KV$1.Value, { children: log.entityType })
51674
+ ] }),
51675
+ log.entityName && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
51676
+ /* @__PURE__ */ jsxRuntime.jsx(KV$1.Key, { children: "Entity Name" }),
51677
+ /* @__PURE__ */ jsxRuntime.jsx(KV$1.Value, { children: log.entityName })
51678
+ ] }),
51679
+ log.serviceName && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
51680
+ /* @__PURE__ */ jsxRuntime.jsx(KV$1.Key, { children: "Service" }),
51681
+ /* @__PURE__ */ jsxRuntime.jsx(KV$1.Value, { children: log.serviceName })
51682
+ ] }),
51683
+ log.environment && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
51684
+ /* @__PURE__ */ jsxRuntime.jsx(KV$1.Key, { children: "Environment" }),
51685
+ /* @__PURE__ */ jsxRuntime.jsx(KV$1.Value, { children: log.environment })
51686
+ ] }),
51687
+ log.source && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
51688
+ /* @__PURE__ */ jsxRuntime.jsx(KV$1.Key, { children: "Source" }),
51689
+ /* @__PURE__ */ jsxRuntime.jsx(KV$1.Value, { children: log.source })
51690
+ ] }),
51691
+ log.metadata && Object.keys(log.metadata).length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
51692
+ /* @__PURE__ */ jsxRuntime.jsx(KV$1.Header, { children: "Metadata" }),
51693
+ Object.entries(log.metadata).map(([key, value]) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
51694
+ /* @__PURE__ */ jsxRuntime.jsx(KV$1.Key, { children: key }),
51695
+ /* @__PURE__ */ jsxRuntime.jsx(KV$1.Value, { children: String(value) })
51696
+ ] }, key))
51697
+ ] })
51698
+ ] }),
51699
+ log.data && Object.keys(log.data).length > 0 && /* @__PURE__ */ jsxRuntime.jsx(DataDetailsPanel.CodeSection, { title: "Data", codeStr: JSON.stringify(log.data, null, 2), className: "mt-6" })
51700
+ ] })
51701
+ ] });
51702
+ }
51703
+
51704
+ function useTraceSpans(traceId) {
51705
+ const client = react.useMastraClient();
51706
+ return reactQuery.useQuery({
51707
+ queryKey: ["trace-spans", traceId],
51708
+ queryFn: async () => {
51709
+ if (!traceId) {
51710
+ throw new Error("Trace ID is required");
51711
+ }
51712
+ const res = await client.getTrace(traceId);
51713
+ return res;
51714
+ },
51715
+ enabled: !!traceId
51716
+ });
51717
+ }
51718
+
51719
+ const formatHierarchicalSpans = (spans) => {
51720
+ if (!spans || spans.length === 0) {
51721
+ return [];
51722
+ }
51723
+ const overallEndDate = spans.reduce(
51724
+ (latest, span) => {
51725
+ const endDate = span?.endedAt ? new Date(span.endedAt) : void 0;
51726
+ return endDate && (!latest || endDate > latest) ? endDate : latest;
51727
+ },
51728
+ null
51729
+ );
51730
+ const spanMap = /* @__PURE__ */ new Map();
51731
+ const rootSpans = [];
51732
+ spans.forEach((spanRecord) => {
51733
+ const startDate = new Date(spanRecord.startedAt);
51734
+ const endDate = spanRecord.endedAt ? new Date(spanRecord.endedAt) : void 0;
51735
+ const uiSpan = {
51736
+ id: spanRecord.spanId,
51737
+ name: spanRecord.name,
51738
+ type: spanRecord.spanType,
51739
+ latency: endDate ? endDate.getTime() - startDate.getTime() : 0,
51740
+ startTime: startDate.toISOString(),
51741
+ endTime: endDate ? endDate.toISOString() : void 0,
51742
+ spans: [],
51743
+ parentSpanId: spanRecord.parentSpanId
51744
+ };
51745
+ spanMap.set(spanRecord.spanId, uiSpan);
51746
+ });
51747
+ spans.forEach((spanRecord) => {
51748
+ const uiSpan = spanMap.get(spanRecord.spanId);
51749
+ if (spanRecord?.parentSpanId == null) {
51750
+ if (overallEndDate && uiSpan.endTime && overallEndDate > new Date(uiSpan.endTime)) {
51751
+ uiSpan.endTime = overallEndDate.toISOString();
51752
+ const overallEndTime = new Date(overallEndDate).getTime();
51753
+ const spanStartTime = new Date(uiSpan.startTime).getTime();
51754
+ uiSpan.latency = overallEndTime - spanStartTime;
51755
+ }
51756
+ rootSpans.push(uiSpan);
51757
+ } else {
51758
+ const parent = spanMap.get(spanRecord.parentSpanId);
51759
+ if (parent) {
51760
+ parent.spans.push(uiSpan);
51761
+ } else {
51762
+ rootSpans.push(uiSpan);
51763
+ }
51764
+ }
51765
+ });
51766
+ const sortSpansByStartTime = (spans2) => {
51767
+ return spans2.sort((a, b) => new Date(a.startTime).getTime() - new Date(b.startTime).getTime());
51768
+ };
51769
+ const sortedRootSpans = sortSpansByStartTime(rootSpans);
51770
+ const sortNestedSpans = (spans2) => {
51771
+ spans2.forEach((span) => {
51772
+ if (span.spans && span.spans.length > 0) {
51773
+ span.spans = sortSpansByStartTime(span.spans);
51774
+ sortNestedSpans(span.spans);
51775
+ }
51776
+ });
51777
+ };
51778
+ sortNestedSpans(sortedRootSpans);
51779
+ return sortedRootSpans;
51780
+ };
51781
+
51782
+ function getSpanDescendantIds(span) {
51783
+ if (!span.spans || span.spans.length === 0) {
51784
+ return [];
51785
+ }
51786
+ const descendantIds = [];
51787
+ span.spans.forEach((childSpan) => {
51788
+ descendantIds.push(childSpan.id);
51789
+ descendantIds.push(...getSpanDescendantIds(childSpan));
51790
+ });
51791
+ return descendantIds;
51792
+ }
51793
+ function getAllSpanIds(spans) {
51794
+ const ids = [];
51795
+ for (const span of spans) {
51796
+ ids.push(span.id);
51797
+ ids.push(...getSpanDescendantIds(span));
51798
+ }
51799
+ return ids;
51800
+ }
51801
+
51802
+ function getSpanTypeUi(type) {
51803
+ const typePrefix = type?.toLowerCase().split("_")[0];
51804
+ const spanTypeToUiElements = {
51805
+ agent: {
51806
+ icon: /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, {}),
51807
+ color: "oklch(0.75 0.15 250)",
51808
+ label: "Agent",
51809
+ bgColor: "oklch(0.75 0.15 250 / 0.1)",
51810
+ typePrefix: "agent"
51811
+ },
51812
+ workflow: {
51813
+ icon: /* @__PURE__ */ jsxRuntime.jsx(WorkflowIcon, {}),
51814
+ color: "oklch(0.75 0.15 200)",
51815
+ label: "Workflow",
51816
+ bgColor: "oklch(0.75 0.15 200 / 0.1)",
51817
+ typePrefix: "workflow"
51818
+ },
51819
+ model: {
51820
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BrainIcon, {}),
51821
+ color: "oklch(0.75 0.15 320)",
51822
+ label: "Model",
51823
+ bgColor: "oklch(0.75 0.15 320 / 0.1)",
51824
+ typePrefix: "model"
51825
+ },
51826
+ mcp: {
51827
+ icon: /* @__PURE__ */ jsxRuntime.jsx(McpServerIcon, {}),
51828
+ color: "oklch(0.75 0.15 160)",
51829
+ label: "MCP",
51830
+ bgColor: "oklch(0.75 0.15 160 / 0.1)",
51831
+ typePrefix: "mcp"
51832
+ },
51833
+ tool: {
51834
+ icon: /* @__PURE__ */ jsxRuntime.jsx(ToolsIcon, {}),
51835
+ color: "oklch(0.75 0.15 100)",
51836
+ label: "Tool",
51837
+ bgColor: "oklch(0.75 0.15 100 / 0.1)",
51838
+ typePrefix: "tool"
51839
+ }
51840
+ };
51841
+ if (typePrefix in spanTypeToUiElements) {
51842
+ return spanTypeToUiElements[typePrefix];
51843
+ }
51844
+ return {
51845
+ typePrefix: "other"
51846
+ };
51847
+ }
51848
+
51849
+ function TimelineExpandCol({
51850
+ isSelected,
51851
+ isFaded,
51852
+ isExpanded,
51853
+ toggleChildren,
51854
+ expandAllDescendants,
51855
+ totalDescendants = 0,
51856
+ allDescendantsExpanded,
51857
+ numOfChildren
51858
+ }) {
51859
+ return /* @__PURE__ */ jsxRuntime.jsx(
51860
+ "div",
51861
+ {
51862
+ className: cn("flex items-center justify-end h-full px-1.5", {
51863
+ "opacity-30 [&:hover]:opacity-60": isFaded,
51864
+ "bg-surface4": isSelected
51865
+ }),
51866
+ children: numOfChildren && numOfChildren > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1", children: [
51867
+ /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton, { onClick: () => toggleChildren?.(), children: [
51868
+ allDescendantsExpanded ? totalDescendants : numOfChildren,
51869
+ " ",
51870
+ isExpanded ? allDescendantsExpanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, {})
51871
+ ] }),
51872
+ totalDescendants > numOfChildren && !allDescendantsExpanded && /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton, { onClick: () => expandAllDescendants?.(), children: [
51873
+ totalDescendants,
51874
+ " ",
51875
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsDownIcon, {})
51876
+ ] })
51877
+ ] }) : null
51878
+ }
51879
+ );
51880
+ }
51881
+ function ExpandButton({ onClick, children, className }) {
51882
+ return /* @__PURE__ */ jsxRuntime.jsx("button", { onClick, className: cn("h-full", className), children: /* @__PURE__ */ jsxRuntime.jsx(
51883
+ "div",
51884
+ {
51885
+ className: cn(
51886
+ "flex items-center gap-[0.1rem] text-ui-xs text-neutral5 border border-border1 pl-1.5 pr-0.5 rounded-md transition-all",
51887
+ "hover:text-yellow-500",
51888
+ "[&>svg]:shrink-0 [&>svg]:opacity-80 [&>svg]:w-[0.85rem] [&>svg]:h-[0.85rem] [&>svg]:transition-all"
51889
+ ),
51890
+ children
51891
+ }
51892
+ ) });
51893
+ }
51894
+
51895
+ function TimelineStructureSign({ isLastChild }) {
51896
+ return /* @__PURE__ */ jsxRuntime.jsx(
51897
+ "div",
51898
+ {
51899
+ className: cn(
51900
+ "w-[0.5rem] h-[1.8rem] relative opacity-100 shrink-0",
51901
+ 'after:content-[""] after:absolute after:left-[-1px] after:top-0 after:bottom-0 after:w-[0px] after:border-l-[1px] after:border-neutral3 after:border-dashed ',
51902
+ 'before:content-[""] before:absolute before:left-0 before:top-[50%] before:w-full before:h-[0px] before:border-b-[1px] before:border-neutral3 before:border-dashed',
51903
+ {
51904
+ "after:bottom-[50%]": isLastChild
51905
+ }
51906
+ )
51907
+ }
51908
+ );
51909
+ }
51910
+
51911
+ function TimelineNameCol({
51912
+ span,
51913
+ spanUI: _spanUI,
51914
+ isFaded,
51915
+ depth = 0,
51916
+ onSpanClick,
51917
+ selectedSpanId,
51918
+ isLastChild,
51919
+ hasChildren: _hasChildren,
51920
+ isRootSpan,
51921
+ isExpanded: _isExpanded
51922
+ }) {
51923
+ return /* @__PURE__ */ jsxRuntime.jsxs(
51924
+ "div",
51925
+ {
51926
+ "aria-label": `View details for span ${span.name}`,
51927
+ className: cn("rounded-md transition-colors flex opacity-80 min-h-8 items-center rounded-l-lg", {
51928
+ "opacity-30 [&:hover]:opacity-60": isFaded,
51929
+ "bg-surface4": selectedSpanId === span.id
51930
+ }),
51931
+ style: { paddingLeft: `${depth * 1}rem` },
51932
+ children: [
51933
+ !isRootSpan && /* @__PURE__ */ jsxRuntime.jsx(TimelineStructureSign, { isLastChild }),
51934
+ /* @__PURE__ */ jsxRuntime.jsx(
51935
+ "button",
51936
+ {
51937
+ onClick: () => onSpanClick?.(span.id),
51938
+ className: cn(
51939
+ "text-ui-sm flex items-center text-left gap-1.5 text-neutral6 w-full min-w-0 rounded-md h-full px-2 py-1 transition-colors",
51940
+ "[&>svg]:transition-all [&>svg]:shrink-0 [&>svg]:opacity-0 [&>svg]:w-[1em] [&>svg]:h-[1em] [&>svg]:ml-auto",
51941
+ "hover:bg-surface4 [&:hover>svg]:opacity-60"
51942
+ ),
51943
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate", children: span.name })
51944
+ }
51945
+ )
51946
+ ]
51947
+ }
51948
+ );
51949
+ }
51950
+
51951
+ function TimelineTimingCol({
51952
+ span,
51953
+ selectedSpanId,
51954
+ isFaded,
51955
+ overallLatency,
51956
+ overallStartTime,
51957
+ color
51958
+ }) {
51959
+ const percentageSpanLatency = overallLatency ? Math.ceil(span.latency / overallLatency * 100) : 0;
51960
+ const overallStartTimeDate = overallStartTime ? new Date(overallStartTime) : null;
51961
+ const spanStartTimeDate = span.startTime ? new Date(span.startTime) : null;
51962
+ const spanStartTimeShift = spanStartTimeDate && overallStartTimeDate ? spanStartTimeDate.getTime() - overallStartTimeDate.getTime() : 0;
51963
+ const percentageSpanStartTime = overallLatency && Math.floor(spanStartTimeShift / overallLatency * 100);
51964
+ return /* @__PURE__ */ jsxRuntime.jsxs(HoverCard__namespace.Root, { openDelay: 250, children: [
51965
+ /* @__PURE__ */ jsxRuntime.jsxs(
51966
+ HoverCard__namespace.Trigger,
51967
+ {
51968
+ className: cn(
51969
+ "h-8 min-w-[8rem] p-1 grid grid-cols-[1fr_auto] gap-2 items-center cursor-help pr-2 rounded-r-md",
51970
+ "[&:hover>div]:bg-surface5",
51971
+ {
51972
+ "opacity-30 [&:hover]:opacity-60": isFaded,
51973
+ "bg-surface4": selectedSpanId === span.id
51974
+ }
51975
+ ),
51976
+ children: [
51977
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full p-1.5 rounded-md bg-surface4 transition-colors duration-1000"), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full h-1.5 rounded-sm", children: /* @__PURE__ */ jsxRuntime.jsx(
51978
+ "div",
51979
+ {
51980
+ className: cn("bg-neutral1 absolute rounded-sm h-1.5 top-0"),
51981
+ style: {
51982
+ width: percentageSpanLatency ? `${percentageSpanLatency}%` : "2px",
51983
+ left: `${percentageSpanStartTime || 0}%`,
51984
+ backgroundColor: color
51985
+ }
51986
+ }
51987
+ ) }) }),
51988
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex justify-end text-neutral3 text-ui-xs"), children: [
51989
+ (span.latency / 1e3).toFixed(3),
51990
+ " s"
51991
+ ] })
51992
+ ]
51993
+ }
51994
+ ),
51995
+ /* @__PURE__ */ jsxRuntime.jsx(HoverCard__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
51996
+ HoverCard__namespace.Content,
51997
+ {
51998
+ className: "z-50 w-auto max-w-[25rem] rounded-md bg-surface4 p-2 px-4 pr-6 text-ui-sm text-neutral5 text-center border border-border1",
51999
+ sideOffset: 5,
52000
+ side: "top",
52001
+ children: [
52002
+ /* @__PURE__ */ jsxRuntime.jsxs(
52003
+ "div",
52004
+ {
52005
+ className: cn(
52006
+ "text-ui-md flex items-center gap-2 mb-4",
52007
+ "[&>svg]:w-[1.25em] [&>svg]:h-[1.25em] [&>svg]:shrink-0 [&>svg]:opacity-50"
52008
+ ),
52009
+ children: [
52010
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TimerIcon, {}),
52011
+ " Span Timing"
52012
+ ]
52013
+ }
52014
+ ),
52015
+ /* @__PURE__ */ jsxRuntime.jsx(
52016
+ KeyValueList,
52017
+ {
52018
+ className: " [&>dd]:text-ui-md [&>dt]:text-ui-md [&>dt]:min-h-0 [&>dd]:min-h-0",
52019
+ data: [
52020
+ {
52021
+ key: "Latency",
52022
+ label: "Latency",
52023
+ value: `${span.latency} ms`,
52024
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsLeftRightIcon, {})
52025
+ },
52026
+ {
52027
+ key: "startTime",
52028
+ label: "Started at",
52029
+ value: span.startTime ? format.format(new Date(span.startTime), "hh:mm:ss:SSS a") : "-",
52030
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronFirstIcon, {})
52031
+ },
52032
+ {
52033
+ key: "endTime",
52034
+ label: "Ended at",
52035
+ value: span.endTime ? format.format(new Date(span.endTime), "hh:mm:ss:SSS a") : "-",
52036
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLastIcon, {})
52037
+ },
52038
+ {
52039
+ key: "startShift",
52040
+ label: "Start Shift",
52041
+ value: `${spanStartTimeShift}ms`,
52042
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsRightIcon, {})
52043
+ }
52044
+ ]
52045
+ }
52046
+ ),
52047
+ /* @__PURE__ */ jsxRuntime.jsx(HoverCard__namespace.Arrow, { className: "fill-surface5" })
52048
+ ]
52049
+ }
52050
+ ) })
52051
+ ] });
52052
+ }
52053
+
52054
+ function TraceTimelineSpan({
52055
+ span,
52056
+ depth = 0,
52057
+ onSpanClick,
52058
+ selectedSpanId,
52059
+ isLastChild,
52060
+ overallLatency,
52061
+ overallStartTime,
52062
+ fadedTypes,
52063
+ searchPhrase,
52064
+ featuredSpanIds,
52065
+ expandedSpanIds,
52066
+ setExpandedSpanIds
52067
+ }) {
52068
+ const hasChildren = span.spans && span.spans.length > 0;
52069
+ const numOfChildren = span.spans ? span.spans.length : 0;
52070
+ const allDescendantIds = getSpanDescendantIds(span);
52071
+ const totalDescendants = allDescendantIds.length;
52072
+ const isRootSpan = depth === 0;
52073
+ const spanUI = getSpanTypeUi(span?.type);
52074
+ const isExpanded = expandedSpanIds ? expandedSpanIds.includes(span.id) : false;
52075
+ const isFadedBySearch = featuredSpanIds && featuredSpanIds.length > 0 ? !featuredSpanIds.includes(span.id) : false;
52076
+ const isFadedByType = fadedTypes && fadedTypes.length > 0 ? fadedTypes.includes(spanUI?.typePrefix || "") : false;
52077
+ const isFaded = isFadedByType || isFadedBySearch;
52078
+ React.useEffect(() => {
52079
+ if (!featuredSpanIds || allDescendantIds.length === 0) return;
52080
+ if (isExpanded) return;
52081
+ const hasFeaturedDescendant = allDescendantIds.some((id) => featuredSpanIds.includes(id));
52082
+ if (hasFeaturedDescendant && setExpandedSpanIds) {
52083
+ setExpandedSpanIds((prev) => prev ? [...prev, span.id] : [span.id]);
52084
+ }
52085
+ }, [featuredSpanIds, allDescendantIds]);
52086
+ const toggleChildren = () => {
52087
+ if (!setExpandedSpanIds) return;
52088
+ setExpandedSpanIds((prev) => {
52089
+ if (!prev) return prev;
52090
+ const idsToRemove = /* @__PURE__ */ new Set([span.id, ...allDescendantIds]);
52091
+ return isExpanded ? prev.filter((id) => !idsToRemove.has(id)) : [...prev, span.id];
52092
+ });
52093
+ };
52094
+ const expandAllDescendants = () => {
52095
+ if (!setExpandedSpanIds) return;
52096
+ setExpandedSpanIds((prev) => {
52097
+ if (!prev) return prev;
52098
+ return Array.from(/* @__PURE__ */ new Set([...prev, span.id, ...allDescendantIds]));
52099
+ });
52100
+ };
52101
+ const allDescendantsExpanded = allDescendantIds.every((id) => expandedSpanIds?.includes(id));
52102
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
52103
+ /* @__PURE__ */ jsxRuntime.jsx(
52104
+ TimelineNameCol,
52105
+ {
52106
+ span,
52107
+ spanUI,
52108
+ isFaded,
52109
+ depth,
52110
+ onSpanClick,
52111
+ selectedSpanId,
52112
+ isLastChild,
52113
+ hasChildren,
52114
+ isRootSpan,
52115
+ isExpanded
52116
+ }
52117
+ ),
52118
+ /* @__PURE__ */ jsxRuntime.jsx(
52119
+ TimelineExpandCol,
52120
+ {
52121
+ isSelected: selectedSpanId === span.id,
52122
+ isFaded,
52123
+ isExpanded,
52124
+ toggleChildren,
52125
+ expandAllDescendants,
52126
+ expandedSpanIds,
52127
+ totalDescendants,
52128
+ allDescendantsExpanded,
52129
+ numOfChildren
52130
+ }
52131
+ ),
52132
+ /* @__PURE__ */ jsxRuntime.jsx(
52133
+ TimelineTimingCol,
52134
+ {
52135
+ span,
52136
+ selectedSpanId,
52137
+ isFaded,
52138
+ overallLatency,
52139
+ overallStartTime,
52140
+ color: spanUI?.color
52141
+ }
52142
+ ),
52143
+ hasChildren && isExpanded && span.spans?.map((childSpan, idx, array) => {
52144
+ const isLast = idx === array.length - 1;
52145
+ return /* @__PURE__ */ jsxRuntime.jsx(
52146
+ TraceTimelineSpan,
52147
+ {
52148
+ span: childSpan,
52149
+ depth: depth + 1,
52150
+ onSpanClick,
52151
+ selectedSpanId,
52152
+ isLastChild: isLast,
52153
+ overallLatency,
52154
+ overallStartTime,
52155
+ fadedTypes,
52156
+ searchPhrase,
52157
+ expandedSpanIds,
52158
+ setExpandedSpanIds,
52159
+ featuredSpanIds
52160
+ },
52161
+ childSpan.id
52162
+ );
52163
+ })
52164
+ ] });
52165
+ }
52166
+
52167
+ function TraceTimeline({
52168
+ hierarchicalSpans = [],
52169
+ onSpanClick,
52170
+ selectedSpanId,
52171
+ isLoading,
52172
+ fadedTypes,
52173
+ expandedSpanIds,
52174
+ setExpandedSpanIds,
52175
+ featuredSpanIds
52176
+ }) {
52177
+ const overallLatency = hierarchicalSpans?.[0]?.latency || 0;
52178
+ const overallStartTime = hierarchicalSpans?.[0]?.startTime || "";
52179
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsxs(
52180
+ "div",
52181
+ {
52182
+ className: cn(
52183
+ "flex items-center text-ui-sm gap-3 bg-surface3/50 rounded-md p-3 justify-center text-neutral3",
52184
+ "[&_svg]:w-[1.25em] [&_svg]:h-[1.25em] [&_svg]:opacity-50"
52185
+ ),
52186
+ children: [
52187
+ /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}),
52188
+ " Loading Trace Timeline ..."
52189
+ ]
52190
+ }
52191
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-[minmax(0,1fr)_auto_auto] items-start content-start gap-y-px overflow-hidden py-1", children: hierarchicalSpans?.map((span) => /* @__PURE__ */ jsxRuntime.jsx(
52192
+ TraceTimelineSpan,
52193
+ {
52194
+ span,
52195
+ onSpanClick,
52196
+ selectedSpanId,
52197
+ overallLatency,
52198
+ overallStartTime,
52199
+ fadedTypes,
52200
+ featuredSpanIds,
52201
+ expandedSpanIds,
52202
+ setExpandedSpanIds
52203
+ },
52204
+ span.id
52205
+ )) }) });
52206
+ }
52207
+
52208
+ function TraceDetails({ traceId, onClose, onSpanSelect, initialSpanId }) {
52209
+ const { data: traceData, isLoading } = useTraceSpans(traceId);
52210
+ const [selectedSpanId, setSelectedSpanId] = React.useState(initialSpanId ?? void 0);
52211
+ React.useEffect(() => {
52212
+ if (initialSpanId && traceData?.spans) {
52213
+ const span = traceData.spans.find((s) => s.spanId === initialSpanId);
52214
+ if (span) {
52215
+ setSelectedSpanId(initialSpanId);
52216
+ onSpanSelect?.(span);
52217
+ return;
52218
+ }
52219
+ }
52220
+ setSelectedSpanId(void 0);
52221
+ onSpanSelect?.(void 0);
52222
+ }, [initialSpanId, traceData?.spans]);
52223
+ const hierarchicalSpans = React.useMemo(() => formatHierarchicalSpans(traceData?.spans ?? []), [traceData?.spans]);
52224
+ const [expandedSpanIds, setExpandedSpanIds] = React.useState([]);
52225
+ React.useEffect(() => {
52226
+ if (hierarchicalSpans.length > 0) {
52227
+ setExpandedSpanIds(getAllSpanIds(hierarchicalSpans));
52228
+ }
52229
+ }, [hierarchicalSpans]);
52230
+ const handleSpanClick = (id) => {
52231
+ const newId = selectedSpanId === id ? void 0 : id;
52232
+ setSelectedSpanId(newId);
52233
+ const span = newId ? traceData?.spans?.find((s) => s.spanId === newId) : void 0;
52234
+ onSpanSelect?.(span);
52235
+ };
52236
+ return /* @__PURE__ */ jsxRuntime.jsxs(DataDetailsPanel, { children: [
52237
+ /* @__PURE__ */ jsxRuntime.jsxs(DataDetailsPanel.Header, { children: [
52238
+ /* @__PURE__ */ jsxRuntime.jsxs(DataDetailsPanel.Heading, { children: [
52239
+ "Trace ",
52240
+ /* @__PURE__ */ jsxRuntime.jsxs("b", { children: [
52241
+ "# ",
52242
+ traceId
52243
+ ] })
52244
+ ] }),
52245
+ /* @__PURE__ */ jsxRuntime.jsx(DataDetailsPanel.CloseButton, { onClick: onClose })
52246
+ ] }),
52247
+ isLoading ? /* @__PURE__ */ jsxRuntime.jsx(DataDetailsPanel.LoadingData, { children: "Loading trace..." }) : hierarchicalSpans.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(DataDetailsPanel.NoData, { children: "No spans found for this trace." }) : /* @__PURE__ */ jsxRuntime.jsx(DataDetailsPanel.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
52248
+ TraceTimeline,
52249
+ {
52250
+ hierarchicalSpans,
52251
+ onSpanClick: handleSpanClick,
52252
+ selectedSpanId,
52253
+ expandedSpanIds,
52254
+ setExpandedSpanIds
52255
+ }
52256
+ ) })
52257
+ ] });
52258
+ }
52259
+
52260
+ const NoLogsInfo = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
52261
+ EmptyState$1,
52262
+ {
52263
+ iconSlot: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleSlashIcon, {}),
52264
+ titleSlot: "No logs yet",
52265
+ descriptionSlot: "Logs will appear here once agents, workflows, or tools are executed."
52266
+ }
52267
+ ) });
52268
+
52269
+ const KV = DataDetailsPanel.KeyValueList;
52270
+ function SpanDetails({ span, onClose }) {
52271
+ const durationMs = span.startedAt && span.endedAt ? new Date(span.endedAt).getTime() - new Date(span.startedAt).getTime() : null;
52272
+ return /* @__PURE__ */ jsxRuntime.jsxs(DataDetailsPanel, { children: [
52273
+ /* @__PURE__ */ jsxRuntime.jsxs(DataDetailsPanel.Header, { children: [
52274
+ /* @__PURE__ */ jsxRuntime.jsxs(DataDetailsPanel.Heading, { children: [
52275
+ "Span ",
52276
+ /* @__PURE__ */ jsxRuntime.jsxs("b", { children: [
52277
+ "# ",
52278
+ span.spanId
52279
+ ] })
52280
+ ] }),
52281
+ /* @__PURE__ */ jsxRuntime.jsx(DataDetailsPanel.CloseButton, { onClick: onClose })
52282
+ ] }),
52283
+ /* @__PURE__ */ jsxRuntime.jsxs(DataDetailsPanel.Content, { children: [
52284
+ /* @__PURE__ */ jsxRuntime.jsxs(KV, { children: [
52285
+ span.spanType && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
52286
+ /* @__PURE__ */ jsxRuntime.jsx(KV.Key, { children: "Type" }),
52287
+ /* @__PURE__ */ jsxRuntime.jsx(KV.Value, { children: span.spanType })
52288
+ ] }),
52289
+ span.startedAt && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
52290
+ /* @__PURE__ */ jsxRuntime.jsx(KV.Key, { children: "Started" }),
52291
+ /* @__PURE__ */ jsxRuntime.jsx(KV.Value, { children: dateFns.format(new Date(span.startedAt), "MMM dd, HH:mm:ss.SSS") })
52292
+ ] }),
52293
+ span.endedAt && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
52294
+ /* @__PURE__ */ jsxRuntime.jsx(KV.Key, { children: "Ended" }),
52295
+ /* @__PURE__ */ jsxRuntime.jsx(KV.Value, { children: dateFns.format(new Date(span.endedAt), "MMM dd, HH:mm:ss.SSS") })
52296
+ ] }),
52297
+ durationMs != null && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
52298
+ /* @__PURE__ */ jsxRuntime.jsx(KV.Key, { children: "Duration" }),
52299
+ /* @__PURE__ */ jsxRuntime.jsx(KV.Value, { children: durationMs < 1e3 ? `${durationMs}ms` : `${(durationMs / 1e3).toFixed(2)}s` })
52300
+ ] })
52301
+ ] }),
52302
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
52303
+ /* @__PURE__ */ jsxRuntime.jsx(
52304
+ DataDetailsPanel.CodeSection,
52305
+ {
52306
+ title: "Input",
52307
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileInputIcon, {}),
52308
+ codeStr: JSON.stringify(span.input ?? null, null, 2)
52309
+ }
52310
+ ),
52311
+ /* @__PURE__ */ jsxRuntime.jsx(
52312
+ DataDetailsPanel.CodeSection,
52313
+ {
52314
+ title: "Output",
52315
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileOutputIcon, {}),
52316
+ codeStr: JSON.stringify(span.output ?? null, null, 2)
52317
+ }
52318
+ ),
52319
+ /* @__PURE__ */ jsxRuntime.jsx(
52320
+ DataDetailsPanel.CodeSection,
52321
+ {
52322
+ title: "Metadata",
52323
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BracesIcon, {}),
52324
+ codeStr: JSON.stringify(span.metadata ?? null, null, 2)
52325
+ }
52326
+ ),
52327
+ /* @__PURE__ */ jsxRuntime.jsx(
52328
+ DataDetailsPanel.CodeSection,
52329
+ {
52330
+ title: "Attributes",
52331
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BracesIcon, {}),
52332
+ codeStr: JSON.stringify(span.attributes ?? null, null, 2)
52333
+ }
52334
+ )
52335
+ ] })
52336
+ ] });
52337
+ }
52338
+
52339
+ function DataListNextPageLoading({
52340
+ isLoading,
52341
+ hasMore,
52342
+ setEndOfListElement,
52343
+ loadingText = "Loading more data...",
52344
+ noMoreDataText = "No more data to load"
52345
+ }) {
52346
+ if (!setEndOfListElement) {
52347
+ return null;
52348
+ }
52349
+ return /* @__PURE__ */ jsxRuntime.jsxs(
52350
+ "div",
52351
+ {
52352
+ ref: setEndOfListElement,
52353
+ className: "col-span-full text-ui-md text-neutral3 opacity-50 flex py-4 justify-center",
52354
+ children: [
52355
+ isLoading && loadingText,
52356
+ !hasMore && !isLoading && noMoreDataText
52357
+ ]
52358
+ }
52359
+ );
52360
+ }
52361
+
52362
+ function DataListNoMatch({ message = "Nothing matches your search", className }) {
52363
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("col-span-full flex flex-col items-center justify-center gap-2 py-12 text-neutral3", className), children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-ui-md", children: message }) });
52364
+ }
52365
+
52366
+ function DataListRoot({ children, columns, className }) {
52367
+ return /* @__PURE__ */ jsxRuntime.jsx(
52368
+ "div",
52369
+ {
52370
+ className: cn(
52371
+ "grid bg-surface2 border h-full border-border1 rounded-xl overflow-y-auto content-start",
52372
+ className
52373
+ ),
52374
+ style: { gridTemplateColumns: columns },
52375
+ children
52376
+ }
52377
+ );
52378
+ }
52379
+
52380
+ const dataListRowStyles = [
52381
+ "data-list-row grid grid-cols-subgrid gap-10 col-span-full px-5 outline-none cursor-pointer border-y border-b-border1 border-t-transparent",
52382
+ "hover:bg-surface4 hover:border-transparent focus-visible:bg-surface4 focus-visible:border-transparent focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-accent1",
52383
+ "[.data-list-row:hover+&]:border-t-transparent [.data-list-row:focus-visible+&]:border-t-transparent",
52384
+ "transition-colors duration-200 rounded-lg"
52385
+ ];
52386
+
52387
+ function DataListRow({ children, className }) {
52388
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(...dataListRowStyles, className), children });
52389
+ }
52390
+
52391
+ function DataListRowButton({ children, onClick, className }) {
52392
+ return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick, className: cn(...dataListRowStyles, "text-left", className), children });
52393
+ }
52394
+
52395
+ function DataListRowLink({ children, to, className }) {
52396
+ const { Link } = useLinkComponent();
52397
+ return /* @__PURE__ */ jsxRuntime.jsx(Link, { href: to, className: cn(...dataListRowStyles, className), children });
52398
+ }
52399
+
52400
+ function DataListTop({ children, className }) {
52401
+ return /* @__PURE__ */ jsxRuntime.jsx(
52402
+ "div",
52403
+ {
52404
+ className: cn(
52405
+ "grid grid-cols-subgrid gap-6 lg:gap-8 xl:gap-10 2xl:gap-12 3xl:gap-14 col-span-full border-b border-border1 px-4 bg-surface2 sticky top-0 z-10",
52406
+ className
52407
+ ),
52408
+ children
52409
+ }
52410
+ );
52411
+ }
52412
+
52413
+ const DataListTopCell = React.forwardRef(({ children, className }, ref) => {
52414
+ return /* @__PURE__ */ jsxRuntime.jsx(
52415
+ "span",
52416
+ {
52417
+ ref,
52418
+ className: cn(
52419
+ "h-8 py-1 flex items-center uppercase whitespace-nowrap text-neutral2 tracking-widest text-ui-xs",
52420
+ className
52421
+ ),
52422
+ children
52423
+ }
52424
+ );
52425
+ });
52426
+ function DataListTopCellWithTooltip({ children, tooltip, className }) {
52427
+ return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
52428
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(DataListTopCell, { className, children }) }),
52429
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { children: tooltip })
52430
+ ] });
52431
+ }
52432
+ const breakpointClasses = {
52433
+ sm: { show: "hidden sm:inline-flex", hide: "inline-flex sm:hidden" },
52434
+ md: { show: "hidden md:inline-flex", hide: "inline-flex md:hidden" },
52435
+ lg: { show: "hidden lg:inline-flex", hide: "inline-flex lg:hidden" },
52436
+ xl: { show: "hidden xl:inline-flex", hide: "inline-flex xl:hidden" },
52437
+ "2xl": { show: "hidden 2xl:inline-flex", hide: "inline-flex 2xl:hidden" }
52438
+ };
52439
+ function DataListTopCellSmart({
52440
+ long,
52441
+ short,
52442
+ tooltip,
52443
+ breakpoint = "2xl",
52444
+ className
52445
+ }) {
52446
+ const tooltipText = tooltip ?? (typeof long === "string" ? long : void 0);
52447
+ const bp = breakpointClasses[breakpoint];
52448
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
52449
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("items-center gap-1", bp.show), children: long }),
52450
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("items-center gap-1", bp.hide), children: short })
52451
+ ] });
52452
+ if (tooltipText) {
52453
+ return /* @__PURE__ */ jsxRuntime.jsx(
52454
+ DataListTopCellWithTooltip,
52455
+ {
52456
+ tooltip: tooltipText,
52457
+ className: cn("flex [&_svg]:w-[1.3em] [&_svg]:h-[1.3em]", className),
52458
+ children: content
52459
+ }
52460
+ );
52461
+ }
52462
+ return /* @__PURE__ */ jsxRuntime.jsx(DataListTopCell, { className: cn("flex [&_svg]:w-[1.3em] [&_svg]:h-[1.3em]", className), children: content });
52463
+ }
52464
+
52465
+ function DataListCell({ children, className, height = "default" }) {
52466
+ return /* @__PURE__ */ jsxRuntime.jsx(
52467
+ "span",
52468
+ {
52469
+ className: cn(
52470
+ "relative grid items-center text-ui-md whitespace-nowrap text-neutral3",
52471
+ height === "compact" ? "py-2" : "py-4",
52472
+ className
52473
+ ),
52474
+ children
52475
+ }
52476
+ );
52477
+ }
52478
+ function DataListTextCell({ children, className }) {
52479
+ return /* @__PURE__ */ jsxRuntime.jsx(DataListCell, { className, children });
52480
+ }
52481
+ function DataListNameCell({ children, className }) {
52482
+ return /* @__PURE__ */ jsxRuntime.jsx(DataListCell, { className: cn("text-left text-neutral4", className), children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children }) });
52483
+ }
52484
+ function DataListDescriptionCell({ children, className }) {
52485
+ return /* @__PURE__ */ jsxRuntime.jsx(DataListCell, { className: cn("text-neutral2", className), children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children }) });
52486
+ }
52487
+
52488
+ function toDate(value) {
52489
+ const date = value instanceof Date ? value : new Date(value);
52490
+ return isNaN(date.getTime()) ? null : date;
52491
+ }
52492
+ const LEVEL_CONFIG = {
52493
+ debug: { label: "DEBUG", color: "#71717a" },
52494
+ info: { label: "INFO", color: "#60a5fa" },
52495
+ warn: { label: "WARN", color: "#facc15" },
52496
+ error: { label: "ERROR", color: "#f87171" },
52497
+ fatal: { label: "FATAL", color: "#dc2626" }
52498
+ };
52499
+ function LogsDataListLevelCell({ level }) {
52500
+ const config = LEVEL_CONFIG[level];
52501
+ return /* @__PURE__ */ jsxRuntime.jsx(DataListCell, { height: "compact", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "uppercase text-ui-sm font-semibold", style: { color: config.color }, children: config.label }) });
52502
+ }
52503
+ function LogsDataListDateCell({ timestamp }) {
52504
+ const date = toDate(timestamp);
52505
+ return /* @__PURE__ */ jsxRuntime.jsx(DataListCell, { height: "compact", className: "text-ui-smd text-neutral2", children: date ? dateFns.isToday(date) ? "Today" : dateFns.format(date, "MMM dd") : "-" });
52506
+ }
52507
+ function LogsDataListTimeCell({ timestamp }) {
52508
+ const date = toDate(timestamp);
52509
+ return /* @__PURE__ */ jsxRuntime.jsx(DataListCell, { height: "compact", className: "text-ui-smd font-mono text-neutral3 flex", children: date ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
52510
+ dateFns.format(date, "HH:mm:ss"),
52511
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-neutral2", children: [
52512
+ ".",
52513
+ String(date.getMilliseconds()).padStart(3, "0")
52514
+ ] })
52515
+ ] }) : "-" });
52516
+ }
52517
+ function EntityTypeIcon({ entityType, className }) {
52518
+ const iconClass = cn("size-3.5 shrink-0 text-neutral2", className);
52519
+ switch (entityType) {
52520
+ case "AGENT":
52521
+ return /* @__PURE__ */ jsxRuntime.jsx(AgentIcon, { className: iconClass, "aria-hidden": true });
52522
+ case "WORKFLOW":
52523
+ return /* @__PURE__ */ jsxRuntime.jsx(WorkflowIcon, { className: iconClass, "aria-hidden": true });
52524
+ case "TOOL":
52525
+ return /* @__PURE__ */ jsxRuntime.jsx(ToolsIcon, { className: iconClass, "aria-hidden": true });
52526
+ default:
52527
+ return null;
52528
+ }
52529
+ }
52530
+ function LogsDataListEntityCell({ entityType, entityName }) {
52531
+ const type = entityType ?? "";
52532
+ return /* @__PURE__ */ jsxRuntime.jsxs(DataListCell, { height: "compact", className: "flex min-w-0 items-center gap-2", children: [
52533
+ /* @__PURE__ */ jsxRuntime.jsx(EntityTypeIcon, { entityType: type }),
52534
+ entityName ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 text-ui-smd truncate", children: entityName }) : "-"
52535
+ ] });
52536
+ }
52537
+ function LogsDataListMessageCell({ message }) {
52538
+ return /* @__PURE__ */ jsxRuntime.jsx(DataListCell, { height: "compact", className: "text-neutral4 text-ui-smd min-w-0 truncate font-mono", children: message });
52539
+ }
52540
+ function LogsDataListDataCell({ data }) {
52541
+ if (!data || Object.keys(data).length === 0) {
52542
+ return /* @__PURE__ */ jsxRuntime.jsx(DataListCell, { height: "compact", children: null });
52543
+ }
52544
+ const summary = Object.entries(data).map(([k, v]) => {
52545
+ if (typeof v === "string") return `${k}: ${v}`;
52546
+ try {
52547
+ return `${k}: ${JSON.stringify(v)}`;
52548
+ } catch {
52549
+ return `${k}: <unserializable>`;
52550
+ }
52551
+ }).join(", ");
52552
+ return /* @__PURE__ */ jsxRuntime.jsx(DataListCell, { height: "compact", className: "min-w-0", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-neutral3 text-ui-smd font-mono truncate", children: summary }) });
52553
+ }
52554
+
52555
+ const LogsDataList = Object.assign(DataListRoot, {
52556
+ Top: DataListTop,
52557
+ TopCell: DataListTopCell,
52558
+ TopCellWithTooltip: DataListTopCellWithTooltip,
52559
+ TopCellSmart: DataListTopCellSmart,
52560
+ Row: DataListRow,
52561
+ RowButton: DataListRowButton,
52562
+ RowLink: DataListRowLink,
52563
+ NoMatch: DataListNoMatch,
52564
+ DateCell: LogsDataListDateCell,
52565
+ TimeCell: LogsDataListTimeCell,
52566
+ LevelCell: LogsDataListLevelCell,
52567
+ EntityCell: LogsDataListEntityCell,
52568
+ MessageCell: LogsDataListMessageCell,
52569
+ DataCell: LogsDataListDataCell,
52570
+ NextPageLoading: DataListNextPageLoading
52571
+ });
52572
+
52573
+ const DataList = Object.assign(DataListRoot, {
52574
+ Top: DataListTop,
52575
+ TopCell: DataListTopCell,
52576
+ TopCellWithTooltip: DataListTopCellWithTooltip,
52577
+ TopCellSmart: DataListTopCellSmart,
52578
+ Row: DataListRow,
52579
+ RowButton: DataListRowButton,
52580
+ RowLink: DataListRowLink,
52581
+ Cell: DataListCell,
52582
+ TextCell: DataListTextCell,
52583
+ NameCell: DataListNameCell,
52584
+ DescriptionCell: DataListDescriptionCell,
52585
+ NoMatch: DataListNoMatch,
52586
+ NextPageLoading: DataListNextPageLoading
52587
+ });
52588
+
52589
+ const widths = ["75%", "50%", "65%", "90%", "60%", "80%"];
52590
+ function DataListSkeleton({ columns = "auto 1fr auto auto", numberOfRows = 3 }) {
52591
+ const columnParts = columns.trim().split(/\s+/);
52592
+ const columnCount = columnParts.length;
52593
+ const skeletonColumns = columnParts.map((col) => col === "auto" ? "minmax(6rem, auto)" : col).join(" ");
52594
+ const getPseudoRandomWidth = (rowIdx, colIdx) => {
52595
+ const index = (rowIdx + colIdx + columnCount + numberOfRows) % widths.length;
52596
+ return widths[index];
52597
+ };
52598
+ return /* @__PURE__ */ jsxRuntime.jsx(DataListRoot, { columns: skeletonColumns, children: Array.from({ length: numberOfRows }).map((_, rowIdx) => /* @__PURE__ */ jsxRuntime.jsx(
52599
+ "div",
52600
+ {
52601
+ className: "data-list-row grid grid-cols-subgrid gap-6 lg:gap-8 xl:gap-10 2xl:gap-12 3xl:gap-14 col-span-full px-5 border-y border-b-border1 border-t-transparent transition-colors duration-200 rounded-lg",
52602
+ children: Array.from({ length: columnCount }).map((_2, colIdx) => /* @__PURE__ */ jsxRuntime.jsx(DataListCell, { children: /* @__PURE__ */ jsxRuntime.jsx(
52603
+ "div",
52604
+ {
52605
+ className: "bg-surface4 rounded-md animate-pulse text-transparent h-[1rem] select-none",
52606
+ style: { width: getPseudoRandomWidth(rowIdx, colIdx) }
52607
+ }
52608
+ ) }, colIdx))
52609
+ },
52610
+ rowIdx
52611
+ )) });
52612
+ }
52613
+
52614
+ function hashCode(str) {
52615
+ let hash = 0;
52616
+ for (let i = 0; i < str.length; i++) {
52617
+ hash = (hash << 5) - hash + str.charCodeAt(i) | 0;
52618
+ }
52619
+ return (hash >>> 0).toString(36);
52620
+ }
52621
+ function getLogIds(logs) {
52622
+ const ids = /* @__PURE__ */ new Map();
52623
+ const seen = /* @__PURE__ */ new Map();
52624
+ for (const log of logs) {
52625
+ const ts = log.timestamp instanceof Date ? log.timestamp.toISOString() : log.timestamp;
52626
+ const base = hashCode(`${ts}${log.message ?? ""}${log.data ? JSON.stringify(log.data) : ""}`);
52627
+ const count = seen.get(base) ?? 0;
52628
+ seen.set(base, count + 1);
52629
+ ids.set(log, count > 0 ? `${base}-${count}` : base);
52630
+ }
52631
+ return ids;
52632
+ }
52633
+ const COLUMNS$3 = "auto auto auto auto minmax(5rem,1fr) minmax(5rem,1fr)";
52634
+ function LogsList({
52635
+ logs,
52636
+ isLoading,
52637
+ isFetchingNextPage,
52638
+ hasNextPage,
52639
+ setEndOfListElement,
52640
+ error,
52641
+ hasActiveFilters,
52642
+ featuredLogId: controlledLogId,
52643
+ featuredTraceId: controlledTraceId,
52644
+ featuredSpanId: controlledSpanId,
52645
+ onFeaturedChange
52646
+ }) {
52647
+ const [internalIds, setInternalIds] = React.useState({});
52648
+ const featuredLogId = controlledLogId ?? internalIds.logId ?? null;
52649
+ const featuredTraceId = controlledTraceId ?? internalIds.traceId ?? null;
52650
+ const featuredSpanId = controlledSpanId ?? internalIds.spanId ?? null;
52651
+ const updateFeatured = React.useCallback(
52652
+ (ids) => {
52653
+ const merged = {
52654
+ logId: ids.logId !== void 0 ? ids.logId : featuredLogId,
52655
+ traceId: ids.traceId !== void 0 ? ids.traceId : featuredTraceId,
52656
+ spanId: ids.spanId !== void 0 ? ids.spanId : featuredSpanId
52657
+ };
52658
+ if (onFeaturedChange) {
52659
+ onFeaturedChange(merged);
52660
+ } else {
52661
+ setInternalIds(merged);
52662
+ }
52663
+ },
52664
+ [onFeaturedChange, featuredLogId, featuredTraceId, featuredSpanId]
52665
+ );
52666
+ const [featuredSpanRecord, setFeaturedSpanRecord] = React.useState();
52667
+ const [logDetailsCollapsed, setLogDetailsCollapsed] = React.useState(false);
52668
+ React.useEffect(() => {
52669
+ if (!featuredSpanId || featuredSpanRecord && featuredSpanRecord.spanId !== featuredSpanId) {
52670
+ setFeaturedSpanRecord(void 0);
52671
+ }
52672
+ }, [featuredSpanId, featuredSpanRecord]);
52673
+ const logIdMap = React.useMemo(() => getLogIds(logs), [logs]);
52674
+ const idToLog = React.useMemo(() => {
52675
+ const m = /* @__PURE__ */ new Map();
52676
+ for (let i = 0; i < logs.length; i++) {
52677
+ const id = logIdMap.get(logs[i]);
52678
+ if (id) m.set(id, { log: logs[i], idx: i });
52679
+ }
52680
+ return m;
52681
+ }, [logs, logIdMap]);
52682
+ const entry = featuredLogId ? idToLog.get(featuredLogId) : void 0;
52683
+ const featuredLogIdx = entry?.idx ?? -1;
52684
+ const featuredLog = featuredLogIdx >= 0 ? logs[featuredLogIdx] : null;
52685
+ const handlePreviousLog = featuredLogIdx > 0 ? () => {
52686
+ const prevLog = logs[featuredLogIdx - 1];
52687
+ const id = logIdMap.get(prevLog);
52688
+ if (featuredTraceId) {
52689
+ updateFeatured({ logId: id, traceId: prevLog.traceId ?? null, spanId: null });
52690
+ setFeaturedSpanRecord(void 0);
52691
+ } else {
52692
+ updateFeatured({ logId: id });
52693
+ }
52694
+ } : void 0;
52695
+ const handleNextLog = featuredLogIdx >= 0 && featuredLogIdx < logs.length - 1 ? () => {
52696
+ const nextLog = logs[featuredLogIdx + 1];
52697
+ const id = logIdMap.get(nextLog);
52698
+ if (featuredTraceId) {
52699
+ updateFeatured({ logId: id, traceId: nextLog.traceId ?? null, spanId: null });
52700
+ setFeaturedSpanRecord(void 0);
52701
+ } else {
52702
+ updateFeatured({ logId: id });
52703
+ }
52704
+ } : void 0;
52705
+ const handleLogClick = React.useCallback(
52706
+ (log) => {
52707
+ const id = logIdMap.get(log);
52708
+ if (featuredLogId === id) {
52709
+ updateFeatured({ logId: null });
52710
+ return;
52711
+ }
52712
+ if (featuredTraceId) {
52713
+ updateFeatured({ logId: id, traceId: log.traceId ?? null, spanId: null });
52714
+ setFeaturedSpanRecord(void 0);
52715
+ } else {
52716
+ updateFeatured({ logId: id });
52717
+ }
52718
+ },
52719
+ [featuredLogId, featuredTraceId, updateFeatured, logIdMap]
52720
+ );
52721
+ const handleTraceClick = React.useCallback(
52722
+ (traceId) => {
52723
+ updateFeatured({ traceId, spanId: null });
52724
+ setFeaturedSpanRecord(void 0);
52725
+ },
52726
+ [updateFeatured]
52727
+ );
52728
+ const handleSpanClick = React.useCallback(
52729
+ (traceId, spanId) => {
52730
+ updateFeatured({ traceId, spanId });
52731
+ },
52732
+ [updateFeatured]
52733
+ );
52734
+ const handleTraceClose = React.useCallback(() => {
52735
+ updateFeatured({ traceId: null, spanId: null });
52736
+ setLogDetailsCollapsed(false);
52737
+ setFeaturedSpanRecord(void 0);
52738
+ }, [updateFeatured]);
52739
+ const handleSpanSelect = React.useCallback(
52740
+ (span) => {
52741
+ updateFeatured({ spanId: span?.spanId ?? null });
52742
+ setFeaturedSpanRecord(span);
52743
+ },
52744
+ [updateFeatured]
52745
+ );
52746
+ const handleSpanClose = React.useCallback(() => {
52747
+ updateFeatured({ spanId: null });
52748
+ setFeaturedSpanRecord(void 0);
52749
+ }, [updateFeatured]);
52750
+ const handleLogClose = React.useCallback(() => {
52751
+ updateFeatured({ logId: null });
52752
+ }, [updateFeatured]);
52753
+ if (error) {
52754
+ return /* @__PURE__ */ jsxRuntime.jsx(ErrorState, { title: "Failed to load logs", message: error.message });
52755
+ }
52756
+ if (logs.length === 0 && !isLoading && !hasActiveFilters) {
52757
+ return /* @__PURE__ */ jsxRuntime.jsx(NoLogsInfo, {});
52758
+ }
52759
+ if (isLoading) {
52760
+ return /* @__PURE__ */ jsxRuntime.jsx(DataListSkeleton, { columns: COLUMNS$3 });
52761
+ }
52762
+ const hasSidePanel = !!featuredLog;
52763
+ return /* @__PURE__ */ jsxRuntime.jsxs(
52764
+ "div",
52765
+ {
52766
+ className: cn("grid h-full min-h-0 gap-4 items-start ", hasSidePanel ? "grid-cols-[1fr_1fr]" : "grid-cols-[1fr]"),
52767
+ children: [
52768
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsxs(LogsDataList, { columns: COLUMNS$3, className: "min-w-0", children: [
52769
+ /* @__PURE__ */ jsxRuntime.jsxs(LogsDataList.Top, { children: [
52770
+ /* @__PURE__ */ jsxRuntime.jsx(LogsDataList.TopCell, { children: "Date" }),
52771
+ /* @__PURE__ */ jsxRuntime.jsx(LogsDataList.TopCell, { children: "Time" }),
52772
+ /* @__PURE__ */ jsxRuntime.jsx(LogsDataList.TopCell, { children: "Level" }),
52773
+ /* @__PURE__ */ jsxRuntime.jsx(LogsDataList.TopCell, { children: "Entity" }),
52774
+ /* @__PURE__ */ jsxRuntime.jsx(LogsDataList.TopCell, { children: "Message" }),
52775
+ /* @__PURE__ */ jsxRuntime.jsx(LogsDataList.TopCell, { children: "Data" })
52776
+ ] }),
52777
+ logs.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(LogsDataList.NoMatch, { message: "No logs match your search" }) : logs.map((log) => {
52778
+ const id = logIdMap.get(log);
52779
+ const isFeatured = id === featuredLogId;
52780
+ return /* @__PURE__ */ jsxRuntime.jsxs(
52781
+ LogsDataList.RowButton,
52782
+ {
52783
+ onClick: () => handleLogClick(log),
52784
+ className: cn(isFeatured && "bg-surface4"),
52785
+ children: [
52786
+ /* @__PURE__ */ jsxRuntime.jsx(LogsDataList.DateCell, { timestamp: log.timestamp }),
52787
+ /* @__PURE__ */ jsxRuntime.jsx(LogsDataList.TimeCell, { timestamp: log.timestamp }),
52788
+ /* @__PURE__ */ jsxRuntime.jsx(LogsDataList.LevelCell, { level: log.level }),
52789
+ /* @__PURE__ */ jsxRuntime.jsx(LogsDataList.EntityCell, { entityType: log.entityType, entityName: log.entityName }),
52790
+ /* @__PURE__ */ jsxRuntime.jsx(LogsDataList.MessageCell, { message: log.message }),
52791
+ /* @__PURE__ */ jsxRuntime.jsx(LogsDataList.DataCell, { data: log.data })
52792
+ ]
52793
+ },
52794
+ id
52795
+ );
52796
+ }),
52797
+ /* @__PURE__ */ jsxRuntime.jsx(
52798
+ LogsDataList.NextPageLoading,
52799
+ {
52800
+ isLoading: isFetchingNextPage,
52801
+ hasMore: hasNextPage,
52802
+ setEndOfListElement
52803
+ }
52804
+ )
52805
+ ] }) }),
52806
+ featuredLog && /* @__PURE__ */ jsxRuntime.jsxs(
52807
+ "div",
52808
+ {
52809
+ className: cn(
52810
+ "grid gap-4 h-full overflow-auto ",
52811
+ logDetailsCollapsed && featuredTraceId && featuredSpanRecord ? "grid-rows-[auto_1fr_1fr]" : logDetailsCollapsed && featuredTraceId ? "grid-rows-[auto_1fr]" : featuredTraceId && featuredSpanRecord ? "grid-rows-[1fr_1fr_1fr]" : featuredTraceId ? "grid-rows-[1fr_1fr]" : logDetailsCollapsed ? "grid-rows-[auto]" : "grid-rows-[1fr]"
52812
+ ),
52813
+ children: [
52814
+ /* @__PURE__ */ jsxRuntime.jsx(
52815
+ LogDetails,
52816
+ {
52817
+ log: featuredLog,
52818
+ onClose: handleLogClose,
52819
+ onTraceClick: handleTraceClick,
52820
+ onSpanClick: handleSpanClick,
52821
+ onPrevious: handlePreviousLog,
52822
+ onNext: handleNextLog,
52823
+ collapsed: logDetailsCollapsed,
52824
+ onCollapsedChange: setLogDetailsCollapsed
52825
+ }
52826
+ ),
52827
+ featuredTraceId && /* @__PURE__ */ jsxRuntime.jsx(
52828
+ TraceDetails,
52829
+ {
52830
+ traceId: featuredTraceId,
52831
+ onClose: handleTraceClose,
52832
+ onSpanSelect: handleSpanSelect,
52833
+ initialSpanId: featuredSpanId
52834
+ }
52835
+ ),
52836
+ featuredSpanRecord && /* @__PURE__ */ jsxRuntime.jsx(SpanDetails, { span: featuredSpanRecord, onClose: handleSpanClose })
52837
+ ]
52838
+ }
52839
+ )
52840
+ ]
52841
+ }
52842
+ );
52843
+ }
52844
+
52845
+ const SUBMENU_SEARCH_THRESHOLD = 6;
52846
+ const subContentClass = cn(
52847
+ "bg-surface5 backdrop-blur-xl z-50 min-w-[8rem] overflow-auto rounded-lg p-2 shadow-md",
52848
+ "data-[state=open]:animate-in data-[state=closed]:animate-out",
52849
+ "data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0",
52850
+ "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"
52851
+ );
52852
+ function PortalSubContent({ className, children, ...props }) {
52853
+ return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive.SubContent, { className: cn(subContentClass, className), ...props, children }) });
52854
+ }
52855
+ function SubMenuSearch({
52856
+ value,
52857
+ onChange,
52858
+ label = "Search"
52859
+ }) {
52860
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-2 pb-2"), children: /* @__PURE__ */ jsxRuntime.jsxs(
52861
+ "div",
52862
+ {
52863
+ className: cn(
52864
+ "flex items-center gap-2 border border-border1 rounded-md px-2 py-1",
52865
+ "focus-within:border-neutral2"
52866
+ ),
52867
+ children: [
52868
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: cn("text-neutral3 h-3.5 w-3.5 shrink-0") }),
52869
+ /* @__PURE__ */ jsxRuntime.jsx(
52870
+ "input",
52871
+ {
52872
+ type: "text",
52873
+ placeholder: "Search...",
52874
+ "aria-label": label,
52875
+ value,
52876
+ onChange: (e) => onChange(e.target.value),
52877
+ onKeyDown: (e) => e.stopPropagation(),
52878
+ className: cn("bg-transparent text-ui-sm text-neutral4 placeholder:text-neutral3 outline-none w-full")
52879
+ }
52880
+ )
52881
+ ]
52882
+ }
52883
+ ) });
52884
+ }
52885
+ function SelectDataFilter({
52886
+ categories,
52887
+ value,
52888
+ onChange,
52889
+ disabled,
52890
+ label = "Filter",
52891
+ align = "end",
52892
+ searchThreshold = SUBMENU_SEARCH_THRESHOLD
52893
+ }) {
52894
+ const [filterSearch, setFilterSearch] = React.useState("");
52895
+ const [subSearch, setSubSearch] = React.useState("");
52896
+ const resetSubSearch = React.useCallback((open) => {
52897
+ if (!open) setSubSearch("");
52898
+ }, []);
52899
+ const activeFilterCount = React.useMemo(() => {
52900
+ let count = 0;
52901
+ for (const selections of Object.values(value)) {
52902
+ if (selections.length > 0) count++;
52903
+ }
52904
+ return count;
52905
+ }, [value]);
52906
+ const grouped = React.useMemo(() => {
52907
+ const q = filterSearch.toLowerCase();
52908
+ const groups = [];
52909
+ const groupMap = /* @__PURE__ */ new Map();
52910
+ const ungrouped = [];
52911
+ for (const cat of categories) {
52912
+ if (cat.values.length === 0) continue;
52913
+ if (q) {
52914
+ const matchesLabel = cat.label.toLowerCase().includes(q);
52915
+ const matchesValues = cat.values.some((v) => v.label.toLowerCase().includes(q));
52916
+ if (!matchesLabel && !matchesValues) continue;
52917
+ }
52918
+ if (cat.group) {
52919
+ let items = groupMap.get(cat.group);
52920
+ if (!items) {
52921
+ items = [];
52922
+ groupMap.set(cat.group, items);
52923
+ }
52924
+ items.push(cat);
52925
+ } else {
52926
+ ungrouped.push(cat);
52927
+ }
52928
+ }
52929
+ for (const cat of ungrouped) {
52930
+ groups.push({ key: cat.id, items: [cat] });
52931
+ }
52932
+ for (const [groupLabel, items] of groupMap) {
52933
+ groups.push({ key: `group-${groupLabel}`, label: groupLabel, items });
52934
+ }
52935
+ return groups;
52936
+ }, [categories, filterSearch]);
52937
+ const handleSelect = (categoryId, selectedValue, mode) => {
52938
+ const current = value[categoryId] ?? [];
52939
+ let next;
52940
+ if (mode === "single") {
52941
+ next = current.includes(selectedValue) ? [] : [selectedValue];
52942
+ } else {
52943
+ next = current.includes(selectedValue) ? current.filter((v) => v !== selectedValue) : [...current, selectedValue];
52944
+ }
52945
+ onChange({ ...value, [categoryId]: next });
52946
+ };
52947
+ const handleClearAll = () => {
52948
+ onChange({});
52949
+ };
52950
+ const renderCategory = (cat) => {
52951
+ const mode = cat.mode ?? "multi";
52952
+ const selected = value[cat.id] ?? [];
52953
+ const selectedCount = selected.length;
52954
+ return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu.Sub, { onOpenChange: resetSubSearch, children: [
52955
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu.SubTrigger, { children: [
52956
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("truncate"), children: cat.label }),
52957
+ selectedCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("ml-auto text-ui-sm text-accent1"), children: selectedCount })
52958
+ ] }),
52959
+ /* @__PURE__ */ jsxRuntime.jsxs(PortalSubContent, { className: cn("max-h-[20rem]"), children: [
52960
+ cat.values.length >= searchThreshold && /* @__PURE__ */ jsxRuntime.jsx(SubMenuSearch, { value: subSearch, onChange: setSubSearch, label: `Search ${cat.label.toLowerCase()}` }),
52961
+ mode === "single" ? /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.RadioGroup, { value: selected[0] ?? "", onValueChange: (val) => handleSelect(cat.id, val, mode), children: cat.values.filter((v) => !subSearch || v.label.toLowerCase().includes(subSearch.toLowerCase())).map((v) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.RadioItem, { value: v.value, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("truncate"), children: v.label }) }, v.value)) }) : cat.values.filter((v) => !subSearch || v.label.toLowerCase().includes(subSearch.toLowerCase())).map((v) => /* @__PURE__ */ jsxRuntime.jsx(
52962
+ DropdownMenu.CheckboxItem,
52963
+ {
52964
+ checked: selected.includes(v.value),
52965
+ onCheckedChange: () => handleSelect(cat.id, v.value, mode),
52966
+ onSelect: (e) => e.preventDefault(),
52967
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("truncate"), children: v.label })
52968
+ },
52969
+ v.value
52970
+ ))
52971
+ ] })
52972
+ ] }, cat.id);
52973
+ };
52974
+ return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { modal: false, children: [
52975
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", disabled, size: "md", children: [
52976
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FilterIcon, {}),
52977
+ label,
52978
+ activeFilterCount > 0 && /* @__PURE__ */ jsxRuntime.jsx(
52979
+ "span",
52980
+ {
52981
+ className: cn(
52982
+ "ml-0.5 inline-flex items-center justify-center rounded-full bg-accent1/50 text-neutral5 text-ui-sm w-5 h-5"
52983
+ ),
52984
+ children: activeFilterCount
52985
+ }
52986
+ )
52987
+ ] }) }),
52988
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu.Content, { align, className: cn("min-w-[12rem]"), children: [
52989
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-2 pb-2"), children: /* @__PURE__ */ jsxRuntime.jsxs(
52990
+ "div",
52991
+ {
52992
+ className: cn(
52993
+ "flex items-center gap-2 border border-border1 rounded-md px-2 py-1",
52994
+ "focus-within:border-neutral2"
52995
+ ),
52996
+ children: [
52997
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: cn("text-neutral3 h-3.5 w-3.5 shrink-0") }),
52998
+ /* @__PURE__ */ jsxRuntime.jsx(
52999
+ "input",
53000
+ {
53001
+ type: "text",
53002
+ placeholder: "Search filters...",
53003
+ "aria-label": "Search filters",
53004
+ value: filterSearch,
53005
+ onChange: (e) => setFilterSearch(e.target.value),
53006
+ onKeyDown: (e) => e.stopPropagation(),
53007
+ className: cn("bg-transparent text-ui-sm text-neutral4 placeholder:text-neutral3 outline-none w-full")
53008
+ }
53009
+ )
53010
+ ]
53011
+ }
53012
+ ) }),
53013
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.Separator, {}),
53014
+ grouped.map((group) => {
53015
+ if (group.items.length === 1 && !group.label) {
53016
+ return renderCategory(group.items[0]);
53017
+ }
53018
+ if (group.label && group.items.length === 1) {
53019
+ return renderCategory(group.items[0]);
53020
+ }
53021
+ return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu.Sub, { children: [
53022
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.SubTrigger, { children: group.label }),
53023
+ /* @__PURE__ */ jsxRuntime.jsx(PortalSubContent, { className: cn("max-h-[20rem]"), children: group.items.map((cat) => renderCategory(cat)) })
53024
+ ] }, group.key);
53025
+ }),
53026
+ activeFilterCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
53027
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.Separator, {}),
53028
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu.Item, { onSelect: handleClearAll, children: [
53029
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
53030
+ "Clear all filters"
53031
+ ] })
53032
+ ] })
53033
+ ] })
53034
+ ] });
53035
+ }
53036
+
53037
+ const DATE_PRESET_LABELS = {
53038
+ "24h": "Last 24 hours",
53039
+ "3d": "Last 3 days",
53040
+ "7d": "Last 7 days",
53041
+ "14d": "Last 14 days",
53042
+ "30d": "Last 30 days"
53043
+ };
53044
+ function LogsToolbar({
53045
+ onSearchChange,
53046
+ datePreset,
53047
+ onDatePresetChange,
53048
+ filterGroups,
53049
+ filterColumns,
53050
+ onToggleComparator: _onToggleComparator,
53051
+ onRemoveFilterGroup: _onRemoveFilterGroup,
53052
+ onClearAllFilters: _onClearAllFilters,
53053
+ onFilterGroupsChange,
53054
+ onReset,
53055
+ isLoading,
53056
+ hasActiveFilters
53057
+ }) {
53058
+ const categories = React.useMemo(
53059
+ () => filterColumns.map((col) => ({
53060
+ id: col.field,
53061
+ label: col.field,
53062
+ values: col.values.map((v) => ({ value: v, label: v })),
53063
+ mode: "multi"
53064
+ })),
53065
+ [filterColumns]
53066
+ );
53067
+ const filterState = React.useMemo(() => {
53068
+ const state = {};
53069
+ for (const group of filterGroups) {
53070
+ state[group.field] = group.values;
53071
+ }
53072
+ return state;
53073
+ }, [filterGroups]);
53074
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
53075
+ /* @__PURE__ */ jsxRuntime.jsx(ListSearch, { onSearch: onSearchChange, size: "md", label: "Search logs", placeholder: "Search name, ID, content..." }),
53076
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
53077
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "inputLike", size: "md", children: [
53078
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, {}),
53079
+ " ",
53080
+ DATE_PRESET_LABELS[datePreset],
53081
+ " ",
53082
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, {})
53083
+ ] }) }),
53084
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.Content, { children: Object.keys(DATE_PRESET_LABELS).map((value) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu.Item, { onSelect: () => onDatePresetChange(value), children: DATE_PRESET_LABELS[value] }, value)) })
53085
+ ] }),
53086
+ /* @__PURE__ */ jsxRuntime.jsx(
53087
+ SelectDataFilter,
53088
+ {
53089
+ categories,
53090
+ value: filterState,
53091
+ onChange: onFilterGroupsChange,
53092
+ align: "end",
53093
+ disabled: isLoading
53094
+ }
53095
+ ),
53096
+ onReset && hasActiveFilters && /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "md", disabled: isLoading, onClick: onReset, className: "ml-auto", children: [
53097
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
53098
+ "Reset"
53099
+ ] })
53100
+ ] }) });
53101
+ }
53102
+
53103
+ const LEVEL_LABELS = {
53104
+ debug: "DEBUG",
53105
+ info: "INFO",
53106
+ warn: "WARN",
53107
+ error: "ERROR",
53108
+ fatal: "FATAL"
53109
+ };
53110
+ const ENTITY_TYPE_LABELS = {
53111
+ AGENT: "Agent",
53112
+ WORKFLOW: "Workflow",
53113
+ TOOL: "Tool",
53114
+ SYSTEM: "System"
53115
+ };
53116
+ function getLogFilterValue(log, field) {
53117
+ switch (field) {
53118
+ case "Level":
53119
+ return LEVEL_LABELS[log.level];
53120
+ case "Entity type":
53121
+ return ENTITY_TYPE_LABELS[log.entityType ?? ""] ?? log.entityType ?? "";
53122
+ case "Entity name":
53123
+ return log.entityName ?? "";
53124
+ default:
53125
+ return "";
53126
+ }
53127
+ }
53128
+ function useLogsFilters(logs) {
53129
+ const [searchQuery, setSearchQuery] = React.useState("");
53130
+ const [filterGroups, setFilterGroups] = React.useState([]);
53131
+ const filterColumns = React.useMemo(() => {
53132
+ const unique = (values) => Array.from(new Set(values.filter(Boolean))).sort();
53133
+ return [
53134
+ { field: "Level", plural: "levels", values: unique(logs.map((l) => LEVEL_LABELS[l.level])) },
53135
+ {
53136
+ field: "Entity type",
53137
+ plural: "types",
53138
+ values: unique(logs.map((l) => ENTITY_TYPE_LABELS[l.entityType ?? ""] ?? l.entityType ?? ""))
53139
+ },
53140
+ { field: "Entity name", plural: "names", values: unique(logs.map((l) => l.entityName ?? "")) }
53141
+ ];
53142
+ }, [logs]);
53143
+ const toggleComparator = React.useCallback((id) => {
53144
+ setFilterGroups(
53145
+ (prev) => prev.map((g) => g.id === id ? { ...g, comparator: g.comparator === "is" ? "is not" : "is" } : g)
53146
+ );
53147
+ }, []);
53148
+ const removeFilterGroup = React.useCallback((id) => {
53149
+ setFilterGroups((prev) => prev.filter((g) => g.id !== id));
53150
+ }, []);
53151
+ const clearAllFilters = React.useCallback(() => {
53152
+ setFilterGroups([]);
53153
+ }, []);
53154
+ const updateFilterGroups = React.useCallback((nextState) => {
53155
+ setFilterGroups((prev) => {
53156
+ const result = [];
53157
+ const seen = /* @__PURE__ */ new Set();
53158
+ for (const group of prev) {
53159
+ const nextValues = nextState[group.field];
53160
+ if (nextValues && nextValues.length > 0) {
53161
+ result.push({ ...group, values: nextValues });
53162
+ seen.add(group.field);
53163
+ }
53164
+ }
53165
+ for (const [field, values] of Object.entries(nextState)) {
53166
+ if (seen.has(field) || values.length === 0) continue;
53167
+ result.push({ id: `${field}-${Date.now()}`, field, comparator: "is", values });
53168
+ }
53169
+ return result;
53170
+ });
53171
+ }, []);
53172
+ const filteredLogs = React.useMemo(() => {
53173
+ return logs.filter((log) => {
53174
+ if (searchQuery) {
53175
+ const q = searchQuery.toLowerCase();
53176
+ const match = log.message.toLowerCase().includes(q) || (log.entityName ?? "").toLowerCase().includes(q) || (log.traceId ?? "").toLowerCase().includes(q);
53177
+ if (!match) return false;
53178
+ }
53179
+ for (const group of filterGroups) {
53180
+ const logVal = getLogFilterValue(log, group.field);
53181
+ const matches = group.values.includes(logVal);
53182
+ if (group.comparator === "is" && !matches) return false;
53183
+ if (group.comparator === "is not" && matches) return false;
53184
+ }
53185
+ return true;
53186
+ });
53187
+ }, [logs, searchQuery, filterGroups]);
53188
+ return {
53189
+ searchQuery,
53190
+ setSearchQuery,
53191
+ filterGroups,
53192
+ filterColumns,
53193
+ toggleComparator,
53194
+ removeFilterGroup,
53195
+ clearAllFilters,
53196
+ updateFilterGroups,
53197
+ filteredLogs
53198
+ };
53199
+ }
53200
+
53201
+ const DATE_PRESETS = [
53202
+ { label: "Last 24 hours", value: "24h" },
53203
+ { label: "Last 3 days", value: "3d" },
53204
+ { label: "Last 7 days", value: "7d" },
53205
+ { label: "Last 14 days", value: "14d" },
53206
+ { label: "Last 30 days", value: "30d" }
53207
+ ];
53208
+ function isValidLogsDatePreset(value) {
53209
+ return DATE_PRESETS.some((p) => p.value === value);
53210
+ }
53211
+
51412
53212
  function useEvaluationScorers() {
51413
53213
  const client = react.useMastraClient();
51414
53214
  const requestContext = useMergedRequestContext();
@@ -52915,7 +54715,7 @@ function MainSidebarNavHeader({
52915
54715
  {
52916
54716
  className: cn("text-ui-xs uppercase tracking-widest", {
52917
54717
  "pl-3": isDefaultState,
52918
- "text-accent1 font-semibold": isActive,
54718
+ "text-black dark:text-white font-semibold": isActive,
52919
54719
  "text-neutral3/75": !isActive
52920
54720
  }),
52921
54721
  children: href && isDefaultState ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -52924,7 +54724,7 @@ function MainSidebarNavHeader({
52924
54724
  href,
52925
54725
  className: cn("transition-colors duration-normal", {
52926
54726
  "hover:text-neutral5": !isActive,
52927
- "text-accent1": isActive
54727
+ "text-black dark:text-white": isActive
52928
54728
  }),
52929
54729
  children: labelContent
52930
54730
  }
@@ -52964,7 +54764,7 @@ function MainSidebarNavLink({
52964
54764
  "[&>a]:text-neutral5 [&>a]:bg-surface3": isActive,
52965
54765
  "[&_svg]:text-neutral5": isActive,
52966
54766
  // Active indicator bar
52967
- "before:absolute before:left-0 before:top-1/2 before:-translate-y-1/2 before:w-0.5 before:h-5 before:bg-accent1 before:rounded-r-full before:transition-all before:duration-normal": isActive && !isCollapsed,
54767
+ "before:absolute before:left-0 before:top-1/2 before:-translate-y-1/2 before:w-0.5 before:h-5 before:bg-black dark:before:bg-white before:rounded-r-full before:transition-all before:duration-normal": isActive && !isCollapsed,
52968
54768
  "[&>a]:justify-start": !isCollapsed,
52969
54769
  "[&_svg]:text-neutral3": isCollapsed,
52970
54770
  // Featured variant
@@ -55918,6 +57718,8 @@ exports.CreateDatasetFromItemsDialog = CreateDatasetFromItemsDialog;
55918
57718
  exports.CrossIcon = CrossIcon;
55919
57719
  exports.Crumb = Crumb;
55920
57720
  exports.DashboardCard = DashboardCard;
57721
+ exports.DataList = DataList;
57722
+ exports.DataListSkeleton = DataListSkeleton;
55921
57723
  exports.DatasetCombobox = DatasetCombobox;
55922
57724
  exports.DatasetCompareVersionToolbar = DatasetCompareVersionToolbar;
55923
57725
  exports.DatasetCompareVersionsList = DatasetCompareVersionsList;
@@ -56040,10 +57842,15 @@ exports.LatencyCard = LatencyCard;
56040
57842
  exports.LatencyIcon = LatencyIcon;
56041
57843
  exports.LinkComponentProvider = LinkComponentProvider;
56042
57844
  exports.ListSearch = ListSearch;
57845
+ exports.LogDetails = LogDetails;
56043
57846
  exports.LoginButton = LoginButton;
56044
57847
  exports.LoginPage = LoginPage;
56045
57848
  exports.LogoWithoutText = LogoWithoutText;
57849
+ exports.LogsDataList = LogsDataList;
57850
+ exports.LogsDataListSkeleton = DataListSkeleton;
56046
57851
  exports.LogsIcon = LogsIcon;
57852
+ exports.LogsList = LogsList;
57853
+ exports.LogsToolbar = LogsToolbar;
56047
57854
  exports.MCPClientCreateContent = MCPClientCreateContent;
56048
57855
  exports.MCPClientEditLayout = MCPClientEditLayout;
56049
57856
  exports.MCPClientFormSidebar = MCPClientFormSidebar;
@@ -56121,7 +57928,7 @@ exports.RequestContextSchemaForm = RequestContextSchemaForm;
56121
57928
  exports.RequestContextWrapper = RequestContextWrapper;
56122
57929
  exports.ReviewPipelineCard = ReviewPipelineCard;
56123
57930
  exports.ReviewQueueProvider = ReviewQueueProvider;
56124
- exports.Root = Root;
57931
+ exports.Root = Root$1;
56125
57932
  exports.Row = Row;
56126
57933
  exports.RuleBuilder = RuleBuilder;
56127
57934
  exports.RuleFieldSelect = RuleFieldSelect;
@@ -56160,6 +57967,7 @@ exports.SectionHeader = SectionHeader;
56160
57967
  exports.Sections = Sections;
56161
57968
  exports.Select = Select;
56162
57969
  exports.SelectContent = SelectContent;
57970
+ exports.SelectDataFilter = SelectDataFilter;
56163
57971
  exports.SelectField = SelectField;
56164
57972
  exports.SelectFieldBlock = SelectFieldBlock;
56165
57973
  exports.SelectGroup = SelectGroup;
@@ -56233,10 +58041,11 @@ exports.TooltipContent = TooltipContent;
56233
58041
  exports.TooltipProvider = TooltipProvider;
56234
58042
  exports.TooltipTrigger = TooltipTrigger;
56235
58043
  exports.TraceAsItemDialog = TraceAsItemDialog;
58044
+ exports.TraceDetails = TraceDetails;
56236
58045
  exports.TraceDialog = TraceDialog;
56237
58046
  exports.TraceIcon = TraceIcon;
56238
- exports.TraceTimeline = TraceTimeline;
56239
- exports.TraceTimelineSpan = TraceTimelineSpan;
58047
+ exports.TraceTimeline = TraceTimeline$1;
58048
+ exports.TraceTimelineSpan = TraceTimelineSpan$1;
56240
58049
  exports.TraceTimelineTools = TraceTimelineTools;
56241
58050
  exports.TracesList = TracesList;
56242
58051
  exports.TracesTools = TracesTools;
@@ -56299,7 +58108,7 @@ exports.fieldsToJSONSchema = fieldsToJSONSchema;
56299
58108
  exports.findProviderById = findProviderById;
56300
58109
  exports.flattenSchemaToVariables = flattenSchemaToVariables;
56301
58110
  exports.formatCompact = formatCompact;
56302
- exports.formatHierarchicalSpans = formatHierarchicalSpans;
58111
+ exports.formatHierarchicalSpans = formatHierarchicalSpans$1;
56303
58112
  exports.getChildFieldOptions = getChildFieldOptions;
56304
58113
  exports.getColumnTemplate = getColumnTemplate;
56305
58114
  exports.getFieldOptionAtPath = getFieldOptionAtPath;
@@ -56307,7 +58116,7 @@ exports.getFieldOptionsFromSchema = getFieldOptionsFromSchema;
56307
58116
  exports.getItemListColumnTemplate = getItemListColumnTemplate;
56308
58117
  exports.getMainContentContentClassName = getMainContentContentClassName;
56309
58118
  exports.getShortId = getShortId;
56310
- exports.getSpanTypeUi = getSpanTypeUi;
58119
+ exports.getSpanTypeUi = getSpanTypeUi$1;
56311
58120
  exports.getStatusIcon = getStatusIcon;
56312
58121
  exports.getToNextEntryFn = getToNextEntryFn;
56313
58122
  exports.getToNextItemFn = getToNextItemFn;
@@ -56321,6 +58130,7 @@ exports.isActive = isActive;
56321
58130
  exports.isAuthenticated = isAuthenticated;
56322
58131
  exports.isRule = isRule;
56323
58132
  exports.isRuleGroup = isRuleGroup;
58133
+ exports.isValidLogsDatePreset = isValidLogsDatePreset;
56324
58134
  exports.isValidPreset = isValidPreset;
56325
58135
  exports.joinModelId = joinModelId;
56326
58136
  exports.jsonSchemaToFields = jsonSchemaToFields;
@@ -56379,7 +58189,7 @@ exports.useAvgScoreKpiMetrics = useAvgScoreKpiMetrics;
56379
58189
  exports.useCSVParser = useCSVParser;
56380
58190
  exports.useCanCreateAgent = useCanCreateAgent;
56381
58191
  exports.useCloneThread = useCloneThread;
56382
- exports.useCodemirrorTheme = useCodemirrorTheme$1;
58192
+ exports.useCodemirrorTheme = useCodemirrorTheme$2;
56383
58193
  exports.useCompareAgentVersions = useCompareAgentVersions;
56384
58194
  exports.useCompareExperiments = useCompareExperiments;
56385
58195
  exports.useCompareScorerVersions = useCompareScorerVersions;
@@ -56437,6 +58247,7 @@ exports.useLLMProviders = useLLMProviders;
56437
58247
  exports.useLatencyMetrics = useLatencyMetrics;
56438
58248
  exports.useLinkComponent = useLinkComponent;
56439
58249
  exports.useLogout = useLogout;
58250
+ exports.useLogsFilters = useLogsFilters;
56440
58251
  exports.useMCPServerTool = useMCPServerTool;
56441
58252
  exports.useMCPServerTools = useMCPServerTools;
56442
58253
  exports.useMCPServerToolsById = useMCPServerToolsById;