@ai-matrx/rich-content 0.2.94 → 0.2.95
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,6 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.95
|
|
4
|
+
|
|
5
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
6
|
+
`git diff npm/rich-content/v0.2.94..npm/rich-content/v0.2.95 -- apps/shared/rich-content`).
|
|
7
|
+
No source changes intended and no consumer action required.
|
|
8
|
+
|
|
3
9
|
## 0.2.94
|
|
10
|
+
|
|
11
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
12
|
+
`git diff npm/rich-content/v0.2.93..npm/rich-content/v0.2.94 -- apps/shared/rich-content`).
|
|
13
|
+
No source changes intended and no consumer action required.
|
|
14
|
+
|
|
15
|
+
## 0.2.93
|
|
4
16
|
### Unreleased
|
|
5
17
|
|
|
6
18
|
- Fix: a reload could draw a conversation as raw markdown with "No ContentIrRenderProvider above this
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
kindObjectProseBreak,
|
|
6
6
|
normalizeRecoveredContainerPiece
|
|
7
7
|
} from "@ai-matrx/content-ir/surfaces";
|
|
8
|
-
import { hasUnclosedBacktickRun } from "@ai-matrx/content-ir/source";
|
|
8
|
+
import { fenceParts, findCodeRanges, hasUnclosedBacktickRun } from "@ai-matrx/content-ir/source";
|
|
9
9
|
const unescapeKey = (source) => source.replace(/\\_/g, "_");
|
|
10
10
|
const isKindSource = (source) => hasKindKey(source) || hasKindKey(unescapeKey(source));
|
|
11
11
|
const QUOTE_MARKERS = /\n[ \t]{0,3}(?:> ?)+/g;
|
|
@@ -86,7 +86,13 @@ function isCuttable(block) {
|
|
|
86
86
|
}
|
|
87
87
|
return true;
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
function withoutTrailingJsonFenceOpener(content) {
|
|
90
|
+
const range = findCodeRanges(content).at(-1);
|
|
91
|
+
if (!range || range.kind !== "fence" || range.end !== content.length) return content;
|
|
92
|
+
const parts = fenceParts(content.slice(range.start, range.end));
|
|
93
|
+
if (!parts || parts.closed || parts.body.trim() || !JSON_LANGUAGES.has(parts.opener.lang.toLowerCase())) return content;
|
|
94
|
+
return content.slice(0, range.start).replace(/\n?[ \t]*$/, "");
|
|
95
|
+
}
|
|
90
96
|
function recoverPartialKindTail(blocks, envelopes) {
|
|
91
97
|
const last = blocks[blocks.length - 1];
|
|
92
98
|
if (!last || !isCuttable(last)) return blocks;
|
|
@@ -139,7 +145,7 @@ function recoverPartialKindTail(blocks, envelopes) {
|
|
|
139
145
|
pieces.push({ type: "code", content: source, language: "json", metadata: { isComplete: false } });
|
|
140
146
|
}
|
|
141
147
|
let before = content.slice(0, root.start);
|
|
142
|
-
if (last.type !== "text") before = before
|
|
148
|
+
if (last.type !== "text") before = withoutTrailingJsonFenceOpener(before);
|
|
143
149
|
const container = isCodeJson ? "" : normalizeRecoveredContainerPiece(before, last.type, false);
|
|
144
150
|
const head = container && container.trim() ? [{ ...last, content: last.type === "text" ? container.trimEnd() : container }] : [];
|
|
145
151
|
return withoutArrayChrome([...blocks.slice(0, -1), ...head, ...pieces]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-matrx/rich-content",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.95",
|
|
4
4
|
"description": "The AI Matrx formatted-text engine: the one markdown renderer, streaming markdown, the block splitter and renderer, the generic blocks, <RichContent> levels, the rich-document action registry and menus, copy, and the selection toolbar — as portable React.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -133,11 +133,11 @@
|
|
|
133
133
|
"@ai-matrx/agents": "latest",
|
|
134
134
|
"@ai-matrx/alchemy": "latest",
|
|
135
135
|
"@ai-matrx/content-ir": "latest",
|
|
136
|
-
"@ai-matrx/canvas": "latest",
|
|
137
136
|
"@ai-matrx/content-ir-react": "latest",
|
|
138
137
|
"@ai-matrx/data": "latest",
|
|
139
|
-
"@ai-matrx/
|
|
138
|
+
"@ai-matrx/canvas": "latest",
|
|
140
139
|
"@ai-matrx/design-system": "latest",
|
|
140
|
+
"@ai-matrx/diff": "latest",
|
|
141
141
|
"@ai-matrx/icons": "latest",
|
|
142
142
|
"@ai-matrx/kit": "latest",
|
|
143
143
|
"@ai-matrx/media": "latest",
|
|
@@ -204,5 +204,5 @@
|
|
|
204
204
|
"verify:modules-tarball": "node ./scripts/verify-modules-tarball.mjs",
|
|
205
205
|
"verify:tarball": "node ./scripts/verify-tarball.mjs"
|
|
206
206
|
},
|
|
207
|
-
"gitHead": "
|
|
207
|
+
"gitHead": "cba3e4ef660a1544f74eae11d656b0d9955d23ce"
|
|
208
208
|
}
|