From f1400ffb7c988b564a8e2da2657e56f70a26026b Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Tue, 31 Mar 2026 06:14:04 +0000 Subject: [PATCH] remove cost logging from agent runs; extract secrets into own tab - stop capturing/displaying total_cost_usd from Claude CLI (theoretical cost is misleading for subscription users) - remove Cost column from action logs table and GitHub Job Summary - extract SecretsCard into its own sidebar tab with KeyRound icon - remove children prop from AgentSettingsSection Made-with: Cursor --- agents/claude.ts | 16 ++-------------- entry | 40 +++++++++++----------------------------- utils/log.ts | 34 +++++++++------------------------- 3 files changed, 22 insertions(+), 68 deletions(-) diff --git a/agents/claude.ts b/agents/claude.ts index 5eb8095..86566a3 100644 --- a/agents/claude.ts +++ b/agents/claude.ts @@ -189,7 +189,6 @@ async function runClaude(params: RunParams): Promise { let finalOutput = ""; let accumulatedTokens = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }; - let costUsd: number | undefined; let tokensLogged = false; function buildUsage(): AgentUsage | undefined { @@ -202,7 +201,6 @@ async function runClaude(params: RunParams): Promise { outputTokens: accumulatedTokens.output, cacheReadTokens: accumulatedTokens.cacheRead || undefined, cacheWriteTokens: accumulatedTokens.cacheWrite || undefined, - costUsd, } : undefined; } @@ -291,28 +289,18 @@ async function runClaude(params: RunParams): Promise { const totalInput = inputTokens + cacheRead + cacheWrite; accumulatedTokens = { input: inputTokens, output: outputTokens, cacheRead, cacheWrite }; - costUsd = event.total_cost_usd ?? undefined; - log.info( - `» ${params.label} result: subtype=${subtype}, turns=${numTurns}, cost=$${costUsd?.toFixed(4) ?? "?"}` - ); + log.info(`» ${params.label} result: subtype=${subtype}, turns=${numTurns}`); if (!tokensLogged) { log.table([ [ - { data: "Cost", header: true }, { data: "Input", header: true }, { data: "Cache Read", header: true }, { data: "Cache Write", header: true }, { data: "Output", header: true }, ], - [ - `$${costUsd?.toFixed(4) || "0.0000"}`, - String(totalInput), - String(cacheRead), - String(cacheWrite), - String(outputTokens), - ], + [String(totalInput), String(cacheRead), String(cacheWrite), String(outputTokens)], ]); tokensLogged = true; } diff --git a/entry b/entry index a3d5d4f..14d7688 100755 --- a/entry +++ b/entry @@ -107596,27 +107596,21 @@ function formatJsonValue(value2) { } function formatUsageSummary(entries) { if (entries.length === 0) return ""; - const hasCost = entries.some((e) => e.costUsd !== void 0); - const header = hasCost ? "| Agent | Input | Output | Cache Read | Cache Write | Cost |" : "| Agent | Input | Output | Cache Read | Cache Write |"; + const header = "| Agent | Input | Output | Cache Read | Cache Write |"; + const separatorRow = "| --- | ---: | ---: | ---: | ---: |"; const fmt = (n) => n.toLocaleString("en-US"); - const separatorRow = hasCost ? "| --- | ---: | ---: | ---: | ---: | ---: |" : "| --- | ---: | ---: | ---: | ---: |"; - const rows = entries.map((e) => { - const base = `| ${e.agent} | ${fmt(e.inputTokens)} | ${fmt(e.outputTokens)} | ${fmt(e.cacheReadTokens ?? 0)} | ${fmt(e.cacheWriteTokens ?? 0)} |`; - return hasCost ? `${base} ${e.costUsd !== void 0 ? `$${e.costUsd.toFixed(4)}` : "-"} |` : base; - }); + const rows = entries.map( + (e) => `| ${e.agent} | ${fmt(e.inputTokens)} | ${fmt(e.outputTokens)} | ${fmt(e.cacheReadTokens ?? 0)} | ${fmt(e.cacheWriteTokens ?? 0)} |` + ); const totalsRows = []; if (entries.length > 1) { const totalInput = entries.reduce((sum, e) => sum + e.inputTokens, 0); const totalOutput = entries.reduce((sum, e) => sum + e.outputTokens, 0); const totalCacheRead = entries.reduce((sum, e) => sum + (e.cacheReadTokens ?? 0), 0); const totalCacheWrite = entries.reduce((sum, e) => sum + (e.cacheWriteTokens ?? 0), 0); - const totalBase = `| **Total** | **${fmt(totalInput)}** | **${fmt(totalOutput)}** | **${fmt(totalCacheRead)}** | **${fmt(totalCacheWrite)}** |`; - if (hasCost) { - const totalCost = entries.reduce((sum, e) => sum + (e.costUsd ?? 0), 0); - totalsRows.push(`${totalBase} **$${totalCost.toFixed(4)}** |`); - } else { - totalsRows.push(totalBase); - } + totalsRows.push( + `| **Total** | **${fmt(totalInput)}** | **${fmt(totalOutput)}** | **${fmt(totalCacheRead)}** | **${fmt(totalCacheWrite)}** |` + ); } return [ "
", @@ -149453,7 +149447,6 @@ async function runClaude(params) { const thinkingTimer = new ThinkingTimer(); let finalOutput = ""; let accumulatedTokens = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }; - let costUsd; let tokensLogged = false; function buildUsage() { const totalInput = accumulatedTokens.input + accumulatedTokens.cacheRead + accumulatedTokens.cacheWrite; @@ -149462,8 +149455,7 @@ async function runClaude(params) { inputTokens: totalInput, outputTokens: accumulatedTokens.output, cacheReadTokens: accumulatedTokens.cacheRead || void 0, - cacheWriteTokens: accumulatedTokens.cacheWrite || void 0, - costUsd + cacheWriteTokens: accumulatedTokens.cacheWrite || void 0 } : void 0; } const handlers2 = { @@ -149526,26 +149518,16 @@ async function runClaude(params) { const outputTokens = usage?.output_tokens || 0; const totalInput = inputTokens + cacheRead + cacheWrite; accumulatedTokens = { input: inputTokens, output: outputTokens, cacheRead, cacheWrite }; - costUsd = event.total_cost_usd ?? void 0; - log.info( - `\xBB ${params.label} result: subtype=${subtype}, turns=${numTurns}, cost=$${costUsd?.toFixed(4) ?? "?"}` - ); + log.info(`\xBB ${params.label} result: subtype=${subtype}, turns=${numTurns}`); if (!tokensLogged) { log.table([ [ - { data: "Cost", header: true }, { data: "Input", header: true }, { data: "Cache Read", header: true }, { data: "Cache Write", header: true }, { data: "Output", header: true } ], - [ - `$${costUsd?.toFixed(4) || "0.0000"}`, - String(totalInput), - String(cacheRead), - String(cacheWrite), - String(outputTokens) - ] + [String(totalInput), String(cacheRead), String(cacheWrite), String(outputTokens)] ]); tokensLogged = true; } diff --git a/utils/log.ts b/utils/log.ts index 469e26c..43bd354 100644 --- a/utils/log.ts +++ b/utils/log.ts @@ -339,40 +339,24 @@ export function formatIndentedField(label: string, content: string): string { export function formatUsageSummary(entries: AgentUsage[]): string { if (entries.length === 0) return ""; - const hasCost = entries.some((e) => e.costUsd !== undefined); - - const header = hasCost - ? "| Agent | Input | Output | Cache Read | Cache Write | Cost |" - : "| Agent | Input | Output | Cache Read | Cache Write |"; - + const header = "| Agent | Input | Output | Cache Read | Cache Write |"; + const separatorRow = "| --- | ---: | ---: | ---: | ---: |"; const fmt = (n: number) => n.toLocaleString("en-US"); - const separatorRow = hasCost - ? "| --- | ---: | ---: | ---: | ---: | ---: |" - : "| --- | ---: | ---: | ---: | ---: |"; + const rows = entries.map( + (e) => + `| ${e.agent} | ${fmt(e.inputTokens)} | ${fmt(e.outputTokens)} | ${fmt(e.cacheReadTokens ?? 0)} | ${fmt(e.cacheWriteTokens ?? 0)} |` + ); - const rows = entries.map((e) => { - const base = `| ${e.agent} | ${fmt(e.inputTokens)} | ${fmt(e.outputTokens)} | ${fmt(e.cacheReadTokens ?? 0)} | ${fmt(e.cacheWriteTokens ?? 0)} |`; - return hasCost - ? `${base} ${e.costUsd !== undefined ? `$${e.costUsd.toFixed(4)}` : "-"} |` - : base; - }); - - // totals row (only useful when there are multiple entries) const totalsRows: string[] = []; if (entries.length > 1) { const totalInput = entries.reduce((sum, e) => sum + e.inputTokens, 0); const totalOutput = entries.reduce((sum, e) => sum + e.outputTokens, 0); const totalCacheRead = entries.reduce((sum, e) => sum + (e.cacheReadTokens ?? 0), 0); const totalCacheWrite = entries.reduce((sum, e) => sum + (e.cacheWriteTokens ?? 0), 0); - const totalBase = `| **Total** | **${fmt(totalInput)}** | **${fmt(totalOutput)}** | **${fmt(totalCacheRead)}** | **${fmt(totalCacheWrite)}** |`; - - if (hasCost) { - const totalCost = entries.reduce((sum, e) => sum + (e.costUsd ?? 0), 0); - totalsRows.push(`${totalBase} **$${totalCost.toFixed(4)}** |`); - } else { - totalsRows.push(totalBase); - } + totalsRows.push( + `| **Total** | **${fmt(totalInput)}** | **${fmt(totalOutput)}** | **${fmt(totalCacheRead)}** | **${fmt(totalCacheWrite)}** |` + ); } return [