@ai-matrx/content-ir 0.21.1 → 0.22.1

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,47 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.22.1
4
+
5
+ First published release of the 0.22 line (the `npm/content-ir-core/v0.22.0` tag never published: the
6
+ `one-code-range-rule` census was red against the relocated chat tree; it now records the real tree).
7
+
8
+ ## 0.22.0 (unpublished)
9
+
10
+ ### New subpath `@ai-matrx/content-ir/surfaces` — kind-aware text surfaces (rich-content extraction)
11
+
12
+ - Moved verbatim from `@ai-matrx/chat` `utils/content-ir/**` (parked there by chat-package-move P14): the JSON-kind
13
+ signal, embedded kind JSON, kind value → markdown, one-line and label projections, quoted-kind lift, escaped-kind
14
+ recovery, image-alt unwrap, the instance-title rule, the legacy quiz envelope, the envelope parity predicate and the
15
+ decision-answers ids. Pure TS, shared by both block splitters and the server-side shape doctors.
16
+ - `registerKindValueMarkdown` keeps its registration on `globalThis` (`Symbol.for("ai-matrx.content-ir.kind-value-markdown")`)
17
+ and announces an unregistered host once on the console.
18
+ - Strict-mode fixes only (`noUncheckedIndexedAccess` assertions where the bound is already checked); no behavior change.
19
+
20
+ ### `/source` `readXmlTag`: requires a `<` at `start`
21
+
22
+ - The chat copy carried the RC-B3r guard and this one did not: `description: >-` was read as a tag named `escription:`
23
+ when a caller started one character early. Now one reader with the guard; the chat copy is deleted in rich-content
24
+ phase 3.
25
+
26
+ ### Consumer action
27
+
28
+ - None required. New code should import these helpers from `@ai-matrx/content-ir/surfaces`, not from `@ai-matrx/chat`.
29
+
30
+ ## 0.21.2
31
+
32
+ ### `/source`: a ```json fence's string state never crosses a line end (never-raw R11 H2)
33
+
34
+ - `FenceReader` (behind `closeFence`, `fenceLineKinds`, `findCodeRanges`, the XML / directive balance walkers) read
35
+ JSON-string state across lines inside a ```json fence. A JSON string never holds a raw newline, so a body line
36
+ that ends inside one (`{\"__kind\":\"note\"}` — escaped quotes, a cut value) swallowed the closing ``` and every
37
+ following list item / quoted line. The state is now read per line; a backtick run inside a string on the same line
38
+ is still text.
39
+
40
+ ### Consumer action
41
+
42
+ - None required. matrx-frontend may drop its splitter workaround (`jsonLineForFenceReader` in
43
+ content-splitter-core.ts) once on 0.21.2.
44
+
3
45
  ## 0.21.1
4
46
 
5
47
  ### `/source`: the tokenizer locks what the renderer draws (fuzz `source-covers-renderer`)
package/dist/index.cjs CHANGED
@@ -5487,9 +5487,9 @@ function fenceOpenerOf(content) {
5487
5487
  function opensStrictFence(line) {
5488
5488
  return fenceOpenerOf(line) !== null;
5489
5489
  }
5490
+ var LINE_START = { inString: false, escaped: false };
5490
5491
  var FenceReader = class {
5491
5492
  opener;
5492
- state = { inString: false, escaped: false };
5493
5493
  depth = 0;
5494
5494
  /** A nested fence was opened at some point. */
5495
5495
  sawNested = false;
@@ -5510,17 +5510,8 @@ var FenceReader = class {
5510
5510
  if (this.tildeCloser) return this.tildeCloser.test(line);
5511
5511
  const trimmedLine = trimFenceLine(line);
5512
5512
  const at = line.indexOf("```");
5513
- if (at === -1) {
5514
- if (this.isJson) this.state = jsonStringState(line, 0, line.length, this.state);
5515
- return false;
5516
- }
5517
- if (this.isJson) {
5518
- const probe = jsonStringState(line, 0, at, this.state);
5519
- if (probe.inString) {
5520
- this.state = jsonStringState(line, at, line.length, probe);
5521
- return false;
5522
- }
5523
- }
5513
+ if (at === -1) return false;
5514
+ if (this.isJson && jsonStringState(line, 0, at, LINE_START).inString) return false;
5524
5515
  if (trimmedLine.startsWith("```")) {
5525
5516
  const kind = classifyInnerFenceLine(trimmedLine, this.opener.ticks, this.nesting, this.depth);
5526
5517
  if (kind === "close-outer") return true;
@@ -5534,7 +5525,6 @@ var FenceReader = class {
5534
5525
  const after = trimFenceLine(line.slice(at + closeTicks));
5535
5526
  if (closeTicks >= this.opener.ticks && after === "" && this.depth === 0) return true;
5536
5527
  }
5537
- if (this.isJson) this.state = jsonStringState(line, 0, line.length, this.state);
5538
5528
  return false;
5539
5529
  }
5540
5530
  };
@@ -6069,6 +6059,7 @@ var XML_NAME_START = /[A-Za-z_]/;
6069
6059
  var XML_NAME_CHARACTER = /[\w.:-]/;
6070
6060
  var WHITESPACE = /\s/;
6071
6061
  function readXmlTag(content, start, find = (needle, from) => content.indexOf(needle, from)) {
6062
+ if (content[start] !== "<") return null;
6072
6063
  let cursor = start + 1;
6073
6064
  const isClosing = content[cursor] === "/";
6074
6065
  if (isClosing) cursor++;