@openclaw/feishu 2026.10.2 → 2026.10.5-beta.2

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 (325) hide show
  1. package/dist/.setup/{app-registration-BB6TubaW.mjs → app-registration-DQOq5urV.mjs} +13 -32
  2. package/dist/.setup/{channel-DZakdZ3r.mjs → channel-CjGGyrdx.mjs} +87 -174
  3. package/dist/.setup/{channel.runtime-rXFuQXLL.mjs → channel.runtime-SaC_uTPM.mjs} +57 -74
  4. package/dist/.setup/{chat-mTBvMMvx.mjs → chat-fC3dvxFs.mjs} +16 -28
  5. package/dist/.setup/{client-CcxmEkoy.mjs → client-wwr8PGPH.mjs} +24 -30
  6. package/dist/.setup/{conversation-id-C1ofUfU8.mjs → conversation-id-D00i9uy5.mjs} +5 -10
  7. package/dist/.setup/{doctor-contract-DyOo8NvC.mjs → doctor-contract-oIpUWtNO.mjs} +8 -15
  8. package/dist/.setup/{monitor-CXaFHMmi.mjs → monitor-Yt__BUki.mjs} +33 -54
  9. package/dist/.setup/{monitor.account-cJ8gavqv.mjs → monitor.account-CVz16781.mjs} +359 -658
  10. package/dist/.setup/{probe-BjSykXB8.mjs → probe-DXnFxq5j.mjs} +14 -17
  11. package/dist/.setup/{reply-delivery-result-laBNOmBu.mjs → reply-delivery-result-iCCrdxE1.mjs} +153 -181
  12. package/dist/.setup/{session-conversation-C53IEUWt.mjs → session-conversation-BSBNK5Mq.mjs} +1 -1
  13. package/dist/.setup/{setup-api-fZcYXGxe.mjs → setup-api-B_LFQQ-Q.mjs} +1 -1
  14. package/dist/.setup/{subagent-hooks-C8Z_x3KJ.mjs → subagent-hooks-9Pc1-k37.mjs} +7 -17
  15. package/dist/.setup/{thread-bindings-jW2x5VuN.mjs → thread-bindings-DdNLxoL3.mjs} +21 -44
  16. package/dist/api.js +218 -326
  17. package/dist/channel-plugin-api.js +1 -1
  18. package/dist/contract-api.js +1 -1
  19. package/dist/doctor-contract-api.js +1 -1
  20. package/dist/session-binding-contract-api.js +1 -1
  21. package/dist/session-key-api.js +1 -1
  22. package/dist/setup-api.js +1 -1
  23. package/dist/setup-entry.js +1 -1
  24. package/dist/subagent-hooks-api.js +1 -1
  25. package/node_modules/@openclaw/fs-safe/CHANGELOG.md +35 -0
  26. package/node_modules/@openclaw/fs-safe/README.md +1 -1
  27. package/node_modules/@openclaw/fs-safe/dist/advanced.d.ts +1 -1
  28. package/node_modules/@openclaw/fs-safe/dist/advanced.js +1 -1
  29. package/node_modules/@openclaw/fs-safe/dist/archive-durability.js +1 -1
  30. package/node_modules/@openclaw/fs-safe/dist/archive-merge.js +4 -4
  31. package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
  32. package/node_modules/@openclaw/fs-safe/dist/archive-read.js +5 -4
  33. package/node_modules/@openclaw/fs-safe/dist/archive-staging.d.ts +1 -1
  34. package/node_modules/@openclaw/fs-safe/dist/archive-staging.js +22 -38
  35. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.d.ts +17 -0
  36. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.js +117 -0
  37. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.d.ts +8 -5
  38. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.js +27 -50
  39. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.d.ts +3 -0
  40. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.js +57 -11
  41. package/node_modules/@openclaw/fs-safe/dist/guarded-mutation.js +5 -5
  42. package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +52 -5
  43. package/node_modules/@openclaw/fs-safe/dist/guest.js +1 -1
  44. package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +1 -0
  45. package/node_modules/@openclaw/fs-safe/dist/native-operations.d.ts +0 -1
  46. package/node_modules/@openclaw/fs-safe/dist/native-operations.js +22 -26
  47. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.js +5 -1
  48. package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +4 -1
  49. package/node_modules/@openclaw/fs-safe/dist/permission-exec.js +2 -1
  50. package/node_modules/@openclaw/fs-safe/dist/pinned-write-types.d.ts +6 -1
  51. package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.js +2 -2
  52. package/node_modules/@openclaw/fs-safe/dist/publish-file.js +34 -7
  53. package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-fallback.js +1 -4
  54. package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +6 -0
  55. package/node_modules/@openclaw/fs-safe/dist/root-create-input.d.ts +15 -1
  56. package/node_modules/@openclaw/fs-safe/dist/root-create-input.js +4 -0
  57. package/node_modules/@openclaw/fs-safe/dist/root-directory-entry.js +1 -1
  58. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.d.ts +0 -1
  59. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +6 -12
  60. package/node_modules/@openclaw/fs-safe/dist/root-impl.js +15 -15
  61. package/node_modules/@openclaw/fs-safe/dist/root-paths.js +1 -1
  62. package/node_modules/@openclaw/fs-safe/dist/root-walk.js +4 -4
  63. package/node_modules/@openclaw/fs-safe/dist/root-write-verification.d.ts +10 -1
  64. package/node_modules/@openclaw/fs-safe/dist/root-write-verification.js +20 -0
  65. package/node_modules/@openclaw/fs-safe/dist/secure-temp-dir.js +19 -7
  66. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-acquire.js +25 -3
  67. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-admission.d.ts +2 -0
  68. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.d.ts +14 -0
  69. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.js +187 -0
  70. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock.js +15 -1
  71. package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.d.ts +10 -0
  72. package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.js +29 -0
  73. package/node_modules/@openclaw/fs-safe/dist/temp-target.js +1 -1
  74. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-admission.js +6 -6
  75. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.d.ts +4 -4
  76. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +17 -16
  77. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.js +20 -28
  78. package/node_modules/@openclaw/fs-safe/dist/walk.js +2 -13
  79. package/node_modules/@openclaw/fs-safe/dist/watch-native.d.ts +2 -2
  80. package/node_modules/@openclaw/fs-safe/dist/watch-native.js +3 -1
  81. package/node_modules/@openclaw/fs-safe/dist/watch-rescan.js +3 -9
  82. package/node_modules/@openclaw/fs-safe/dist/watch.js +2 -3
  83. package/node_modules/@openclaw/fs-safe/docs/advanced.md +1 -1
  84. package/node_modules/@openclaw/fs-safe/docs/archive.md +3 -0
  85. package/node_modules/@openclaw/fs-safe/docs/atomic.md +11 -3
  86. package/node_modules/@openclaw/fs-safe/docs/contributing.md +1 -1
  87. package/node_modules/@openclaw/fs-safe/docs/copy.md +48 -0
  88. package/node_modules/@openclaw/fs-safe/docs/guest.md +21 -4
  89. package/node_modules/@openclaw/fs-safe/docs/path-scope.md +4 -0
  90. package/node_modules/@openclaw/fs-safe/docs/sidecar-lock.md +46 -8
  91. package/node_modules/@openclaw/fs-safe/docs/temp.md +12 -0
  92. package/node_modules/@openclaw/fs-safe/docs/watch.md +3 -2
  93. package/node_modules/@openclaw/fs-safe/package.json +15 -15
  94. package/node_modules/@openclaw/fs-safe-darwin-arm64/fs-safe-native.node +0 -0
  95. package/node_modules/@openclaw/fs-safe-darwin-arm64/package.json +1 -1
  96. package/node_modules/@openclaw/fs-safe-darwin-x64/fs-safe-native.node +0 -0
  97. package/node_modules/@openclaw/fs-safe-darwin-x64/package.json +1 -1
  98. package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/fs-safe-native.node +0 -0
  99. package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/package.json +1 -1
  100. package/node_modules/@openclaw/fs-safe-linux-arm64-musl/fs-safe-native.node +0 -0
  101. package/node_modules/@openclaw/fs-safe-linux-arm64-musl/package.json +1 -1
  102. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/fs-safe-native.node +0 -0
  103. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/package.json +1 -1
  104. package/node_modules/@openclaw/fs-safe-linux-x64-musl/fs-safe-native.node +0 -0
  105. package/node_modules/@openclaw/fs-safe-linux-x64-musl/package.json +1 -1
  106. package/node_modules/@openclaw/fs-safe-win32-x64-msvc/fs-safe-native.node +0 -0
  107. package/node_modules/@openclaw/fs-safe-win32-x64-msvc/package.json +1 -1
  108. package/node_modules/follow-redirects/index.js +10 -1
  109. package/node_modules/follow-redirects/package.json +1 -1
  110. package/node_modules/mdast-util-to-markdown/index.d.ts +2 -0
  111. package/node_modules/mdast-util-to-markdown/lib/configure.d.ts +5 -0
  112. package/node_modules/mdast-util-to-markdown/lib/configure.d.ts.map +1 -1
  113. package/node_modules/mdast-util-to-markdown/lib/configure.js +19 -0
  114. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts +7 -0
  115. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts.map +1 -1
  116. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js +12 -1
  117. package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts +7 -0
  118. package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts.map +1 -1
  119. package/node_modules/mdast-util-to-markdown/lib/handle/break.js +16 -5
  120. package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts +7 -0
  121. package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts.map +1 -1
  122. package/node_modules/mdast-util-to-markdown/lib/handle/code.js +13 -2
  123. package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts +7 -0
  124. package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts.map +1 -1
  125. package/node_modules/mdast-util-to-markdown/lib/handle/definition.js +7 -0
  126. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts +30 -2
  127. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts.map +1 -1
  128. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js +39 -41
  129. package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts +7 -0
  130. package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts.map +1 -1
  131. package/node_modules/mdast-util-to-markdown/lib/handle/heading.js +11 -2
  132. package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts +7 -0
  133. package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts.map +1 -1
  134. package/node_modules/mdast-util-to-markdown/lib/handle/html.js +7 -0
  135. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts +10 -0
  136. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts.map +1 -1
  137. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js +17 -2
  138. package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts +10 -0
  139. package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts.map +1 -1
  140. package/node_modules/mdast-util-to-markdown/lib/handle/image.js +10 -0
  141. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts +9 -0
  142. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts.map +1 -1
  143. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js +14 -4
  144. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts +10 -0
  145. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts.map +1 -1
  146. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js +17 -2
  147. package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts +13 -0
  148. package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts.map +1 -1
  149. package/node_modules/mdast-util-to-markdown/lib/handle/link.js +24 -9
  150. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts +7 -0
  151. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts.map +1 -1
  152. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.js +12 -1
  153. package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts +7 -0
  154. package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts.map +1 -1
  155. package/node_modules/mdast-util-to-markdown/lib/handle/list.js +7 -0
  156. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts +7 -0
  157. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts.map +1 -1
  158. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js +7 -0
  159. package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts +7 -0
  160. package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts.map +1 -1
  161. package/node_modules/mdast-util-to-markdown/lib/handle/root.js +13 -2
  162. package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts +30 -2
  163. package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts.map +1 -1
  164. package/node_modules/mdast-util-to-markdown/lib/handle/strong.js +39 -41
  165. package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts +7 -0
  166. package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts.map +1 -1
  167. package/node_modules/mdast-util-to-markdown/lib/handle/text.js +7 -0
  168. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts +6 -0
  169. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts.map +1 -1
  170. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js +6 -0
  171. package/node_modules/mdast-util-to-markdown/lib/index.d.ts.map +1 -1
  172. package/node_modules/mdast-util-to-markdown/lib/index.js +34 -8
  173. package/node_modules/mdast-util-to-markdown/lib/join.d.ts.map +1 -1
  174. package/node_modules/mdast-util-to-markdown/lib/join.js +18 -1
  175. package/node_modules/mdast-util-to-markdown/lib/types.d.ts +50 -30
  176. package/node_modules/mdast-util-to-markdown/lib/unsafe.d.ts.map +1 -1
  177. package/node_modules/mdast-util-to-markdown/lib/unsafe.js +15 -1
  178. package/node_modules/mdast-util-to-markdown/lib/util/character.d.ts +23 -0
  179. package/node_modules/mdast-util-to-markdown/lib/util/character.d.ts.map +1 -0
  180. package/node_modules/mdast-util-to-markdown/lib/util/character.js +32 -0
  181. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts +4 -0
  182. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts.map +1 -1
  183. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js +4 -0
  184. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts +4 -0
  185. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts.map +1 -1
  186. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js +4 -0
  187. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts +4 -0
  188. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts.map +1 -1
  189. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js +4 -0
  190. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts +4 -0
  191. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts.map +1 -1
  192. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js +4 -0
  193. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts +4 -0
  194. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts.map +1 -1
  195. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.js +4 -0
  196. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts +4 -0
  197. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts.map +1 -1
  198. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js +4 -0
  199. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts +4 -0
  200. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts.map +1 -1
  201. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.js +4 -0
  202. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts +4 -0
  203. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts.map +1 -1
  204. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js +4 -0
  205. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts +4 -0
  206. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts.map +1 -1
  207. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.js +4 -0
  208. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts +4 -0
  209. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts.map +1 -1
  210. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.js +4 -0
  211. package/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js +3 -1
  212. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts +2 -0
  213. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts.map +1 -1
  214. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.js +9 -0
  215. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts +95 -4
  216. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts.map +1 -1
  217. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js +636 -57
  218. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts +2 -2
  219. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts.map +1 -1
  220. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.js +1 -1
  221. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts +5 -0
  222. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts.map +1 -1
  223. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js +12 -7
  224. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts +5 -0
  225. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts.map +1 -1
  226. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js +7 -2
  227. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts +5 -0
  228. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts.map +1 -1
  229. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js +20 -15
  230. package/node_modules/mdast-util-to-markdown/lib/util/html-kind.d.ts +31 -0
  231. package/node_modules/mdast-util-to-markdown/lib/util/html-kind.d.ts.map +1 -0
  232. package/node_modules/mdast-util-to-markdown/lib/util/html-kind.js +63 -0
  233. package/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js +5 -0
  234. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts +5 -0
  235. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts.map +1 -1
  236. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js +11 -0
  237. package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts +2 -2
  238. package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts.map +1 -1
  239. package/node_modules/mdast-util-to-markdown/lib/util/safe.js +71 -7
  240. package/node_modules/mdast-util-to-markdown/package.json +13 -57
  241. package/node_modules/mdast-util-to-markdown/readme.md +139 -84
  242. package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
  243. package/node_modules/micromark/dev/lib/compile.js +14 -4
  244. package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
  245. package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
  246. package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
  247. package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
  248. package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
  249. package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
  250. package/node_modules/micromark/dev/lib/preprocess.js +19 -21
  251. package/node_modules/micromark/lib/compile.d.ts.map +1 -1
  252. package/node_modules/micromark/lib/compile.js +37 -29
  253. package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
  254. package/node_modules/micromark/lib/create-tokenizer.js +37 -35
  255. package/node_modules/micromark/lib/initialize/document.js +21 -13
  256. package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
  257. package/node_modules/micromark/lib/initialize/text.js +7 -3
  258. package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
  259. package/node_modules/micromark/lib/preprocess.js +16 -19
  260. package/node_modules/micromark/package.json +2 -15
  261. package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
  262. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
  263. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
  264. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
  265. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
  266. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
  267. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
  268. package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
  269. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
  270. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
  271. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
  272. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
  273. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
  274. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
  275. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
  276. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
  277. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
  278. package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
  279. package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
  280. package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
  281. package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
  282. package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
  283. package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
  284. package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
  285. package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
  286. package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
  287. package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
  288. package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
  289. package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
  290. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
  291. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
  292. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
  293. package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
  294. package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
  295. package/node_modules/micromark-core-commonmark/package.json +4 -16
  296. package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
  297. package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
  298. package/node_modules/micromark-factory-space/dev/index.js +58 -3
  299. package/node_modules/micromark-factory-space/index.d.ts +24 -1
  300. package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
  301. package/node_modules/micromark-factory-space/index.js +55 -3
  302. package/node_modules/micromark-factory-space/package.json +1 -10
  303. package/node_modules/micromark-factory-space/readme.md +25 -25
  304. package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
  305. package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
  306. package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
  307. package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
  308. package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
  309. package/node_modules/micromark-util-edit-map/index.js +225 -0
  310. package/node_modules/micromark-util-edit-map/license +22 -0
  311. package/node_modules/micromark-util-edit-map/package.json +48 -0
  312. package/node_modules/micromark-util-edit-map/readme.md +234 -0
  313. package/node_modules/micromark-util-types/index.d.ts +6 -3
  314. package/node_modules/micromark-util-types/package.json +2 -36
  315. package/node_modules/ws/lib/websocket.js +17 -3
  316. package/node_modules/ws/package.json +1 -1
  317. package/package.json +5 -5
  318. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.d.ts +0 -17
  319. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.js +0 -66
  320. package/node_modules/@openclaw/fs-safe/dist/publish-file-native.d.ts +0 -4
  321. package/node_modules/@openclaw/fs-safe/dist/publish-file-native.js +0 -35
  322. package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.d.ts +0 -7
  323. package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.js +0 -16
  324. package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts +0 -7
  325. package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts.map +0 -1
@@ -10,26 +10,35 @@ import {formatLinkAsAutolink} from '../util/format-link-as-autolink.js'
10
10
  link.peek = linkPeek
11
11
 
12
12
  /**
13
+ * Serialize a link node.
14
+ *
13
15
  * @param {Link} node
16
+ * Node to serialize.
14
17
  * @param {Parents | undefined} _
18
+ * Parent node.
15
19
  * @param {State} state
20
+ * Info passed around.
16
21
  * @param {Info} info
22
+ * Info on surrounding context.
17
23
  * @returns {string}
24
+ * Serialized markdown.
18
25
  */
19
26
  export function link(node, _, state, info) {
20
27
  const quote = checkQuote(state)
21
28
  const suffix = quote === '"' ? 'Quote' : 'Apostrophe'
22
29
  const tracker = state.createTracker(info)
23
- /** @type {Exit} */
24
- let exit
25
- /** @type {Exit} */
26
- let subexit
27
30
 
28
31
  if (formatLinkAsAutolink(node, state)) {
29
- // Hide the fact that we’re in phrasing, because escapes don’t work.
32
+ // Hide that we’re in phrasing as things like attention or code cannot form
33
+ // in autolinks.
34
+ // Character escapes also don’t work (nor character references),
35
+ // but that is a different matter, which `safe.js` handles for `autolink`.
36
+ // It is important to know about other constructs, such as table cells.
30
37
  const stack = state.stack
31
- state.stack = []
32
- exit = state.enter('autolink')
38
+ state.stack = stack.filter(function (d) {
39
+ return d !== 'phrasing'
40
+ })
41
+ const exit = state.enter('autolink')
33
42
  let value = tracker.move('<')
34
43
  value += tracker.move(
35
44
  state.containerPhrasing(node, {
@@ -44,8 +53,8 @@ export function link(node, _, state, info) {
44
53
  return value
45
54
  }
46
55
 
47
- exit = state.enter('link')
48
- subexit = state.enter('label')
56
+ const exit = state.enter('link')
57
+ let subexit = state.enter('label')
49
58
  let value = tracker.move('[')
50
59
  value += tracker.move(
51
60
  state.containerPhrasing(node, {
@@ -104,10 +113,16 @@ export function link(node, _, state, info) {
104
113
  }
105
114
 
106
115
  /**
116
+ * Peek at this node.
117
+ *
107
118
  * @param {Link} node
119
+ * Node to peek at.
108
120
  * @param {Parents | undefined} _
121
+ * Parent node.
109
122
  * @param {State} state
123
+ * Info passed around.
110
124
  * @returns {string}
125
+ * Start of the serialized markdown.
111
126
  */
112
127
  function linkPeek(node, _, state) {
113
128
  return formatLinkAsAutolink(node, state) ? '<' : '['
@@ -1,9 +1,16 @@
1
1
  /**
2
+ * Serialize a list item node.
3
+ *
2
4
  * @param {ListItem} node
5
+ * Node to serialize.
3
6
  * @param {Parents | undefined} parent
7
+ * Parent node.
4
8
  * @param {State} state
9
+ * Info passed around.
5
10
  * @param {Info} info
11
+ * Info on surrounding context.
6
12
  * @returns {string}
13
+ * Serialized markdown.
7
14
  */
8
15
  export function listItem(node: ListItem, parent: Parents | undefined, state: State, info: Info): string;
9
16
  import type { ListItem } from 'mdast';
@@ -1 +1 @@
1
- {"version":3,"file":"list-item.d.ts","sourceRoot":"","sources":["list-item.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,+BANW,QAAQ,UACR,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CAgDlB;8BA3DmC,OAAO;6BAAP,OAAO;2BADR,wBAAwB;0BAAxB,wBAAwB"}
1
+ {"version":3,"file":"list-item.d.ts","sourceRoot":"","sources":["list-item.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,+BAXW,QAAQ,UAER,OAAO,GAAG,SAAS,SAEnB,KAAK,QAEL,IAAI,GAEF,MAAM,CAqDlB;8BAtEmC,OAAO;6BAAP,OAAO;2BADR,wBAAwB;0BAAxB,wBAAwB"}
@@ -7,11 +7,18 @@ import {checkBullet} from '../util/check-bullet.js'
7
7
  import {checkListItemIndent} from '../util/check-list-item-indent.js'
8
8
 
9
9
  /**
10
+ * Serialize a list item node.
11
+ *
10
12
  * @param {ListItem} node
13
+ * Node to serialize.
11
14
  * @param {Parents | undefined} parent
15
+ * Parent node.
12
16
  * @param {State} state
17
+ * Info passed around.
13
18
  * @param {Info} info
19
+ * Info on surrounding context.
14
20
  * @returns {string}
21
+ * Serialized markdown.
15
22
  */
16
23
  export function listItem(node, parent, state, info) {
17
24
  const listItemIndent = checkListItemIndent(state)
@@ -51,7 +58,11 @@ export function listItem(node, parent, state, info) {
51
58
 
52
59
  return value
53
60
 
54
- /** @type {Map} */
61
+ /**
62
+ * Indent lines of the list item.
63
+ *
64
+ * @type {Map}
65
+ */
55
66
  function map(line, index, blank) {
56
67
  if (index) {
57
68
  return (blank ? '' : ' '.repeat(size)) + line
@@ -1,9 +1,16 @@
1
1
  /**
2
+ * Serialize a list node.
3
+ *
2
4
  * @param {List} node
5
+ * Node to serialize.
3
6
  * @param {Parents | undefined} parent
7
+ * Parent node.
4
8
  * @param {State} state
9
+ * Info passed around.
5
10
  * @param {Info} info
11
+ * Info on surrounding context.
6
12
  * @returns {string}
13
+ * Serialized markdown.
7
14
  */
8
15
  export function list(node: List, parent: Parents | undefined, state: State, info: Info): string;
9
16
  import type { List } from 'mdast';
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.js"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,2BANW,IAAI,UACJ,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CAoFlB;0BAjG+B,OAAO;6BAAP,OAAO;2BADT,wBAAwB;0BAAxB,wBAAwB"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;GAaG;AACH,2BAXW,IAAI,UAEJ,OAAO,GAAG,SAAS,SAEnB,KAAK,QAEL,IAAI,GAEF,MAAM,CAqFlB;0BAxG+B,OAAO;6BAAP,OAAO;2BADT,wBAAwB;0BAAxB,wBAAwB"}
@@ -9,11 +9,18 @@ import {checkBulletOrdered} from '../util/check-bullet-ordered.js'
9
9
  import {checkRule} from '../util/check-rule.js'
10
10
 
11
11
  /**
12
+ * Serialize a list node.
13
+ *
12
14
  * @param {List} node
15
+ * Node to serialize.
13
16
  * @param {Parents | undefined} parent
17
+ * Parent node.
14
18
  * @param {State} state
19
+ * Info passed around.
15
20
  * @param {Info} info
21
+ * Info on surrounding context.
16
22
  * @returns {string}
23
+ * Serialized markdown.
17
24
  */
18
25
  export function list(node, parent, state, info) {
19
26
  const exit = state.enter('list')
@@ -3,11 +3,18 @@
3
3
  * @import {Paragraph, Parents} from 'mdast'
4
4
  */
5
5
  /**
6
+ * Serialize a paragraph node.
7
+ *
6
8
  * @param {Paragraph} node
9
+ * Node to serialize.
7
10
  * @param {Parents | undefined} _
11
+ * Parent node.
8
12
  * @param {State} state
13
+ * Info passed around.
9
14
  * @param {Info} info
15
+ * Info on surrounding context.
10
16
  * @returns {string}
17
+ * Serialized markdown.
11
18
  */
12
19
  export function paragraph(node: Paragraph, _: Parents | undefined, state: State, info: Info): string;
13
20
  import type { Paragraph } from 'mdast';
@@ -1 +1 @@
1
- {"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["paragraph.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AACH,gCANW,SAAS,KACT,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CASlB;+BAjBoC,OAAO;6BAAP,OAAO;2BADd,wBAAwB;0BAAxB,wBAAwB"}
1
+ {"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["paragraph.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AACH,gCAXW,SAAS,KAET,OAAO,GAAG,SAAS,SAEnB,KAAK,QAEL,IAAI,GAEF,MAAM,CAUlB;+BAxBoC,OAAO;6BAAP,OAAO;2BADd,wBAAwB;0BAAxB,wBAAwB"}
@@ -4,11 +4,18 @@
4
4
  */
5
5
 
6
6
  /**
7
+ * Serialize a paragraph node.
8
+ *
7
9
  * @param {Paragraph} node
10
+ * Node to serialize.
8
11
  * @param {Parents | undefined} _
12
+ * Parent node.
9
13
  * @param {State} state
14
+ * Info passed around.
10
15
  * @param {Info} info
16
+ * Info on surrounding context.
11
17
  * @returns {string}
18
+ * Serialized markdown.
12
19
  */
13
20
  export function paragraph(node, _, state, info) {
14
21
  const exit = state.enter('paragraph')
@@ -1,9 +1,16 @@
1
1
  /**
2
+ * Serialize a root node.
3
+ *
2
4
  * @param {Root} node
5
+ * Node to serialize.
3
6
  * @param {Parents | undefined} _
7
+ * Parent node.
4
8
  * @param {State} state
9
+ * Info passed around.
5
10
  * @param {Info} info
11
+ * Info on surrounding context.
6
12
  * @returns {string}
13
+ * Serialized markdown.
7
14
  */
8
15
  export function root(node: Root, _: Parents | undefined, state: State, info: Info): string;
9
16
  import type { Root } from 'mdast';
@@ -1 +1 @@
1
- {"version":3,"file":"root.d.ts","sourceRoot":"","sources":["root.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,2BANW,IAAI,KACJ,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CAUlB;0BApB+B,OAAO;6BAAP,OAAO;2BADT,wBAAwB;0BAAxB,wBAAwB"}
1
+ {"version":3,"file":"root.d.ts","sourceRoot":"","sources":["root.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AACH,2BAXW,IAAI,KAEJ,OAAO,GAAG,SAAS,SAEnB,KAAK,QAEL,IAAI,GAEF,MAAM,CAelB;0BA/B+B,OAAO;6BAAP,OAAO;2BADT,wBAAwB;0BAAxB,wBAAwB"}
@@ -6,11 +6,18 @@
6
6
  import {phrasing} from 'mdast-util-phrasing'
7
7
 
8
8
  /**
9
+ * Serialize a root node.
10
+ *
9
11
  * @param {Root} node
12
+ * Node to serialize.
10
13
  * @param {Parents | undefined} _
14
+ * Parent node.
11
15
  * @param {State} state
16
+ * Info passed around.
12
17
  * @param {Info} info
18
+ * Info on surrounding context.
13
19
  * @returns {string}
20
+ * Serialized markdown.
14
21
  */
15
22
  export function root(node, _, state, info) {
16
23
  // Note: `html` nodes are ambiguous.
@@ -18,6 +25,10 @@ export function root(node, _, state, info) {
18
25
  return phrasing(d)
19
26
  })
20
27
 
21
- const container = hasPhrasing ? state.containerPhrasing : state.containerFlow
22
- return container.call(state, node, info)
28
+ if (!hasPhrasing) return state.containerFlow(node, info)
29
+
30
+ const exit = state.enter('phrasing')
31
+ const value = state.containerPhrasing(node, info)
32
+ exit()
33
+ return value
23
34
  }
@@ -1,24 +1,52 @@
1
1
  /**
2
+ * Serialize a strong node.
3
+ *
4
+ * Attention is properly handled by `containerPhrasing`.
5
+ *
2
6
  * @param {Strong} node
7
+ * Node to serialize.
3
8
  * @param {Parents | undefined} _
9
+ * Parent node.
4
10
  * @param {State} state
11
+ * Info passed around.
5
12
  * @param {Info} info
13
+ * Info on surrounding context.
6
14
  * @returns {string}
15
+ * Serialized markdown.
7
16
  */
8
17
  export function strong(node: Strong, _: Parents | undefined, state: State, info: Info): string;
9
18
  export namespace strong {
10
- export { strongPeek as peek };
19
+ export { attention };
20
+ export { peek };
11
21
  }
12
22
  import type { Strong } from 'mdast';
13
23
  import type { Parents } from 'mdast';
14
24
  import type { State } from 'mdast-util-to-markdown';
15
25
  import type { Info } from 'mdast-util-to-markdown';
16
26
  /**
27
+ * Serialize a strong node as attention.
28
+ *
17
29
  * @param {Strong} _
30
+ * Node to serialize.
31
+ * @param {State} state
32
+ * Info passed around.
33
+ * @returns {AttentionInfo}
34
+ * Info on how to serialize the node.
35
+ */
36
+ declare function attention(_: Strong, state: State): AttentionInfo;
37
+ /**
38
+ * Peek at this node.
39
+ *
40
+ * @param {Strong} _
41
+ * Node to serialize.
18
42
  * @param {Parents | undefined} _1
43
+ * Parent node.
19
44
  * @param {State} state
45
+ * Info passed around.
20
46
  * @returns {string}
47
+ * Start of the serialized markdown.
21
48
  */
22
- declare function strongPeek(_: Strong, _1: Parents | undefined, state: State): string;
49
+ declare function peek(_: Strong, _1: Parents | undefined, state: State): string;
50
+ import type { AttentionInfo } from 'mdast-util-to-markdown';
23
51
  export {};
24
52
  //# sourceMappingURL=strong.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"strong.d.ts","sourceRoot":"","sources":["strong.js"],"names":[],"mappings":"AAWA;;;;;;GAMG;AACH,6BANW,MAAM,KACN,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CA0ClB;;;;4BAxDiC,OAAO;6BAAP,OAAO;2BADX,wBAAwB;0BAAxB,wBAAwB;AA2DtD;;;;;GAKG;AACH,+BALW,MAAM,MACN,OAAO,GAAG,SAAS,SACnB,KAAK,GACH,MAAM,CAIlB"}
1
+ {"version":3,"file":"strong.d.ts","sourceRoot":"","sources":["strong.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;GAeG;AACH,6BAXW,MAAM,KAEN,OAAO,GAAG,SAAS,SAEnB,KAAK,QAEL,IAAI,GAEF,MAAM,CAQlB;;;;;4BA7BiC,OAAO;6BAAP,OAAO;2BADI,wBAAwB;0BAAxB,wBAAwB;AAgCrE;;;;;;;;;GASG;AACH,8BAPW,MAAM,SAEN,KAAK,GAEH,aAAa,CAUzB;AAED;;;;;;;;;;;GAWG;AACH,yBATW,MAAM,MAEN,OAAO,GAAG,SAAS,SAEnB,KAAK,GAEH,MAAM,CAKlB;mCAjE4C,wBAAwB"}
@@ -1,69 +1,67 @@
1
1
  /**
2
- * @import {Info, State} from 'mdast-util-to-markdown'
2
+ * @import {AttentionInfo, Info, State} from 'mdast-util-to-markdown'
3
3
  * @import {Parents, Strong} from 'mdast'
4
4
  */
5
5
 
6
6
  import {checkStrong} from '../util/check-strong.js'
7
- import {encodeCharacterReference} from '../util/encode-character-reference.js'
8
- import {encodeInfo} from '../util/encode-info.js'
9
7
 
10
- strong.peek = strongPeek
8
+ strong.attention = attention
9
+ strong.peek = peek
11
10
 
12
11
  /**
12
+ * Serialize a strong node.
13
+ *
14
+ * Attention is properly handled by `containerPhrasing`.
15
+ *
13
16
  * @param {Strong} node
17
+ * Node to serialize.
14
18
  * @param {Parents | undefined} _
19
+ * Parent node.
15
20
  * @param {State} state
21
+ * Info passed around.
16
22
  * @param {Info} info
23
+ * Info on surrounding context.
17
24
  * @returns {string}
25
+ * Serialized markdown.
18
26
  */
19
27
  export function strong(node, _, state, info) {
20
- const marker = checkStrong(state)
21
- const exit = state.enter('strong')
22
- const tracker = state.createTracker(info)
23
- const before = tracker.move(marker + marker)
24
-
25
- let between = tracker.move(
26
- state.containerPhrasing(node, {
27
- after: marker,
28
- before,
29
- ...tracker.current()
30
- })
31
- )
32
- const betweenHead = between.charCodeAt(0)
33
- const open = encodeInfo(
34
- info.before.charCodeAt(info.before.length - 1),
35
- betweenHead,
36
- marker
37
- )
38
-
39
- if (open.inside) {
40
- between = encodeCharacterReference(betweenHead) + between.slice(1)
41
- }
42
-
43
- const betweenTail = between.charCodeAt(between.length - 1)
44
- const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker)
45
-
46
- if (close.inside) {
47
- between = between.slice(0, -1) + encodeCharacterReference(betweenTail)
48
- }
49
-
50
- const after = tracker.move(marker + marker)
51
-
28
+ const exit = state.enter('phrasing')
29
+ const value = state.containerPhrasing({type: 'root', children: [node]}, info)
52
30
  exit()
31
+ return value
32
+ }
53
33
 
54
- state.attentionEncodeSurroundingInfo = {
55
- after: close.outside,
56
- before: open.outside
34
+ /**
35
+ * Serialize a strong node as attention.
36
+ *
37
+ * @param {Strong} _
38
+ * Node to serialize.
39
+ * @param {State} state
40
+ * Info passed around.
41
+ * @returns {AttentionInfo}
42
+ * Info on how to serialize the node.
43
+ */
44
+ function attention(_, state) {
45
+ const marker = checkStrong(state)
46
+ return {
47
+ construct: 'strong',
48
+ markers: marker === '*' ? ['*', '_'] : ['_', '*'],
49
+ sizes: [2]
57
50
  }
58
- return before + between + after
59
51
  }
60
52
 
61
53
  /**
54
+ * Peek at this node.
55
+ *
62
56
  * @param {Strong} _
57
+ * Node to serialize.
63
58
  * @param {Parents | undefined} _1
59
+ * Parent node.
64
60
  * @param {State} state
61
+ * Info passed around.
65
62
  * @returns {string}
63
+ * Start of the serialized markdown.
66
64
  */
67
- function strongPeek(_, _1, state) {
65
+ function peek(_, _1, state) {
68
66
  return state.options.strong || '*'
69
67
  }
@@ -3,11 +3,18 @@
3
3
  * @import {Parents, Text} from 'mdast'
4
4
  */
5
5
  /**
6
+ * Serialize a text node.
7
+ *
6
8
  * @param {Text} node
9
+ * Node to serialize.
7
10
  * @param {Parents | undefined} _
11
+ * Parent node.
8
12
  * @param {State} state
13
+ * Info passed around.
9
14
  * @param {Info} info
15
+ * Info on surrounding context.
10
16
  * @returns {string}
17
+ * Serialized markdown.
11
18
  */
12
19
  export function text(node: Text, _: Parents | undefined, state: State, info: Info): string;
13
20
  import type { Text } from 'mdast';
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["text.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AACH,2BANW,IAAI,KACJ,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CAIlB;0BAZ+B,OAAO;6BAAP,OAAO;2BADT,wBAAwB;0BAAxB,wBAAwB"}
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["text.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AACH,2BAXW,IAAI,KAEJ,OAAO,GAAG,SAAS,SAEnB,KAAK,QAEL,IAAI,GAEF,MAAM,CAKlB;0BAnB+B,OAAO;6BAAP,OAAO;2BADT,wBAAwB;0BAAxB,wBAAwB"}
@@ -4,11 +4,18 @@
4
4
  */
5
5
 
6
6
  /**
7
+ * Serialize a text node.
8
+ *
7
9
  * @param {Text} node
10
+ * Node to serialize.
8
11
  * @param {Parents | undefined} _
12
+ * Parent node.
9
13
  * @param {State} state
14
+ * Info passed around.
10
15
  * @param {Info} info
16
+ * Info on surrounding context.
11
17
  * @returns {string}
18
+ * Serialized markdown.
12
19
  */
13
20
  export function text(node, _, state, info) {
14
21
  return state.safe(node.value, info)
@@ -1,8 +1,14 @@
1
1
  /**
2
+ * Serialize a thematic break node.
3
+ *
2
4
  * @param {ThematicBreak} _
5
+ * Node to serialize.
3
6
  * @param {Parents | undefined} _1
7
+ * Parent node.
4
8
  * @param {State} state
9
+ * Info passed around.
5
10
  * @returns {string}
11
+ * Serialized markdown.
6
12
  */
7
13
  export function thematicBreak(_: ThematicBreak, _1: Parents | undefined, state: State): string;
8
14
  import type { ThematicBreak } from 'mdast';
@@ -1 +1 @@
1
- {"version":3,"file":"thematic-break.d.ts","sourceRoot":"","sources":["thematic-break.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,iCALW,aAAa,MACb,OAAO,GAAG,SAAS,SACnB,KAAK,GACH,MAAM,CAQlB;mCAlBwC,OAAO;6BAAP,OAAO;2BADxB,wBAAwB"}
1
+ {"version":3,"file":"thematic-break.d.ts","sourceRoot":"","sources":["thematic-break.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;GAWG;AACH,iCATW,aAAa,MAEb,OAAO,GAAG,SAAS,SAEnB,KAAK,GAEH,MAAM,CASlB;mCAxBwC,OAAO;6BAAP,OAAO;2BADxB,wBAAwB"}
@@ -7,10 +7,16 @@ import {checkRuleRepetition} from '../util/check-rule-repetition.js'
7
7
  import {checkRule} from '../util/check-rule.js'
8
8
 
9
9
  /**
10
+ * Serialize a thematic break node.
11
+ *
10
12
  * @param {ThematicBreak} _
13
+ * Node to serialize.
11
14
  * @param {Parents | undefined} _1
15
+ * Parent node.
12
16
  * @param {State} state
17
+ * Info passed around.
13
18
  * @returns {string}
19
+ * Serialized markdown.
14
20
  */
15
21
  export function thematicBreak(_, _1, state) {
16
22
  const value = (
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAmBA;;;;;;;;;GASG;AACH,iCAPW,KAAK,YAEL,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,MAAM,CAoElB;2BA5FuB,OAAO;6BAD0B,wBAAwB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAoBA;;;;;;;;;GASG;AACH,iCAPW,KAAK,YAEL,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,MAAM,CA6ElB;2BAtGuB,OAAO;6BAD0B,wBAAwB"}
@@ -4,6 +4,7 @@
4
4
  * @import {Enter, FlowParents, PhrasingParents, TrackFields} from './types.js'
5
5
  */
6
6
 
7
+ import {phrasing} from 'mdast-util-phrasing'
7
8
  import {zwitch} from 'zwitch'
8
9
  import {configure} from './configure.js'
9
10
  import {handle as handlers} from './handle/index.js'
@@ -32,6 +33,8 @@ export function toMarkdown(tree, options) {
32
33
  /** @type {State} */
33
34
  const state = {
34
35
  associationId: association,
36
+ bulletCurrent: undefined,
37
+ bulletLastUsed: undefined,
35
38
  containerPhrasing: containerPhrasingBound,
36
39
  containerFlow: containerFlowBound,
37
40
  createTracker: track,
@@ -63,12 +66,12 @@ export function toMarkdown(tree, options) {
63
66
  handlers: state.handlers
64
67
  })
65
68
 
66
- let result = state.handle(tree, undefined, state, {
67
- before: '\n',
68
- after: '\n',
69
- now: {line: 1, column: 1},
70
- lineShift: 0
71
- })
69
+ let result = state.handle(
70
+ phrasing(tree) ? {type: 'root', children: [tree]} : tree,
71
+ undefined,
72
+ state,
73
+ {before: '\n', after: '\n', now: {line: 1, column: 1}, lineShift: 0}
74
+ )
72
75
 
73
76
  if (
74
77
  result &&
@@ -80,13 +83,20 @@ export function toMarkdown(tree, options) {
80
83
 
81
84
  return result
82
85
 
83
- /** @type {Enter} */
86
+ /**
87
+ * Enter a construct.
88
+ *
89
+ * @type {Enter}
90
+ */
84
91
  function enter(name) {
85
92
  state.stack.push(name)
86
93
  return exit
87
94
 
88
95
  /**
96
+ * Exit a construct.
97
+ *
89
98
  * @returns {undefined}
99
+ * Nothing.
90
100
  */
91
101
  function exit() {
92
102
  state.stack.pop()
@@ -95,16 +105,28 @@ export function toMarkdown(tree, options) {
95
105
  }
96
106
 
97
107
  /**
108
+ * Handle an invalid value that cannot be processed.
109
+ *
98
110
  * @param {unknown} value
111
+ * Value.
99
112
  * @returns {never}
113
+ * Never.
114
+ * @throws {Error}
115
+ * Always.
100
116
  */
101
117
  function invalid(value) {
102
118
  throw new Error('Cannot handle value `' + value + '`, expected node')
103
119
  }
104
120
 
105
121
  /**
122
+ * Handle an unknown node.
123
+ *
106
124
  * @param {unknown} value
125
+ * Value.
107
126
  * @returns {never}
127
+ * Never.
128
+ * @throws {Error}
129
+ * Always.
108
130
  */
109
131
  function unknown(value) {
110
132
  // Always a node.
@@ -112,7 +134,11 @@ function unknown(value) {
112
134
  throw new Error('Cannot handle unknown node `' + node.type + '`')
113
135
  }
114
136
 
115
- /** @type {Join} */
137
+ /**
138
+ * Join function for `tightDefinitions` option.
139
+ *
140
+ * @type {Join}
141
+ */
116
142
  function joinDefinition(left, right) {
117
143
  // No blank line between adjacent definitions.
118
144
  if (left.type === 'definition' && left.type === right.type) {
@@ -1 +1 @@
1
- {"version":3,"file":"join.d.ts","sourceRoot":"","sources":["join.js"],"names":[],"mappings":"AAOA,0BAA0B;AAC1B,mBADW,KAAK,CAAC,IAAI,CAAC,CACY;0BAPX,wBAAwB"}
1
+ {"version":3,"file":"join.d.ts","sourceRoot":"","sources":["join.js"],"names":[],"mappings":"AAQA,0BAA0B;AAC1B,mBADW,KAAK,CAAC,IAAI,CAAC,CACY;0BARX,wBAAwB"}
@@ -4,11 +4,16 @@
4
4
 
5
5
  import {formatCodeAsIndented} from './util/format-code-as-indented.js'
6
6
  import {formatHeadingAsSetext} from './util/format-heading-as-setext.js'
7
+ import {htmlKind} from './util/html-kind.js'
7
8
 
8
9
  /** @type {Array<Join>} */
9
10
  export const join = [joinDefaults]
10
11
 
11
- /** @type {Join} */
12
+ /**
13
+ * Default join function.
14
+ *
15
+ * @type {Join}
16
+ */
12
17
  function joinDefaults(left, right, parent, state) {
13
18
  // Indented code after list or another indented code.
14
19
  if (
@@ -34,6 +39,18 @@ function joinDefaults(left, right, parent, state) {
34
39
  return
35
40
  }
36
41
 
42
+ // HTML that only ends at a blank line followed by something.
43
+ if (left.type === 'html') {
44
+ const kind = htmlKind(left.value)
45
+ if (kind === undefined || kind === 6 || kind === 7) return 1
46
+ }
47
+
48
+ // HTML that cannot interrupt a paragraph (kind 7) after one.
49
+ if (left.type === 'paragraph' && right.type === 'html') {
50
+ const kind = htmlKind(right.value)
51
+ if (kind === undefined || kind === 7) return 1
52
+ }
53
+
37
54
  return parent.spread ? 1 : 0
38
55
  }
39
56
  }