Skip to content

feat(subagent): add an active-only toggle collapsing idle topology branches - #381

Open
q862877400-ux wants to merge 1 commit into
omdsh-dev:mainfrom
q862877400-ux:feat/subagent-active-only-toggle
Open

feat(subagent): add an active-only toggle collapsing idle topology branches#381
q862877400-ux wants to merge 1 commit into
omdsh-dev:mainfrom
q862877400-ux:feat/subagent-active-only-toggle

Conversation

@q862877400-ux

Copy link
Copy Markdown

What

任务管理页(Subagent topology)主代理卡片下新增一个「只看活跃 / Active only」胶囊开关。开启后,拓扑隐藏所有没有运行活动的分支:

节点可见 ⟺ 它在运行,或其子树包含运行中的后代

空闲父链被隐藏不会让运行中的子代理"消失"(祖先链保留);诊断行一并隐藏。关闭即恢复完整拓扑。

Why

一次性子代理大量堆积后,已结束的分支长期占据页面且无法收起。高频派发子代理的工作流里,「只看正在跑的」是最常用的视图需求。

How

  • subagent-detect.ts 新增
    unningVisibilitySet(byId, rootId):基于 summary 镜像计算 keep-set(运行中 ∪ 有运行中后代的祖先;环安全、忽略 Side 线程)。
  • SubagentView.tsx 经 RowsProps 把该集合传入 CatalogRows 过滤 �isibleEntries;entry.activity === 'running' 恒放行,避免 catalog 行滞后于自身 summary 标记。
  • 开关只在 otals.count > 0 时渲染;偏好为纯客户端视图设置,localStorage 持久化(默认关),刷新保持,不触碰宿主状态。
  • i18n:新 key 同步全部 21 份词典(zh/en + 19 个第三语言文件), ests/locales.spec.ts 的 key-parity 守护通过。

Tests

  • ests/subagent-detect.spec.ts 新增 5 个用例:全空闲 → 空集;运行中子代理 + 祖先保留;深层后代运行时闲置父保留;Side 线程忽略;环安全。
  • pnpm typecheck ✅;pnpm test 全量 997 passed。4 个既有文件(bottom-auto-terminal / sidebar-crash / free-window / smoke 的 git 用例)在本机环境性失败——干净基线(stash 后)同样失败,与本 PR 无关。

…anches

The Subagent page renders the FULL topology of the current tree, which is
the right default but gets noisy once one-shot subagents pile up: finished
branches keep occupying the page and there was no way to tuck them away
short of deleting sessions.

Add an "Active only" pill under the main agent card. When pressed, the
topology hides every branch without running work: a node stays visible iff
it is running or its subtree contains a running descendant (hiding an idle
parent must never orphan its running children); diagnostics hide too.
Toggling off restores the full tree. The preference is a pure client-side
view setting persisted in localStorage (default off), so refreshes keep
the chosen posture without touching host state.

- subagent-detect: add runningVisibilitySet(byId, rootId) computing that
  keep-set over the summary mirror (cycle-safe, side threads ignored).
- SubagentView: thread the set through RowsProps/CatalogRows, guard
  visibleEntries (entry.activity === 'running' always passes so a catalog
  row never lags its own summary flag), render the toggle only when the
  tree actually has subagents.
- locales: new keys shipped across zh/en plus all 19 third-language
  dictionaries (key parity guarded by tests/locales.spec.ts).
@Menghuan1918 Menghuan1918 added enhancement New feature or request P3 低:体验/建议 area/sidebar Sidebar shell, panels, layout, tabs, workspace windows labels Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/sidebar Sidebar shell, panels, layout, tabs, workspace windows enhancement New feature or request P3 低:体验/建议

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants