@copilotz/admin 0.9.28 → 0.9.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -536,16 +536,6 @@ function CardHeader({ className, ...props }) {
536
536
  }
537
537
  );
538
538
  }
539
- function CardTitle({ className, ...props }) {
540
- return /* @__PURE__ */ jsx(
541
- "div",
542
- {
543
- "data-slot": "card-title",
544
- className: cn("leading-none font-semibold", className),
545
- ...props
546
- }
547
- );
548
- }
549
539
  function CardContent({ className, ...props }) {
550
540
  return /* @__PURE__ */ jsx(
551
541
  "div",
@@ -1496,7 +1486,7 @@ import {
1496
1486
  BarChart,
1497
1487
  CartesianGrid,
1498
1488
  Legend,
1499
- Tooltip as Tooltip2,
1489
+ Tooltip as RechartsTooltip,
1500
1490
  XAxis,
1501
1491
  YAxis
1502
1492
  } from "recharts";
@@ -1863,10 +1853,10 @@ function UsageDashboard({
1863
1853
  });
1864
1854
  return () => setHeaderRefresh?.(null);
1865
1855
  }, [loadUsage, setHeaderRefresh]);
1866
- return /* @__PURE__ */ jsxs8("div", { className: "grid h-full min-h-0 grid-rows-[auto_minmax(0,4fr)_minmax(0,5fr)] gap-3", children: [
1856
+ return /* @__PURE__ */ jsxs8("div", { className: "grid h-full min-h-[760px] grid-rows-[auto_minmax(280px,4fr)_minmax(260px,5fr)] gap-3", children: [
1867
1857
  /* @__PURE__ */ jsxs8("div", { className: "space-y-3", children: [
1868
- /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-3 xl:flex-row xl:items-end xl:justify-between", children: [
1869
- /* @__PURE__ */ jsxs8("div", { className: "min-w-0", children: [
1858
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [
1859
+ /* @__PURE__ */ jsxs8("div", { className: "min-w-[180px]", children: [
1870
1860
  /* @__PURE__ */ jsx13("h2", { className: "text-xl font-semibold tracking-tight", children: config.labels.llmUsageTitle }),
1871
1861
  /* @__PURE__ */ jsxs8("div", { className: "mt-1 flex flex-wrap items-center gap-2", children: [
1872
1862
  /* @__PURE__ */ jsx13(Badge, { variant: "outline", children: formatUsageRangeLabel(period, range) }),
@@ -1906,34 +1896,19 @@ function UsageDashboard({
1906
1896
  }
1907
1897
  )
1908
1898
  ] }),
1909
- /* @__PURE__ */ jsxs8(Card, { className: "min-h-0 gap-2 overflow-hidden py-3", children: [
1910
- /* @__PURE__ */ jsx13(CardHeader, { className: "px-4", children: /* @__PURE__ */ jsx13("div", { className: "flex flex-col gap-2 md:flex-row md:items-start md:justify-between", children: /* @__PURE__ */ jsxs8("div", { children: [
1911
- /* @__PURE__ */ jsx13(CardTitle, { className: "text-base", children: getUsageSummaryLabel(config.labels, metricKind, dimension) }),
1912
- /* @__PURE__ */ jsxs8("p", { className: "mt-1 text-sm text-muted-foreground", children: [
1913
- formatMetricValue(
1914
- getUsageTotalValue(totals, metricKind, dimension),
1915
- metricKind
1916
- ),
1917
- " ",
1918
- "across ",
1919
- formatNumber(totals.totalCalls),
1920
- " calls"
1921
- ] })
1922
- ] }) }) }),
1923
- /* @__PURE__ */ jsx13(CardContent, { className: "min-h-0 flex-1 px-2 lg:px-4", children: error ? /* @__PURE__ */ jsx13("div", { className: "rounded-lg border border-destructive/30 bg-destructive/10 p-4 text-sm text-destructive", children: error }) : chartState.data.length === 0 ? /* @__PURE__ */ jsx13(
1924
- EmptyDashboard,
1925
- {
1926
- description: config.labels.noResults,
1927
- title: "No usage"
1928
- }
1929
- ) : /* @__PURE__ */ jsx13(
1930
- UsageChart,
1931
- {
1932
- chartState,
1933
- metricKind
1934
- }
1935
- ) })
1936
- ] }),
1899
+ /* @__PURE__ */ jsx13(Card, { className: "min-h-0 gap-0 overflow-hidden py-2", children: /* @__PURE__ */ jsx13(CardContent, { className: "min-h-0 flex-1 px-2 lg:px-4", children: error ? /* @__PURE__ */ jsx13("div", { className: "rounded-lg border border-destructive/30 bg-destructive/10 p-4 text-sm text-destructive", children: error }) : chartState.data.length === 0 ? /* @__PURE__ */ jsx13(
1900
+ EmptyDashboard,
1901
+ {
1902
+ description: config.labels.noResults,
1903
+ title: "No usage"
1904
+ }
1905
+ ) : /* @__PURE__ */ jsx13(
1906
+ UsageChart,
1907
+ {
1908
+ chartState,
1909
+ metricKind
1910
+ }
1911
+ ) }) }),
1937
1912
  /* @__PURE__ */ jsx13(
1938
1913
  UsageTable,
1939
1914
  {
@@ -2022,7 +1997,7 @@ function UsageChart({
2022
1997
  }
2023
1998
  ),
2024
1999
  /* @__PURE__ */ jsx13(
2025
- Tooltip2,
2000
+ RechartsTooltip,
2026
2001
  {
2027
2002
  content: /* @__PURE__ */ jsx13(
2028
2003
  ChartTooltipContent,
@@ -2067,72 +2042,62 @@ function UsageTable({
2067
2042
  }) {
2068
2043
  const totalValue = getUsageTotalValue(totals, metricKind, dimension);
2069
2044
  const filterable = groupBy !== "namespace";
2070
- return /* @__PURE__ */ jsxs8(Card, { className: "min-h-0 gap-2 overflow-hidden py-3", children: [
2071
- /* @__PURE__ */ jsx13(CardHeader, { className: "px-4", children: /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between", children: [
2072
- /* @__PURE__ */ jsx13(CardTitle, { className: "text-base", children: "Usage detail" }),
2073
- /* @__PURE__ */ jsxs8(Badge, { variant: "outline", children: [
2074
- formatNumber(rows.length),
2075
- " ",
2076
- getGroupByLabel(groupBy).toLowerCase()
2077
- ] })
2045
+ return /* @__PURE__ */ jsx13(Card, { className: "min-h-0 gap-0 overflow-hidden py-0", children: /* @__PURE__ */ jsx13(CardContent, { className: "min-h-0 flex-1 overflow-hidden px-0", children: rows.length === 0 ? /* @__PURE__ */ jsx13("p", { className: "px-5 py-4 text-sm text-muted-foreground", children: labels.noResults }) : /* @__PURE__ */ jsx13("div", { className: "h-full overflow-auto", children: /* @__PURE__ */ jsxs8("table", { className: "w-full min-w-[940px] text-sm", children: [
2046
+ /* @__PURE__ */ jsx13("thead", { className: "sticky top-0 z-10 bg-card", children: /* @__PURE__ */ jsxs8("tr", { className: "border-b text-left text-xs uppercase tracking-[0.12em] text-muted-foreground", children: [
2047
+ /* @__PURE__ */ jsx13("th", { className: "px-5 py-2.5 font-medium", children: getGroupByLabel(groupBy) }),
2048
+ /* @__PURE__ */ jsx13("th", { className: "px-3 py-2.5 text-right font-medium", children: getUsageSummaryLabel(labels, metricKind, dimension) }),
2049
+ /* @__PURE__ */ jsx13("th", { className: "px-3 py-2.5 text-right font-medium", children: "Share" }),
2050
+ /* @__PURE__ */ jsx13("th", { className: "px-3 py-2.5 text-right font-medium", children: "Calls" }),
2051
+ /* @__PURE__ */ jsx13("th", { className: "px-3 py-2.5 text-right font-medium", children: "Input" }),
2052
+ /* @__PURE__ */ jsx13("th", { className: "px-3 py-2.5 text-right font-medium", children: "Output" }),
2053
+ /* @__PURE__ */ jsx13("th", { className: "px-3 py-2.5 text-right font-medium", children: "Reasoning" }),
2054
+ /* @__PURE__ */ jsx13("th", { className: "px-3 py-2.5 text-right font-medium", children: "Cache read" }),
2055
+ /* @__PURE__ */ jsx13("th", { className: "px-5 py-2.5 text-right font-medium", children: "Avg/call" })
2078
2056
  ] }) }),
2079
- /* @__PURE__ */ jsx13(CardContent, { className: "min-h-0 flex-1 overflow-hidden px-0", children: rows.length === 0 ? /* @__PURE__ */ jsx13("p", { className: "px-5 py-4 text-sm text-muted-foreground", children: labels.noResults }) : /* @__PURE__ */ jsx13("div", { className: "h-full overflow-auto", children: /* @__PURE__ */ jsxs8("table", { className: "w-full min-w-[940px] text-sm", children: [
2080
- /* @__PURE__ */ jsx13("thead", { className: "sticky top-0 z-10 bg-card", children: /* @__PURE__ */ jsxs8("tr", { className: "border-b text-left text-xs uppercase tracking-[0.12em] text-muted-foreground", children: [
2081
- /* @__PURE__ */ jsx13("th", { className: "px-5 py-2.5 font-medium", children: getGroupByLabel(groupBy) }),
2082
- /* @__PURE__ */ jsx13("th", { className: "px-3 py-2.5 text-right font-medium", children: getUsageSummaryLabel(labels, metricKind, dimension) }),
2083
- /* @__PURE__ */ jsx13("th", { className: "px-3 py-2.5 text-right font-medium", children: "Share" }),
2084
- /* @__PURE__ */ jsx13("th", { className: "px-3 py-2.5 text-right font-medium", children: "Calls" }),
2085
- /* @__PURE__ */ jsx13("th", { className: "px-3 py-2.5 text-right font-medium", children: "Input" }),
2086
- /* @__PURE__ */ jsx13("th", { className: "px-3 py-2.5 text-right font-medium", children: "Output" }),
2087
- /* @__PURE__ */ jsx13("th", { className: "px-3 py-2.5 text-right font-medium", children: "Reasoning" }),
2088
- /* @__PURE__ */ jsx13("th", { className: "px-3 py-2.5 text-right font-medium", children: "Cache read" }),
2089
- /* @__PURE__ */ jsx13("th", { className: "px-5 py-2.5 text-right font-medium", children: "Avg/call" })
2090
- ] }) }),
2091
- /* @__PURE__ */ jsx13("tbody", { children: rows.slice(0, 60).map((row) => {
2092
- const share = totalValue > 0 ? row.value / totalValue : 0;
2093
- return /* @__PURE__ */ jsxs8(
2094
- "tr",
2095
- {
2096
- className: cn(
2097
- "border-b last:border-0",
2098
- filterable && "cursor-pointer transition-colors hover:bg-muted/50"
2099
- ),
2100
- onClick: () => filterable && onRowFilter(row),
2101
- children: [
2102
- /* @__PURE__ */ jsxs8("td", { className: "px-5 py-3", children: [
2103
- /* @__PURE__ */ jsx13("div", { className: "max-w-80 truncate font-medium", children: row.groupLabel }),
2104
- row.groupKey !== row.groupLabel && /* @__PURE__ */ jsx13("div", { className: "mt-0.5 max-w-80 truncate text-xs text-muted-foreground", children: row.groupKey })
2105
- ] }),
2106
- /* @__PURE__ */ jsx13("td", { className: "px-3 py-3 text-right font-medium", children: formatMetricValue(row.value, metricKind) }),
2107
- /* @__PURE__ */ jsx13("td", { className: "px-3 py-3 text-right", children: formatPercent(share) }),
2108
- /* @__PURE__ */ jsx13("td", { className: "px-3 py-3 text-right", children: formatNumber(row.totalCalls) }),
2109
- /* @__PURE__ */ jsx13("td", { className: "px-3 py-3 text-right", children: formatMetricValue(
2110
- getUsageTotalValue(row, metricKind, "input"),
2111
- metricKind
2112
- ) }),
2113
- /* @__PURE__ */ jsx13("td", { className: "px-3 py-3 text-right", children: formatMetricValue(
2114
- getUsageTotalValue(row, metricKind, "output"),
2115
- metricKind
2116
- ) }),
2117
- /* @__PURE__ */ jsx13("td", { className: "px-3 py-3 text-right", children: formatMetricValue(
2118
- getUsageTotalValue(row, metricKind, "reasoning"),
2119
- metricKind
2120
- ) }),
2121
- /* @__PURE__ */ jsx13("td", { className: "px-3 py-3 text-right", children: formatMetricValue(
2122
- getUsageTotalValue(row, metricKind, "cacheRead"),
2123
- metricKind
2124
- ) }),
2125
- /* @__PURE__ */ jsx13("td", { className: "px-5 py-3 text-right", children: formatMetricValue(
2126
- row.totalCalls > 0 ? row.value / row.totalCalls : 0,
2127
- metricKind
2128
- ) })
2129
- ]
2130
- },
2131
- row.groupKey
2132
- );
2133
- }) })
2134
- ] }) }) })
2135
- ] });
2057
+ /* @__PURE__ */ jsx13("tbody", { children: rows.slice(0, 60).map((row) => {
2058
+ const share = totalValue > 0 ? row.value / totalValue : 0;
2059
+ return /* @__PURE__ */ jsxs8(
2060
+ "tr",
2061
+ {
2062
+ className: cn(
2063
+ "border-b last:border-0",
2064
+ filterable && "cursor-pointer transition-colors hover:bg-muted/50"
2065
+ ),
2066
+ onClick: () => filterable && onRowFilter(row),
2067
+ children: [
2068
+ /* @__PURE__ */ jsxs8("td", { className: "px-5 py-3", children: [
2069
+ /* @__PURE__ */ jsx13("div", { className: "max-w-80 truncate font-medium", children: row.groupLabel }),
2070
+ row.groupKey !== row.groupLabel && /* @__PURE__ */ jsx13("div", { className: "mt-0.5 max-w-80 truncate text-xs text-muted-foreground", children: row.groupKey })
2071
+ ] }),
2072
+ /* @__PURE__ */ jsx13("td", { className: "px-3 py-3 text-right font-medium", children: formatMetricValue(row.value, metricKind) }),
2073
+ /* @__PURE__ */ jsx13("td", { className: "px-3 py-3 text-right", children: formatPercent(share) }),
2074
+ /* @__PURE__ */ jsx13("td", { className: "px-3 py-3 text-right", children: formatNumber(row.totalCalls) }),
2075
+ /* @__PURE__ */ jsx13("td", { className: "px-3 py-3 text-right", children: formatMetricValue(
2076
+ getUsageTotalValue(row, metricKind, "input"),
2077
+ metricKind
2078
+ ) }),
2079
+ /* @__PURE__ */ jsx13("td", { className: "px-3 py-3 text-right", children: formatMetricValue(
2080
+ getUsageTotalValue(row, metricKind, "output"),
2081
+ metricKind
2082
+ ) }),
2083
+ /* @__PURE__ */ jsx13("td", { className: "px-3 py-3 text-right", children: formatMetricValue(
2084
+ getUsageTotalValue(row, metricKind, "reasoning"),
2085
+ metricKind
2086
+ ) }),
2087
+ /* @__PURE__ */ jsx13("td", { className: "px-3 py-3 text-right", children: formatMetricValue(
2088
+ getUsageTotalValue(row, metricKind, "cacheRead"),
2089
+ metricKind
2090
+ ) }),
2091
+ /* @__PURE__ */ jsx13("td", { className: "px-5 py-3 text-right", children: formatMetricValue(
2092
+ row.totalCalls > 0 ? row.value / row.totalCalls : 0,
2093
+ metricKind
2094
+ ) })
2095
+ ]
2096
+ },
2097
+ row.groupKey
2098
+ );
2099
+ }) })
2100
+ ] }) }) }) });
2136
2101
  }
2137
2102
  function DashboardHeaderControls({
2138
2103
  attribution,
@@ -2258,7 +2223,7 @@ function InlineFilters({
2258
2223
  setThreadId,
2259
2224
  threadId
2260
2225
  }) {
2261
- return /* @__PURE__ */ jsxs8("div", { className: "flex max-w-full flex-wrap items-end justify-end gap-2", children: [
2226
+ return /* @__PURE__ */ jsxs8("div", { className: "flex min-w-[min(100%,520px)] flex-1 flex-wrap items-end justify-end gap-2", children: [
2262
2227
  /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2 pb-1 text-xs font-medium text-muted-foreground", children: [
2263
2228
  /* @__PURE__ */ jsx13(Filter, { className: "size-3.5" }),
2264
2229
  /* @__PURE__ */ jsx13("span", { children: "Filters" }),
@@ -2354,57 +2319,66 @@ function InlineFilters({
2354
2319
  ] });
2355
2320
  }
2356
2321
  function HeaderSelect(props) {
2357
- return /* @__PURE__ */ jsxs8(Select, { value: props.value, onValueChange: props.onValueChange, children: [
2358
- /* @__PURE__ */ jsx13(
2359
- SelectTrigger,
2360
- {
2361
- "aria-label": props.label,
2362
- className: cn("h-8 bg-background text-xs", props.width),
2363
- children: /* @__PURE__ */ jsx13(SelectValue, {})
2364
- }
2365
- ),
2366
- /* @__PURE__ */ jsx13(SelectContent, { children: props.options.map(([value, label]) => /* @__PURE__ */ jsx13(SelectItem, { value, children: label }, value)) })
2367
- ] });
2368
- }
2369
- function UsageSelect(props) {
2370
- return /* @__PURE__ */ jsxs8("label", { className: cn("space-y-1", props.compact && "w-[116px]"), children: [
2371
- /* @__PURE__ */ jsx13("span", { className: "sr-only", children: props.label }),
2322
+ return /* @__PURE__ */ jsxs8(Tooltip, { children: [
2372
2323
  /* @__PURE__ */ jsxs8(Select, { value: props.value, onValueChange: props.onValueChange, children: [
2373
- /* @__PURE__ */ jsx13(
2324
+ /* @__PURE__ */ jsx13(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx13(
2374
2325
  SelectTrigger,
2375
2326
  {
2376
2327
  "aria-label": props.label,
2377
- className: cn(
2378
- "w-full min-w-0 bg-background",
2379
- props.compact ? "h-8 text-xs" : "h-9"
2380
- ),
2328
+ className: cn("h-8 bg-background text-xs", props.width),
2381
2329
  children: /* @__PURE__ */ jsx13(SelectValue, {})
2382
2330
  }
2383
- ),
2331
+ ) }),
2384
2332
  /* @__PURE__ */ jsx13(SelectContent, { children: props.options.map(([value, label]) => /* @__PURE__ */ jsx13(SelectItem, { value, children: label }, value)) })
2385
- ] })
2333
+ ] }),
2334
+ /* @__PURE__ */ jsx13(TooltipContent, { children: props.label })
2335
+ ] });
2336
+ }
2337
+ function UsageSelect(props) {
2338
+ return /* @__PURE__ */ jsxs8(Tooltip, { children: [
2339
+ /* @__PURE__ */ jsxs8("label", { className: cn("space-y-1", props.compact && "w-[116px]"), children: [
2340
+ /* @__PURE__ */ jsx13("span", { className: "sr-only", children: props.label }),
2341
+ /* @__PURE__ */ jsxs8(Select, { value: props.value, onValueChange: props.onValueChange, children: [
2342
+ /* @__PURE__ */ jsx13(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx13(
2343
+ SelectTrigger,
2344
+ {
2345
+ "aria-label": props.label,
2346
+ className: cn(
2347
+ "w-full min-w-0 bg-background",
2348
+ props.compact ? "h-8 text-xs" : "h-9"
2349
+ ),
2350
+ children: /* @__PURE__ */ jsx13(SelectValue, {})
2351
+ }
2352
+ ) }),
2353
+ /* @__PURE__ */ jsx13(SelectContent, { children: props.options.map(([value, label]) => /* @__PURE__ */ jsx13(SelectItem, { value, children: label }, value)) })
2354
+ ] })
2355
+ ] }),
2356
+ /* @__PURE__ */ jsx13(TooltipContent, { children: props.label })
2386
2357
  ] });
2387
2358
  }
2388
2359
  function FilterInput(props) {
2389
- return /* @__PURE__ */ jsxs8("label", { className: cn("space-y-1", props.compact && "w-[150px]"), children: [
2390
- /* @__PURE__ */ jsx13("span", { className: "sr-only", children: props.label }),
2391
- /* @__PURE__ */ jsxs8("div", { className: "relative", children: [
2392
- props.icon && /* @__PURE__ */ jsx13("span", { className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground", children: props.icon }),
2393
- /* @__PURE__ */ jsx13(
2394
- Input,
2395
- {
2396
- "aria-label": props.label,
2397
- className: cn(
2398
- "bg-background",
2399
- props.compact ? "h-8 text-xs" : "h-9",
2400
- props.icon && "pl-8"
2401
- ),
2402
- onChange: (event) => props.onChange(event.target.value),
2403
- type: props.type ?? "text",
2404
- value: props.value
2405
- }
2406
- )
2407
- ] })
2360
+ return /* @__PURE__ */ jsxs8(Tooltip, { children: [
2361
+ /* @__PURE__ */ jsxs8("label", { className: cn("space-y-1", props.compact && "w-[150px]"), children: [
2362
+ /* @__PURE__ */ jsx13("span", { className: "sr-only", children: props.label }),
2363
+ /* @__PURE__ */ jsx13(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs8("div", { className: "relative", children: [
2364
+ props.icon && /* @__PURE__ */ jsx13("span", { className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground", children: props.icon }),
2365
+ /* @__PURE__ */ jsx13(
2366
+ Input,
2367
+ {
2368
+ "aria-label": props.label,
2369
+ className: cn(
2370
+ "bg-background",
2371
+ props.compact ? "h-8 text-xs" : "h-9",
2372
+ props.icon && "pl-8"
2373
+ ),
2374
+ onChange: (event) => props.onChange(event.target.value),
2375
+ type: props.type ?? "text",
2376
+ value: props.value
2377
+ }
2378
+ )
2379
+ ] }) })
2380
+ ] }),
2381
+ /* @__PURE__ */ jsx13(TooltipContent, { children: props.label })
2408
2382
  ] });
2409
2383
  }
2410
2384
  function EmptyDashboard({