zames_pro 2.82.132 → 2.82.134

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.82.134] - 2026-10-24
11
+
12
+ ### Fixed
13
+
14
+ - **input:** the legacy editor forgets a deleted paste body too
15
+
16
+ ## [2.82.133] - 2026-10-24
17
+
18
+ ### Fixed
19
+
20
+ - **tui,glm:** a deleted paste body is forgotten; a message id is not a chat id
21
+
10
22
  ## [2.82.132] - 2026-10-24
11
23
 
12
24
  ### Fixed
@@ -374,6 +374,18 @@ export function extractChatId(body) {
374
374
  const m1 = b.match(/"chat_id"\s*:\s*"([0-9a-f-]{36})"/i);
375
375
  if (m1)
376
376
  return m1[1];
377
+ // The response envelope nests the chat UNDER a key (`chat:{id}`, `data:{id}`)
378
+ // while its siblings carry their OWN ids (a request id, a message id). A
379
+ // plain `"id"` match anywhere in the body could pick one of those: the
380
+ // saved session then pointed at a chat that does not exist.
381
+ const nested = b.match(/"(?:chat|data|conversation|session)"\s*:\s*\{[^{}]*?"id"\s*:\s*"([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"/i);
382
+ if (nested)
383
+ return nested[1];
384
+ // A bare `id` is accepted only when the body carries NO other id-like key
385
+ // that could own it first.
386
+ const otherId = /"(?:request_id|message_id|msg_id|run_id|trace_id|response_id|event_id)"\s*:/i.test(b);
387
+ if (otherId)
388
+ return null;
377
389
  const m2 = b.match(/"id"\s*:\s*"([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"/i);
378
390
  return m2 ? m2[1] : null;
379
391
  }
package/dist/input.js CHANGED
@@ -1309,6 +1309,7 @@ export class LineEditor {
1309
1309
  chars.splice(this.cursor - 1, 1);
1310
1310
  this.buf = chars.join('');
1311
1311
  this.cursor--;
1312
+ this._dropLostPastes();
1312
1313
  }
1313
1314
  _delete() {
1314
1315
  const chars = Array.from(this.buf);
@@ -1316,6 +1317,18 @@ export class LineEditor {
1316
1317
  return;
1317
1318
  chars.splice(this.cursor, 1);
1318
1319
  this.buf = chars.join('');
1320
+ this._dropLostPastes();
1321
+ }
1322
+ /** Forget paste bodies whose `[Pasted lines#N]` marker is no longer in the
1323
+ * buffer: a hand-deleted marker used to keep its body, and the NEXT paste of
1324
+ * the same line count was then expanded to the DELETED text (the same rule
1325
+ * as the TUI editor's dropLostPastes). */
1326
+ _dropLostPastes() {
1327
+ if (!this.pastes.length)
1328
+ return;
1329
+ const kept = this.pastes.filter((p) => this.buf.includes(p.marker));
1330
+ if (kept.length !== this.pastes.length)
1331
+ this.pastes = kept;
1319
1332
  }
1320
1333
  _left() {
1321
1334
  if (this.cursor > 0)
package/dist/tui/edit.js CHANGED
@@ -66,14 +66,29 @@ export function backspace(s) {
66
66
  return s;
67
67
  const chars = charsOf(s);
68
68
  chars.splice(s.cursor - 1, 1);
69
- return { ...s, buf: chars.join(''), cursor: s.cursor - 1 };
69
+ const next = { ...s, buf: chars.join(''), cursor: s.cursor - 1 };
70
+ return dropLostPastes(next);
70
71
  }
71
72
  export function del(s) {
72
73
  const chars = charsOf(s);
73
74
  if (s.cursor >= chars.length)
74
75
  return s;
75
76
  chars.splice(s.cursor, 1);
76
- return { ...s, buf: chars.join('') };
77
+ return dropLostPastes({ ...s, buf: chars.join('') });
78
+ }
79
+ /**
80
+ * Forget the paste bodies whose marker is no longer in the buffer. Deleting a
81
+ * `[Pasted lines#N]` marker by hand used to leave its body in the list: the
82
+ * next paste of the SAME line count then matched the old body, and
83
+ * `expandPastes` sent the DELETED text to the model instead of the new one.
84
+ * A marker that is merely split by an edit (its text no longer present) is
85
+ * treated the same way — the body can never be expanded again.
86
+ */
87
+ function dropLostPastes(s) {
88
+ if (!s.pastes.length)
89
+ return s;
90
+ const kept = s.pastes.filter((p) => s.buf.includes(p.marker));
91
+ return kept.length === s.pastes.length ? s : { ...s, pastes: kept };
77
92
  }
78
93
  /** Delete the word on the LEFT of the cursor (Ctrl+W / Alt+Backspace). */
79
94
  export function deleteWordLeft(s) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zames_pro",
3
- "version": "2.82.132",
3
+ "version": "2.82.134",
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": {