Merge 200f8c0f0340c12181dca28a712a53436f09588b into 598f1826d8b2bc969aace2c6459824737667218c

This commit is contained in:
Stephen Schoettler 2026-03-20 20:20:15 -07:00 committed by GitHub
commit 9631548e8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 8 deletions

View File

@ -316,7 +316,7 @@ export async function launchOpenClawChrome(
args.push("about:blank");
return spawn(exe.path, args, {
stdio: "pipe",
stdio: ["ignore", "ignore", "ignore"],
env: {
...process.env,
// Reduce accidental sharing with the user's env.

View File

@ -769,22 +769,22 @@ export const usageHandlers: GatewayRequestHandlers = {
.toSorted((a, b) => b.count - a.count),
},
byModel: Array.from(byModelMap.values()).toSorted((a, b) => {
const costDiff = b.totals.totalCost - a.totals.totalCost;
const costDiff = (b.totals?.totalCost ?? 0) - (a.totals?.totalCost ?? 0);
if (costDiff !== 0) {
return costDiff;
}
return b.totals.totalTokens - a.totals.totalTokens;
return (b.totals?.totalTokens ?? 0) - (a.totals?.totalTokens ?? 0);
}),
byProvider: Array.from(byProviderMap.values()).toSorted((a, b) => {
const costDiff = b.totals.totalCost - a.totals.totalCost;
const costDiff = (b.totals?.totalCost ?? 0) - (a.totals?.totalCost ?? 0);
if (costDiff !== 0) {
return costDiff;
}
return b.totals.totalTokens - a.totals.totalTokens;
return (b.totals?.totalTokens ?? 0) - (a.totals?.totalTokens ?? 0);
}),
byAgent: Array.from(byAgentMap.entries())
.map(([id, totals]) => ({ agentId: id, totals }))
.toSorted((a, b) => b.totals.totalCost - a.totals.totalCost),
.toSorted((a, b) => (b.totals?.totalCost ?? 0) - (a.totals?.totalCost ?? 0)),
...tail,
};

View File

@ -707,11 +707,11 @@ export async function loadSessionCostSummary(params: {
const modelUsage = modelUsageMap.size
? Array.from(modelUsageMap.values()).toSorted((a, b) => {
const costDiff = b.totals.totalCost - a.totals.totalCost;
const costDiff = (b.totals?.totalCost ?? 0) - (a.totals?.totalCost ?? 0);
if (costDiff !== 0) {
return costDiff;
}
return b.totals.totalTokens - a.totals.totalTokens;
return (b.totals?.totalTokens ?? 0) - (a.totals?.totalTokens ?? 0);
})
: undefined;