style(desktop): apply Biome formatting to agent-usage files

Main's Biome version rewraps lines differently than the version this
branch was written against, so the post-merge tree failed the desktop
lint and format gate. Formatter output only; no logic changes.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7
2026-07-29 18:18:40 -04:00
co-authored by Will Pfleger
parent 1e865b5b0b
commit 0bd3b7d0a3
3 changed files with 24 additions and 20 deletions
@@ -453,7 +453,8 @@ test("sortAgentsByDisplayTotal handles mixed exact/approximate/unknown populatio
const agents = [
agentUsage("u1", null), // unknown
agentUsage("e1", "100"), // exact
agentUsage("a1", null, { // approximate
agentUsage("a1", null, {
// approximate
usage: reportedUsage({
inputTokens: usageField({ value: "400" }),
outputTokens: usageField({ value: "100" }),
@@ -461,7 +462,8 @@ test("sortAgentsByDisplayTotal handles mixed exact/approximate/unknown populatio
}),
agentUsage("u2", null), // unknown
agentUsage("e2", "300"), // exact
agentUsage("a2", null, { // approximate
agentUsage("a2", null, {
// approximate
usage: reportedUsage({
inputTokens: usageField({ value: "150" }),
outputTokens: usageField({ value: "50" }),
@@ -220,7 +220,11 @@ export function deriveDisplayTotal(usage: {
}): DisplayTotal {
const exact = parseTokenCount(usage.totalTokens.value);
if (exact !== null) {
return { kind: "exact", value: exact, partial: isPartialField(usage.totalTokens) };
return {
kind: "exact",
value: exact,
partial: isPartialField(usage.totalTokens),
};
}
const input = parseTokenCount(usage.inputTokens.value);
const output = parseTokenCount(usage.outputTokens.value);
@@ -228,7 +232,8 @@ export function deriveDisplayTotal(usage: {
return {
kind: "approximate",
value: input + output,
partial: isPartialField(usage.inputTokens) || isPartialField(usage.outputTokens),
partial:
isPartialField(usage.inputTokens) || isPartialField(usage.outputTokens),
};
}
return { kind: "unknown", value: null, partial: false };
@@ -259,7 +264,11 @@ function tierOf(dt: DisplayTotal): DisplayTierKey {
*/
function rankByDisplayTotal<T>(
items: readonly T[],
getUsage: (item: T) => { inputTokens: UsageField; outputTokens: UsageField; totalTokens: UsageField },
getUsage: (item: T) => {
inputTokens: UsageField;
outputTokens: UsageField;
totalTokens: UsageField;
},
tiebreak: (a: T, b: T) => number,
): T[] {
const withDisplay: RankedWithDisplay<T>[] = items.map((item) => {
@@ -389,9 +398,9 @@ export function sumKnownBucketTotals(
buckets: readonly AgentUsageSeriesBucket[],
): DisplayTotal {
let sumValue = 0n;
let sawAny = false; // any report-bearing bucket processed
let anyApprox = false; // at least one approximate bucket contributed a value
let anyWithValue = false; // at least one bucket contributed a numeric value
let sawAny = false; // any report-bearing bucket processed
let anyApprox = false; // at least one approximate bucket contributed a value
let anyWithValue = false; // at least one bucket contributed a numeric value
let partial = false;
for (const bucket of buckets) {
@@ -205,8 +205,7 @@ function AgentUsageFocusedTotals({
agent: AgentUsageSeries["agents"][number];
coverage: AgentUsageSeries["coverage"];
}) {
const { estimatedCostUsd, inputTokens, outputTokens } =
agent.usage;
const { estimatedCostUsd, inputTokens, outputTokens } = agent.usage;
const models = sortModelsByDisplayTotal(agent.models);
// Each caveat sentence is gated only on the condition that proves it:
// - unknown-intervals sentence: direct i/o incompleteness — true when at
@@ -229,10 +228,7 @@ function AgentUsageFocusedTotals({
return (
<Card className="space-y-4 p-6" data-testid="agent-usage-focused-totals">
<div className="grid grid-cols-2 gap-4 sm:grid-cols-4">
<ApproxTokenStat
displayTotal={displayTotal}
label="Total tokens"
/>
<ApproxTokenStat displayTotal={displayTotal} label="Total tokens" />
<TokenStat field={inputTokens} label="Input tokens" />
<TokenStat field={outputTokens} label="Output tokens" />
<UsageStat
@@ -316,8 +312,8 @@ function AgentUsageFocusedTotals({
{coverage.invalidReportCount === 1
? "1 report"
: `${coverage.invalidReportCount} reports`}{" "}
excluded: reports with an unreadable timestamp or a cumulative
total missing its session are not assigned to any day.
excluded: reports with an unreadable timestamp or a cumulative total
missing its session are not assigned to any day.
</p>
) : null}
</div>
@@ -384,10 +380,7 @@ function UsageStat({
return (
<div className="space-y-1">
<p className="text-xs text-muted-foreground">{label}</p>
<p
className="text-lg font-semibold text-foreground"
data-testid={testId}
>
<p className="text-lg font-semibold text-foreground" data-testid={testId}>
{display ?? "—"}
</p>
{isPartial ? <Badge variant="outline">Partial</Badge> : null}