Skip to content

Feat/agent task navigation#1

Open
ninime09 wants to merge 2 commits intoCherryHQ:mainfrom
ninime09:feat/agent-task-navigation
Open

Feat/agent task navigation#1
ninime09 wants to merge 2 commits intoCherryHQ:mainfrom
ninime09:feat/agent-task-navigation

Conversation

@ninime09
Copy link
Copy Markdown

@ninime09 ninime09 commented Apr 1, 2026

feat: Agent Multi-Task Navigation System & Complete Status Architecture

Background

Cherry Studio V2's Agent workspace needs to support users managing multiple AI task threads simultaneously. The existing design relied on a sidebar session list for task switching, lacking a top-level quick-navigation entry point. The task status system was also incomplete (only active / completed / paused), unable to represent two critical real-world agent states: "waiting for user approval" and "execution error."

This PR delivers two core objectives:

  1. Introduce a TaskBar (second toolbar row) enabling fast cross-task switching
  2. Expand the task status system to a complete 5-state model, with consistent rendering across all display layers (TaskBar, main content header, history page)

Motivation

Problem Root Cause
Inefficient multi-task switching Only the sidebar session list was available; no way to quickly scan global task status
Incomplete status model waiting (pending approval) and error (execution failure) were missing, making it impossible to represent real agent execution states
Inconsistent status display TaskBar, header text, and history page each resolved status independently, falling out of sync
Status data decoupled from content AgentSession.status and WorkflowStep.status were two independent data sources, causing contradictions like "all steps done" in the content area while the header showed "Awaiting Approval"

Before / After

Status System

Dimension Before After
AgentSession status values active | completed | paused active | waiting | error | paused | completed
WorkflowStep status values done | running | pending done | running | pending | error
TaskBar status dot Green pulse for active only 5 states with distinct colors and animations
Header run-status label Binary: active ? '运行中' : '已完成' 5-state label map
History page filter All / Running (active only) / Completed All / In Progress (aggregates all non-completed) / Completed
History page row indicator Green dot for active only 5-state colored dots + tooltip

TaskBar (new)

Feature Description
Task capsules Show title, status dot, and pin indicator; hover reveals "title · status" tooltip
Filter views Toggle between Recent Tasks and Pinned Tasks
Context menu Inline rename, pin/unpin, branch from current task, close task (with adjacent-task navigation)
Drag to reorder HTML5 native DnD with before/after insertion lines and clean state reset
Task branching Auto-derives {base} - Branch / {base} - Branch 2 naming from existing branch count

Changed Files:

File Change Type Description
src/app/types/agent.ts Modified AgentSession.status expanded to 5 states
src/app/types/chat.ts Modified WorkflowStep.status adds 'error'
src/styles/tailwind.css Modified Adds pulse-slow keyframe and animate-pulse-slow utility
src/app/context/AgentSessionContext.tsx New Shared agent session state; includes positional insert logic in reorderSessions
src/app/components/layout/TaskBar.tsx New Task navigation bar: status dots, context menu, inline rename, drag-to-reorder, branch creation
src/app/components/CherryStudio.tsx Modified Mounts AgentSessionProvider; conditionally renders TaskBar when Agent tab is active
src/features/agent/run/AgentRunPage.tsx Modified Migrates session state to Context; expands header status label to 5-state map; fixes CompactSessionSelector status dots
src/features/agent/run/SessionSidebar.tsx Modified Expands inline session status indicator to 5 states
src/features/agent/run/SessionHistoryPage.tsx Modified Refactors status filter to aggregate in-progress; expands row status dots to 5 states with tooltip
src/app/mock/agentData.ts Modified Aligns first 10 sessions' status with step data; adds complete error-state data for session-7

Impact Assessment

Positive Impact:

  • Users in multi-task scenarios can scan all task statuses directly from the TaskBar, reducing navigation depth
  • waiting and error states are now clearly visible — users won't miss tasks that require confirmation or intervention
  • All status display is driven by a single source of truth (AgentSession.status), eliminating cross-layer inconsistencies
  • AgentSessionContext promotes session state from AgentRunPage-local to globally shared, establishing the foundation for future cross-component access

Potential Risks:

  • AgentSession.status type expansion (waiting and error added): any existing exhaustive switch statements consuming this type elsewhere may need the two new cases added. All reference sites have been audited in this PR — no unhandled switches were found
  • WorkflowStep.status adds errorWorkflowPanel.tsx's StatusDot already had a pre-existing error branch (red X icon) before this change; the type update activates it with no rendering logic changes required
  • TaskBar drag-and-drop uses the HTML5 native DnD API — no new third-party dependencies, no bundle size impact

Feasibility Assessment

Dimension Assessment
Technical implementation Entirely within the existing stack (React + TailwindCSS v4 + Radix UI); no new dependencies introduced
Change scope Well-contained: TaskBar and Context are new files; all modifications to existing components are minimal and targeted, with no unrelated refactoring
Backward compatibility Status type changes are additive union extensions; existing consumers of active / completed / paused are unaffected
Mock data Used for UI prototype only; does not affect real API integration; session status has been verified to match step/message content throughout
Status consistency Verified across: session-1 (active), session-2 (completed), session-3 (completed), session-4 (waiting — last message unresolved), session-7 (error — final step is error)

Known Gaps (follow-up)

  • waiting / error / paused states currently require manual assignment in mock data; runtime auto-derivation from steps/messages back to AgentSession.status is not yet implemented
  • completed status tasks have no confirmation dialog before closing (intentional design decision: closing a completed task is low-risk)
  • queued state has been discussed but is not included in this PR; will be revisited once real concurrent execution requirements are confirmed

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