zames_pro 2.80.0 → 2.80.2
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 +15 -0
- package/dist/context.js +7 -1
- package/dist/diagnostics.js +5 -1
- package/dist/input/layout.js +38 -12
- package/dist/statusline.js +27 -1
- package/dist/undo.js +10 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.80.2] - 2026-10-20
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- wrapToWidth keeps the indentation and inner spaces of a line
|
|
15
|
+
- **undo:** derive the backup name hash with sha1 instead of a path prefix
|
|
16
|
+
|
|
17
|
+
## [2.80.1] - 2026-10-20
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- **context:** strip a leading BOM before the SKILL.md frontmatter
|
|
22
|
+
- **statusline:** clip a long status badge to one short row
|
|
23
|
+
- **diagnostics:** keep the summary inside maxChars
|
|
24
|
+
|
|
10
25
|
## [2.80.0] - 2026-10-20
|
|
11
26
|
|
|
12
27
|
### Fixed
|
package/dist/context.js
CHANGED
|
@@ -305,7 +305,13 @@ function parseFrontmatter(raw) {
|
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
307
|
export function skillBody(raw) {
|
|
308
|
-
|
|
308
|
+
// A leading BOM (some Windows editors and generators write one) makes the
|
|
309
|
+
// text NOT start with `---`, so the frontmatter check below missed it and
|
|
310
|
+
// the model got the raw YAML mixed into the instructions. Drop it first.
|
|
311
|
+
const bom = String.fromCharCode(0xfeff);
|
|
312
|
+
const norm = String(raw ?? '')
|
|
313
|
+
.replace(new RegExp('^' + bom), '')
|
|
314
|
+
.replace(CRLF_RE, NL);
|
|
309
315
|
if (!norm.startsWith('---'))
|
|
310
316
|
return norm.trim();
|
|
311
317
|
const end = norm.indexOf(NL + '---', 3);
|
package/dist/diagnostics.js
CHANGED
|
@@ -47,10 +47,14 @@ export function summarizeDiagnostics(raw, maxChars) {
|
|
|
47
47
|
const chosen = errLines.length ? errLines : lines;
|
|
48
48
|
let out = chosen.join('\n');
|
|
49
49
|
if (out.length > maxChars) {
|
|
50
|
+
// The truncation MARKER is part of the cap, so the head must leave room
|
|
51
|
+
// for it (appending it to a maxChars-long head exceeded the budget).
|
|
52
|
+
const MARKER = '\n… [diagnostics truncated]';
|
|
53
|
+
const budget = Math.max(0, maxChars - MARKER.length);
|
|
50
54
|
// Never split a surrogate PAIR (emoji / astral CJK): the high half alone
|
|
51
55
|
// is a lone surrogate in the model's context. Same rule as
|
|
52
56
|
// truncateToolResult (agent-loop) and capReport (subagent).
|
|
53
|
-
let cut =
|
|
57
|
+
let cut = budget;
|
|
54
58
|
const c = out.charCodeAt(cut - 1);
|
|
55
59
|
if (c >= 0xd800 && c <= 0xdbff)
|
|
56
60
|
cut--;
|
package/dist/input/layout.js
CHANGED
|
@@ -183,41 +183,67 @@ export function wrapToWidth(s, maxCols) {
|
|
|
183
183
|
out.push('');
|
|
184
184
|
continue;
|
|
185
185
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
// A line that already fits is returned VERBATIM: wrapping is a width
|
|
187
|
+
// operation, not a normalizer. Splitting on spaces and re-joining ate the
|
|
188
|
+
// leading indentation (and emptied a line of only spaces), so an indented
|
|
189
|
+
// warning / echoed operator line lost its layout.
|
|
190
|
+
if (visLen(raw) <= width) {
|
|
191
|
+
out.push(raw);
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
// Wrapping is a WIDTH operation, not a normalizer: the spaces BETWEEN words
|
|
195
|
+
// (and the leading indentation) belong to the line and are reproduced
|
|
196
|
+
// verbatim. The old split(' ')/join(' ') glued the words back with ONE
|
|
197
|
+
// separator, so `'aaa bbb'` at width 7 became `'aaabbb'` and an indented
|
|
198
|
+
// warning lost its indent.
|
|
199
|
+
const words = raw.split(/ +/).filter((w) => w !== '');
|
|
200
|
+
const indent = raw.slice(0, raw.length - raw.trimStart().length);
|
|
201
|
+
let line = indent;
|
|
202
|
+
let lineW = visLen(indent);
|
|
203
|
+
let first = true;
|
|
204
|
+
for (let i = 0; i < words.length; i++) {
|
|
205
|
+
const word = words[i];
|
|
189
206
|
const w = visLen(word);
|
|
190
207
|
// Hard-split a word longer than a whole line.
|
|
191
208
|
if (w > width) {
|
|
192
|
-
if (
|
|
209
|
+
if (!first) {
|
|
193
210
|
out.push(line);
|
|
211
|
+
line = '';
|
|
212
|
+
lineW = 0;
|
|
194
213
|
}
|
|
195
214
|
let piece = '';
|
|
196
215
|
let pieceW = 0;
|
|
197
216
|
for (const ch of word) {
|
|
198
217
|
const cw = charWidth(ch.codePointAt(0));
|
|
199
218
|
if (pieceW + cw > width) {
|
|
200
|
-
out.push(piece);
|
|
219
|
+
out.push(line + piece);
|
|
220
|
+
line = '';
|
|
221
|
+
lineW = 0;
|
|
201
222
|
piece = '';
|
|
202
223
|
pieceW = 0;
|
|
203
224
|
}
|
|
204
225
|
piece += ch;
|
|
205
226
|
pieceW += cw;
|
|
206
227
|
}
|
|
207
|
-
line
|
|
208
|
-
lineW
|
|
228
|
+
line += piece;
|
|
229
|
+
lineW += pieceW;
|
|
230
|
+
first = false;
|
|
209
231
|
continue;
|
|
210
232
|
}
|
|
211
|
-
|
|
212
|
-
if (lineW + sep + w > width) {
|
|
233
|
+
if (!first && lineW + 1 + w > width) {
|
|
213
234
|
out.push(line);
|
|
214
235
|
line = word;
|
|
215
236
|
lineW = w;
|
|
237
|
+
first = false;
|
|
238
|
+
continue;
|
|
216
239
|
}
|
|
217
|
-
|
|
218
|
-
line
|
|
219
|
-
lineW +=
|
|
240
|
+
if (!first) {
|
|
241
|
+
line += ' ';
|
|
242
|
+
lineW += 1;
|
|
220
243
|
}
|
|
244
|
+
line += word;
|
|
245
|
+
lineW += w;
|
|
246
|
+
first = false;
|
|
221
247
|
}
|
|
222
248
|
out.push(line);
|
|
223
249
|
}
|
package/dist/statusline.js
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
+
// N37 statusLine hook. When `ui.statusLineCommand` is set, zames runs it on a
|
|
3
|
+
// timer with a JSON status object on stdin and shows the FIRST line of its
|
|
4
|
+
// stdout in the status line (like Claude Code). The command is deliberately
|
|
5
|
+
// run OUT of the render path: a per-render spawn would block typing, so the
|
|
6
|
+
// caller runs it on its own interval and only sets the resulting text.
|
|
7
|
+
//
|
|
8
|
+
// Best-effort: a missing/failing command yields an empty string (the badge is
|
|
9
|
+
// hidden), never an error in the UI.
|
|
10
|
+
// Longest status text that still fits a typical terminal row together with
|
|
11
|
+
// the rest of the status bar.
|
|
12
|
+
export const STATUS_BADGE_MAX = 80;
|
|
13
|
+
/** Clip a status badge to STATUS_BADGE_MAX with an ellipsis (never splits a
|
|
14
|
+
* surrogate pair). */
|
|
15
|
+
export function clipBadge(text, max = STATUS_BADGE_MAX) {
|
|
16
|
+
const s = String(text ?? '');
|
|
17
|
+
if (s.length <= max)
|
|
18
|
+
return s;
|
|
19
|
+
let cut = max - 1;
|
|
20
|
+
const c = s.charCodeAt(cut - 1);
|
|
21
|
+
if (c >= 0xd800 && c <= 0xdbff)
|
|
22
|
+
cut--;
|
|
23
|
+
return s.slice(0, cut) + '…';
|
|
24
|
+
}
|
|
2
25
|
/** Run the statusLine command and return its first stdout line (trimmed). */
|
|
3
26
|
export function runStatusLineCommand(workdir, command, info, timeoutMs = 4000) {
|
|
4
27
|
return new Promise((resolve) => {
|
|
@@ -24,7 +47,10 @@ export function runStatusLineCommand(workdir, command, info, timeoutMs = 4000) {
|
|
|
24
47
|
return;
|
|
25
48
|
done = true;
|
|
26
49
|
const first = String(out).split(/\r?\n/)[0].trim();
|
|
27
|
-
|
|
50
|
+
// The status line is rendered as ONE row, unwrapped. A command that
|
|
51
|
+
// prints a long single line must not push 400 raw columns into it
|
|
52
|
+
// (the row overflows and the cursor arithmetic drifts).
|
|
53
|
+
resolve(clipBadge(first));
|
|
28
54
|
};
|
|
29
55
|
// Only the FIRST LINE is shown, so there is no reason to keep collecting a
|
|
30
56
|
// big blob: a chatty command (a JSON dump, `ls -R`) would grow `out`
|
package/dist/undo.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import os from 'os';
|
|
4
|
-
import { randomBytes } from 'crypto';
|
|
4
|
+
import { randomBytes, createHash } from 'crypto';
|
|
5
5
|
import { writeJsonAtomic } from './fsutil.js';
|
|
6
6
|
const UNDO_DIR = path.join(os.homedir(), '.zames', 'undo');
|
|
7
7
|
const INDEX = path.join(UNDO_DIR, 'index.json');
|
|
@@ -42,13 +42,17 @@ export class UndoStore {
|
|
|
42
42
|
throw e;
|
|
43
43
|
}
|
|
44
44
|
const stamp = Date.now();
|
|
45
|
-
|
|
45
|
+
// The name only needs to be SHORT and unique; the backup name also
|
|
46
|
+
// carries a random suffix. A 16-hex prefix of the hex-encoded path is
|
|
47
|
+
// the first 8 BYTES of the path, which for files in one directory is
|
|
48
|
+
// the SAME string (and identical without the random part).
|
|
49
|
+
const hash = createHash('sha1').update(filePath).digest('hex').slice(0, 16);
|
|
46
50
|
let backupFile = null;
|
|
47
51
|
if (existed) {
|
|
48
|
-
// The stamp is only ms-precision
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
// backup
|
|
52
|
+
// The stamp is only ms-precision, so two edits in the same
|
|
53
|
+
// millisecond would share a backup name and the second write would
|
|
54
|
+
// clobber the first (losing the backup). Add a random suffix so a
|
|
55
|
+
// backup name is unique.
|
|
52
56
|
const uniq = randomBytes(4).toString('hex');
|
|
53
57
|
backupFile = path.join(UNDO_DIR, `${stamp}-${hash}-${uniq}.bak`);
|
|
54
58
|
await fs.writeFile(backupFile, content);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zames_pro",
|
|
3
|
-
"version": "2.80.
|
|
3
|
+
"version": "2.80.2",
|
|
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": {
|