@ai-matrx/content-ir 0.11.6 → 0.12.0

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,57 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.0 — 2026-09-23
4
+
5
+ **`/source` — the stored text is the truth, block by block** (rich-content
6
+ unification PLAN decision 6, register row RC-B3). New subpath
7
+ `@ai-matrx/content-ir/source` (also re-exported from the root):
8
+
9
+ - `tokenizeSource(text)` — the offset-preserving tokenizer. Blocks
10
+ `{ kind: "prose" | "island" | "gap", islandType, start, end, startCp, endCp,
11
+ raw, complete, meta, inlines }` cover the text exactly (the concatenation of
12
+ `raw` IS the input — nothing trimmed or normalized). Every protected
13
+ construct is an island: code fences (incl. special languages, the ```json
14
+ string-aware close), bare typed / `__kind` / directive JSON, known XML
15
+ regions, attribute XML (line-leading and mid-line), unknown XML containers
16
+ (the renderer splitter's own balance tracker, ported), raw HTML blocks and
17
+ tags, HTML comments and pinned anchors `<!--@a:id-->`, `$$` / `\(` / `\[`
18
+ math and THE single-dollar rule, `{{variables}}`, `<matrxcite/>`, embedded
19
+ `__kind` JSON, `[Image URL: …]` media refs, front matter, box-drawing trees.
20
+ Islands inside a paragraph stay in that prose block as `inlines`.
21
+ Streaming-tolerant: an unclosed construct is an island to the end of the
22
+ text with `complete: false`; never throws. Offsets in UTF-16 and code points.
23
+ - `spliceSave(original, edits)` — save = splice. Block-aligned replacements;
24
+ bytes outside the edits are copied, never rebuilt; no-op edits return the
25
+ original string. Returns a change set narrowed to the bytes that differ
26
+ (UTF-16 + code points) for anchor mapping (`mapPosition`, `mapRange`,
27
+ ProseMirror StepMap semantics — STORE-DESIGN §3.19) and an integrity
28
+ report naming any island outside the edit that the edit disturbed
29
+ (`requireIntegrity: true` throws instead).
30
+ - `isSingleDollarMath` / `singleDollarMathEnd` — THE single-dollar math rule,
31
+ moved here from matrx-frontend's math normalizer so the renderer and the
32
+ tokenizer can never disagree.
33
+ - `readXmlTag`, `XmlContainerTracker`, `buildCodePointIndex`,
34
+ `toCodePointOffset`, `toUtf16Offset`, `joinSource`, `listIslands`,
35
+ `blockAt`, `blockEdit`, `blockRangeEdit`.
36
+
37
+ Proof: 39 tests (fixture corpus of every construct, 2,000 adversarial random
38
+ documents, every prefix of every fixture, 1,000 random single-block edits;
39
+ two planted mutations turned the suite red). matrx-frontend's read-only
40
+ `pnpm check:source-roundtrip` ran every stored row — notes, chat text parts,
41
+ agent and template messages, message templates, skills — 135,302 rows, all
42
+ byte-identical, all edit-local.
43
+
44
+ ### Consumer action
45
+
46
+ None required — additive. matrx-frontend adopts `isSingleDollarMath` from
47
+ `/source` in its math normalizer.
48
+
49
+ ## 0.11.7
50
+
51
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
52
+ `git diff npm/content-ir-core/v0.11.6..npm/content-ir-core/v0.11.7 -- apps/shared/content-ir-core`).
53
+ No source changes intended and no consumer action required.
54
+
3
55
  ## 0.11.6
4
56
 
5
57
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/README.md CHANGED
@@ -18,6 +18,8 @@ The root export is the full surface and always will be. Since 0.10.0 each intern
18
18
  | `@ai-matrx/content-ir/registry` | kind registry types, storage transform, the dual gate |
19
19
  | `@ai-matrx/content-ir/convert` | kind ⇄ JSON Schema, the OpenAI structured-output converter |
20
20
  | `@ai-matrx/content-ir/wire` | partial-kind events, runtime wrapper readers, emit payload |
21
+ | `@ai-matrx/content-ir/directives` | Kind Directives: slug grammar, the ONE decoder |
22
+ | `@ai-matrx/content-ir/source` | offset-preserving source tokenizer, splice save + anchor-mapping change set, the single-dollar math rule |
21
23
 
22
24
  ```ts
23
25
  import { createKindStreamParser, envelopeFromCompleteValue } from "@ai-matrx/content-ir/core";