dsh-patch-edit-plus 0.3.0 → 0.3.1
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 +5 -0
- package/CHANGELOG.zh.md +5 -0
- package/README.de.md +127 -0
- package/README.es.md +127 -0
- package/README.fr.md +127 -0
- package/README.it.md +127 -0
- package/README.ja.md +2 -0
- package/README.ko.md +2 -0
- package/README.md +2 -0
- package/README.ru.md +127 -0
- package/README.zh.md +2 -0
- package/dsh.plugin.json +1 -1
- package/lib/parse/unified.js +6 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
## [0.3.1] — 2026-10-01
|
|
5
|
+
|
|
6
|
+
### Fixed
|
|
7
|
+
- **A bare multi-file unified diff collapsed into one file section** (same defect fixed on the 0.1.7 line in 0.2.5): with no `diff --git` separators, the second file's `--- `/`+++ ` headers rewrote the previous section's paths and its hunks were matched against the wrong content, failing every section after the first with `the context does not match the file`. `--- ` now opens a new section whenever the current one is already claimed; parser-level and end-to-end regression tests added.
|
|
3
8
|
## [0.3.0] — 2026-09-29
|
|
4
9
|
|
|
5
10
|
### Changed
|
package/CHANGELOG.zh.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
## [0.3.1] — 2026-10-01
|
|
5
|
+
|
|
6
|
+
### 修复
|
|
7
|
+
- **裸多文件 unified diff 被折叠进同一个文件 section**(与 0.1.7 线 0.2.5 修复的同一缺陷):没有 `diff --git` 分隔时,第二个文件的 `--- `/`+++ ` 头改写前一个 section 的路径,其 hunk 被拿到错误内容上匹配,第一个文件之后的每个 section 都报 `the context does not match the file`。现在当前 section 已被认领时 `--- ` 即开新 section;新增解析层与端到端回归测试。
|
|
3
8
|
## [0.3.0] — 2026-09-29
|
|
4
9
|
|
|
5
10
|
### 变更
|
package/README.de.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# dsh-patch-edit-plus
|
|
2
|
+
|
|
3
|
+
Deutsch | [English](./README.md) | [简体中文](./README.zh.md) | [日本語](./README.ja.md) | [한국어](./README.ko.md) | [Français](./README.fr.md) | [Italiano](./README.it.md) | [Русский](./README.ru.md) | [Español](./README.es.md)
|
|
4
|
+
|
|
5
|
+
Patch-basierte Dateibearbeitung für [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness): ein einzelnes, dem Modell zugängliches `apply_patch`-Werkzeug, das **git/unified diff** (Standard) und die **Codex-`apply_patch`-Syntax** (Opt-in) akzeptiert, jede Änderung nach dem **Alles-oder-Nichts**-Prinzip anwendet und DSH dabei vollständig aus dem Weg geht.
|
|
6
|
+
|
|
7
|
+
## DSH-Versionskompatibilität
|
|
8
|
+
|
|
9
|
+
| DSH-Version | Status | Hinweise |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `0.2.0-rc.1+` | ✅ unterstützt (diese Linie, v0.3.0+) | Deklarative Einstellungen: `allowCodexPatch` ist mit `.volatile()` markiert — das Einstellungsformular wird automatisch gerendert, und `loader/volatile-update` registriert das Werkzeug ohne Remount neu. Kein Registrierungsaufruf. Delete/Move wurde auf die Foreground-API `ShellExecutor.execute()` + `result()` migriert. |
|
|
12
|
+
| `0.1.7-rc.1+` | ↗ Wartungslinie | Wird vom Zweig `compat/0.1.7` / dem Dist-Tag `dsh-0.1.7` bedient (dort v0.2.1). Der Shell-Executor von 0.2.0 benannte `run` → `execute` um (eingeführt zwischen 0.1.2 und 0.1.7), daher kann eine einzige Codebasis nicht typsicher beide Linien bedienen. |
|
|
13
|
+
| `0.1.2-rc.1` ~ `0.1.5-rc.2` | ↗ Wartungslinie | Wird vom Zweig vor 0.1.7 / dem Dist-Tag `dsh-0.1.5` bedient. 0.1.7 entfernte die imperativen Einstellungs-APIs, auf die der Dual-API-Fallback angewiesen war. |
|
|
14
|
+
|
|
15
|
+
Einstellungen sind auf dieser Linie deklarativ: In `Config` mit `.volatile()` markierte Felder werden zum Einstellungsformular; das Plugin abonniert `loader/volatile-update`, statt Registrierungs-Hooks zu empfangen.
|
|
16
|
+
|
|
17
|
+
## Warum überhaupt Patches? (Tool-Routing-Leitfaden)
|
|
18
|
+
|
|
19
|
+
Die Werkzeugbeschreibung leitet das Modell ausdrücklich:
|
|
20
|
+
|
|
21
|
+
- **Einzelne kleine Änderung in einer bereits gelesenen Datei** → bevorzugen Sie das native `edit`-Werkzeug (ein Patch kostet mehr Tokens als eine wörtliche Bearbeitung).
|
|
22
|
+
- **Kleine Änderung in einer GROSSEN Datei** → `apply_patch` (die ganze Datei muss nicht zurückgeschickt werden).
|
|
23
|
+
- **Gebündelte Änderungen über VIELE Dateien** → `apply_patch` (ein Aufruf, atomar verifiziert).
|
|
24
|
+
- **Neue Datei mit substanziellem Inhalt / Löschen / Umbenennen** → `apply_patch`.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
dsh plugin --profile web add <path-to-dsh-patch-edit-plus>
|
|
30
|
+
dsh web --dump-config # verify the plugin row appears
|
|
31
|
+
# restart DSH
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Verwendung
|
|
35
|
+
|
|
36
|
+
### Unified Diff (Standard, aktiviert)
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
--- a/src/app.ts
|
|
40
|
+
+++ b/src/app.ts
|
|
41
|
+
@@ -10,4 +10,4 @@ export function main() {
|
|
42
|
+
init()
|
|
43
|
+
- start(oldPort)
|
|
44
|
+
+ start(newPort)
|
|
45
|
+
await shutdown()
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Codex apply_patch-Syntax (Opt-in)
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
*** Begin Patch
|
|
53
|
+
*** Update File: src/app.ts
|
|
54
|
+
@@
|
|
55
|
+
init()
|
|
56
|
+
- start(oldPort)
|
|
57
|
+
+ start(newPort)
|
|
58
|
+
*** Add File: docs/notes.md
|
|
59
|
+
+# Notes
|
|
60
|
+
*** Delete File: tmp/junk.txt
|
|
61
|
+
*** Move to: src/app.ts (via `*** Move to:` after *** Update File:)
|
|
62
|
+
*** End Patch
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Aktivieren mit `allowCodexPatch: true`. Trifft ein Codex-Patch ein, während die Option deaktiviert ist, liefert das Werkzeug einen **umsetzbaren Hinweis** (wie man sie aktiviert oder wie man im Unified-Diff-Format wiederholt) statt eines generischen Parse-Fehlers — die Codex-Syntax ist ein starker Prior für Modelle der GPT-Familie, und ein stilles Scheitern fängt sie in Wiederholungsschleifen.
|
|
66
|
+
|
|
67
|
+
### Operationen
|
|
68
|
+
|
|
69
|
+
| Operation | Unified Diff | Codex | Ausführungspfad |
|
|
70
|
+
|---|---|---|---|
|
|
71
|
+
| Hinzufügen | `new file mode` + `/dev/null` | `*** Add File:` | `ctx.fs.writeText` (offizieller Intent-Ablauf) |
|
|
72
|
+
| Aktualisieren (multi-hunk) | `@@` hunks | `@@` hunks | `ctx.fs.writeText` |
|
|
73
|
+
| Löschen | `deleted file mode` + `/dev/null` | `*** Delete File:` | `ctx.shell` (sandbox-bewusst, Pfad per env übergeben) |
|
|
74
|
+
| Verschieben / Umbenennen | `rename from/to` | `*** Move to:` | `ctx.shell` |
|
|
75
|
+
|
|
76
|
+
## Garantien
|
|
77
|
+
|
|
78
|
+
- **Alles-oder-Nichts**: Der gesamte Patch wird zuerst gegen den aktuellen Dateiinhalt verifiziert (Kontextlokalisierung, Workspace-Eingrenzung, Symlink-Richtlinie, doppelte Pfade); jeder Fehler bricht ab, ohne dass ein einziges Byte geschrieben wurde.
|
|
79
|
+
- **Einhaltung der Read-before-Write-Schranke**: Jeder Schreibvorgang reproduziert den Intent-Ablauf des offiziellen `write`-Werkzeugs — `fs/write-intent`-Wasserfall → geschütztes `writeText` → `fs/observed`-Emission. Ein nacktes `writeText` würde die Schranke still umgehen, da DSH-Provider `fs/*`-Ereignisse nie selbst dispatchen.
|
|
80
|
+
- **Präzise Fehlerdiagnostik**: Bei einer Hunk-Fehlanpassung trägt der Fehler Datei + Hunk-Index, Ursprungszeile der Suche, Vorschau der erwarteten Zeile (Whitespace sichtbar gemacht), den tatsächlichen Dateiauszug sowie einen gezielten Hinweis.
|
|
81
|
+
- **Zeilenende-Treue**: CRLF-Dateien werden als CRLF zurückgeschrieben; Enden ohne abschließenden Zeilenumbruch bleiben erhalten, sofern der Patch das Ende nicht ändert.
|
|
82
|
+
- **Reine Ergänzung**: Das Plugin registriert genau ein Werkzeug, ruft nie `tools.restrict()` auf, überschreibt nie ein natives Werkzeug, registriert keine globalen Dienste und entfernt beim Entladen alles. Namenskonflikte mit anderen `apply_patch`-Providern (`bainianlaoyao/dsh-codex-mode`, `shuind/dsh-codex-harness`, …) werden durch Umbenennungs-Vermeidung gelöst (`apply_patch_1`, `…_2`, …), sodass DSH beim Start nie scheitert.
|
|
83
|
+
|
|
84
|
+
## Konfiguration
|
|
85
|
+
|
|
86
|
+
| Option | Standard | Beschreibung |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `toolName` | `apply_patch` | Name des dem Modell zugänglichen Werkzeugs. |
|
|
89
|
+
| `conflictPolicy` | `rename` | `rename` / `skip` / `fail`, wenn der Werkzeugname bereits vergeben ist. |
|
|
90
|
+
| `renameSuffix` | `_1` | Suffix, das von der Umbenennungs-Vermeidung verwendet wird. |
|
|
91
|
+
| `allowUnifiedDiff` | `true` | Akzeptiert git/unified diffs. |
|
|
92
|
+
| `allowCodexPatch` | `false` | Akzeptiert die Codex-`apply_patch`-Syntax. Auch im DSH-Einstellungspanel änderbar; Änderungen wirken sofort, kein Neustart nötig. |
|
|
93
|
+
| `deleteBackend` | `shell` | `shell` oder `none` (Delete/Move liefern einen strukturierten Fehler). |
|
|
94
|
+
| `shellDialect` | `auto` | `auto` (pwsh unter win32) / `posix` / `pwsh`. |
|
|
95
|
+
| `deleteCommand` / `moveCommand` | built-in | Eigene Befehlsvorlagen. Pfade kommen weiterhin **ausschließlich per env** an (`DSH_PATCH_TARGET` / `DSH_PATCH_SOURCE`); interpolieren Sie sie nie in den Befehlsstring. |
|
|
96
|
+
| `dryRunByDefault` | `false` | Aufrufe als Probelauf (Dry Run) behandeln, außer bei `dryRun: false`. |
|
|
97
|
+
| `followSymlinks` | `false` | Erlauben, dass Patch-Pfade Symlinks folgen. |
|
|
98
|
+
| `maxFiles` | `50` | Maximale Anzahl Dateiabschnitte pro Patch. |
|
|
99
|
+
| `maxPatchBytes` | `524288` | Maximale Größe des Patch-Texts in Bytes. |
|
|
100
|
+
| `maxDiffBytes` | `16384` | Maximale Größe des je Datei in den Ergebnis-Metadaten behaltenen Diffs (größere Diffs werden geleert und mit `truncated` markiert). |
|
|
101
|
+
|
|
102
|
+
## Einschränkungen (offengelegt)
|
|
103
|
+
|
|
104
|
+
- **Delete/Move laufen über `ctx.shell`.** Die Sandbox-Stärke ist genau die, die der geladene Shell-Executor durchsetzt (`bash-sandbox` grenzt ab; `bash-local` nicht) — dieselbe Risikoposition wie beim nativen bash-Werkzeug. Jede Anfrage trägt eine `sandboxPolicy` und berichtet Sandbox-Fakten, damit „Richtlinie verweigert“ von „Befehl fehlgeschlagen“ unterscheidbar ist.
|
|
105
|
+
- **Jeder Schreibvorgang und jeder Delete/Move trägt die Sitzungsbezogene Richtlinie.** `apply_patch` löst `ctx.sandboxPolicy.resolve({ session })` pro Aufruf auf — die Modus-Übersteuerung der Sitzung plus deren cwd als Workspace-Wurzel — genau wie die nativen `write`/`edit`-Werkzeuge, und löst die Planknotenpfade gegen dieselbe Wurzel auf. Ohne sie fällt das durchsetzende Dateisystem auf die Deployment-Wurzel zurück, wodurch Schreibvorgänge im Workspace als `workspace-write`-Verweigerungen fehlschlagen, selbst in einer `danger-full-access`-Sitzung. Eine `workspace-write`-Verweigerung tritt als `PatchError` auf, deren Nachricht den Backend-Text trägt (der strukturierte `[sandbox: …]`-Marker und die Same-Turn-Escalation-Felder sind nicht implementiert; benutzen Sie die nativen `write`/`edit`-Werkzeuge, wenn Sie eskalieren müssen).
|
|
106
|
+
- **Add erzeugt keine übergeordneten Verzeichnisse.** Das entspricht dem nativen `write`-Werkzeug (`ctx.fs` hat kein mkdir); der Fehler nennt das fehlende Verzeichnis.
|
|
107
|
+
- Kein unscharfes/Offset-basiertes Matching: Die Hunk-Lokalisierung ist exakt → `trimEnd` → `trim`, und das absichtlich (unscharfes Matching ist bei destruktiven Operationen unsicher; es steht auf der Roadmap).
|
|
108
|
+
- Binär-Patches werden mit einer klaren Fehlermeldung abgelehnt.
|
|
109
|
+
|
|
110
|
+
## Entwicklung
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm install
|
|
114
|
+
npm run typecheck # against 0.2.0-rc.1 peers (devDependencies)
|
|
115
|
+
npm run typecheck:0.2.0 # against real 0.2.0-rc.1 peer packages installed from the registry (dual-baseline proof)
|
|
116
|
+
npm test # vitest, 92 tests
|
|
117
|
+
npm run lint
|
|
118
|
+
npm run build # lib/
|
|
119
|
+
npm run verify:source # static safety assertions (intent dance, no node:fs, …)
|
|
120
|
+
npm run smoke # load-level smoke against a stub host
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Die manuelle Verifikation auf einem laufenden DSH (`dsh plugin --profile web add` → Neustart → Aufruf des Werkzeugs in einer Sitzung) ist bewusst dem Betreiber überlassen.
|
|
124
|
+
|
|
125
|
+
## Lizenz
|
|
126
|
+
|
|
127
|
+
MIT
|
package/README.es.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# dsh-patch-edit-plus
|
|
2
|
+
|
|
3
|
+
Español | [English](./README.md) | [简体中文](./README.zh.md) | [日本語](./README.ja.md) | [한국어](./README.ko.md) | [Français](./README.fr.md) | [Deutsch](./README.de.md) | [Italiano](./README.it.md) | [Русский](./README.ru.md)
|
|
4
|
+
|
|
5
|
+
Edición de archivos estilo parche para [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness): una única herramienta `apply_patch` expuesta al modelo, que acepta **diff git/unificado** (por defecto) y la **sintaxis `apply_patch` de Codex** (opcional), aplica cada cambio bajo el principio de **todo-o-nada** y no estorba en absoluto a DSH.
|
|
6
|
+
|
|
7
|
+
## Compatibilidad de versiones de DSH
|
|
8
|
+
|
|
9
|
+
| Versión de DSH | Estado | Notas |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `0.2.0-rc.1+` | ✅ compatible (esta línea, v0.3.0+) | Ajustes declarativos: `allowCodexPatch` está marcado con `.volatile()` — el formulario de ajustes se genera automáticamente y `loader/volatile-update` vuelve a registrar la herramienta sin remontaje. Sin llamada de registro. Delete/Move migrados a la API de primer plano `ShellExecutor.execute()` + `result()`. |
|
|
12
|
+
| `0.1.7-rc.1+` | ↗ línea de mantenimiento | Atendida por la rama `compat/0.1.7` / el dist-tag `dsh-0.1.7` (v0.2.1 allí). El ejecutor de shell de 0.2.0 renombró `run` → `execute` (cambio introducido entre 0.1.2 y 0.1.7), así que una sola base de código no puede atender ambas líneas de forma type-safe. |
|
|
13
|
+
| `0.1.2-rc.1` ~ `0.1.5-rc.2` | ↗ línea de mantenimiento | Atendida por la rama anterior a 0.1.7 / el dist-tag `dsh-0.1.5`. La 0.1.7 eliminó las API imperativas de ajustes de las que dependía el fallback de doble API. |
|
|
14
|
+
|
|
15
|
+
En esta línea los ajustes son declarativos: los campos marcados con `.volatile()` en `Config` se convierten en el formulario de ajustes; el plugin se suscribe a `loader/volatile-update` en lugar de recibir hooks de registro.
|
|
16
|
+
|
|
17
|
+
## ¿Por qué usar parches? (guía de enrutamiento de herramientas)
|
|
18
|
+
|
|
19
|
+
La descripción de la herramienta dirige explícitamente al modelo:
|
|
20
|
+
|
|
21
|
+
- **Un único cambio pequeño en un archivo ya leído** → prefiere la herramienta nativa `edit` (un parche cuesta más tokens que una edición literal).
|
|
22
|
+
- **Cambio pequeño dentro de un archivo GRANDE** → `apply_patch` (no hace falta reenviar el archivo entero).
|
|
23
|
+
- **Cambios por lotes en MUCHOS archivos** → `apply_patch` (una sola llamada, verificada atómicamente).
|
|
24
|
+
- **Archivo nuevo con contenido sustancial / borrado / renombrado** → `apply_patch`.
|
|
25
|
+
|
|
26
|
+
## Instalación
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
dsh plugin --profile web add <path-to-dsh-patch-edit-plus>
|
|
30
|
+
dsh web --dump-config # verify the plugin row appears
|
|
31
|
+
# restart DSH
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Uso
|
|
35
|
+
|
|
36
|
+
### Diff unificado (por defecto, activado)
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
--- a/src/app.ts
|
|
40
|
+
+++ b/src/app.ts
|
|
41
|
+
@@ -10,4 +10,4 @@ export function main() {
|
|
42
|
+
init()
|
|
43
|
+
- start(oldPort)
|
|
44
|
+
+ start(newPort)
|
|
45
|
+
await shutdown()
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Sintaxis apply_patch de Codex (opcional)
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
*** Begin Patch
|
|
53
|
+
*** Update File: src/app.ts
|
|
54
|
+
@@
|
|
55
|
+
init()
|
|
56
|
+
- start(oldPort)
|
|
57
|
+
+ start(newPort)
|
|
58
|
+
*** Add File: docs/notes.md
|
|
59
|
+
+# Notes
|
|
60
|
+
*** Delete File: tmp/junk.txt
|
|
61
|
+
*** Move to: src/app.ts (via `*** Move to:` after *** Update File:)
|
|
62
|
+
*** End Patch
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Se activa con `allowCodexPatch: true`. Cuando llega un parche de Codex con la opción desactivada, la herramienta devuelve una **pista accionable** (cómo activarla o cómo reintentar en diff unificado) en lugar de un error genérico de análisis — la sintaxis de Codex es un prior fuerte para los modelos de la familia GPT, y un fallo silencioso los atrapa en bucles de reintentos.
|
|
66
|
+
|
|
67
|
+
### Operaciones
|
|
68
|
+
|
|
69
|
+
| Operación | Diff unificado | Codex | Ruta de ejecución |
|
|
70
|
+
|---|---|---|---|
|
|
71
|
+
| Añadir | `new file mode` + `/dev/null` | `*** Add File:` | `ctx.fs.writeText` (secuencia de intent oficial) |
|
|
72
|
+
| Actualizar (multi-hunk) | `@@` hunks | `@@` hunks | `ctx.fs.writeText` |
|
|
73
|
+
| Eliminar | `deleted file mode` + `/dev/null` | `*** Delete File:` | `ctx.shell` (consciente de la sandbox, ruta pasada por env) |
|
|
74
|
+
| Mover / renombrar | `rename from/to` | `*** Move to:` | `ctx.shell` |
|
|
75
|
+
|
|
76
|
+
## Garantías
|
|
77
|
+
|
|
78
|
+
- **Todo-o-nada**: el parche completo se verifica primero contra el contenido actual de los archivos (localización del contexto, contención del workspace, política de symlinks, rutas duplicadas); cualquier fallo aborta sin escribir un solo byte.
|
|
79
|
+
- **Se respeta la barrera de leer-antes-de-escribir**: cada escritura replica la secuencia de intent de la herramienta oficial `write` — cascada `fs/write-intent` → `writeText` protegido → emisión `fs/observed`. Un `writeText` a secas sortearía silenciosamente la barrera, porque los providers de DSH nunca despachan ellos mismos los eventos `fs/*`.
|
|
80
|
+
- **Diagnóstico preciso de fallos**: ante un hunk que no coincide, el error incluye archivo + índice del hunk, línea de origen de la búsqueda, vista previa de la línea esperada (con los espacios hechos visibles), el extracto real del archivo y una pista concreta.
|
|
81
|
+
- **Fidelidad de los finales de línea**: los archivos CRLF se reescriben como CRLF; los finales sin salto de línea final se preservan, salvo que el parche cambie el final.
|
|
82
|
+
- **Adición pura**: el plugin registra exactamente una herramienta, nunca llama a `tools.restrict()`, nunca sobrescribe una herramienta nativa, no registra servicios globales y lo elimina todo al descargarse. Los conflictos de nombre con otros proveedores de `apply_patch` (`bainianlaoyao/dsh-codex-mode`, `shuind/dsh-codex-harness`, …) se resuelven evitando el renombrado (`apply_patch_1`, `…_2`, …), de modo que DSH nunca falle al arrancar.
|
|
83
|
+
|
|
84
|
+
## Configuración
|
|
85
|
+
|
|
86
|
+
| Opción | Predeterminado | Descripción |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `toolName` | `apply_patch` | Nombre de la herramienta expuesta al modelo. |
|
|
89
|
+
| `conflictPolicy` | `rename` | `rename` / `skip` / `fail` cuando el nombre de la herramienta ya está ocupado. |
|
|
90
|
+
| `renameSuffix` | `_1` | Sufijo usado por la evitación del renombrado. |
|
|
91
|
+
| `allowUnifiedDiff` | `true` | Aceptar diffs git/unificados. |
|
|
92
|
+
| `allowCodexPatch` | `false` | Aceptar la sintaxis `apply_patch` de Codex. También editable en el panel de ajustes de DSH; los cambios surten efecto de inmediato, sin reinicio. |
|
|
93
|
+
| `deleteBackend` | `shell` | `shell` o `none` (Delete/Move devuelven un error estructurado). |
|
|
94
|
+
| `shellDialect` | `auto` | `auto` (pwsh en win32) / `posix` / `pwsh`. |
|
|
95
|
+
| `deleteCommand` / `moveCommand` | built-in | Plantillas de comando personalizadas. Las rutas siguen llegando **solo por variables de entorno** (`DSH_PATCH_TARGET` / `DSH_PATCH_SOURCE`); nunca las interpole en la cadena de comando. |
|
|
96
|
+
| `dryRunByDefault` | `false` | Tratar las llamadas como ensayos en seco (dry run) salvo `dryRun: false`. |
|
|
97
|
+
| `followSymlinks` | `false` | Permitir que las rutas del parche atraviesen symlinks. |
|
|
98
|
+
| `maxFiles` | `50` | Número máximo de secciones de archivo por parche. |
|
|
99
|
+
| `maxPatchBytes` | `524288` | Tamaño máximo del texto del parche en bytes. |
|
|
100
|
+
| `maxDiffBytes` | `16384` | Tamaño máximo del diff por archivo conservado en los metadatos del resultado (los diffs mayores se vacían y se marcan como `truncated`). |
|
|
101
|
+
|
|
102
|
+
## Limitaciones (declaradas)
|
|
103
|
+
|
|
104
|
+
- **Delete/Move se ejecutan a través de `ctx.shell`.** La fortaleza de la sandbox es la que haga cumplir el ejecutor de shell cargado (`bash-sandbox` aisla; `bash-local` no) — la misma postura de riesgo que la herramienta bash nativa. Cada petición lleva una `sandboxPolicy` e informa de los hechos de la sandbox, de modo que «política denegada» sea distinguible de «comando fallido».
|
|
105
|
+
- **Cada escritura y cada Delete/Move llevan la política con alcance de sesión.** `apply_patch` resuelve `ctx.sandboxPolicy.resolve({ session })` en cada llamada — la anulación de modo de la sesión más su cwd como raíz del workspace — exactamente igual que las herramientas nativas `write`/`edit`, y resuelve las rutas del plan contra esa misma raíz. Sin ello, el sistema de archivos que hace cumplir la política retrocede a la raíz de despliegue, lo que hace que las escrituras dentro del workspace fallen como denegaciones `workspace-write` incluso en una sesión `danger-full-access`. Una denegación `workspace-write` se manifiesta como una `PatchError` cuyo mensaje incluye el texto del backend (el marcador estructurado `[sandbox: …]` y los campos de escalada del mismo turno no están implementados; use las herramientas nativas `write`/`edit` si necesita escalar).
|
|
106
|
+
- **Add no crea los directorios padre.** Esto coincide con la herramienta nativa `write` (`ctx.fs` no tiene mkdir); el error nombra el directorio que falta.
|
|
107
|
+
- Sin coincidencia difusa/por desplazamiento: la localización de los hunks es exacta → `trimEnd` → `trim`, deliberadamente (la coincidencia difusa no es segura para operaciones destructivas; está en la hoja de ruta).
|
|
108
|
+
- Los parches binarios se rechazan con un error claro.
|
|
109
|
+
|
|
110
|
+
## Desarrollo
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm install
|
|
114
|
+
npm run typecheck # against 0.2.0-rc.1 peers (devDependencies)
|
|
115
|
+
npm run typecheck:0.2.0 # against real 0.2.0-rc.1 peer packages installed from the registry (dual-baseline proof)
|
|
116
|
+
npm test # vitest, 92 tests
|
|
117
|
+
npm run lint
|
|
118
|
+
npm run build # lib/
|
|
119
|
+
npm run verify:source # static safety assertions (intent dance, no node:fs, …)
|
|
120
|
+
npm run smoke # load-level smoke against a stub host
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
La verificación manual sobre un DSH en vivo (`dsh plugin --profile web add` → reinicio → llamada a la herramienta en una sesión) se deja deliberadamente al operador.
|
|
124
|
+
|
|
125
|
+
## Licencia
|
|
126
|
+
|
|
127
|
+
MIT
|
package/README.fr.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# dsh-patch-edit-plus
|
|
2
|
+
|
|
3
|
+
Français | [English](./README.md) | [简体中文](./README.zh.md) | [日本語](./README.ja.md) | [한국어](./README.ko.md) | [Deutsch](./README.de.md) | [Italiano](./README.it.md) | [Русский](./README.ru.md) | [Español](./README.es.md)
|
|
4
|
+
|
|
5
|
+
Édition de fichiers en mode patch pour [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) : un outil unique `apply_patch` exposé au modèle, qui accepte les **diffs git/unifiés** (par défaut) et la **syntaxe `apply_patch` de Codex** (opt-in), applique chaque changement selon le principe du **tout-ou-rien** et reste totalement hors du chemin de DSH.
|
|
6
|
+
|
|
7
|
+
## Compatibilité des versions de DSH
|
|
8
|
+
|
|
9
|
+
| Version de DSH | Statut | Notes |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `0.2.0-rc.1+` | ✅ pris en charge (cette ligne, v0.3.0+) | Paramètres déclaratifs : `allowCodexPatch` est marqué `.volatile()` — le formulaire de paramètres est généré automatiquement et `loader/volatile-update` réenregistre l'outil sans remontage (remount). Aucun appel d'enregistrement. Delete/Move migrés vers l'API de premier plan `ShellExecutor.execute()` + `result()`. |
|
|
12
|
+
| `0.1.7-rc.1+` | ↗ ligne de maintenance | Assurée par la branche `compat/0.1.7` / le dist-tag `dsh-0.1.7` (v0.2.1 sur cette ligne). L'exécuteur shell de 0.2.0 a renommé `run` → `execute` (changement introduit entre 0.1.2 et 0.1.7) ; une seule base de code ne peut donc pas servir les deux lignes de manière type-safe. |
|
|
13
|
+
| `0.1.2-rc.1` ~ `0.1.5-rc.2` | ↗ ligne de maintenance | Assurée par la branche antérieure à 0.1.7 / le dist-tag `dsh-0.1.5`. La 0.1.7 a supprimé les API impératives de paramétrage dont dépendait le repli bi-API (dual-API fallback). |
|
|
14
|
+
|
|
15
|
+
Sur cette ligne, les paramètres sont déclaratifs : les champs marqués `.volatile()` dans `Config` constituent le formulaire de paramètres ; le plugin s'abonne à `loader/volatile-update` au lieu de recevoir des hooks d'enregistrement.
|
|
16
|
+
|
|
17
|
+
## Pourquoi faire des patchs ? (guide de routage des outils)
|
|
18
|
+
|
|
19
|
+
La description de l'outil oriente explicitement le modèle :
|
|
20
|
+
|
|
21
|
+
- **Petite modification unique dans un fichier déjà lu** → privilégiez l'outil natif `edit` (un patch coûte plus de tokens qu'une édition littérale).
|
|
22
|
+
- **Petite modification au sein d'un fichier VOLUMINEUX** → `apply_patch` (inutile de renvoyer l'intégralité du fichier).
|
|
23
|
+
- **Modifications groupées sur DE NOMBREUX fichiers** → `apply_patch` (un seul appel, vérifié atomiquement).
|
|
24
|
+
- **Nouveau fichier au contenu substantiel / suppression / renommage** → `apply_patch`.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
dsh plugin --profile web add <path-to-dsh-patch-edit-plus>
|
|
30
|
+
dsh web --dump-config # verify the plugin row appears
|
|
31
|
+
# restart DSH
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Utilisation
|
|
35
|
+
|
|
36
|
+
### Diff unifié (par défaut, activé)
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
--- a/src/app.ts
|
|
40
|
+
+++ b/src/app.ts
|
|
41
|
+
@@ -10,4 +10,4 @@ export function main() {
|
|
42
|
+
init()
|
|
43
|
+
- start(oldPort)
|
|
44
|
+
+ start(newPort)
|
|
45
|
+
await shutdown()
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Syntaxe apply_patch de Codex (opt-in)
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
*** Begin Patch
|
|
53
|
+
*** Update File: src/app.ts
|
|
54
|
+
@@
|
|
55
|
+
init()
|
|
56
|
+
- start(oldPort)
|
|
57
|
+
+ start(newPort)
|
|
58
|
+
*** Add File: docs/notes.md
|
|
59
|
+
+# Notes
|
|
60
|
+
*** Delete File: tmp/junk.txt
|
|
61
|
+
*** Move to: src/app.ts (via `*** Move to:` after *** Update File:)
|
|
62
|
+
*** End Patch
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Activez avec `allowCodexPatch: true`. Quand un patch Codex arrive alors que l'option est désactivée, l'outil renvoie une **aide actionnable** (comment l'activer ou comment réessayer en diff unifié) au lieu d'une erreur d'analyse générique — la syntaxe Codex est un prior fort pour les modèles de la famille GPT, et un échec silencieux les enferme dans des boucles de réessai.
|
|
66
|
+
|
|
67
|
+
### Opérations
|
|
68
|
+
|
|
69
|
+
| Opération | Diff unifié | Codex | Chemin d'exécution |
|
|
70
|
+
|---|---|---|---|
|
|
71
|
+
| Ajout | `new file mode` + `/dev/null` | `*** Add File:` | `ctx.fs.writeText` (séquence d'intent officielle) |
|
|
72
|
+
| Mise à jour (multi-hunks) | `@@` hunks | `@@` hunks | `ctx.fs.writeText` |
|
|
73
|
+
| Suppression | `deleted file mode` + `/dev/null` | `*** Delete File:` | `ctx.shell` (conscient de la sandbox, chemin passé par env) |
|
|
74
|
+
| Déplacement / renommage | `rename from/to` | `*** Move to:` | `ctx.shell` |
|
|
75
|
+
|
|
76
|
+
## Garanties
|
|
77
|
+
|
|
78
|
+
- **Tout-ou-rien** : l'ensemble du patch est d'abord vérifié par rapport au contenu actuel des fichiers (localisation du contexte, confinement de l'espace de travail, politique des symlinks, chemins dupliqués) ; tout échec avorte sans écrire le moindre octet.
|
|
79
|
+
- **Respect du verrou lecture-avant-écriture** : chaque écriture reproduit la séquence d'intent de l'outil `write` officiel — cascade `fs/write-intent` → `writeText` gardé → émission `fs/observed`. Un `writeText` brut contournerait silencieusement ce verrou, car les providers DSH n'émettent jamais eux-mêmes les événements `fs/*`.
|
|
80
|
+
- **Diagnostics d'échec précis** : en cas de hunk non correspondant, l'erreur embarque fichier + index du hunk, ligne d'origine de la recherche, aperçu de la ligne attendue (espaces rendus visibles), extrait réel du fichier, ainsi qu'une indication ciblée.
|
|
81
|
+
- **Fidélité des fins de ligne** : les fichiers CRLF sont réécrits en CRLF ; les fins sans nouvelle ligne finale sont préservées, sauf si le patch modifie la fin.
|
|
82
|
+
- **Pure addition** : le plugin enregistre exactement un outil, n'appelle jamais `tools.restrict()`, ne surcharge jamais un outil natif, n'enregistre aucun service global et supprime tout au déchargement. Les conflits de noms avec d'autres fournisseurs d'`apply_patch` (`bainianlaoyao/dsh-codex-mode`, `shuind/dsh-codex-harness`, …) sont résolus par évitement de renommage (`apply_patch_1`, `…_2`, …), afin que DSH ne tombe jamais en échec au démarrage.
|
|
83
|
+
|
|
84
|
+
## Configuration
|
|
85
|
+
|
|
86
|
+
| Option | Par défaut | Description |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `toolName` | `apply_patch` | Nom de l'outil exposé au modèle. |
|
|
89
|
+
| `conflictPolicy` | `rename` | `rename` / `skip` / `fail` quand le nom de l'outil est déjà pris. |
|
|
90
|
+
| `renameSuffix` | `_1` | Suffixe utilisé par l'évitement de renommage. |
|
|
91
|
+
| `allowUnifiedDiff` | `true` | Accepte les diffs git/unifiés. |
|
|
92
|
+
| `allowCodexPatch` | `false` | Accepte la syntaxe `apply_patch` de Codex. Également modifiable dans le panneau de paramètres DSH ; les changements prennent effet immédiatement, sans redémarrage. |
|
|
93
|
+
| `deleteBackend` | `shell` | `shell` ou `none` (Delete/Move renvoient une erreur structurée). |
|
|
94
|
+
| `shellDialect` | `auto` | `auto` (pwsh sous win32) / `posix` / `pwsh`. |
|
|
95
|
+
| `deleteCommand` / `moveCommand` | built-in | Modèles de commandes personnalisés. Les chemins n'arrivent toujours **que via les variables d'environnement** (`DSH_PATCH_TARGET` / `DSH_PATCH_SOURCE`) ; ne les interpolez jamais dans la chaîne de commande. |
|
|
96
|
+
| `dryRunByDefault` | `false` | Traiter les appels comme des essais à vide (dry run) sauf si `dryRun: false`. |
|
|
97
|
+
| `followSymlinks` | `false` | Autoriser les chemins de patch à traverser les symlinks. |
|
|
98
|
+
| `maxFiles` | `50` | Nombre maximal de sections de fichiers par patch. |
|
|
99
|
+
| `maxPatchBytes` | `524288` | Taille maximale du texte de patch, en octets. |
|
|
100
|
+
| `maxDiffBytes` | `16384` | Taille maximale du diff par fichier conservé dans les métadonnées du résultat (les diffs plus grands sont vidés et marqués `truncated`). |
|
|
101
|
+
|
|
102
|
+
## Limitations (divulguées)
|
|
103
|
+
|
|
104
|
+
- **Delete/Move passent par `ctx.shell`.** La force de la sandbox est celle que l'exécuteur shell chargé fait respecter (`bash-sandbox` cloisonne ; `bash-local` non) — la même posture de risque que l'outil bash natif. Chaque requête porte un `sandboxPolicy` et rapporte les faits relatifs à la sandbox, de sorte qu'un « refus de politique » soit distinguable d'un « échec de commande ».
|
|
105
|
+
- **Chaque écriture et chaque Delete/Move porte la politique à la portée de la session.** `apply_patch` résout `ctx.sandboxPolicy.resolve({ session })` à chaque appel — la surcharge de mode de la session plus son cwd comme racine de l'espace de travail — exactement comme les outils natifs `write`/`edit`, et résout les chemins du plan par rapport à cette même racine. Sans cela, le système de fichiers contraignant retombe sur la racine de déploiement, ce qui fait échouer les écritures intra-espace de travail comme refus `workspace-write`, même dans une session `danger-full-access`. Un refus `workspace-write` se manifeste par une `PatchError` dont le message contient le texte du backend (le marqueur structuré `[sandbox: …]` et les champs d'escalade du même tour ne sont pas implémentés ; utilisez les outils natifs `write`/`edit` si vous devez escalader).
|
|
106
|
+
- **Add ne crée pas les répertoires parents.** Cela correspond à l'outil natif `write` (`ctx.fs` n'a pas de mkdir) ; l'erreur nomme le répertoire manquant.
|
|
107
|
+
- Pas de correspondance floue/avec décalage : la localisation des hunks est exacte → `trimEnd` → `trim`, volontairement (la correspondance floue n'est pas sûre pour les opérations destructrices ; elle figure sur la feuille de route).
|
|
108
|
+
- Les patchs binaires sont rejetés avec une erreur claire.
|
|
109
|
+
|
|
110
|
+
## Développement
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm install
|
|
114
|
+
npm run typecheck # against 0.2.0-rc.1 peers (devDependencies)
|
|
115
|
+
npm run typecheck:0.2.0 # against real 0.2.0-rc.1 peer packages installed from the registry (dual-baseline proof)
|
|
116
|
+
npm test # vitest, 92 tests
|
|
117
|
+
npm run lint
|
|
118
|
+
npm run build # lib/
|
|
119
|
+
npm run verify:source # static safety assertions (intent dance, no node:fs, …)
|
|
120
|
+
npm run smoke # load-level smoke against a stub host
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
La vérification manuelle sur un DSH en fonctionnement (`dsh plugin --profile web add` → redémarrage → appel de l'outil dans une session) est volontairement laissée à l'opérateur.
|
|
124
|
+
|
|
125
|
+
## Licence
|
|
126
|
+
|
|
127
|
+
MIT
|
package/README.it.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# dsh-patch-edit-plus
|
|
2
|
+
|
|
3
|
+
Italiano | [English](./README.md) | [简体中文](./README.zh.md) | [日本語](./README.ja.md) | [한국어](./README.ko.md) | [Français](./README.fr.md) | [Deutsch](./README.de.md) | [Русский](./README.ru.md) | [Español](./README.es.md)
|
|
4
|
+
|
|
5
|
+
Modifica di file in stile patch per [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness): un unico strumento `apply_patch` esposto al modello, che accetta i **diff git/unificati** (predefinito) e la **sintassi `apply_patch` di Codex** (opt-in), applica ogni modifica secondo il principio del **tutto-o-nulla** e resta completamente fuori dai piedi di DSH.
|
|
6
|
+
|
|
7
|
+
## Compatibilità delle versioni DSH
|
|
8
|
+
|
|
9
|
+
| Versione DSH | Stato | Note |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `0.2.0-rc.1+` | ✅ supportato (questa linea, v0.3.0+) | Impostazioni dichiarative: `allowCodexPatch` è contrassegnato con `.volatile()` — il modulo delle impostazioni viene generato automaticamente e `loader/volatile-update` registra nuovamente lo strumento senza remount. Nessuna chiamata di registrazione. Delete/Move sono migrati all'API in primo piano `ShellExecutor.execute()` + `result()`. |
|
|
12
|
+
| `0.1.7-rc.1+` | ↗ linea di manutenzione | Servita dal ramo `compat/0.1.7` / dal dist-tag `dsh-0.1.7` (v0.2.1 lì). L'esecutore shell di 0.2.0 ha rinominato `run` → `execute` (modifica introdotta tra 0.1.2 e 0.1.7), quindi una singola codebase non può servire entrambe le linee in modo type-safe. |
|
|
13
|
+
| `0.1.2-rc.1` ~ `0.1.5-rc.2` | ↗ linea di manutenzione | Servita dal ramo precedente a 0.1.7 / dal dist-tag `dsh-0.1.5`. La 0.1.7 ha rimosso le API imperative delle impostazioni da cui dipendeva il fallback dual-API. |
|
|
14
|
+
|
|
15
|
+
Su questa linea le impostazioni sono dichiarative: i campi contrassegnati con `.volatile()` in `Config` diventano il modulo delle impostazioni; il plugin si iscrive a `loader/volatile-update` invece di ricevere hook di registrazione.
|
|
16
|
+
|
|
17
|
+
## Perché proprio le patch? (guida al routing degli strumenti)
|
|
18
|
+
|
|
19
|
+
La descrizione dello strumento indirizza esplicitamente il modello:
|
|
20
|
+
|
|
21
|
+
- **Singola piccola modifica in un file già letto** → preferisci lo strumento nativo `edit` (una patch costa più token di una modifica letterale).
|
|
22
|
+
- **Piccola modifica all'interno di un file GRANDE** → `apply_patch` (non serve rinviare l'intero file).
|
|
23
|
+
- **Modifiche raggruppate su MOLTI file** → `apply_patch` (una sola chiamata, verificata atomicamente).
|
|
24
|
+
- **Nuovo file con contenuto sostanzioso / cancellazione / rinomina** → `apply_patch`.
|
|
25
|
+
|
|
26
|
+
## Installazione
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
dsh plugin --profile web add <path-to-dsh-patch-edit-plus>
|
|
30
|
+
dsh web --dump-config # verify the plugin row appears
|
|
31
|
+
# restart DSH
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Utilizzo
|
|
35
|
+
|
|
36
|
+
### Diff unificato (predefinito, attivo)
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
--- a/src/app.ts
|
|
40
|
+
+++ b/src/app.ts
|
|
41
|
+
@@ -10,4 +10,4 @@ export function main() {
|
|
42
|
+
init()
|
|
43
|
+
- start(oldPort)
|
|
44
|
+
+ start(newPort)
|
|
45
|
+
await shutdown()
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Sintassi apply_patch di Codex (opt-in)
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
*** Begin Patch
|
|
53
|
+
*** Update File: src/app.ts
|
|
54
|
+
@@
|
|
55
|
+
init()
|
|
56
|
+
- start(oldPort)
|
|
57
|
+
+ start(newPort)
|
|
58
|
+
*** Add File: docs/notes.md
|
|
59
|
+
+# Notes
|
|
60
|
+
*** Delete File: tmp/junk.txt
|
|
61
|
+
*** Move to: src/app.ts (via `*** Move to:` after *** Update File:)
|
|
62
|
+
*** End Patch
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Si abilita con `allowCodexPatch: true`. Quando arriva una patch Codex mentre l'opzione è disattivata, lo strumento restituisce un **suggerimento azionabile** (come abilitarla o come riprovare in diff unificato) invece di un generico errore di parsing — la sintassi Codex è un forte prior per i modelli della famiglia GPT, e un fallimento silenzioso li intrappola in cicli di tentativi.
|
|
66
|
+
|
|
67
|
+
### Operazioni
|
|
68
|
+
|
|
69
|
+
| Operazione | Diff unificato | Codex | Percorso di esecuzione |
|
|
70
|
+
|---|---|---|---|
|
|
71
|
+
| Aggiunta | `new file mode` + `/dev/null` | `*** Add File:` | `ctx.fs.writeText` (sequenza di intent ufficiale) |
|
|
72
|
+
| Aggiornamento (multi-hunk) | `@@` hunks | `@@` hunks | `ctx.fs.writeText` |
|
|
73
|
+
| Cancellazione | `deleted file mode` + `/dev/null` | `*** Delete File:` | `ctx.shell` (consapevole della sandbox, percorso passato via env) |
|
|
74
|
+
| Spostamento / rinomina | `rename from/to` | `*** Move to:` | `ctx.shell` |
|
|
75
|
+
|
|
76
|
+
## Garanzie
|
|
77
|
+
|
|
78
|
+
- **Tutto-o-nulla**: l'intera patch viene prima verificata rispetto al contenuto attuale dei file (localizzazione del contesto, contenimento del workspace, politica dei symlink, percorsi duplicati); qualsiasi fallimento interrompe l'operazione senza scrivere un solo byte.
|
|
79
|
+
- **Rispetto del cancello leggi-prima-di-scrivere**: ogni scrittura replica la sequenza di intent dello strumento `write` ufficiale — cascata `fs/write-intent` → `writeText` protetto → emissione `fs/observed`. Un `writeText` nudo bypasserebbe silenziosamente il cancello, perché i provider DSH non dispatchano mai da soli gli eventi `fs/*`.
|
|
80
|
+
- **Diagnostica dei guasti precisa**: in caso di hunk non corrispondente, l'errore riporta file + indice dell'hunk, riga di origine della ricerca, anteprima della riga attesa (con spazi resi visibili), l'estratto reale del file e un suggerimento mirato.
|
|
81
|
+
- **Fedeltà dei fine riga**: i file CRLF vengono riscritti come CRLF; le code senza newline finale sono preservate, a meno che la patch non modifichi la coda.
|
|
82
|
+
- **Pura aggiunta**: il plugin registra esattamente uno strumento, non chiama mai `tools.restrict()`, non sovrascrive mai uno strumento nativo, non registra servizi globali e rimuove tutto allo scaricamento. I conflitti di nome con altri provider di `apply_patch` (`bainianlaoyao/dsh-codex-mode`, `shuind/dsh-codex-harness`, …) sono risolti evitando la rinomina (`apply_patch_1`, `…_2`, …), così che DSH non fallisca mai l'avvio.
|
|
83
|
+
|
|
84
|
+
## Configurazione
|
|
85
|
+
|
|
86
|
+
| Opzione | Predefinito | Descrizione |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `toolName` | `apply_patch` | Nome dello strumento esposto al modello. |
|
|
89
|
+
| `conflictPolicy` | `rename` | `rename` / `skip` / `fail` quando il nome dello strumento è già occupato. |
|
|
90
|
+
| `renameSuffix` | `_1` | Suffisso usato dall'evitamento della rinomina. |
|
|
91
|
+
| `allowUnifiedDiff` | `true` | Accetta i diff git/unificati. |
|
|
92
|
+
| `allowCodexPatch` | `false` | Accetta la sintassi `apply_patch` di Codex. Modificabile anche nel pannello delle impostazioni DSH; le modifiche hanno effetto immediato, senza riavvio. |
|
|
93
|
+
| `deleteBackend` | `shell` | `shell` oppure `none` (Delete/Move restituiscono un errore strutturato). |
|
|
94
|
+
| `shellDialect` | `auto` | `auto` (pwsh su win32) / `posix` / `pwsh`. |
|
|
95
|
+
| `deleteCommand` / `moveCommand` | built-in | Modelli di comando personalizzati. I percorsi arrivano comunque **solo tramite le variabili d'ambiente** (`DSH_PATCH_TARGET` / `DSH_PATCH_SOURCE`); non interpolarli mai nella stringa di comando. |
|
|
96
|
+
| `dryRunByDefault` | `false` | Tratta le chiamate come prove a vuoto (dry run) salvo `dryRun: false`. |
|
|
97
|
+
| `followSymlinks` | `false` | Consente ai percorsi delle patch di attraversare i symlink. |
|
|
98
|
+
| `maxFiles` | `50` | Numero massimo di sezioni file per patch. |
|
|
99
|
+
| `maxPatchBytes` | `524288` | Dimensione massima del testo della patch in byte. |
|
|
100
|
+
| `maxDiffBytes` | `16384` | Dimensione massima del diff per file conservato nei metadati del risultato (i diff più grandi vengono svuotati e marcati `truncated`). |
|
|
101
|
+
|
|
102
|
+
## Limitazioni (dichiarate)
|
|
103
|
+
|
|
104
|
+
- **Delete/Move passano attraverso `ctx.shell`.** La robustezza della sandbox è quella che l'esecutore shell caricato fa rispettare (`bash-sandbox` isola; `bash-local` no) — la stessa postura di rischio dello strumento bash nativo. Ogni richiesta porta una `sandboxPolicy` e riporta i fatti della sandbox, così che un «rifiuto della politica» sia distinguibile da un «fallimento del comando».
|
|
105
|
+
- **Ogni scrittura e ogni Delete/Move porta la politica nell'ambito della sessione.** `apply_patch` risolve `ctx.sandboxPolicy.resolve({ session })` a ogni chiamata — l'override di modalità della sessione più il suo cwd come radice del workspace — esattamente come gli strumenti nativi `write`/`edit`, e risolve i percorsi del piano rispetto alla stessa radice. Senza di essa, il filesystem di applicazione ricade sulla radice di deployment, il che fa fallire le scritture nel workspace come rifiuti `workspace-write`, persino in una sessione `danger-full-access`. Un rifiuto `workspace-write` emerge come `PatchError` il cui messaggio contiene il testo del backend (il marcatore strutturato `[sandbox: …]` e i campi di escalation nello stesso turno non sono implementati; usate gli strumenti nativi `write`/`edit` quando dovete escalare).
|
|
106
|
+
- **Add non crea le directory madri.** Questo rispecchia lo strumento nativo `write` (`ctx.fs` non ha mkdir); l'errore nomina la directory mancante.
|
|
107
|
+
- Nessuna corrispondenza fuzzy/per offset: la localizzazione degli hunk è esatta → `trimEnd` → `trim`, deliberatamente (il matching fuzzy non è sicuro per le operazioni distruttive; è nella roadmap).
|
|
108
|
+
- Le patch binarie vengono rifiutate con un errore chiaro.
|
|
109
|
+
|
|
110
|
+
## Sviluppo
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm install
|
|
114
|
+
npm run typecheck # against 0.2.0-rc.1 peers (devDependencies)
|
|
115
|
+
npm run typecheck:0.2.0 # against real 0.2.0-rc.1 peer packages installed from the registry (dual-baseline proof)
|
|
116
|
+
npm test # vitest, 92 tests
|
|
117
|
+
npm run lint
|
|
118
|
+
npm run build # lib/
|
|
119
|
+
npm run verify:source # static safety assertions (intent dance, no node:fs, …)
|
|
120
|
+
npm run smoke # load-level smoke against a stub host
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
La verifica manuale su un DSH in esecuzione (`dsh plugin --profile web add` → riavvio → chiamata dello strumento in una sessione) è lasciata deliberatamente all'operatore.
|
|
124
|
+
|
|
125
|
+
## Licenza
|
|
126
|
+
|
|
127
|
+
MIT
|
package/README.ja.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# dsh-patch-edit-plus
|
|
2
2
|
|
|
3
|
+
[English](./README.md) | [简体中文](./README.zh.md) | 日本語 | [한국어](./README.ko.md) | [Français](./README.fr.md) | [Deutsch](./README.de.md) | [Italiano](./README.it.md) | [Русский](./README.ru.md) | [Español](./README.es.md)
|
|
4
|
+
|
|
3
5
|
[DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) 向けのパッチ形式ファイル編集。モデルに公開される単一の `apply_patch` ツールが **git/unified diff**(既定)と **Codex `apply_patch` 構文**(オプトイン)を受け付け、すべての変更を **オール・オア・ナッシング**で適用し、DSH の動作には一切干渉しません。
|
|
4
6
|
|
|
5
7
|
## DSH バージョン互換性
|
package/README.ko.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# dsh-patch-edit-plus
|
|
2
2
|
|
|
3
|
+
[English](./README.md) | [简体中文](./README.zh.md) | [日本語](./README.ja.md) | 한국어 | [Français](./README.fr.md) | [Deutsch](./README.de.md) | [Italiano](./README.it.md) | [Русский](./README.ru.md) | [Español](./README.es.md)
|
|
4
|
+
|
|
3
5
|
[DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness)를 위한 패치 스타일 파일 편집 도구입니다. 모델에 노출되는 단일 `apply_patch` 도구가 **git/unified diff**(기본)와 **Codex `apply_patch` 문법**(옵트인)을 받아들이고, 모든 변경을 **전부 아니면 전무(all-or-nothing)** 방식으로 적용하며, DSH의 동작에는 전혀 간섭하지 않습니다.
|
|
4
6
|
|
|
5
7
|
## DSH 버전 호환성
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# dsh-patch-edit-plus
|
|
2
2
|
|
|
3
|
+
English | [简体中文](./README.zh.md) | [日本語](./README.ja.md) | [한국어](./README.ko.md) | [Français](./README.fr.md) | [Deutsch](./README.de.md) | [Italiano](./README.it.md) | [Русский](./README.ru.md) | [Español](./README.es.md)
|
|
4
|
+
|
|
3
5
|
Patch-style file editing for [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness): one model-facing `apply_patch` tool that accepts **git/unified diff** (default) and **Codex `apply_patch` syntax** (opt-in), applies every change **all-or-nothing**, and stays completely out of DSH's way.
|
|
4
6
|
|
|
5
7
|
## DSH version compatibility
|
package/README.ru.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# dsh-patch-edit-plus
|
|
2
|
+
|
|
3
|
+
Русский | [English](./README.md) | [简体中文](./README.zh.md) | [日本語](./README.ja.md) | [한국어](./README.ko.md) | [Français](./README.fr.md) | [Deutsch](./README.de.md) | [Italiano](./README.it.md) | [Español](./README.es.md)
|
|
4
|
+
|
|
5
|
+
Патчевое редактирование файлов для [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness): единственный доступный модели инструмент `apply_patch`, который принимает **git/unified diff** (по умолчанию) и **синтаксис `apply_patch` от Codex** (по явному включению), применяет каждое изменение по принципу **всё-или-ничего** и абсолютно не мешает работе DSH.
|
|
6
|
+
|
|
7
|
+
## Совместимость с версиями DSH
|
|
8
|
+
|
|
9
|
+
| Версия DSH | Статус | Примечания |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `0.2.0-rc.1+` | ✅ поддерживается (эта линия, v0.3.0+) | Декларативные настройки: `allowCodexPatch` помечен `.volatile()` — форма настроек формируется автоматически, а `loader/volatile-update` перерегистрирует инструмент без перемонтирования. Вызов регистрации не нужен. Delete/Move переведены на foreground-API `ShellExecutor.execute()` + `result()`. |
|
|
12
|
+
| `0.1.7-rc.1+` | ↗ линия сопровождения | Обслуживается веткой `compat/0.1.7` / dist-tag `dsh-0.1.7` (там v0.2.1). Shell-исполнитель 0.2.0 переименовал `run` → `execute` (изменение появилось между 0.1.2 и 0.1.7), поэтому одна кодовая база не может типобезопасно обслуживать обе линии. |
|
|
13
|
+
| `0.1.2-rc.1` ~ `0.1.5-rc.2` | ↗ линия сопровождения | Обслуживается веткой до 0.1.7 / dist-tag `dsh-0.1.5`. В 0.1.7 удалены императивные API настроек, на которых держался двух-API-фолбэк. |
|
|
14
|
+
|
|
15
|
+
На этой линии настройки декларативны: поля, помеченные `.volatile()` в `Config`, становятся формой настроек; плагин подписывается на `loader/volatile-update` вместо получения регистрационных хуков.
|
|
16
|
+
|
|
17
|
+
## Зачем вообще патчи? (руководство по маршрутизации инструментов)
|
|
18
|
+
|
|
19
|
+
Описание инструмента явно направляет модель:
|
|
20
|
+
|
|
21
|
+
- **Одиночное небольшое изменение в уже прочитанном файле** → предпочитайте нативный инструмент `edit` (патч стоит больше токенов, чем буквальное редактирование).
|
|
22
|
+
- **Небольшое изменение внутри БОЛЬШОГО файла** → `apply_patch` (не нужно повторять весь файл).
|
|
23
|
+
- **Пакетные изменения во МНОГИХ файлах** → `apply_patch` (один вызов, атомарная проверка).
|
|
24
|
+
- **Новый файл с существенным содержимым / удаление / переименование** → `apply_patch`.
|
|
25
|
+
|
|
26
|
+
## Установка
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
dsh plugin --profile web add <path-to-dsh-patch-edit-plus>
|
|
30
|
+
dsh web --dump-config # verify the plugin row appears
|
|
31
|
+
# restart DSH
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Использование
|
|
35
|
+
|
|
36
|
+
### Unified diff (по умолчанию, включён)
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
--- a/src/app.ts
|
|
40
|
+
+++ b/src/app.ts
|
|
41
|
+
@@ -10,4 +10,4 @@ export function main() {
|
|
42
|
+
init()
|
|
43
|
+
- start(oldPort)
|
|
44
|
+
+ start(newPort)
|
|
45
|
+
await shutdown()
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Синтаксис apply_patch от Codex (по явному включению)
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
*** Begin Patch
|
|
53
|
+
*** Update File: src/app.ts
|
|
54
|
+
@@
|
|
55
|
+
init()
|
|
56
|
+
- start(oldPort)
|
|
57
|
+
+ start(newPort)
|
|
58
|
+
*** Add File: docs/notes.md
|
|
59
|
+
+# Notes
|
|
60
|
+
*** Delete File: tmp/junk.txt
|
|
61
|
+
*** Move to: src/app.ts (via `*** Move to:` after *** Update File:)
|
|
62
|
+
*** End Patch
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Включается через `allowCodexPatch: true`. Если патч Codex приходит при выключенной опции, инструмент возвращает **действенную подсказку** (как её включить или как повторить попытку в unified diff) вместо общей ошибки разбора — синтаксис Codex является сильным априорным признаком для моделей семейства GPT, и молчаливый сбой затягивает их в циклы повторов.
|
|
66
|
+
|
|
67
|
+
### Операции
|
|
68
|
+
|
|
69
|
+
| Операция | Unified diff | Codex | Путь выполнения |
|
|
70
|
+
|---|---|---|---|
|
|
71
|
+
| Добавление | `new file mode` + `/dev/null` | `*** Add File:` | `ctx.fs.writeText` (официальная intent-последовательность) |
|
|
72
|
+
| Обновление (multi-hunk) | `@@` hunks | `@@` hunks | `ctx.fs.writeText` |
|
|
73
|
+
| Удаление | `deleted file mode` + `/dev/null` | `*** Delete File:` | `ctx.shell` (с учётом sandbox, путь передаётся через env) |
|
|
74
|
+
| Перемещение / переименование | `rename from/to` | `*** Move to:` | `ctx.shell` |
|
|
75
|
+
|
|
76
|
+
## Гарантии
|
|
77
|
+
|
|
78
|
+
- **Всё-или-ничего**: весь патч сначала проверяется на соответствие текущему содержимому файлов (локализация контекста, удержание в рабочей области, политика symlink, дубликаты путей); любой сбой прерывает операцию без записи хотя бы байта.
|
|
79
|
+
- **Соблюдение запрета на запись без чтения**: каждая запись воспроизводит intent-последовательность официального инструмента `write` — водопад `fs/write-intent` → защищённый `writeText` → эмиссия `fs/observed`. Голый `writeText` молча обходил бы этот барьер, поскольку провайдеры DSH никогда сами не диспетчеризуют события `fs/*`.
|
|
80
|
+
- **Точная диагностика сбоев**: при несовпадении хунка ошибка содержит файл + индекс хунка, исходную строку поиска, превью ожидаемой строки (с показанными пробелами), фактический фрагмент файла и адресную подсказку.
|
|
81
|
+
- **Точность переводов строк**: файлы CRLF записываются обратно как CRLF; окончания без завершающего перевода строки сохраняются, если только патч не меняет окончание.
|
|
82
|
+
- **Чистое дополнение**: плагин регистрирует ровно один инструмент, никогда не вызывает `tools.restrict()`, никогда не переопределяет нативный инструмент, не регистрирует глобальных служб и при выгрузке удаляет всё. Конфликты имён с другими провайдерами `apply_patch` (`bainianlaoyao/dsh-codex-mode`, `shuind/dsh-codex-harness`, …) разрешаются избеганием переименования (`apply_patch_1`, `…_2`, …), так что DSH никогда не падает при старте.
|
|
83
|
+
|
|
84
|
+
## Конфигурация
|
|
85
|
+
|
|
86
|
+
| Опция | По умолчанию | Описание |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `toolName` | `apply_patch` | Имя инструмента, доступного модели. |
|
|
89
|
+
| `conflictPolicy` | `rename` | `rename` / `skip` / `fail`, если имя инструмента уже занято. |
|
|
90
|
+
| `renameSuffix` | `_1` | Суффикс, используемый при избегании переименования. |
|
|
91
|
+
| `allowUnifiedDiff` | `true` | Принимать git/unified diff. |
|
|
92
|
+
| `allowCodexPatch` | `false` | Принимать синтаксис `apply_patch` от Codex. Также редактируется в панели настроек DSH; изменения вступают в силу немедленно, без перезапуска. |
|
|
93
|
+
| `deleteBackend` | `shell` | `shell` или `none` (Delete/Move возвращают структурированную ошибку). |
|
|
94
|
+
| `shellDialect` | `auto` | `auto` (pwsh на win32) / `posix` / `pwsh`. |
|
|
95
|
+
| `deleteCommand` / `moveCommand` | built-in | Пользовательские шаблоны команд. Пути по-прежнему передаются **только через переменные окружения** (`DSH_PATCH_TARGET` / `DSH_PATCH_SOURCE`); никогда не подставляйте их в строку команды интерполяцией. |
|
|
96
|
+
| `dryRunByDefault` | `false` | Считать вызовы пробными запусками (dry run), если не задано `dryRun: false`. |
|
|
97
|
+
| `followSymlinks` | `false` | Разрешить путям патча переходить по symlink. |
|
|
98
|
+
| `maxFiles` | `50` | Максимум файловых секций на один патч. |
|
|
99
|
+
| `maxPatchBytes` | `524288` | Максимальный размер текста патча в байтах. |
|
|
100
|
+
| `maxDiffBytes` | `16384` | Максимальный размер диффа на файл, сохраняемого в метаданных результата (большие диффы опустошаются и помечаются `truncated`). |
|
|
101
|
+
|
|
102
|
+
## Ограничения (раскрытые)
|
|
103
|
+
|
|
104
|
+
- **Delete/Move выполняются через `ctx.shell`.** Сила sandbox такова, каков обеспечивающий её загруженный shell-исполнитель (`bash-sandbox` изолирует; `bash-local` — нет) — та же позиция риска, что и у нативного инструмента bash. Каждый запрос несёт `sandboxPolicy` и сообщает факты о sandbox, чтобы «отказ политики» можно было отличить от «сбоя команды».
|
|
105
|
+
- **Каждая запись и каждый Delete/Move несут политику в области действия сессии.** `apply_patch` разрешает `ctx.sandboxPolicy.resolve({ session })` при каждом вызове — переопределение режима сессии плюс её cwd как корень рабочей области — в точности как нативные инструменты `write`/`edit`, и разрешает пути плана относительно того же корня. Без этого файловая система принуждения откатывается к корню развёртывания, из-за чего записи внутри рабочей области завершаются отказами `workspace-write` даже в сессии `danger-full-access`. Отказ `workspace-write` проявляется как `PatchError`, сообщение которой несёт текст бэкенда (структурированный маркер `[sandbox: …]` и поля эскалации в том же ходе не реализованы; если нужна эскалация, пользуйтесь нативными `write`/`edit`).
|
|
106
|
+
- **Add не создаёт родительские каталоги.** Это соответствует нативному инструменту `write` (у `ctx.fs` нет mkdir); в ошибке называется недостающий каталог.
|
|
107
|
+
- Нет нечёткого/со смещением сопоставления: локализация хунка точная → `trimEnd` → `trim`, причём намеренно (нечёткое сопоставление небезопасно для разрушающих операций; оно есть в дорожной карте).
|
|
108
|
+
- Двоичные патчи отклоняются с понятной ошибкой.
|
|
109
|
+
|
|
110
|
+
## Разработка
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm install
|
|
114
|
+
npm run typecheck # against 0.2.0-rc.1 peers (devDependencies)
|
|
115
|
+
npm run typecheck:0.2.0 # against real 0.2.0-rc.1 peer packages installed from the registry (dual-baseline proof)
|
|
116
|
+
npm test # vitest, 92 tests
|
|
117
|
+
npm run lint
|
|
118
|
+
npm run build # lib/
|
|
119
|
+
npm run verify:source # static safety assertions (intent dance, no node:fs, …)
|
|
120
|
+
npm run smoke # load-level smoke against a stub host
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Ручная проверка на живом DSH (`dsh plugin --profile web add` → перезапуск → вызов инструмента в сессии) намеренно оставлена оператору.
|
|
124
|
+
|
|
125
|
+
## Лицензия
|
|
126
|
+
|
|
127
|
+
MIT
|
package/README.zh.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# dsh-patch-edit-plus
|
|
2
2
|
|
|
3
|
+
[English](./README.md) | 简体中文 | [日本語](./README.ja.md) | [한국어](./README.ko.md) | [Français](./README.fr.md) | [Deutsch](./README.de.md) | [Italiano](./README.it.md) | [Русский](./README.ru.md) | [Español](./README.es.md)
|
|
4
|
+
|
|
3
5
|
面向 [DeepSeek Harness(DSH)](https://github.com/deepseek-ai/deepseek-harness) 的补丁风格文件编辑插件:只提供 **1 个**模型可见工具 `apply_patch`,接受 **git/unified diff**(默认开启)与 **Codex `apply_patch` 语法**(可选开启),全量验证后**原子应用**,对 DSH 既有功能零负面影响。
|
|
4
6
|
|
|
5
7
|
## DSH 版本适配矩阵
|
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.3.
|
|
4
|
+
"version": "0.3.1",
|
|
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。"
|
package/lib/parse/unified.js
CHANGED
|
@@ -55,8 +55,12 @@ export function parseUnifiedDiff(patch) {
|
|
|
55
55
|
continue;
|
|
56
56
|
}
|
|
57
57
|
if (line.startsWith('--- ')) {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
// A bare multi-file unified diff repeats `--- `/`+++ ` per file with no
|
|
59
|
+
// `diff --git` separator. Once the current section has been claimed by
|
|
60
|
+
// a path or a hunk, this header therefore opens the NEXT file section;
|
|
61
|
+
// reusing the section would drag the previous file's hunks into this
|
|
62
|
+
// one and fail them against the wrong content.
|
|
63
|
+
if (current === null || current.oldPath !== null || current.newPath !== null || current.hunks.length > 0) {
|
|
60
64
|
current = { oldPath: null, newPath: null, newFile: false, deletedFile: false, renameFrom: null, renameTo: null, hunks: [], startLine: lineNo };
|
|
61
65
|
sections.push(current);
|
|
62
66
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-patch-edit-plus",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
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": {
|
|
@@ -102,6 +102,6 @@
|
|
|
102
102
|
"@deepseek-ai/schemastery": "^3.18.4"
|
|
103
103
|
},
|
|
104
104
|
"publishConfig": {
|
|
105
|
-
"tag": "dsh-0.
|
|
105
|
+
"tag": "dsh-0.2.0"
|
|
106
106
|
}
|
|
107
107
|
}
|