@openclaw/feishu 2026.7.1 → 2026.7.2-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 (750) hide show
  1. package/dist/{accounts-Bs5uJ4h0.js → accounts-BDoGHJDk.js} +29 -54
  2. package/dist/api.js +351 -195
  3. package/dist/{app-registration-BwQ-aGTe.js → app-registration-BzkyrVZu.js} +11 -11
  4. package/dist/{channel-DRQRQQQ3.js → channel-X30GQVwc.js} +591 -398
  5. package/dist/channel-plugin-api.js +1 -1
  6. package/dist/{channel.runtime-pvr-Y5ji.js → channel.runtime-By2uqa3Q.js} +272 -107
  7. package/dist/{client-B7EAV_Ss.js → client-87BmeMpj.js} +55 -29
  8. package/dist/contract-api.js +1 -1
  9. package/dist/{conversation-id-CdLdoot3.js → conversation-id-BeJL-wq7.js} +3 -0
  10. package/dist/doctor-contract-DXH5hux1.js +97 -0
  11. package/dist/doctor-contract-api.js +2 -0
  12. package/dist/{drive-D0lIhxqZ.js → drive-B4E8OXZ0.js} +181 -33
  13. package/dist/{monitor-CsbheK9J.js → monitor-CHl0bWzb.js} +3 -3
  14. package/dist/{monitor.account-Dr7do33p.js → monitor.account-BSRV2hIF.js} +529 -549
  15. package/dist/monitor.startup-Cy8NPGAX.js +43 -0
  16. package/dist/{probe-Dxyo9zlw.js → probe-BgboTHIn.js} +3 -6
  17. package/dist/{secret-contract-DLaBl9m4.js → secret-contract-DnlMcrn5.js} +14 -69
  18. package/dist/secret-contract-api.js +1 -1
  19. package/dist/{send-Be2GMA6Z.js → send-DrWM_Ilf.js} +67 -40
  20. package/dist/send-result-DsqTk27v.js +770 -0
  21. package/dist/{session-conversation-BYuoVJwl.js → session-conversation-BksWrfzm.js} +1 -1
  22. package/dist/session-key-api.js +1 -1
  23. package/dist/setup-api.js +1 -1
  24. package/dist/setup-entry.js +0 -5
  25. package/dist/{subagent-hooks-B2iWPYJ1.js → subagent-hooks-BKTOxB-T.js} +9 -5
  26. package/dist/subagent-hooks-api.js +1 -1
  27. package/node_modules/@types/debug/LICENSE +21 -0
  28. package/node_modules/@types/debug/README.md +69 -0
  29. package/node_modules/@types/debug/index.d.ts +50 -0
  30. package/node_modules/@types/debug/package.json +58 -0
  31. package/node_modules/@types/mdast/LICENSE +21 -0
  32. package/node_modules/@types/mdast/README.md +15 -0
  33. package/node_modules/@types/mdast/index.d.ts +1123 -0
  34. package/node_modules/@types/mdast/package.json +47 -0
  35. package/node_modules/@types/ms/LICENSE +21 -0
  36. package/node_modules/@types/ms/README.md +82 -0
  37. package/node_modules/@types/ms/index.d.ts +63 -0
  38. package/node_modules/@types/ms/package.json +26 -0
  39. package/node_modules/@types/unist/LICENSE +21 -0
  40. package/node_modules/@types/unist/README.md +15 -0
  41. package/node_modules/@types/unist/index.d.ts +119 -0
  42. package/node_modules/@types/unist/package.json +60 -0
  43. package/node_modules/character-entities/index.d.ts +6 -0
  44. package/node_modules/character-entities/index.js +2132 -0
  45. package/node_modules/character-entities/license +22 -0
  46. package/node_modules/character-entities/package.json +78 -0
  47. package/node_modules/character-entities/readme.md +152 -0
  48. package/node_modules/debug/LICENSE +20 -0
  49. package/node_modules/debug/README.md +481 -0
  50. package/node_modules/debug/package.json +64 -0
  51. package/node_modules/debug/src/browser.js +272 -0
  52. package/node_modules/debug/src/common.js +292 -0
  53. package/node_modules/debug/src/index.js +10 -0
  54. package/node_modules/debug/src/node.js +263 -0
  55. package/node_modules/decode-named-character-reference/index.d.ts +13 -0
  56. package/node_modules/decode-named-character-reference/index.d.ts.map +1 -0
  57. package/node_modules/decode-named-character-reference/index.dom.d.ts +6 -0
  58. package/node_modules/decode-named-character-reference/index.dom.d.ts.map +1 -0
  59. package/node_modules/decode-named-character-reference/index.dom.js +32 -0
  60. package/node_modules/decode-named-character-reference/index.js +19 -0
  61. package/node_modules/decode-named-character-reference/license +22 -0
  62. package/node_modules/decode-named-character-reference/package.json +90 -0
  63. package/node_modules/decode-named-character-reference/readme.md +136 -0
  64. package/node_modules/dequal/dist/index.js +86 -0
  65. package/node_modules/dequal/dist/index.min.js +1 -0
  66. package/node_modules/dequal/dist/index.mjs +84 -0
  67. package/node_modules/dequal/index.d.ts +1 -0
  68. package/node_modules/dequal/license +21 -0
  69. package/node_modules/dequal/lite/index.d.ts +1 -0
  70. package/node_modules/dequal/lite/index.js +31 -0
  71. package/node_modules/dequal/lite/index.min.js +1 -0
  72. package/node_modules/dequal/lite/index.mjs +29 -0
  73. package/node_modules/dequal/package.json +57 -0
  74. package/node_modules/dequal/readme.md +112 -0
  75. package/node_modules/devlop/lib/default.js +9 -0
  76. package/node_modules/devlop/lib/development.d.ts +84 -0
  77. package/node_modules/devlop/lib/development.js +238 -0
  78. package/node_modules/devlop/license +22 -0
  79. package/node_modules/devlop/package.json +80 -0
  80. package/node_modules/devlop/readme.md +360 -0
  81. package/node_modules/longest-streak/index.d.ts +11 -0
  82. package/node_modules/longest-streak/index.js +36 -0
  83. package/node_modules/longest-streak/license +22 -0
  84. package/node_modules/longest-streak/package.json +73 -0
  85. package/node_modules/longest-streak/readme.md +150 -0
  86. package/node_modules/markdown-table/index.d.ts +171 -0
  87. package/node_modules/markdown-table/index.d.ts.map +1 -0
  88. package/node_modules/markdown-table/index.js +393 -0
  89. package/node_modules/markdown-table/license +22 -0
  90. package/node_modules/markdown-table/package.json +77 -0
  91. package/node_modules/markdown-table/readme.md +344 -0
  92. package/node_modules/mdast-util-from-markdown/dev/index.d.ts +23 -0
  93. package/node_modules/mdast-util-from-markdown/dev/index.js +2 -0
  94. package/node_modules/mdast-util-from-markdown/dev/lib/index.d.ts +53 -0
  95. package/node_modules/mdast-util-from-markdown/dev/lib/index.d.ts.map +1 -0
  96. package/node_modules/mdast-util-from-markdown/dev/lib/index.js +1348 -0
  97. package/node_modules/mdast-util-from-markdown/dev/lib/types.d.ts +295 -0
  98. package/node_modules/mdast-util-from-markdown/dev/lib/types.js +2 -0
  99. package/node_modules/mdast-util-from-markdown/index.d.ts +23 -0
  100. package/node_modules/mdast-util-from-markdown/index.js +2 -0
  101. package/node_modules/mdast-util-from-markdown/lib/index.d.ts +53 -0
  102. package/node_modules/mdast-util-from-markdown/lib/index.d.ts.map +1 -0
  103. package/node_modules/mdast-util-from-markdown/lib/index.js +1177 -0
  104. package/node_modules/mdast-util-from-markdown/lib/types.d.ts +295 -0
  105. package/node_modules/mdast-util-from-markdown/lib/types.js +2 -0
  106. package/node_modules/mdast-util-from-markdown/license +22 -0
  107. package/node_modules/mdast-util-from-markdown/package.json +99 -0
  108. package/node_modules/mdast-util-from-markdown/readme.md +535 -0
  109. package/node_modules/mdast-util-gfm-table/index.d.ts +54 -0
  110. package/node_modules/mdast-util-gfm-table/index.js +2 -0
  111. package/node_modules/mdast-util-gfm-table/lib/index.d.ts +51 -0
  112. package/node_modules/mdast-util-gfm-table/lib/index.js +300 -0
  113. package/node_modules/mdast-util-gfm-table/license +22 -0
  114. package/node_modules/mdast-util-gfm-table/package.json +101 -0
  115. package/node_modules/mdast-util-gfm-table/readme.md +605 -0
  116. package/node_modules/mdast-util-phrasing/index.d.ts +1 -0
  117. package/node_modules/mdast-util-phrasing/index.js +1 -0
  118. package/node_modules/mdast-util-phrasing/lib/index.d.ts +3 -0
  119. package/node_modules/mdast-util-phrasing/lib/index.js +45 -0
  120. package/node_modules/mdast-util-phrasing/license +23 -0
  121. package/node_modules/mdast-util-phrasing/package.json +78 -0
  122. package/node_modules/mdast-util-phrasing/readme.md +200 -0
  123. package/node_modules/mdast-util-to-markdown/index.d.ts +16 -0
  124. package/node_modules/mdast-util-to-markdown/index.js +3 -0
  125. package/node_modules/mdast-util-to-markdown/lib/configure.d.ts +9 -0
  126. package/node_modules/mdast-util-to-markdown/lib/configure.d.ts.map +1 -0
  127. package/node_modules/mdast-util-to-markdown/lib/configure.js +79 -0
  128. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts +17 -0
  129. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts.map +1 -0
  130. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js +29 -0
  131. package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts +13 -0
  132. package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts.map +1 -0
  133. package/node_modules/mdast-util-to-markdown/lib/handle/break.js +30 -0
  134. package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts +13 -0
  135. package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts.map +1 -0
  136. package/node_modules/mdast-util-to-markdown/lib/handle/code.js +75 -0
  137. package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts +13 -0
  138. package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts.map +1 -0
  139. package/node_modules/mdast-util-to-markdown/lib/handle/definition.js +76 -0
  140. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts +24 -0
  141. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts.map +1 -0
  142. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js +69 -0
  143. package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts +13 -0
  144. package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts.map +1 -0
  145. package/node_modules/mdast-util-to-markdown/lib/handle/heading.js +75 -0
  146. package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts +15 -0
  147. package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts.map +1 -0
  148. package/node_modules/mdast-util-to-markdown/lib/handle/html.js +20 -0
  149. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts +21 -0
  150. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts.map +1 -0
  151. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js +63 -0
  152. package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts +21 -0
  153. package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts.map +1 -0
  154. package/node_modules/mdast-util-to-markdown/lib/handle/image.js +82 -0
  155. package/node_modules/mdast-util-to-markdown/lib/handle/index.d.ts +42 -0
  156. package/node_modules/mdast-util-to-markdown/lib/handle/index.d.ts.map +1 -0
  157. package/node_modules/mdast-util-to-markdown/lib/handle/index.js +45 -0
  158. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts +19 -0
  159. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts.map +1 -0
  160. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js +76 -0
  161. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts +21 -0
  162. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts.map +1 -0
  163. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js +63 -0
  164. package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts +24 -0
  165. package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts.map +1 -0
  166. package/node_modules/mdast-util-to-markdown/lib/handle/link.js +114 -0
  167. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts +13 -0
  168. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts.map +1 -0
  169. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.js +62 -0
  170. package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts +13 -0
  171. package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts.map +1 -0
  172. package/node_modules/mdast-util-to-markdown/lib/handle/list.js +100 -0
  173. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts +17 -0
  174. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts.map +1 -0
  175. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js +20 -0
  176. package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts +13 -0
  177. package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts.map +1 -0
  178. package/node_modules/mdast-util-to-markdown/lib/handle/root.js +23 -0
  179. package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts +24 -0
  180. package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts.map +1 -0
  181. package/node_modules/mdast-util-to-markdown/lib/handle/strong.js +69 -0
  182. package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts +17 -0
  183. package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts.map +1 -0
  184. package/node_modules/mdast-util-to-markdown/lib/handle/text.js +15 -0
  185. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts +11 -0
  186. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts.map +1 -0
  187. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js +21 -0
  188. package/node_modules/mdast-util-to-markdown/lib/index.d.ts +14 -0
  189. package/node_modules/mdast-util-to-markdown/lib/index.d.ts.map +1 -0
  190. package/node_modules/mdast-util-to-markdown/lib/index.js +187 -0
  191. package/node_modules/mdast-util-to-markdown/lib/join.d.ts +4 -0
  192. package/node_modules/mdast-util-to-markdown/lib/join.d.ts.map +1 -0
  193. package/node_modules/mdast-util-to-markdown/lib/join.js +39 -0
  194. package/node_modules/mdast-util-to-markdown/lib/types.d.ts +965 -0
  195. package/node_modules/mdast-util-to-markdown/lib/types.js +2 -0
  196. package/node_modules/mdast-util-to-markdown/lib/unsafe.d.ts +4 -0
  197. package/node_modules/mdast-util-to-markdown/lib/unsafe.d.ts.map +1 -0
  198. package/node_modules/mdast-util-to-markdown/lib/unsafe.js +146 -0
  199. package/node_modules/mdast-util-to-markdown/lib/util/association.d.ts +2 -0
  200. package/node_modules/mdast-util-to-markdown/lib/util/association.d.ts.map +1 -0
  201. package/node_modules/mdast-util-to-markdown/lib/util/association.js +33 -0
  202. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts +11 -0
  203. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts.map +1 -0
  204. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js +21 -0
  205. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts +8 -0
  206. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts.map +1 -0
  207. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js +38 -0
  208. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts +11 -0
  209. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts.map +1 -0
  210. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js +21 -0
  211. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts +11 -0
  212. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts.map +1 -0
  213. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js +21 -0
  214. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts +11 -0
  215. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts.map +1 -0
  216. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.js +21 -0
  217. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts +11 -0
  218. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts.map +1 -0
  219. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js +21 -0
  220. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts +11 -0
  221. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts.map +1 -0
  222. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.js +21 -0
  223. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts +11 -0
  224. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts.map +1 -0
  225. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js +21 -0
  226. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts +11 -0
  227. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts.map +1 -0
  228. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.js +21 -0
  229. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts +11 -0
  230. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts.map +1 -0
  231. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.js +21 -0
  232. package/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.d.ts +2 -0
  233. package/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.d.ts.map +1 -0
  234. package/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js +24 -0
  235. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts +19 -0
  236. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts.map +1 -0
  237. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.js +84 -0
  238. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts +19 -0
  239. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts.map +1 -0
  240. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js +125 -0
  241. package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts +7 -0
  242. package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts.map +1 -0
  243. package/node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.d.ts +10 -0
  244. package/node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.d.ts.map +1 -0
  245. package/node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js +11 -0
  246. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts +33 -0
  247. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts.map +1 -0
  248. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.js +82 -0
  249. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts +13 -0
  250. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts.map +1 -0
  251. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js +22 -0
  252. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts +9 -0
  253. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts.map +1 -0
  254. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js +34 -0
  255. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts +9 -0
  256. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts.map +1 -0
  257. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js +34 -0
  258. package/node_modules/mdast-util-to-markdown/lib/util/indent-lines.d.ts +2 -0
  259. package/node_modules/mdast-util-to-markdown/lib/util/indent-lines.d.ts.map +1 -0
  260. package/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js +35 -0
  261. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts +12 -0
  262. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts.map +1 -0
  263. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js +41 -0
  264. package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts +29 -0
  265. package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts.map +1 -0
  266. package/node_modules/mdast-util-to-markdown/lib/util/safe.js +174 -0
  267. package/node_modules/mdast-util-to-markdown/lib/util/track.d.ts +2 -0
  268. package/node_modules/mdast-util-to-markdown/lib/util/track.d.ts.map +1 -0
  269. package/node_modules/mdast-util-to-markdown/lib/util/track.js +55 -0
  270. package/node_modules/mdast-util-to-markdown/license +22 -0
  271. package/node_modules/mdast-util-to-markdown/package.json +132 -0
  272. package/node_modules/mdast-util-to-markdown/readme.md +750 -0
  273. package/node_modules/mdast-util-to-string/index.d.ts +2 -0
  274. package/node_modules/mdast-util-to-string/index.js +5 -0
  275. package/node_modules/mdast-util-to-string/lib/index.d.ts +31 -0
  276. package/node_modules/mdast-util-to-string/lib/index.js +108 -0
  277. package/node_modules/mdast-util-to-string/license +22 -0
  278. package/node_modules/mdast-util-to-string/package.json +78 -0
  279. package/node_modules/mdast-util-to-string/readme.md +218 -0
  280. package/node_modules/micromark/dev/index.d.ts +82 -0
  281. package/node_modules/micromark/dev/index.d.ts.map +1 -0
  282. package/node_modules/micromark/dev/index.js +68 -0
  283. package/node_modules/micromark/dev/lib/compile.d.ts +16 -0
  284. package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -0
  285. package/node_modules/micromark/dev/lib/compile.js +1152 -0
  286. package/node_modules/micromark/dev/lib/constructs.d.ts +73 -0
  287. package/node_modules/micromark/dev/lib/constructs.d.ts.map +1 -0
  288. package/node_modules/micromark/dev/lib/constructs.js +101 -0
  289. package/node_modules/micromark/dev/lib/create-tokenizer.d.ts +46 -0
  290. package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -0
  291. package/node_modules/micromark/dev/lib/create-tokenizer.js +717 -0
  292. package/node_modules/micromark/dev/lib/initialize/content.d.ts +4 -0
  293. package/node_modules/micromark/dev/lib/initialize/content.d.ts.map +1 -0
  294. package/node_modules/micromark/dev/lib/initialize/content.js +99 -0
  295. package/node_modules/micromark/dev/lib/initialize/document.d.ts +10 -0
  296. package/node_modules/micromark/dev/lib/initialize/document.d.ts.map +1 -0
  297. package/node_modules/micromark/dev/lib/initialize/document.js +445 -0
  298. package/node_modules/micromark/dev/lib/initialize/flow.d.ts +4 -0
  299. package/node_modules/micromark/dev/lib/initialize/flow.d.ts.map +1 -0
  300. package/node_modules/micromark/dev/lib/initialize/flow.js +86 -0
  301. package/node_modules/micromark/dev/lib/initialize/text.d.ts +8 -0
  302. package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -0
  303. package/node_modules/micromark/dev/lib/initialize/text.js +244 -0
  304. package/node_modules/micromark/dev/lib/parse.d.ts +10 -0
  305. package/node_modules/micromark/dev/lib/parse.d.ts.map +1 -0
  306. package/node_modules/micromark/dev/lib/parse.js +58 -0
  307. package/node_modules/micromark/dev/lib/postprocess.d.ts +9 -0
  308. package/node_modules/micromark/dev/lib/postprocess.d.ts.map +1 -0
  309. package/node_modules/micromark/dev/lib/postprocess.js +19 -0
  310. package/node_modules/micromark/dev/lib/preprocess.d.ts +13 -0
  311. package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -0
  312. package/node_modules/micromark/dev/lib/preprocess.js +141 -0
  313. package/node_modules/micromark/dev/stream.d.ts +35 -0
  314. package/node_modules/micromark/dev/stream.d.ts.map +1 -0
  315. package/node_modules/micromark/dev/stream.js +270 -0
  316. package/node_modules/micromark/index.d.ts +82 -0
  317. package/node_modules/micromark/index.d.ts.map +1 -0
  318. package/node_modules/micromark/index.js +60 -0
  319. package/node_modules/micromark/lib/compile.d.ts +16 -0
  320. package/node_modules/micromark/lib/compile.d.ts.map +1 -0
  321. package/node_modules/micromark/lib/compile.js +1060 -0
  322. package/node_modules/micromark/lib/constructs.d.ts +73 -0
  323. package/node_modules/micromark/lib/constructs.d.ts.map +1 -0
  324. package/node_modules/micromark/lib/constructs.js +85 -0
  325. package/node_modules/micromark/lib/create-tokenizer.d.ts +46 -0
  326. package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -0
  327. package/node_modules/micromark/lib/create-tokenizer.js +611 -0
  328. package/node_modules/micromark/lib/initialize/content.d.ts +4 -0
  329. package/node_modules/micromark/lib/initialize/content.d.ts.map +1 -0
  330. package/node_modules/micromark/lib/initialize/content.js +79 -0
  331. package/node_modules/micromark/lib/initialize/document.d.ts +10 -0
  332. package/node_modules/micromark/lib/initialize/document.d.ts.map +1 -0
  333. package/node_modules/micromark/lib/initialize/document.js +362 -0
  334. package/node_modules/micromark/lib/initialize/flow.d.ts +4 -0
  335. package/node_modules/micromark/lib/initialize/flow.d.ts.map +1 -0
  336. package/node_modules/micromark/lib/initialize/flow.js +58 -0
  337. package/node_modules/micromark/lib/initialize/text.d.ts +8 -0
  338. package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -0
  339. package/node_modules/micromark/lib/initialize/text.js +212 -0
  340. package/node_modules/micromark/lib/parse.d.ts +10 -0
  341. package/node_modules/micromark/lib/parse.d.ts.map +1 -0
  342. package/node_modules/micromark/lib/parse.js +56 -0
  343. package/node_modules/micromark/lib/postprocess.d.ts +9 -0
  344. package/node_modules/micromark/lib/postprocess.d.ts.map +1 -0
  345. package/node_modules/micromark/lib/postprocess.js +18 -0
  346. package/node_modules/micromark/lib/preprocess.d.ts +13 -0
  347. package/node_modules/micromark/lib/preprocess.d.ts.map +1 -0
  348. package/node_modules/micromark/lib/preprocess.js +115 -0
  349. package/node_modules/micromark/license +22 -0
  350. package/node_modules/micromark/package.json +100 -0
  351. package/node_modules/micromark/readme.md +488 -0
  352. package/node_modules/micromark/stream.d.ts +35 -0
  353. package/node_modules/micromark/stream.d.ts.map +1 -0
  354. package/node_modules/micromark/stream.js +256 -0
  355. package/node_modules/micromark-core-commonmark/dev/index.d.ts +23 -0
  356. package/node_modules/micromark-core-commonmark/dev/index.d.ts.map +1 -0
  357. package/node_modules/micromark-core-commonmark/dev/index.js +22 -0
  358. package/node_modules/micromark-core-commonmark/dev/lib/attention.d.ts +4 -0
  359. package/node_modules/micromark-core-commonmark/dev/lib/attention.d.ts.map +1 -0
  360. package/node_modules/micromark-core-commonmark/dev/lib/attention.js +300 -0
  361. package/node_modules/micromark-core-commonmark/dev/lib/autolink.d.ts +4 -0
  362. package/node_modules/micromark-core-commonmark/dev/lib/autolink.d.ts.map +1 -0
  363. package/node_modules/micromark-core-commonmark/dev/lib/autolink.js +269 -0
  364. package/node_modules/micromark-core-commonmark/dev/lib/blank-line.d.ts +4 -0
  365. package/node_modules/micromark-core-commonmark/dev/lib/blank-line.d.ts.map +1 -0
  366. package/node_modules/micromark-core-commonmark/dev/lib/blank-line.js +62 -0
  367. package/node_modules/micromark-core-commonmark/dev/lib/block-quote.d.ts +4 -0
  368. package/node_modules/micromark-core-commonmark/dev/lib/block-quote.d.ts.map +1 -0
  369. package/node_modules/micromark-core-commonmark/dev/lib/block-quote.js +162 -0
  370. package/node_modules/micromark-core-commonmark/dev/lib/character-escape.d.ts +4 -0
  371. package/node_modules/micromark-core-commonmark/dev/lib/character-escape.d.ts.map +1 -0
  372. package/node_modules/micromark-core-commonmark/dev/lib/character-escape.js +69 -0
  373. package/node_modules/micromark-core-commonmark/dev/lib/character-reference.d.ts +4 -0
  374. package/node_modules/micromark-core-commonmark/dev/lib/character-reference.d.ts.map +1 -0
  375. package/node_modules/micromark-core-commonmark/dev/lib/character-reference.js +166 -0
  376. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts +4 -0
  377. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -0
  378. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +514 -0
  379. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.d.ts +4 -0
  380. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.d.ts.map +1 -0
  381. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +202 -0
  382. package/node_modules/micromark-core-commonmark/dev/lib/code-text.d.ts +4 -0
  383. package/node_modules/micromark-core-commonmark/dev/lib/code-text.d.ts.map +1 -0
  384. package/node_modules/micromark-core-commonmark/dev/lib/code-text.js +257 -0
  385. package/node_modules/micromark-core-commonmark/dev/lib/content.d.ts +7 -0
  386. package/node_modules/micromark-core-commonmark/dev/lib/content.d.ts.map +1 -0
  387. package/node_modules/micromark-core-commonmark/dev/lib/content.js +185 -0
  388. package/node_modules/micromark-core-commonmark/dev/lib/definition.d.ts +4 -0
  389. package/node_modules/micromark-core-commonmark/dev/lib/definition.d.ts.map +1 -0
  390. package/node_modules/micromark-core-commonmark/dev/lib/definition.js +295 -0
  391. package/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.d.ts +4 -0
  392. package/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.d.ts.map +1 -0
  393. package/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js +65 -0
  394. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.d.ts +4 -0
  395. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.d.ts.map +1 -0
  396. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +233 -0
  397. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts +4 -0
  398. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -0
  399. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +989 -0
  400. package/node_modules/micromark-core-commonmark/dev/lib/html-text.d.ts +4 -0
  401. package/node_modules/micromark-core-commonmark/dev/lib/html-text.d.ts.map +1 -0
  402. package/node_modules/micromark-core-commonmark/dev/lib/html-text.js +783 -0
  403. package/node_modules/micromark-core-commonmark/dev/lib/label-end.d.ts +4 -0
  404. package/node_modules/micromark-core-commonmark/dev/lib/label-end.d.ts.map +1 -0
  405. package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +656 -0
  406. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts +4 -0
  407. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -0
  408. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +110 -0
  409. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts +4 -0
  410. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -0
  411. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +62 -0
  412. package/node_modules/micromark-core-commonmark/dev/lib/line-ending.d.ts +4 -0
  413. package/node_modules/micromark-core-commonmark/dev/lib/line-ending.d.ts.map +1 -0
  414. package/node_modules/micromark-core-commonmark/dev/lib/line-ending.js +34 -0
  415. package/node_modules/micromark-core-commonmark/dev/lib/list.d.ts +4 -0
  416. package/node_modules/micromark-core-commonmark/dev/lib/list.d.ts.map +1 -0
  417. package/node_modules/micromark-core-commonmark/dev/lib/list.js +306 -0
  418. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts +4 -0
  419. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -0
  420. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +210 -0
  421. package/node_modules/micromark-core-commonmark/dev/lib/thematic-break.d.ts +4 -0
  422. package/node_modules/micromark-core-commonmark/dev/lib/thematic-break.d.ts.map +1 -0
  423. package/node_modules/micromark-core-commonmark/dev/lib/thematic-break.js +120 -0
  424. package/node_modules/micromark-core-commonmark/index.d.ts +23 -0
  425. package/node_modules/micromark-core-commonmark/index.d.ts.map +1 -0
  426. package/node_modules/micromark-core-commonmark/index.js +22 -0
  427. package/node_modules/micromark-core-commonmark/lib/attention.d.ts +4 -0
  428. package/node_modules/micromark-core-commonmark/lib/attention.d.ts.map +1 -0
  429. package/node_modules/micromark-core-commonmark/lib/attention.js +241 -0
  430. package/node_modules/micromark-core-commonmark/lib/autolink.d.ts +4 -0
  431. package/node_modules/micromark-core-commonmark/lib/autolink.d.ts.map +1 -0
  432. package/node_modules/micromark-core-commonmark/lib/autolink.js +233 -0
  433. package/node_modules/micromark-core-commonmark/lib/blank-line.d.ts +4 -0
  434. package/node_modules/micromark-core-commonmark/lib/blank-line.d.ts.map +1 -0
  435. package/node_modules/micromark-core-commonmark/lib/blank-line.js +61 -0
  436. package/node_modules/micromark-core-commonmark/lib/block-quote.d.ts +4 -0
  437. package/node_modules/micromark-core-commonmark/lib/block-quote.d.ts.map +1 -0
  438. package/node_modules/micromark-core-commonmark/lib/block-quote.js +143 -0
  439. package/node_modules/micromark-core-commonmark/lib/character-escape.d.ts +4 -0
  440. package/node_modules/micromark-core-commonmark/lib/character-escape.d.ts.map +1 -0
  441. package/node_modules/micromark-core-commonmark/lib/character-escape.js +64 -0
  442. package/node_modules/micromark-core-commonmark/lib/character-reference.d.ts +4 -0
  443. package/node_modules/micromark-core-commonmark/lib/character-reference.d.ts.map +1 -0
  444. package/node_modules/micromark-core-commonmark/lib/character-reference.js +149 -0
  445. package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts +4 -0
  446. package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -0
  447. package/node_modules/micromark-core-commonmark/lib/code-fenced.js +460 -0
  448. package/node_modules/micromark-core-commonmark/lib/code-indented.d.ts +4 -0
  449. package/node_modules/micromark-core-commonmark/lib/code-indented.d.ts.map +1 -0
  450. package/node_modules/micromark-core-commonmark/lib/code-indented.js +177 -0
  451. package/node_modules/micromark-core-commonmark/lib/code-text.d.ts +4 -0
  452. package/node_modules/micromark-core-commonmark/lib/code-text.d.ts.map +1 -0
  453. package/node_modules/micromark-core-commonmark/lib/code-text.js +225 -0
  454. package/node_modules/micromark-core-commonmark/lib/content.d.ts +7 -0
  455. package/node_modules/micromark-core-commonmark/lib/content.d.ts.map +1 -0
  456. package/node_modules/micromark-core-commonmark/lib/content.js +163 -0
  457. package/node_modules/micromark-core-commonmark/lib/definition.d.ts +4 -0
  458. package/node_modules/micromark-core-commonmark/lib/definition.d.ts.map +1 -0
  459. package/node_modules/micromark-core-commonmark/lib/definition.js +254 -0
  460. package/node_modules/micromark-core-commonmark/lib/hard-break-escape.d.ts +4 -0
  461. package/node_modules/micromark-core-commonmark/lib/hard-break-escape.d.ts.map +1 -0
  462. package/node_modules/micromark-core-commonmark/lib/hard-break-escape.js +60 -0
  463. package/node_modules/micromark-core-commonmark/lib/heading-atx.d.ts +4 -0
  464. package/node_modules/micromark-core-commonmark/lib/heading-atx.d.ts.map +1 -0
  465. package/node_modules/micromark-core-commonmark/lib/heading-atx.js +195 -0
  466. package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts +4 -0
  467. package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -0
  468. package/node_modules/micromark-core-commonmark/lib/html-flow.js +876 -0
  469. package/node_modules/micromark-core-commonmark/lib/html-text.d.ts +4 -0
  470. package/node_modules/micromark-core-commonmark/lib/html-text.d.ts.map +1 -0
  471. package/node_modules/micromark-core-commonmark/lib/html-text.js +678 -0
  472. package/node_modules/micromark-core-commonmark/lib/label-end.d.ts +4 -0
  473. package/node_modules/micromark-core-commonmark/lib/label-end.d.ts.map +1 -0
  474. package/node_modules/micromark-core-commonmark/lib/label-end.js +560 -0
  475. package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts +4 -0
  476. package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -0
  477. package/node_modules/micromark-core-commonmark/lib/label-start-image.js +102 -0
  478. package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts +4 -0
  479. package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -0
  480. package/node_modules/micromark-core-commonmark/lib/label-start-link.js +55 -0
  481. package/node_modules/micromark-core-commonmark/lib/line-ending.d.ts +4 -0
  482. package/node_modules/micromark-core-commonmark/lib/line-ending.d.ts.map +1 -0
  483. package/node_modules/micromark-core-commonmark/lib/line-ending.js +33 -0
  484. package/node_modules/micromark-core-commonmark/lib/list.d.ts +4 -0
  485. package/node_modules/micromark-core-commonmark/lib/list.d.ts.map +1 -0
  486. package/node_modules/micromark-core-commonmark/lib/list.js +213 -0
  487. package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts +4 -0
  488. package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -0
  489. package/node_modules/micromark-core-commonmark/lib/setext-underline.js +185 -0
  490. package/node_modules/micromark-core-commonmark/lib/thematic-break.d.ts +4 -0
  491. package/node_modules/micromark-core-commonmark/lib/thematic-break.d.ts.map +1 -0
  492. package/node_modules/micromark-core-commonmark/lib/thematic-break.js +102 -0
  493. package/node_modules/micromark-core-commonmark/license +22 -0
  494. package/node_modules/micromark-core-commonmark/package.json +74 -0
  495. package/node_modules/micromark-core-commonmark/readme.md +171 -0
  496. package/node_modules/micromark-extension-gfm-table/dev/index.d.ts +55 -0
  497. package/node_modules/micromark-extension-gfm-table/dev/index.js +2 -0
  498. package/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.d.ts +38 -0
  499. package/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.d.ts.map +1 -0
  500. package/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.js +212 -0
  501. package/node_modules/micromark-extension-gfm-table/dev/lib/html.d.ts +11 -0
  502. package/node_modules/micromark-extension-gfm-table/dev/lib/html.d.ts.map +1 -0
  503. package/node_modules/micromark-extension-gfm-table/dev/lib/html.js +148 -0
  504. package/node_modules/micromark-extension-gfm-table/dev/lib/infer.d.ts +14 -0
  505. package/node_modules/micromark-extension-gfm-table/dev/lib/infer.d.ts.map +1 -0
  506. package/node_modules/micromark-extension-gfm-table/dev/lib/infer.js +64 -0
  507. package/node_modules/micromark-extension-gfm-table/dev/lib/syntax.d.ts +18 -0
  508. package/node_modules/micromark-extension-gfm-table/dev/lib/syntax.d.ts.map +1 -0
  509. package/node_modules/micromark-extension-gfm-table/dev/lib/syntax.js +941 -0
  510. package/node_modules/micromark-extension-gfm-table/index.d.ts +55 -0
  511. package/node_modules/micromark-extension-gfm-table/index.js +2 -0
  512. package/node_modules/micromark-extension-gfm-table/lib/edit-map.d.ts +38 -0
  513. package/node_modules/micromark-extension-gfm-table/lib/edit-map.d.ts.map +1 -0
  514. package/node_modules/micromark-extension-gfm-table/lib/edit-map.js +202 -0
  515. package/node_modules/micromark-extension-gfm-table/lib/html.d.ts +11 -0
  516. package/node_modules/micromark-extension-gfm-table/lib/html.d.ts.map +1 -0
  517. package/node_modules/micromark-extension-gfm-table/lib/html.js +130 -0
  518. package/node_modules/micromark-extension-gfm-table/lib/infer.d.ts +14 -0
  519. package/node_modules/micromark-extension-gfm-table/lib/infer.d.ts.map +1 -0
  520. package/node_modules/micromark-extension-gfm-table/lib/infer.js +52 -0
  521. package/node_modules/micromark-extension-gfm-table/lib/syntax.d.ts +18 -0
  522. package/node_modules/micromark-extension-gfm-table/lib/syntax.d.ts.map +1 -0
  523. package/node_modules/micromark-extension-gfm-table/lib/syntax.js +819 -0
  524. package/node_modules/micromark-extension-gfm-table/license +22 -0
  525. package/node_modules/micromark-extension-gfm-table/package.json +128 -0
  526. package/node_modules/micromark-extension-gfm-table/readme.md +515 -0
  527. package/node_modules/micromark-factory-destination/dev/index.d.ts +42 -0
  528. package/node_modules/micromark-factory-destination/dev/index.d.ts.map +1 -0
  529. package/node_modules/micromark-factory-destination/dev/index.js +255 -0
  530. package/node_modules/micromark-factory-destination/index.d.ts +42 -0
  531. package/node_modules/micromark-factory-destination/index.d.ts.map +1 -0
  532. package/node_modules/micromark-factory-destination/index.js +206 -0
  533. package/node_modules/micromark-factory-destination/license +22 -0
  534. package/node_modules/micromark-factory-destination/package.json +57 -0
  535. package/node_modules/micromark-factory-destination/readme.md +234 -0
  536. package/node_modules/micromark-factory-label/dev/index.d.ts +37 -0
  537. package/node_modules/micromark-factory-label/dev/index.d.ts.map +1 -0
  538. package/node_modules/micromark-factory-label/dev/index.js +172 -0
  539. package/node_modules/micromark-factory-label/index.d.ts +37 -0
  540. package/node_modules/micromark-factory-label/index.d.ts.map +1 -0
  541. package/node_modules/micromark-factory-label/index.js +148 -0
  542. package/node_modules/micromark-factory-label/license +22 -0
  543. package/node_modules/micromark-factory-label/package.json +60 -0
  544. package/node_modules/micromark-factory-label/readme.md +224 -0
  545. package/node_modules/micromark-factory-space/dev/index.d.ts +37 -0
  546. package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -0
  547. package/node_modules/micromark-factory-space/dev/index.js +67 -0
  548. package/node_modules/micromark-factory-space/index.d.ts +37 -0
  549. package/node_modules/micromark-factory-space/index.d.ts.map +1 -0
  550. package/node_modules/micromark-factory-space/index.js +64 -0
  551. package/node_modules/micromark-factory-space/license +22 -0
  552. package/node_modules/micromark-factory-space/package.json +55 -0
  553. package/node_modules/micromark-factory-space/readme.md +225 -0
  554. package/node_modules/micromark-factory-title/dev/index.d.ts +36 -0
  555. package/node_modules/micromark-factory-title/dev/index.d.ts.map +1 -0
  556. package/node_modules/micromark-factory-title/dev/index.js +169 -0
  557. package/node_modules/micromark-factory-title/index.d.ts +36 -0
  558. package/node_modules/micromark-factory-title/index.d.ts.map +1 -0
  559. package/node_modules/micromark-factory-title/index.js +158 -0
  560. package/node_modules/micromark-factory-title/license +22 -0
  561. package/node_modules/micromark-factory-title/package.json +58 -0
  562. package/node_modules/micromark-factory-title/readme.md +229 -0
  563. package/node_modules/micromark-factory-whitespace/dev/index.d.ts +22 -0
  564. package/node_modules/micromark-factory-whitespace/dev/index.d.ts.map +1 -0
  565. package/node_modules/micromark-factory-whitespace/dev/index.js +53 -0
  566. package/node_modules/micromark-factory-whitespace/index.d.ts +22 -0
  567. package/node_modules/micromark-factory-whitespace/index.d.ts.map +1 -0
  568. package/node_modules/micromark-factory-whitespace/index.js +44 -0
  569. package/node_modules/micromark-factory-whitespace/license +22 -0
  570. package/node_modules/micromark-factory-whitespace/package.json +57 -0
  571. package/node_modules/micromark-factory-whitespace/readme.md +205 -0
  572. package/node_modules/micromark-util-character/dev/index.d.ts +195 -0
  573. package/node_modules/micromark-util-character/dev/index.d.ts.map +1 -0
  574. package/node_modules/micromark-util-character/dev/index.js +252 -0
  575. package/node_modules/micromark-util-character/index.d.ts +195 -0
  576. package/node_modules/micromark-util-character/index.d.ts.map +1 -0
  577. package/node_modules/micromark-util-character/index.js +246 -0
  578. package/node_modules/micromark-util-character/license +22 -0
  579. package/node_modules/micromark-util-character/package.json +57 -0
  580. package/node_modules/micromark-util-character/readme.md +446 -0
  581. package/node_modules/micromark-util-chunked/dev/index.d.ts +41 -0
  582. package/node_modules/micromark-util-chunked/dev/index.d.ts.map +1 -0
  583. package/node_modules/micromark-util-chunked/dev/index.js +89 -0
  584. package/node_modules/micromark-util-chunked/index.d.ts +41 -0
  585. package/node_modules/micromark-util-chunked/index.d.ts.map +1 -0
  586. package/node_modules/micromark-util-chunked/index.js +81 -0
  587. package/node_modules/micromark-util-chunked/license +22 -0
  588. package/node_modules/micromark-util-chunked/package.json +57 -0
  589. package/node_modules/micromark-util-chunked/readme.md +219 -0
  590. package/node_modules/micromark-util-classify-character/dev/index.d.ts +18 -0
  591. package/node_modules/micromark-util-classify-character/dev/index.d.ts.map +1 -0
  592. package/node_modules/micromark-util-classify-character/dev/index.js +38 -0
  593. package/node_modules/micromark-util-classify-character/index.d.ts +18 -0
  594. package/node_modules/micromark-util-classify-character/index.d.ts.map +1 -0
  595. package/node_modules/micromark-util-classify-character/index.js +27 -0
  596. package/node_modules/micromark-util-classify-character/license +22 -0
  597. package/node_modules/micromark-util-classify-character/package.json +59 -0
  598. package/node_modules/micromark-util-classify-character/readme.md +205 -0
  599. package/node_modules/micromark-util-combine-extensions/index.d.ts +22 -0
  600. package/node_modules/micromark-util-combine-extensions/index.d.ts.map +1 -0
  601. package/node_modules/micromark-util-combine-extensions/index.js +143 -0
  602. package/node_modules/micromark-util-combine-extensions/license +22 -0
  603. package/node_modules/micromark-util-combine-extensions/package.json +52 -0
  604. package/node_modules/micromark-util-combine-extensions/readme.md +201 -0
  605. package/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts +16 -0
  606. package/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts.map +1 -0
  607. package/node_modules/micromark-util-decode-numeric-character-reference/dev/index.js +42 -0
  608. package/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts +16 -0
  609. package/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts.map +1 -0
  610. package/node_modules/micromark-util-decode-numeric-character-reference/index.js +32 -0
  611. package/node_modules/micromark-util-decode-numeric-character-reference/license +22 -0
  612. package/node_modules/micromark-util-decode-numeric-character-reference/package.json +59 -0
  613. package/node_modules/micromark-util-decode-numeric-character-reference/readme.md +184 -0
  614. package/node_modules/micromark-util-decode-string/dev/index.d.ts +14 -0
  615. package/node_modules/micromark-util-decode-string/dev/index.d.ts.map +1 -0
  616. package/node_modules/micromark-util-decode-string/dev/index.js +53 -0
  617. package/node_modules/micromark-util-decode-string/index.d.ts +14 -0
  618. package/node_modules/micromark-util-decode-string/index.d.ts.map +1 -0
  619. package/node_modules/micromark-util-decode-string/index.js +45 -0
  620. package/node_modules/micromark-util-decode-string/license +22 -0
  621. package/node_modules/micromark-util-decode-string/package.json +63 -0
  622. package/node_modules/micromark-util-decode-string/readme.md +179 -0
  623. package/node_modules/micromark-util-encode/index.d.ts +14 -0
  624. package/node_modules/micromark-util-encode/index.d.ts.map +1 -0
  625. package/node_modules/micromark-util-encode/index.js +33 -0
  626. package/node_modules/micromark-util-encode/license +22 -0
  627. package/node_modules/micromark-util-encode/package.json +47 -0
  628. package/node_modules/micromark-util-encode/readme.md +176 -0
  629. package/node_modules/micromark-util-html-tag-name/index.d.ts +30 -0
  630. package/node_modules/micromark-util-html-tag-name/index.d.ts.map +1 -0
  631. package/node_modules/micromark-util-html-tag-name/index.js +93 -0
  632. package/node_modules/micromark-util-html-tag-name/license +22 -0
  633. package/node_modules/micromark-util-html-tag-name/package.json +47 -0
  634. package/node_modules/micromark-util-html-tag-name/readme.md +193 -0
  635. package/node_modules/micromark-util-normalize-identifier/dev/index.d.ts +21 -0
  636. package/node_modules/micromark-util-normalize-identifier/dev/index.d.ts.map +1 -0
  637. package/node_modules/micromark-util-normalize-identifier/dev/index.js +38 -0
  638. package/node_modules/micromark-util-normalize-identifier/index.d.ts +21 -0
  639. package/node_modules/micromark-util-normalize-identifier/index.d.ts.map +1 -0
  640. package/node_modules/micromark-util-normalize-identifier/index.js +33 -0
  641. package/node_modules/micromark-util-normalize-identifier/license +22 -0
  642. package/node_modules/micromark-util-normalize-identifier/package.json +58 -0
  643. package/node_modules/micromark-util-normalize-identifier/readme.md +187 -0
  644. package/node_modules/micromark-util-resolve-all/index.d.ts +22 -0
  645. package/node_modules/micromark-util-resolve-all/index.d.ts.map +1 -0
  646. package/node_modules/micromark-util-resolve-all/index.js +32 -0
  647. package/node_modules/micromark-util-resolve-all/license +22 -0
  648. package/node_modules/micromark-util-resolve-all/package.json +48 -0
  649. package/node_modules/micromark-util-resolve-all/readme.md +238 -0
  650. package/node_modules/micromark-util-sanitize-uri/dev/index.d.ts +36 -0
  651. package/node_modules/micromark-util-sanitize-uri/dev/index.d.ts.map +1 -0
  652. package/node_modules/micromark-util-sanitize-uri/dev/index.js +124 -0
  653. package/node_modules/micromark-util-sanitize-uri/index.d.ts +36 -0
  654. package/node_modules/micromark-util-sanitize-uri/index.d.ts.map +1 -0
  655. package/node_modules/micromark-util-sanitize-uri/index.js +107 -0
  656. package/node_modules/micromark-util-sanitize-uri/license +22 -0
  657. package/node_modules/micromark-util-sanitize-uri/package.json +59 -0
  658. package/node_modules/micromark-util-sanitize-uri/readme.md +214 -0
  659. package/node_modules/micromark-util-subtokenize/dev/index.d.ts +12 -0
  660. package/node_modules/micromark-util-subtokenize/dev/index.d.ts.map +1 -0
  661. package/node_modules/micromark-util-subtokenize/dev/index.js +284 -0
  662. package/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.d.ts +161 -0
  663. package/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.d.ts.map +1 -0
  664. package/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.js +288 -0
  665. package/node_modules/micromark-util-subtokenize/index.d.ts +12 -0
  666. package/node_modules/micromark-util-subtokenize/index.d.ts.map +1 -0
  667. package/node_modules/micromark-util-subtokenize/index.js +228 -0
  668. package/node_modules/micromark-util-subtokenize/lib/splice-buffer.d.ts +161 -0
  669. package/node_modules/micromark-util-subtokenize/lib/splice-buffer.d.ts.map +1 -0
  670. package/node_modules/micromark-util-subtokenize/lib/splice-buffer.js +251 -0
  671. package/node_modules/micromark-util-subtokenize/license +22 -0
  672. package/node_modules/micromark-util-subtokenize/package.json +60 -0
  673. package/node_modules/micromark-util-subtokenize/readme.md +181 -0
  674. package/node_modules/micromark-util-symbol/lib/codes.d.ts +139 -0
  675. package/node_modules/micromark-util-symbol/lib/codes.d.ts.map +1 -0
  676. package/node_modules/micromark-util-symbol/lib/codes.js +158 -0
  677. package/node_modules/micromark-util-symbol/lib/constants.d.ts +37 -0
  678. package/node_modules/micromark-util-symbol/lib/constants.d.ts.map +1 -0
  679. package/node_modules/micromark-util-symbol/lib/constants.js +44 -0
  680. package/node_modules/micromark-util-symbol/lib/default.d.ts +5 -0
  681. package/node_modules/micromark-util-symbol/lib/default.d.ts.map +1 -0
  682. package/node_modules/micromark-util-symbol/lib/default.js +4 -0
  683. package/node_modules/micromark-util-symbol/lib/types.d.ts +106 -0
  684. package/node_modules/micromark-util-symbol/lib/types.d.ts.map +1 -0
  685. package/node_modules/micromark-util-symbol/lib/types.js +453 -0
  686. package/node_modules/micromark-util-symbol/lib/values.d.ts +102 -0
  687. package/node_modules/micromark-util-symbol/lib/values.d.ts.map +1 -0
  688. package/node_modules/micromark-util-symbol/lib/values.js +109 -0
  689. package/node_modules/micromark-util-symbol/license +22 -0
  690. package/node_modules/micromark-util-symbol/package.json +43 -0
  691. package/node_modules/micromark-util-symbol/readme.md +168 -0
  692. package/node_modules/micromark-util-types/index.d.ts +1312 -0
  693. package/node_modules/micromark-util-types/index.js +2 -0
  694. package/node_modules/micromark-util-types/license +22 -0
  695. package/node_modules/micromark-util-types/package.json +71 -0
  696. package/node_modules/micromark-util-types/readme.md +151 -0
  697. package/node_modules/ms/index.js +162 -0
  698. package/node_modules/ms/license.md +21 -0
  699. package/node_modules/ms/package.json +38 -0
  700. package/node_modules/ms/readme.md +59 -0
  701. package/node_modules/unist-util-is/index.d.ts +5 -0
  702. package/node_modules/unist-util-is/index.d.ts.map +1 -0
  703. package/node_modules/unist-util-is/index.js +7 -0
  704. package/node_modules/unist-util-is/lib/index.d.ts +111 -0
  705. package/node_modules/unist-util-is/lib/index.d.ts.map +1 -0
  706. package/node_modules/unist-util-is/lib/index.js +296 -0
  707. package/node_modules/unist-util-is/license +22 -0
  708. package/node_modules/unist-util-is/package.json +103 -0
  709. package/node_modules/unist-util-is/readme.md +351 -0
  710. package/node_modules/unist-util-stringify-position/index.d.ts +1 -0
  711. package/node_modules/unist-util-stringify-position/index.js +1 -0
  712. package/node_modules/unist-util-stringify-position/lib/index.d.ts +61 -0
  713. package/node_modules/unist-util-stringify-position/lib/index.js +84 -0
  714. package/node_modules/unist-util-stringify-position/license +22 -0
  715. package/node_modules/unist-util-stringify-position/package.json +80 -0
  716. package/node_modules/unist-util-stringify-position/readme.md +206 -0
  717. package/node_modules/unist-util-visit/index.d.ts +9 -0
  718. package/node_modules/unist-util-visit/index.js +2 -0
  719. package/node_modules/unist-util-visit/lib/index.d.ts +195 -0
  720. package/node_modules/unist-util-visit/lib/index.d.ts.map +1 -0
  721. package/node_modules/unist-util-visit/lib/index.js +312 -0
  722. package/node_modules/unist-util-visit/license +22 -0
  723. package/node_modules/unist-util-visit/package.json +108 -0
  724. package/node_modules/unist-util-visit/readme.md +313 -0
  725. package/node_modules/unist-util-visit-parents/index.d.ts +14 -0
  726. package/node_modules/unist-util-visit-parents/index.js +2 -0
  727. package/node_modules/unist-util-visit-parents/lib/color.d.ts +6 -0
  728. package/node_modules/unist-util-visit-parents/lib/color.d.ts.map +1 -0
  729. package/node_modules/unist-util-visit-parents/lib/color.js +7 -0
  730. package/node_modules/unist-util-visit-parents/lib/color.node.d.ts +6 -0
  731. package/node_modules/unist-util-visit-parents/lib/color.node.d.ts.map +1 -0
  732. package/node_modules/unist-util-visit-parents/lib/color.node.js +7 -0
  733. package/node_modules/unist-util-visit-parents/lib/index.d.ts +219 -0
  734. package/node_modules/unist-util-visit-parents/lib/index.d.ts.map +1 -0
  735. package/node_modules/unist-util-visit-parents/lib/index.js +399 -0
  736. package/node_modules/unist-util-visit-parents/license +22 -0
  737. package/node_modules/unist-util-visit-parents/package.json +106 -0
  738. package/node_modules/unist-util-visit-parents/readme.md +388 -0
  739. package/node_modules/zwitch/index.d.ts +67 -0
  740. package/node_modules/zwitch/index.js +118 -0
  741. package/node_modules/zwitch/license +22 -0
  742. package/node_modules/zwitch/package.json +72 -0
  743. package/node_modules/zwitch/readme.md +226 -0
  744. package/npm-shrinkwrap.json +737 -3
  745. package/openclaw.plugin.json +164 -89
  746. package/package.json +10 -7
  747. package/skills/feishu-drive/SKILL.md +5 -2
  748. package/dist/legacy-state-migrations-api.js +0 -73
  749. package/dist/monitor.state-DAHbcR2N.js +0 -173
  750. package/dist/send-result-BMQw-YhV.js +0 -287
package/dist/api.js CHANGED
@@ -1,20 +1,21 @@
1
- import { r as listEnabledFeishuAccounts } from "./accounts-Bs5uJ4h0.js";
2
- import { a as setFeishuNamedAccountEnabled, i as feishuSetupAdapter, n as feishuSetupWizard, r as runFeishuLogin, t as feishuPlugin } from "./channel-DRQRQQQ3.js";
3
- import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, n as buildFeishuModelOverrideParentCandidates, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-CdLdoot3.js";
1
+ import { r as listEnabledFeishuAccounts } from "./accounts-BDoGHJDk.js";
2
+ import { a as setFeishuNamedAccountEnabled, i as feishuSetupAdapter, n as feishuSetupWizard, r as runFeishuLogin, t as feishuPlugin } from "./channel-X30GQVwc.js";
3
+ import { p as parseFeishuMarkdown, u as chunkFeishuMarkdown } from "./send-result-DsqTk27v.js";
4
+ import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, n as buildFeishuModelOverrideParentCandidates, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-BeJL-wq7.js";
5
+ import { r as createFeishuClient, s as resolveConfiguredHttpTimeoutMs } from "./client-87BmeMpj.js";
4
6
  import { t as getFeishuRuntime } from "./runtime-C5JxBWZp.js";
5
- import { r as createFeishuClient } from "./client-B7EAV_Ss.js";
6
- import { a as toolExecutionErrorResult, d as createFeishuToolClient, f as resolveAnyEnabledFeishuToolsConfig, m as resolveToolsConfig, n as registerFeishuDriveTools, o as unknownToolActionResult, p as resolveFeishuToolAccount, u as registerFeishuChatTools } from "./drive-D0lIhxqZ.js";
7
+ import { a as toolExecutionErrorResult, f as registerFeishuChatTools, g as resolveToolsConfig, h as resolveFeishuToolAccount, m as resolveAnyEnabledFeishuToolsConfig, n as registerFeishuDriveTools, o as unknownToolActionResult, p as createFeishuToolClient } from "./drive-B4E8OXZ0.js";
7
8
  import { n as getFeishuThreadBindingManager, r as testing, t as createFeishuThreadBindingManager } from "./thread-bindings-V0bwk0A1.js";
8
- import { n as handleFeishuSubagentEnded, r as handleFeishuSubagentSpawning, t as handleFeishuSubagentDeliveryTarget } from "./subagent-hooks-B2iWPYJ1.js";
9
- import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, readStringValue, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
9
+ import { n as handleFeishuSubagentEnded, r as handleFeishuSubagentSpawning, t as handleFeishuSubagentDeliveryTarget } from "./subagent-hooks-BKTOxB-T.js";
10
10
  import { optionalPositiveIntegerSchema } from "openclaw/plugin-sdk/channel-actions";
11
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, readStringValue, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
11
12
  import { existsSync } from "node:fs";
12
13
  import { homedir } from "node:os";
13
14
  import { basename, isAbsolute, resolve } from "node:path";
14
15
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
15
- import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
16
16
  import { jsonResult } from "openclaw/plugin-sdk/tool-results";
17
17
  import { Type } from "typebox";
18
+ import { canonicalizeBase64, estimateBase64DecodedBytes, extensionForMime } from "openclaw/plugin-sdk/media-runtime";
18
19
  import { readPositiveIntegerParam } from "openclaw/plugin-sdk/param-readers";
19
20
  import { createClackPrompter } from "openclaw/plugin-sdk/setup-runtime";
20
21
  //#region extensions/feishu/src/doc-schema.ts
@@ -232,7 +233,7 @@ function calculateAdaptiveColumnWidths(blocks, tableBlockId) {
232
233
  const cellId = cellIds[row * column_size + col];
233
234
  if (cellId) {
234
235
  const length = getWeightedLength(getCellText(cellId));
235
- maxLengths[col] = Math.max(maxLengths[col], length);
236
+ maxLengths[col] = Math.max(maxLengths[col] ?? 0, length);
236
237
  }
237
238
  }
238
239
  const totalLength = maxLengths.reduce((a, b) => a + b, 0);
@@ -252,8 +253,10 @@ function calculateAdaptiveColumnWidths(blocks, tableBlockId) {
252
253
  const perColumn = Math.floor(remaining / growable.length);
253
254
  if (perColumn === 0) break;
254
255
  for (const i of growable) {
255
- const add = Math.min(perColumn, MAX_COLUMN_WIDTH - widths[i]);
256
- widths[i] += add;
256
+ const width = widths[i];
257
+ if (width === void 0) continue;
258
+ const add = Math.min(perColumn, MAX_COLUMN_WIDTH - width);
259
+ widths[i] = width + add;
257
260
  remaining -= add;
258
261
  }
259
262
  }
@@ -471,8 +474,7 @@ async function insertBlocksInBatches(client, docToken, blocks, firstLevelBlockId
471
474
  }
472
475
  if (currentBatch.blocks.length > 0) batches.push(currentBatch);
473
476
  let currentIndex = startIndex;
474
- for (let i = 0; i < batches.length; i++) {
475
- const batch = batches[i];
477
+ for (const [i, batch] of batches.entries()) {
476
478
  logger?.info?.(`feishu_doc: Inserting batch ${i + 1}/${batches.length} (${batch.blocks.length} blocks)...`);
477
479
  const children = await insertBatch(client, docToken, batch.blocks, batch.firstLevelIds, parentBlockId, currentIndex);
478
480
  allChildren.push(...children);
@@ -524,6 +526,7 @@ function parseColorMarkup(content) {
524
526
  } else {
525
527
  const tagStr = normalizeLowercaseStringOrEmpty(match[1]);
526
528
  const text = match[2];
529
+ if (text === void 0) continue;
527
530
  const tags = tagStr.split(/\s+/);
528
531
  const segment = { text };
529
532
  for (const tag of tags) if (tag.startsWith("bg:")) {
@@ -563,6 +566,249 @@ async function updateColorText(client, docToken, blockId, content) {
563
566
  };
564
567
  }
565
568
  //#endregion
569
+ //#region extensions/feishu/src/docx-markdown.ts
570
+ const MAX_BREAK_PROBES = 32;
571
+ const STABLE_LINE_CONTAINER_TYPES = /* @__PURE__ */ new Set([
572
+ "list",
573
+ "blockquote",
574
+ "code"
575
+ ]);
576
+ function visitMarkdown(root, visitor) {
577
+ const pending = [root];
578
+ while (pending.length > 0) {
579
+ const node = pending.pop();
580
+ if (!node) continue;
581
+ visitor(node);
582
+ if (!node.children) continue;
583
+ for (let index = node.children.length - 1; index >= 0; index -= 1) {
584
+ const child = node.children[index];
585
+ if (child) pending.push(child);
586
+ }
587
+ }
588
+ }
589
+ function resolveRemoteImageUrl(value) {
590
+ if (!value) return;
591
+ try {
592
+ const url = new URL(value);
593
+ return url.protocol === "http:" || url.protocol === "https:" ? value : void 0;
594
+ } catch {
595
+ return;
596
+ }
597
+ }
598
+ function collectMarkdownImages(root) {
599
+ const definitions = /* @__PURE__ */ new Map();
600
+ visitMarkdown(root, (node) => {
601
+ if (node.type !== "definition" || !node.identifier || !node.url) return;
602
+ if (!definitions.has(node.identifier)) definitions.set(node.identifier, node.url);
603
+ });
604
+ const images = [];
605
+ visitMarkdown(root, (node) => {
606
+ if (node.type === "image") {
607
+ images.push({ url: resolveRemoteImageUrl(node.url) });
608
+ return;
609
+ }
610
+ if (node.type === "imageReference") images.push({ url: resolveRemoteImageUrl(node.identifier ? definitions.get(node.identifier) : void 0) });
611
+ });
612
+ return images;
613
+ }
614
+ function splitSourceAtOffsets(source, offsets) {
615
+ const chunks = [];
616
+ let start = 0;
617
+ for (const offset of offsets) {
618
+ if (offset <= start || offset >= source.length) continue;
619
+ chunks.push(source.slice(start, offset));
620
+ start = offset;
621
+ }
622
+ chunks.push(source.slice(start));
623
+ return chunks;
624
+ }
625
+ function headingOffsets(source, root) {
626
+ const offsets = [];
627
+ for (const node of root.children ?? []) {
628
+ if (node.type !== "heading" || node.depth === void 0 || node.depth > 2) continue;
629
+ const offset = node.position?.start.offset;
630
+ if (offset !== void 0 && source[offset] === "#") offsets.push(offset);
631
+ }
632
+ return offsets;
633
+ }
634
+ function blockBreakOffsets(root) {
635
+ const offsets = [];
636
+ for (const block of root.children ?? []) {
637
+ const blockStart = block.position?.start.offset;
638
+ if (blockStart !== void 0 && blockStart > 0) offsets.push(blockStart);
639
+ }
640
+ return offsets;
641
+ }
642
+ function paragraphBreakOffsets(source, root) {
643
+ const offsets = [];
644
+ for (const block of root.children ?? []) {
645
+ if (block.type !== "paragraph") continue;
646
+ for (const child of block.children ?? []) {
647
+ if (child.type !== "text") continue;
648
+ const start = child.position?.start.offset;
649
+ const end = child.position?.end.offset;
650
+ if (start === void 0 || end === void 0) continue;
651
+ for (let offset = start; offset < end; offset += 1) {
652
+ const char = source[offset];
653
+ if (char === " " || char === " " || char === "\n" || char === "\r") offsets.push(offset + 1);
654
+ }
655
+ }
656
+ }
657
+ return offsets;
658
+ }
659
+ function lineBreakOffsets(source) {
660
+ const offsets = [];
661
+ for (let offset = 0; offset < source.length; offset += 1) if (source[offset] === "\n" && offset + 1 < source.length) offsets.push(offset + 1);
662
+ return offsets;
663
+ }
664
+ function nearestOffset(offsets, target, sourceLength) {
665
+ return offsets.filter((offset) => offset > 0 && offset < sourceLength).toSorted((left, right) => Math.abs(left - target) - Math.abs(right - target) || left - right);
666
+ }
667
+ function isStableParagraphBreak(source, offset) {
668
+ const before = parseFeishuMarkdown(source.slice(0, offset)).children?.at(-1);
669
+ const after = parseFeishuMarkdown(source.slice(offset)).children?.[0];
670
+ return before?.type === "paragraph" && after?.type === "paragraph";
671
+ }
672
+ function isStableContainerBreak(source, offset, containerType) {
673
+ const before = parseFeishuMarkdown(source.slice(0, offset)).children;
674
+ const after = parseFeishuMarkdown(source.slice(offset)).children;
675
+ return before?.length === 1 && after?.length === 1 && before[0]?.type === containerType && after[0]?.type === containerType;
676
+ }
677
+ function splitTableAtRow(source, root, target) {
678
+ const table = root.children?.length === 1 ? root.children[0] : void 0;
679
+ if (table?.type !== "table") return;
680
+ const rows = table.children ?? [];
681
+ const firstBodyOffset = rows[1]?.position?.start.offset;
682
+ const splitOffset = nearestOffset(rows.slice(2).map((row) => row.position?.start.offset).filter((offset) => offset !== void 0), target, source.length)[0];
683
+ if (firstBodyOffset === void 0 || splitOffset === void 0) return;
684
+ const tableStart = table.position?.start.offset ?? 0;
685
+ const repeatedHeader = source.slice(tableStart, firstBodyOffset);
686
+ const chunks = [source.slice(0, splitOffset), `${repeatedHeader}${source.slice(splitOffset)}`];
687
+ if (chunks.every((chunk) => parseFeishuMarkdown(chunk).children?.[0]?.type === "table")) return chunks;
688
+ }
689
+ function isFencedCodeSource(source) {
690
+ const firstLineEnd = source.indexOf("\n");
691
+ const firstLine = source.slice(0, firstLineEnd === -1 ? source.length : firstLineEnd);
692
+ let indent = 0;
693
+ while (indent < firstLine.length && firstLine[indent] === " ") indent += 1;
694
+ if (indent > 3) return false;
695
+ const marker = firstLine.slice(indent);
696
+ return marker.startsWith("```") || marker.startsWith("~~~");
697
+ }
698
+ function createDocxMarkdownChunk(markdown) {
699
+ return {
700
+ markdown,
701
+ images: collectMarkdownImages(parseFeishuMarkdown(markdown))
702
+ };
703
+ }
704
+ function createDocxMarkdownPlan(markdown) {
705
+ return { chunks: splitSourceAtOffsets(markdown, headingOffsets(markdown, parseFeishuMarkdown(markdown))).map(createDocxMarkdownChunk) };
706
+ }
707
+ function splitDocxMarkdownBySize(markdown, maxChars) {
708
+ if (markdown.length <= maxChars) return [markdown];
709
+ const root = parseFeishuMarkdown(markdown);
710
+ const target = Math.min(markdown.length - 1, Math.max(1, maxChars));
711
+ const splitOffset = nearestOffset(blockBreakOffsets(root), target, markdown.length)[0];
712
+ if (splitOffset !== void 0) return [markdown.slice(0, splitOffset), markdown.slice(splitOffset)];
713
+ const paragraphOffset = nearestOffset(paragraphBreakOffsets(markdown, root), target, markdown.length).slice(0, MAX_BREAK_PROBES).find((offset) => isStableParagraphBreak(markdown, offset));
714
+ if (paragraphOffset !== void 0) return [markdown.slice(0, paragraphOffset), markdown.slice(paragraphOffset)];
715
+ if (root.children?.length === 1 && root.children[0]?.type === "code" && isFencedCodeSource(markdown)) return chunkFeishuMarkdown(markdown, maxChars);
716
+ const tableChunks = splitTableAtRow(markdown, root, target);
717
+ if (tableChunks) return tableChunks;
718
+ const containerType = root.children?.length === 1 ? root.children[0]?.type : void 0;
719
+ if (containerType && STABLE_LINE_CONTAINER_TYPES.has(containerType)) {
720
+ const containerOffset = nearestOffset(lineBreakOffsets(markdown), target, markdown.length).slice(0, MAX_BREAK_PROBES).find((offset) => isStableContainerBreak(markdown, offset, containerType));
721
+ if (containerOffset !== void 0) return [markdown.slice(0, containerOffset), markdown.slice(containerOffset)];
722
+ }
723
+ return [markdown];
724
+ }
725
+ //#endregion
726
+ //#region extensions/feishu/src/docx-upload-input.ts
727
+ function decodeBase64Image(params) {
728
+ const estimatedBytes = estimateBase64DecodedBytes(params.payload);
729
+ if (estimatedBytes > params.maxBytes) throw new Error(`${params.oversizedLabel} exceeds limit: estimated ${estimatedBytes} bytes > ${params.maxBytes} bytes`);
730
+ const canonical = canonicalizeBase64(params.payload);
731
+ if (!canonical) throw new Error(params.invalidMessage);
732
+ return Buffer.from(canonical, "base64");
733
+ }
734
+ function resolveDataUriImage(image, maxBytes, fileName) {
735
+ const commaIndex = image.indexOf(",");
736
+ if (commaIndex === -1) throw new Error("Invalid data URI: missing comma separator.");
737
+ const metadata = image.slice(5, commaIndex).split(";");
738
+ if (!metadata.slice(1).map((value) => value.trim().toLowerCase()).includes("base64")) throw new Error("Invalid data URI: missing ';base64' marker. Expected format: data:image/png;base64,<base64data>");
739
+ const buffer = decodeBase64Image({
740
+ payload: image.slice(commaIndex + 1),
741
+ maxBytes,
742
+ invalidMessage: "Invalid data URI: base64 payload is malformed.",
743
+ oversizedLabel: "Image data URI"
744
+ });
745
+ const mime = metadata[0]?.trim();
746
+ const extension = extensionForMime(mime)?.slice(1) ?? "png";
747
+ return {
748
+ buffer,
749
+ fileName: fileName ?? `image.${extension}`
750
+ };
751
+ }
752
+ async function resolveLocalUpload(filePath, maxBytes, localRoots, fileName) {
753
+ return {
754
+ buffer: (await getFeishuRuntime().media.loadWebMedia(resolve(filePath), {
755
+ maxBytes,
756
+ optimizeImages: false,
757
+ localRoots
758
+ })).buffer,
759
+ fileName: fileName ?? basename(filePath)
760
+ };
761
+ }
762
+ function resolveImageLocalPath(image) {
763
+ const candidate = image.startsWith("~") ? `${homedir()}${image.slice(1)}` : image;
764
+ const unambiguousPath = image.startsWith("~") || image.startsWith("./") || image.startsWith("../");
765
+ const absolutePath = isAbsolute(image);
766
+ if (unambiguousPath || absolutePath && existsSync(candidate)) return candidate;
767
+ if (absolutePath) throw new Error(`File not found: "${candidate}". If you intended to pass image binary data, use a data URI instead: data:image/jpeg;base64,...`);
768
+ }
769
+ async function resolveRemoteUpload(input) {
770
+ const fetched = await getFeishuRuntime().channel.media.readRemoteMediaBuffer({
771
+ url: input.url,
772
+ maxBytes: input.maxBytes,
773
+ ...input.remoteReadTimeoutMs !== void 0 ? {
774
+ responseHeaderTimeoutMs: input.remoteReadTimeoutMs,
775
+ readIdleTimeoutMs: input.remoteReadTimeoutMs
776
+ } : {}
777
+ });
778
+ const urlFileName = new URL(input.url).pathname.split("/").pop() || "upload.bin";
779
+ return {
780
+ buffer: fetched.buffer,
781
+ fileName: input.fileName ?? fetched.fileName ?? urlFileName
782
+ };
783
+ }
784
+ async function resolveDocxUploadInput(input) {
785
+ const sources = [
786
+ input.url && "url",
787
+ input.filePath && "file_path",
788
+ input.image && "image"
789
+ ].filter((source) => Boolean(source));
790
+ if (sources.length !== 1) throw new Error(sources.length === 0 ? "Either url, file_path, or image (base64/data URI) must be provided" : `Provide only one upload source; got: ${sources.join(", ")}`);
791
+ if (input.url) return await resolveRemoteUpload({
792
+ ...input,
793
+ url: input.url
794
+ });
795
+ if (input.filePath) return await resolveLocalUpload(input.filePath, input.maxBytes, input.localRoots, input.fileName);
796
+ const image = input.image;
797
+ if (!image) throw new Error("Image input must not be empty");
798
+ if (image.startsWith("data:")) return resolveDataUriImage(image, input.maxBytes, input.fileName);
799
+ const localPath = resolveImageLocalPath(image);
800
+ if (localPath) return await resolveLocalUpload(localPath, input.maxBytes, input.localRoots, input.fileName);
801
+ return {
802
+ buffer: decodeBase64Image({
803
+ payload: image,
804
+ maxBytes: input.maxBytes,
805
+ invalidMessage: "Invalid base64: image input is malformed. Use a data URI (data:image/png;base64,...) or a local file path instead.",
806
+ oversizedLabel: "Base64 image"
807
+ }),
808
+ fileName: input.fileName ?? "image.png"
809
+ };
810
+ }
811
+ //#endregion
566
812
  //#region extensions/feishu/src/docx.ts
567
813
  function resolveDocToolLocalRoots(ctx) {
568
814
  if (ctx.fsPolicy?.workspaceOnly !== true) return;
@@ -570,17 +816,6 @@ function resolveDocToolLocalRoots(ctx) {
570
816
  if (!workspaceDir) return [];
571
817
  return [resolve(workspaceDir)];
572
818
  }
573
- /** Extract image URLs from markdown content */
574
- function extractImageUrls(markdown) {
575
- const regex = /!\[[^\]]*\]\(([^)]+)\)/g;
576
- const urls = [];
577
- let match;
578
- while ((match = regex.exec(markdown)) !== null) {
579
- const url = match[1].trim();
580
- if (url.startsWith("http://") || url.startsWith("https://")) urls.push(url);
581
- }
582
- return urls;
583
- }
584
819
  const BLOCK_TYPE_NAMES = {
585
820
  1: "Page",
586
821
  2: "Text",
@@ -721,83 +956,49 @@ async function insertBlocks(client, docToken, blocks, parentBlockId, index) {
721
956
  skipped
722
957
  };
723
958
  }
724
- /** Split markdown into chunks at top-level headings (# or ##) to stay within API content limits */
725
- function splitMarkdownByHeadings(markdown) {
726
- const lines = markdown.split("\n");
727
- const chunks = [];
728
- let current = [];
729
- let inFencedBlock = false;
730
- for (const line of lines) {
731
- if (/^(`{3,}|~{3,})/.test(line)) inFencedBlock = !inFencedBlock;
732
- if (!inFencedBlock && /^#{1,2}\s/.test(line) && current.length > 0) {
733
- chunks.push(current.join("\n"));
734
- current = [];
735
- }
736
- current.push(line);
737
- }
738
- if (current.length > 0) chunks.push(current.join("\n"));
739
- return chunks;
740
- }
741
- /** Split markdown by size, preferring to break outside fenced code blocks when possible */
742
- function splitMarkdownBySize(markdown, maxChars) {
743
- if (markdown.length <= maxChars) return [markdown];
744
- const lines = markdown.split("\n");
745
- const chunks = [];
746
- let current = [];
747
- let currentLength = 0;
748
- let inFencedBlock = false;
749
- for (const line of lines) {
750
- if (/^(`{3,}|~{3,})/.test(line)) inFencedBlock = !inFencedBlock;
751
- const lineLength = line.length + 1;
752
- const wouldExceed = currentLength + lineLength > maxChars;
753
- if (current.length > 0 && wouldExceed && !inFencedBlock) {
754
- chunks.push(current.join("\n"));
755
- current = [];
756
- currentLength = 0;
757
- }
758
- current.push(line);
759
- currentLength += lineLength;
760
- }
761
- if (current.length > 0) chunks.push(current.join("\n"));
762
- if (chunks.length > 1) return chunks;
763
- const midpoint = Math.floor(lines.length / 2);
764
- if (midpoint <= 0 || midpoint >= lines.length) return [markdown];
765
- return [lines.slice(0, midpoint).join("\n"), lines.slice(midpoint).join("\n")];
766
- }
767
- async function convertMarkdownWithFallback(client, markdown, depth = 0) {
959
+ async function convertMarkdownWithFallback(client, chunk, depth = 0) {
768
960
  try {
769
- return await convertMarkdown(client, markdown);
961
+ return {
962
+ ...await convertMarkdown(client, chunk.markdown),
963
+ images: chunk.images
964
+ };
770
965
  } catch (error) {
771
- if (depth >= MAX_CONVERT_RETRY_DEPTH || markdown.length < 2) throw error;
772
- const chunks = splitMarkdownBySize(markdown, Math.max(256, Math.floor(markdown.length / 2)));
966
+ if (depth >= MAX_CONVERT_RETRY_DEPTH || chunk.markdown.length < 2) throw error;
967
+ const splitTarget = Math.max(256, Math.floor(chunk.markdown.length / 2));
968
+ const chunks = splitDocxMarkdownBySize(chunk.markdown, splitTarget).map(createDocxMarkdownChunk);
773
969
  if (chunks.length <= 1) throw error;
774
970
  const blocks = [];
775
971
  const firstLevelBlockIds = [];
776
- for (const chunk of chunks) {
777
- const converted = await convertMarkdownWithFallback(client, chunk, depth + 1);
972
+ const images = [];
973
+ for (const fallbackChunk of chunks) {
974
+ const converted = await convertMarkdownWithFallback(client, fallbackChunk, depth + 1);
778
975
  blocks.push(...converted.blocks);
779
976
  firstLevelBlockIds.push(...converted.firstLevelBlockIds);
977
+ images.push(...converted.images);
780
978
  }
781
979
  return {
782
980
  blocks,
783
- firstLevelBlockIds
981
+ firstLevelBlockIds,
982
+ images
784
983
  };
785
984
  }
786
985
  }
787
986
  /** Convert markdown in chunks to avoid document.convert content size limits */
788
- async function chunkedConvertMarkdown(client, markdown) {
789
- const chunks = splitMarkdownByHeadings(markdown);
987
+ async function chunkedConvertMarkdown(client, chunks) {
790
988
  const allBlocks = [];
791
989
  const allRootIds = [];
990
+ const allImages = [];
792
991
  for (const chunk of chunks) {
793
- const { blocks, firstLevelBlockIds } = await convertMarkdownWithFallback(client, chunk);
992
+ const { blocks, firstLevelBlockIds, images } = await convertMarkdownWithFallback(client, chunk);
794
993
  const { orderedBlocks, rootIds } = normalizeConvertedBlockTree(blocks, firstLevelBlockIds);
795
994
  allBlocks.push(...orderedBlocks);
796
995
  allRootIds.push(...rootIds);
996
+ allImages.push(...images);
797
997
  }
798
998
  return {
799
999
  blocks: allBlocks,
800
- firstLevelBlockIds: allRootIds
1000
+ firstLevelBlockIds: allRootIds,
1001
+ images: allImages
801
1002
  };
802
1003
  }
803
1004
  /**
@@ -855,98 +1056,21 @@ async function uploadImageToDocx(client, blockId, imageBuffer, fileName, docToke
855
1056
  if (!fileToken) throw new Error("Image upload failed: no file_token returned");
856
1057
  return fileToken;
857
1058
  }
858
- async function downloadImage(url, maxBytes) {
859
- return (await getFeishuRuntime().channel.media.readRemoteMediaBuffer({
860
- url,
861
- maxBytes
862
- })).buffer;
863
- }
864
- async function resolveUploadInput(url, filePath, maxBytes, localRoots, explicitFileName, imageInput) {
865
- const inputSources = [
866
- url ? "url" : null,
867
- filePath ? "file_path" : null,
868
- imageInput ? "image" : null
869
- ].filter(Boolean);
870
- if (inputSources.length > 1) throw new Error(`Provide only one image source; got: ${inputSources.join(", ")}`);
871
- if (imageInput?.startsWith("data:")) {
872
- const commaIdx = imageInput.indexOf(",");
873
- if (commaIdx === -1) throw new Error("Invalid data URI: missing comma separator.");
874
- const header = imageInput.slice(0, commaIdx);
875
- const data = imageInput.slice(commaIdx + 1);
876
- if (!header.includes(";base64")) throw new Error("Invalid data URI: missing ';base64' marker. Expected format: data:image/png;base64,<base64data>");
877
- const trimmedData = data.trim();
878
- if (trimmedData.length === 0 || !/^[A-Za-z0-9+/]+=*$/.test(trimmedData)) throw new Error(`Invalid data URI: base64 payload contains characters outside the standard alphabet.`);
879
- const ext = extensionForMime(header.match(/data:([^;]+)/)?.[1])?.slice(1) ?? "png";
880
- const estimatedBytes = Math.ceil(trimmedData.length * 3 / 4);
881
- if (estimatedBytes > maxBytes) throw new Error(`Image data URI exceeds limit: estimated ${estimatedBytes} bytes > ${maxBytes} bytes`);
882
- return {
883
- buffer: Buffer.from(trimmedData, "base64"),
884
- fileName: explicitFileName ?? `image.${ext}`
885
- };
886
- }
887
- if (imageInput) {
888
- const candidate = imageInput.startsWith("~") ? imageInput.replace(/^~/, homedir()) : imageInput;
889
- const unambiguousPath = imageInput.startsWith("~") || imageInput.startsWith("./") || imageInput.startsWith("../");
890
- const absolutePath = isAbsolute(imageInput);
891
- if (unambiguousPath || absolutePath && existsSync(candidate)) {
892
- const resolvedPath = resolve(candidate);
893
- return {
894
- buffer: (await getFeishuRuntime().media.loadWebMedia(resolvedPath, {
895
- maxBytes,
896
- optimizeImages: false,
897
- localRoots
898
- })).buffer,
899
- fileName: explicitFileName ?? basename(candidate)
900
- };
901
- }
902
- if (absolutePath && !existsSync(candidate)) throw new Error(`File not found: "${candidate}". If you intended to pass image binary data, use a data URI instead: data:image/jpeg;base64,...`);
903
- }
904
- if (imageInput) {
905
- const trimmed = imageInput.trim();
906
- if (trimmed.length === 0 || !/^[A-Za-z0-9+/]+=*$/.test(trimmed)) throw new Error("Invalid base64: image input contains characters outside the standard base64 alphabet. Use a data URI (data:image/png;base64,...) or a local file path instead.");
907
- const estimatedBytes = Math.ceil(trimmed.length * 3 / 4);
908
- if (estimatedBytes > maxBytes) throw new Error(`Base64 image exceeds limit: estimated ${estimatedBytes} bytes > ${maxBytes} bytes`);
909
- const buffer = Buffer.from(trimmed, "base64");
910
- if (buffer.length === 0) throw new Error("Base64 image decoded to empty buffer; check the input.");
911
- return {
912
- buffer,
913
- fileName: explicitFileName ?? "image.png"
914
- };
915
- }
916
- if (!url && !filePath) throw new Error("Either url, file_path, or image (base64/data URI) must be provided");
917
- if (url && filePath) throw new Error("Provide only one of url or file_path");
918
- if (url) {
919
- const fetched = await getFeishuRuntime().channel.media.readRemoteMediaBuffer({
920
- url,
921
- maxBytes
922
- });
923
- const guessed = new URL(url).pathname.split("/").pop() || "upload.bin";
924
- return {
925
- buffer: fetched.buffer,
926
- fileName: explicitFileName || guessed
927
- };
928
- }
929
- const resolvedFilePath = resolve(filePath);
930
- return {
931
- buffer: (await getFeishuRuntime().media.loadWebMedia(resolvedFilePath, {
932
- maxBytes,
933
- optimizeImages: false,
934
- localRoots
935
- })).buffer,
936
- fileName: explicitFileName || basename(filePath)
937
- };
938
- }
939
- async function processImages(client, docToken, markdown, insertedBlocks, maxBytes) {
940
- const imageUrls = extractImageUrls(markdown);
941
- if (imageUrls.length === 0) return 0;
1059
+ async function processImages(client, docToken, images, insertedBlocks, maxBytes, imageReadTimeoutMs) {
1060
+ if (images.length === 0) return 0;
942
1061
  const imageBlocks = insertedBlocks.filter((b) => b.block_type === 27);
943
1062
  let processed = 0;
944
- for (let i = 0; i < Math.min(imageUrls.length, imageBlocks.length); i++) {
945
- const url = imageUrls[i];
1063
+ for (let i = 0; i < Math.min(images.length, imageBlocks.length); i++) {
1064
+ const url = images[i]?.url;
946
1065
  const blockId = imageBlocks[i]?.block_id;
947
- if (!blockId) continue;
1066
+ if (!url || !blockId) continue;
948
1067
  try {
949
- const fileToken = await uploadImageToDocx(client, blockId, await downloadImage(url, maxBytes), new URL(url).pathname.split("/").pop() || `image_${i}.png`, docToken);
1068
+ const upload = await resolveDocxUploadInput({
1069
+ url,
1070
+ maxBytes,
1071
+ remoteReadTimeoutMs: imageReadTimeoutMs
1072
+ });
1073
+ const fileToken = await uploadImageToDocx(client, blockId, upload.buffer, upload.fileName, docToken);
950
1074
  await client.docx.documentBlock.patch({
951
1075
  path: {
952
1076
  document_id: docToken,
@@ -961,7 +1085,16 @@ async function processImages(client, docToken, markdown, insertedBlocks, maxByte
961
1085
  }
962
1086
  return processed;
963
1087
  }
964
- async function uploadImageBlock(client, docToken, maxBytes, localRoots, url, filePath, parentBlockId, filename, index, imageInput) {
1088
+ async function uploadImageBlock(client, docToken, maxBytes, imageReadTimeoutMs, localRoots, url, filePath, parentBlockId, filename, index, imageInput) {
1089
+ const upload = await resolveDocxUploadInput({
1090
+ url,
1091
+ filePath,
1092
+ image: imageInput,
1093
+ maxBytes,
1094
+ localRoots,
1095
+ fileName: filename,
1096
+ remoteReadTimeoutMs: imageReadTimeoutMs
1097
+ });
965
1098
  const insertRes = await client.docx.documentBlockChildren.create({
966
1099
  path: {
967
1100
  document_id: docToken,
@@ -979,7 +1112,6 @@ async function uploadImageBlock(client, docToken, maxBytes, localRoots, url, fil
979
1112
  if (insertRes.code !== 0) throw new Error(`Failed to create image block: ${insertRes.msg}`);
980
1113
  const imageBlockId = insertRes.data?.children?.find((b) => b.block_type === 27)?.block_id;
981
1114
  if (!imageBlockId) throw new Error("Failed to create image block");
982
- const upload = await resolveUploadInput(url, filePath, maxBytes, localRoots, filename, imageInput);
983
1115
  const fileToken = await uploadImageToDocx(client, imageBlockId, upload.buffer, upload.fileName, docToken);
984
1116
  const patchRes = await client.docx.documentBlock.patch({
985
1117
  path: {
@@ -999,8 +1131,14 @@ async function uploadImageBlock(client, docToken, maxBytes, localRoots, url, fil
999
1131
  }
1000
1132
  async function uploadFileBlock(client, docToken, maxBytes, localRoots, url, filePath, parentBlockId, filename) {
1001
1133
  const blockId = parentBlockId ?? docToken;
1002
- const upload = await resolveUploadInput(url, filePath, maxBytes, localRoots, filename);
1003
- const converted = await convertMarkdown(client, `[${upload.fileName}](https://example.com/placeholder)`);
1134
+ const upload = await resolveDocxUploadInput({
1135
+ url,
1136
+ filePath,
1137
+ maxBytes,
1138
+ localRoots,
1139
+ fileName: filename
1140
+ });
1141
+ const converted = await convertMarkdown(client, "[file](https://example.com/placeholder)");
1004
1142
  const { orderedBlocks } = normalizeConvertedBlockTree(converted.blocks, converted.firstLevelBlockIds);
1005
1143
  const { children: inserted } = await insertBlocks(client, docToken, orderedBlocks, blockId);
1006
1144
  const placeholderBlock = inserted[0];
@@ -1124,10 +1262,11 @@ async function createDoc(client, title, folderToken, options) {
1124
1262
  }
1125
1263
  };
1126
1264
  }
1127
- async function writeDoc(client, docToken, markdown, maxBytes, logger) {
1128
- const deleted = await clearDocumentContent(client, docToken);
1265
+ async function writeDoc(client, docToken, markdown, maxBytes, imageReadTimeoutMs, logger) {
1266
+ const markdownPlan = createDocxMarkdownPlan(markdown);
1129
1267
  logger?.info?.("feishu_doc: Converting markdown...");
1130
- const { blocks, firstLevelBlockIds } = await chunkedConvertMarkdown(client, markdown);
1268
+ const { blocks, firstLevelBlockIds, images } = await chunkedConvertMarkdown(client, markdownPlan.chunks);
1269
+ const deleted = await clearDocumentContent(client, docToken);
1131
1270
  if (blocks.length === 0) return {
1132
1271
  success: true,
1133
1272
  blocks_deleted: deleted,
@@ -1137,7 +1276,7 @@ async function writeDoc(client, docToken, markdown, maxBytes, logger) {
1137
1276
  logger?.info?.(`feishu_doc: Converted to ${blocks.length} blocks, inserting...`);
1138
1277
  const { orderedBlocks, rootIds } = normalizeConvertedBlockTree(blocks, firstLevelBlockIds);
1139
1278
  const { children: inserted } = blocks.length > 1e3 ? await insertBlocksInBatches(client, docToken, orderedBlocks, rootIds, logger) : await insertBlocksWithDescendant(client, docToken, orderedBlocks, rootIds);
1140
- const imagesProcessed = await processImages(client, docToken, markdown, inserted, maxBytes);
1279
+ const imagesProcessed = await processImages(client, docToken, images, inserted, maxBytes, imageReadTimeoutMs);
1141
1280
  logger?.info?.(`feishu_doc: Done (${blocks.length} blocks, ${imagesProcessed} images)`);
1142
1281
  return {
1143
1282
  success: true,
@@ -1146,14 +1285,15 @@ async function writeDoc(client, docToken, markdown, maxBytes, logger) {
1146
1285
  images_processed: imagesProcessed
1147
1286
  };
1148
1287
  }
1149
- async function appendDoc(client, docToken, markdown, maxBytes, logger) {
1288
+ async function appendDoc(client, docToken, markdown, maxBytes, imageReadTimeoutMs, logger) {
1289
+ const markdownPlan = createDocxMarkdownPlan(markdown);
1150
1290
  logger?.info?.("feishu_doc: Converting markdown...");
1151
- const { blocks, firstLevelBlockIds } = await chunkedConvertMarkdown(client, markdown);
1291
+ const { blocks, firstLevelBlockIds, images } = await chunkedConvertMarkdown(client, markdownPlan.chunks);
1152
1292
  if (blocks.length === 0) throw new Error("Content is empty");
1153
1293
  logger?.info?.(`feishu_doc: Converted to ${blocks.length} blocks, inserting...`);
1154
1294
  const { orderedBlocks, rootIds } = normalizeConvertedBlockTree(blocks, firstLevelBlockIds);
1155
1295
  const { children: inserted } = blocks.length > 1e3 ? await insertBlocksInBatches(client, docToken, orderedBlocks, rootIds, logger) : await insertBlocksWithDescendant(client, docToken, orderedBlocks, rootIds);
1156
- const imagesProcessed = await processImages(client, docToken, markdown, inserted, maxBytes);
1296
+ const imagesProcessed = await processImages(client, docToken, images, inserted, maxBytes, imageReadTimeoutMs);
1157
1297
  logger?.info?.(`feishu_doc: Done (${blocks.length} blocks, ${imagesProcessed} images)`);
1158
1298
  return {
1159
1299
  success: true,
@@ -1162,7 +1302,8 @@ async function appendDoc(client, docToken, markdown, maxBytes, logger) {
1162
1302
  block_ids: inserted.map((b) => b.block_id)
1163
1303
  };
1164
1304
  }
1165
- async function insertDoc(client, docToken, markdown, afterBlockId, maxBytes, logger) {
1305
+ async function insertDoc(client, docToken, markdown, afterBlockId, maxBytes, imageReadTimeoutMs, logger) {
1306
+ const markdownPlan = createDocxMarkdownPlan(markdown);
1166
1307
  const blockInfo = await client.docx.documentBlock.get({ path: {
1167
1308
  document_id: docToken,
1168
1309
  block_id: afterBlockId
@@ -1187,7 +1328,7 @@ async function insertDoc(client, docToken, markdown, afterBlockId, maxBytes, log
1187
1328
  if (blockIndex === -1) throw new Error(`after_block_id "${afterBlockId}" was not found among the children of parent block "${parentId}". Use list_blocks to verify the block ID.`);
1188
1329
  const insertIndex = blockIndex + 1;
1189
1330
  logger?.info?.("feishu_doc: Converting markdown...");
1190
- const { blocks, firstLevelBlockIds } = await chunkedConvertMarkdown(client, markdown);
1331
+ const { blocks, firstLevelBlockIds, images } = await chunkedConvertMarkdown(client, markdownPlan.chunks);
1191
1332
  if (blocks.length === 0) throw new Error("Content is empty");
1192
1333
  const { orderedBlocks, rootIds } = normalizeConvertedBlockTree(blocks, firstLevelBlockIds);
1193
1334
  logger?.info?.(`feishu_doc: Converted to ${blocks.length} blocks, inserting at index ${insertIndex}...`);
@@ -1195,7 +1336,7 @@ async function insertDoc(client, docToken, markdown, afterBlockId, maxBytes, log
1195
1336
  parentBlockId: parentId,
1196
1337
  index: insertIndex
1197
1338
  });
1198
- const imagesProcessed = await processImages(client, docToken, markdown, inserted, maxBytes);
1339
+ const imagesProcessed = await processImages(client, docToken, images, inserted, maxBytes, imageReadTimeoutMs);
1199
1340
  logger?.info?.(`feishu_doc: Done (${blocks.length} blocks, ${imagesProcessed} images)`);
1200
1341
  return {
1201
1342
  success: true,
@@ -1405,6 +1546,15 @@ function registerFeishuDocTools(api) {
1405
1546
  label: "Doc"
1406
1547
  }
1407
1548
  }).config?.mediaMaxMb ?? 30) * 1024 * 1024;
1549
+ const getImageReadTimeoutMs = (params, defaultAccountId) => resolveConfiguredHttpTimeoutMs(resolveFeishuToolAccount({
1550
+ api,
1551
+ executeParams: params,
1552
+ defaultAccountId,
1553
+ requiredTool: {
1554
+ family: "doc",
1555
+ label: "Doc"
1556
+ }
1557
+ }));
1408
1558
  if (toolsCfg.doc) {
1409
1559
  api.registerTool((ctx) => {
1410
1560
  const defaultAccountId = ctx.agentAccountId;
@@ -1421,9 +1571,9 @@ function registerFeishuDocTools(api) {
1421
1571
  const client = getClient(p, defaultAccountId);
1422
1572
  switch (p.action) {
1423
1573
  case "read": return jsonResult(await readDoc(client, p.doc_token));
1424
- case "write": return jsonResult(await writeDoc(client, p.doc_token, p.content, getMediaMaxBytes(p, defaultAccountId), api.logger));
1425
- case "append": return jsonResult(await appendDoc(client, p.doc_token, p.content, getMediaMaxBytes(p, defaultAccountId), api.logger));
1426
- case "insert": return jsonResult(await insertDoc(client, p.doc_token, p.content, p.after_block_id, getMediaMaxBytes(p, defaultAccountId), api.logger));
1574
+ case "write": return jsonResult(await writeDoc(client, p.doc_token, p.content, getMediaMaxBytes(p, defaultAccountId), getImageReadTimeoutMs(p, defaultAccountId), api.logger));
1575
+ case "append": return jsonResult(await appendDoc(client, p.doc_token, p.content, getMediaMaxBytes(p, defaultAccountId), getImageReadTimeoutMs(p, defaultAccountId), api.logger));
1576
+ case "insert": return jsonResult(await insertDoc(client, p.doc_token, p.content, p.after_block_id, getMediaMaxBytes(p, defaultAccountId), getImageReadTimeoutMs(p, defaultAccountId), api.logger));
1427
1577
  case "create": return jsonResult(await createDoc(client, p.title, p.folder_token, {
1428
1578
  grantToRequester: p.grant_to_requester,
1429
1579
  requesterOpenId: trustedRequesterOpenId
@@ -1435,7 +1585,7 @@ function registerFeishuDocTools(api) {
1435
1585
  case "create_table": return jsonResult(await createTable(client, p.doc_token, p.row_size, p.column_size, p.parent_block_id, p.column_width));
1436
1586
  case "write_table_cells": return jsonResult(await writeTableCells(client, p.doc_token, p.table_block_id, p.values));
1437
1587
  case "create_table_with_values": return jsonResult(await createTableWithValues(client, p.doc_token, p.row_size, p.column_size, p.values, p.parent_block_id, p.column_width));
1438
- case "upload_image": return jsonResult(await uploadImageBlock(client, p.doc_token, getMediaMaxBytes(p, defaultAccountId), mediaLocalRoots, p.url, p.file_path, p.parent_block_id, p.filename, p.index, p.image));
1588
+ case "upload_image": return jsonResult(await uploadImageBlock(client, p.doc_token, getMediaMaxBytes(p, defaultAccountId), getImageReadTimeoutMs(p, defaultAccountId), mediaLocalRoots, p.url, p.file_path, p.parent_block_id, p.filename, p.index, p.image));
1439
1589
  case "upload_file": return jsonResult(await uploadFileBlock(client, p.doc_token, getMediaMaxBytes(p, defaultAccountId), mediaLocalRoots, p.url, p.file_path, p.parent_block_id, p.filename));
1440
1590
  case "color_text": return jsonResult(await updateColorText(client, p.doc_token, p.block_id, p.content));
1441
1591
  case "insert_table_row": return jsonResult(await insertTableRow(client, p.doc_token, p.block_id, p.row_index));
@@ -1893,17 +2043,23 @@ function parseBitableUrl(url) {
1893
2043
  const u = new URL(url);
1894
2044
  const tableId = u.searchParams.get("table") ?? void 0;
1895
2045
  const wikiMatch = u.pathname.match(/\/wiki\/([A-Za-z0-9]+)/);
1896
- if (wikiMatch) return {
1897
- token: wikiMatch[1],
1898
- tableId,
1899
- isWiki: true
1900
- };
2046
+ if (wikiMatch) {
2047
+ const wikiPathSegment = wikiMatch[1];
2048
+ return wikiPathSegment === void 0 ? null : {
2049
+ token: wikiPathSegment,
2050
+ tableId,
2051
+ isWiki: true
2052
+ };
2053
+ }
1901
2054
  const baseMatch = u.pathname.match(/\/base\/([A-Za-z0-9]+)/);
1902
- if (baseMatch) return {
1903
- token: baseMatch[1],
1904
- tableId,
1905
- isWiki: false
1906
- };
2055
+ if (baseMatch) {
2056
+ const basePathSegment = baseMatch[1];
2057
+ return basePathSegment === void 0 ? null : {
2058
+ token: basePathSegment,
2059
+ tableId,
2060
+ isWiki: false
2061
+ };
2062
+ }
1907
2063
  return null;
1908
2064
  } catch {
1909
2065
  return null;
@@ -2140,7 +2296,7 @@ async function createApp(client, name, folderToken, logger) {
2140
2296
  try {
2141
2297
  const tablesRes = await client.bitable.appTable.list({ path: { app_token: appToken } });
2142
2298
  if (tablesRes.code === 0 && tablesRes.data?.items && tablesRes.data.items.length > 0) {
2143
- tableId = tablesRes.data.items[0].table_id ?? void 0;
2299
+ tableId = tablesRes.data.items.at(0)?.table_id;
2144
2300
  if (tableId) {
2145
2301
  const cleanup = await cleanupNewBitable(client, appToken, tableId, name, log);
2146
2302
  cleanedRows = cleanup.cleanedRows;