dsh-claude-project-ui 0.2.0 → 0.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 CHANGED
@@ -1,6 +1,68 @@
1
1
  # Changelog
2
2
 
3
- ## 0.2.0
3
+ ## 0.3.0 — 2026-11-18
4
+
5
+ 新增**辅助文件夹(多目录挂载)**与**项目主文件夹切换**:一个项目除主文件夹外可以挂多个目录,提示词、
6
+ 沙箱授权、本插件自己的文件工具三条都通;主文件夹可以在面板或 `/hub folder` 里真的切换
7
+ (写入 dsh-threads 的项目记录 + DSH 的 workspace 记录,**当前对话不动、重启后新会话跟随**)。
8
+
9
+ - 新增 `src/folders.js`:挂载列表存本插件自己的 `projects/<id>/folders.json`(**不写** dsh-threads 的
10
+ `dsh_threads.json`,两边各管各的存储);路径落盘前 `realpath` 归一化为物理绝对路径
11
+ (DSH 沙箱不接受 symlink 拼写的额外根),非目录 / 读不到的路径直接拒绝;同一项目的挂载写入串行化。
12
+ - 系统提示:新增 `project-hub/folders` section,给主对话和每个讨论串列出挂载目录
13
+ (`foldersContextMaxChars`,默认 600)。
14
+ - 沙箱:宿主半对项目里每个存活会话调用 `ctx.sandboxPolicy.registerWritableRoot(session, dir)`;
15
+ 授权按会话、运行时有效,10 秒刷新循环在挂载变化后重新登记;`read-only` 不授予写权限。
16
+ - 面板(浏览器半):「▤ 项目看板」里每个项目多一块文件夹区:主文件夹(`切换文件夹…` 按钮走系统选择器,
17
+ 选择器不可用时手填路径;成功后显示「已切换 + 重启后新会话才用新目录、当前对话仍在原目录」的说明)、
18
+ 辅助文件夹列表 + 添加 / 移除;宿主没有 `sandboxPolicy` 服务时明确标注「核心文件工具仍只允许主文件夹」,
19
+ 不静默降级。该区文案中英双语(读 `locale` 服务,读不到就用浏览器语言)。新增宿主路由
20
+ `POST /project-hub/folders`(要求 `x-project-hub: 1` 请求头,挡掉跨站请求),`action` 支持
21
+ `add` / `remove` / `main`。
22
+ - 新增 `src/mainfolder.js`(**切换主文件夹**,移植 dsh-threads PR #61 的服务端语义):
23
+ - 同时改两处记录,缺一不写:`~/.dsh/storages/dsh_threads.json` 的 `tables.projects[<id>].folder`
24
+ (dsh-threads 渲染与面板显示)与 `~/.dsh/storages/workspace.json` 的 `tables.workspaces[<ws>].path`
25
+ (**新会话的目录来源**)。只改前者会是「面板显示新目录、新会话还在旧目录」的假切换。
26
+ - 写入优先走 `ctx.storageDomain` 里 dsh-threads / DSH 已经打开的 domain(内存态权威、写链串行,
27
+ 避免外部直写被下一次写覆盖);宿主没暴露该服务时退化为「重新读取 → 原子 rename」,并在面板标注。
28
+ - 写前把两个存储文件各备份成 `<文件>.bak-mainfolder-<时间戳>`;写后读回校验,不一致或抛错就回滚两处记录,
29
+ 错误带到面板(或 `/hub folder`),不静默。
30
+ - 校验:存在 + 是目录 + `realpath` 归一化(去尾斜杠、解 symlink);拒绝 `/`、`/Applications`、`/System`、
31
+ `/Library`、`/usr` 等系统目录、用户主目录本身、`~/.dsh`(含子目录)、`~/.ssh` 与本插件数据目录;
32
+ 目录已被另一个 DSH workspace 占用时拒绝。写入按存储路径串行化(同一目录连点两次不会交错)。
33
+ - **生效边界**:只写记录、不改活动会话的工作目录,所以
34
+
35
+ > 新会话和新讨论串要等 DSH 重启之后才用新文件夹;当前这个对话在重启前仍留在原目录。
36
+
37
+ 面板(中英文案)与 `/hub folder` 都按这个语义写,不说「立即生效」。
38
+ - **行为变化**:`kb_add` 的 `path` 现在只接受主文件夹与已挂载目录里的文件,其它路径报错并列出可用挂载
39
+ (它用插件自己的权限读盘,边界必须由插件自己兜)。
40
+ - `/hub` 命令新增 `folders`、`folders add <路径>`、`folders rm <路径>`,以及 `folder` / `folder <路径>`
41
+ (看 / 切换主文件夹,走与面板同一个 writer,便于在 tui / headless 里调试);
42
+ `/hub doctor` 显示挂载数、沙箱授权状态与文件夹注入字符数。
43
+ - 配置:`maxExtraFolders`(默认 8)、`foldersContextMaxChars`(默认 600)、
44
+ `workspaceStorage`(默认与 `threadsStorage` 同目录的 `workspace.json`,只在切换主文件夹时写)。
45
+ - 宿主半 `inject` 增加 `storageDomain`:切换主文件夹必须通过 dsh-threads / DSH 已打开的 domain 写链,
46
+ 否则下一次它们自己的写会把改动覆盖掉(丢更新)。
47
+ - 文档:README 中英各补「辅助文件夹(多目录挂载)」一节、配置表、数据目录与已知限制;
48
+ 新增 `docs/folders-feasibility.md`(沙箱 API / 主文件夹切换 / `settings.section` / 右栏页签的只读验证证据)。
49
+ - 测试:`test/harness.mjs` 30 项(新增 extraFolders 持久化、提示注入 + 沙箱授权、`/hub folders`、
50
+ 文件夹路由鉴权与增删;主文件夹切换正常改 / 目录不存在被拒 / 非法路径被拒(`/Applications`、`/`、`~/.dsh`、
51
+ 相对路径)/ 未知字段保留 / 并发写后不丢数据 / 已被占用的目录被拒 / storage-domain 写链 / `/hub folder` /
52
+ 路由返回 `restartRequired`),`test/spec-check.mjs` 10 个工具 schema 全绿。
53
+
54
+ ## 0.2.1 — 2026-11-18
55
+
56
+ 代码行为与 0.2.0 一致(`src/` 未改);这一版只为把仓库里的文档同步到 npm 页面,并给发布加一道门禁。
57
+
58
+ - 文档:README 补「快速开始(3 步)」「配置项表(字段 / 默认值 / 影响)」「License」三节,中英各一份;
59
+ 修两处 heading 前缺空行、英文看板段多出来的一行 `right:`。
60
+ - `package.json` 加 `prepublishOnly` 门禁:`node test/harness.mjs && node test/spec-check.mjs`,
61
+ 以后 `npm publish` 前必过测试与 schema 校验。
62
+ - `INSTALL-LOCAL.md` removed from the public repo: the local install notes (machine-specific absolute paths and backup-directory names) now live in a private folder outside this repository. The file was never shipped in the npm package.
63
+ - GitHub 仓库主页 homepage 指向 npm 包页:<https://www.npmjs.com/package/dsh-claude-project-ui>
64
+
65
+ ## 0.2.0 — 2026-11-17(npm 首发)
4
66
 
5
67
  - 改名:`dsh-project-hub` → `dsh-claude-project-ui`(仓库、npm 包名、插件 id 一并改;仓库改名后旧地址仍重定向)。
6
68
  - 新增**看板面板**(浏览器半):侧栏页脚多一个「▤ 看板」按钮,点开是右侧浮层面板,
package/README.md CHANGED
@@ -34,6 +34,7 @@
34
34
  ```
35
35
 
36
36
  改完完全退出 DSH 再启动。
37
+
37
38
  ## 和 dsh-threads 的关系:补强,不是替代
38
39
 
39
40
  | 能力 | `@kyf-eng/dsh-threads` | 本插件 `dsh-claude-project-ui` |
@@ -45,9 +46,13 @@
45
46
  | 开 thread 时的上下文简报 | 手写 `task` 文本 | ✅ `context_brief` 一键拼好 |
46
47
  | 讨论串回报汇聚成任务 | ❌ | ✅ 幂等自动汇总(按 `threadId` 去重) |
47
48
  | 讨论串建好时的启动上下文 | — | ✅ 自动注入项目说明 + 看板 + 他人进展 |
49
+ | 辅助文件夹(多目录挂载) | PR #61 在做,未发布 | ✅ 本插件自己存 + 提示注入 + 沙箱可写根 |
50
+ | 切换项目主文件夹 | PR #61 在做,未发布 | ✅ 本插件实现(写 dsh-threads 记录 + DSH workspace 记录,重启后新会话生效) |
48
51
 
49
- 两个插件通过**只读存储文件**解耦:本插件不 import dsh-threads 的模块,也不写它的存储。
50
- 任何一个卸载,另一个照常工作;dsh-threads 换存储格式时本插件静默降级为「不注入」,不会报错。
52
+ 两个插件通过**存储文件 + storage-domain 写链**解耦:本插件不 import dsh-threads 的模块,平时只读它的存储;
53
+ 只有「切换主文件夹」这一条写路径(`src/mainfolder.js`)会动它的项目记录和 DSH 的 workspace 记录,
54
+ 而且走 dsh-threads 已经打开的 domain 句柄、带备份与回滚。任何一个卸载,另一个照常工作;
55
+ dsh-threads 换存储格式时本插件静默降级为「不注入」,不会报错。
51
56
 
52
57
  ## 功能
53
58
 
@@ -93,6 +98,8 @@
93
98
  /hub kb [关键词] 知识库列表或检索
94
99
  /hub brief 项目简报
95
100
  /hub note <文本> 记一条项目级上下文
101
+ /hub folders [add|rm <路径>] 辅助文件夹:列出 / 挂载 / 移除
102
+ /hub folder [<路径>] 看 / 切换项目主文件夹(当前对话不动,重启后新会话才用新目录)
96
103
  /hub add <标题> | <正文> 加一篇知识库文档(正文可省略)
97
104
  ```
98
105
 
@@ -110,6 +117,61 @@
110
117
 
111
118
  面板只在 Web GUI(`desktop` / `web` profile)出现;`tui` / headless 没有侧栏,
112
119
  退化成 `/hub board` 命令和 `board_list` 工具。
120
+
121
+ ## 辅助文件夹(多目录挂载)
122
+
123
+ 一个项目除了主文件夹,还可以挂载多个**辅助文件夹**(类似 Claude Code 的 additional directories)。
124
+ 在右侧「▤ 项目看板」页签里按项目增删,也可以用命令:
125
+
126
+ ```text
127
+ /hub folders 列出已挂载的辅助文件夹
128
+ /hub folders add <绝对路径> 挂载一个(也接受 ~/ 开头的写法)
129
+ /hub folders rm <绝对路径> 移除一个
130
+ ```
131
+
132
+ 行为与边界:
133
+
134
+ - **存本插件自己的数据**:`projects/<id>/folders.json`。绝不写 dsh-threads 的 `dsh_threads.json`,
135
+ 两边各管各的存储,删掉任一插件另一边照常读。
136
+ - 路径落盘前归一化为**物理绝对路径**(`realpath`):DSH 沙箱不接受用 symlink 拼写的额外根,
137
+ 非目录 / 读不到的路径直接拒绝。
138
+ - **系统提示**给每个项目会话(主对话 + 每个讨论串)列出挂载目录(`project-hub/folders` section)。
139
+ - **沙箱**:宿主半对项目里每个存活会话调用 `ctx.sandboxPolicy.registerWritableRoot(session, dir)`,
140
+ 所以 `workspace-write` 下核心文件工具与 bash 都能写这些目录。授权是**运行时、按会话**的:
141
+ 重启 / resume / fork 后由 10 秒的刷新循环重新登记;`read-only` 不授予写权限;
142
+ Windows 上进程隔离不认额外根(只有 harness 的文件工具认)。
143
+ - **我们自己的文件工具认这些目录**:`kb_add` 的 `path` 只允许主文件夹和已挂载目录里的文件,
144
+ 其它路径会报错并列出当前可用的挂载(它用插件自己的权限读盘,所以这条校验必须自己兜住)。
145
+ - 授不到沙箱根时(宿主没有 `sandboxPolicy` 服务、目录被删、或不是目录)面板会**明确标注**,
146
+ 不会假装挂载可用。
147
+
148
+ ## 切换主文件夹(重启后生效)
149
+
150
+ 面板里「主文件夹」那一行的「切换文件夹…」按钮(或 `/hub folder <绝对路径>`)会打开系统的文件夹选择器;
151
+ 没有选择器时可以在同一块里手填绝对路径。选完之后:
152
+
153
+ - **两处记录一起改,缺一不写**:
154
+ - `~/.dsh/storages/dsh_threads.json` → `tables.projects[<id>].folder`:dsh-threads 渲染那栏 UI 用它,本插件面板也直接读它(不另存一份真相);
155
+ - `~/.dsh/storages/workspace.json` → `tables.workspaces[<workspaceId>].path`:**新会话的目录是从这里读的**。
156
+ 只改第一处会出现「面板显示新目录、新会话还在旧目录」的假切换,所以第二处写不进去时整次切换直接失败、什么都不改。
157
+ - **写之前备份**:两个存储文件各留一份 `<文件>.bak-mainfolder-<时间戳>`;
158
+ 写入走 dsh-threads / DSH 已经打开的那个 storage-domain(内存态是权威、写链串行),
159
+ 宿主没暴露该服务时退化为「重新读取 → 原子 rename」,并在面板上标注这次是直写文件。
160
+ - **校验**:目标必须存在且是目录,`realpath` 归一化(去尾斜杠、解 symlink);
161
+ 拒绝 `/`、`/Applications`、`/System`、`/Library`、`/usr` 等系统目录,拒绝用户主目录本身、
162
+ `~/.dsh`(含子目录)、`~/.ssh` 与本插件自己的数据目录;目标目录已被另一个 DSH workspace 占用时也拒绝
163
+ (否则 DSH 启动时的 workspace 一致性检查会失败)。
164
+ - **失败不静默**:写后读回校验,不一致或中途抛错就回滚两处记录,并把原因(含备份路径)显示在面板上。
165
+ - **生效边界(实话)**:DSH 把 workspace 记录缓存在进程内存里,所以
166
+
167
+ > **新会话和新讨论串要等 DeepSeek Harness 重启之后才用新文件夹;当前这个对话在你重启前仍留在原目录。**
168
+
169
+ 本插件的写入路径从不改活动会话的工作目录(`src/mainfolder.js` 里只写那两条记录),这就是「当前对话不动」的由来。
170
+ 面板与 `/hub folder` 的文案都按这个语义写,不会说「立即生效」。
171
+ - **耦合风险**:`dsh_threads`/`workspace` 的 domain 名与字段是 dsh-threads 和 DSH 的私有契约;
172
+ 上游 PR #61 合并后应改用它提供的官方入口。字段变了会在切换时直接报错并回滚(不会写坏记录)。
173
+ 详见 [`docs/folders-feasibility.md`](docs/folders-feasibility.md)。
174
+
113
175
  ## 安装
114
176
 
115
177
  需要 DeepSeek Harness 0.2.1-rc.2 到 0.3.0。
@@ -154,6 +216,20 @@ dsh plugin --profile web add dsh-claude-project-ui
154
216
 
155
217
  数据留在 `~/.dsh/project-hub/`,卸载不会删;要彻底清掉就删这个目录。
156
218
 
219
+ ## 快速开始(3 步)
220
+
221
+ 装好并**完全退出 DSH 再启动**之后:
222
+
223
+ ```text
224
+ /hub status 我在哪个项目、多少知识 / 任务
225
+ /hub note 发布前必须跑 node test/harness.mjs
226
+ /hub add 发布清单 | 1) 跑测试 2) npm pack 3) gh release
227
+ /hub brief 粘进 thread_open.task 的项目简报
228
+ ```
229
+
230
+ 右侧栏「▤ 项目看板」页签里应该能看到刚加的任务和讨论串状态;`tui` / headless 没有侧栏,用 `/hub board`。
231
+ 开新讨论串时它第一步就会带上项目说明、看板快照和最近进展,不用你复制粘贴。
232
+
157
233
  ## 配置
158
234
 
159
235
  在 profile 的 `cordis.patch.yml` 里覆盖:
@@ -164,10 +240,13 @@ dsh plugin --profile web add dsh-claude-project-ui
164
240
  config:
165
241
  dataDir: "" # 默认 ~/.dsh/project-hub
166
242
  threadsStorage: "" # 默认 ~/.dsh/storages/dsh_threads.json
243
+ workspaceStorage: "" # 默认与 threadsStorage 同目录的 workspace.json(切换主文件夹时写)
167
244
  knowledgeIndexMaxChars: 280
168
245
  kbIndexMaxDocs: 3
169
246
  boardContextMaxChars: 700
170
247
  digestContextMaxChars: 700
248
+ maxExtraFolders: 8 # 一个项目最多挂载几个辅助文件夹
249
+ foldersContextMaxChars: 600 # 注入的挂载目录列表字符上限
171
250
  briefMaxChars: 4000
172
251
  maxNotes: 200
173
252
  maxDocs: 200
@@ -176,6 +255,24 @@ dsh plugin --profile web add dsh-claude-project-ui
176
255
  autoConvergeReports: true # 把讨论串回报自动汇总成看板任务(幂等)
177
256
  ```
178
257
 
258
+ | 字段 | 默认值 | 影响 |
259
+ |---|---|---|
260
+ | `dataDir` | `~/.dsh/project-hub` | 知识库 / 任务 / 笔记的根目录;换掉就是另一套项目数据 |
261
+ | `threadsStorage` | `~/.dsh/storages/dsh_threads.json` | 只读;用来识别「哪些会话属于哪个项目」,格式变了会静默降级为不注入。切换主文件夹时这一处也会被写(见上) |
262
+ | `workspaceStorage` | 与 `threadsStorage` 同目录的 `workspace.json` | 只在切换主文件夹时写:新会话的目录来自这里的 `workspaces[].path`;指错会让切换失败并回滚 |
263
+ | `knowledgeIndexMaxChars` | `280` | 注入的知识库索引字符上限;调大占提示词预算,调小了只列更少文档 |
264
+ | `kbIndexMaxDocs` | `3` | 索引里最多列几篇文档,其余提示用 `kb_search` 检索 |
265
+ | `boardContextMaxChars` | `700` | 注入的看板快照字符上限 |
266
+ | `digestContextMaxChars` | `700` | 注入的「最近进展」字符上限 |
267
+ | `maxExtraFolders` | `8` | 一个项目最多挂载几个辅助文件夹 |
268
+ | `foldersContextMaxChars` | `600` | 注入的辅助文件夹列表字符上限 |
269
+ | `briefMaxChars` | `4000` | `context_brief` / `/hub brief` 的单次输出上限 |
270
+ | `maxNotes` | `200` | 每个项目保留多少条 `hub_note` 进展笔记 |
271
+ | `maxDocs` | `200` | 每个项目允许的知识库文档数 |
272
+ | `maxKnowledgeChars` | `4000000` | 每个项目知识库总字符数上限 |
273
+ | `hideResolvedThreads` | `true` | 看板与注入里隐藏已解决 / 已归档讨论串;`board_list all=true` 可看全部 |
274
+ | `autoConvergeReports` | `true` | 讨论串回报自动汇总成看板任务(按 `threadId` 幂等) |
275
+
179
276
  ## 数据
180
277
 
181
278
  ```
@@ -183,17 +280,27 @@ dsh plugin --profile web add dsh-claude-project-ui
183
280
  knowledge.json 知识库文档
184
281
  board.json 手动任务
185
282
  notes.json 项目上下文笔记
283
+ folders.json 辅助文件夹挂载(本插件自己的记录)
186
284
  ```
187
285
 
188
286
  全部是普通 JSON,原子写入(临时文件 + rename),可以手工备份或编辑。
189
287
 
288
+ 切换主文件夹不改这里,而是改 `~/.dsh/storages/dsh_threads.json` 与 `~/.dsh/storages/workspace.json`
289
+ (写前各留一份 `*.bak-mainfolder-<时间戳>`)。
290
+
190
291
  ## 已知限制
191
292
 
192
293
  - 只读识别 dsh-threads 的存储文件;它的存储格式若改变,项目识别会失效(插件会静默降级为「不注入」而不是报错)。
193
294
  - 知识库是**词法检索**(CJK 二元组 + 英文词 + 词频归一化),没有向量检索,也没有 LLM 摘要;文档要自己写清楚标题和关键词。
194
295
  - 摘要不是模型生成的:自动部分来自 dsh-threads 的 `lastReport`,手动部分来自 `hub_note`。主对话自己没回报过的东西不会出现。
195
296
  - 注入内容按字符截断(每段默认 700-900 字),不是按 token 精确计量。
196
- - 面板是只读的:建/改/删任务目前只能用 `board_add` / `board_update` / `/hub task|done|rm`。
297
+ - 面板除了**辅助文件夹增删**和**主文件夹切换**以外是只读的:建/改/删任务目前只能用
298
+ `board_add` / `board_update` / `/hub task|done|rm`。
299
+ - 主文件夹切换依赖 `dsh_threads` / `workspace` 两个 storage domain 的私有字段(dsh-threads 与 DSH 的契约)。
300
+ 上游 PR #61 合并后应改用它提供的入口;字段变了对不上时切换会报错并回滚,不会静默写坏。
301
+ - 主文件夹切换**当前对话不搬家**:只有重启 DSH 之后新建的会话 / 讨论串才用新目录;面板与 `/hub folder` 都这么写。
302
+ - 辅助文件夹的沙箱授权只在 `workspace-write` 生效;`read-only` 下核心工具本来就写不了。
303
+ 授权是运行时状态,重启 / resume 后需要重新登记(刷新循环会自动做,最多延迟 10 秒)。
197
304
  - 轮询刷新:每 10 秒 + agent 状态变化时刷新提示词快照,最坏情况看到的是 10 秒前的看板。
198
305
  - 看板默认隐藏已解决/已归档的讨论串;想全看用 `board_list all=true` 或 `/hub board --all`。
199
306
 
@@ -206,12 +313,16 @@ dsh plugin --profile web add dsh-claude-project-ui
206
313
  | 注入 | 通过(知识库) | 真实 system prompt 中出现:`本项目共享知识库(主对话和每个讨论串都会收到这份索引)。\n## 项目知识库(1 篇…)` |
207
314
  | 注入(看板/进展) | 通过 | 讨论串 #2 的请求体(`user/message` 记录,12.7KB)里逐字包含 `## 项目看板`、两行讨论串状态、`## 项目进展` 段;KB 则在 `system/message` 里(section vs context 两种注入通道) |
208
315
  | schema 兼容 | 通过 | `node test/spec-check.mjs` 对照宿主 DSL 校验 10 个工具定义 |
209
- | 逻辑 | 通过 | `node test/harness.mjs` 19 项(含 changedFiles、隐藏规则、汇总幂等、/hub doctor) |
316
+ | 逻辑 | 通过 | `node test/harness.mjs` 30 项(含 changedFiles、隐藏规则、汇总幂等、/hub doctor、extraFolders 持久化 / 提示注入 / kb_add 目录校验 / 文件夹路由鉴权、主文件夹切换(两处记录 / 备份 / 拒绝非法路径 / 并发不丢数据 / 回滚)/ `/hub folder` / 路由) |
210
317
 
211
318
  ## 与 Team 模式的关系
212
319
 
213
320
  Team 模式的任务板属于**单个会话的 subagent 树**;本插件的看板属于**一个 dsh-threads 项目**(主对话 + 它的所有讨论串)。两者互补,不会互相写入。
214
321
 
322
+ ## License
323
+
324
+ MIT(见 [LICENSE](LICENSE))。
325
+
215
326
  ---
216
327
 
217
328
  <a id="english"></a>
@@ -269,11 +380,15 @@ Quit DSH completely and start it again after editing.
269
380
  | Brief when opening a thread | hand-written `task` text | ✅ `context_brief` assembles it |
270
381
  | Thread reports rolled up as tasks | ❌ | ✅ idempotent rollup keyed by `threadId` |
271
382
  | Startup context for a new thread | — | ✅ project brief + board + other threads' progress |
383
+ | Auxiliary folders (additional directories) | PR #61, unreleased | ✅ own record + prompt list + sandbox writable roots |
384
+ | Switching the project main folder | PR #61, unreleased | ✅ implemented here (writes the dsh-threads project record + the DSH workspace record; new sessions follow after a restart) |
272
385
 
273
- The two plugins are decoupled through a **read-only storage file**: this plugin never imports
274
- dsh-threads modules and never writes its storage. Uninstalling either leaves the other working; if
275
- dsh-threads changes its storage format, this plugin silently degrades to "no injection" instead of
276
- throwing.
386
+ The two plugins are decoupled through **storage files plus a storage-domain write chain**: this plugin
387
+ never imports dsh-threads modules and normally only reads its storage. Exactly one write path —
388
+ switching the main folder (`src/mainfolder.js`) — touches dsh-threads' project record and DSH's
389
+ workspace record, through the domain handle dsh-threads already opened, with a backup and a rollback.
390
+ Uninstalling either leaves the other working; if dsh-threads changes its storage format, this plugin
391
+ silently degrades to "no injection" instead of throwing.
277
392
 
278
393
  ## Features
279
394
 
@@ -320,6 +435,8 @@ Thread state is owned by dsh-threads and read-only here:
320
435
  /hub kb [query] List the knowledge base, or search it
321
436
  /hub brief Project brief
322
437
  /hub note <text> Record one line of project context
438
+ /hub folders [add|rm <path>] Auxiliary folders: list / mount / unmount
439
+ /hub folder [<path>] Show / switch the project main folder (this conversation stays put; new sessions after a restart)
323
440
  /hub add <title> | <body> Add a knowledge document (body optional)
324
441
  ```
325
442
 
@@ -329,7 +446,6 @@ and they run in order with a per-line report. A trailing `→ note` is treated a
329
446
  ## Board panel (sidebar)
330
447
 
331
448
  The browser half registers a "项目看板" tab in the **right-hand sidebar pane**, next to dsh-threads' "讨论串" tab (the session header also gets a "▤ 项目看板" button that opens it):
332
- right:
333
449
 
334
450
  - Projects grouped, each listing **live threads** (number, title, state, worktree branch)
335
451
  - **Tasks** (id, title, status, owner), including the automatically rolled-up thread tasks
@@ -339,6 +455,72 @@ right:
339
455
  The panel only exists in the Web GUI (`desktop` / `web` profiles). `tui` and headless have no
340
456
  sidebar and fall back to the `/hub board` command and the `board_list` tool.
341
457
 
458
+ ## Mounted folders (additional directories)
459
+
460
+ A project can mount extra **auxiliary folders** on top of its main folder (Claude Code's additional
461
+ directories idea). Add or remove them per project in the "▤ 项目看板" tab, or by command:
462
+
463
+ ```text
464
+ /hub folders list mounted folders
465
+ /hub folders add <path> mount one (absolute, or ~/…)
466
+ /hub folders rm <path> unmount one
467
+ ```
468
+
469
+ Behaviour and boundaries:
470
+
471
+ - **This plugin's own record**: `projects/<id>/folders.json`. It never writes dsh-threads'
472
+ `dsh_threads.json`; each plugin owns its data and removing either leaves the other readable.
473
+ - Paths are stored as **physical absolute paths** (`realpath`): the DSH sandbox rejects an extra
474
+ root spelled through a symlink; missing or non-directory paths are refused.
475
+ - **System prompt**: every project session (main conversation and each thread) gets the mount list
476
+ as a `project-hub/folders` section.
477
+ - **Sandbox**: the host half calls `ctx.sandboxPolicy.registerWritableRoot(session, dir)` for every
478
+ live session of the project, so under `workspace-write` the core file tools and bash can write
479
+ those directories. Grants are runtime-only and per session: the 10-second sweep re-registers them
480
+ after a restart / resume / fork. `read-only` grants no writes; on Windows process confinement
481
+ ignores extra roots (the harness file tools honour them).
482
+ - **Our own file tool honours them**: `kb_add`'s `path` accepts files under the main folder and
483
+ the mounted folders only; any other path fails with the available mounts listed (it reads with the
484
+ plugin's own rights, so it enforces the boundary itself).
485
+ - When a grant cannot be made (no `sandboxPolicy` service, a deleted directory, a non-directory),
486
+ the panel says so explicitly instead of pretending the mount works.
487
+
488
+ ## Switching the main folder (effective after a restart)
489
+
490
+ The "Change folder…" button on the main-folder row (or `/hub folder <absolute path>`) opens the
491
+ system folder chooser; type a path in the same block when no chooser is available. Then:
492
+
493
+ - **Two records move together, or nothing does**:
494
+ - `~/.dsh/storages/dsh_threads.json` → `tables.projects[<id>].folder`: what dsh-threads renders and
495
+ what this panel reads directly (no second copy of the truth here);
496
+ - `~/.dsh/storages/workspace.json` → `tables.workspaces[<workspaceId>].path`: **a new session's
497
+ directory is read from here**. Writing only the first one would show a new folder while new
498
+ sessions still opened the old one; so when the second write cannot be made, the whole switch fails
499
+ and nothing changes.
500
+ - **Backup first**: each storage file gets a `<file>.bak-mainfolder-<timestamp>` copy. Writes go
501
+ through the storage domain dsh-threads / DSH already opened (authoritative memory, serialised write
502
+ chain); when the host exposes no such service the writer degrades to "re-read → atomic rename" and
503
+ the panel says this switch wrote the files directly.
504
+ - **Validation**: the target must exist and be a directory and is canonicalised (`realpath`, no
505
+ trailing slash, symlinks resolved). `/`, `/Applications`, `/System`, `/Library`, `/usr` and the
506
+ other system roots are refused, as are the home directory itself, `~/.dsh` (and anything under it),
507
+ `~/.ssh` and this plugin's own data directory. A directory another DSH workspace already claims is
508
+ refused too (DSH's startup consistency check would fail).
509
+ - **No silent failure**: the writer reads both records back, and on any mismatch or error it rolls
510
+ both back and shows the reason (including the backup paths) in the panel.
511
+ - **What actually changes, honestly**: DSH caches workspace records in process memory, therefore
512
+
513
+ > **New sessions and threads use the new folder only once DeepSeek Harness restarts; this
514
+ > conversation stays in its original folder until then.**
515
+
516
+ The write path never touches a live session's working directory (it only writes those two records),
517
+ which is exactly why the current conversation does not move. The panel and `/hub folder` say so;
518
+ neither claims the switch is immediate.
519
+ - **Coupling risk**: the `dsh_threads` / `workspace` domain names and fields are dsh-threads' and
520
+ DSH's private contracts. Once upstream PR #61 lands, this should switch to its official entry point.
521
+ If a field stops matching, the switch fails and rolls back instead of corrupting a record.
522
+ See [`docs/folders-feasibility.md`](docs/folders-feasibility.md).
523
+
342
524
  ## Install
343
525
 
344
526
  Requires DeepSeek Harness 0.2.1-rc.2 through 0.3.0.
@@ -384,6 +566,21 @@ Other profiles: `dsh plugin --profile web remove dsh-claude-project-ui`.
384
566
 
385
567
  Data stays in `~/.dsh/project-hub/`; uninstalling does not delete it.
386
568
 
569
+ ## Quick start (3 steps)
570
+
571
+ After installing and **quitting DSH completely and starting it again**:
572
+
573
+ ```text
574
+ /hub status which project am I in, how much knowledge / how many tasks
575
+ /hub note release gate is node test/harness.mjs
576
+ /hub add release checklist | 1) run tests 2) npm pack 3) gh release
577
+ /hub brief a project brief to paste into thread_open.task
578
+ ```
579
+
580
+ The "▤ 项目看板" tab in the right pane should now show the task and thread state you just added; `tui` / headless
581
+ have no sidebar, so use `/hub board` there. When you open a new thread it starts with the project brief, the board
582
+ snapshot and recent progress already attached.
583
+
387
584
  ## Configuration
388
585
 
389
586
  Override in the profile's `cordis.patch.yml`:
@@ -394,10 +591,13 @@ Override in the profile's `cordis.patch.yml`:
394
591
  config:
395
592
  dataDir: "" # default ~/.dsh/project-hub
396
593
  threadsStorage: "" # default ~/.dsh/storages/dsh_threads.json
594
+ workspaceStorage: "" # default: workspace.json next to threadsStorage (written on a folder switch)
397
595
  knowledgeIndexMaxChars: 280
398
596
  kbIndexMaxDocs: 3
399
597
  boardContextMaxChars: 700
400
598
  digestContextMaxChars: 700
599
+ maxExtraFolders: 8 # auxiliary folders a project may mount
600
+ foldersContextMaxChars: 600 # cap for the injected mount list
401
601
  briefMaxChars: 4000
402
602
  maxNotes: 200
403
603
  maxDocs: 200
@@ -406,6 +606,24 @@ Override in the profile's `cordis.patch.yml`:
406
606
  autoConvergeReports: true # roll thread reports up into board tasks (idempotent)
407
607
  ```
408
608
 
609
+ | Field | Default | Effect |
610
+ |---|---|---|
611
+ | `dataDir` | `~/.dsh/project-hub` | Root for knowledge, tasks and notes; pointing it elsewhere gives you a separate set of projects |
612
+ | `threadsStorage` | `~/.dsh/storages/dsh_threads.json` | Read-only for detection; also written when the main folder is switched (see above). A format change degrades to "no injection" |
613
+ | `workspaceStorage` | `workspace.json` next to `threadsStorage` | Written only on a folder switch: a new session's directory comes from `workspaces[].path` here; a wrong value makes the switch fail and roll back |
614
+ | `knowledgeIndexMaxChars` | `280` | Character cap for the injected knowledge index |
615
+ | `kbIndexMaxDocs` | `3` | How many documents the index lists before pointing at `kb_search` |
616
+ | `boardContextMaxChars` | `700` | Character cap for the injected board snapshot |
617
+ | `digestContextMaxChars` | `700` | Character cap for the injected recent-progress digest |
618
+ | `maxExtraFolders` | `8` | Auxiliary folders a project may mount |
619
+ | `foldersContextMaxChars` | `600` | Character cap for the injected auxiliary-folder list |
620
+ | `briefMaxChars` | `4000` | Cap for one `context_brief` / `/hub brief` result |
621
+ | `maxNotes` | `200` | Progress notes kept per project |
622
+ | `maxDocs` | `200` | Knowledge documents allowed per project |
623
+ | `maxKnowledgeChars` | `4000000` | Total knowledge characters allowed per project |
624
+ | `hideResolvedThreads` | `true` | Hide resolved / archived threads from the board and injection; `board_list all=true` shows everything |
625
+ | `autoConvergeReports` | `true` | Mirror thread reports onto the board as tasks (idempotent by `threadId`) |
626
+
409
627
  ## Data
410
628
 
411
629
  ```
@@ -413,10 +631,14 @@ Override in the profile's `cordis.patch.yml`:
413
631
  knowledge.json knowledge documents
414
632
  board.json manual tasks
415
633
  notes.json project context notes
634
+ folders.json auxiliary folder mounts (this plugin's own record)
416
635
  ```
417
636
 
418
637
  Plain JSON, written atomically (temp file + rename); safe to back up or edit by hand.
419
638
 
639
+ A main-folder switch does not touch this directory: it writes `~/.dsh/storages/dsh_threads.json` and
640
+ `~/.dsh/storages/workspace.json`, keeping a `*.bak-mainfolder-<timestamp>` copy of every file it changes.
641
+
420
642
  ## Known limitations
421
643
 
422
644
  - Project detection reads dsh-threads' storage file. If that format changes, detection breaks and
@@ -426,8 +648,17 @@ Plain JSON, written atomically (temp file + rename); safe to back up or edit by
426
648
  - Summaries are not model-generated: the automatic part comes from dsh-threads' `lastReport`, the
427
649
  manual part from `hub_note`. Nothing the main conversation never reported will show up.
428
650
  - Injection is truncated by characters (700–900 per section by default), not by tokens.
429
- - The panel is read-only: creating, changing or deleting tasks today means `board_add` /
430
- `board_update` / `/hub task|done|rm`.
651
+ - The panel is read-only apart from **adding/removing auxiliary folders** and **switching the main
652
+ folder**: creating, changing or deleting tasks today means `board_add` / `board_update` /
653
+ `/hub task|done|rm`.
654
+ - Switching the main folder depends on the private fields of two storage domains (`dsh_threads` and
655
+ `workspace`). Once upstream PR #61 lands this should move to its entry point; if a field stops
656
+ matching, the switch errors out and rolls back rather than corrupting a record.
657
+ - Switching the main folder does **not** move the current conversation: only sessions and threads
658
+ created after a DSH restart use the new directory, and the panel plus `/hub folder` say exactly that.
659
+ - Auxiliary folder grants only take effect under `workspace-write`; `read-only` grants nothing.
660
+ Grants are runtime state that must be re-registered after a restart / resume (the sweep does it,
661
+ so it can lag up to 10 seconds).
431
662
  - Refreshes are polled: every 10 seconds plus on agent status changes, so a snapshot can be up to
432
663
  10 seconds stale.
433
664
  - The board hides resolved/archived threads by default; use `board_list all=true` or
@@ -442,10 +673,14 @@ Plain JSON, written atomically (temp file + rename); safe to back up or edit by
442
673
  | Injection (knowledge) | Pass | Real system prompt contained the shared-knowledge section |
443
674
  | Injection (board/progress) | Pass | Thread #2's request body (`user/message`, 12.7 KB) contained `## 项目看板`, two thread rows and `## 项目进展` verbatim; knowledge rode in `system/message` (section vs context channels) |
444
675
  | Schema compatibility | Pass | `node test/spec-check.mjs` validates all 10 tool definitions against the host DSL |
445
- | Logic | Pass | `node test/harness.mjs`, 19 checks (changedFiles, hiding rules, rollup idempotency, `/hub doctor`) |
676
+ | Logic | Pass | `node test/harness.mjs`, 30 checks (changedFiles, hiding rules, rollup idempotency, `/hub doctor`, extraFolders persistence / prompt injection / kb_add path boundary / folder route auth, main-folder switch (both records, backup, refused paths, concurrent writes, rollback), `/hub folder`, the route) |
446
677
 
447
678
  ## Relationship to Team mode
448
679
 
449
680
  A Team-mode task board belongs to **one session's subagent tree**; this plugin's board belongs to
450
681
  **one dsh-threads project** (main conversation plus all of its threads). They complement each other
451
682
  and never write to the same place.
683
+
684
+ ## License
685
+
686
+ MIT — see [LICENSE](LICENSE).