makecindy / makecindy/cindy

建议合并 Subagent 面板与后台任务面板,并调整 Subagent 面板自动打开行为

Open
#2,413 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.7k
Forks
395
Avg merge
21h 48m
Merged PRs (30d)
776

Description

## 背景

右侧面板中存在两个功能高度重叠的 tab:**Subagent**(#2263,刚合入)和**后台任务**(较早存在)。两者内容相似但架构独立,给用户带来困惑。

## 问题 1:两个面板内容重叠但架构分裂

### 重叠情况

| | Subagent 面板 | 后台任务面板 |
|---|---|---|
| 覆盖任务类型 | 仅 subagent runs | Workflow / Agent / Bash / 其他后台任务 |
| 数据源 | SQLite subagent_runs(跨会话持久化) | makerChatStore(当前会话消息流) |
| 详情 | 活动时间线 + Markdown 渲染返回结果 | Workflow 多 Agent 进度树(仅 workflow) |
| 停止按钮 | 无 | 有 |

同一个 subagent 任务在**两个面板各产生一行**,且状态推导逻辑不一致(一个走 SQLite 持久化 mergeStatus,一个走消息流 deriveAgentTaskStatus),可能出现状态分叉。

### 实际用户体验

- 聊天中的 AgentTaskCard:workflow 卡片点击 → 走后台上任务面板;subagent 卡片点击 → 走 Subagent 面板
- 两个面板之间**零互跳转**,用户在 Subagent 面板找不到 workflow 进度,在后台任务面板找不到 subagent 活动日志
- 用户容易困惑:为什么同一个任务两边都能看到?到底应该看哪个?

### 建议

将 Subagent 面板的能力(活动日志、Markdown 渲染返回结果、持久化历史查询)合并进后台任务面板。后台任务面板覆盖所有任务类型,是天然的统一入口:

1. 在后台任务面板中为 agent 类型行增加 Subagent 详情视图(从 SQLite 读活动日志和返回结果)
2. 统一 AgentTaskCard 的卡片点击路由
3. 移除独立的 Subagent 面板和 tab 注册
4. 清理冗余 i18n key(约 40 个)

## 问题 2:Subagent 面板在首次 Subagent 启动时自动展开右侧栏

### 现象

CCAgentSessionView.tsx 中有一个 useEffect(L555-598):
- 挂载时静默确保 Subagent tab 存在(revealSidebar: false)
- 但 onChanged 订阅中,当 payload.created && payload.firstForSession(首次创建 subagent run)时,revealSidebar: true 会**自动展开右侧栏**

### 问题

- 用户启动 subagent 后右侧栏突然弹出,打断了正常的聊天流
- 对于习惯于极简界面的用户,这个行为侵入性很强
- 用户可能并不需要在 subagent 运行时立刻查看面板
- 首次运行 subagent 时,右侧栏打开后显示的是一个他们可能不熟悉的新面板,增加了认知负担

### 建议

- 首次 subagent 启动时不要自动展开右侧栏(revealSidebar: false)
- 仅在用户通过卡片点击等显式操作时才打开面板
- 或者至少提供一个设置选项让用户控制这个行为

## 额外说明

- Subagent 面板的持久化 SQLite 数据层可以保留,作为后台任务面板中 subagent 详情的辅助数据源
- packages/maker-shared/src/subagentWorkspace.ts 的类型定义对合并后的面板仍有价值,无需移除

---
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Contributor guide

Open the contributing guide

Research direction

Start with CCAgentSessionView.tsx around lines 555-598 and trace the Subagent and background-task panel registrations, AgentTaskCard click routing, and related i18n keys. Review packages/maker-shared/src/subagentWorkspace.ts and the existing SQLite and makerChatStore data paths. Done means one background-task entry point covers the relevant task types, Subagent details remain available, and first-run creation no longer reveals the sidebar automatically.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.