reactive-md 0.9.0 → 0.9.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.
Files changed (162) hide show
  1. package/CHANGELOG-ch.md +13 -0
  2. package/CHANGELOG.md +13 -0
  3. package/README-ch.md +6 -6
  4. package/README-en.md +6 -6
  5. package/README.md +6 -6
  6. package/SECURITY-ch.md +3 -3
  7. package/SECURITY.md +3 -3
  8. package/THIRD_PARTY_NOTICES.md +111 -1
  9. package/cli/build.mjs +1 -0
  10. package/cli/init.mjs +1 -1
  11. package/dist-library/{LocalDocumentView-K7Y-2bRJ.js → LocalDocumentView-sthUP0ct.js} +10 -10
  12. package/dist-library/LocalDocumentViewCore-GiWV3bey.js +9829 -0
  13. package/dist-library/LocalReactiveDocumentCore-ZjQSGyHE.js +275 -0
  14. package/dist-library/{authoring-Co_TiE-P.js → authoring-Dsune4Hy.js} +40 -20
  15. package/dist-library/{compile-LhpTKqCR.js → compile-wUv8KEge.js} +1 -1
  16. package/dist-library/{compiler-core-DTxY-qYz.js → compiler-core-As_m-MNm.js} +2449 -1742
  17. package/dist-library/{compiler-DfGbQhyD.js → compiler-eOfcinZs.js} +19 -19
  18. package/dist-library/{component-state-BBJ08vML.js → component-state-C52ZFJGl.js} +1 -1
  19. package/dist-library/{config-BUo-8O5C.js → config-BadfhjdP.js} +1 -1
  20. package/dist-library/{config-validation-C5kJYk-J.js → config-validation-F47AcE6o.js} +49 -1
  21. package/dist-library/{controls-BWiLLtBO.js → controls-CcT6n7k_.js} +2433 -2409
  22. package/dist-library/{coordinate-BSl6enWV.js → coordinate-CWS9p5q_.js} +108 -107
  23. package/dist-library/{data-table-DfvytZKQ.js → data-table-Bgccxd7h.js} +68 -65
  24. package/dist-library/{display-lw3BT1TA.js → display-B-VhqVND.js} +1 -1
  25. package/dist-library/{export-C7IDW9ul.js → export-BqVmTXm8.js} +145 -87
  26. package/dist-library/{gallery-B8kSt1oI.js → gallery-CY6mTx8i.js} +151 -147
  27. package/dist-library/html-CNT4KD-2.js +757 -0
  28. package/dist-library/{incremental-D_6vwAAE.js → incremental-Dv0FSp_U.js} +404 -142
  29. package/dist-library/layout-C0YlEPGr.js +562 -0
  30. package/dist-library/{mount-preset-C5s9ebEH.js → mount-preset-KxvtKgJb.js} +2 -2
  31. package/dist-library/options-1aDLK7JY.js +121 -0
  32. package/dist-library/{package-core-D0POW4Gd.js → package-core-WFK1RhAZ.js} +3 -3
  33. package/dist-library/{parser-standard-OToYcOBL.js → parser-standard-Yuf3A_VI.js} +3270 -3778
  34. package/dist-library/react-D5iGiUdL.js +7 -0
  35. package/dist-library/reactive-md-authoring.js +16 -18
  36. package/dist-library/reactive-md-build.js +51 -51
  37. package/dist-library/reactive-md-compiler-standard.js +10 -9
  38. package/dist-library/reactive-md-compiler.js +3 -3
  39. package/dist-library/reactive-md-export.js +4 -4
  40. package/dist-library/reactive-md-minimal-react-preset.js +3 -3
  41. package/dist-library/reactive-md-pdf.js +127 -3
  42. package/dist-library/reactive-md-plugin-chart.js +2 -2
  43. package/dist-library/reactive-md-plugin-data.js +4 -4
  44. package/dist-library/reactive-md-plugin-diagram.js +3 -3
  45. package/dist-library/reactive-md-plugin-forms.js +2 -2
  46. package/dist-library/reactive-md-plugin-gallery.js +2 -2
  47. package/dist-library/reactive-md-plugin-navigation.js +2 -2
  48. package/dist-library/reactive-md-plugin-network.js +117 -115
  49. package/dist-library/reactive-md-plugin-plot.js +3 -3
  50. package/dist-library/reactive-md-react-minimal.js +4 -4
  51. package/dist-library/reactive-md-react-server.js +6 -6
  52. package/dist-library/reactive-md-react-unstyled.js +10 -11
  53. package/dist-library/reactive-md-react.js +10 -11
  54. package/dist-library/reactive-md-sdk.js +3 -3
  55. package/dist-library/reactive-md-standalone-configured.js +2 -2
  56. package/dist-library/reactive-md-standalone-host.js +2 -2
  57. package/dist-library/reactive-md-testing-browser.js +2 -2
  58. package/dist-library/reactive-md-testing-react.js +6 -6
  59. package/dist-library/reactive-md-testing.js +4 -4
  60. package/dist-library/reactive-md.js +280 -193
  61. package/dist-library/{registry-05JiqmEp.js → registry-B9NGct4d.js} +1 -1
  62. package/dist-library/{resources-IeJomeUT.js → resources-D2GDQS0p.js} +1 -1
  63. package/dist-library/{runtime-CuOyRe9f.js → runtime-kcA7bG7G.js} +341 -341
  64. package/dist-library/{schema-C-AeByPp.js → schema-BufhKUSM.js} +5 -5
  65. package/dist-library/{sdk-core-BJLJaVR5.js → sdk-core-BoJT1SIt.js} +490 -150
  66. package/dist-library/{session-core-BGka5D1J.js → session-core-nmJHuR9c.js} +170 -156
  67. package/dist-library/{shareable-jkGi2g6y.js → shareable-DpbE-59H.js} +207 -242
  68. package/dist-library/types/authoring/catalog.d.ts +1 -2
  69. package/dist-library/types/components/shared/visual-frame.d.ts +6 -2
  70. package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
  71. package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
  72. package/dist-library/types/local/compilation/compiler-services.d.ts +8 -4
  73. package/dist-library/types/local/compilation/compiler.d.ts +3 -3
  74. package/dist-library/types/local/compilation/session/incremental.d.ts +20 -5
  75. package/dist-library/types/local/compilation/streaming.d.ts +27 -0
  76. package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
  77. package/dist-library/types/local/configuration/diagnostic-messages.d.ts +48 -0
  78. package/dist-library/types/local/configuration/options-core.d.ts +1 -2
  79. package/dist-library/types/local/configuration/options.d.ts +1 -0
  80. package/dist-library/types/local/css/author-css.d.ts +66 -0
  81. package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
  82. package/dist-library/types/local/html/html.d.ts +39 -3
  83. package/dist-library/types/local/index.d.ts +1 -1
  84. package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
  85. package/dist-library/types/local/parsing/parse-session.d.ts +2 -2
  86. package/dist-library/types/local/parsing/parser-convert.d.ts +2 -1
  87. package/dist-library/types/local/parsing/parser-core.d.ts +8 -1
  88. package/dist-library/types/local/parsing/parser.d.ts +2 -2
  89. package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
  90. package/dist-library/types/local/rendering/document/LocalDocumentViewCore.d.ts +25 -1
  91. package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +1 -1
  92. package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
  93. package/dist-library/types/local/rendering/document/view-render-context.d.ts +11 -1
  94. package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
  95. package/dist-library/types/local/transport/worker.d.ts +27 -4
  96. package/dist-library/types/local/types.d.ts +52 -16
  97. package/dist-library/types/react/component-api.d.ts +10 -1
  98. package/dist-library/types/react/component-utils.d.ts +9 -1
  99. package/dist-library/types/react/sdk-core.d.ts +4 -1
  100. package/dist-library/types/shareable.d.ts +5 -4
  101. package/dist-library/types/standalone/prepare.d.ts +1 -1
  102. package/dist-library/types/standalone/session-core.d.ts +3 -2
  103. package/dist-library/{types-BFC5rzC4.js → types-BeNtPqdY.js} +1 -1
  104. package/dist-library/{validation-BlDL2uD9.js → validation-BEBA_HvS.js} +88 -72
  105. package/dist-library/{visual-frame-G8PHoj1e.js → visual-frame-CyV1FXzs.js} +6 -5
  106. package/dist-library/{visuals-BkYRmYGO.js → visuals-BZbZYA7w.js} +24181 -24180
  107. package/dist-standalone/reactive-md-standalone.js +124 -117
  108. package/docs/README-ch.md +2 -1
  109. package/docs/README.md +2 -1
  110. package/docs/compatibility/compatibility-ch.md +6 -6
  111. package/docs/compatibility/compatibility-en.md +6 -6
  112. package/docs/compatibility/source-versioning-ch.md +1 -1
  113. package/docs/compatibility/source-versioning-en.md +1 -1
  114. package/docs/development/component-development-ch.md +2 -2
  115. package/docs/development/component-development-en.md +2 -2
  116. package/docs/development/component-development-reference-ch.md +2 -2
  117. package/docs/development/component-development-reference-en.md +2 -2
  118. package/docs/development/component-protocol-ch.md +2 -2
  119. package/docs/development/component-protocol-en.md +2 -2
  120. package/docs/development/extension-tutorial-ch.md +3 -3
  121. package/docs/development/extension-tutorial-en.md +3 -3
  122. package/docs/integration/author-tools-ch.md +1 -1
  123. package/docs/integration/author-tools-en.md +1 -1
  124. package/docs/integration/compiler-ch.md +3 -1
  125. package/docs/integration/compiler-en.md +3 -1
  126. package/docs/integration/editor-ch.md +3 -3
  127. package/docs/integration/editor-en.md +3 -3
  128. package/docs/integration/extension-sdk-ch.md +2 -2
  129. package/docs/integration/extension-sdk-en.md +2 -2
  130. package/docs/integration/local-integration-ch.md +130 -8
  131. package/docs/integration/local-integration-en.md +130 -8
  132. package/docs/integration/shareable-export-ch.md +4 -2
  133. package/docs/integration/shareable-export-en.md +4 -2
  134. package/docs/reference/html-compatibility-ch.md +20 -67
  135. package/docs/reference/html-compatibility-en.md +19 -64
  136. package/docs/reference/public-api-ch.md +10 -7
  137. package/docs/reference/public-api-en.md +10 -7
  138. package/docs/releases/release-0.9.1-ch.md +29 -0
  139. package/docs/releases/release-0.9.1-en.md +29 -0
  140. package/examples/component-package/README-ch.md +1 -1
  141. package/examples/component-package/README.md +1 -1
  142. package/examples/game-2048-package/README-ch.md +1 -1
  143. package/examples/game-2048-package/README.md +1 -1
  144. package/examples/integration/README-ch.md +21 -2
  145. package/examples/integration/README.md +21 -2
  146. package/examples/integration/extension-sdk/README-ch.md +1 -1
  147. package/examples/integration/extension-sdk/README.md +1 -1
  148. package/examples/integration/streaming/index.html +48 -0
  149. package/examples/integration/streaming/main.js +175 -0
  150. package/examples/integration/streaming/package.json +13 -0
  151. package/examples/integration/streaming/worker.js +3 -0
  152. package/examples/minimal-extension/README-ch.md +3 -3
  153. package/examples/minimal-extension/README.md +3 -3
  154. package/examples/tetris-package/README-ch.md +1 -1
  155. package/examples/tetris-package/README.md +1 -1
  156. package/package.json +6 -1
  157. package/dist-library/LocalDocumentViewCore-BLG4hMuO.js +0 -9535
  158. package/dist-library/LocalReactiveDocumentCore-DVQ6WA9G.js +0 -259
  159. package/dist-library/component-utils-BvHL8VGt.js +0 -298
  160. package/dist-library/layout-C22VjZh0.js +0 -542
  161. package/dist-library/options-CdSKOi7p.js +0 -116
  162. package/dist-library/react-LY5qsVeP.js +0 -7
@@ -6,7 +6,7 @@
6
6
 
7
7
  ## 运行环境与入口
8
8
 
9
- 下个发行版的 P0 HTML 和三个宿主能力开关见 [HTML 部分兼容](../reference/html-compatibility-ch.md)。本版采用暂时性分流政策:任意开启作者 CSS、JavaScript 或扩展 HTML,整篇文档即按原生 HTML 渲染,停止解析 Markdown 和 ReactiveMD。
9
+ ReactiveMD 支持混排基础 HTML、Markdown 与组件。宿主分别授权作者样式、脚本与扩展 HTML。参见 [HTML 兼容](../reference/html-compatibility-ch.md)。
10
10
 
11
11
  | 入口 | 内容 | 依赖 |
12
12
  | --- | --- | --- |
@@ -46,6 +46,8 @@ export function Article() {
46
46
  | 属性 | 类型 | 组件 | 说明 |
47
47
  | --- | --- | --- | --- |
48
48
  | `source` | `string` | `LocalReactiveDocument` | 源码变化时重新编译,并在现有运行时中采用新文档,迁移仍符合契约的参数值;影响编译语义的宿主选项变化或文档无法采用时创建新运行时,旧实例状态不保留。见[源码变化时保留参数](#源码变化时保留参数) |
49
+ | `sourcePhase` | `'streaming' \| 'final'` | `LocalReactiveDocument` | 标记源码是否仍在生成,默认 `final`。`streaming` 期间文档以只读静态模式呈现并暂缓副作用交互;与 `strict` 独立。宿主也可设置 `compileOptions.sourcePhase`,两者同时提供时以 prop 为准。见[流式源码编译](#流式源码编译) |
50
+ | `onTransientDiagnostics` | `(diagnostics: Diagnostic[]) => void` | `LocalReactiveDocument` | 接收流式快照中的可修复问题,不进入 `onDiagnostics`;完成时若曾上报,最后回调一次空数组。省略时忽略暂态问题 |
49
51
  | `compileOptions` | `LocalCompileOptions` | `LocalReactiveDocument` | 单次编译预算、HTML 能力开关和宿主组件 schema;省略时使用默认 ReactiveMD 模式 |
50
52
  | `document` | `LocalDocument` | `LocalDocumentView` | 已编译文档;由宿主编译一次 |
51
53
  | `runtime` | `LocalRuntime` | `LocalDocumentView` | 宿主创建并负责销毁 |
@@ -102,13 +104,13 @@ console.log(session.stats); // mode: 'incremental', compiledBlocks: 1, reusedBlo
102
104
  session.dispose(); // 关闭文档时释放会话缓存
103
105
  ```
104
106
 
105
- `compile(source, options?)` 返回 `LocalCompileResult`。`clear()` 清空复用数据,`dispose()` 释放缓存并结束会话;销毁后的会话不能再次编译。结果是可序列化的普通数据,每次返回独立快照,修改旧结果不会污染缓存。会话内未修改块的节点 ID 可跨编辑保持稳定,编号不要求与独立 `compileLocal()` 调用相同;节点 ID 及其元数据关联始终以同一份结果为准。
107
+ `compile(source, options?, phase?)` 返回 `LocalCompileResult`;阶段用法见[流式源码编译](#流式源码编译)。`compileShared` 返回 Worker 与预览使用的编译器只读结果图,调用方不得修改;需要独立数据时使用 `compile`,它会发布普通数据快照。`clear()` 清空复用数据,`dispose()` 释放缓存并结束会话;销毁后的会话不能再次编译。结果是可序列化的普通数据,每次返回独立快照,修改旧结果不会污染缓存。会话内未修改块的节点 ID 可跨编辑保持稳定,编号不要求与独立 `compileLocal()` 调用相同;节点 ID 及其元数据关联始终以同一份结果为准。
106
108
 
107
109
  同一会话内,参数与声明上下文保持不变时,只重新编译受影响的 Markdown 块。改变声明、组件内容、编译选项、权限或宿主 schema 时执行完整编译。引用定义、脚注、导航锚点、HTML、BOM、代码定界符变化及无法确认安全边界的输入也保守回到完整编译。出现诊断时返回完整编译的诊断。整篇源码和累计节点预算仍然生效,缓存只保留当前版本。
108
110
 
109
111
  连续修改组件或声明时,会话保留最新的成功编译结果,延迟建立块索引。恢复编辑独立正文块时,再建立一次索引并复用其他块。相同源码可直接返回独立快照;选项变化、错误、`clear()` 和 `dispose()` 都会清除待恢复状态。
110
112
 
111
- `stats` 提供最近一次调用的 `mode`(`full`、`incremental`、`cached`)、块数、复用数、编译字符数与可选失效原因,用于观测实际复用。`cacheBuilds` 记录本次调用尝试建立块索引的次数,包括延迟恢复。修改块会在不变的声明前缀下编译,前缀工作量计入 `compiledCharacters`。差异检测、范围重定位和完整结果快照组装仍随文档规模增长;会话不保证每次编辑都是常数时间。
113
+ `stats` 提供最近一次调用的 `mode`(`full`、`incremental`、`cached` 或 `streaming`)、块数、复用数、编译字符数与可选失效原因,用于观测实际复用。`cacheBuilds` 记录本次调用尝试建立块索引的次数,包括延迟恢复。修改块会在不变的声明前缀下编译,前缀工作量计入 `compiledCharacters`。差异检测、范围重定位和完整结果快照组装仍随文档规模增长;会话不保证每次编辑都是常数时间。
112
114
 
113
115
  扁平单行列表、表格即使占满整个文档,也可建立增量快照。修改一行后,会话复用上一版的简单行解析计划,并在完整语义校验后保留未修改行的节点 ID。位置不变的行可共享对象;位置变化时克隆并更新 UTF-16 范围。动态插值仍由通用解析器处理。`stats.parse` 中的 `reusedRows` / `reusedItems` 累计解析计划复用,`reusedRowNodes` / `reusedItemNodes` 单独累计最终行节点复用。
114
116
 
@@ -116,6 +118,125 @@ Worker 判断结果补丁不划算时,可对同一修订返回完整成功结
116
118
 
117
119
  内置 `startLocalCompileWorker()`、`LocalCompileScheduler` 默认降级编译和 `LocalReactiveDocument` 已管理各自会话。自定义 `fallbackCompile` 继续由宿主管理。`compileLocal()` 保持单次完整编译 API。测试与性能数据见[块级增量编译](../development/performance-overview-ch.md)。
118
120
 
121
+ ## 流式源码编译
122
+
123
+ 模型输出、协作回放或分块生成内容时,宿主可以把仍在增长的源码持续交给编译会话、调度器、Worker 或 `LocalReactiveDocument`,不必等到全文结束才呈现。引擎只接受完整源码快照和阶段标记;token 累积、模型连接、会话历史、重试与取消策略都由宿主负责。
124
+
125
+ ### 快照与阶段
126
+
127
+ 每次提交都是截至当前的完整源码。宿主收到 token 后追加到自己的缓冲区,按节流窗口或结构边界提交缓冲区;断线恢复、替换错误片段也提交完整文本。阶段表达为:
128
+
129
+ ```ts
130
+ type LocalSourcePhase = 'streaming' | 'final';
131
+ ```
132
+
133
+ `streaming` 表示本轮生成尚未结束,`final` 表示源码已经完整。阶段可以作为 `LocalCompileOptions.sourcePhase` 传入,也可以作为会话、调度器的显式参数传入。两者都省略时完全沿用现有的最终编译语义。运行时只接受这两个值;会话与 `LocalCompileScheduler` 对其他值都返回相同的 `local.options.invalid` 失败,而不是回退到 `final`。`sourcePhase` 不是编译身份的一部分,不进入 `localCompileOptionsKey`,也不会改变 `strict`:
134
+
135
+ - `strict` 仍只控制最终源码的结构恢复。`strict: false` 不是流式模式,它会把最终仍损坏的结构恢复为惰性原文并产生 warning。
136
+ - `sourcePhase` 表达源码是否仍在生成。流式快照把当前无法安全解释的区域降级为原文,并保留已完成前缀的节点身份和源码范围;它不会因为尾部尚未补全就让整篇预览失败。`strict: false` 的恢复记录和 warning 仍按既有规则产生,不会被标成暂态;`final` 再按所选严格模式完整编译。
137
+ - 流式中临时可见的未闭合标签、属性引号、组件体、插值和公式不应由宿主改写成语法修复;补全后按普通源码重新编译。
138
+
139
+ ### 状态与暂态诊断
140
+
141
+ 显式提供阶段时,结果增加 `status`;流式结果还可带 `transientDiagnostics`。未提供阶段时保持既有结果形状,不增加这两个字段。`diagnostics` 始终只包含非暂态诊断:
142
+
143
+ | 源阶段 | `status` | 结果语义 |
144
+ | --- | --- | --- |
145
+ | `streaming` | `partial` | `ok: true`,返回当前可安全呈现的文档;可由后续源码修复的问题进入 `transientDiagnostics`,不可安全解释的区域以原文显示。 |
146
+ | `streaming` + 确定性错误 | `failed` | `ok: false`;只有确定性错误留在 `diagnostics`:选项、源码类型或长度、语法版本、预算、原生 HTML/安全策略、配置、注册表与能力失败,以及内部解析失败(`local.parse.*`)。 |
147
+ | `final` | `valid` | 完整编译成功,且未执行结构恢复。 |
148
+ | `final` + `strict: false` 恢复 | `recovered` | 返回文档、`recoveries` 和每个恢复对应的 warning。 |
149
+ | `final` | `failed` | 沿用最终编译错误规则,不把错误标为暂态。 |
150
+
151
+ 暂态诊断保留原来的 `code`、`message` 和源码范围,只出现在 `transientDiagnostics` 中;宽松模式的恢复 warning 仍按最终诊断规则产生,不会被复制到暂态列表。消费端应依据 `status` 和字段判断阶段,不要从诊断文本推断是否还在生成。流式成功结果可以暂时带有未闭合结构或未求值表达式;收到 `final` 后应清空宿主的暂态诊断状态,并以最终 `diagnostics` 为准。确定性错误仍会立即失败,不能当作可等待补全的暂态问题。
152
+
153
+ ### 会话、调度器与 Worker
154
+
155
+ ```ts
156
+ import { LocalCompileScheduler, createLocalCompileSession } from 'reactive-md';
157
+
158
+ const session = createLocalCompileSession();
159
+ const partial = session.compile(snapshot, options, 'streaming');
160
+ if (partial.status === 'partial') {
161
+ render(partial.document);
162
+ showTransient(partial.transientDiagnostics ?? []);
163
+ }
164
+
165
+ const final = session.compile(completedSource, options, 'final');
166
+ if (final.status === 'valid' || final.status === 'recovered') {
167
+ clearTransient();
168
+ render(final.document);
169
+ }
170
+ ```
171
+
172
+ `compile(source, options?, phase?)` 和 `compileShared(source, options?, phase?)` 的显式 `phase` 优先于 `options.sourcePhase`。显式 `final` 与省略阶段使用同一条最终编译路径,只是额外返回 `status`。
173
+
174
+ `LocalCompileScheduler.schedule(source, options?, hint?, phase?)` 按同一套阶段工作:
175
+
176
+ ```ts
177
+ const scheduler = new LocalCompileScheduler({
178
+ createWorker: () => new Worker(new URL('./compile.worker.ts', import.meta.url), { type: 'module' }),
179
+ onResult: ({ result, sourcePhase }) => applySnapshot(result, sourcePhase),
180
+ delay: 150,
181
+ });
182
+
183
+ scheduler.schedule(snapshot, options, undefined, 'streaming');
184
+ scheduler.schedule(completedSource, options, undefined, 'final');
185
+ ```
186
+
187
+ - 流式快照使用调度器的节流窗口(默认 `LOCAL_COMPILE_DELAY_MS`,150 ms)合并,只保留最新排队快照;不会为每个 token 单独编译。
188
+ - `final` 跳过防抖立即排队。它可以等待正在执行的编译结束,但旧任务的结果因阶段不同无法交付;单调修订号确保后续响应不会覆盖已接受的状态。
189
+ - 修订号随调度递增,过期 Worker 回包不能更新当前预览。流式任务不属于 `patch-v1` 基线;安排流式快照会使现有基线失效,只有最终结果可以建立补丁基线。
190
+ - Worker 的完整请求与响应在声明了阶段时回显 `sourcePhase`;未声明阶段的旧客户端保持原有报文形状并省略该字段。阶段放在 options 对象上同样生效。`LocalCompileOutcome.sourcePhase` 报告结果阶段。主线程回退使用相同语义;自定义 `fallbackCompile` 会在第三个参数收到阶段。
191
+ - Worker 补丁重试使用 `retryFull`,代码为 `stale-base`、`options-mismatch`、`invalid-edit` 或 `phase-mismatch`;调度器改发一次完整请求,而不是信任错位的补丁。
192
+
193
+ 同一会话的流式编译不会读取或写入最终编译的块索引、延迟索引和共享结果缓存;`final` 始终从既有的增量或完整编译路径开始。按精确源码文本索引的底层解析缓存可以同时服务两个阶段,因为它们是文本和选项的纯函数。流式任务之间可以复用最近一次相同快照的结果,但不要依赖跨快照的块级复用。
194
+
195
+ ### React 宿主
196
+
197
+ ```tsx
198
+ import { useState } from 'react';
199
+ import type { Diagnostic, LocalSourcePhase } from 'reactive-md';
200
+ import { LocalReactiveDocument } from 'reactive-md/react';
201
+
202
+ export function StreamedArticle({ source, phase }: {
203
+ source: string;
204
+ phase: LocalSourcePhase;
205
+ }) {
206
+ const [transient, setTransient] = useState<Diagnostic[]>([]);
207
+ const [diagnostics, setDiagnostics] = useState<Diagnostic[]>([]);
208
+
209
+ return (
210
+ <>
211
+ <LocalReactiveDocument
212
+ source={source}
213
+ sourcePhase={phase}
214
+ onTransientDiagnostics={setTransient}
215
+ onDiagnostics={setDiagnostics}
216
+ />
217
+ {transient.length > 0 && <p>{transient.length} 个暂态问题</p>}
218
+ {phase === 'final' && diagnostics.length > 0 && <p>编译失败,请查看诊断。</p>}
219
+ </>
220
+ );
221
+ }
222
+ ```
223
+
224
+ 流式期间 `LocalReactiveDocument` 使用 `mode="static"` 渲染:控件只读,网络会话不建立,提交、重置和其他组件副作用 effect 不启动。它仍复用同一编译会话和运行时,普通源码更新按现有迁移规则保留兼容的读者参数和输入草稿;阶段切换不会重建运行时或重置状态。`final` 恢复宿主传入的 `mode`、`staticFirst` 和正式交互。`onDiagnostics` 承载当前快照的非暂态诊断,暂态问题不会进入该通道。`onTransientDiagnostics` 只报告暂态问题;如果宿主曾收到暂态诊断,最终时会再收到一次空数组用于清除,后续没有暂态问题的流式快照也会同样撤回。确定性失败仍按现有规则显示错误提示。
225
+
226
+ 宿主必须自行把新快照写入 `source`,并在生成结束时把 `sourcePhase` 切回 `final`。取消生成、切换文档或卸载时停止提交并丢弃旧结果;引擎只校验修订和阶段,不管理生成轮次。
227
+
228
+ ### 安全边界
229
+
230
+ 流式编译不改变文档的安全模型:
231
+
232
+ - 模型传输、凭据、请求重试和取消都由宿主负责。ReactiveMD 只接收文本快照,不连接模型服务,不为流式能力新增网络请求或代码执行。
233
+ - `streaming` 不会打开作者 HTML、脚本、CSS 或其他语言能力;这些仍由宿主通过显式编译选项授予。确定性安全、配置、版本和预算错误仍是最终失败。
234
+ - 流式期间副作用组件按静态模式暂缓,避免未完成内容触发提交、订阅或其他外部操作;`final` 后才恢复正式交互。宿主仍应执行自己的权限、CSP 和不可信内容策略。
235
+
236
+ ### 性能预期
237
+
238
+ 每个被接受的流式快照都编译完整源码。无法安全解释的区域通过最多 6 轮稳定化重试降级为原文;若仍有损伤,再执行一次整篇原文编译。该路径不承诺块级增量成本。调度器负责节流和合并快照,`final` 立即排队。源码仍受 1,000,000 字符上限和编译预算约束;快照越长,单次编译成本越高。长文档应测量输入到预览的延迟和编译量,并根据测量结果调整宿主的提交窗口;不要逐 token 调用编译入口。仓库基准 `npm run bench:streaming` 对一份 15.5 KB、227 块的文档以 64 字符片段测得每个流式快照 p50 约 15–23 ms、p95 约 33–53 ms(多次运行范围),最终文档与一次性编译完全一致;150 ms 窗口下约合并为 31 次提交。该结果只作为基线,不构成跨机器的统一 SLO。
239
+
119
240
  ## 严格解析与局部恢复
120
241
 
121
242
  `strict` 控制单次编译、`compileLocal`、编辑会话和 Worker 的结构恢复行为。默认值为 `true`;省略和显式 `undefined` 使用相同默认值。其他非布尔值是配置错误。
@@ -421,9 +542,9 @@ const scheduler = new LocalCompileScheduler({
421
542
  scheduler.schedule(source);
422
543
  ```
423
544
 
424
- `LocalCompileScheduler` 按 `LOCAL_COMPILE_DELAY_MS`(150 ms,可用 `delay` 覆盖)合并编辑,只保留一个进行中的任务和最新排队源码,并丢弃已被新编辑取代的结果。没有可用 Worker 或 Worker 出错后,它在主线程调用 `fallbackCompile`(默认 `compileLocal`);Worker 失败后会永久切换到该回退,并通过 `onModeChange` 报告。Worker 抛出的错误或回退编译抛出的错误使用 `local.worker.compile` 诊断码。
545
+ `LocalCompileScheduler` 按 `LOCAL_COMPILE_DELAY_MS`(150 ms,可用 `delay` 覆盖)合并编辑,只保留一个进行中的任务和最新排队源码,并丢弃已被新编辑取代的结果。没有可用 Worker 或 Worker 出错后,它在主线程调用 `fallbackCompile`;默认实现使用内部会话编译,结果与 `compileLocal` 相同但不跨调用复用。Worker 失败后会永久切换到该回退,并通过 `onModeChange` 报告。Worker 抛出的错误或回退编译抛出的错误使用 `local.worker.compile` 诊断码。需要提交流式快照时使用 `schedule(source, options?, hint?, phase?)`,`final` 会跳过防抖;详见[流式源码编译](#流式源码编译)。
425
546
 
426
- `onResult` 接收 `LocalCompileOutcome`(`source`、`result`、`duration`、`mode`),`onPendingChange` 报告是否仍有排队或进行中的任务,`dispose()` 停止计时器、终止 Worker,并阻止之后的回调。
547
+ `onResult` 接收 `LocalCompileOutcome`(`source`、`result`、`duration`、`mode`、`sourcePhase`),`onPendingChange` 报告是否仍有排队或进行中的任务,`dispose()` 停止计时器、终止 Worker,并阻止之后的回调。
427
548
 
428
549
  ### 其他核心导出
429
550
 
@@ -436,7 +557,8 @@ scheduler.schedule(source);
436
557
  - 源码修订:`inspectLocalSourceVersion`、`checkLocalUpgrade` 和 `migrateLocalSource`;`LocalUpgradeOptions` 配置源修订和语义变化许可。
437
558
  - 参数保留:`planLocalStateRetention` 和 `applyLocalStateRetention`。
438
559
  - 后台编译:`LocalCompileScheduler`、`LOCAL_COMPILE_DELAY_MS` 和 `startLocalCompileWorker`。
439
- - 类型导出:`Diagnostic`、`SourceRange`、`LocalValue`、`LocalValueKind`、`LocalNode`、`LocalBinding`、`LocalComputation`、`LocalValidation`、`LocalDocument`、`LocalCompileLimits`、`LocalCompileOptions`、`LocalCompileResult`、`LocalHostPropKind`、`LocalHostPropSchema`、`LocalHostComponentSchema`、`LocalUpgradeOptions`、`LocalRuntime`、`LocalSnapshot`、`LocalStateFile`、`LocalStateGenerator`、`LocalStateParseResult`、`LocalStateResolution`、`LocalRetainedState`、`LocalStateRetentionReason`、`LocalStateRetentionDrop`、`LocalStateRetentionInput`、`LocalStateRetentionResult`、`LocalCompileWorker`、`LocalCompileWorkerScope`、`LocalCompileRequest`、`LocalCompileResponse`、`LocalCompileOutcome`、`LocalCompileMode`、`LocalCompileSchedulerOptions`。
560
+ - 流式阶段:`LocalSourcePhase`、`LocalCompileStatus`;显式阶段结果中的 `status` 和 `transientDiagnostics`。
561
+ - 类型导出:`Diagnostic`、`SourceRange`、`LocalValue`、`LocalValueKind`、`LocalNode`、`LocalBinding`、`LocalComputation`、`LocalValidation`、`LocalDocument`、`LocalCompileLimits`、`LocalCompileOptions`、`LocalCompileResult`、`LocalSourcePhase`、`LocalCompileStatus`、`LocalHostPropKind`、`LocalHostPropSchema`、`LocalHostComponentSchema`、`LocalUpgradeOptions`、`LocalRuntime`、`LocalSnapshot`、`LocalStateFile`、`LocalStateGenerator`、`LocalStateParseResult`、`LocalStateResolution`、`LocalRetainedState`、`LocalStateRetentionReason`、`LocalStateRetentionDrop`、`LocalStateRetentionInput`、`LocalStateRetentionResult`、`LocalCompileWorker`、`LocalCompileWorkerScope`、`LocalCompileRequest`、`LocalCompileResponse`、`LocalCompileOutcome`、`LocalCompileMode`、`LocalCompileSchedulerOptions`。
440
562
 
441
563
  `compileExpression`、`compileLatex` 和 `samplePlot` 是较低层的工具,稳定级别与核心 API 相同;通常只需要 `compileLocal` 和 `createLocalRuntime`。
442
564
 
@@ -515,9 +637,9 @@ const urlPolicy: LocalUrlPolicy = (raw, kind) => {
515
637
 
516
638
  ## 不提供的功能
517
639
 
518
- 默认 ReactiveMD 路径支持 P0 HTML。作者 CSS、JavaScript 和扩展 HTML 的宿主开关使用独立的原生 HTML 路径,见 [HTML 部分兼容](../reference/html-compatibility-ch.md)。自动状态持久化、不受限的网络或存储调用、Vue、React 18 和 CommonJS 仍不在当前接口范围内。宿主数据使用显式只读声明,状态导出与导入由宿主调用。
640
+ 基础 HTML 与 RMD 混排,作者能力由宿主独立授权。参见 [HTML 兼容](../reference/html-compatibility-ch.md)。自动状态持久化、不受限的网络或存储调用、Vue、React 18 和 CommonJS 仍不在当前接口范围内。宿主数据使用显式只读声明,状态导出与导入由宿主调用。
519
641
 
520
- [扩展 SDK](extension-sdk-ch.md)随 `reactive-md@0.8.0` 提供自定义组件和主题包注册,开发流程见[组件插件开发指南](../development/component-development-ch.md)。`LocalReactiveDocument` 在普通源码编辑中尝试采用新文档并保留兼容绑定;切换独立文档时更换 React `key`,或由宿主管理文档与运行时。
642
+ [扩展 SDK](extension-sdk-ch.md)自 `reactive-md@0.8.0` 起提供自定义组件和主题包注册,开发流程见[组件插件开发指南](../development/component-development-ch.md)。`LocalReactiveDocument` 在普通源码编辑中尝试采用新文档并保留兼容绑定;切换独立文档时更换 React `key`,或由宿主管理文档与运行时。
521
643
 
522
644
  组块、颜色、槽位状态与迁移规则见[交互语法规范](../reference/local-interaction-syntax-ch.md),升级清单见[0.4.0 发布与迁移](../releases/release-0.4.0-ch.md)。
523
645
 
@@ -6,7 +6,7 @@ Local interaction mode uses HTML-style tags, in-place parameters and `{{ express
6
6
 
7
7
  ## Runtime and entries
8
8
 
9
- See [HTML compatibility](../reference/html-compatibility-en.md) for the next release's P0 HTML support and host capability options. The temporary routing policy sends the entire document to native HTML when author CSS, JavaScript or extended HTML is enabled. Markdown and ReactiveMD interpretation stop in that path.
9
+ ReactiveMD mixes P0 HTML with Markdown and components. Hosts grant author styles, scripts and extended HTML fragments independently. See [HTML compatibility](../reference/html-compatibility-en.md).
10
10
 
11
11
  | Entry | Contents | Dependency |
12
12
  | --- | --- | --- |
@@ -46,6 +46,8 @@ export function Article() {
46
46
  | Prop | Type | Component | Notes |
47
47
  | --- | --- | --- | --- |
48
48
  | `source` | `string` | `LocalReactiveDocument` | Recompiles on source changes and adopts the new document in the existing runtime, migrating parameter values that still satisfy their contracts. Host option changes that affect compilation semantics or a document the runtime cannot adopt create a new runtime and drop the old instance state. See [Keeping values when source changes](#keeping-values-when-source-changes) |
49
+ | `sourcePhase` | `'streaming' \| 'final'` | `LocalReactiveDocument` | Marks whether the source is still being generated; defaults to `final`. While `streaming`, the document renders read-only in static mode and defers side effects; independent of `strict`. A host may also set `compileOptions.sourcePhase`; the prop wins. See [Streaming source compilation](#streaming-source-compilation) |
50
+ | `onTransientDiagnostics` | `(diagnostics: Diagnostic[]) => void` | `LocalReactiveDocument` | Receives fixable issues from streaming snapshots; they never enter `onDiagnostics`. When generation finishes, hosts that received them get one final empty array. Omit to ignore provisional issues |
49
51
  | `compileOptions` | `LocalCompileOptions` | `LocalReactiveDocument` | Per-compilation limits, HTML capability flags and host component schemas; omitted options use the default ReactiveMD path |
50
52
  | `document` | `LocalDocument` | `LocalDocumentView` | Compiled document; compiled once by the host |
51
53
  | `runtime` | `LocalRuntime` | `LocalDocumentView` | Created by the host, which is responsible for disposal |
@@ -102,13 +104,13 @@ console.log(session.stats); // mode: 'incremental', compiledBlocks: 1, reusedBlo
102
104
  session.dispose(); // when closing the document
103
105
  ```
104
106
 
105
- `compile(source, options?)` returns `LocalCompileResult`. `clear()` releases reusable state; `dispose()` releases it and ends the session. Compiling after disposal throws. Each result is an independent, serializable plain-data snapshot, so mutating an earlier result cannot corrupt cached blocks. Unchanged blocks may retain node IDs across edits. Their numbering can differ from a separate `compileLocal()` call; resolve metadata IDs within the same result.
107
+ `compile(source, options?, phase?)` returns `LocalCompileResult`; see [Streaming source compilation](#streaming-source-compilation) for phases. `compileShared` exposes the compiler-owned read-only result graph used by the Worker and preview; callers must not mutate it, and `compile` publishes an independent plain-data snapshot instead. `clear()` releases reusable state; `dispose()` releases it and ends the session. Compiling after disposal throws. Each result is an independent, serializable plain-data snapshot, so mutating an earlier result cannot corrupt cached blocks. Unchanged blocks may retain node IDs across edits. Their numbering can differ from a separate `compileLocal()` call; resolve metadata IDs within the same result.
106
108
 
107
109
  With an unchanged declaration and binding context, only affected Markdown blocks are recompiled. Changes to declarations, component contents, options, permissions or host schemas trigger full compilation. Reference definitions, footnotes, navigation anchors, HTML, BOMs, code-delimiter changes and uncertain boundaries also use full compilation. Inputs producing diagnostics return the full compiler's diagnostics. Whole-document source and cumulative node budgets still apply, and only the current version is retained.
108
110
 
109
111
  During consecutive component or declaration edits, the session retains the latest successful full result and defers building its block index. The next independent prose edit builds the index once and reuses the other blocks. Identical source can return an independent cached snapshot. Option changes, errors, `clear()` and `dispose()` discard deferred state.
110
112
 
111
- `stats` reports the latest mode (`full`, `incremental`, or `cached`), block counts, reuse counts, compiled characters and an optional invalidation reason. `cacheBuilds` counts block-index construction attempts during the call, including deferred recovery. Changed blocks compile under the unchanged declaration prefix; that work is included in `compiledCharacters`. Source comparison, range relocation and complete result snapshot assembly still scale with document size.
113
+ `stats` reports the latest mode (`full`, `incremental`, `cached`, or `streaming`), block counts, reuse counts, compiled characters and an optional invalidation reason. `cacheBuilds` counts block-index construction attempts during the call, including deferred recovery. Changed blocks compile under the unchanged declaration prefix; that work is included in `compiledCharacters`. Source comparison, range relocation and complete result snapshot assembly still scale with document size.
112
114
 
113
115
  A document consisting of one flat list or table can also establish an incremental snapshot. Simple inline plans survive row edits; unchanged rows retain node IDs after semantic validation. Rows at unchanged offsets can share objects; shifted rows are cloned with updated UTF-16 ranges. Dynamic interpolation still uses the general parser. The cumulative `stats.parse.reusedRows` / `reusedItems` counters track inline plans, while `reusedRowNodes` / `reusedItemNodes` track final row subtrees separately.
114
116
 
@@ -116,6 +118,125 @@ When a result patch costs too much, the Worker can return a complete successful
116
118
 
117
119
  `startLocalCompileWorker()`, the default `LocalCompileScheduler` fallback, and `LocalReactiveDocument` manage their own sessions. A custom `fallbackCompile` remains host-owned. `compileLocal()` remains the one-shot full compiler. See the [implementation and measurements](../development/performance-overview-en.md).
118
120
 
121
+ ## Streaming source compilation
122
+
123
+ When a model, a collaborative replay or another producer grows a document in chunks, the host can submit the growing source to a compile session, scheduler, Worker or `LocalReactiveDocument` without waiting for the complete text. The engine accepts complete source snapshots and a phase marker only; token accumulation, model connections, conversation history, retries and cancellation stay with the host.
124
+
125
+ ### Snapshots and phases
126
+
127
+ Every submission is the complete source so far. The host appends tokens to its own buffer and submits that buffer at a throttling window or structural boundary; reconnecting or replacing a damaged fragment also submits complete text. The phase is:
128
+
129
+ ```ts
130
+ type LocalSourcePhase = 'streaming' | 'final';
131
+ ```
132
+
133
+ `streaming` means the current generation is unfinished; `final` means the source is complete. The phase may be supplied as `LocalCompileOptions.sourcePhase` or as an explicit session or scheduler argument. When both are omitted, compilation keeps the existing final semantics. Only these two values are accepted at runtime; sessions and `LocalCompileScheduler` return the same `local.options.invalid` failure for any other value instead of falling back to `final`. `sourcePhase` is not part of compile identity: it does not enter `localCompileOptionsKey` and does not change `strict`:
134
+
135
+ - `strict` still controls structural recovery of the final source only. `strict: false` is not a streaming mode; it recovers structures that remain damaged in the final source as literal text and reports warnings.
136
+ - `sourcePhase` reports whether the source is still being generated. A streaming snapshot degrades regions that cannot be interpreted safely to literal text while keeping node identity and source ranges for the completed prefix; an unfinished tail does not fail the whole preview. `strict: false` recovery records and warnings keep their existing rules and are not marked transient. `final` compiles the complete source under the selected strict mode.
137
+ - Unclosed tags, attribute quotes, component bodies, interpolations and formulas that are temporarily visible during streaming should not be rewritten into syntax repairs by the host; submit the completed source and compile it normally.
138
+
139
+ ### Status and transient diagnostics
140
+
141
+ Results for calls that supply an explicit phase add `status`; streaming results may also carry `transientDiagnostics`. Calls that omit the phase keep the existing result shape without either field. `diagnostics` always contains non-transient diagnostics only:
142
+
143
+ | Source phase | `status` | Result meaning |
144
+ | --- | --- | --- |
145
+ | `streaming` | `partial` | `ok: true`; returns the document that can be shown safely. Issues that later source can repair go to `transientDiagnostics`, and regions that cannot be interpreted safely stay literal. |
146
+ | `streaming` + deterministic error | `failed` | `ok: false`; only deterministic errors remain in `diagnostics`: options, source type or length, syntax version, budgets, native-HTML/security policy, configuration, registry and capability failures, plus internal parse failures (`local.parse.*`). |
147
+ | `final` | `valid` | Complete compilation succeeded without structural recovery. |
148
+ | `final` + `strict: false` recovery | `recovered` | Returns the document, `recoveries` and one warning per recovery. |
149
+ | `final` | `failed` | Keeps the final compilation error rules; errors are not marked transient. |
150
+
151
+ Transient diagnostics keep their original `code`, `message` and source range and appear only in `transientDiagnostics`; loose-mode recovery warnings keep their final diagnostic rules and are never copied into the transient list. Consumers should use `status` and the explicit fields instead of inferring the phase from diagnostic text. A streaming success may temporarily contain unclosed structures or unevaluated expressions; on `final`, clear the host's transient state and use the final `diagnostics`. Deterministic errors still fail immediately and are not repairable placeholders.
152
+
153
+ ### Sessions, schedulers and Workers
154
+
155
+ ```ts
156
+ import { LocalCompileScheduler, createLocalCompileSession } from 'reactive-md';
157
+
158
+ const session = createLocalCompileSession();
159
+ const partial = session.compile(snapshot, options, 'streaming');
160
+ if (partial.status === 'partial') {
161
+ render(partial.document);
162
+ showTransient(partial.transientDiagnostics ?? []);
163
+ }
164
+
165
+ const final = session.compile(completedSource, options, 'final');
166
+ if (final.status === 'valid' || final.status === 'recovered') {
167
+ clearTransient();
168
+ render(final.document);
169
+ }
170
+ ```
171
+
172
+ The explicit `phase` of `compile(source, options?, phase?)` and `compileShared(source, options?, phase?)` wins over `options.sourcePhase`. An explicit `final` uses the same final compilation path as an omitted phase and only adds `status`.
173
+
174
+ `LocalCompileScheduler.schedule(source, options?, hint?, phase?)` follows the same phases:
175
+
176
+ ```ts
177
+ const scheduler = new LocalCompileScheduler({
178
+ createWorker: () => new Worker(new URL('./compile.worker.ts', import.meta.url), { type: 'module' }),
179
+ onResult: ({ result, sourcePhase }) => applySnapshot(result, sourcePhase),
180
+ delay: 150,
181
+ });
182
+
183
+ scheduler.schedule(snapshot, options, undefined, 'streaming');
184
+ scheduler.schedule(completedSource, options, undefined, 'final');
185
+ ```
186
+
187
+ - Streaming snapshots share the scheduler's throttle window (`LOCAL_COMPILE_DELAY_MS`, 150 ms by default) and only the latest queued snapshot is kept; no compilation runs per token.
188
+ - `final` bypasses the debounce and queues immediately. It may wait for an in-flight compile, but the older result cannot be delivered because the phase is part of job identity; monotonic revisions keep later responses from overwriting earlier accepted state.
189
+ - Revisions increase monotonically, and a stale Worker response cannot update the current preview. Streaming jobs never join the `patch-v1` baseline; scheduling a streaming snapshot invalidates the existing baseline, and only a final result can establish a patch baseline.
190
+ - Worker full requests and responses echo `sourcePhase` whenever a phase was declared; phase-less legacy jobs keep the historical wire shape and omit it. A phase on the options object is honored the same way. `LocalCompileOutcome.sourcePhase` reports the result phase. Main-thread fallback uses the same semantics; a custom `fallbackCompile` receives the phase as its third argument.
191
+ - Worker patch retries use `retryFull` with the codes `stale-base`, `options-mismatch`, `invalid-edit` or `phase-mismatch`; the scheduler falls back to one complete request instead of trusting a misaligned patch.
192
+
193
+ Streaming snapshots never read or populate the final block, deferred-index or shared-result caches; a final compile always starts from the existing incremental or full path. Lower-level parser caches keyed by exact source text may still serve both phases, because they are pure functions of that text and options. Streaming jobs may reuse the last result for an identical snapshot, but do not depend on block-level reuse across snapshots.
194
+
195
+ ### React hosts
196
+
197
+ ```tsx
198
+ import { useState } from 'react';
199
+ import type { Diagnostic, LocalSourcePhase } from 'reactive-md';
200
+ import { LocalReactiveDocument } from 'reactive-md/react';
201
+
202
+ export function StreamedArticle({ source, phase }: {
203
+ source: string;
204
+ phase: LocalSourcePhase;
205
+ }) {
206
+ const [transient, setTransient] = useState<Diagnostic[]>([]);
207
+ const [diagnostics, setDiagnostics] = useState<Diagnostic[]>([]);
208
+
209
+ return (
210
+ <>
211
+ <LocalReactiveDocument
212
+ source={source}
213
+ sourcePhase={phase}
214
+ onTransientDiagnostics={setTransient}
215
+ onDiagnostics={setDiagnostics}
216
+ />
217
+ {transient.length > 0 && <p>{transient.length} provisional issues</p>}
218
+ {phase === 'final' && diagnostics.length > 0 && <p>Compilation failed; see diagnostics.</p>}
219
+ </>
220
+ );
221
+ }
222
+ ```
223
+
224
+ While streaming, `LocalReactiveDocument` renders with `mode="static"`: controls are read-only, network sessions are not established, and submissions, resets and other component side effects do not start. It still reuses the same compile session and runtime, and ordinary source updates retain compatible reader values and input drafts through the existing migration rules; a phase change does not rebuild the runtime or reset state. `final` restores the host's `mode`, `staticFirst` and full interaction. `onDiagnostics` carries non-transient diagnostics for the current snapshot; provisional issues never enter that channel. `onTransientDiagnostics` reports provisional issues only; if the host received any, finalization calls it once more with an empty array, and a later streaming snapshot without provisional issues retracts the same way. Deterministic failures still show the existing error notice.
225
+
226
+ The host must write each new snapshot to `source` and switch `sourcePhase` back to `final` when generation ends. On cancellation, document switches or unmount, stop submitting and discard old results; the engine validates revisions and phases only and does not manage generation rounds.
227
+
228
+ ### Security boundaries
229
+
230
+ Streaming compilation does not change the document security model:
231
+
232
+ - The host owns model transport, credentials, retries and cancellation. ReactiveMD receives text snapshots only; it does not connect to model services or add network requests or code execution for streaming.
233
+ - `streaming` does not enable author HTML, scripts, CSS or other language capabilities; the host still grants them through explicit compile options. Deterministic security, configuration, version and budget errors remain final failures.
234
+ - During streaming, side-effecting components are deferred by static mode so incomplete content cannot submit, subscribe or perform other external actions; full interaction returns on `final`. Hosts still enforce their own permissions, CSP and untrusted-content policies.
235
+
236
+ ### Performance expectations
237
+
238
+ Every accepted streaming snapshot compiles the complete source. Regions that cannot be interpreted safely are degraded to literal text through up to six stabilization passes, followed by one whole-source literal compile when damage persists; this path does not promise block-level incremental cost. The scheduler throttles and coalesces snapshots, and `final` queues immediately. Source still respects the 1,000,000-character limit and compile budgets; longer snapshots cost more per compile. Measure input-to-preview latency and compile volume on long documents, then tune the host's submission window accordingly; do not call a compile entry per token. The repository benchmark `npm run bench:streaming` reports, for a 15.5 KB / 227-block document in 64-character chunks, p50 ≈ 15–23 ms and p95 ≈ 33–53 ms per streaming snapshot across runs, exact final equality with one-shot compilation, and about 31 coalesced submissions under a 150 ms window. Treat these numbers as a baseline, not a cross-machine SLO.
239
+
119
240
  ## Strict parsing and local recovery
120
241
 
121
242
  The `strict` option controls structural recovery in compiler factories, `compileLocal`, editing sessions and Workers. It defaults to `true`; omission and explicit `undefined` use the same default. Other non-boolean values are configuration errors.
@@ -436,9 +557,9 @@ const scheduler = new LocalCompileScheduler({
436
557
  scheduler.schedule(source);
437
558
  ```
438
559
 
439
- `LocalCompileScheduler` coalesces edits for `LOCAL_COMPILE_DELAY_MS` (150 ms; override with `delay`), keeps one compile in flight plus only the latest queued source, and discards results that a newer edit has superseded. When no worker is available, or after a worker error, it compiles on the main thread with `fallbackCompile`, which defaults to `compileLocal`; a worker failure switches permanently to this fallback and reports it through `onModeChange`. Failures thrown by the worker or during fallback compilation use the `local.worker.compile` diagnostic code.
560
+ `LocalCompileScheduler` coalesces edits for `LOCAL_COMPILE_DELAY_MS` (150 ms; override with `delay`), keeps one compile in flight plus only the latest queued source, and discards results that a newer edit has superseded. When no worker is available, or after a worker error, it compiles on the main thread with `fallbackCompile`; the default is an internal session-backed compile with the same results as `compileLocal`, without cross-call reuse. A worker failure switches permanently to this fallback and reports it through `onModeChange`. Failures thrown by the worker or during fallback compilation use the `local.worker.compile` diagnostic code. Use `schedule(source, options?, hint?, phase?)` for streaming snapshots; `final` bypasses the debounce. See [Streaming source compilation](#streaming-source-compilation).
440
561
 
441
- `onResult` receives `LocalCompileOutcome` (`source`, `result`, `duration`, `mode`), `onPendingChange` reports whether work is queued or in flight, and `dispose()` stops the timer, terminates the worker and suppresses later callbacks.
562
+ `onResult` receives `LocalCompileOutcome` (`source`, `result`, `duration`, `mode`, `sourcePhase`), `onPendingChange` reports whether work is queued or in flight, and `dispose()` stops the timer, terminates the worker and suppresses later callbacks.
442
563
 
443
564
  ### Other core exports
444
565
 
@@ -451,7 +572,8 @@ scheduler.schedule(source);
451
572
  - Source revisions: `inspectLocalSourceVersion`, `checkLocalUpgrade` and `migrateLocalSource`; `LocalUpgradeOptions` configures the source revision and semantic-change allowance.
452
573
  - Retention: `planLocalStateRetention` and `applyLocalStateRetention`.
453
574
  - Background compilation: `LocalCompileScheduler`, `LOCAL_COMPILE_DELAY_MS` and `startLocalCompileWorker`.
454
- - Type exports: `Diagnostic`, `SourceRange`, `LocalValue`, `LocalValueKind`, `LocalNode`, `LocalBinding`, `LocalComputation`, `LocalValidation`, `LocalDocument`, `LocalCompileLimits`, `LocalCompileOptions`, `LocalCompileResult`, `LocalHostPropKind`, `LocalHostPropSchema`, `LocalHostComponentForm`, `LocalHostBindingSchema`, `LocalHostComponentSchema`, `LocalExternal`, `LocalDynamicConstraint`, `LocalDynamicConstraints`, `LocalRuntimeOptions`, `LocalUpgradeOptions`, `LocalRuntime`, `LocalSnapshot`, `LocalStateFile`, `LocalStateGenerator`, `LocalStateParseResult`, `LocalStateResolution`, `LocalRetainedState`, `LocalStateRetentionReason`, `LocalStateRetentionDrop`, `LocalStateRetentionInput`, `LocalStateRetentionResult`, `LocalCompileWorker`, `LocalCompileWorkerScope`, `LocalCompileRequest`, `LocalCompileResponse`, `LocalCompileOutcome`, `LocalCompileMode`, `LocalCompileSchedulerOptions`.
575
+ - Streaming phases: `LocalSourcePhase`, `LocalCompileStatus`; the `status` and `transientDiagnostics` fields on explicit-phase results.
576
+ - Type exports: `Diagnostic`, `SourceRange`, `LocalValue`, `LocalValueKind`, `LocalNode`, `LocalBinding`, `LocalComputation`, `LocalValidation`, `LocalDocument`, `LocalCompileLimits`, `LocalCompileOptions`, `LocalCompileResult`, `LocalSourcePhase`, `LocalCompileStatus`, `LocalHostPropKind`, `LocalHostPropSchema`, `LocalHostComponentForm`, `LocalHostBindingSchema`, `LocalHostComponentSchema`, `LocalExternal`, `LocalDynamicConstraint`, `LocalDynamicConstraints`, `LocalRuntimeOptions`, `LocalUpgradeOptions`, `LocalRuntime`, `LocalSnapshot`, `LocalStateFile`, `LocalStateGenerator`, `LocalStateParseResult`, `LocalStateResolution`, `LocalRetainedState`, `LocalStateRetentionReason`, `LocalStateRetentionDrop`, `LocalStateRetentionInput`, `LocalStateRetentionResult`, `LocalCompileWorker`, `LocalCompileWorkerScope`, `LocalCompileRequest`, `LocalCompileResponse`, `LocalCompileOutcome`, `LocalCompileMode`, `LocalCompileSchedulerOptions`.
455
577
 
456
578
  `compileExpression`, `compileLatex` and `samplePlot` are lower-level utilities with the same stability level as the core API; usually only `compileLocal` and `createLocalRuntime` are needed.
457
579
 
@@ -530,9 +652,9 @@ These limits bound the work for a single document; they do not replace host cont
530
652
 
531
653
  ## Features not provided
532
654
 
533
- The default ReactiveMD path supports P0 HTML. Host options for author CSS, JavaScript and extended HTML use the separate native HTML path described in [HTML compatibility](../reference/html-compatibility-en.md). Automatic state persistence, unrestricted network/storage calls, Vue, React 18 and CommonJS remain outside the current API. Hosts declare read-only values and invoke state export/import explicitly.
655
+ ReactiveMD supports P0 HTML and independent author capabilities. See [HTML compatibility](../reference/html-compatibility-en.md). Automatic state persistence, unrestricted network/storage calls, Vue, React 18 and CommonJS remain outside the current API. Hosts declare read-only values and invoke state export/import explicitly.
534
656
 
535
- The source [extension SDK](extension-sdk-en.md) provides custom component and theme package registration in `reactive-md@0.8.0`; follow the [component plugin development guide](../development/component-development-en.md). On ordinary source edits, `LocalReactiveDocument` tries to adopt the new document and retain compatible bindings. Use a new React `key` for independent documents, or manage documents and runtimes in the host.
657
+ The source [extension SDK](extension-sdk-en.md) provides custom component and theme package registration since `reactive-md@0.8.0`; follow the [component plugin development guide](../development/component-development-en.md). On ordinary source edits, `LocalReactiveDocument` tries to adopt the new document and retain compatible bindings. Use a new React `key` for independent documents, or manage documents and runtimes in the host.
536
658
 
537
659
 
538
660
  See the [syntax specification](../reference/local-interaction-syntax-en.md) for the component tags, color options and slot state.
@@ -6,7 +6,9 @@
6
6
 
7
7
  ## 导出产物
8
8
 
9
- 默认 ReactiveMD 文档遵循下述导出规则。原生 HTML 文档的交互导出保留 `compileOptions` 和整篇 HTML 路径,静态导出禁用作者 JavaScript;这类文档没有 ReactiveMD 参数。编译开关、隔离和暂时性分流政策见 [HTML 部分兼容](../reference/html-compatibility-ch.md)。
9
+ 交互导出保存 RMD 状态基线、能力开关与 `sourceSemantics: "mixed-rmd-v1"`。运行时按旧语义读取历史导出。静态导出使用选择的状态而不启动作者脚本。参见 [HTML 兼容](../reference/html-compatibility-ch.md)。
10
+
11
+ 直接调用 `createShareableHtml` 时,请用与导出一致的 CSS 和扩展 HTML 授权渲染 `staticMarkup`。导出关闭某项能力时,函数会拒绝仍使用该能力的快照。
10
12
 
11
13
  **交互式 HTML** 是一个自包含的 `.html` 文件。它内嵌原始源码、独立浏览器运行时、React 19、样式表和打印样式。读者通过 `file://` 打开即可交互,不需要 Node.js、React、reactive-md 包或网络连接。
12
14
 
@@ -288,7 +290,7 @@ Demo 的 `vite.export-assets.ts` 用它把样式表、打印样式表、notices
288
290
 
289
291
  ## 产物体积基线
290
292
 
291
- 在引擎源码目录完成构建后,运行 `node scripts/verify-shareable.mjs` 检查静态首屏水合并测量原始及 gzip 体积。当前体积阈值以 0.9.0 默认预设的构建为基线。
293
+ 在引擎源码目录完成构建后,运行 `node scripts/verify-shareable.mjs` 检查静态首屏水合并测量原始及 gzip 体积。体积阈值以当前完整预设构建为基线。
292
294
 
293
295
  | 产物 | 当前基线 | 报警阈值 |
294
296
  | --- | --- | --- |
@@ -6,7 +6,9 @@ This guide covers the single-file HTML exporter introduced with `local-draft-2`.
6
6
 
7
7
  ## Output modes
8
8
 
9
- The rules below describe default ReactiveMD documents. Native HTML interactive export preserves `compileOptions` and whole-document HTML routing; static export disables author JavaScript. These documents have no ReactiveMD parameters. See [HTML compatibility](../reference/html-compatibility-en.md) for capability flags, isolation and the temporary routing policy.
9
+ Interactive exports save the RMD state baseline, capability flags and `sourceSemantics: "mixed-rmd-v1"`. The runtime’s legacy reader preserves the original interpretation of older exports. Static output uses the selected state without executing author scripts. See [HTML compatibility](../reference/html-compatibility-en.md).
10
+
11
+ When calling `createShareableHtml` directly, render `staticMarkup` with the same CSS and Extended HTML grants as the export. The function rejects a snapshot that still uses a capability disabled for the export.
10
12
 
11
13
  **Interactive HTML** is one self-contained `.html` file. It embeds the original source, the standalone browser runtime, React 19, the current stylesheet and print styles. Readers can open it through `file://` without Node.js, React, the reactive-md package or network access.
12
14
 
@@ -290,7 +292,7 @@ The demo's `vite.export-assets.ts` uses it to expose the stylesheet, print style
290
292
 
291
293
  ## Bundle baseline
292
294
 
293
- In the engine checkout, run `node scripts/verify-shareable.mjs` after building. It tests static-first hydration and reports the raw and gzip sizes. The 0.9.0 full-preset build sets the baseline for the current size limits.
295
+ In the engine checkout, run `node scripts/verify-shareable.mjs` after building. It tests static-first hydration and reports the raw and gzip sizes. The current full-preset build sets the baseline for the current size limits.
294
296
 
295
297
  | Artifact | Current baseline | Alarm |
296
298
  | --- | --- | --- |
@@ -1,60 +1,28 @@
1
- # HTML 部分兼容与暂时性分流政策
1
+ # HTML 兼容与作者能力
2
2
 
3
3
  **中文** · [English](html-compatibility-en.md)
4
4
 
5
- 此功能面向下个发行版。默认文档继续使用 Markdown、ReactiveMD 控件和表达式,并支持下表中的 P0 HTML。CSS、JavaScript 和扩展 HTML 由宿主分别开启,默认全部关闭。
6
-
7
- `strict: false` 可在默认文档路径中启用[局部结构恢复](../integration/local-integration-ch.md#严格解析与局部恢复),无需开启上述能力。`details` 的 `summary` 与正文可连续换行,呈现为单个 disclosure 的 accordion,支持富文本标题和键盘切换。
8
-
9
- ## 暂时性分流政策
10
-
11
- 为了避开作者 CSS、JavaScript、扩展 HTML 与 ReactiveMD 之间的混合解析和渲染冲突,本版采用整篇分流:
12
-
13
- | 编译选项 | 文档行为 |
14
- | --- | --- |
15
- | 三个开关全部关闭或省略 | 使用 ReactiveMD 解析器和现有 React 渲染器,支持 P0 HTML |
16
- | 任意一个开关为 `true` | 整篇源码按原生 HTML 处理,在隔离的 iframe 中渲染 |
17
-
18
- 原生 HTML 路径中的 `# 标题`、`**强调**`、LaTeX 和 `{{ 表达式 }}` 保持普通文本;`<input>`、`<table>` 等按 HTML 语义处理,ReactiveMD 组件不建立绑定。关闭全部开关会重新编译回默认模式。此政策是本版的过渡方案,后续版本再评估混合兼容。
19
-
20
- 开关是宿主能力设置,源码、参数状态文件和文档标签不能自行开启它们。Demo 始终显示当前模式,刷新页面后回到三个开关全部关闭的状态。
21
-
22
- ## 开关与 API
23
-
24
- ```ts
25
- import { compileLocal } from 'reactive-md';
26
-
27
- // Markdown、ReactiveMD 与 P0 HTML。
28
- const reactive = compileLocal(source);
29
-
30
- // 整篇按原生 HTML 处理;只允许作者 CSS。
31
- const html = compileLocal(source, {
32
- enableCss: true,
33
- enableJavaScript: false,
34
- enableExtendedHtml: false,
35
- });
36
- ```
5
+ 同一份文档可混排 Markdown、RMD 组件、表达式和基础 HTML。宿主独立控制三项能力。
37
6
 
38
7
  | 选项 | 默认值 | 作用 |
39
8
  | --- | --- | --- |
40
- | `enableCss` | `false` | 允许作者 CSS |
41
- | `enableJavaScript` | `false` | 允许作者脚本和事件处理代码 |
42
- | `enableExtendedHtml` | `false` | 允许 P1 标签、嵌入、表单、SVG/MathML 和整页 HTML 功能 |
9
+ | `enableCss` | `true` | 文档样式、组件行内声明及获准 HTML 片段中的样式 |
10
+ | `enableJavaScript` | `false` | 在交互挂载时执行作者脚本 |
11
+ | `enableExtendedHtml` | `false` | 允许额外的原生 HTML 片段 |
43
12
 
44
- 选项必须是布尔值。开启一个开关不会顺带开启其他两个。带样式的扩展元素需要同时允许扩展 HTML 和 CSS;扩展元素中的脚本需要同时允许扩展 HTML 和 JavaScript。内置组件使用的样式、交互代码、图表 SVG 和公式 MathML 不受作者能力开关影响。
13
+ 源码视图从 `LocalReactiveDocument.compileOptions` 取得授权。预编译视图通过 `LocalDocumentView.capabilityGrants` 授权,缺省为 CSS 开、JavaScript 关、扩展 HTML 关。每项能力需要编译与当前挂载同时允许。单独切换开关保留源码视图的运行时状态。
45
14
 
46
- 现有源码长度和 `limits.maxSyntaxNodes` 预算继续生效。HTML 路径按解析遍历的节点计数,嵌套 `srcdoc` 共用累计预算。
15
+ ### 样式
47
16
 
48
- React 快捷组件通过 `compileOptions` 接收同样的设置:
17
+ 在正文前放一个或多个成对的 `<css>` 块,按源码顺序层叠。组件实例的 `css` 属性接收 CSS 声明,应用到可见根。文档选择器止于嵌套文档根,DOM 的 CSS 继承照常生效。作者样式使用文内规则,外链样式表和样式资源请求受策略过滤。迟置样式块和无可见根的组件会收到定点诊断。已注册的 `css`、`javascript` 组件保留各自的标签,组件 schema 自行定义的 `css` 属性保留原有语义。
49
18
 
50
- ```tsx
51
- <LocalReactiveDocument
52
- source={source}
53
- compileOptions={{ enableCss: true }}
54
- />
55
- ```
19
+ ### 脚本
20
+
21
+ 用成对的 `<javascript>` 声明代码。交互运行时恢复状态后,隔离 Worker 按源码顺序执行脚本。每个块有自己的词法作用域。通过 `await rmd.get(name)` 读取命名绑定,通过 `await rmd.set(name, value)` 写入单项,或通过 `await rmd.setMany(values)` 原子更新多项。写入沿用组件的约束和只读规则。
56
22
 
57
- 底层宿主把 `compileLocal` 生成的文档交给 `LocalDocumentView`。原生 HTML 文档的 `document.html` 记录三个归一化开关;参数和绑定集合为空。该字段属于运行时元数据,保存文档时保留原始源码和宿主设置。
23
+ 通过计数器的 `action-id` 命名实例。调用 `rmd.handleAction(id, "increment", callback)` 接管该实例的增加动作。计数器还提供 `decrement` 和 `reset`。用 `rmd.observeAction` 观察动作,默认处理照常运行。替换脚本、撤销授权或卸载文档时清理会话。静态 HTML、PDF 和 hydration 的静态阶段使用给定的 RMD 状态。
24
+
25
+ 异步预览重新编译时,可用 `LocalDocumentView.authorScriptPaused` 暂停作者动作和绑定请求。确认脚本未变后恢复原会话。撤销计数器 `action-id` 的删除后,同一脚本会话可继续接管这个动作。
58
26
 
59
27
  ## 默认支持的 P0 HTML
60
28
 
@@ -83,7 +51,7 @@ React 快捷组件通过 `compileOptions` 接收同样的设置:
83
51
  <p align="right">右对齐的 **Markdown** 段落。</p>
84
52
  ```
85
53
 
86
- 对齐不需要开启 CSS 或扩展 HTML,容器内的 Markdown 和绑定继续生效;嵌套元素可以设置自己的对齐。原生 HTML 路径同样接受这些限定值。
54
+ 对齐不需要开启 CSS 或扩展 HTML,容器内的 Markdown 和绑定继续生效;嵌套元素可以设置自己的对齐。
87
55
 
88
56
  通用属性按允许列表接收,支持文档标识、标题、语言、方向和可访问性属性。默认模式中的作者 `style`、事件处理属性及不支持的标签保持惰性源码或产生定位诊断。图片仍需宿主明确允许后才加载。代码与不支持区域不执行脚本。
89
57
 
@@ -114,27 +82,12 @@ React 快捷组件通过 `compileOptions` 接收同样的设置:
114
82
 
115
83
  无法编译的局部原生 HTML 按原文显示,其余 Markdown、公式和控件继续工作。回退覆盖不支持的标签或属性、无效的原生表格,以及缺少完整结束标记的 HTML 片段。无法找到结束标签时,片段截至当前段落或外层 ReactiveMD 容器的结束标签。回退片段中的 Markdown、`{{ 表达式 }}`、组件和脚本均保留为文本。
116
84
 
117
- 原生 HTML 路径中,不支持的属性会使所在元素回退为原文;相邻元素继续渲染。整篇解析、序列化或编译预算检查失败时,React 预览和 standalone 挂载显示完整源码,保留换行并转义标签。`compileLocal` 的错误结果、资源限制和 `onDiagnostics` 诊断仍保留;配置错误及 ReactiveMD 组件语法错误继续按原规则处理。
118
-
119
- ## 扩展 HTML
120
-
121
- `enableExtendedHtml` 管理以下作者语法:
122
-
123
- - 定义列表:`dl`、`dt`、`dd`。
124
- - 补充文字语义:`small`、`kbd`、`samp`、`var`、`abbr`、`q`、`cite`、`ins`。
125
- - 图文和结构:`figure`、`figcaption`、`article`、`section`、`aside`、`header`、`footer`、`ruby`、`rt`、`rp`、`wbr`。
126
- - 原生表单、`iframe`、`object`、`embed`、`dialog`、任意 SVG/MathML 和整页 HTML 功能。
127
-
128
- 在默认模式中,ReactiveMD `<table>` 按正文结构与原生表格区分;`<section>`、`<input>`、`<select>` 等同名组件继续采用当前语义。在原生 HTML 模式中,同名元素采用浏览器语义。
129
-
130
- ## 隔离与导出
131
-
132
- 作者 HTML 放在不带 `allow-same-origin` 的沙箱 iframe 中。源码中的整页结构、样式和脚本作用于该隔离文档。资源加载、表单提交和导航仍受 CSP 与沙箱限制;启用扩展 HTML 不代表获得全部网络能力。
85
+ ## 扩展 HTML 与导出
133
86
 
134
- 本版支持内联 CSS 和 JavaScript,自动外部资源请求仍受限:外部脚本、样式表、图片、媒体及嵌入资源不会因开启开关而自动加载。扩展 HTML 允许隔离文档中的 HTTP(S) 表单提交和 `<base>` 地址解析,保留顶层导航与宿主访问限制。iframe 可用 `srcdoc` 提供内联内容;`object`、`embed` 的外部资源仍受 CSP 限制。
87
+ 已注册组件优先。比如 `<input bind="name">` 仍是 RMD 输入框,`details` 的正文继续支持 Markdown 和表达式。净化后的普通定义列表等结构直接进入文档,包含嵌入、作者脚本或样式的片段由沙箱承载。未获准的片段在原位置显示转义源码。
135
88
 
136
- 启用任意 JavaScript 后,脚本可以动态创建元素和样式,另两个开关主要约束作者源码。宿主隔离仍有效,但这些开关不承诺逐项阻止脚本的运行时 DOM 操作。
89
+ 自包含嵌入可用经净化的 `srcdoc`。通过挂载参数 `allowedFrameOrigins` 开放精确的 HTTPS 来源。片段样式和脚本继续受对应开关管理,沙箱约束导航、表单和对父文档的访问。
137
90
 
138
- 交互导出保留本次编译选项和文档路径。原生 HTML 的静态导出保留浏览器内建的折叠和表单行为,并禁用作者 JavaScript。这类文档没有可保存的 ReactiveMD 参数。旧导出载荷省略编译选项时采用三个开关全部关闭的默认行为。
91
+ 新版交互导出记录 `sourceSemantics: "mixed-rmd-v1"`、开关和状态基线。缺少该字段的 v1/v2 导出按原语义打开,包含此前显式开启能力时的整页 HTML 路径。载荷的 v1/v2 继续区分恢复契约。
139
92
 
140
- 相关规则见[集成说明](../integration/local-integration-ch.md)、[可分享导出](../integration/shareable-export-ch.md)和[安全约定](../../SECURITY-ch.md)。
93
+ 参见[集成说明](../integration/local-integration-ch.md)、[可分享导出](../integration/shareable-export-ch.md)和[安全约定](../../SECURITY-ch.md)。