/** Token cost card sub-component for WorkItemDetailPanel. */ import type { AgentCostEntry, TokenCostResponse } from "../api/client"; /** Renders the "Token Cost" card in the detail panel. */ export function TokenCostSection({ tokenCost, }: { tokenCost: TokenCostResponse | null; }) { return (
Token Cost
{tokenCost && tokenCost.agents.length > 0 ? (
Total:{" "} ${tokenCost.total_cost_usd.toFixed(6)}
{tokenCost.agents.map((agent: AgentCostEntry) => (
{agent.agent_name} {agent.model ? ( {` (${agent.model})`} ) : null} ${agent.total_cost_usd.toFixed(6)}
in {agent.input_tokens.toLocaleString()} / out{" "} {agent.output_tokens.toLocaleString()} {(agent.cache_creation_input_tokens > 0 || agent.cache_read_input_tokens > 0) && ( <> {" "} / cache + {agent.cache_creation_input_tokens.toLocaleString()}{" "} read {agent.cache_read_input_tokens.toLocaleString()} )}
))}
) : (
No token data recorded
)}
); }