dsh-claude-project-ui 0.2.1 → 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,5 +1,56 @@
1
1
  # Changelog
2
2
 
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
+
3
54
  ## 0.2.1 — 2026-11-18
4
55
 
5
56
  代码行为与 0.2.0 一致(`src/` 未改);这一版只为把仓库里的文档同步到 npm 页面,并给发布加一道门禁。
package/README.md CHANGED
@@ -46,9 +46,13 @@
46
46
  | 开 thread 时的上下文简报 | 手写 `task` 文本 | ✅ `context_brief` 一键拼好 |
47
47
  | 讨论串回报汇聚成任务 | ❌ | ✅ 幂等自动汇总(按 `threadId` 去重) |
48
48
  | 讨论串建好时的启动上下文 | — | ✅ 自动注入项目说明 + 看板 + 他人进展 |
49
+ | 辅助文件夹(多目录挂载) | PR #61 在做,未发布 | ✅ 本插件自己存 + 提示注入 + 沙箱可写根 |
50
+ | 切换项目主文件夹 | PR #61 在做,未发布 | ✅ 本插件实现(写 dsh-threads 记录 + DSH workspace 记录,重启后新会话生效) |
49
51
 
50
- 两个插件通过**只读存储文件**解耦:本插件不 import dsh-threads 的模块,也不写它的存储。
51
- 任何一个卸载,另一个照常工作;dsh-threads 换存储格式时本插件静默降级为「不注入」,不会报错。
52
+ 两个插件通过**存储文件 + storage-domain 写链**解耦:本插件不 import dsh-threads 的模块,平时只读它的存储;
53
+ 只有「切换主文件夹」这一条写路径(`src/mainfolder.js`)会动它的项目记录和 DSH 的 workspace 记录,
54
+ 而且走 dsh-threads 已经打开的 domain 句柄、带备份与回滚。任何一个卸载,另一个照常工作;
55
+ dsh-threads 换存储格式时本插件静默降级为「不注入」,不会报错。
52
56
 
53
57
  ## 功能
54
58
 
@@ -94,6 +98,8 @@
94
98
  /hub kb [关键词] 知识库列表或检索
95
99
  /hub brief 项目简报
96
100
  /hub note <文本> 记一条项目级上下文
101
+ /hub folders [add|rm <路径>] 辅助文件夹:列出 / 挂载 / 移除
102
+ /hub folder [<路径>] 看 / 切换项目主文件夹(当前对话不动,重启后新会话才用新目录)
97
103
  /hub add <标题> | <正文> 加一篇知识库文档(正文可省略)
98
104
  ```
99
105
 
@@ -112,6 +118,60 @@
112
118
  面板只在 Web GUI(`desktop` / `web` profile)出现;`tui` / headless 没有侧栏,
113
119
  退化成 `/hub board` 命令和 `board_list` 工具。
114
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
+
115
175
  ## 安装
116
176
 
117
177
  需要 DeepSeek Harness 0.2.1-rc.2 到 0.3.0。
@@ -180,10 +240,13 @@ dsh plugin --profile web add dsh-claude-project-ui
180
240
  config:
181
241
  dataDir: "" # 默认 ~/.dsh/project-hub
182
242
  threadsStorage: "" # 默认 ~/.dsh/storages/dsh_threads.json
243
+ workspaceStorage: "" # 默认与 threadsStorage 同目录的 workspace.json(切换主文件夹时写)
183
244
  knowledgeIndexMaxChars: 280
184
245
  kbIndexMaxDocs: 3
185
246
  boardContextMaxChars: 700
186
247
  digestContextMaxChars: 700
248
+ maxExtraFolders: 8 # 一个项目最多挂载几个辅助文件夹
249
+ foldersContextMaxChars: 600 # 注入的挂载目录列表字符上限
187
250
  briefMaxChars: 4000
188
251
  maxNotes: 200
189
252
  maxDocs: 200
@@ -195,11 +258,14 @@ dsh plugin --profile web add dsh-claude-project-ui
195
258
  | 字段 | 默认值 | 影响 |
196
259
  |---|---|---|
197
260
  | `dataDir` | `~/.dsh/project-hub` | 知识库 / 任务 / 笔记的根目录;换掉就是另一套项目数据 |
198
- | `threadsStorage` | `~/.dsh/storages/dsh_threads.json` | 只读;用来识别「哪些会话属于哪个项目」,格式变了会静默降级为不注入 |
261
+ | `threadsStorage` | `~/.dsh/storages/dsh_threads.json` | 只读;用来识别「哪些会话属于哪个项目」,格式变了会静默降级为不注入。切换主文件夹时这一处也会被写(见上) |
262
+ | `workspaceStorage` | 与 `threadsStorage` 同目录的 `workspace.json` | 只在切换主文件夹时写:新会话的目录来自这里的 `workspaces[].path`;指错会让切换失败并回滚 |
199
263
  | `knowledgeIndexMaxChars` | `280` | 注入的知识库索引字符上限;调大占提示词预算,调小了只列更少文档 |
200
264
  | `kbIndexMaxDocs` | `3` | 索引里最多列几篇文档,其余提示用 `kb_search` 检索 |
201
265
  | `boardContextMaxChars` | `700` | 注入的看板快照字符上限 |
202
266
  | `digestContextMaxChars` | `700` | 注入的「最近进展」字符上限 |
267
+ | `maxExtraFolders` | `8` | 一个项目最多挂载几个辅助文件夹 |
268
+ | `foldersContextMaxChars` | `600` | 注入的辅助文件夹列表字符上限 |
203
269
  | `briefMaxChars` | `4000` | `context_brief` / `/hub brief` 的单次输出上限 |
204
270
  | `maxNotes` | `200` | 每个项目保留多少条 `hub_note` 进展笔记 |
205
271
  | `maxDocs` | `200` | 每个项目允许的知识库文档数 |
@@ -214,17 +280,27 @@ dsh plugin --profile web add dsh-claude-project-ui
214
280
  knowledge.json 知识库文档
215
281
  board.json 手动任务
216
282
  notes.json 项目上下文笔记
283
+ folders.json 辅助文件夹挂载(本插件自己的记录)
217
284
  ```
218
285
 
219
286
  全部是普通 JSON,原子写入(临时文件 + rename),可以手工备份或编辑。
220
287
 
288
+ 切换主文件夹不改这里,而是改 `~/.dsh/storages/dsh_threads.json` 与 `~/.dsh/storages/workspace.json`
289
+ (写前各留一份 `*.bak-mainfolder-<时间戳>`)。
290
+
221
291
  ## 已知限制
222
292
 
223
293
  - 只读识别 dsh-threads 的存储文件;它的存储格式若改变,项目识别会失效(插件会静默降级为「不注入」而不是报错)。
224
294
  - 知识库是**词法检索**(CJK 二元组 + 英文词 + 词频归一化),没有向量检索,也没有 LLM 摘要;文档要自己写清楚标题和关键词。
225
295
  - 摘要不是模型生成的:自动部分来自 dsh-threads 的 `lastReport`,手动部分来自 `hub_note`。主对话自己没回报过的东西不会出现。
226
296
  - 注入内容按字符截断(每段默认 700-900 字),不是按 token 精确计量。
227
- - 面板是只读的:建/改/删任务目前只能用 `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 秒)。
228
304
  - 轮询刷新:每 10 秒 + agent 状态变化时刷新提示词快照,最坏情况看到的是 10 秒前的看板。
229
305
  - 看板默认隐藏已解决/已归档的讨论串;想全看用 `board_list all=true` 或 `/hub board --all`。
230
306
 
@@ -237,7 +313,7 @@ dsh plugin --profile web add dsh-claude-project-ui
237
313
  | 注入 | 通过(知识库) | 真实 system prompt 中出现:`本项目共享知识库(主对话和每个讨论串都会收到这份索引)。\n## 项目知识库(1 篇…)` |
238
314
  | 注入(看板/进展) | 通过 | 讨论串 #2 的请求体(`user/message` 记录,12.7KB)里逐字包含 `## 项目看板`、两行讨论串状态、`## 项目进展` 段;KB 则在 `system/message` 里(section vs context 两种注入通道) |
239
315
  | schema 兼容 | 通过 | `node test/spec-check.mjs` 对照宿主 DSL 校验 10 个工具定义 |
240
- | 逻辑 | 通过 | `node test/harness.mjs` 19 项(含 changedFiles、隐藏规则、汇总幂等、/hub doctor) |
316
+ | 逻辑 | 通过 | `node test/harness.mjs` 30 项(含 changedFiles、隐藏规则、汇总幂等、/hub doctor、extraFolders 持久化 / 提示注入 / kb_add 目录校验 / 文件夹路由鉴权、主文件夹切换(两处记录 / 备份 / 拒绝非法路径 / 并发不丢数据 / 回滚)/ `/hub folder` / 路由) |
241
317
 
242
318
  ## 与 Team 模式的关系
243
319
 
@@ -304,11 +380,15 @@ Quit DSH completely and start it again after editing.
304
380
  | Brief when opening a thread | hand-written `task` text | ✅ `context_brief` assembles it |
305
381
  | Thread reports rolled up as tasks | ❌ | ✅ idempotent rollup keyed by `threadId` |
306
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) |
307
385
 
308
- The two plugins are decoupled through a **read-only storage file**: this plugin never imports
309
- dsh-threads modules and never writes its storage. Uninstalling either leaves the other working; if
310
- dsh-threads changes its storage format, this plugin silently degrades to "no injection" instead of
311
- 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.
312
392
 
313
393
  ## Features
314
394
 
@@ -355,6 +435,8 @@ Thread state is owned by dsh-threads and read-only here:
355
435
  /hub kb [query] List the knowledge base, or search it
356
436
  /hub brief Project brief
357
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)
358
440
  /hub add <title> | <body> Add a knowledge document (body optional)
359
441
  ```
360
442
 
@@ -373,6 +455,72 @@ The browser half registers a "项目看板" tab in the **right-hand sidebar pane
373
455
  The panel only exists in the Web GUI (`desktop` / `web` profiles). `tui` and headless have no
374
456
  sidebar and fall back to the `/hub board` command and the `board_list` tool.
375
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
+
376
524
  ## Install
377
525
 
378
526
  Requires DeepSeek Harness 0.2.1-rc.2 through 0.3.0.
@@ -443,10 +591,13 @@ Override in the profile's `cordis.patch.yml`:
443
591
  config:
444
592
  dataDir: "" # default ~/.dsh/project-hub
445
593
  threadsStorage: "" # default ~/.dsh/storages/dsh_threads.json
594
+ workspaceStorage: "" # default: workspace.json next to threadsStorage (written on a folder switch)
446
595
  knowledgeIndexMaxChars: 280
447
596
  kbIndexMaxDocs: 3
448
597
  boardContextMaxChars: 700
449
598
  digestContextMaxChars: 700
599
+ maxExtraFolders: 8 # auxiliary folders a project may mount
600
+ foldersContextMaxChars: 600 # cap for the injected mount list
450
601
  briefMaxChars: 4000
451
602
  maxNotes: 200
452
603
  maxDocs: 200
@@ -458,11 +609,14 @@ Override in the profile's `cordis.patch.yml`:
458
609
  | Field | Default | Effect |
459
610
  |---|---|---|
460
611
  | `dataDir` | `~/.dsh/project-hub` | Root for knowledge, tasks and notes; pointing it elsewhere gives you a separate set of projects |
461
- | `threadsStorage` | `~/.dsh/storages/dsh_threads.json` | Read-only; used to tell which sessions belong to a project. A format change degrades to "no injection" |
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 |
462
614
  | `knowledgeIndexMaxChars` | `280` | Character cap for the injected knowledge index |
463
615
  | `kbIndexMaxDocs` | `3` | How many documents the index lists before pointing at `kb_search` |
464
616
  | `boardContextMaxChars` | `700` | Character cap for the injected board snapshot |
465
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 |
466
620
  | `briefMaxChars` | `4000` | Cap for one `context_brief` / `/hub brief` result |
467
621
  | `maxNotes` | `200` | Progress notes kept per project |
468
622
  | `maxDocs` | `200` | Knowledge documents allowed per project |
@@ -477,10 +631,14 @@ Override in the profile's `cordis.patch.yml`:
477
631
  knowledge.json knowledge documents
478
632
  board.json manual tasks
479
633
  notes.json project context notes
634
+ folders.json auxiliary folder mounts (this plugin's own record)
480
635
  ```
481
636
 
482
637
  Plain JSON, written atomically (temp file + rename); safe to back up or edit by hand.
483
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
+
484
642
  ## Known limitations
485
643
 
486
644
  - Project detection reads dsh-threads' storage file. If that format changes, detection breaks and
@@ -490,8 +648,17 @@ Plain JSON, written atomically (temp file + rename); safe to back up or edit by
490
648
  - Summaries are not model-generated: the automatic part comes from dsh-threads' `lastReport`, the
491
649
  manual part from `hub_note`. Nothing the main conversation never reported will show up.
492
650
  - Injection is truncated by characters (700–900 per section by default), not by tokens.
493
- - The panel is read-only: creating, changing or deleting tasks today means `board_add` /
494
- `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).
495
662
  - Refreshes are polled: every 10 seconds plus on agent status changes, so a snapshot can be up to
496
663
  10 seconds stale.
497
664
  - The board hides resolved/archived threads by default; use `board_list all=true` or
@@ -506,7 +673,7 @@ Plain JSON, written atomically (temp file + rename); safe to back up or edit by
506
673
  | Injection (knowledge) | Pass | Real system prompt contained the shared-knowledge section |
507
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) |
508
675
  | Schema compatibility | Pass | `node test/spec-check.mjs` validates all 10 tool definitions against the host DSL |
509
- | 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) |
510
677
 
511
678
  ## Relationship to Team mode
512
679
 
@@ -0,0 +1,204 @@
1
+ # 文件夹功能可行性验证(2026-11-18)
2
+
3
+ > 2026-11-18 更新:第 2 项「切换主文件夹」**已由本包实现**(用户决定不等上游合并,把 PR #61 的服务端语义
4
+ > 移植进 `src/mainfolder.js`)。§2 从「不可做」改写为「怎么做的、字段来源、耦合风险」;
5
+ > §1(沙箱额外根)、§3(UI 槽位)的只读验证结论不变。
6
+
7
+ > 只读验证:不写 `~/.dsh` 安装副本、不改 dsh-threads 数据、不重启 app。
8
+ > 被验证对象:`DeepSeek Harness 0.2.2`(`/Applications/DeepSeek Harness.app/Contents/Resources/app.asar`,
9
+ > 包源码从 asar 抽出到 `/tmp/dsx`,行号即该包 `src/*.ts` 原文行号)、
10
+ > `@kyf-eng/dsh-threads` 0.2.0(本机 install 为打过 PR #61 补丁的 dist;PR 源码在
11
+ > `~/Documents/deepseek-harness/pr-work/dsh-threads`)。
12
+
13
+ ## 结论表
14
+
15
+ | # | 能力 | 结论 | 依赖 / 绕路 |
16
+ |---|---|---|---|
17
+ | 1 | 给沙箱加「额外允许路径」的插件 API | **可做** | `ctx.sandboxPolicy.registerWritableRoot(session, dir)`;按会话、运行时生效、返回 disposer |
18
+ | 2 | 切换项目**主文件夹** | **已在本包实现(写入 dsh-threads 记录)** | `src/mainfolder.js`:同时写 `dsh_threads.json` 的 `projects[].folder` 与 `workspace.json` 的 `workspaces[].path`;详见 §2 |
19
+ | 3 | 我们的插件承载文件夹 UI | **可做** | 现有 `sidebar.right.pane.tab`(keyed/session)里加一块即可;`settings.section` 也可用(形状见 §3) |
20
+ | 4 | 辅助文件夹(多目录挂载)整体 | **可做** | 存本插件 `projects/<id>/folders.json`;提示注入 + 沙箱授权 + 我们自己的 `kb_add` 路径校验 |
21
+
22
+ ---
23
+
24
+ ## 1) 沙箱额外允许路径 API
25
+
26
+ **结论:有,且第三方插件可直接复用。** DSH 把它做成 Cordis 服务 `ctx.sandboxPolicy` 的公开方法
27
+ (不是 dsh-threads 私有的)。
28
+
29
+ 证据:
30
+
31
+ - `dsh/node_modules/@deepseek-ai/dsh-sandbox-policy/src/index.ts:244-261` —— 方法签名与语义:
32
+
33
+ ```ts
34
+ registerWritableRoot(session: Session, directory: string): () => void
35
+ ```
36
+
37
+ 注释写明:给「这个会话」后续的 workspace-write 操作加写授权;调用方拥有该 effect,dispose 只撤销自己这一条;
38
+ 授权是**运行时**的,resume / fork 后要重新注册;Windows 上只有 harness 的文件工具认,进程隔离不认。
39
+ - `dsh-sandbox-policy/src/index.ts:208-220` —— `resolve()` 把「配置里的额外根 + 该会话的活动注册」快照进
40
+ `additionalWritableRoots`,文件工具与沙箱执行器读同一份策略。
41
+ - `dsh-sandbox/src/index.ts:48-69` —— `SandboxExecutionPolicy.additionalWritableRoots` 的契约
42
+ (「Extra physical absolute directories workspace-write may also write under」)。
43
+ - `dsh-sandbox/src/roots.ts:87-91`、`:103-105` —— `workspaceWritableRoots()` / `writableRoots()` 把
44
+ workspaceRoot 与额外根合并成允许列表(`read-only` 返回空)。
45
+ - `dsh-fs-sandbox/src/index.ts:160-176` —— 文件写入的 containment 检查用 `writableRoots(policy)`,即额外根真的生效。
46
+ - `dsh/node_modules/@deepseek-ai/dsh/docs/subsystems/sandbox.md:221-233` —— 文档里作为 surface 公开列出
47
+ `registerWritableRoot`,说明它是受支持的扩展点而不只是内部实现。
48
+ - **上游 PR #61 正是这么做的**:`pr-work/dsh-threads/src/install.ts:21-25` 定义 `SandboxPolicyLike`,
49
+ `:56-62` 对每个挂载目录 `policy.registerWritableRoot(agent.session, folder)`,并在
50
+ `:40-42` 把挂载列表拼进 key、变化时重装——证明「第三方插件 / 另一个 profile bundle」能拿到这个服务。
51
+
52
+ 注意事项(实现时按此处理):
53
+
54
+ - 授权按 **Session 对象**,不是按目录全局;我们得对项目里每个存活会话各注册一次(主对话 + 每个讨论串)。
55
+ - 运行时授权,**重启 / resume / fork 后消失**;要跟着插件的刷新循环重新注册。
56
+ - `read-only` 模式下额外根不授予任何写权限;`danger-full-access` 本来就不受限。
57
+ - 路径必须是**物理绝对路径**:`dsh-sandbox/src/roots.ts:36-50` 对 symlink 拼写直接报
58
+ `SANDBOX_INVALID_ROOT`;不存在、不是目录也会在每次调用时被拒绝。→ 我们存盘前 `realpath` 归一化。
59
+ - 句柄来源:`ctx.get('sandboxPolicy')`(try/catch 兜底,缺失时 `undefined`,不能静默当成功)。
60
+
61
+ ## 2) 切换项目主文件夹
62
+
63
+ **结论:已在本包实现(2026-11-18,用户决定不等上游合并)。** 上游 PR #61 已在 dsh-threads 内部做了这件事;
64
+ 本包把它的服务端语义移植过来,不改它的 UI 结构。下面写清「谁读哪个字段」「为什么不能直写文件」
65
+ 「本包怎么兜住安全」「和 PR #61 的差异」「耦合风险」。
66
+
67
+ ### 2.1 两个记录,各喂一个消费者(字段来源)
68
+
69
+ | 记录 | 文件 | 字段 | 谁读它 |
70
+ |---|---|---|---|
71
+ | dsh-threads 项目 | `~/.dsh/storages/dsh_threads.json` | `tables.projects[<projectId>].folder` | dsh-threads 渲染项目栏、`projects.update` 的校验;本插件面板直接读它(不另存一份真相) |
72
+ | DSH workspace | `~/.dsh/storages/workspace.json` | `tables.workspaces[<workspaceId>].path` | DSH workspace registry;**新建会话的目录**(`sessionController.create({ workspaceId })`) |
73
+
74
+ 证据(PR #61 分支源码,`~/Documents/deepseek-harness/pr-work/dsh-threads`):
75
+
76
+ - `src/storage.ts` 的 `projectSchema` 有 `folder` 与 `workspaceId`;`src/types.ts:126-140` 注释:
77
+ 「A project … one folder (a DSH workspace)」。
78
+ - `src/host.ts:190-201` `switchFolder`:**先**改 `ctx.storageDomain.get('workspace').table('workspaces')`
79
+ 的 `path`,再让 `projects.update` 落 `folder`——两处一起改。
80
+ - `src/host.ts:110-116` `createSession`、`:129-131` `createMainSession` 都以 `workspaceId` 建会话,
81
+ 即新会话目录来自 `workspace.json` 的 `path`;`src/host.ts:137-138` `workspace(workspaceId)` 读的是 registry。
82
+ - **对任务书的一处修正**:任务书写「`project.folder` 是它创建会话时读取的来源」,实测**不是**——
83
+ 只写 `project.folder` 会让面板显示新目录、新讨论串仍在旧目录(假切换)。所以本包两处一起写,
84
+ 第二处写不进去时整次切换失败、什么都不改。
85
+ - `src/projects.ts:180` `folderPendingRestart: workspace.path !== project.folder`:dsh-threads 自己的 UI 用
86
+ registry **内存里**的 workspace 路径与项目记录比较,因此它本来就会显示「需要重启」——与本包的文案一致。
87
+
88
+ ### 2.2 为什么不能「直接从外面改文件」
89
+
90
+ - `dsh-storage-domain/src/domain.ts:1-10`:domain 的**内存态是权威**,读是同步读内存,写走**单条写链**
91
+ (先落盘、再改内存、再发事件)。
92
+ - `dsh-storage-json/src/single-unit.ts`:single 布局每次写都**整文件原子重发**。
93
+ - 所以外部改文件 → 运行中的 dsh-threads / DSH 看不到(读内存),它们下一次写会把外部改动整段覆盖(丢更新);
94
+ 同一 domain 只允许一个打开句柄(`storage-domain/src/index.ts` `open` 的 `already-open`)。
95
+ - 本包因此**优先走 `ctx.storageDomain`**:`get('dsh_threads')` / `get('workspace')` 拿到的就是它们已打开的那个
96
+ domain,`table.update()` 排在同一条写链上(`domain.d.ts`:`update` 的 `fn` 看到「队列槽位上的当前值」)。
97
+ 宿主没有暴露该服务时(非标准 profile、测试)才退化为文件直写:**重新读取 → 原子 rename**,
98
+ 并在面板上写明「这次是直写文件,重启前可能被覆盖」,不假装等价。
99
+
100
+ ### 2.3 本包的做法(`src/mainfolder.js`)
101
+
102
+ 1. **校验**:必须绝对路径(`~` 可展开)、存在、是目录;`realpath` 归一化(去尾斜杠、解 symlink);
103
+ 拒绝 `/`、`/Applications`、`/System`、`/Library`、`/usr`、`/bin`、`/sbin`、`/etc`、`/dev`、`/cores`
104
+ 这些系统根,拒绝系统目录里的**任何**路径、用户主目录本身、`~/.dsh`(含子目录)、`~/.ssh`、
105
+ 本插件自己的数据目录(`protectedTrees`)。
106
+ 2. **冲突检查**:目标目录已被**另一个** DSH workspace 记录占用时拒绝(否则 DSH 启动时的 workspace 一致性检查会失败)。
107
+ 3. **备份**:`dsh_threads.json` 与 `workspace.json` 各留一份 `<文件>.bak-mainfolder-<时间戳>`。
108
+ 4. **写**:先写 workspace 的 `path`,再写 project 的 `folder` + `updatedAt`(整条记录替换,未知字段不动)。
109
+ 5. **读回校验 + 回滚**:读回两条记录,任何一条不等于目标就回滚两条(`restore` 只改回那一个字段,
110
+ 不回写整份快照),错误信息带备份路径;面板 / `/hub folder` 直接显示该错误。
111
+ 6. **串行化**:模块内按「两个存储路径」做读写队列,连点两次不会交错;走 domain 时另外还有 domain 自己的写链。
112
+ 7. **生效边界**:只写这两条记录,**不调用**任何改活动会话工作目录的 API(PR #61 的 `enterFolder` 属于
113
+ dsh-threads 的私有 host 能力)。因此:
114
+
115
+ > **新会话和新讨论串要等 DSH 重启之后才用新文件夹;当前这个对话在重启前仍留在原目录。**
116
+
117
+ 面板(中英)与 `/hub folder` 的文案都按这句写,不出现「立即生效」。
118
+
119
+ ### 2.4 与上游 PR #61 的差异
120
+
121
+ | | PR #61(dsh-threads 内) | 本包(`src/mainfolder.js`) |
122
+ |---|---|---|
123
+ | 改写 `workspace.path` | ✅ `switchFolder` | ✅ 同一语义 |
124
+ | 改写 `project.folder` | ✅ `projects.update` | ✅ 同一语义 |
125
+ | 当前主对话当场换目录 | ✅ `enterFolder` → `workingDirectory.set` | ❌ **故意不做**(用户要求「当前对话不动」,且那是它的私有 host API) |
126
+ | 备份 / 回滚 | ❌(domain 写链保证原子,但没有备份) | ✅ 写前备份、写后读回、失败回滚 |
127
+ | 危险路径校验 | ❌ 只校验「存在且是目录」+ 路径占用 | ✅ 额外拒绝系统目录 / 家目录 / `~/.dsh` / `~/.ssh` / 插件数据目录 |
128
+ | UI | 它自己的项目设置页 | 本包「▤ 项目看板」的文件夹区 + `/hub folder` |
129
+
130
+ ### 2.5 耦合风险(必须知道)
131
+
132
+ - domain 名(`dsh_threads` / `workspace`)与字段(`projects[].folder` / `workspaces[].path`)是**私有契约**,
133
+ 上游改 schema 时本包会失败:`table.update` 抛错或读回不一致 → 回滚 + 报错,不会写坏记录。
134
+ - 文件直写退化路径(宿主没有 `storageDomain`)本质上仍有丢更新窗口:面板会标注,重启前建议再看一眼路径。
135
+ - PR #61 合并后应改用它提供的官方入口(它还会处理 `extraFolders`、主对话 cwd),
136
+ 本包的 writer 可以在那时缩成一个调用。
137
+ - 本包 `inject` 因此多了 `storageDomain`:没有这个服务的 profile 会让插件等待挂载(与 `webServer` 同样的取舍)。
138
+
139
+ ### 2.6 早期被否掉的绕路(历史记录,2026-11-18 上午的结论)
140
+
141
+ 实现前逐条否掉的绕法,留档避免重复踩;括号里是本次实现怎么处理它们:
142
+
143
+ 1. **直接写 `dsh_threads.json`** → 丢更新(domain 内存态权威、整文件重发)。→ 现在只在宿主没有
144
+ `storageDomain` 时退化使用,并明确标注「直写文件」;正常路径走 domain 写链。
145
+ 2. **只用 `ctx.storageDomain.get('dsh_threads')` 改 `projects[].folder`** → 写序安全了,但不换
146
+ DSH workspace、新会话仍旧目录,UI 是假的「已切换」。→ 现在**同时**改 `workspace.json` 的
147
+ `workspaces[].path`,第二处写不进去就整体失败。
148
+ 3. **浏览器半直接 `POST /api/dsh-threads` 的 `projects.update`** → 只在打了 PR #61 补丁的本机 install 上有效,
149
+ 私有契约、未合并。→ 仍然不做。
150
+
151
+ ## 3) 我们的插件承载 UI
152
+
153
+ ### 3.1 右栏页签(本插件当前做法,推荐)
154
+
155
+ - slot 名:`sidebar.right.pane.tab`,契约:`dsh-client-ui-sidebar-right/src/client/contract/slots.ts:59-64`
156
+ (keyed、session 作用域、owner 声明里带 `hookContext` 与 `inject: { hooks: { tabInfo } }`)。
157
+ - 本插件已经在用:`src/client.js:227-232`
158
+ `slots.inject("sidebar.right.pane.tab", () => slots.register({ name, key: TAB_ID, inject: () => ({}) }, BoardTab))`。
159
+ - 结论:文件夹 UI 直接加进现有「▤ 项目看板」页签的 `ProjectBlock` 里即可,不需要新 slot;
160
+ 数据走宿主半已有 webServer 路由模式(`src/index.js:132-159`)。
161
+
162
+ ### 3.2 `settings.section`(备选:做成设置页)
163
+
164
+ 注册形状(list、root 作用域),选项:`id`(必填,list 键 / 导航过滤)、`order`、`label`
165
+ (字符串或 `() => 本地化文案`)、可选 `locale`、`inject`、`children`;组件 props 是
166
+ `PropsRuntime<'settings.section'>`,owner 侧只给一个 `{ close: () => void }`。
167
+
168
+ 证据:`dsh-client-ui-settings/src/client/contract/slots.ts:46-57`(类型)、`:134-137`(owner props),
169
+ `dsh-client-ui-settings-general/src/client/index.ts:266-272`(真实注册)、
170
+ `dsh/docs/subsystems/slots.md:27-52`(`inject` + `register` 范式)。
171
+
172
+ 最小示例(浏览器半,未在本插件启用):
173
+
174
+ ```js
175
+ const slots = ctx.get("slots");
176
+ const Section = ({ close }) =>
177
+ React.createElement("div", null,
178
+ React.createElement("h3", null, "项目文件夹"),
179
+ React.createElement("p", null, "辅助文件夹在这里管理。"),
180
+ React.createElement("button", { onClick: close }, "关闭"));
181
+
182
+ slots.inject("settings.section", () =>
183
+ slots.register({
184
+ name: "settings.section",
185
+ id: "project-folders", // list 槽必填,也是 settings.section.icon 的匹配键
186
+ order: 60,
187
+ label: () => "项目文件夹",
188
+ inject: () => ({})
189
+ }, Section));
190
+ ```
191
+
192
+ 注意:`settings.section` 由 ui-settings-general 在运行时声明;第三方只能 `inject` 后注册
193
+ (`slots.md:27`),不能自己声明这个槽。设置面板不属于本项目当前交互(用户在右栏做),
194
+ 所以本次实现放在右栏页签,设置页留作以后。
195
+
196
+ ## 4) 实现边界(由上面三条推出)
197
+
198
+ - 辅助文件夹:**做**。存本插件自己的 `projects/<id>/folders.json`(与 dsh_threads 不双写);
199
+ 系统提示用 `systemPrompt.section` 列出挂载;对我们自己的 `kb_add` 读文件路径做
200
+ 「主文件夹或已挂载目录」校验;沙箱侧用 `registerWritableRoot` 对项目每个会话授权,
201
+ 授不到(服务缺失 / 目录消失)时在面板上明说,不静默降级。
202
+ - 主文件夹切换:**实现**(`src/mainfolder.js`)。两处记录一起改、写前备份、走 storage-domain 写链、
203
+ 写后读回校验、失败回滚;面板按钮可用并写明「重启后新会话才用新目录、当前对话不动」;
204
+ `/hub folder [<路径>]` 等价入口。风险与差异见 §2.3–§2.5。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-claude-project-ui",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Claude-style Projects + Threads for DeepSeek Harness: a project workspace UI on top of @kyf-eng/dsh-threads (shared project briefs, a cross-thread board panel, carried-over context).",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -34,6 +34,7 @@
34
34
  },
35
35
  "files": [
36
36
  "src",
37
+ "docs",
37
38
  "cordis.patch.yml",
38
39
  "README.md",
39
40
  "CHANGELOG.md",