fix(tui): use displayed cost in /cost and /tokens commands

Switch /cost and /tokens from session_cost+subagent_cost (raw sum) to
displayed_session_cost_for_currency so the numbers match the footer and
sidebar UI, which apply the high-water mark for consistency.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
lbcheng
2026-05-08 19:31:30 +08:00
parent 53076e23f2
commit d24abd97ac
+2 -4
View File
@@ -74,8 +74,7 @@ pub fn tokens(app: &mut App) -> CommandResult {
.replace(
"{cost}",
&app.format_cost_amount_precise(
app.session_cost_for_currency(app.cost_currency)
+ app.subagent_cost_for_currency(app.cost_currency),
app.displayed_session_cost_for_currency(app.cost_currency),
),
)
.replace("{api_messages}", &message_count.to_string())
@@ -86,8 +85,7 @@ pub fn tokens(app: &mut App) -> CommandResult {
/// Show session cost breakdown
pub fn cost(app: &mut App) -> CommandResult {
let total = app.session_cost_for_currency(app.cost_currency)
+ app.subagent_cost_for_currency(app.cost_currency);
let total = app.displayed_session_cost_for_currency(app.cost_currency);
let report = tr(app.ui_locale, MessageId::CmdCostReport).replace(
"{cost}",
&app.format_cost_amount_precise(total),