Skip to content

Commit 0face46

Browse files
Merge pull request #1228 from Evsdrg/fix/spinner-tree-local-agent-tokens
fix: showSpinnerTree 模式下保留 local-agent token 显示
2 parents d451e30 + e7070e0 commit 0face46

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

src/components/Spinner.tsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,22 @@ function SpinnerWithVerbInner({
210210
const hasRunningTeammates = runningTeammates.length > 0;
211211
const allIdle = hasRunningTeammates && runningTeammates.every(t => t.isIdle);
212212

213-
// Gather aggregate token stats from all running swarm teammates
214-
// In spinner-tree mode, skip aggregation (teammates have their own lines in the tree)
213+
// Gather aggregate token stats from all running agents.
214+
// In spinner-tree mode, skip in-process teammates (they have their own
215+
// per-teammate lines in the tree) but still count local-agent tasks
216+
// (background agents) which have no dedicated tree rows.
215217
let teammateTokens = 0;
216-
if (!showSpinnerTree) {
217-
for (const task of Object.values(tasks)) {
218-
if (task.status === 'running' && (isInProcessTeammateTask(task) || isLocalAgentTask(task))) {
219-
if (task.progress?.tokenCount) {
220-
teammateTokens += task.progress.tokenCount;
221-
}
218+
for (const task of Object.values(tasks)) {
219+
if (task.status !== 'running') continue;
220+
if (isInProcessTeammateTask(task)) {
221+
if (!showSpinnerTree && task.progress?.tokenCount) {
222+
teammateTokens += task.progress.tokenCount;
223+
}
224+
continue;
225+
}
226+
if (isLocalAgentTask(task)) {
227+
if (task.progress?.tokenCount) {
228+
teammateTokens += task.progress.tokenCount;
222229
}
223230
}
224231
}

0 commit comments

Comments
 (0)