Skip to content

feat(tui): add Tasks panel with PanelProvider registry architecture#117

Merged
yishuiliunian merged 2 commits intomainfrom
worktree-luminous-beaming-beaver
Apr 16, 2026
Merged

feat(tui): add Tasks panel with PanelProvider registry architecture#117
yishuiliunian merged 2 commits intomainfrom
worktree-luminous-beaming-beaver

Conversation

@yishuiliunian
Copy link
Copy Markdown
Contributor

Summary

  • Add a Tasks panel to the TUI panel zone, displaying TaskCreate/TaskUpdate progress alongside Agents and BgTasks panels
  • Introduce PanelProvider registry architecture — unified trait + registry replaces per-kind dispatch in navigation, rendering, and sync
  • Implement session state cleanup to prevent unbounded memory growth in long-running sessions (auto-evicts finished agents, completed bg_tasks)

Changes

Event pipeline (new)

  • loopal-protocol: TaskSnapshot type + TasksChanged event variant
  • loopal-agent: TaskStore subscribe/notify for change detection (pure persistence, no protocol dep)
  • loopal-agent-server: TaskBridge converts store changes → TasksChanged events via frontend
  • loopal-session: task_state.rs handles TasksChangedSessionState.task_snapshots

Panel architecture (refactored)

  • PanelProvider trait (kind, max_visible, item_ids, height, render) replaces old PanelSection trait
  • PanelRegistry holds registered providers; panel_ops and render iterate over it
  • providers/ directory: AgentPanelProvider, TasksPanelProvider, BgTasksPanelProvider
  • PanelSectionState unifies focus/scroll per panel (replaces scattered focused_agent, focused_bg_task, etc.)
  • Adding a new panel type = 1 provider file + 1 register call + 1 PanelKind variant (3 files, zero changes to panel_ops/render/tui_loop)

Session cleanup (new)

  • session_cleanup.rs: removes completed bg_tasks from session state each frame
  • Finished sub-agents (with persisted session_id) removed from state.agents
  • bg_task_details uses merge-and-retain pattern (capped at 50) so log viewer still works
  • BgTasks panel now shows Running tasks only (completed hidden immediately)

Other fixes

  • Removed dead viewing indicator (▶) from agent panel (was unreachable)
  • BgTask/TasksChanged events now return early in agent_handler (skip post_event_cleanup)
  • Task subjects sanitized (newlines replaced with spaces)
  • Scroll offset clamped each frame to prevent stale offset after items disappear

Test plan

  • bazel build //... compiles
  • bazel build //... --config=clippy zero warnings
  • bazel test //... — 52/52 pass (includes new task_state, tasks_panel, enter_panel, panel_tab tests)

…113)

Structured tasks (TaskCreate/TaskUpdate) are now displayed in a dedicated
panel alongside Agents and BgTasks, with a unified PanelProvider registry
that drives navigation, rendering, and lifecycle cleanup.

Event pipeline: TaskStore → TaskBridge → TasksChanged → SessionState → TUI.
Panel system: PanelProvider trait + PanelRegistry replaces per-kind dispatch.
Cleanup: session state auto-evicts finished agents, completed bg_tasks, and
completed tasks to prevent unbounded growth in long-running sessions.
@yishuiliunian yishuiliunian merged commit 93f9996 into main Apr 16, 2026
4 checks passed
@yishuiliunian yishuiliunian deleted the worktree-luminous-beaming-beaver branch April 16, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant