fix(web): render the chat session tree from parent/sub-session lineage

The sidebar treated every workspace session as a root and only nested the
manifest sub-agents, so sub-session files showed up as siblings (the same child
twice); sub-sessions the plugin marked hidden were listed anyway.

- build the tree from `parentId` in a pure `buildSessionTree` model: orphans are
  promoted to roots, cycles and duplicate ids are guarded, real child-session
  rows win over the manifest projection, and the routed row force-opens its
  ancestors
- honour the plugin's `:PiSessions` visibility (`visible: false`) with a "show
  hidden sub-sessions" toggle, the routed-row exception and a dedicated
  all-hidden empty state
- keep tree metadata across WS snapshots, reducer events, id migration and
  parent removal; prefer a root row for the `/chat` index and add a "back to
  parent" action
- document the session-row and `pi2:subagents` list metadata in the protocol
This commit is contained in:
yuez committed 2026-10-22 16:45:09 +08:00
1 parent 7e780515ac
commit 06e70204e7
15 files changed
+1133 -240

No files matched your search

+5
View File
@@ -7,6 +7,8 @@
"chat.acceptedAll": "已接受全部 {n} 个文件",
"chat.addAttachment": "添加附件",
"chat.allowOnce": "允许一次",
"chat.allHidden": "所有子会话均已隐藏",
"chat.allHiddenText": "开启「显示隐藏的子会话」即可显示。",
"chat.attachTitle": "添加附件",
"chat.attachmentAdded": "已添加附件 {name}",
"chat.attachmentFailed": "附件读取失败:{name}",
@@ -20,6 +22,7 @@
"chat.batchFailed": "{n} 失败",
"chat.batchRunning": "{n} 运行中",
"chat.cancelSiblingsLabel": "失败时取消同级子代理(cancel_siblings_on_fail)",
"chat.childCount": "{n} 个子项",
"chat.closePanel": "关闭面板",
"chat.closeProcess": "关闭进程",
"chat.closeSessionText": "将结束 session「{name}」的 pi 进程。会话历史仍保留,可重新唤醒。",
@@ -103,6 +106,8 @@
"chat.sendTitle": "发送(Enter)",
"chat.sending": "发送中…",
"chat.sessions": "会话",
"chat.showHidden": "显示隐藏的子会话",
"chat.showHiddenAria": "显示隐藏的子会话",
"chat.source": "来源:{name}",
"chat.status": "状态",
"chat.steer": "Steer",