zames_pro 2.90.8 → 2.90.10

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.90.10] - 2026-10-29
11
+
12
+ ### Fixed
13
+
14
+ - **commands:** never cut a restored message in the middle of a surrogate pair
15
+
16
+ ## [2.90.9] - 2026-10-28
17
+
18
+ ### Fixed
19
+
20
+ - **ui:** strip OSC escapes when measuring the banner and config-menu width
21
+
10
22
  ## [2.90.8] - 2026-10-28
11
23
 
12
24
  ### Fixed
package/dist/banner.js CHANGED
@@ -6,7 +6,18 @@ import { theme } from './theme.js';
6
6
  import { visLen } from './input/layout.js';
7
7
  /** Visible width of a string (ANSI stripped, wide chars counted as 2). */
8
8
  function width(s) {
9
- return visLen(s.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, ''));
9
+ return visLen(stripAnsi(s));
10
+ }
11
+ /**
12
+ * Remove CSI AND OSC escapes. An OSC body (an OSC-8 hyperlink, a terminal
13
+ * title) is NOT visible text: a CSI-only regex counted every URL character as
14
+ * a column, so the banner box was drawn too wide and the config menu's erase
15
+ * height disagreed with the real screen (duplicated rows).
16
+ */
17
+ function stripAnsi(s) {
18
+ return String(s ?? '')
19
+ .replace(/\x1b\[[0-9;?]*[A-Za-z]/g, '')
20
+ .replace(/\x1b\][\s\S]*?(?:\x07|\x1b\\|$)/g, '');
10
21
  }
11
22
  /**
12
23
  * Draw a rounded box around the given content lines. The box width is the
@@ -34,6 +45,9 @@ function box(lines, maxWidth) {
34
45
  return [top, ...body, bottom].join('\n');
35
46
  }
36
47
  /** Truncate an (ANSI-carrying) string to `max` visible columns. */
48
+ export function clipToWidth(s, max) {
49
+ return clip(s, max);
50
+ }
37
51
  function clip(s, max) {
38
52
  if (width(s) <= max)
39
53
  return s;
@@ -43,7 +57,7 @@ function clip(s, max) {
43
57
  let out = '';
44
58
  let visible = 0;
45
59
  let i = 0;
46
- const esc = /\x1b\[[0-9;?]*[A-Za-z]/y;
60
+ const esc = /\x1b\[[0-9;?]*[A-Za-z]|\x1b\][\s\S]*?(?:\x07|\x1b\\|$)/y;
47
61
  while (i < s.length && visible < max - 1) {
48
62
  esc.lastIndex = i;
49
63
  const m = esc.exec(s);
package/dist/commands.js CHANGED
@@ -527,7 +527,14 @@ export function normalizeRestoredMessage(m) {
527
527
  // it silently left the operator with a dialogue where the agent's own reply
528
528
  // was missing. Keep such a message but shorten it for display.
529
529
  if (text.length > RESTORED_MESSAGE_MAX) {
530
- text = text.slice(0, RESTORED_MESSAGE_MAX) + '…';
530
+ // Never split a surrogate PAIR: the cut is in UTF-16 units, so a high half
531
+ // alone would reach the terminal as a broken code point (same rule as
532
+ // truncateToolResult / capReport / cutHookText).
533
+ let cut = RESTORED_MESSAGE_MAX;
534
+ const last = text.charCodeAt(cut - 1);
535
+ if (last >= 0xd800 && last <= 0xdbff)
536
+ cut--;
537
+ text = text.slice(0, cut) + '…';
531
538
  }
532
539
  if (m.role === 'user') {
533
540
  if (/^Tool result for /.test(text))
@@ -14,7 +14,12 @@ const ESC = String.fromCharCode(27);
14
14
  // (input.ts keeps its own private helper): the regex must match a real CSI,
15
15
  // otherwise visCols over-counts and the erase moves to the wrong row.
16
16
  function stripAnsiLocal(s) {
17
- return s.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, '');
17
+ // CSI AND OSC: a menu line never carries a hyperlink today, but a field
18
+ // value or a group label may, and an OSC body counted as visible columns
19
+ // made the erase height disagree with the real screen (duplicated rows).
20
+ return String(s ?? '')
21
+ .replace(/\x1b\[[0-9;?]*[A-Za-z]/g, '')
22
+ .replace(/\x1b\][\s\S]*?(?:\x07|\x1b\\|$)/g, '');
18
23
  }
19
24
  // Visible COLUMNS of a line (ANSI removed, wide chars counted as 2). Using the
20
25
  // code-point count made the block height disagree with the real screen on lines
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zames_pro",
3
- "version": "2.90.8",
3
+ "version": "2.90.10",
4
4
  "description": "Terminal coding agent that drives a real browser to chat with DeepSeek, Qwen or GLM — 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": {