dsh-session-branch 0.0.0-stage → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ ## 1.3.0 — 2026-12-04
4
+
5
+ First public release of the branch-chat fork, based on `dsh-session-lineage` 1.2.3.
6
+
7
+ ### Added
8
+
9
+ - **Branch chat** sidebar context-menu item (`分支对话` / `Branch chat`), listed before the native fork item. It forks, records the exact parent link, guarantees the new row is mounted in the sidebar, expands its ancestors and flashes it once — without switching the current conversation, so the same session can be branched repeatedly into siblings.
10
+ - **Per-answer branch button** in the assistant action row: forks at that exact answer (`atSeq`), so the child conversation opens on that answer with the full preceding memory.
11
+ - **Exact parent links**: the fork edge is recorded client-side (`state.forks`) and the state store preserves it, so a branch stays under its parent even when the parent keeps growing after the fork.
12
+ - **Branch watcher**: every 3 s the sidebar re-reads the lineage and re-plans rows whose parent becomes known, so a branch shows up under its parent without a refresh.
13
+ - **Fold on launch**: sessions with children start collapsed on every launch; the toggle only appears for sessions whose child rows are actually rendered.
14
+
15
+ ### Changed
16
+
17
+ - Prefix fingerprint capacity raised from 8192 to 262144 events, so forks made deep in a long session still find their parent.
18
+ - Sidebar indentation no longer draws vertical guide rails.
19
+ - Fork errors are surfaced in the console instead of being swallowed.
20
+
21
+ ### Fixed
22
+
23
+ - Branching a just-forked session no longer leaves the new row as a top-level session while its parent is unknown.
24
+ - Collapse arrows no longer appear on sessions with no rendered children.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 yangt16 (original dsh-session-lineage)
4
+ Copyright (c) 2026 adorable520665 (branch-chat changes)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,46 @@
1
+ # Branch Chat · Session Tree (dsh-session-branch)
2
+
3
+ A DeepSeek Harness plugin that forks one session into as many **parallel** child conversations as you want and draws the result as a collapsible session tree in the left sidebar.
4
+
5
+ > An enhanced fork of [`dsh-session-lineage`](https://github.com/yangt16/dsh-session-lineage) (MIT, by yangt16). Uninstall the original `dsh-session-lineage` before installing this one — both occupy the same plugin seat.
6
+
7
+ ## Features
8
+
9
+ 1. **Many sibling branches** — fork `5` twice and get `5.1` and `5.2` side by side under `5`; fork `5.1` and get `5.1.1` nested one level deeper.
10
+ 2. **Sidebar → Branch chat** — the first item in a session's context menu. The new child appears under its parent and flashes once, without switching the conversation you are looking at, so you can click it repeatedly.
11
+ 3. **Fork from any answer** — every assistant answer carries a branch icon in its action row. The child starts at that answer and inherits the full context before it.
12
+ 4. **Inherit up to the last turn** — a plain fork cuts at the parent's latest completed turn, so the child opens on the parent's last answer with the same memory.
13
+ 5. **Session tree** — indentation, collapse/expand, manual sibling ordering, hierarchical numbering, and "show as sibling of the parent" without touching the inference.
14
+ 6. **Folded on launch** — sessions with children start collapsed, so the sidebar first reads as a flat list.
15
+ 7. **No dead arrows** — the collapse arrow only appears when child rows are actually rendered.
16
+
17
+ ## Install
18
+
19
+ Market index:
20
+
21
+ ```
22
+ https://raw.githubusercontent.com/adorable520665/dsh-session-branch/main/index.json
23
+ ```
24
+
25
+ Or `dsh plugin add dsh-session-branch`, or install the folder as a local plugin and restart DeepSeek Harness.
26
+
27
+ ## Usage
28
+
29
+ - Right-click a session → **Branch chat** (or the native "Fork session").
30
+ - Hover any answer → branch icon in its action row.
31
+ - Click the triangle to fold a subtree; right-click for sibling ordering.
32
+
33
+ ## Privacy
34
+
35
+ Reads local `.dsh` session logs and workspace membership only; state lives in `~/.dsh/storages/session-lineage/state.json`. No network requests.
36
+
37
+ ## Limitations
38
+
39
+ - The source session needs one completed turn before it can be forked (a DeepSeek Harness rule).
40
+ - A sidebar group renders its first five sessions by default; pin the parent to keep its children in view.
41
+ - Cannot coexist with the original `dsh-session-lineage`.
42
+ - Web/Desktop only.
43
+
44
+ ## License
45
+
46
+ MIT. Based on `dsh-session-lineage`, Copyright (c) 2026 yangt16; see `LICENSE`.
package/README.md CHANGED
@@ -1,3 +1,61 @@
1
- # Temporary Holding Version
1
+ # 分支对话 · 会话树(dsh-session-branch)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 给 DeepSeek Harness 的「分支对话」插件:把一个会话反复分叉成多支**并列**的子对话,并按父子关系在左侧栏缩进成一棵树。
4
+
5
+ > 这是 [`dsh-session-lineage`](https://github.com/yangt16/dsh-session-lineage)(MIT,作者 yangt16)的增强分支版,保留原有会话树能力并加入下面这些功能。安装前请先卸载原版 `dsh-session-lineage`,两者使用同一个插件位置,不能同时启用。
6
+
7
+ ## 功能
8
+
9
+ 1. **反复分叉、并列成支**:对同一个会话分叉多次,得到 `5.1`、`5.2`、`5.3` 并列挂在 `5` 下面;对 `5.1` 再分叉得到 `5.1.1`,层级编号自动推出来。
10
+ 2. **右栏右键「分支对话」**:侧栏会话右键菜单里排在最前的一项。分叉后新分支立刻出现在父会话下面并高亮一次,**不切换**你当前正在看的会话,所以可以连点多次分出多支。
11
+ 3. **聊天里任意一条回答下面直接分叉**:每条回答的动作行多一个分支图标,点它就从这一条回答切一个子会话——子会话的第一条记录就是那条回答,记忆包含它之前的全部上下文。
12
+ 4. **默认继承到父对话最后一条**:右键分叉(不带位置)时,子会话从父会话最近的完整轮次切开,因此开头就是父对话最后一条回答,聊天记忆与父会话一致。
13
+ 5. **会话树**:父子缩进、折叠/展开、同层手动排序、层级编号、把某一支「与父级并列显示」而不改变推断结果。
14
+ 6. **启动默认收起**:每次打开 DeepSeek Harness,有子会话的父会话先折叠,侧栏先给你一份平铺列表;点三角再展开。
15
+ 7. **没有子会话就没有三角**:只有当前确实渲染出子行的会话才显示折叠箭头,不会出现点了没反应的死箭头。
16
+
17
+ ## 安装
18
+
19
+ ### 从插件市场安装
20
+
21
+ 把下面这个索引地址加到「设置 → 插件 → 发现」的索引里:
22
+
23
+ ```
24
+ https://raw.githubusercontent.com/adorable520665/dsh-session-branch/main/index.json
25
+ ```
26
+
27
+ 然后搜索「分支对话」安装即可。
28
+
29
+ ### 从 npm 安装
30
+
31
+ ```
32
+ dsh plugin add dsh-session-branch
33
+ ```
34
+
35
+ ### 手动安装(离线)
36
+
37
+ 1. 下载仓库,得到 `dsh-session-branch` 目录;
38
+ 2. 在 DeepSeek Harness 里用「插件 → 安装本地插件」选择该目录,或用 `plugin_manager install_bundle`,目标填 `file:<绝对路径>`;
39
+ 3. 重启 DeepSeek Harness。
40
+
41
+ ## 使用
42
+
43
+ - **侧栏分叉**:在会话上点右键 →「分支对话」(或原生「分叉会话」,两者都会生成子会话,前者额外保证新行可见并高亮)。
44
+ - **按回答分叉**:把鼠标移到任意一条回答上,点底部动作行里的分支图标。
45
+ - **收/展分支**:点会话左侧的三角。启动时全部收起,展开状态只在本次运行内保持。
46
+ - **调顺序**:右键 →「同级上移 / 下移 / 移到最前 / 最后」;或「与父级并列显示」把某一支提到父级旁边。
47
+
48
+ ## 数据与隐私
49
+
50
+ 插件只读取本机 `.dsh` 下的会话日志与工作区成员表,状态保存在 `~/.dsh/storages/session-lineage/state.json`(折叠、排序、手动父级记录)。不发送任何网络请求。
51
+
52
+ ## 已知限制
53
+
54
+ - 分叉要求源会话有**已完成的一轮**,刚新建、还没跑完一轮的空会话无法分叉(DeepSeek Harness 自身限制)。
55
+ - 侧栏每个分组默认只渲染前 5 条会话(DSH 的「显示更多」机制),父会话如果被挤到后面,它的子行也会一起隐藏;用右键「置顶」把父会话固定到前面即可。
56
+ - 与官网原版 `dsh-session-lineage` 不能共存,安装前请卸载原版。
57
+ - 仅支持 Web/Desktop 端;不支持纯 CLI 会话界面。
58
+
59
+ ## 许可
60
+
61
+ MIT。基于 `dsh-session-lineage`(Copyright (c) 2026 yangt16)修改,原始版权声明见 `LICENSE`。
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: session-lineage
3
+ name: dsh-session-branch
package/docs/DETAIL.md ADDED
@@ -0,0 +1 @@
1
+ ![Sidebar session tree: a parent session with two sibling children indented below it, beside a branch icon](preview.en.svg)
@@ -0,0 +1 @@
1
+ ![侧栏会话树:父会话下面并列缩进两个子会话,右侧是分叉图标](preview.zh.svg)
@@ -0,0 +1,50 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="640" height="300" viewBox="0 0 640 300" fill="none" role="img" aria-label="Sidebar session tree: a parent session with two sibling child sessions indented under it, and a branch icon">
2
+ <rect x="8" y="8" width="624" height="284" rx="18" fill="#f8fafc"/>
3
+ <rect x="8" y="8" width="624" height="284" rx="18" stroke="#e2e8f0" stroke-width="2"/>
4
+
5
+ <!-- parent row -->
6
+ <rect x="40" y="46" width="16" height="16" rx="4" fill="#2563eb"/>
7
+ <rect x="66" y="50" width="230" height="9" rx="4.5" fill="#334155"/>
8
+ <rect x="306" y="50" width="120" height="9" rx="4.5" fill="#cbd5e1"/>
9
+
10
+ <!-- connector -->
11
+ <path d="M48 66 V 96" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
12
+ <path d="M48 96 H 68" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
13
+ <path d="M48 96 H 68" stroke="#94a3b8" stroke-width="2" stroke-linecap="round" stroke-dasharray="0"/>
14
+ <path d="M48 128 H 68" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
15
+ <path d="M48 96 V 128" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
16
+
17
+ <!-- child 1 -->
18
+ <rect x="72" y="90" width="12" height="12" rx="3" fill="#94a3b8"/>
19
+ <rect x="94" y="92" width="180" height="8" rx="4" fill="#94a3b8"/>
20
+ <rect x="284" y="92" width="70" height="8" rx="4" fill="#e2e8f0"/>
21
+
22
+ <!-- child 2 -->
23
+ <rect x="72" y="122" width="12" height="12" rx="3" fill="#94a3b8"/>
24
+ <rect x="94" y="124" width="180" height="8" rx="4" fill="#94a3b8"/>
25
+ <rect x="284" y="124" width="70" height="8" rx="4" fill="#e2e8f0"/>
26
+
27
+ <!-- grandchild -->
28
+ <path d="M78 104 V 168" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
29
+ <path d="M78 168 H 100" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
30
+ <rect x="104" y="162" width="12" height="12" rx="3" fill="#cbd5e1"/>
31
+ <rect x="126" y="164" width="150" height="8" rx="4" fill="#cbd5e1"/>
32
+
33
+ <!-- other sessions -->
34
+ <rect x="40" y="206" width="16" height="16" rx="4" fill="#cbd5e1"/>
35
+ <rect x="66" y="210" width="210" height="9" rx="4.5" fill="#cbd5e1"/>
36
+ <rect x="40" y="240" width="16" height="16" rx="4" fill="#cbd5e1"/>
37
+ <rect x="66" y="244" width="180" height="9" rx="4.5" fill="#cbd5e1"/>
38
+
39
+ <!-- branch glyph -->
40
+ <g transform="translate(470 92)">
41
+ <rect x="-34" y="-38" width="176" height="170" rx="20" fill="#ffffff"/>
42
+ <rect x="-34" y="-38" width="176" height="170" rx="20" stroke="#e2e8f0" stroke-width="2"/>
43
+ <circle cx="18" cy="26" r="9" fill="#2563eb"/>
44
+ <path d="M18 35 V 58" stroke="#2563eb" stroke-width="4" stroke-linecap="round"/>
45
+ <path d="M18 44 C 18 62, -6 58, -6 76" stroke="#2563eb" stroke-width="4" stroke-linecap="round" fill="none"/>
46
+ <path d="M18 54 C 18 72, 42 68, 42 86" stroke="#94a3b8" stroke-width="4" stroke-linecap="round" fill="none"/>
47
+ <circle cx="-6" cy="84" r="9" fill="#94a3b8"/>
48
+ <circle cx="42" cy="94" r="9" fill="#94a3b8"/>
49
+ </g>
50
+ </svg>
@@ -0,0 +1,50 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="640" height="300" viewBox="0 0 640 300" fill="none" role="img" aria-label="Sidebar session tree: a parent session with two sibling child sessions indented under it, and a branch icon">
2
+ <rect x="8" y="8" width="624" height="284" rx="18" fill="#f8fafc"/>
3
+ <rect x="8" y="8" width="624" height="284" rx="18" stroke="#e2e8f0" stroke-width="2"/>
4
+
5
+ <!-- parent row -->
6
+ <rect x="40" y="46" width="16" height="16" rx="4" fill="#2563eb"/>
7
+ <rect x="66" y="50" width="230" height="9" rx="4.5" fill="#334155"/>
8
+ <rect x="306" y="50" width="120" height="9" rx="4.5" fill="#cbd5e1"/>
9
+
10
+ <!-- connector -->
11
+ <path d="M48 66 V 96" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
12
+ <path d="M48 96 H 68" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
13
+ <path d="M48 96 H 68" stroke="#94a3b8" stroke-width="2" stroke-linecap="round" stroke-dasharray="0"/>
14
+ <path d="M48 128 H 68" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
15
+ <path d="M48 96 V 128" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
16
+
17
+ <!-- child 1 -->
18
+ <rect x="72" y="90" width="12" height="12" rx="3" fill="#94a3b8"/>
19
+ <rect x="94" y="92" width="180" height="8" rx="4" fill="#94a3b8"/>
20
+ <rect x="284" y="92" width="70" height="8" rx="4" fill="#e2e8f0"/>
21
+
22
+ <!-- child 2 -->
23
+ <rect x="72" y="122" width="12" height="12" rx="3" fill="#94a3b8"/>
24
+ <rect x="94" y="124" width="180" height="8" rx="4" fill="#94a3b8"/>
25
+ <rect x="284" y="124" width="70" height="8" rx="4" fill="#e2e8f0"/>
26
+
27
+ <!-- grandchild -->
28
+ <path d="M78 104 V 168" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
29
+ <path d="M78 168 H 100" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
30
+ <rect x="104" y="162" width="12" height="12" rx="3" fill="#cbd5e1"/>
31
+ <rect x="126" y="164" width="150" height="8" rx="4" fill="#cbd5e1"/>
32
+
33
+ <!-- other sessions -->
34
+ <rect x="40" y="206" width="16" height="16" rx="4" fill="#cbd5e1"/>
35
+ <rect x="66" y="210" width="210" height="9" rx="4.5" fill="#cbd5e1"/>
36
+ <rect x="40" y="240" width="16" height="16" rx="4" fill="#cbd5e1"/>
37
+ <rect x="66" y="244" width="180" height="9" rx="4.5" fill="#cbd5e1"/>
38
+
39
+ <!-- branch glyph -->
40
+ <g transform="translate(470 92)">
41
+ <rect x="-34" y="-38" width="176" height="170" rx="20" fill="#ffffff"/>
42
+ <rect x="-34" y="-38" width="176" height="170" rx="20" stroke="#e2e8f0" stroke-width="2"/>
43
+ <circle cx="18" cy="26" r="9" fill="#2563eb"/>
44
+ <path d="M18 35 V 58" stroke="#2563eb" stroke-width="4" stroke-linecap="round"/>
45
+ <path d="M18 44 C 18 62, -6 58, -6 76" stroke="#2563eb" stroke-width="4" stroke-linecap="round" fill="none"/>
46
+ <path d="M18 54 C 18 72, 42 68, 42 86" stroke="#94a3b8" stroke-width="4" stroke-linecap="round" fill="none"/>
47
+ <circle cx="-6" cy="84" r="9" fill="#94a3b8"/>
48
+ <circle cx="42" cy="94" r="9" fill="#94a3b8"/>
49
+ </g>
50
+ </svg>
package/icon.svg ADDED
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36" fill="none">
2
+ <rect x="6" y="7" width="14" height="4.5" rx="2.25" fill="#2563eb"/>
3
+ <path d="M9.5 11.5V26.75" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
4
+ <path d="M9.5 18H14" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
5
+ <path d="M9.5 26.75H14" stroke="#94a3b8" stroke-width="2" stroke-linecap="round"/>
6
+ <rect x="15" y="15.75" width="15" height="4.5" rx="2.25" fill="#94a3b8"/>
7
+ <rect x="15" y="24.5" width="15" height="4.5" rx="2.25" fill="#94a3b8"/>
8
+ </svg>