@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.cjs +122 -148
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +124 -150
- package/dist/index.js.map +1 -1
- package/dist/styles.css +11 -50
- package/package.json +1 -1
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
|
|
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-
|
|
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-
|
|
1869
|
-
/* @__PURE__ */ jsxs8("div", { className: "min-w-
|
|
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__ */
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
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
|
-
|
|
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__ */
|
|
2071
|
-
/* @__PURE__ */ jsx13(
|
|
2072
|
-
/* @__PURE__ */ jsx13(
|
|
2073
|
-
/* @__PURE__ */
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
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(
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
className:
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
children:
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
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
|
|
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(
|
|
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(
|
|
2390
|
-
/* @__PURE__ */
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
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({
|