dsh-extra-paths 0.1.0 → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 0x7a76
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,80 +1,100 @@
1
1
  # dsh-extra-paths
2
2
 
3
- 让 DSH 对一组配置的外部路径**首次尝试即可写、无需审批**:既覆盖 `write`/`edit` 工具,也覆盖 `bash` 子进程。
4
- 插件以服务包装实现,不改 DSH 核心代码,并提供 Web 设置页与「当前工作区解析出的生效根」预览。
3
+ English | [中文](README.zh.md)
5
4
 
6
- ## 安装
5
+ Let DSH **write to a set of configured external paths on the first try, with no approval**: this covers the `write`/`edit`
6
+ tools and `bash` subprocesses alike. The plugin works by wrapping services (it does not change DSH core) and ships a Web
7
+ settings page plus a preview of the effective roots for the current workspace.
7
8
 
8
- 需要 DSH `0.1.5` / `0.2.0` / `0.2.1`(不在范围内会被安装闸门拒绝)。
9
+ ## Install
10
+
11
+ Requires DSH `0.1.5` / `0.2.0` / `0.2.1` / `0.2.2` (outside that range the install gate refuses the package).
12
+
13
+ ```bash
14
+ dsh plugin --profile <name> add dsh-extra-paths # <name> = your profile
15
+ ```
16
+
17
+ From a checkout instead of the registry:
9
18
 
10
19
  ```bash
11
20
  pnpm install && pnpm build
12
- dsh plugin --profile <name> add /path/to/dsh-extra-paths # <name>=你的 profile 名;路径=本仓库的绝对路径
21
+ dsh plugin --profile <name> add /path/to/dsh-extra-paths # path = absolute path to this repo
13
22
  ```
14
23
 
15
- 装好后打开 **设置 → 插件** 里的「Extra paths」卡片,或设置左栏的「额外可写路径」。
24
+ Then open **Extra writable paths** in the settings sidebar. In **Settings → Plugins** the same page lives on this
25
+ plugin's own row: open the `dsh-extra-paths` bundle, then hit that row's **Configure** button.
16
26
 
17
- ## 配置
27
+ ## Configuration
18
28
 
19
- 写进设置文档 `~/.dsh/settings.yaml` 的 `extra-paths` 段,或直接用设置页(**保存即生效,无需重启**)。
20
- 下面的 `<工作根>` 是占位符,指你放项目的那个上层目录(绝对路径,或 `~/` 开头的路径):
29
+ Write it into the `extra-paths` section of the settings document `~/.dsh/settings.yaml`, or just use the settings page
30
+ (**saving takes effect immediately, no restart needed**). `<work root>` below is a placeholder for the directory that
31
+ holds your projects (an absolute path, or one starting with `~/`) — replace it with a path of your own:
21
32
 
22
33
  ```yaml
23
34
  extra-paths:
24
35
  paths:
25
- - <工作根>/notes/home # 用默认 scope/surfaces
26
- - path: ../../notes/home # 相对路径按「会话工作区」解析
36
+ - <work root>/notes/home # default scope/surfaces
37
+ - path: ../../notes/home # relative paths resolve against the session workspace
27
38
  scope: always-write
28
- - path: <工作根>/some-repo
39
+ - path: <work root>/some-repo
29
40
  scope: write
30
- surfaces: [fs] # 只允许 write/edit 工具写
41
+ surfaces: [fs] # only the write/edit tools may write here
31
42
  ```
32
43
 
33
- | scope | 会话 read-only | 会话 workspace-write |
44
+ | scope | session `read-only` | session `workspace-write` |
34
45
  |---|---|---|
35
- | `write`(默认) | 拒绝 | 可写 |
36
- | `always-write` | 可写 | 可写 |
46
+ | `write` (default) | denied | writable |
47
+ | `always-write` | writable | writable |
37
48
 
38
- `surfaces`:`fs` = `write`/`edit`/str-replace 工具;`shell` = `bash` 子进程。读与执行本来就不受沙箱限制。
49
+ `surfaces`: `fs` = the `write`/`edit`/str-replace tools; `shell` = `bash` subprocesses. Reads and execution are not
50
+ sandboxed to begin with.
39
51
 
40
- ### 相对路径怎么写
52
+ ### How relative paths resolve
41
53
 
42
- 相对路径按**各会话自己的工作区**解析(设置页里可以改「基准工作区」来预览):
54
+ Relative paths resolve against **each session's own workspace** (the settings page has a "base workspace" field so you
55
+ can preview this):
43
56
 
44
- | 写法 | 解析成 | 说明 |
57
+ | Spelling | Resolves to | Notes |
45
58
  |---|---|---|
46
- | `..` | `<工作根>` | 工作区的**上一层**,该目录及其所有兄弟目录都可写 |
47
- | `../某仓库` | `<工作根>/某仓库` | 只放行那一个兄弟仓库(比 `..` 精确,推荐) |
48
- | `../../notes/home` | `<工作根>/notes/home` | 往上几层再进别的树 |
49
- | `~/notes/home` | 家目录下 | 与工作区无关;`~user` 不展开(与宿主一致) |
59
+ | `..` | `<work root>` | the **parent** of the workspace; that directory and all of its siblings become writable |
60
+ | `../some-repo` | `<work root>/some-repo` | grants exactly one sibling repository (more precise than `..`, recommended) |
61
+ | `../../notes/home` | `<work root>/notes/home` | go up a few levels and into another tree |
62
+ | `~/notes/home` | under your home | independent of the workspace; `~user` is not expanded (same as the host) |
50
63
 
51
- ### 模式:按目录结构锚定(不用写死路径)
64
+ ### Patterns: anchor a grant to directory structure (no hard-coded paths)
52
65
 
53
- `path` 里可以用通配符描述**一组目录**,于是"路径里存在某个目录"可以变成一个条件:
66
+ A `path` can use wildcards to describe **a group of directories**, turning "a certain directory exists somewhere in this
67
+ path" into a condition:
54
68
 
55
- | 写法 | 命中(授予的根) |
69
+ | Spelling | Matches (the granted root) |
56
70
  |---|---|
57
- | `<工作根>/**/.worktrees/..` | 每个**含 `.worktrees` 的仓库根**(`.worktrees` 的上级) |
58
- | `<工作根>/**/.worktrees/*` | 每个具体 worktree(不碰 `.git` 与主检出) |
59
- | `<工作根>/<某仓库>/.worktrees/*` | 某一个仓库下所有 worktree(**零遍历开销**,最推荐) |
60
- | `<工作根>/*/notes` | 每个仓库/项目下的 `notes` 目录 |
61
-
62
- 语法:`*` = 恰好一层、`**` = 最多 3 层(**只匹配真实存在的目录**,所以"必须存在 `.worktrees`"是自然结果);
63
- 结尾的 `..` 在**命中之后**再上移(因此 `…/.worktrees/..` 就是"`.worktrees` 的上级",不会被词法折叠吃掉)。
64
-
65
- 安全边界(都是硬约束,不是建议):
66
-
67
- - 通配符前必须有**字面量锚点**,且锚点至少两层、必须是绝对路径或 `~/` 开头 —— `/**`、`~/**`、`/srv/**` 一律拒绝
68
- - 遍历**不进入** `node_modules`、`.git`,`**` 也不进入隐藏目录(`.worktrees` 本身是字面量,仍在当层匹配)
69
- - 有界:`**` 最多 3 层、目录数 > 4096 或命中 > 256 时**整个模式不生效**(fail closed,绝不给"部分命中"这种不可预期的授权);触顶原因会写进告警
70
- - 展开结果缓存 30 秒,因此**新建的 worktree 最迟 30 秒**被纳入
71
-
72
- 设置页每行会**实时显示解析到的绝对路径**(符号链接以宿主的「解析预览」为准),模式行显示命中条数 `[生效 ×N]`
73
- 并列出每个具体根;0 命中或被拦截都会明确说明,所以不必"先保存再看解析对不对"。
74
-
75
- ## 已知边界
76
-
77
- - 逐路径的"完全不受限"做不到:bash 沙箱是整次调用粒度。
78
- - 相对路径按会话工作区解析,因此同一份配置在不同工作区指向不同目录——设置页的预览会显示实际解析结果。
79
- - Windows 的 shell 侧不放行;`always-write` 会削弱 `read-only` 急停按钮对该路径的作用。
80
- - 写在工作区外的文件不会出现在 `deliverables` 的工作区变更卡片里。
71
+ | `<work root>/**/.worktrees/..` | every **repository root that contains `.worktrees`** (the parent of `.worktrees`) |
72
+ | `<work root>/**/.worktrees/*` | each individual worktree (`.git` and the main checkout are never touched) |
73
+ | `<work root>/<some-repo>/.worktrees/*` | every worktree of one repository (**zero traversal cost**, recommended) |
74
+ | `<work root>/*/notes` | the `notes` directory under every repository/project |
75
+
76
+ Syntax: `*` = exactly one level, `**` = at most 3 levels (**only directories that actually exist** match, so
77
+ "`.worktrees` must exist" comes for free); a trailing `..` moves up **after** matching (so `…/.worktrees/..` is "the
78
+ parent of `.worktrees`", rather than something lexical collapsing eats away).
79
+
80
+ Safety bounds (hard constraints, not advice):
81
+
82
+ - the wildcard needs a **literal anchor** before it, at least two segments long, absolute or starting with `~/` —
83
+ `/**`, `~/**`, `/srv/**` are refused outright
84
+ - traversal **never enters** `node_modules` or `.git`, and `**` never enters hidden directories (`.worktrees` is a
85
+ literal, so it still matches at its own level)
86
+ - bounded: `**` covers at most 3 levels, and more than 4096 directories or more than 256 matches makes **the whole
87
+ pattern inert** (fail closed — never a partial, unpredictable grant); the reason is reported as a warning
88
+ - expansions are cached for 30 seconds, so a **newly created worktree is picked up within 30 seconds**
89
+
90
+ The settings page shows the **resolved absolute path** live for every row (symlinks follow the host's canonical
91
+ preview) and, for a pattern row, the match count as `[active ×N]` plus each concrete root below it; zero matches and
92
+ blocked patterns are both spelled out — so there is no need to "save first and then check whether it resolved".
93
+
94
+ ## Known limits
95
+
96
+ - Per-path "no restrictions at all" is not achievable: the bash sandbox works at whole-invocation granularity.
97
+ - Relative paths resolve against the session workspace, so the same entry points at different directories in different
98
+ workspaces — the settings page preview shows the actual resolution.
99
+ - The shell side is not widened on Windows; `always-write` weakens what the `read-only` stop button can do for that path.
100
+ - Files written outside the workspace do not appear in the `deliverables` workspace-changes card.
package/README.zh.md ADDED
@@ -0,0 +1,89 @@
1
+ # dsh-extra-paths
2
+
3
+ [English](README.md) | 中文
4
+
5
+ 让 DSH 对一组配置的外部路径**首次尝试即可写、无需审批**:既覆盖 `write`/`edit` 工具,也覆盖 `bash` 子进程。
6
+ 插件以服务包装实现,不改 DSH 核心代码,并提供 Web 设置页与「当前工作区解析出的生效根」预览。
7
+
8
+ ## 安装
9
+
10
+ 需要 DSH `0.1.5` / `0.2.0` / `0.2.1` / `0.2.2`(不在范围内会被安装闸门拒绝)。
11
+
12
+ ```bash
13
+ dsh plugin --profile <name> add dsh-extra-paths # <name>=你的 profile 名
14
+ ```
15
+
16
+ 想从源码安装(开发时):
17
+
18
+ ```bash
19
+ pnpm install && pnpm build
20
+ dsh plugin --profile <name> add /path/to/dsh-extra-paths # 路径=本仓库的绝对路径
21
+ ```
22
+
23
+ 装好后打开设置左栏的「额外可写路径」。在 **设置 → 插件** 里,同一页在这个插件自己那一行上:
24
+ 打开 `dsh-extra-paths` 组合包,点该行的「配置」。
25
+
26
+ ## 配置
27
+
28
+ 写进设置文档 `~/.dsh/settings.yaml` 的 `extra-paths` 段,或直接用设置页(**保存即生效,无需重启**)。
29
+ 下面的 `<工作根>` 是占位符,指你放项目的那个上层目录(绝对路径,或 `~/` 开头的路径):
30
+
31
+ ```yaml
32
+ extra-paths:
33
+ paths:
34
+ - <工作根>/notes/home # 用默认 scope/surfaces
35
+ - path: ../../notes/home # 相对路径按「会话工作区」解析
36
+ scope: always-write
37
+ - path: <工作根>/some-repo
38
+ scope: write
39
+ surfaces: [fs] # 只允许 write/edit 工具写
40
+ ```
41
+
42
+ | scope | 会话 read-only | 会话 workspace-write |
43
+ |---|---|---|
44
+ | `write`(默认) | 拒绝 | 可写 |
45
+ | `always-write` | 可写 | 可写 |
46
+
47
+ `surfaces`:`fs` = `write`/`edit`/str-replace 工具;`shell` = `bash` 子进程。读与执行本来就不受沙箱限制。
48
+
49
+ ### 相对路径怎么写
50
+
51
+ 相对路径按**各会话自己的工作区**解析(设置页里可以改「基准工作区」来预览):
52
+
53
+ | 写法 | 解析成 | 说明 |
54
+ |---|---|---|
55
+ | `..` | `<工作根>` | 工作区的**上一层**,该目录及其所有兄弟目录都可写 |
56
+ | `../某仓库` | `<工作根>/某仓库` | 只放行那一个兄弟仓库(比 `..` 精确,推荐) |
57
+ | `../../notes/home` | `<工作根>/notes/home` | 往上几层再进别的树 |
58
+ | `~/notes/home` | 家目录下 | 与工作区无关;`~user` 不展开(与宿主一致) |
59
+
60
+ ### 模式:按目录结构锚定(不用写死路径)
61
+
62
+ `path` 里可以用通配符描述**一组目录**,于是"路径里存在某个目录"可以变成一个条件:
63
+
64
+ | 写法 | 命中(授予的根) |
65
+ |---|---|
66
+ | `<工作根>/**/.worktrees/..` | 每个**含 `.worktrees` 的仓库根**(`.worktrees` 的上级) |
67
+ | `<工作根>/**/.worktrees/*` | 每个具体 worktree(不碰 `.git` 与主检出) |
68
+ | `<工作根>/<某仓库>/.worktrees/*` | 某一个仓库下所有 worktree(**零遍历开销**,最推荐) |
69
+ | `<工作根>/*/notes` | 每个仓库/项目下的 `notes` 目录 |
70
+
71
+ 语法:`*` = 恰好一层、`**` = 最多 3 层(**只匹配真实存在的目录**,所以"必须存在 `.worktrees`"是自然结果);
72
+ 结尾的 `..` 在**命中之后**再上移(因此 `…/.worktrees/..` 就是"`.worktrees` 的上级",不会被词法折叠吃掉)。
73
+
74
+ 安全边界(都是硬约束,不是建议):
75
+
76
+ - 通配符前必须有**字面量锚点**,且锚点至少两层、必须是绝对路径或 `~/` 开头 —— `/**`、`~/**`、`/srv/**` 一律拒绝
77
+ - 遍历**不进入** `node_modules`、`.git`,`**` 也不进入隐藏目录(`.worktrees` 本身是字面量,仍在当层匹配)
78
+ - 有界:`**` 最多 3 层、目录数 > 4096 或命中 > 256 时**整个模式不生效**(fail closed,绝不给"部分命中"这种不可预期的授权);触顶原因会写进告警
79
+ - 展开结果缓存 30 秒,因此**新建的 worktree 最迟 30 秒**被纳入
80
+
81
+ 设置页每行会**实时显示解析到的绝对路径**(符号链接以宿主的「解析预览」为准),模式行显示命中条数 `[生效 ×N]`
82
+ 并列出每个具体根;0 命中或被拦截都会明确说明,所以不必"先保存再看解析对不对"。
83
+
84
+ ## 已知边界
85
+
86
+ - 逐路径的"完全不受限"做不到:bash 沙箱是整次调用粒度。
87
+ - 相对路径按会话工作区解析,因此同一份配置在不同工作区指向不同目录——设置页的预览会显示实际解析结果。
88
+ - Windows 的 shell 侧不放行;`always-write` 会削弱 `read-only` 急停按钮对该路径的作用。
89
+ - 写在工作区外的文件不会出现在 `deliverables` 的工作区变更卡片里。
package/lib/client.js CHANGED
@@ -340,6 +340,11 @@ window.__ModuleLoader__.load({
340
340
  * compositions that pass no standard props.
341
341
  * @module dsh-extra-paths/client/page
342
342
  */
343
+ /**
344
+ * Shown when the host refuses a write. The 0.2.x client API returns `false`
345
+ * rather than a message, so the page owns this explanation.
346
+ */
347
+ const SAVE_REFUSED_MESSAGE = "保存被宿主拒绝:该配置可能被 home patch 或命令行覆盖(设置页只写 profile 的 cordis.patch.yml)。请删掉 ~/.dsh/cordis.patch.yml 里同 id 的覆盖,或直接改 profile patch 后重启。";
343
348
  const NOOP_HOOK = () => void 0;
344
349
  const IDENTITY = (snapshot) => snapshot;
345
350
  function itemsOf(value) {
@@ -389,6 +394,24 @@ window.__ModuleLoader__.load({
389
394
  return snapshot;
390
395
  }
391
396
  /**
397
+ * The one-liner the plugin manager shows in its list (`view: 'summary'`).
398
+ *
399
+ * The manager renders every configuration entry twice: a compact summary in the
400
+ * list, and the full view on the entry's own page. Rendering the editor for both
401
+ * is what used to fill the Plugins page with the whole form, so the summary is a
402
+ * separate component that can never grow one.
403
+ * @param props - the bound settings scope.
404
+ */
405
+ function ExtraPathsSummary({ scope }) {
406
+ const { status, value } = useSnapshot(scope);
407
+ const rows = rowsOf(value).filter((row) => row.path.trim() !== "");
408
+ const text = status === "loading" ? "额外可写路径:读取中…" : status === "unavailable" ? "额外可写路径:宿主未提供该设置" : rows.length === 0 ? "额外可写路径:尚未配置" : `额外可写路径:${rows.length} 条 · 保存即生效,写入无需审批`;
409
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
410
+ style: styles.dim,
411
+ children: text
412
+ });
413
+ }
414
+ /**
392
415
  * Render the page.
393
416
  * @param props - the bound settings scope, the standard workspace hook, and the
394
417
  * lazy fallback used when the composition supplies no standard props.
@@ -467,10 +490,11 @@ window.__ModuleLoader__.load({
467
490
  const save = () => {
468
491
  setBusy(true);
469
492
  setError(void 0);
470
- scope.set("paths", payloadOf(rows)).then(() => {
471
- setDirty(false);
493
+ scope.set("paths", payloadOf(rows)).then((accepted) => {
494
+ if (accepted === false) setError(SAVE_REFUSED_MESSAGE);
495
+ else setDirty(false);
472
496
  }).catch((cause) => {
473
- setError(String(cause));
497
+ setError(cause instanceof Error ? cause.message : String(cause));
474
498
  }).finally(() => {
475
499
  setBusy(false);
476
500
  });
@@ -774,11 +798,28 @@ window.__ModuleLoader__.load({
774
798
  //#region src/client/index.tsx
775
799
  /**
776
800
  * Client half: contributes the Extra paths configuration page to the settings
777
- * dialog twice — as a `settings.section` nav row (the settings sidebar) and as
778
- * the plugin's own card (0.1.5: `settings.plugin.item`, keyed by the settings
779
- * namespace; 0.2.x: `plugins.item`, a list slot).
801
+ * dialog and to the plugin manager.
802
+ *
803
+ * THREE ENTRY POINTS, ONE PAGE — and the plugin manager asks for two different
804
+ * views of it. `view: 'summary'` is the one-liner it lays out in its list;
805
+ * anything else is the editor (`view: 'page'` on the entry's own page). Ignoring
806
+ * that split is what used to render the whole form inline in the plugin list,
807
+ * under the built-in plugins group, and pushed everything else off screen.
808
+ *
809
+ * - `settings.section` — a nav row in the settings dialog's left column. Declared
810
+ * by both host generations, so this is the entry point that always exists.
811
+ * - 0.2.x `plugins.row.config` — a KEYED slot spelled `<bundle name>#<entry id>`.
812
+ * Our own row inside the `dsh-extra-paths` bundle gains a 配置 control that
813
+ * opens this page in the plugin manager. Present in every 0.2.x release
814
+ * (checked against 0.2.0-rc.2 and 0.2.1-rc.5).
815
+ * - 0.1.5 `settings.plugin.item` — the keyed card of the older settings dialog,
816
+ * keyed by the settings namespace.
780
817
  *
781
- * TWO HOST GENERATIONS, ONE PAGE. The settings scope this page edits moved in
818
+ * The 0.2.x `plugins.item` slot is deliberately NOT registered: the shipped
819
+ * contract reserves it for the host's own plugins ("用于官方插件", rendered in the
820
+ * 内置插件配置 group). A third-party bundle belongs on its own row instead.
821
+ *
822
+ * TWO HOST GENERATIONS, ONE SCOPE. The settings scope this page edits moved in
782
823
  * 0.2.0: `ctx.settingsScope` (0.1.5) is gone and replaced by `ctx.configForms`
783
824
  * — which however exposes the SAME three methods the page was written against
784
825
  * (`getSnapshot`/`subscribe`/`set`). So the page keeps its narrow `PageScope`
@@ -788,10 +829,10 @@ window.__ModuleLoader__.load({
788
829
  * waiting forever.
789
830
  *
790
831
  * Slot keys, register shapes and the module table were taken from the RUNNING
791
- * version's own official occupants (`dsh-client-ui-settings-plugins`,
792
- * `dsh-client-ui-settings-agent-loop`) and their published contracts. A slot key
793
- * that nothing declares is inert under `ctx.slots.inject` (the callback never
794
- * runs), which is what lets one build register into both generations' cards.
832
+ * version's own official occupants (`dsh-client-ui-settings-agent-loop`,
833
+ * `dsh-client-ui-settings-shell`) and their published contracts. A slot key that
834
+ * nothing declares is inert under `ctx.slots.inject` (the callback never runs),
835
+ * which is what lets one build register into both generations.
795
836
  *
796
837
  * Every @deepseek-ai/* import here is TYPE-ONLY (erased): the runtime services
797
838
  * arrive through cordis, and react resolves from the page's module table
@@ -809,6 +850,14 @@ window.__ModuleLoader__.load({
809
850
  /** The settings namespace this page edits — the one the host half registers. */
810
851
  const NAMESPACE = "extra-paths";
811
852
  /**
853
+ * The plugin manager's key for our row: `<bundle name>#<entry id>`.
854
+ *
855
+ * The bundle name is the package name and the row id is the entry this repo's
856
+ * `cordis.patch.yml` inserts; `tests/client-slots.test.ts` pins it against both
857
+ * files so a rename cannot silently detach the config control.
858
+ */
859
+ const ROW_KEY = "dsh-extra-paths#extra-paths";
860
+ /**
812
861
  * A `PageScope` that forwards to whichever real scope arrives.
813
862
  *
814
863
  * Subscribers are held here rather than on the real scope so a page that mounted
@@ -834,7 +883,13 @@ window.__ModuleLoader__.load({
834
883
  listeners.delete(listener);
835
884
  };
836
885
  },
837
- set: (field, value) => real?.set(field, value) ?? Promise.resolve()
886
+ set: (field, value) => {
887
+ if (real === void 0) return Promise.resolve();
888
+ return real.set(field, value).then((accepted) => {
889
+ if (accepted === false) throw new Error(SAVE_REFUSED_MESSAGE);
890
+ return accepted;
891
+ });
892
+ }
838
893
  },
839
894
  attach: (next) => {
840
895
  if (next === void 0) return;
@@ -860,7 +915,7 @@ window.__ModuleLoader__.load({
860
915
  attach({
861
916
  getSnapshot: () => configForms.get(NAMESPACE).getSnapshot(),
862
917
  subscribe: (listener) => configForms.get(NAMESPACE).subscribe(listener),
863
- set: (field, value) => configForms.get(NAMESPACE).set(field, value).then(() => void 0)
918
+ set: (field, value) => configForms.get(NAMESPACE).set(field, value)
864
919
  });
865
920
  });
866
921
  const getWorkspaces = () => ctx.get("workspaces", false);
@@ -868,7 +923,14 @@ window.__ModuleLoader__.load({
868
923
  scope,
869
924
  getWorkspaces
870
925
  });
871
- const page = () => react.createElement(ExtraPathsPage, props());
926
+ /** The editor, forwarding the shell's workspace hook when the slot carries one. */
927
+ const renderPage = (slotProps) => react.createElement(ExtraPathsPage, {
928
+ scope,
929
+ getWorkspaces,
930
+ useWorkspaces: typeof slotProps?.useWorkspaces === "function" ? slotProps.useWorkspaces : void 0
931
+ });
932
+ /** The slot component: one line for `summary`, the editor for every other view. */
933
+ const card = (slotProps) => slotProps?.view === "summary" ? react.createElement(ExtraPathsSummary, { scope }) : renderPage(slotProps);
872
934
  ctx.slots.inject("settings.section", () => ctx.slots.register({
873
935
  name: "settings.section",
874
936
  id: NAMESPACE,
@@ -876,27 +938,26 @@ window.__ModuleLoader__.load({
876
938
  label: () => "额外可写路径",
877
939
  locale: NAMESPACE,
878
940
  inject: props
879
- }, page));
941
+ }, card));
880
942
  ctx.slots.inject("settings.plugin.item", () => ctx.slots.register({
881
943
  name: "settings.plugin.item",
882
944
  key: NAMESPACE,
883
945
  locale: NAMESPACE,
884
946
  inject: props
885
- }, page));
886
- const registerCard = () => ctx.slots.inject("plugins.item", () => ctx.slots.register({
887
- name: "plugins.item",
888
- id: NAMESPACE,
889
- order: 40,
890
- label: () => "额外可写路径",
947
+ }, card));
948
+ const registerRow = () => ctx.slots.inject("plugins.row.config", () => ctx.slots.register({
949
+ name: "plugins.row.config",
950
+ key: ROW_KEY,
891
951
  locale: NAMESPACE,
892
952
  inject: props
893
- }, page));
953
+ }, card));
894
954
  const forms = ctx.get("configForms", false);
895
- if (typeof forms?.whileServed === "function" && typeof ctx.effect === "function") ctx.effect(() => forms.whileServed?.(["extra-paths"], registerCard) ?? registerCard(), "extra-paths: card while served");
896
- else registerCard();
955
+ if (typeof forms?.whileServed === "function" && typeof ctx.effect === "function") ctx.effect(() => forms.whileServed?.(["extra-paths"], registerRow) ?? registerRow(), "extra-paths: row page while served");
956
+ else registerRow();
897
957
  }
898
958
  //#endregion
899
959
  exports.NAMESPACE = NAMESPACE;
960
+ exports.ROW_KEY = ROW_KEY;
900
961
  exports.apply = apply;
901
962
  exports.inject = inject;
902
963
  exports.lateBoundScope = lateBoundScope;
package/lib/policy.js CHANGED
@@ -7,11 +7,24 @@
7
7
  * under a configured root. The mode rises to `workspace-write` because that is
8
8
  * this grant's meaning: a single call is allowed to write this root, while the
9
9
  * base class keeps owning resolution, atomic publication and the version guard.
10
+ *
11
+ * The caller's own `additionalWritableRoots` are dropped on purpose: under a
12
+ * `read-only` session an `always-write` grant must not smuggle the deployment's
13
+ * extra roots into the elevated call.
10
14
  * @param policy - the caller's resolved policy.
11
15
  * @param workspaceRoot - the canonical configured root that matched the target.
16
+ * @param additionalWritableRoots - further configured roots to grant in the
17
+ * same call (DSH 0.2.2+ only; used by `moveFile` when both ends lie under
18
+ * different configured roots).
12
19
  * @returns the policy to hand the base implementation.
13
20
  */
14
- export function syntheticPolicy(policy, workspaceRoot) {
15
- return { ...policy, mode: 'workspace-write', workspaceRoot };
21
+ export function syntheticPolicy(policy, workspaceRoot, additionalWritableRoots) {
22
+ const { additionalWritableRoots: _callerRoots, ...rest } = policy;
23
+ return {
24
+ ...rest,
25
+ mode: 'workspace-write',
26
+ workspaceRoot,
27
+ ...(additionalWritableRoots === undefined ? {} : { additionalWritableRoots }),
28
+ };
16
29
  }
17
30
  //# sourceMappingURL=policy.js.map
package/lib/policy.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"policy.js","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,MAAkB,EAAE,aAAqB;IACvE,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,aAAa,EAAE,CAAA;AAC9D,CAAC"}
1
+ {"version":3,"file":"policy.js","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAkB,EAClB,aAAqB,EACrB,uBAA2C;IAE3C,MAAM,EAAE,uBAAuB,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAA;IACjE,OAAO;QACL,GAAG,IAAI;QACP,IAAI,EAAE,iBAAiB;QACvB,aAAa;QACb,GAAG,CAAC,uBAAuB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,CAAC;KAC9E,CAAA;AACH,CAAC"}
@@ -7,6 +7,16 @@ import type { SandboxModeLike } from './grant.js';
7
7
  export interface PolicyLike {
8
8
  readonly mode: SandboxModeLike;
9
9
  readonly workspaceRoot: string;
10
+ /**
11
+ * Explicit extra writable directories a policy may carry (DSH 0.2.2+).
12
+ *
13
+ * The 0.2.2 enforcement layers derive their allow-list from the workspace
14
+ * root PLUS this list, so a single synthetic policy can grant more than one
15
+ * configured root — which is what a move between two configured roots needs.
16
+ * Older hosts have no such field and ignore it; the wrapper only sets it for
17
+ * the 0.2.2-only `moveFile` surface.
18
+ */
19
+ readonly additionalWritableRoots?: readonly string[];
10
20
  readonly sessionId?: unknown;
11
21
  }
12
22
  /**
@@ -14,8 +24,15 @@ export interface PolicyLike {
14
24
  * under a configured root. The mode rises to `workspace-write` because that is
15
25
  * this grant's meaning: a single call is allowed to write this root, while the
16
26
  * base class keeps owning resolution, atomic publication and the version guard.
27
+ *
28
+ * The caller's own `additionalWritableRoots` are dropped on purpose: under a
29
+ * `read-only` session an `always-write` grant must not smuggle the deployment's
30
+ * extra roots into the elevated call.
17
31
  * @param policy - the caller's resolved policy.
18
32
  * @param workspaceRoot - the canonical configured root that matched the target.
33
+ * @param additionalWritableRoots - further configured roots to grant in the
34
+ * same call (DSH 0.2.2+ only; used by `moveFile` when both ends lie under
35
+ * different configured roots).
19
36
  * @returns the policy to hand the base implementation.
20
37
  */
21
- export declare function syntheticPolicy(policy: PolicyLike, workspaceRoot: string): PolicyLike;
38
+ export declare function syntheticPolicy(policy: PolicyLike, workspaceRoot: string, additionalWritableRoots?: readonly string[]): PolicyLike;
@@ -2,6 +2,13 @@
2
2
  * The filesystem half of the plugin: a transparent Proxy over `ctx.fs` that
3
3
  * re-stamps ONE call's policy when its target lies under a configured root.
4
4
  *
5
+ * The host generation decides how many mutations this surface has. 0.2.0/0.2.1
6
+ * fence `writeText`/`editText`; 0.2.2 additionally fences `patchText`,
7
+ * `deleteFile` and `moveFile` (the `apply_patch` tool and the delete/move
8
+ * operations). The wrapper therefore overrides every mutation the INNER service
9
+ * actually exposes, and never invents one: on a 0.2.1 service the three newer
10
+ * methods stay absent, exactly as the base class declared them.
11
+ *
5
12
  * Transparency rules (verified against cordis 4.0.2 by
6
13
  * spike/cordis-get-wrap-baseline.mjs): forward every property with the inner
7
14
  * value as the receiver, bind methods to the inner instance — except
@@ -24,6 +31,12 @@ export interface FsInnerLike {
24
31
  }): Promise<FsTargetLike>;
25
32
  writeText(target: FsTargetLike, content: string, expected?: unknown, signal?: AbortSignal, policy?: PolicyLike): Promise<unknown>;
26
33
  editText(target: FsTargetLike, edit: unknown, expected?: unknown, signal?: AbortSignal, policy?: PolicyLike): Promise<unknown>;
34
+ /** DSH 0.2.2+: apply parsed hunks (the `apply_patch` tool's surface). */
35
+ patchText?(target: FsTargetLike, hunks: unknown, expected?: unknown, signal?: AbortSignal, policy?: PolicyLike): Promise<unknown>;
36
+ /** DSH 0.2.2+: remove one regular file. */
37
+ deleteFile?(target: FsTargetLike, expected?: unknown, signal?: AbortSignal, policy?: PolicyLike): Promise<unknown>;
38
+ /** DSH 0.2.2+: publish a destination and remove the source. */
39
+ moveFile?(source: FsTargetLike, destination: FsTargetLike, options?: unknown, signal?: AbortSignal, policy?: PolicyLike): Promise<unknown>;
27
40
  readonly sandboxMode?: string;
28
41
  }
29
42
  /** What the wrapper needs from the plugin. */
package/lib/wrap-fs.js CHANGED
@@ -2,6 +2,13 @@
2
2
  * The filesystem half of the plugin: a transparent Proxy over `ctx.fs` that
3
3
  * re-stamps ONE call's policy when its target lies under a configured root.
4
4
  *
5
+ * The host generation decides how many mutations this surface has. 0.2.0/0.2.1
6
+ * fence `writeText`/`editText`; 0.2.2 additionally fences `patchText`,
7
+ * `deleteFile` and `moveFile` (the `apply_patch` tool and the delete/move
8
+ * operations). The wrapper therefore overrides every mutation the INNER service
9
+ * actually exposes, and never invents one: on a 0.2.1 service the three newer
10
+ * methods stay absent, exactly as the base class declared them.
11
+ *
5
12
  * Transparency rules (verified against cordis 4.0.2 by
6
13
  * spike/cordis-get-wrap-baseline.mjs): forward every property with the inner
7
14
  * value as the receiver, bind methods to the inner instance — except
@@ -9,6 +16,8 @@
9
16
  * (`Service[Symbol.hasInstance]` walks `instance.constructor`).
10
17
  * @module dsh-extra-paths/wrap-fs
11
18
  */
19
+ import { realpathSync, statSync } from 'node:fs';
20
+ import { resolve as resolvePath } from 'node:path';
12
21
  import { grantFor } from './grant.js';
13
22
  import { isUnder } from './paths.js';
14
23
  import { syntheticPolicy } from './policy.js';
@@ -27,6 +36,22 @@ export function isConfiningFs(value) {
27
36
  && typeof fs.resolve === 'function'
28
37
  && typeof fs.sandboxMode === 'string';
29
38
  }
39
+ /**
40
+ * Whether a configured root can be expressed as an `additionalWritableRoots`
41
+ * entry for the 0.2.2 fence: an existing PHYSICAL directory. The base fence
42
+ * rejects missing, non-directory and symlinked entries by throwing, so a grant
43
+ * list is only assembled from roots that pass the same test.
44
+ * @param path - the canonical root to test.
45
+ * @returns true when the base fence would accept it.
46
+ */
47
+ function isPhysicalDirectory(path) {
48
+ try {
49
+ return statSync(path).isDirectory() && realpathSync.native(path) === resolvePath(path);
50
+ }
51
+ catch {
52
+ return false;
53
+ }
54
+ }
30
55
  /**
31
56
  * Wrap one filesystem service.
32
57
  * @param inner - the service instance read from the context.
@@ -35,10 +60,12 @@ export function isConfiningFs(value) {
35
60
  */
36
61
  export function wrapFs(inner, deps) {
37
62
  const bound = new Map();
63
+ /** Roots this call grants, or an empty list when the target set is not covered. */
64
+ const grantedFor = (policy) => grantFor(policy.mode, resolveRoots(deps.readConfig(), policy.workspaceRoot).roots, 'fs');
38
65
  const translate = async (target, policy, delegate) => {
39
66
  if (policy === undefined || policy.mode === 'danger-full-access')
40
67
  return delegate(policy);
41
- const granted = grantFor(policy.mode, resolveRoots(deps.readConfig(), policy.workspaceRoot).roots, 'fs');
68
+ const granted = grantedFor(policy);
42
69
  if (granted.length === 0)
43
70
  return delegate(policy);
44
71
  // Re-canonicalise NOW, exactly like the base fence does, so the identity we
@@ -49,17 +76,59 @@ export function wrapFs(inner, deps) {
49
76
  return delegate(policy);
50
77
  return delegate(syntheticPolicy(policy, match.root));
51
78
  };
79
+ /**
80
+ * A move is one call with TWO fenced targets. Both ends must land in the
81
+ * configured set; one policy then carries the union. When the ends share one
82
+ * configured root the workspace-root re-stamp is enough on every host; two
83
+ * different roots are expressed through `additionalWritableRoots` (0.2.2+,
84
+ * the only host generation that has `moveFile` at all).
85
+ */
86
+ const translateMove = async (source, destination, policy, delegate) => {
87
+ if (policy === undefined || policy.mode === 'danger-full-access')
88
+ return delegate(policy);
89
+ const granted = grantedFor(policy);
90
+ if (granted.length === 0)
91
+ return delegate(policy);
92
+ const [freshSource, freshDestination] = await Promise.all([
93
+ inner.resolve(source.displayPath),
94
+ inner.resolve(destination.displayPath),
95
+ ]);
96
+ const sourceRoot = granted.find(root => isUnder(String(freshSource.targetKey), root.root));
97
+ const destinationRoot = granted.find(root => isUnder(String(freshDestination.targetKey), root.root));
98
+ if (sourceRoot === undefined || destinationRoot === undefined)
99
+ return delegate(policy);
100
+ if (sourceRoot === destinationRoot)
101
+ return delegate(syntheticPolicy(policy, sourceRoot.root));
102
+ const roots = [sourceRoot.root, destinationRoot.root];
103
+ if (!roots.every(isPhysicalDirectory))
104
+ return delegate(policy);
105
+ return delegate(syntheticPolicy(policy, sourceRoot.root, [destinationRoot.root]));
106
+ };
52
107
  // Built ONCE per wrapper: reading a method twice must hand back the same
53
108
  // function (and a fresh closure per read is pure allocation). Nothing here
54
109
  // captures read-time state — the policy is resolved inside each call.
55
110
  const writeText = (t, content, expected, signal, policy) => translate(t, policy ?? deps.fallbackPolicy(), effective => inner.writeText(t, content, expected, signal, effective));
56
111
  const editText = (t, edit, expected, signal, policy) => translate(t, policy ?? deps.fallbackPolicy(), effective => inner.editText(t, edit, expected, signal, effective));
112
+ const patchText = (t, hunks, expected, signal, policy) => translate(t, policy ?? deps.fallbackPolicy(), effective => inner.patchText(t, hunks, expected, signal, effective));
113
+ const deleteFile = (t, expected, signal, policy) => translate(t, policy ?? deps.fallbackPolicy(), effective => inner.deleteFile(t, expected, signal, effective));
114
+ const moveFile = (source, destination, options, signal, policy) => translateMove(source, destination, policy ?? deps.fallbackPolicy(), effective => inner.moveFile(source, destination, options, signal, effective));
115
+ const overrides = new Map([
116
+ ['writeText', writeText],
117
+ ['editText', editText],
118
+ ]);
119
+ // Only override what the running host declares: a 0.2.1 service must keep
120
+ // answering `undefined` for the 0.2.2-only mutations.
121
+ if (typeof inner.patchText === 'function')
122
+ overrides.set('patchText', patchText);
123
+ if (typeof inner.deleteFile === 'function')
124
+ overrides.set('deleteFile', deleteFile);
125
+ if (typeof inner.moveFile === 'function')
126
+ overrides.set('moveFile', moveFile);
57
127
  return new Proxy(inner, {
58
128
  get(target, prop) {
59
- if (prop === 'writeText')
60
- return writeText;
61
- if (prop === 'editText')
62
- return editText;
129
+ const override = overrides.get(prop);
130
+ if (override !== undefined)
131
+ return override;
63
132
  const value = Reflect.get(target, prop, target);
64
133
  if (typeof value !== 'function' || prop === 'constructor')
65
134
  return value;
@@ -1 +1 @@
1
- {"version":3,"file":"wrap-fs.js","sourceRoot":"","sources":["../src/wrap-fs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAE,eAAe,EAAmB,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAwB3C;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,MAAM,EAAE,GAAG,KAAgC,CAAA;IAC3C,OAAO,OAAO,EAAE,EAAE,SAAS,KAAK,UAAU;WACrC,OAAO,EAAE,CAAC,QAAQ,KAAK,UAAU;WACjC,OAAO,EAAE,CAAC,OAAO,KAAK,UAAU;WAChC,OAAO,EAAE,CAAC,WAAW,KAAK,QAAQ,CAAA;AACzC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,KAAkB,EAAE,IAAgB;IACzD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAwB,CAAA;IAE7C,MAAM,SAAS,GAAG,KAAK,EACrB,MAAoB,EACpB,MAA8B,EAC9B,QAA8D,EAC5C,EAAE;QACpB,IAAI,M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SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;IAChF,IAAI,OAAO,KAAK,CAAC,UAAU,KAAK,UAAU;QAAE,SAAS,CAAC,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;IACnF,IAAI,OAAO,KAAK,CAAC,QAAQ,KAAK,UAAU;QAAE,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IAE7E,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE;QACtB,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACpC,IAAI,QAAQ,KAAK,SAAS;gBAAE,OAAO,QAAQ,CAAA;YAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;YAC/C,IAAI,OAAO,KAAK,KAAK,UAAU,IAAI,IAAI,KAAK,aAAa;gBAAE,OAAO,KAAK,CAAA;YACvE,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YAC9B,IAAI,MAAM,KAAK,SAAS;gBAAE,OAAO,MAAM,CAAA;YACvC,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YAC7B,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;YACnB,OAAO,EAAE,CAAA;QACX,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-extra-paths",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "配置一组额外可写根:fs 工具与受限 shell 首次尝试即可写、无需审批,带 Web 设置页与按目录结构锚定的路径模式。 · DSH plugin: configured extra writable roots for the fs tools and the sandboxed shell, with a Web settings page and structure-anchored path patterns.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -40,7 +40,8 @@
40
40
  "build:client": "tsdown",
41
41
  "watch:client": "tsdown --watch",
42
42
  "typecheck": "node scripts/dsh-paths.mjs && tsc -p tsconfig.json --noEmit && tsc -p tsconfig.client.json --noEmit",
43
- "test": "vitest run"
43
+ "test": "vitest run",
44
+ "prepublishOnly": "pnpm run build && pnpm test"
44
45
  },
45
46
  "dependencies": {
46
47
  "@deepseek-ai/schemastery": "^3.18.4"
@@ -67,7 +68,7 @@
67
68
  "settings",
68
69
  "bash"
69
70
  ],
70
- "license": "UNLICENSED",
71
+ "license": "MIT",
71
72
  "repository": {
72
73
  "type": "git",
73
74
  "url": "git+https://github.com/0x7a76/dsh-extra-paths.git"
@@ -78,19 +79,19 @@
78
79
  },
79
80
  "engines": {
80
81
  "node": ">=20",
81
- "dsh": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0"
82
+ "dsh": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0 || >=0.2.2-0 <0.2.3-0"
82
83
  },
83
84
  "peerDependencies": {
84
85
  "@deepseek-ai/cordis": "^4.0.2",
85
- "@deepseek-ai/dsh-fs": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0",
86
- "@deepseek-ai/dsh-sandbox": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0",
87
- "@deepseek-ai/dsh-sandbox-policy": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0",
88
- "@deepseek-ai/dsh-settings": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0",
89
- "@deepseek-ai/dsh-fs-sandbox": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0",
90
- "@deepseek-ai/dsh-system-prompt": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0",
91
- "@deepseek-ai/dsh-host-webserver": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0",
92
- "@deepseek-ai/dsh-client-ui-settings": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0",
93
- "@deepseek-ai/dsh-client-ui-slots": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0"
86
+ "@deepseek-ai/dsh-fs": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0 || >=0.2.2-0 <0.2.3-0",
87
+ "@deepseek-ai/dsh-sandbox": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0 || >=0.2.2-0 <0.2.3-0",
88
+ "@deepseek-ai/dsh-sandbox-policy": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0 || >=0.2.2-0 <0.2.3-0",
89
+ "@deepseek-ai/dsh-settings": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0 || >=0.2.2-0 <0.2.3-0",
90
+ "@deepseek-ai/dsh-fs-sandbox": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0 || >=0.2.2-0 <0.2.3-0",
91
+ "@deepseek-ai/dsh-system-prompt": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0 || >=0.2.2-0 <0.2.3-0",
92
+ "@deepseek-ai/dsh-host-webserver": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0 || >=0.2.2-0 <0.2.3-0",
93
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0 || >=0.2.2-0 <0.2.3-0",
94
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.5-0 <0.1.6-0 || >=0.2.0-0 <0.2.2-0 || >=0.2.2-0 <0.2.3-0"
94
95
  },
95
96
  "peerDependenciesMeta": {
96
97
  "@deepseek-ai/dsh-fs-sandbox": {