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
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,
}