feat: unified sidebar with threads, tasks, and sub-agents#85
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The sidebar now shows a unified view of all concurrent work:
sessions_spawnChanges
send_threads_update()to query all three sourcestask_mgrparameter to the functionSessionManagerare included with status indicatorsTesting
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.