Problem
src/tui/hooks/usePlanTree.ts has a stub implementation that always returns an empty plan array. The TUI Plans pane shows "No plans loaded" regardless of what's indexed.
Current behavior
export function usePlanTree(pollIntervalMs = 3000): PlanNode[] {
const [plans, setPlans] = useState<PlanNode[]>([]);
useEffect(() => {
setPlans([]);
const interval = setInterval(() => {
// TODO: integrate with DB indexer
}, pollIntervalMs);
return () => clearInterval(interval);
}, [pollIntervalMs]);
return plans;
}
Expected behavior
The hook polls the DB indexer (or subscribes to file-watcher events) and returns a live tree of PlanNode[]. Each PlanNode contains id, name, status, and agents[] with real statuses from the agent frontmatter.
Acceptance criteria
Files to modify
src/tui/hooks/usePlanTree.ts — implement DB polling
src/tui/app.tsx — pass DB context or config to the hook
tests/tui/hooks.test.ts — add tests with temp DB fixture
Related
src/indexer.ts — listPlans, listAgents query functions
src/acp/session-manager.ts — status_updated event to trigger re-poll
Problem
src/tui/hooks/usePlanTree.tshas a stub implementation that always returns an empty plan array. The TUI Plans pane shows "No plans loaded" regardless of what's indexed.Current behavior
Expected behavior
The hook polls the DB indexer (or subscribes to file-watcher events) and returns a live tree of
PlanNode[]. EachPlanNodecontainsid,name,status, andagents[]with real statuses from the agent frontmatter.Acceptance criteria
PlanNode.agentsreflects current agent statuses (GAP,WIP,PASS,BLOCKED)pollIntervalMswindow (default 3s)update_statuscalls trigger a re-poll (viaAcpSessionManagerstatus_updatedevent)Files to modify
src/tui/hooks/usePlanTree.ts— implement DB pollingsrc/tui/app.tsx— pass DB context or config to the hooktests/tui/hooks.test.ts— add tests with temp DB fixtureRelated
src/indexer.ts—listPlans,listAgentsquery functionssrc/acp/session-manager.ts—status_updatedevent to trigger re-poll