fix: improve subagent UI display and interruption handling (#330)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2025-12-21 00:09:12 -08:00
committed by GitHub
parent 90d84482ef
commit 0852ce26fe
14 changed files with 161 additions and 29 deletions

View File

@@ -8,7 +8,7 @@
* Format tool count and token statistics for display
*
* @param toolCount - Number of tool calls
* @param totalTokens - Total tokens used
* @param totalTokens - Total tokens used (0 or undefined means no data available)
* @param isRunning - If true, shows "—" for tokens (since usage is only available at end)
*/
export function formatStats(
@@ -16,12 +16,19 @@ export function formatStats(
totalTokens: number,
isRunning = false,
): string {
const tokenStr = isRunning
? "—"
: totalTokens >= 1000
const toolStr = `${toolCount} tool use${toolCount !== 1 ? "s" : ""}`;
// Only show token count if we have actual data (not running and totalTokens > 0)
const hasTokenData = !isRunning && totalTokens > 0;
if (!hasTokenData) {
return toolStr;
}
const tokenStr =
totalTokens >= 1000
? `${(totalTokens / 1000).toFixed(1)}k`
: String(totalTokens);
return `${toolCount} tool use${toolCount !== 1 ? "s" : ""} · ${tokenStr} tokens`;
return `${toolStr} · ${tokenStr} tokens`;
}
/**