zames_pro 2.82.109 → 2.82.111

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.111] - 2026-10-24
11
+
12
+ ### Fixed
13
+
14
+ - **cost:** a tool name with a newline cannot break the /cost report
15
+
16
+ ## [2.82.110] - 2026-10-24
17
+
18
+ ### Fixed
19
+
20
+ - **commands:** a dollar token inside a custom-command argument is not expanded twice
21
+
10
22
  ## [2.82.109] - 2026-10-24
11
23
 
12
24
  ### Fixed
package/dist/commands.js CHANGED
@@ -229,10 +229,14 @@ export function renderCost(stats, transcriptFile, tokenUsage = null, t = transla
229
229
  lines.push(t('cost.auto_compacts', { n: String(stats.autoCompacts) }));
230
230
  }
231
231
  const top = Object.entries(stats.toolCounts).sort((a, b) => b[1] - a[1]);
232
+ // A tool NAME is arbitrary text (the model invents it, an MCP server
233
+ // declares it): a newline would start a new line of the report and could
234
+ // spoof an `[OK]` doctor row. Collapse it to one line.
235
+ const nameLine = (v) => v.replace(/\s+/g, ' ');
232
236
  if (top.length) {
233
237
  lines.push(t('cost.by_tool'));
234
238
  for (const [name, n] of top)
235
- lines.push(' ' + name + ': ' + n);
239
+ lines.push(' ' + nameLine(name) + ': ' + n);
236
240
  }
237
241
  // T-D3: where the time went. Sort by total ms, show the top tools with the
238
242
  // count and a human duration, so Read→Edit cycles and slow Bash calls are
@@ -244,7 +248,7 @@ export function renderCost(stats, transcriptFile, tokenUsage = null, t = transla
244
248
  lines.push(t('cost.by_time', { dur: formatDuration(stats.toolMs) }));
245
249
  for (const [name, ms] of byTime.slice(0, 8)) {
246
250
  const count = stats.toolCounts[name] ?? 0;
247
- lines.push(' ' + name + ': ' + formatDuration(ms) + ' ×' + count);
251
+ lines.push(' ' + nameLine(name) + ': ' + formatDuration(ms) + ' ×' + count);
248
252
  }
249
253
  }
250
254
  lines.push(t('cost.duration', { dur: formatDuration(stats.durationMs) }));
@@ -886,10 +890,32 @@ function replaceDollarTokens(s, parts, names) {
886
890
  // it is unit-tested.
887
891
  export function expandCommandArgs(body, rest, names = []) {
888
892
  const parts = splitCommandArgs(rest);
893
+ // Scan the BODY only: the operator's arguments are DATA and must not be
894
+ // re-scanned for `$1`/`$name`. Substituting them into the text FIRST and
895
+ // running the dollar pass over the result rewrote an argument that merely
896
+ // contained `$1` (`/cmd real $1` sent `real real`). A unique placeholder is
897
+ // parked for every `{{args}}`/`$ARGUMENTS` occurrence and restored after the
898
+ // positional pass.
899
+ const parked = [];
889
900
  let out = String(body ?? '');
890
- out = out.split('{{args}}').join(rest);
891
- out = out.split('$ARGUMENTS').join(rest);
901
+ const park = () => {
902
+ const key = String.fromCharCode(0x1f) +
903
+ 'a' +
904
+ parked.length +
905
+ String.fromCharCode(0x1f);
906
+ parked.push(rest);
907
+ return key;
908
+ };
909
+ out = out.split('{{args}}').join(park());
910
+ out = out.split('$ARGUMENTS').join(park());
892
911
  out = replaceDollarTokens(out, parts, names);
912
+ for (let i = 0; i < parked.length; i++) {
913
+ const key = String.fromCharCode(0x1f) + 'a' + i + String.fromCharCode(0x1f);
914
+ out = out.split(key).join(parked[i]);
915
+ }
916
+ // The placeholder uses a control character that cannot appear in a normal
917
+ // body; a body that DOES contain it (a binary snippet) is left untouched
918
+ // because its text is not a generated key.
893
919
  return out.trim();
894
920
  }
895
921
  // Names declared in `arguments:` but not supplied on the command line (by
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zames_pro",
3
- "version": "2.82.109",
3
+ "version": "2.82.111",
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": {