dsh-session-manager 0.5.2 → 0.5.3

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/README.md CHANGED
@@ -1,139 +1,140 @@
1
- # dsh-session-manager — session manager for DeepSeek Harness
2
-
3
- English | [中文](README.zh.md)
4
-
5
- [![npm version](https://img.shields.io/npm/v/dsh-session-manager)](https://www.npmjs.com/package/dsh-session-manager)
6
- [![GitHub](https://img.shields.io/badge/GitHub-repository-blue)](https://github.com/hkkz9522/dsh-session-manager)
7
- [![CI](https://github.com/hkkz9522/dsh-session-manager/actions/workflows/ci.yml/badge.svg)](https://github.com/hkkz9522/dsh-session-manager/actions/workflows/ci.yml)
8
- [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
9
-
10
- ## 0 Overview
11
-
12
- DSH Web session manager: delete, archive, move across workspaces, migrate preset; favorites, review-later, search, sort, priority, add tags and notes; bulk processing. Suggestions and feedback are welcome on GitHub.
13
-
14
- ## 1 Features
15
-
16
- ### 1.1 Session lifecycle management
17
-
18
- - **Delete** is irreversible and always asks for confirmation. Subagent sessions and transient blank placeholders (no persisted artifact) cannot be deleted.
19
- - **Archive / Unarchive** moves a session in and out of the active list without touching its disk content.
20
- - **Move to workspace** keeps history, title, archive state and derived-session relationships intact, rewrites the session's `cwd` to the target workspace, and updates the live writer's header in place so any pending tool calls keep landing on the new path.
21
- - **Migrate Agent preset** rewrites the latest `agent-preset/selected` event (or the session header if no such event exists) so a session whose preset was renamed or removed can resume. Message history is never altered.
22
-
23
- ### 1.2 Session shortcuts
24
-
25
- - **Favorites / Review-later** are manual flags that survive archive and session end; neither is cleared automatically.
26
- - **Search** matches title, session ID, note and tags case-insensitively, trims whitespace, and never reads chat history.
27
- - **Filters and sorting** combine a workspace selector (All / Ungrouped / specific) with an archive filter (All / Active / Archived), then layer favorites / review, tag and priority filters on top. Sort by recently updated (default), least recently updated, newest created, oldest created, or **priority (1 → 5)**.
28
- - **Priority** is a dropdown **1 Highest, 2 High, 3 Normal, 4 Low, 5 Lowest**, default **3 (Normal)**; legacy `null` priorities are normalized to 3.
29
- - **Tags / Notes**: up to 20 tags per session (≤ 32 characters each) and a 2000-character note. Both English `,` and Chinese `,` are separators, whitespace is trimmed, duplicate tags are merged case-insensitively.
30
- - **AI-assisted tagging** is manual and opt-in: **Copy Prompt** writes a structured prompt (Chinese or English, matched to the active UI) to the clipboard; **Import** parses the clipboard JSON (tolerating Markdown fences, conversational wrappers, smart quotes, stray backslashes and a leading BOM), validates it against the same limits, and populates the editor fields. Neither button calls a model automatically.
31
- - Annotations live in plain text under the DSH home (`dsh-session-manager/annotations.v1.json`), keyed by session ID. Same-origin browser tabs stay in sync via `BroadcastChannel`. Saves are durable across crashes; revision conflicts surface a "load latest" prompt.
32
-
33
- ### 1.3 Bulk management
34
-
35
- - **Batch process mode**: click the toggle in the panel header to reveal row checkboxes, a **Select all in filter / Clear selection** toolbar pair, and the bulk action bar. Exiting batch process clears the current selection.
36
- - **Action bar** lists every batch action:
37
- - **Annotation toggles**: **Archive / Unarchive / Favorite / Unfavorite / Mark for review / Clear review flag**.
38
- - **Mutating actions**: **Add tags / Clear tags / Set priority / Move to workspace / Migrate preset / Delete session**.
39
- - **Confirmation flow**:
40
- - Non-destructive actions (archive / unarchive / favorite / unfavorite / review / unreview / add-tags / clear-tags / set-priority / move / preset-migrate) fire immediately and report per-session results in a **result dialog** with **Success / Failed / Skipped** groups and a one-click **Retry failed** that re-arms the failed IDs into the selection.
41
- - Destructive actions (**delete session**) first open a **preview dialog** listing the targeted sessions, then show a progress bar, then a per-id result dialog.
42
-
43
- ## 2 UI entry points
44
-
45
- ### 2.1 Title bar
46
-
47
- The right side of the title area exposes actions for the **current session**: **Archive / Unarchive**, **Tags / Notes**, **Move to workspace**, **Delete session**.
48
-
49
- ### 2.2 Session manager panel
50
-
51
- Open the **Session manager** panel from the bottom of DSH's sidebar to browse every session, switch workspaces, search by title or ID, apply filters and sorting, and run **Open / Archive / Unarchive / Tags / Notes / Move / Migrate preset / Delete** on any row. The panel header carries the workspace selector, archive filter, favorites / review flags, tag and priority filters, sort order, and matching / total counts plus a reset action.
52
-
53
- ### 2.3 Bulk management
54
-
55
- The **Batch process** button in the session manager panel header is the entry point: click it once to enter batch process (row checkboxes appear, the **Select all in filter / Clear selection** pair and the bulk action bar show up); click it again to exit batch process.
56
-
57
- ## 3 Install
58
-
59
- ### 3.1 From the official plugin management
60
-
61
- Go to **plugin management** inside DSH, search for `dsh-session-manager`, and install it.
62
-
63
- ### 3.2 From dsh-market
64
-
65
- ```powershell
66
- dsh plugin --profile web add npm:dsh-session-manager
67
- ```
68
-
69
- ### 3.3 From GitHub
70
-
71
- ```powershell
72
- dsh plugin --profile web add github:hkkz9522/dsh-session-manager
73
- ```
74
-
75
- After installing, restart DSH Web. If the browser still holds an older client bundle, force-refresh with `Ctrl+Shift+R`.
76
-
77
- ### 3.4 Local development / runtime injection
78
-
79
- ```text
80
- dev_inject_plugin {"dir": "<absolute path to this repository>"}
81
- ```
82
-
83
- ## 4 Safety and behavior
84
-
85
- - **Deletion is permanent**, so the UI always asks for confirmation. The API checks the session ID, directory boundary and artifact header before deletion; traversal, symlinks and junctions are refused.
86
- - Move and preset migration keep the live session / agent alive; only deletion cancels and disposes the session. Move updates the stored `cwd` and the existing live writer's header.
87
- - The management list hides subagent sessions and the move API rejects them. Blank sessions without a persisted artifact cannot be moved.
88
- - Cold rewrites preserve the artifact's stored format (V1 / V2 / V3 / V4 are all readable; the plugin never forces an upgrade). Moves and rewrites refuse corrupt / truncated Zstd logs or JSONL logs with incomplete final lines instead of publishing partial history.
89
- - Preset migration separates backup, publication and rollback. If rollback fails, recovery files are retained and their paths are included in the error; do not remove them.
90
- - Incomplete startup scans skip workspace reconciliation. Complete scans preserve live sessions and any membership added during the scan.
91
- - Plugin mutations are serialized per session and request bodies are limited to 64 KiB. This queue supplements, rather than replaces, DSH's own persistence coordination.
92
-
93
- ## 5 Compatibility
94
-
95
- | Plugin version | Verified DSH version |
96
- | --- | --- |
97
- | 0.5.2 | v0.1.7-rc.1 |
98
- | 0.5.1 | v0.1.6-alpha.2 |
99
- | 0.4.11 | v0.1.5-rc.2 |
100
- | 0.4.10 | v0.1.5-rc.1 |
101
- | 0.4.9 | v0.1.5-rc.1 |
102
- | 0.4.7 | v0.1.5-rc.1 |
103
- | 0.4.6 | 0.1.3-alpha.2 |
104
- | 0.4.4 | 0.1.3-alpha.2 |
105
- | 0.4.1 | 0.1.3-alpha.2 |
106
- | 0.4.0 | v0.1.2-rc.1 |
107
- | 0.1.2 | v0.1.0-rc.7 |
108
- | 0.1.1 | v0.1.0-rc.7 |
109
- | 0.1.0 | v0.1.0-rc.7 |
110
-
111
- Requires Node.js 22.15+ (22.x) or 24+ for built-in Zstd support.
112
-
113
- This is a Cordis plugin and declares `cordis: ">=4.0.0-rc <5"` as its peer dependency.
114
-
115
- ## 6 Development
116
-
117
- - `lib/index.js` is the host-side ESM plugin; `lib/client.js` is the Web client bundle. No build step is required.
118
- - Before submitting changes, run:
119
-
120
- ```powershell
121
- npm run check
122
- npm test
123
- npm run check:package
124
- git diff --check
125
- ```
126
-
127
- Tests use isolated temporary directories and the real plugin entry point, never real sessions. CI runs these checks on Windows / Linux with Node 22.15.0 / 24.
128
-
129
- Optional integration check: run `node scripts/smoke-test.mjs` against a running test instance of DSH Web. It contacts a real service and is not part of the default unit test suite.
130
-
131
- Release history is in [CHANGELOG.md](CHANGELOG.md).
132
-
133
- ## 7 Acknowledgments
134
-
135
- Thanks to everyone who installs and uses dsh-session-manager, and to the people who file issues and open pull requests to help improve it. The plugin is listed in [dsh-market](https://github.com/dsh-market/dsh-market) and [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin). Suggestions and feedback are welcome.
136
-
137
- ## 8 License
138
-
139
- [MIT](LICENSE)
1
+ # dsh-session-manager — session manager for DeepSeek Harness
2
+
3
+ English | [中文](README.zh.md)
4
+
5
+ [![npm version](https://img.shields.io/npm/v/dsh-session-manager)](https://www.npmjs.com/package/dsh-session-manager)
6
+ [![GitHub](https://img.shields.io/badge/GitHub-repository-blue)](https://github.com/hkkz9522/dsh-session-manager)
7
+ [![CI](https://github.com/hkkz9522/dsh-session-manager/actions/workflows/ci.yml/badge.svg)](https://github.com/hkkz9522/dsh-session-manager/actions/workflows/ci.yml)
8
+ [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
9
+
10
+ ## 0 Overview
11
+
12
+ DSH Web session manager: delete, archive, move across workspaces, migrate preset; favorites, review-later, search, sort, priority, add tags and notes; bulk processing. Suggestions and feedback are welcome on GitHub.
13
+
14
+ ## 1 Features
15
+
16
+ ### 1.1 Session lifecycle management
17
+
18
+ - **Delete** is irreversible and always asks for confirmation. Subagent sessions and transient blank placeholders (no persisted artifact) cannot be deleted.
19
+ - **Archive / Unarchive** moves a session in and out of the active list without touching its disk content.
20
+ - **Move to workspace** keeps history, title, archive state and derived-session relationships intact, rewrites the session's `cwd` to the target workspace, and updates the live writer's header in place so any pending tool calls keep landing on the new path.
21
+ - **Migrate Agent preset** rewrites the latest `agent-preset/selected` event (or the session header if no such event exists) so a session whose preset was renamed or removed can resume. Message history is never altered.
22
+
23
+ ### 1.2 Session shortcuts
24
+
25
+ - **Favorites / Review-later** are manual flags that survive archive and session end; neither is cleared automatically.
26
+ - **Search** matches title, session ID, note and tags case-insensitively, trims whitespace, and never reads chat history.
27
+ - **Filters and sorting** combine a workspace selector (All / Ungrouped / specific) with an archive filter (All / Active / Archived), then layer favorites / review, tag and priority filters on top. Sort by recently updated (default), least recently updated, newest created, oldest created, or **priority (1 → 5)**.
28
+ - **Priority** is a dropdown **1 Highest, 2 High, 3 Normal, 4 Low, 5 Lowest**, default **3 (Normal)**; legacy `null` priorities are normalized to 3.
29
+ - **Tags / Notes**: up to 20 tags per session (≤ 32 characters each) and a 2000-character note. Both English `,` and Chinese `,` are separators, whitespace is trimmed, duplicate tags are merged case-insensitively.
30
+ - **AI-assisted tagging** is manual and opt-in: **Copy Prompt** writes a structured prompt (Chinese or English, matched to the active UI) to the clipboard; **Import** parses the clipboard JSON (tolerating Markdown fences, conversational wrappers, smart quotes, stray backslashes and a leading BOM), validates it against the same limits, and populates the editor fields. Neither button calls a model automatically.
31
+ - Annotations live in plain text under the DSH home (`dsh-session-manager/annotations.v1.json`), keyed by session ID. Same-origin browser tabs stay in sync via `BroadcastChannel`. Saves are durable across crashes; revision conflicts surface a "load latest" prompt.
32
+
33
+ ### 1.3 Bulk management
34
+
35
+ - **Batch process mode**: click the toggle in the panel header to reveal row checkboxes, a **Select all in filter / Clear selection** toolbar pair, and the bulk action bar. Exiting batch process clears the current selection.
36
+ - **Action bar** lists every batch action:
37
+ - **Annotation toggles**: **Archive / Unarchive / Favorite / Unfavorite / Mark for review / Clear review flag**.
38
+ - **Mutating actions**: **Add tags / Clear tags / Set priority / Move to workspace / Migrate preset / Delete session**.
39
+ - **Confirmation flow**:
40
+ - Non-destructive actions (archive / unarchive / favorite / unfavorite / review / unreview / add-tags / clear-tags / set-priority / move / preset-migrate) fire immediately and report per-session results in a **result dialog** with **Success / Failed / Skipped** groups and a one-click **Retry failed** that re-arms the failed IDs into the selection.
41
+ - Destructive actions (**delete session**) first open a **preview dialog** listing the targeted sessions, then show a progress bar, then a per-id result dialog.
42
+
43
+ ## 2 UI entry points
44
+
45
+ ### 2.1 Title bar
46
+
47
+ The right side of the title area exposes actions for the **current session**: **Archive / Unarchive**, **Tags / Notes**, **Move to workspace**, **Delete session**.
48
+
49
+ ### 2.2 Session manager panel
50
+
51
+ Open the **Session manager** panel from the bottom of DSH's sidebar to browse every session, switch workspaces, search by title or ID, apply filters and sorting, and run **Open / Archive / Unarchive / Tags / Notes / Move / Migrate preset / Delete** on any row. The panel header carries the workspace selector, archive filter, favorites / review flags, tag and priority filters, sort order, and matching / total counts plus a reset action.
52
+
53
+ ### 2.3 Bulk management
54
+
55
+ The **Batch process** button in the session manager panel header is the entry point: click it once to enter batch process (row checkboxes appear, the **Select all in filter / Clear selection** pair and the bulk action bar show up); click it again to exit batch process.
56
+
57
+ ## 3 Install
58
+
59
+ ### 3.1 From the official plugin management
60
+
61
+ Go to **plugin management** inside DSH, search for `dsh-session-manager`, and install it.
62
+
63
+ ### 3.2 From dsh-market
64
+
65
+ ```powershell
66
+ dsh plugin --profile web add npm:dsh-session-manager
67
+ ```
68
+
69
+ ### 3.3 From GitHub
70
+
71
+ ```powershell
72
+ dsh plugin --profile web add github:hkkz9522/dsh-session-manager
73
+ ```
74
+
75
+ After installing, restart DSH Web. If the browser still holds an older client bundle, force-refresh with `Ctrl+Shift+R`.
76
+
77
+ ### 3.4 Local development / runtime injection
78
+
79
+ ```text
80
+ dev_inject_plugin {"dir": "<absolute path to this repository>"}
81
+ ```
82
+
83
+ ## 4 Safety and behavior
84
+
85
+ - **Deletion is permanent**, so the UI always asks for confirmation. The API checks the session ID, directory boundary and artifact header before deletion; traversal, symlinks and junctions are refused.
86
+ - Move and preset migration keep the live session / agent alive; only deletion cancels and disposes the session. Move updates the stored `cwd` and the existing live writer's header.
87
+ - The management list hides subagent sessions and the move API rejects them. Blank sessions without a persisted artifact cannot be moved.
88
+ - Cold rewrites preserve the artifact's stored format (V1 / V2 / V3 / V4 are all readable; the plugin never forces an upgrade). Moves and rewrites refuse corrupt / truncated Zstd logs or JSONL logs with incomplete final lines instead of publishing partial history.
89
+ - Preset migration separates backup, publication and rollback. If rollback fails, recovery files are retained and their paths are included in the error; do not remove them.
90
+ - Incomplete startup scans skip workspace reconciliation. Complete scans preserve live sessions and any membership added during the scan.
91
+ - Plugin mutations are serialized per session and request bodies are limited to 64 KiB. This queue supplements, rather than replaces, DSH's own persistence coordination.
92
+
93
+ ## 5 Compatibility
94
+
95
+ | Plugin version | Verified DSH version |
96
+ | --- | --- |
97
+ | 0.5.3 | v0.1.7-rc.2 |
98
+ | 0.5.2 | v0.1.7-rc.1 |
99
+ | 0.5.1 | v0.1.6-alpha.2 |
100
+ | 0.4.11 | v0.1.5-rc.2 |
101
+ | 0.4.10 | v0.1.5-rc.1 |
102
+ | 0.4.9 | v0.1.5-rc.1 |
103
+ | 0.4.7 | v0.1.5-rc.1 |
104
+ | 0.4.6 | 0.1.3-alpha.2 |
105
+ | 0.4.4 | 0.1.3-alpha.2 |
106
+ | 0.4.1 | 0.1.3-alpha.2 |
107
+ | 0.4.0 | v0.1.2-rc.1 |
108
+ | 0.1.2 | v0.1.0-rc.7 |
109
+ | 0.1.1 | v0.1.0-rc.7 |
110
+ | 0.1.0 | v0.1.0-rc.7 |
111
+
112
+ Requires Node.js 22.15+ (22.x) or 24+ for built-in Zstd support.
113
+
114
+ This is a Cordis plugin and declares `cordis: ">=4.0.0-rc <5"` as its peer dependency.
115
+
116
+ ## 6 Development
117
+
118
+ - `lib/index.js` is the host-side ESM plugin; `lib/client.js` is the Web client bundle. No build step is required.
119
+ - Before submitting changes, run:
120
+
121
+ ```powershell
122
+ npm run check
123
+ npm test
124
+ npm run check:package
125
+ git diff --check
126
+ ```
127
+
128
+ Tests use isolated temporary directories and the real plugin entry point, never real sessions. CI runs these checks on Windows / Linux with Node 22.15.0 / 24.
129
+
130
+ Optional integration check: run `node scripts/smoke-test.mjs` against a running test instance of DSH Web. It contacts a real service and is not part of the default unit test suite.
131
+
132
+ Release history is in [CHANGELOG.md](CHANGELOG.md).
133
+
134
+ ## 7 Acknowledgments
135
+
136
+ Thanks to everyone who installs and uses dsh-session-manager, and to the people who file issues and open pull requests to help improve it. The plugin is listed in [dsh-market](https://github.com/dsh-market/dsh-market) and [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin). Suggestions and feedback are welcome.
137
+
138
+ ## 8 License
139
+
140
+ [MIT](LICENSE)
package/README.zh.md CHANGED
@@ -1,137 +1,138 @@
1
- # dsh-session-manager — DeepSeek Harness 会话管理器
2
-
3
- [English](README.md) | 中文
4
-
5
- [![npm version](https://img.shields.io/npm/v/dsh-session-manager)](https://www.npmjs.com/package/dsh-session-manager)
6
- [![GitHub](https://img.shields.io/badge/GitHub-仓库-blue)](https://github.com/hkkz9522/dsh-session-manager)
7
- [![CI](https://github.com/hkkz9522/dsh-session-manager/actions/workflows/ci.yml/badge.svg)](https://github.com/hkkz9522/dsh-session-manager/actions/workflows/ci.yml)
8
- [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
9
-
10
- ## 0 简介
11
-
12
- DSH Web 会话管理:删除、归档、跨工作区移动、迁移预设;收藏、待看、搜索、排序、设置优先级、添加标签和备注;批量处理。欢迎至 GitHub 提意见。
13
-
14
- ## 1 功能
15
-
16
- ### 1.1 会话生命周期管理
17
-
18
- - **删除**:不可逆操作,UI 始终要求二次确认。subagent 会话和尚未落盘的空白会话占位不能删除。
19
- - **归档 / 移出归档**:把会话移出或移回主列表,不删除磁盘内容。
20
- - **移动至工作区**:跨工作区移动时保留历史、标题、归档状态和派生会话关系,同时把 `cwd` 重写为目标工作区,并就地更新 live writer 的 header,使挂起的工具调用继续落到新路径。
21
- - **迁移 Agent 预设**:原预设被改名或删除导致会话无法恢复时,可修复该会话。迁移会就地重写最后一条 `agent-preset/selected` 事件(若从未记录则修改会话 header),不改动历史消息。
22
-
23
- ### 1.2 会话快捷管理
24
-
25
- - **收藏 / 待回看**:长期标记和手动提醒;不会随归档或会话结束自动清除。
26
- - **搜索**:按标题、会话 ID、备注、标签不区分大小写匹配,自动去除首尾空格,不读取聊天历史。
27
- - **筛选与排序**:工作区(全部 / 未分组 / 具体)与归档状态(全部 / 未归档 / 已归档)可叠加;可叠加收藏 / 待回看、标签和优先级筛选;排序支持最近更新(默认)、最早更新、最新创建、最早创建以及**优先级(1 → 5)**。
28
- - **优先级**:下拉 **1 最高、2 高、3 普通、4 低、5 最低**,**默认 3(普通)**;旧数据中的 `null` 归一化为 3。
29
- - **标签 / 备注**:每会话最多 20 个标签(每个 ≤ 32 字符)、备注最多 2000 字符。英文 `,` 与中文 `,` 都是分隔符,首尾空白被去除,重复标签按大小写不敏感合并。
30
- - **AI 整理(手动、可选)**:标签 / 备注编辑窗口内的 **复制 Prompt** 把结构化提示复制到剪贴板,**导入** 解析剪贴板 JSON(可识别 Markdown 代码块、对话包裹、智能引号、孤立反斜杠和开头 BOM),按相同规则校验后填入字段;两者都不会自动调用模型。
31
- - 标记保存在 `dsh-session-manager/annotations.v1.json`,按会话 ID 关联;同源浏览器标签页通过 `BroadcastChannel` 同步;保存可跨进程崩溃恢复,版本冲突会提示"载入最新内容"。
32
-
33
- ### 1.3 批量处理
34
-
35
- - **批量模式入口**:在会话管理窗口顶部点击 **批量处理** 切换按钮,行左侧出现复选框,工具栏出现 **全选当前筛选 / 清空选择** 和 **批量按钮区**;退出批量模式会清空当前选中。
36
- - **批量按钮区** 列出所有批量动作:
37
- - **标记切换**:**归档 / 取消归档 / 收藏 / 取消收藏 / 待回看 / 取消待看**。
38
- - **变更操作**:**添加标签 / 清空标签 / 设置优先级 / 移动至工作区 / 迁移预设 / 删除会话**。
39
- - **执行流程**:非破坏性操作(归档 / 取消归档 / 收藏 / 取消收藏 / 待回看 / 取消待看 / 添加标签 / 清空标签 / 设置优先级 / 移动至工作区 / 迁移预设)立即执行,结果按会话逐条展示在 **结果对话框** 的 **成功 / 失败 / 跳过** 分组里,并提供 **重试失败项** 一键把失败 ID 重新加入选中;破坏性操作(**删除会话**)先弹 **预览对话框** 列出受影响的会话,再显示进度条,最后给出逐条结果。
40
-
41
- ## 2 UI入口
42
-
43
- ### 2.1 标题栏入口
44
-
45
- 标题栏右侧对**当前会话**提供:**归档 / 移出归档**、**标签 / 备注**、**移动至工作区**、**删除会话**。
46
-
47
- ### 2.2 会话管理入口与界面
48
-
49
- 从 DSH 侧边栏底部进入 **会话管理**,可浏览全部会话、切换工作区、按标题 / ID / 备注 / 标签搜索、应用筛选与排序,并对每条会话执行 **打开 / 归档 / 移出归档 / 标签 / 备注 / 移动 / 迁移预设 / 删除** 操作。窗口顶部承载工作区选择、归档筛选、收藏 / 待回看、标签、优先级筛选与排序控件,以及匹配 / 总数计数和"重置筛选"。
50
-
51
- ### 2.3 批量管理入口
52
-
53
- 会话管理窗口顶部的 **批量处理** 按钮即是入口:点一下进入批量模式,行左侧出现复选框,工具栏出现 **全选当前筛选 / 清空选择** 和 **批量按钮区**;再点一次退出批量模式。
54
-
55
- ## 3 安装
56
-
57
- ### 3.1 从官方插件管理入口安装
58
-
59
- 进入 DSH 应用内的 **插件管理**,搜索 `dsh-session-manager` 并安装。
60
-
61
- ### 3.2 从 dsh-market 安装
62
-
63
- ```powershell
64
- dsh plugin --profile web add npm:dsh-session-manager
65
- ```
66
-
67
- ### 3.3 从 GitHub 安装
68
-
69
- ```powershell
70
- dsh plugin --profile web add github:hkkz9522/dsh-session-manager
71
- ```
72
-
73
- 安装后重启 DSH Web;若浏览器仍加载旧的客户端代码,请使用 `Ctrl+Shift+R` 强制刷新。
74
-
75
- ### 3.4 本地开发 / 运行时注入
76
-
77
- ```text
78
- dev_inject_plugin {"dir": "<本仓库的绝对路径>"}
79
- ```
80
-
81
- ## 4 安全说明
82
-
83
- - **删除不可恢复**,UI 始终要求二次确认;删除前校验会话 ID、目录边界和工件 header,不允许通过路径穿越、符号链接或 junction 操作其他目录。
84
- - 移动和迁移预设保留 live session / agent;只有删除才会取消运行并释放会话。移动会更新保存的 cwd 和 live writer 的 header。
85
- - 会话管理列表隐藏 subagent 会话,移动接口也拒绝 subagent;尚未落盘的空白会话不能跨工作区移动。
86
- - 冷会话重写保留原工件格式(V1 / V2 / V3 / V4 都可读,绝不强制升级)。损坏或截断的 Zstd 日志、缺少完整尾行的 JSONL 会拒绝移动 / 重写,不会把部分历史当作完整日志保存。
87
- - 迁移预设按"备份 → 发布 → 回滚"分阶段处理。如果回滚失败,会保留恢复文件并在错误中报告路径;不要删除这些文件。
88
- - 启动扫描不完整时跳过工作区归属修复;完整扫描也不会清除仍在内存中或扫描期间新加入的会话。
89
- - 同一会话的插件写操作按顺序执行;请求体限制为 64 KiB。该队列不替代 DSH 自身的持久化写入协调。
90
-
91
- ## 5 兼容性
92
-
93
- | 插件版本 | 已验证 DSH 版本 |
94
- | ------ | ------------- |
95
- | 0.5.2 | v0.1.7-rc.1 |
96
- | 0.5.1 | v0.1.6-alpha.2 |
97
- | 0.4.11 | v0.1.5-rc.2 |
98
- | 0.4.10 | v0.1.5-rc.1 |
99
- | 0.4.9 | v0.1.5-rc.1 |
100
- | 0.4.7 | v0.1.5-rc.1 |
101
- | 0.4.6 | 0.1.3-alpha.2 |
102
- | 0.4.4 | 0.1.3-alpha.2 |
103
- | 0.4.1 | 0.1.3-alpha.2 |
104
- | 0.4.0 | v0.1.2-rc.1 |
105
- | 0.1.2 | v0.1.0-rc.7 |
106
- | 0.1.1 | v0.1.0-rc.7 |
107
- | 0.1.0 | v0.1.0-rc.7 |
108
-
109
- 运行时要求 Node.js 22.15+(22.x)或 24+,以提供内置 Zstd 支持。
110
-
111
- 本插件是 Cordis 插件,peer dependency 为 `cordis: ">=4.0.0-rc <5"`。
112
-
113
- ## 6 开发
114
-
115
- - `lib/index.js` 是 host 端 ESM 插件,`lib/client.js` 是 Web 客户端 bundle,无需构建步骤。
116
- - 提交修改前请运行:
117
-
118
- ```powershell
119
- npm run check
120
- npm test
121
- npm run check:package
122
- git diff --check
123
- ```
124
-
125
- 测试使用隔离临时目录和真实插件入口,不操作真实会话。CI 在 Windows / Linux、Node 22.15.0 / 24 上执行相同检查。
126
-
127
- 可选集成检查:在 DSH Web 已运行的测试环境中执行 `node scripts/smoke-test.mjs`;它会请求实际服务,不属于默认单元测试。
128
-
129
- 发布记录见 [CHANGELOG.md](CHANGELOG.md)。
130
-
131
- ## 7 致谢
132
-
133
- 感谢每一位安装和使用 dsh-session-manager 的用户,也感谢提交 Issue 与 Pull Request 帮助改进本插件的朋友们。本插件已被 [dsh-market](https://github.com/dsh-market/dsh-market) 和 [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) 收录。欢迎提出修改意见。
134
-
135
- ## 8 开源许可
136
-
137
- [MIT](LICENSE)
1
+ # dsh-session-manager — DeepSeek Harness 会话管理器
2
+
3
+ [English](README.md) | 中文
4
+
5
+ [![npm version](https://img.shields.io/npm/v/dsh-session-manager)](https://www.npmjs.com/package/dsh-session-manager)
6
+ [![GitHub](https://img.shields.io/badge/GitHub-仓库-blue)](https://github.com/hkkz9522/dsh-session-manager)
7
+ [![CI](https://github.com/hkkz9522/dsh-session-manager/actions/workflows/ci.yml/badge.svg)](https://github.com/hkkz9522/dsh-session-manager/actions/workflows/ci.yml)
8
+ [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
9
+
10
+ ## 0 简介
11
+
12
+ DSH Web 会话管理:删除、归档、跨工作区移动、迁移预设;收藏、待看、搜索、排序、设置优先级、添加标签和备注;批量处理。欢迎至 GitHub 提意见。
13
+
14
+ ## 1 功能
15
+
16
+ ### 1.1 会话生命周期管理
17
+
18
+ - **删除**:不可逆操作,UI 始终要求二次确认。subagent 会话和尚未落盘的空白会话占位不能删除。
19
+ - **归档 / 移出归档**:把会话移出或移回主列表,不删除磁盘内容。
20
+ - **移动至工作区**:跨工作区移动时保留历史、标题、归档状态和派生会话关系,同时把 `cwd` 重写为目标工作区,并就地更新 live writer 的 header,使挂起的工具调用继续落到新路径。
21
+ - **迁移 Agent 预设**:原预设被改名或删除导致会话无法恢复时,可修复该会话。迁移会就地重写最后一条 `agent-preset/selected` 事件(若从未记录则修改会话 header),不改动历史消息。
22
+
23
+ ### 1.2 会话快捷管理
24
+
25
+ - **收藏 / 待回看**:长期标记和手动提醒;不会随归档或会话结束自动清除。
26
+ - **搜索**:按标题、会话 ID、备注、标签不区分大小写匹配,自动去除首尾空格,不读取聊天历史。
27
+ - **筛选与排序**:工作区(全部 / 未分组 / 具体)与归档状态(全部 / 未归档 / 已归档)可叠加;可叠加收藏 / 待回看、标签和优先级筛选;排序支持最近更新(默认)、最早更新、最新创建、最早创建以及**优先级(1 → 5)**。
28
+ - **优先级**:下拉 **1 最高、2 高、3 普通、4 低、5 最低**,**默认 3(普通)**;旧数据中的 `null` 归一化为 3。
29
+ - **标签 / 备注**:每会话最多 20 个标签(每个 ≤ 32 字符)、备注最多 2000 字符。英文 `,` 与中文 `,` 都是分隔符,首尾空白被去除,重复标签按大小写不敏感合并。
30
+ - **AI 整理(手动、可选)**:标签 / 备注编辑窗口内的 **复制 Prompt** 把结构化提示复制到剪贴板,**导入** 解析剪贴板 JSON(可识别 Markdown 代码块、对话包裹、智能引号、孤立反斜杠和开头 BOM),按相同规则校验后填入字段;两者都不会自动调用模型。
31
+ - 标记保存在 `dsh-session-manager/annotations.v1.json`,按会话 ID 关联;同源浏览器标签页通过 `BroadcastChannel` 同步;保存可跨进程崩溃恢复,版本冲突会提示"载入最新内容"。
32
+
33
+ ### 1.3 批量处理
34
+
35
+ - **批量模式入口**:在会话管理窗口顶部点击 **批量处理** 切换按钮,行左侧出现复选框,工具栏出现 **全选当前筛选 / 清空选择** 和 **批量按钮区**;退出批量模式会清空当前选中。
36
+ - **批量按钮区** 列出所有批量动作:
37
+ - **标记切换**:**归档 / 取消归档 / 收藏 / 取消收藏 / 待回看 / 取消待看**。
38
+ - **变更操作**:**添加标签 / 清空标签 / 设置优先级 / 移动至工作区 / 迁移预设 / 删除会话**。
39
+ - **执行流程**:非破坏性操作(归档 / 取消归档 / 收藏 / 取消收藏 / 待回看 / 取消待看 / 添加标签 / 清空标签 / 设置优先级 / 移动至工作区 / 迁移预设)立即执行,结果按会话逐条展示在 **结果对话框** 的 **成功 / 失败 / 跳过** 分组里,并提供 **重试失败项** 一键把失败 ID 重新加入选中;破坏性操作(**删除会话**)先弹 **预览对话框** 列出受影响的会话,再显示进度条,最后给出逐条结果。
40
+
41
+ ## 2 UI入口
42
+
43
+ ### 2.1 标题栏入口
44
+
45
+ 标题栏右侧对**当前会话**提供:**归档 / 移出归档**、**标签 / 备注**、**移动至工作区**、**删除会话**。
46
+
47
+ ### 2.2 会话管理入口与界面
48
+
49
+ 从 DSH 侧边栏底部进入 **会话管理**,可浏览全部会话、切换工作区、按标题 / ID / 备注 / 标签搜索、应用筛选与排序,并对每条会话执行 **打开 / 归档 / 移出归档 / 标签 / 备注 / 移动 / 迁移预设 / 删除** 操作。窗口顶部承载工作区选择、归档筛选、收藏 / 待回看、标签、优先级筛选与排序控件,以及匹配 / 总数计数和"重置筛选"。
50
+
51
+ ### 2.3 批量管理入口
52
+
53
+ 会话管理窗口顶部的 **批量处理** 按钮即是入口:点一下进入批量模式,行左侧出现复选框,工具栏出现 **全选当前筛选 / 清空选择** 和 **批量按钮区**;再点一次退出批量模式。
54
+
55
+ ## 3 安装
56
+
57
+ ### 3.1 从官方插件管理入口安装
58
+
59
+ 进入 DSH 应用内的 **插件管理**,搜索 `dsh-session-manager` 并安装。
60
+
61
+ ### 3.2 从 dsh-market 安装
62
+
63
+ ```powershell
64
+ dsh plugin --profile web add npm:dsh-session-manager
65
+ ```
66
+
67
+ ### 3.3 从 GitHub 安装
68
+
69
+ ```powershell
70
+ dsh plugin --profile web add github:hkkz9522/dsh-session-manager
71
+ ```
72
+
73
+ 安装后重启 DSH Web;若浏览器仍加载旧的客户端代码,请使用 `Ctrl+Shift+R` 强制刷新。
74
+
75
+ ### 3.4 本地开发 / 运行时注入
76
+
77
+ ```text
78
+ dev_inject_plugin {"dir": "<本仓库的绝对路径>"}
79
+ ```
80
+
81
+ ## 4 安全说明
82
+
83
+ - **删除不可恢复**,UI 始终要求二次确认;删除前校验会话 ID、目录边界和工件 header,不允许通过路径穿越、符号链接或 junction 操作其他目录。
84
+ - 移动和迁移预设保留 live session / agent;只有删除才会取消运行并释放会话。移动会更新保存的 cwd 和 live writer 的 header。
85
+ - 会话管理列表隐藏 subagent 会话,移动接口也拒绝 subagent;尚未落盘的空白会话不能跨工作区移动。
86
+ - 冷会话重写保留原工件格式(V1 / V2 / V3 / V4 都可读,绝不强制升级)。损坏或截断的 Zstd 日志、缺少完整尾行的 JSONL 会拒绝移动 / 重写,不会把部分历史当作完整日志保存。
87
+ - 迁移预设按"备份 → 发布 → 回滚"分阶段处理。如果回滚失败,会保留恢复文件并在错误中报告路径;不要删除这些文件。
88
+ - 启动扫描不完整时跳过工作区归属修复;完整扫描也不会清除仍在内存中或扫描期间新加入的会话。
89
+ - 同一会话的插件写操作按顺序执行;请求体限制为 64 KiB。该队列不替代 DSH 自身的持久化写入协调。
90
+
91
+ ## 5 兼容性
92
+
93
+ | 插件版本 | 已验证 DSH 版本 |
94
+ | ------ | ------------- |
95
+ | 0.5.3 | v0.1.7-rc.2 |
96
+ | 0.5.2 | v0.1.7-rc.1 |
97
+ | 0.5.1 | v0.1.6-alpha.2 |
98
+ | 0.4.11 | v0.1.5-rc.2 |
99
+ | 0.4.10 | v0.1.5-rc.1 |
100
+ | 0.4.9 | v0.1.5-rc.1 |
101
+ | 0.4.7 | v0.1.5-rc.1 |
102
+ | 0.4.6 | 0.1.3-alpha.2 |
103
+ | 0.4.4 | 0.1.3-alpha.2 |
104
+ | 0.4.1 | 0.1.3-alpha.2 |
105
+ | 0.4.0 | v0.1.2-rc.1 |
106
+ | 0.1.2 | v0.1.0-rc.7 |
107
+ | 0.1.1 | v0.1.0-rc.7 |
108
+ | 0.1.0 | v0.1.0-rc.7 |
109
+
110
+ 运行时要求 Node.js 22.15+(22.x)或 24+,以提供内置 Zstd 支持。
111
+
112
+ 本插件是 Cordis 插件,peer dependency 为 `cordis: ">=4.0.0-rc <5"`。
113
+
114
+ ## 6 开发
115
+
116
+ - `lib/index.js` 是 host 端 ESM 插件,`lib/client.js` 是 Web 客户端 bundle,无需构建步骤。
117
+ - 提交修改前请运行:
118
+
119
+ ```powershell
120
+ npm run check
121
+ npm test
122
+ npm run check:package
123
+ git diff --check
124
+ ```
125
+
126
+ 测试使用隔离临时目录和真实插件入口,不操作真实会话。CI 在 Windows / Linux、Node 22.15.0 / 24 上执行相同检查。
127
+
128
+ 可选集成检查:在 DSH Web 已运行的测试环境中执行 `node scripts/smoke-test.mjs`;它会请求实际服务,不属于默认单元测试。
129
+
130
+ 发布记录见 [CHANGELOG.md](CHANGELOG.md)。
131
+
132
+ ## 7 致谢
133
+
134
+ 感谢每一位安装和使用 dsh-session-manager 的用户,也感谢提交 Issue 与 Pull Request 帮助改进本插件的朋友们。本插件已被 [dsh-market](https://github.com/dsh-market/dsh-market) 和 [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) 收录。欢迎提出修改意见。
135
+
136
+ ## 8 开源许可
137
+
138
+ [MIT](LICENSE)