zames_pro 2.82.132 → 2.82.133

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,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.82.133] - 2026-10-24
11
+
12
+ ### Fixed
13
+
14
+ - **tui,glm:** a deleted paste body is forgotten; a message id is not a chat id
15
+
10
16
  ## [2.82.132] - 2026-10-24
11
17
 
12
18
  ### 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/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.133",
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": {