zames_pro 2.81.19 → 2.81.21

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
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.81.21] - 2026-10-22
11
+
12
+ ### Fixed
13
+
14
+ - **extra-tools:** ApplyPatch Add File refuses to overwrite an existing file
15
+
16
+ ## [2.81.20] - 2026-10-22
17
+
18
+ ### Fixed
19
+
20
+ - **extra-tools:** MultiEdit without new_string no longer deletes text
21
+
10
22
  ## [2.81.19] - 2026-10-21
11
23
 
12
24
  ### Fixed
@@ -299,7 +299,14 @@ export function createExtraTools(workdir, { undo, todos } = {}) {
299
299
  for (let i = 0; i < list.length; i++) {
300
300
  const e = list[i];
301
301
  const oldStr = String(e.old_string ?? '');
302
- const newStr = String(e.new_string ?? '');
302
+ // A missing new_string must not mean "delete": String(undefined) is
303
+ // '' and the edit silently ERASED the matched text (the same data
304
+ // loss fixed in the single-file Edit). An EXPLICIT '' still deletes.
305
+ if (e.new_string === undefined || e.new_string === null) {
306
+ throw new Error(`edits[${i}]: new_string is missing. Add the replacement text ` +
307
+ '(use an empty string to delete) and retry.');
308
+ }
309
+ const newStr = String(e.new_string);
303
310
  if (oldStr === '') {
304
311
  throw new Error(`edits[${i}]: old_string is empty.`);
305
312
  }
@@ -369,6 +376,18 @@ export function createExtraTools(workdir, { undo, todos } = {}) {
369
376
  continue;
370
377
  }
371
378
  if (op.op === 'add') {
379
+ // `Add File:` means CREATE. Applied to an existing file it used to
380
+ // silently OVERWRITE the whole file (the writer just writes the
381
+ // body), so a stale or wrong path destroyed real content with no
382
+ // warning. Refuse; Update/Delete remain for existing files.
383
+ if (await fs
384
+ .stat(file)
385
+ .then(() => true)
386
+ .catch(() => false)) {
387
+ throw new Error('Add File ' +
388
+ op.file +
389
+ ': the file already exists. Use Update File to change it.');
390
+ }
372
391
  const body = op.lines
373
392
  .filter((l) => l.startsWith('+'))
374
393
  .map((l) => l.slice(1))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zames_pro",
3
- "version": "2.81.19",
3
+ "version": "2.81.21",
4
4
  "description": "Terminal coding agent that drives a real browser to chat with DeepSeek, Qwen and other web LLMs — no API key required. Reads and edits files, runs commands, commits to git, like Claude Code / Codex CLI.",
5
5
  "type": "module",
6
6
  "bin": {