From cb75b7c2a4269f6e1b8577d618989378bd0abd8a Mon Sep 17 00:00:00 2001 From: HiranoMasaaki Date: Fri, 20 Feb 2026 02:27:07 +0000 Subject: [PATCH 1/2] fix: show running and waiting counts separately in status line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, suspending experts (waiting for delegates) were counted as "in progress" alongside running experts, making the status line misleading. Now displays "1 running · 3 waiting" instead of "4 in progress experts". Co-Authored-By: Claude Opus 4.6 --- packages/tui-components/src/execution/app.tsx | 3 ++- .../src/execution/components/interface-panel.tsx | 9 ++++++--- .../execution/hooks/use-delegation-tree.test.ts | 8 ++++---- .../src/execution/hooks/use-delegation-tree.ts | 15 ++++++++++----- .../src/execution/hooks/use-execution-state.ts | 6 ++++-- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/packages/tui-components/src/execution/app.tsx b/packages/tui-components/src/execution/app.tsx index 762097c1..c421eddd 100644 --- a/packages/tui-components/src/execution/app.tsx +++ b/packages/tui-components/src/execution/app.tsx @@ -72,7 +72,8 @@ export const ExecutionApp = (props: ExecutionAppProps) => { runStatus={state.runStatus} onSubmit={state.handleSubmit} delegationTreeState={state.delegationTreeState} - inProgressCount={state.inProgressCount} + runningCount={state.runningCount} + waitingCount={state.waitingCount} formattedTotalTokens={state.formattedTotalTokens} elapsedTime={state.elapsedTime} /> diff --git a/packages/tui-components/src/execution/components/interface-panel.tsx b/packages/tui-components/src/execution/components/interface-panel.tsx index 1f1b9f69..2a11cd34 100644 --- a/packages/tui-components/src/execution/components/interface-panel.tsx +++ b/packages/tui-components/src/execution/components/interface-panel.tsx @@ -11,7 +11,8 @@ type InterfacePanelProps = { runStatus: RunStatus onSubmit: (query: string) => void delegationTreeState: DelegationTreeState - inProgressCount: number + runningCount: number + waitingCount: number formattedTotalTokens: string elapsedTime: string } @@ -21,7 +22,8 @@ export const InterfacePanel = ({ runStatus, onSubmit, delegationTreeState, - inProgressCount, + runningCount, + waitingCount, formattedTotalTokens, elapsedTime, }: InterfacePanelProps): React.ReactNode => { @@ -53,7 +55,8 @@ export const InterfacePanel = ({ {query || "–"} - {inProgressCount} in progress experts + {runningCount} running + {waitingCount > 0 ? · {waitingCount} waiting : null} · {elapsedTime} · diff --git a/packages/tui-components/src/execution/hooks/use-delegation-tree.test.ts b/packages/tui-components/src/execution/hooks/use-delegation-tree.test.ts index b8e877de..ac7050a9 100644 --- a/packages/tui-components/src/execution/hooks/use-delegation-tree.test.ts +++ b/packages/tui-components/src/execution/hooks/use-delegation-tree.test.ts @@ -5,7 +5,7 @@ import { deriveActionLabel, flattenTree, formatTokenCount, - getInProgressCount, + getStatusCounts, processDelegationTreeEvent, resolveRunId, } from "./use-delegation-tree.js" @@ -1165,8 +1165,8 @@ describe("flattenTree", () => { }) }) -describe("getInProgressCount", () => { - it("counts running and suspending nodes", () => { +describe("getStatusCounts", () => { + it("counts running and waiting nodes separately", () => { const state = createInitialDelegationTreeState() processDelegationTreeEvent( state, @@ -1225,6 +1225,6 @@ describe("getInProgressCount", () => { }), ) // run-1 = suspending, run-2 = completed, run-3 = running - expect(getInProgressCount(state)).toBe(2) + expect(getStatusCounts(state)).toEqual({ running: 1, waiting: 1 }) }) }) diff --git a/packages/tui-components/src/execution/hooks/use-delegation-tree.ts b/packages/tui-components/src/execution/hooks/use-delegation-tree.ts index 0feacadb..df674a54 100644 --- a/packages/tui-components/src/execution/hooks/use-delegation-tree.ts +++ b/packages/tui-components/src/execution/hooks/use-delegation-tree.ts @@ -106,12 +106,17 @@ export function formatTokenCount(n: number): string { return String(n) } -export function getInProgressCount(state: DelegationTreeState): number { - let count = 0 +export function getStatusCounts(state: DelegationTreeState): { + running: number + waiting: number +} { + let running = 0 + let waiting = 0 for (const node of state.nodes.values()) { - if (node.status === "running" || node.status === "suspending") count++ + if (node.status === "running") running++ + else if (node.status === "suspending") waiting++ } - return count + return { running, waiting } } export function flattenTree(state: DelegationTreeState): FlatTreeNode[] { @@ -393,7 +398,7 @@ export function useDelegationTree() { return { state, processEvent, - inProgressCount: getInProgressCount(state), + statusCounts: getStatusCounts(state), formattedTotalTokens: formatTokenCount(state.jobTotalTokens), } } diff --git a/packages/tui-components/src/execution/hooks/use-execution-state.ts b/packages/tui-components/src/execution/hooks/use-execution-state.ts index 7ab437f8..673f46ec 100644 --- a/packages/tui-components/src/execution/hooks/use-execution-state.ts +++ b/packages/tui-components/src/execution/hooks/use-execution-state.ts @@ -37,7 +37,8 @@ export type ExecutionState = { runStatus: RunStatus handleSubmit: (query: string) => void delegationTreeState: DelegationTreeState - inProgressCount: number + runningCount: number + waitingCount: number formattedTotalTokens: string elapsedTime: string } @@ -169,7 +170,8 @@ export const useExecutionState = (options: UseExecutionStateOptions): ExecutionS runStatus, handleSubmit, delegationTreeState: delegationTree.state, - inProgressCount: delegationTree.inProgressCount, + runningCount: delegationTree.statusCounts.running, + waitingCount: delegationTree.statusCounts.waiting, formattedTotalTokens: delegationTree.formattedTotalTokens, elapsedTime, } From 31fee53628e94c3c846f339b9f4c772ddbdff810 Mon Sep 17 00:00:00 2001 From: HiranoMasaaki Date: Fri, 20 Feb 2026 02:28:50 +0000 Subject: [PATCH 2/2] chore: add changeset for tui-components patch Co-Authored-By: Claude Opus 4.6 --- .changeset/fix-status-line-counts.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fix-status-line-counts.md diff --git a/.changeset/fix-status-line-counts.md b/.changeset/fix-status-line-counts.md new file mode 100644 index 00000000..22d1f139 --- /dev/null +++ b/.changeset/fix-status-line-counts.md @@ -0,0 +1,5 @@ +--- +"@perstack/tui-components": patch +--- + +Show running and waiting expert counts separately in status line