dsh-patch-edit-plus 0.2.2 → 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,15 +1,11 @@
1
1
  # Changelog
2
2
 
3
- ## [0.2.2] — 2026-09-29
3
+ ## [0.3.0] — 2026-09-29
4
4
 
5
5
  ### Changed
6
- - **DSH line split**: this release serves the `0.1.5-rc` segment only — `peerDependencies`/`engines.dsh` capped to `>=0.1.5-rc.1 <0.1.6-0` (both manifests), published under the `dsh-0.1.5` dist-tag. `0.1.2-rc.1` ~ `0.1.4` remain served by the published `0.1.2` (main); `0.1.7` by `dsh-0.1.7` (v0.2.1+); `0.2.0` by `dsh-0.2.0` (v0.3.0+).
7
- - devDependencies 4x `@deepseek-ai/dsh-*` `0.1.2-rc.1` → `0.1.5-rc.3`: the type baseline now matches the hosts this line serves (the stale `0.1.2` pin was the "fake green" pattern — a baseline older than the served line can mask real contract breaks).
8
- - Docs x4 (README/INSTALL): compatibility matrix re-based to the `0.1.5-rc` segment.
9
6
 
10
- ### Verified
11
- - No source changes required: `ShellExecutor.run(spec)` is intact across `0.1.5-rc.1`–`rc.3` (the `run` → `execute` rename lands in the 0.1.6→0.1.7 window), and the imperative settings fallback (`settings.register` / `installSection`) still exists on 0.1.5 hosts.
12
- - build / typecheck / test (94) / lint / smoke / `typecheck:0.1.5` (static proof against real `0.1.5-rc.2` peers) all green; lockfile regenerated against `0.1.5-rc.3`.
7
+ - **DSH 0.2.0 line support (`compat/0.2.0` branch).** Peer ranges and `engines.dsh` (both manifests) now declare `>=0.2.0-rc.1 <0.2.1-0`; version 0.3.0. devDependencies pin the real `0.2.0-rc.1` type baseline, and the cross-check script is upgraded to `npm run typecheck:0.2.0` (installs the real peer packages from the registry). 0.1.x hosts remain served by the `compat/0.1.7` branch / `dsh-0.1.7` dist-tag.
8
+ - **Delete/Move migrated to the current shell executor API.** `ShellExecutor.run(spec)` was renamed `execute(spec)` — returning a `ShellProcess` handle with a `result()` foreground projection — between the 0.1.2 and 0.1.7 host lines. The old devDependency pin (`0.1.2-rc.1`) masked this: the 0.1.7-line package (0.2.1) typechecked green against a stale baseline, and at runtime on real 0.1.7+ hosts its `run`-based duck-typing never matched, so Delete/Move degraded to the structured UNSUPPORTED error. This line calls `shell.execute(...)` and awaits `execution.result()`; the executor is detected via `execute`.
13
9
 
14
10
  ## [0.1.2] — 2026-09-19
15
11
 
package/CHANGELOG.zh.md CHANGED
@@ -1,15 +1,11 @@
1
1
  # 更新日志
2
2
 
3
- ## [0.2.2] — 2026-09-29
3
+ ## [0.3.0] — 2026-09-29
4
4
 
5
5
  ### 变更
6
- - **DSH 线拆分**:本版本只服务 `0.1.5-rc` 线段——`peerDependencies`/`engines.dsh` 封顶到 `>=0.1.5-rc.1 <0.1.6-0`(双清单),经 `dsh-0.1.5` dist-tag 发布。`0.1.2-rc.1` ~ `0.1.4` 仍由已发布的 `0.1.2`(main)服务;`0.1.7` 由 `dsh-0.1.7`(v0.2.1+)服务;`0.2.0` 由 `dsh-0.2.0`(v0.3.0+)服务。
7
- - devDependencies 4 项 `@deepseek-ai/dsh-*` `0.1.2-rc.1` → `0.1.5-rc.3`:类型基线与本线服务的宿主对齐(过期的 `0.1.2` 钉版正是「假绿」形态——基线早于服务线会掩盖真实契约断裂)。
8
- - 文档 ×4(README/INSTALL):兼容矩阵重基于 `0.1.5-rc` 线段。
9
6
 
10
- ### 验证
11
- - 无需源码改动:`ShellExecutor.run(spec)` 在 `0.1.5-rc.1`–`rc.3` 全程未变(`run` → `execute` 改名落在 0.1.6→0.1.7 区间),且 0.1.5 宿主仍有命令式设置回退(`settings.register` / `installSection`)。
12
- - build / typecheck / test(94)/ lint / smoke / `typecheck:0.1.5`(对真实 `0.1.5-rc.2` peer 静态核验)全绿;lockfile 按 `0.1.5-rc.3` 重新生成。
7
+ - **支持 DSH 0.2.0 线(`compat/0.2.0` 分支)。** peer 范围与两份清单的 `engines.dsh` 改为 `>=0.2.0-rc.1 <0.2.1-0`;版本 0.3.0。devDependencies 钉住真实的 `0.2.0-rc.1` 类型基线,交叉校验脚本升级为 `npm run typecheck:0.2.0`(从 registry 干净安装真实 peer 包做核验)。0.1.x 宿主继续由 `compat/0.1.7` 分支 / `dsh-0.1.7` dist-tag 服务。
8
+ - **Delete/Move 迁移到现行 shell 执行器 API。** 宿主在 0.1.2 → 0.1.7 线之间把 `ShellExecutor.run(spec)` 改名为 `execute(spec)`——返回 `ShellProcess` 句柄,前台结果经 `result()` 获取。旧的 devDependency 钉版(`0.1.2-rc.1`)掩盖了这一点:0.1.7 线的包(0.2.1)对过期基线假绿,且在真实 0.1.7+ 宿主上运行时基于 `run` 的鸭子探测永不命中,Delete/Move 实际降级为结构化 UNSUPPORTED 错误。本线改为调用 `shell.execute(...)` 并等待 `execution.result()`;执行器经 `execute` 做结构探测。
13
9
 
14
10
  ## [0.1.2] — 2026-09-19
15
11
 
package/README.ja.md CHANGED
@@ -6,10 +6,11 @@
6
6
 
7
7
  | DSH バージョン | ステータス | 備考 |
8
8
  |---|---|---|
9
- | `0.1.5-rc.1+` | ✅ サポート対象(本ライン、v0.2.2+) | 型ベースラインを実在の `0.1.5-rc.3` ピアに固定し、`peerDependencies`/`engines.dsh` は `>=0.1.5-rc.1 <0.1.6-0` にキャップ。`dsh-0.1.5` dist-tag で公開。 |
10
- | `0.1.2-rc.1` ~ `0.1.4` | ↗ メンテナンスライン | 公開済みの `0.1.2`(main ブランチ)が担います。`0.1.6+` は別契約(shell の `run` → `execute`)であり、compat/0.1.7・compat/0.2.0 ラインが担います。 |
9
+ | `0.2.0-rc.1+` | ✅ サポート対象(本ライン、v0.3.0+) | 宣言的設定:`allowCodexPatch` は `.volatile()` 付きで、設定フォームは自動生成され、`loader/volatile-update` が再マウントなしでツールをその場で再登録します。登録呼び出しは不要。Delete/Move は `ShellExecutor.execute()` + `result()` フォアグラウンド API に移行済み。 |
10
+ | `0.1.7-rc.1+` | ↗ メンテナンスライン | `compat/0.1.7` ブランチ / `dsh-0.1.7` dist-tag が担当(同ラインの v0.2.1)。0.2.0 より前にシェル実行器の `run` が `execute` に改名されており(0.1.2 → 0.1.7 の間)、1 つのコードベースで両ラインを型安全に支えることはできません。 |
11
+ | `0.1.2-rc.1` ~ `0.1.5-rc.2` | ↗ メンテナンスライン | 0.1.7 以前のブランチ / `dsh-0.1.5` dist-tag が担当。0.1.7 はデュアル API フォールバックが依存する命令型登録 API を削除しました。 |
11
12
 
12
- 設定の登録はデュアル API フォールバック(0.1.2 以降では `settings.installSection`、旧ホストでは `settings.register`)を使用します。
13
+ 本ラインの設定は宣言的です:`Config` 内で `.volatile()` を付けたフィールドがそのまま設定フォームになり、プラグインは登録フックの代わりに `loader/volatile-update` を購読します。
13
14
 
14
15
  ## そもそもなぜパッチなのか?(ツールルーティングガイド)
15
16
 
@@ -108,9 +109,9 @@ dsh web --dump-config # verify the plugin row appears
108
109
 
109
110
  ```bash
110
111
  npm install
111
- npm run typecheck # against 0.1.5-rc.3 peers (devDependencies)
112
- npm run typecheck:0.1.5 # 実在の 0.1.5-rc.2 ピアに対する静的クロス検証
113
- npm test # vitest, 90 tests
112
+ npm run typecheck # against 0.2.0-rc.1 peers (devDependencies)
113
+ npm run typecheck:0.2.0 # against real 0.2.0-rc.1 peer packages installed from the registry (dual-baseline proof)
114
+ npm test # vitest, 92 tests
114
115
  npm run lint
115
116
  npm run build # lib/
116
117
  npm run verify:source # static safety assertions (intent dance, no node:fs, …)
package/README.ko.md CHANGED
@@ -6,10 +6,11 @@
6
6
 
7
7
  | DSH 버전 | 상태 | 비고 |
8
8
  |---|---|---|
9
- | `0.1.5-rc.1+` | ✅ 지원됨(본 라인, v0.2.2+) | 타입 베이스라인을 실제 `0.1.5-rc.3` peer에 고정하고, `peerDependencies`/`engines.dsh`는 `>=0.1.5-rc.1 <0.1.6-0`으로 제한합니다. `dsh-0.1.5` dist-tag로 게시됩니다. |
10
- | `0.1.2-rc.1` ~ `0.1.4` | ↗ 유지보수 라인 | 게시된 `0.1.2`(main 브랜치)가 담당합니다. `0.1.6+`은 별도 계약(shell `run` → `execute`)이며 compat/0.1.7·compat/0.2.0 라인이 지원합니다. |
9
+ | `0.2.0-rc.1+` | ✅ 지원됨(본 라인, v0.3.0+) | 선언적 설정: `allowCodexPatch`에 `.volatile()`가 표시되어 설정 폼이 자동 생성되고, `loader/volatile-update`가 리마운트 없이 도구를 그 자리에서 재등록합니다. 등록 호출이 없습니다. Delete/Move는 `ShellExecutor.execute()` + `result()` 포그라운드 API로 이전되었습니다. |
10
+ | `0.1.7-rc.1+` | ↗ 유지보수 라인 | `compat/0.1.7` 브랜치 / `dsh-0.1.7` dist-tag가 담당(해당 라인의 v0.2.1). 0.2.0 이전에 셸 실행기의 `run`이 `execute`로 이름이 바뀌었고(0.1.2 → 0.1.7 사이), 하나의 코드베이스로 두 라인을 타입 안전하게 지원할 수 없습니다. |
11
+ | `0.1.2-rc.1` ~ `0.1.5-rc.2` | ↗ 유지보수 라인 | 0.1.7 이전 브랜치 / `dsh-0.1.5` dist-tag가 담당. 0.1.7은 이중 API 폴백이 의존하던 명령형 등록 API를 제거했습니다. |
11
12
 
12
- 설정 등록은 이중 API 폴백을 사용합니다(0.1.2+ 에서는 `settings.installSection`, 이전 호스트에서는 `settings.register`).
13
+ 본 라인의 설정은 선언적입니다: `Config`에서 `.volatile()`로 표시된 필드가 곧 설정 폼이며, 플러그인은 등록 훅 대신 `loader/volatile-update`를 구독합니다.
13
14
 
14
15
  ## 왜 굳이 패치인가? (도구 라우팅 가이드)
15
16
 
@@ -108,9 +109,9 @@ dsh web --dump-config # verify the plugin row appears
108
109
 
109
110
  ```bash
110
111
  npm install
111
- npm run typecheck # against 0.1.5-rc.3 peers (devDependencies)
112
- npm run typecheck:0.1.5 # 실제 0.1.5-rc.2 peer 대상 정적 교차 검증
113
- npm test # vitest, 90 tests
112
+ npm run typecheck # against 0.2.0-rc.1 peers (devDependencies)
113
+ npm run typecheck:0.2.0 # against real 0.2.0-rc.1 peer packages installed from the registry (dual-baseline proof)
114
+ npm test # vitest, 92 tests
114
115
  npm run lint
115
116
  npm run build # lib/
116
117
  npm run verify:source # static safety assertions (intent dance, no node:fs, …)
package/README.md CHANGED
@@ -6,10 +6,11 @@ Patch-style file editing for [DeepSeek Harness (DSH)](https://github.com/deepsee
6
6
 
7
7
  | DSH version | Status | Notes |
8
8
  |---|---|---|
9
- | `0.1.5-rc.1+` | ✅ supported (this line, v0.2.2+) | Type baseline pinned to the real `0.1.5-rc.3` peers; `peerDependencies`/`engines.dsh` capped to `>=0.1.5-rc.1 <0.1.6-0`. Published under the `dsh-0.1.5` dist-tag. |
10
- | `0.1.2-rc.1` ~ `0.1.4` | ↗ maintenance line | Served by the published `0.1.2` (main branch). `0.1.6+` is a different contract (shell `run` → `execute`) and is served by the compat/0.1.7 and compat/0.2.0 lines. |
9
+ | `0.2.0-rc.1+` | ✅ supported (this line, v0.3.0+) | Declarative settings: `allowCodexPatch` is marked `.volatile()` — the settings form renders automatically and `loader/volatile-update` re-registers the tool without a remount. No registration call. Delete/Move migrated to the `ShellExecutor.execute()` + `result()` foreground API. |
10
+ | `0.1.7-rc.1+` | ↗ maintenance line | Served by the `compat/0.1.7` branch / `dsh-0.1.7` dist-tag (v0.2.1 there). 0.2.0's shell executor renamed `run` → `execute` (introduced between 0.1.2 and 0.1.7), so one codebase cannot serve both lines type-safely. |
11
+ | `0.1.2-rc.1` ~ `0.1.5-rc.2` | ↗ maintenance line | Served by the pre-0.1.7 branch / `dsh-0.1.5` dist-tag. 0.1.7 removed the imperative settings APIs the dual-API fallback relied on. |
11
12
 
12
- Settings registration uses the dual-API fallback (`settings.installSection` on 0.1.2+, `settings.register` on older hosts).
13
+ Settings are declarative on this line: fields marked `.volatile()` in `Config` become the settings form; the plugin subscribes to `loader/volatile-update` instead of receiving registration hooks.
13
14
 
14
15
  ## Why patch at all? (tool routing guide)
15
16
 
@@ -108,9 +109,9 @@ Enable with `allowCodexPatch: true`. When a Codex patch arrives while disabled,
108
109
 
109
110
  ```bash
110
111
  npm install
111
- npm run typecheck # against 0.1.5-rc.3 peers (devDependencies)
112
- npm run typecheck:0.1.5 # static cross-proof against real 0.1.5-rc.2 peers
113
- npm test # vitest, 90 tests
112
+ npm run typecheck # against 0.2.0-rc.1 peers (devDependencies)
113
+ npm run typecheck:0.2.0 # against real 0.2.0-rc.1 peer packages installed from the registry (dual-baseline proof)
114
+ npm test # vitest, 92 tests
114
115
  npm run lint
115
116
  npm run build # lib/
116
117
  npm run verify:source # static safety assertions (intent dance, no node:fs, …)
package/README.zh.md CHANGED
@@ -6,10 +6,11 @@
6
6
 
7
7
  | DSH 版本 | 状态 | 说明 |
8
8
  |---|---|---|
9
- | `0.1.5-rc.1+` | ✅ 支持(本线,v0.2.2+) | 类型基线钉在真实 `0.1.5-rc.3` peer 包;`peerDependencies`/`engines.dsh` 封顶到 `>=0.1.5-rc.1 <0.1.6-0`。经 `dsh-0.1.5` dist-tag 发布。 |
10
- | `0.1.2-rc.1` ~ `0.1.4` | ↗ 维护线 | 由已发布的 `0.1.2`(main 分支)服务。`0.1.6+` 是另一套契约(shell `run` → `execute`),由 compat/0.1.7 与 compat/0.2.0 线服务。 |
9
+ | `0.2.0-rc.1+` | ✅ 支持(本线,v0.3.0+) | 声明式设置:`allowCodexPatch` 标记 `.volatile()`——设置表单自动生成,`loader/volatile-update` 驱动工具原位重注册(不 remount),无任何注册调用。Delete/Move 已迁移到 `ShellExecutor.execute()` + `result()` 前台 API。 |
10
+ | `0.1.7-rc.1+` | ↗ 维护线 | 由 `compat/0.1.7` 分支 / `dsh-0.1.7` dist-tag 服务(该线 v0.2.1)。0.2.0 之前 shell 执行器已把 `run` 改名为 `execute`(发生在 0.1.2 → 0.1.7 之间),一份代码无法对两条线同时类型安全。 |
11
+ | `0.1.2-rc.1` ~ `0.1.5-rc.2` | ↗ 维护线 | 由 0.1.7 前的分支 / `dsh-0.1.5` dist-tag 服务。0.1.7 删除了双 API 回退所依赖的命令式注册 API。 |
11
12
 
12
- settings 注册走双 API 回退:0.1.2+ 的 `settings.installSection` 优先,旧版回退 `settings.register`。
13
+ 本线的 settings 是声明式的:`Config` 中标记 `.volatile()` 的字段即设置表单;插件订阅 `loader/volatile-update`,不再接收注册 hooks。
13
14
 
14
15
  ## 工具路由指引(为什么该用谁)
15
16
 
@@ -107,9 +108,9 @@ dsh web --dump-config # 确认插件行出现
107
108
 
108
109
  ```bash
109
110
  npm install
110
- npm run typecheck # 针对 0.1.5-rc.3 peer 包(devDependencies)
111
- npm run typecheck:0.1.5 # 对真实 0.1.5-rc.2 peer 包做交叉静态核验
112
- npm test # vitest,90 个用例
111
+ npm run typecheck # 针对 0.2.0-rc.1 peer 包(devDependencies)
112
+ npm run typecheck:0.2.0 # 从 registry 干净安装真实 0.2.0-rc.1 peer 包做类型核验(双基线证明)
113
+ npm test # vitest,92 个用例
113
114
  npm run lint
114
115
  npm run build # lib/
115
116
  npm run verify:source # 静态安全断言(intent 舞蹈、无 node:fs 等)
package/dsh.plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "dsh-patch-edit-plus",
3
3
  "name": "dsh-patch-edit-plus",
4
- "version": "0.2.2",
4
+ "version": "0.3.0",
5
5
  "description": {
6
6
  "en": "Patch-style file editing: one apply_patch tool for git/unified diff (default) and Codex apply_patch syntax (opt-in), with all-or-nothing application and sandbox-aware delete/move.",
7
7
  "zh": "补丁风格文件编辑:单个 apply_patch 工具,接受 git/unified diff(默认)与 Codex apply_patch 语法(可选开启),全量验证后原子应用,删除/移动走沙箱感知 shell。"
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "license": "MIT",
15
15
  "engines": {
16
- "dsh": ">=0.1.5-rc.1 <0.1.6-0"
16
+ "dsh": ">=0.2.0-rc.1 <0.2.1-0"
17
17
  },
18
18
  "components": {
19
19
  "host": "lib/index.js"
package/lib/config.js CHANGED
@@ -12,7 +12,7 @@ export const Config = z.object({
12
12
  conflictPolicy: z.union(['rename', 'skip', 'fail']).default('rename'),
13
13
  renameSuffix: z.string().default('_1'),
14
14
  allowUnifiedDiff: z.boolean().default(true),
15
- allowCodexPatch: z.boolean().default(false),
15
+ allowCodexPatch: z.boolean().default(false).volatile(),
16
16
  deleteBackend: z.union(['shell', 'none']).default('shell'),
17
17
  shellDialect: z.union(['auto', 'posix', 'pwsh']).default('auto'),
18
18
  deleteCommand: z.string(),
@@ -23,6 +23,14 @@ export const Config = z.object({
23
23
  maxPatchBytes: z.number().step(1).min(1024).default(512 * 1024),
24
24
  maxDiffBytes: z.number().step(1).min(256).default(16 * 1024),
25
25
  });
26
+ /** Read a `.volatile()` field: a live ref on 0.1.7+, a plain boolean otherwise. */
27
+ export function readVolatileBoolean(value, fallback) {
28
+ if (typeof value === 'boolean')
29
+ return value;
30
+ if (value && typeof value.get === 'function')
31
+ return Boolean(value.get());
32
+ return fallback;
33
+ }
26
34
  /** Fill user config with defaults; `undefined`/null entries fall back too. */
27
35
  export function resolveConfig(config) {
28
36
  const c = config ?? {};
@@ -31,7 +39,7 @@ export function resolveConfig(config) {
31
39
  conflictPolicy: c.conflictPolicy ?? 'rename',
32
40
  renameSuffix: typeof c.renameSuffix === 'string' ? c.renameSuffix : '_1',
33
41
  allowUnifiedDiff: c.allowUnifiedDiff ?? true,
34
- allowCodexPatch: c.allowCodexPatch ?? false,
42
+ allowCodexPatch: readVolatileBoolean(c.allowCodexPatch, false),
35
43
  deleteBackend: c.deleteBackend ?? 'shell',
36
44
  shellDialect: c.shellDialect ?? 'auto',
37
45
  deleteCommand: typeof c.deleteCommand === 'string' && c.deleteCommand !== '' ? c.deleteCommand : undefined,
package/lib/index.js CHANGED
@@ -4,14 +4,15 @@
4
4
  * One `apply_patch` tool accepting git/unified diff (default) and Codex
5
5
  * `apply_patch` syntax (opt-in). All-or-nothing application through the
6
6
  * official fs write-intent dance; delete/move through the sandbox-aware
7
- * shell. Compatible with DSH 0.1.2-rc.1 through 0.1.5-rc.2: the tool
8
- * authoring contract is byte-identical across those versions, so a single
9
- * code path serves both; only settings registration needs the dual-API
10
- * fallback (`installSection` first, `register` second).
7
+ * shell. Targets DSH 0.1.7+: settings are declarative — the fields marked
8
+ * `.volatile()` in `Config` render the settings form automatically (no
9
+ * registration call), and `loader/volatile-update` drives re-registration
10
+ * without a plugin remount. This line drops the pre-0.1.7 hosts; the
11
+ * 0.1.2-rc.1 ~ 0.1.5-rc.2 line stays on its maintenance branch.
11
12
  *
12
13
  * @module dsh-patch-edit-plus
13
14
  */
14
- import { Config, resolveConfig } from './config.js';
15
+ import { resolveConfig } from './config.js';
15
16
  import { registerApplyPatchTool } from './register.js';
16
17
  /** Cordis plugin name used by Loader diagnostics. */
17
18
  export const name = 'dsh-patch-edit-plus';
@@ -31,26 +32,21 @@ export const name = 'dsh-patch-edit-plus';
31
32
  * in every profile that has no shell capability.
32
33
  */
33
34
  export const inject = ['tools', 'fs'];
35
+ export { Config } from './config.js';
34
36
  /**
35
- * Settings namespace. Must match dsh-settings `NAMESPACE_PATTERN`
36
- * (`/^[a-z][a-z0-9-]*$/`) on every target version: letters, digits and
37
- * hyphens only — an underscore made `register()` throw before anything
38
- * persisted, so no migration is needed.
37
+ * Register the tool from the current config snapshot.
38
+ *
39
+ * 登记级 key。工具「描述」把可用语法固化进去了(tool.ts 拼 `Accepts ${styles}`),
40
+ * 所以判定必须覆盖整份 resolved config,而不是只看 allowCodexPatch。
39
41
  */
40
- export const SETTINGS_NAMESPACE = 'patch-edit-plus';
41
- export { Config };
42
- /** Register the tool and the settings namespace. Every registration is scoped to this plugin. */
43
42
  export function apply(ctx, config) {
43
+ // 组合条目(0.1.7 起 volatile 字段在其中是 live 引用):rejudge 每次整体
44
+ // 重解析一次,一次调用内是同一份快照;跨调用的最新值由事件驱动重取。
44
45
  const compositionEntry = config ?? {};
45
- // 权威来源:设置层挂载时是解析后的 scope,否则是组合条目。
46
- // installSection 保证在每次匹配的 onChange 之前先调用 setSource(attach 与 detach 各一次)。
47
- let readSource = () => compositionEntry;
48
46
  let disposer = null;
49
- // 登记级 key。工具「描述」把可用语法固化进去了(tool.ts 拼 `Accepts ${styles}`),
50
- // 所以判定必须覆盖整份 resolved config,而不是只看 allowCodexPatch。
51
47
  let registeredKey = null;
52
48
  const rejudge = () => {
53
- const next = resolveConfig(readSource());
49
+ const next = resolveConfig(compositionEntry);
54
50
  const key = JSON.stringify(next);
55
51
  if (key === registeredKey)
56
52
  return;
@@ -66,23 +62,9 @@ export function apply(ctx, config) {
66
62
  registeredKey = null;
67
63
  };
68
64
  });
69
- ctx.inject(['settings'], (settingsCtx) => {
70
- const settings = settingsCtx.settings
71
- ?? settingsCtx;
72
- if (typeof settings?.installSection === 'function') {
73
- settings.installSection(ctx, SETTINGS_NAMESPACE, Config, compositionEntry, {
74
- setSource: (current) => { readSource = current; },
75
- onChange: () => { rejudge(); },
76
- });
77
- return;
78
- }
79
- if (typeof settings?.register === 'function') {
80
- const scope = settings.register(SETTINGS_NAMESPACE, Config, { base: compositionEntry });
81
- if (scope !== undefined) {
82
- readSource = () => scope.get();
83
- scope.watch(() => { rejudge(); });
84
- rejudge();
85
- }
86
- }
65
+ // 0.1.7+: 只有 volatile 字段变更才走这里(不 remount);普通字段变更会整体
66
+ // remount 插件,新一次 `apply` 自然读到全部新值。等值变更宿主不通知。
67
+ ctx.on('loader/volatile-update', () => {
68
+ rejudge();
87
69
  });
88
70
  }
package/lib/shellops.js CHANGED
@@ -36,7 +36,7 @@ export function moveTemplate(cfg) {
36
36
  export function resolveShell(ctx) {
37
37
  try {
38
38
  const shell = ctx.shell;
39
- return shell !== undefined && typeof shell.run === 'function' && typeof shell.resolve === 'function' ? shell : undefined;
39
+ return shell !== undefined && typeof shell.execute === 'function' && typeof shell.resolve === 'function' ? shell : undefined;
40
40
  }
41
41
  catch {
42
42
  return undefined;
@@ -87,7 +87,8 @@ function requireShell(ctx, cfg) {
87
87
  }
88
88
  async function runShell(shell, request) {
89
89
  try {
90
- return await shell.run(shell.resolve(request));
90
+ const execution = await shell.execute(shell.resolve(request));
91
+ return await execution.result();
91
92
  }
92
93
  catch (error) {
93
94
  const detail = error instanceof Error ? error.message : String(error);
@@ -6,6 +6,7 @@
6
6
  * @module dsh-patch-edit-plus/config
7
7
  */
8
8
  import z from '@deepseek-ai/schemastery';
9
+ import type { Volatile } from '@deepseek-ai/cosmokit';
9
10
  /** What to do when the configured tool name is already taken at registration. */
10
11
  export type ConflictPolicy = 'rename' | 'skip' | 'fail';
11
12
  /** Backend used for Delete/Move operations (`ctx.fs` has no delete/move). */
@@ -22,8 +23,10 @@ export interface Config {
22
23
  renameSuffix?: string;
23
24
  /** Accept git/unified diff patches. Defaults to true. */
24
25
  allowUnifiedDiff?: boolean;
25
- /** Accept Codex `apply_patch` syntax. Defaults to false. */
26
- allowCodexPatch?: boolean;
26
+ /** Accept Codex `apply_patch` syntax. Defaults to false.
27
+ * 0.1.7 `.volatile()`: the loader hands `apply` a live `Volatile` ref for this
28
+ * field — always read it through `readVolatileBoolean`, never cache the ref. */
29
+ allowCodexPatch?: boolean | Volatile<boolean>;
27
30
  /** Delete/Move backend. Defaults to `shell`. `none` rejects Delete/Move with a structured error. */
28
31
  deleteBackend?: DeleteBackend;
29
32
  /** Shell dialect for the constant delete/move templates. Defaults to `auto` (pwsh on win32). */
@@ -44,7 +47,37 @@ export interface Config {
44
47
  maxDiffBytes?: number;
45
48
  }
46
49
  /** Schemastery schema for Loader defaults and generated configuration docs. */
47
- export declare const Config: z<Config>;
50
+ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
51
+ toolName: z<string, string, "defined">;
52
+ conflictPolicy: z<"rename" | "skip" | "fail", "rename" | "skip" | "fail", "defined">;
53
+ renameSuffix: z<string, string, "defined">;
54
+ allowUnifiedDiff: z<boolean, boolean, "defined">;
55
+ allowCodexPatch: z<boolean, boolean, "volatile-defined">;
56
+ deleteBackend: z<"shell" | "none", "shell" | "none", "defined">;
57
+ shellDialect: z<"auto" | "posix" | "pwsh", "auto" | "posix" | "pwsh", "defined">;
58
+ deleteCommand: z<string, string, "plain">;
59
+ moveCommand: z<string, string, "plain">;
60
+ dryRunByDefault: z<boolean, boolean, "defined">;
61
+ followSymlinks: z<boolean, boolean, "defined">;
62
+ maxFiles: z<number, number, "defined">;
63
+ maxPatchBytes: z<number, number, "defined">;
64
+ maxDiffBytes: z<number, number, "defined">;
65
+ }>>, Schemastery.ObjectT<NoInfer<{
66
+ toolName: z<string, string, "defined">;
67
+ conflictPolicy: z<"rename" | "skip" | "fail", "rename" | "skip" | "fail", "defined">;
68
+ renameSuffix: z<string, string, "defined">;
69
+ allowUnifiedDiff: z<boolean, boolean, "defined">;
70
+ allowCodexPatch: z<boolean, boolean, "volatile-defined">;
71
+ deleteBackend: z<"shell" | "none", "shell" | "none", "defined">;
72
+ shellDialect: z<"auto" | "posix" | "pwsh", "auto" | "posix" | "pwsh", "defined">;
73
+ deleteCommand: z<string, string, "plain">;
74
+ moveCommand: z<string, string, "plain">;
75
+ dryRunByDefault: z<boolean, boolean, "defined">;
76
+ followSymlinks: z<boolean, boolean, "defined">;
77
+ maxFiles: z<number, number, "defined">;
78
+ maxPatchBytes: z<number, number, "defined">;
79
+ maxDiffBytes: z<number, number, "defined">;
80
+ }>>, "plain">;
48
81
  /** Fully-resolved configuration used by the tool body. */
49
82
  export interface ResolvedConfig {
50
83
  toolName: string;
@@ -62,5 +95,7 @@ export interface ResolvedConfig {
62
95
  maxPatchBytes: number;
63
96
  maxDiffBytes: number;
64
97
  }
98
+ /** Read a `.volatile()` field: a live ref on 0.1.7+, a plain boolean otherwise. */
99
+ export declare function readVolatileBoolean(value: boolean | Volatile<boolean> | undefined, fallback: boolean): boolean;
65
100
  /** Fill user config with defaults; `undefined`/null entries fall back too. */
66
101
  export declare function resolveConfig(config: Config | undefined): ResolvedConfig;
@@ -4,16 +4,21 @@
4
4
  * One `apply_patch` tool accepting git/unified diff (default) and Codex
5
5
  * `apply_patch` syntax (opt-in). All-or-nothing application through the
6
6
  * official fs write-intent dance; delete/move through the sandbox-aware
7
- * shell. Compatible with DSH 0.1.2-rc.1 through 0.1.5-rc.2: the tool
8
- * authoring contract is byte-identical across those versions, so a single
9
- * code path serves both; only settings registration needs the dual-API
10
- * fallback (`installSection` first, `register` second).
7
+ * shell. Targets DSH 0.1.7+: settings are declarative — the fields marked
8
+ * `.volatile()` in `Config` render the settings form automatically (no
9
+ * registration call), and `loader/volatile-update` drives re-registration
10
+ * without a plugin remount. This line drops the pre-0.1.7 hosts; the
11
+ * 0.1.2-rc.1 ~ 0.1.5-rc.2 line stays on its maintenance branch.
11
12
  *
12
13
  * @module dsh-patch-edit-plus
13
14
  */
14
15
  import type { Context } from '@deepseek-ai/cordis';
15
- import { Config } from './config.js';
16
16
  import type { Config as PluginConfig } from './config.js';
17
+ declare module '@deepseek-ai/cordis' {
18
+ interface Events {
19
+ 'loader/volatile-update': (paths: string[]) => void;
20
+ }
21
+ }
17
22
  /** Cordis plugin name used by Loader diagnostics. */
18
23
  export declare const name = "dsh-patch-edit-plus";
19
24
  /**
@@ -32,13 +37,11 @@ export declare const name = "dsh-patch-edit-plus";
32
37
  * in every profile that has no shell capability.
33
38
  */
34
39
  export declare const inject: string[];
40
+ export { Config } from './config.js';
35
41
  /**
36
- * Settings namespace. Must match dsh-settings `NAMESPACE_PATTERN`
37
- * (`/^[a-z][a-z0-9-]*$/`) on every target version: letters, digits and
38
- * hyphens only — an underscore made `register()` throw before anything
39
- * persisted, so no migration is needed.
42
+ * Register the tool from the current config snapshot.
43
+ *
44
+ * 登记级 key。工具「描述」把可用语法固化进去了(tool.ts 拼 `Accepts ${styles}`),
45
+ * 所以判定必须覆盖整份 resolved config,而不是只看 allowCodexPatch。
40
46
  */
41
- export declare const SETTINGS_NAMESPACE = "patch-edit-plus";
42
- export { Config };
43
- /** Register the tool and the settings namespace. Every registration is scoped to this plugin. */
44
47
  export declare function apply(ctx: Context, config?: PluginConfig): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-patch-edit-plus",
3
- "version": "0.2.2",
4
- "description": "Patch-style file editing for DeepSeek Harness: one apply_patch tool accepting git/unified diff (default) and Codex apply_patch syntax (opt-in), with all-or-nothing application, read-before-write intent dance, sandbox-aware delete/move, and 0.1.5-rc line compatibility (dsh-0.1.5 dist-tag).",
3
+ "version": "0.3.0",
4
+ "description": "Patch-style file editing for DeepSeek Harness: one apply_patch tool accepting git/unified diff (default) and Codex apply_patch syntax (opt-in), with all-or-nothing application, read-before-write intent dance, sandbox-aware delete/move, targeting the DSH 0.2.0 line (declarative volatile settings).",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
@@ -37,7 +37,7 @@
37
37
  "build": "tsc -p tsconfig.build.json",
38
38
  "prepublishOnly": "npm run build",
39
39
  "typecheck": "tsc -p tsconfig.json",
40
- "typecheck:0.1.5": "node scripts/typecheck-0.1.5.mjs",
40
+ "typecheck:0.2.0": "node scripts/typecheck-0.2.0.mjs",
41
41
  "lint": "eslint src tests scripts _smoke",
42
42
  "lint:fix": "eslint src tests scripts _smoke --fix",
43
43
  "test": "vitest run",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "engines": {
49
49
  "node": ">=20",
50
- "dsh": ">=0.1.5-rc.1 <0.1.6-0"
50
+ "dsh": ">=0.2.0-rc.1 <0.2.1-0"
51
51
  },
52
52
  "license": "MIT",
53
53
  "keywords": [
@@ -62,10 +62,10 @@
62
62
  ],
63
63
  "peerDependencies": {
64
64
  "@deepseek-ai/cordis": "^4.0.1",
65
- "@deepseek-ai/dsh-fs": ">=0.1.5-rc.1 <0.1.6-0",
66
- "@deepseek-ai/dsh-sandbox": ">=0.1.5-rc.1 <0.1.6-0",
67
- "@deepseek-ai/dsh-shell": ">=0.1.5-rc.1 <0.1.6-0",
68
- "@deepseek-ai/dsh-tools": ">=0.1.5-rc.1 <0.1.6-0"
65
+ "@deepseek-ai/dsh-fs": ">=0.2.0-rc.1 <0.2.1-0",
66
+ "@deepseek-ai/dsh-sandbox": ">=0.2.0-rc.1 <0.2.1-0",
67
+ "@deepseek-ai/dsh-shell": ">=0.2.0-rc.1 <0.2.1-0",
68
+ "@deepseek-ai/dsh-tools": ">=0.2.0-rc.1 <0.2.1-0"
69
69
  },
70
70
  "peerDependenciesMeta": {
71
71
  "@deepseek-ai/cordis": {
@@ -85,19 +85,23 @@
85
85
  }
86
86
  },
87
87
  "dependencies": {
88
- "@deepseek-ai/schemastery": "^3.18.2"
88
+ "@deepseek-ai/schemastery": "^3.18.4"
89
89
  },
90
90
  "devDependencies": {
91
91
  "@deepseek-ai/cordis": "^4.0.2",
92
- "@deepseek-ai/dsh-fs": "0.1.5-rc.3",
93
- "@deepseek-ai/dsh-sandbox": "0.1.5-rc.3",
94
- "@deepseek-ai/dsh-shell": "0.1.5-rc.3",
95
- "@deepseek-ai/dsh-tools": "0.1.5-rc.3",
92
+ "@deepseek-ai/dsh-fs": "0.2.0-rc.1",
93
+ "@deepseek-ai/dsh-sandbox": "0.2.0-rc.1",
94
+ "@deepseek-ai/dsh-shell": "0.2.0-rc.1",
95
+ "@deepseek-ai/dsh-tools": "0.2.0-rc.1",
96
96
  "@eslint/js": "^9.0.0",
97
97
  "@types/node": "^22.0.0",
98
98
  "eslint": "^9.0.0",
99
99
  "typescript": "^5.6.0",
100
100
  "typescript-eslint": "^8.0.0",
101
- "vitest": "^3.0.0"
101
+ "vitest": "^3.0.0",
102
+ "@deepseek-ai/schemastery": "^3.18.4"
103
+ },
104
+ "publishConfig": {
105
+ "tag": "dsh-0.1.7"
102
106
  }
103
107
  }