Skip to content

feat: unified sidebar with threads, tasks, and sub-agents#85

Merged
rexlunae merged 6 commits intomainfrom
feat/unified-task-sidebar
Feb 27, 2026
Merged

feat: unified sidebar with threads, tasks, and sub-agents#85
rexlunae merged 6 commits intomainfrom
feat/unified-task-sidebar

Conversation

@rexlunae
Copy link
Owner

Summary

The sidebar now shows a unified view of all concurrent work:

  1. Chat threads (from ThreadManager) — conversation contexts the user can switch between
  2. Running tasks (from TaskManager) — background work with status tracking
  3. Sub-agent sessions (from SessionManager) — spawned workers from sessions_spawn

Changes

  • Modified send_threads_update() to query all three sources
  • Added task_mgr parameter to the function
  • Sub-agent sessions from SessionManager are included with status indicators
  • Terminal tasks/sessions older than 5 minutes are filtered out

Testing

All 345+ tests pass.

What this enables

When you ask the agent to spawn background work via sessions_spawn, those sub-agents will now appear in the sidebar with their status (Running, Completed, Failed, etc.) and description.

The sidebar now shows three types of items:
1. Chat threads (from ThreadManager) - conversation contexts
2. Running tasks (from TaskManager) - background work
3. Sub-agent sessions (from SessionManager) - spawned workers

send_threads_update() now queries all three sources and merges
them into a unified list for the TUI sidebar.

Terminal tasks/sessions older than 5 minutes are filtered out
to keep the sidebar clean.
- New tool: thread_describe - sets description of current thread
- Uses marker-based interception (THREAD_UPDATE_MARKER)
- Gateway intercepts marker and updates ThreadManager
- Sends ThreadsUpdate after description change
- Added set_foreground_description() to ThreadManager

This allows the agent to set/update thread descriptions dynamically,
which appear in the sidebar.
New module: threads/ - unified representation of all concurrent work

ThreadKind:
- Chat: user-interactive conversations
- SubAgent: spawned workers (ephemeral, autonomous)
- Background: long-running monitors
- Task: one-shot work that returns result

ThreadStatus:
- Active, Running (with progress), WaitingForInput
- Paused, Completed, Failed, Cancelled

ThreadManager:
- Create/manage all thread types
- Event emission on state changes (Created, StatusChanged, etc.)
- Foreground switching
- Context building from backgrounded threads
- Persistence to JSON
- Automatic cleanup of old ephemeral threads

ThreadEvent:
- Push-based notifications for sidebar updates
- triggers_sidebar_update() to filter relevant events

This unifies the previous split between TaskManager, ThreadManager,
and SessionManager into a single coherent model.
- rename(id, label) - change thread label
- find_best_match(content) - find thread matching message keywords
- task_id() alias on AgentThread for backwards compatibility

These are needed for gateway integration.
- Replace crate::tasks::ThreadManager with crate::threads::ThreadManager
- Replace TaskId with ThreadId throughout gateway
- Update concurrent.rs to use ThreadId
- Add compatibility methods: create_thread(), switch_to(), task_id()
- Add message methods: compaction_prompt(), apply_compaction(), build_context()
- Add TaskId type alias for backwards compatibility
- Fix ThreadInfoDto mapping for new ThreadInfo.status type

The old tasks::ThreadManager still exists but is no longer used by gateway.
Next step: remove it and clean up.
- Subscribe to ThreadManager events in connection handler
- Add select! branch to handle ThreadEvent messages
- Call send_threads_update() when event.triggers_sidebar_update() is true

This replaces periodic polling with event-driven updates. When a thread
status changes, the sidebar updates immediately without the TUI needing
to poll.
@rexlunae rexlunae merged commit e79ec13 into main Feb 27, 2026
16 checks passed
@rexlunae rexlunae deleted the feat/unified-task-sidebar branch February 27, 2026 00:30
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