@ai-matrx/content-ir 0.14.0 → 0.14.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 CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.2 — 2026-09-25
4
+
5
+ **`/source` — a tilde fence locks what the renderer draws inside it**
6
+ (verify-RC-B3 residual R5). The renderer's splitter does not know `~~~`
7
+ fences, so a ```` ``` ```` fence (or an XML section, a JSON block) that starts
8
+ inside one can run past the tilde closer — and the tokenizer had left that
9
+ overflow as editable prose. A tilde island now extends over every block the
10
+ renderer would detect starting inside it (the union of both readings). Found
11
+ by matrx-frontend's new `source-covers-renderer` property test (every fenced
12
+ block the renderer draws must sit inside one tokenizer island; red on 0.14.1,
13
+ green on 0.14.2 over 80k generated documents with tilde, nested-markdown,
14
+ CRLF and exotic-whitespace fences). Guard here: 3 cases in
15
+ `__tests__/source-verify-findings.test.ts`.
16
+
17
+ **Consumer action:** none.
18
+
19
+ ## 0.14.1 — 2026-09-25
20
+
21
+ **Single-dollar math: an adversarial review of the widened rule** (RC-B2's
22
+ single-letter shapes, shipped in 0.14.0). Stored-text impact, every row diffed
23
+ 0.13.0 → 0.14.x: 11 chat text parts gain 37 math spans, 0 lost; notes, agent
24
+ messages, templates and skills unchanged; every gained span is a real shape
25
+ (`f(x)`, `(x, y)`, `(-x, y)`, `f(x-y)`). Two synthetic false positives found
26
+ by probing (none in stored data) are closed: a contraction (`$I'm$` — a prime
27
+ is never followed by a letter) and an abbreviation (`$e.g. (x)$` — a lone
28
+ letter is never followed by a period) stay text. Guard: 6 new cases in
29
+ `__tests__/single-dollar-math.test.ts` (3 red before).
30
+
31
+ **Consumer action:** none.
32
+
3
33
  ## 0.14.0 — 2026-09-25
4
34
 
5
35
  **`/source` — RC-B3 polish: the re-verification residuals, and the verifier's
package/dist/index.cjs CHANGED
@@ -5239,6 +5239,7 @@ function isMathShape(content) {
5239
5239
  const words = content.match(/[A-Za-z]+/g);
5240
5240
  if (!words) return false;
5241
5241
  if (!words.every((w) => w.length === 1 || FUNCTION_NAMES.has(w))) return false;
5242
+ if (/[A-Za-z]'+[A-Za-z]/.test(content) || /(?:^|[\s(,])[A-Za-z]\.(?:[A-Za-z]\.|\s|$)/.test(content)) return false;
5242
5243
  return /[A-Za-z]'*\(|[A-Za-z]'|\b[A-Za-z]\s+[A-Za-z]\b|\([^)]*[A-Za-z][^)]*\)/.test(content);
5243
5244
  }
5244
5245
  function isSingleDollarMath(content, after) {
@@ -6004,11 +6005,41 @@ var Tokenizer = class {
6004
6005
  for (let k = li + 1; k < this.lineCount; k++) {
6005
6006
  if (this.isOpenTail(k)) continue;
6006
6007
  if (close.test(this.lineText(k))) {
6007
- return this.island("fence", p, this.contentEnds[k], true, meta);
6008
+ const tildeEnd = this.contentEnds[k];
6009
+ const end = this.rendererOverflow(li + 1, k, tildeEnd);
6010
+ return this.island("fence", p, end, end === this.n ? this.overflowComplete : true, meta);
6008
6011
  }
6009
6012
  }
6010
6013
  return this.island("fence", p, this.n, false, meta);
6011
6014
  }
6015
+ /** Completion of the last `rendererOverflow` that ran to the end of the text. */
6016
+ overflowComplete = true;
6017
+ /**
6018
+ * The renderer's splitter does not know ~~~ fences: it reads the lines inside
6019
+ * one as ordinary lines, so a ```` ``` ```` fence (or an XML section, a JSON
6020
+ * block…) that STARTS inside the tilde fence can run past its closer. The
6021
+ * editor must lock at least what the renderer draws (verify-RC-B3 residual
6022
+ * R5), so a tilde island extends over every block the renderer would detect
6023
+ * starting inside it. Returns the island's end.
6024
+ */
6025
+ rendererOverflow(firstLine, closeLine, tildeEnd) {
6026
+ let end = tildeEnd;
6027
+ this.overflowComplete = true;
6028
+ for (let j = firstLine; j <= closeLine && j < this.lineCount; j++) {
6029
+ const start = this.lineStarts[j];
6030
+ if (this.lineIsBlank(j)) continue;
6031
+ if (this.lineText(j).trimStart().startsWith("~~~")) continue;
6032
+ const inner = this.detectBlockUncached(start, j, false);
6033
+ if (!inner) continue;
6034
+ if (inner.end > end) {
6035
+ end = inner.end;
6036
+ this.overflowComplete = inner.complete;
6037
+ }
6038
+ const lastLine = this.lineOf(Math.max(start, inner.end - 1));
6039
+ if (lastLine > j) j = lastLine;
6040
+ }
6041
+ return end;
6042
+ }
6012
6043
  /**
6013
6044
  * A line-leading `$$` that OPENS a math pair (source/math-pairs.ts — the
6014
6045
  * core's rule). A closer, an unpaired `$$`, or a prose pair is never a block: