@ai-gui/core 0.22.0 → 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/README.md CHANGED
@@ -113,6 +113,7 @@ const runtime = createActionRuntime({ registry: actions, cardStore })
113
113
  - `Renderer` — `push(chunk)`, `feed(AsyncIterable | ReadableStream)`, `reset()`, `setPlugins(plugins)`; constructor `{ registry?, plugins?, sanitize?, rawHtml?, onPatch?(patches, nodes) }`.
114
114
  - `setPlugins` swaps the grammar and reparses the buffered source, so plugins deferred behind a dynamic import can arrive mid-answer without the host replaying what it pushed.
115
115
  - `rawHtml: false` escapes raw HTML the model wrote instead of interpreting it — a stray `<code>` in prose otherwise swallows the rest of the line.
116
+ - Emphasis is parsed CJK-friendly, one deliberate deviation from CommonMark. CommonMark will not let `**` close when it follows punctuation and precedes a character that is neither whitespace nor punctuation, so `**严格单调(单射)**的函数` renders its asterisks literally. ASCII is unaffected: `a * b * c` and `snake_case_word` parse exactly as before.
116
117
  - `StreamRouter` — demultiplex one stream into named channels: `.channel(name, sink)`, `.on(name, cb)`, `.feed(source)`.
117
118
  - `CardRegistry` — `register(def)`, `parse(type, rawJson)`, `getRender(type)`, `toPromptSpec()`, `toJSONSchema()`.
118
119
  - `CardStore` — `register`, `get`, `list`, `subscribe`, `apply`, `applyAll`, `delete`, `clear`, `snapshot`, and `restore` for Cards with stable IDs.
package/dist/index.cjs CHANGED
@@ -24,6 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  //#endregion
25
25
  const dompurify = __toESM(require("dompurify"));
26
26
  const markdown_it = __toESM(require("markdown-it"));
27
+ const markdown_it_cjk_friendly = __toESM(require("markdown-it-cjk-friendly"));
27
28
 
28
29
  //#region src/partial-json.ts
29
30
  /**
@@ -1554,6 +1555,7 @@ function createParserWithMetadata(options = {}) {
1554
1555
  html: options.rawHtml !== false,
1555
1556
  linkify: true
1556
1557
  });
1558
+ md.use(markdown_it_cjk_friendly.default);
1557
1559
  options.configureMd?.(md);
1558
1560
  for (const plugin of options.plugins ?? []) plugin.extendParser?.(md);
1559
1561
  const hasParserExtensions = Boolean(options.configureMd || options.plugins?.some((plugin) => plugin.extendParser));
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import DOMPurify from "dompurify";
2
2
  import MarkdownIt from "markdown-it";
3
+ import cjkFriendly from "markdown-it-cjk-friendly";
3
4
 
4
5
  //#region src/partial-json.ts
5
6
  /**
@@ -1530,6 +1531,7 @@ function createParserWithMetadata(options = {}) {
1530
1531
  html: options.rawHtml !== false,
1531
1532
  linkify: true
1532
1533
  });
1534
+ md.use(cjkFriendly);
1533
1535
  options.configureMd?.(md);
1534
1536
  for (const plugin of options.plugins ?? []) plugin.extendParser?.(md);
1535
1537
  const hasParserExtensions = Boolean(options.configureMd || options.plugins?.some((plugin) => plugin.extendParser));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-gui/core",
3
- "version": "0.22.0",
3
+ "version": "0.22.1",
4
4
  "description": "Headless streaming renderer core for LLM-generated UI — markdown/JSON repair, card registry, AST diff, plugin engine, sanitizer.",
5
5
  "keywords": [
6
6
  "llm",
@@ -52,7 +52,8 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "dompurify": "^3.4.12",
55
- "markdown-it": "^14.1.0"
55
+ "markdown-it": "^14.1.0",
56
+ "markdown-it-cjk-friendly": "^2.0.2"
56
57
  },
57
58
  "devDependencies": {
58
59
  "@types/markdown-it": "^14.1.2",