@openclaw/feishu 2026.7.1 → 2026.7.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (749) hide show
  1. package/dist/{accounts-Bs5uJ4h0.js → accounts-BDoGHJDk.js} +29 -54
  2. package/dist/api.js +35 -25
  3. package/dist/{channel-DRQRQQQ3.js → channel-DdPQ2HGh.js} +578 -369
  4. package/dist/channel-plugin-api.js +1 -1
  5. package/dist/{channel.runtime-pvr-Y5ji.js → channel.runtime-DJ_B-bpG.js} +272 -107
  6. package/dist/{client-B7EAV_Ss.js → client-BUC-R2Wi.js} +4 -13
  7. package/dist/contract-api.js +1 -1
  8. package/dist/{conversation-id-CdLdoot3.js → conversation-id-BeJL-wq7.js} +3 -0
  9. package/dist/doctor-contract-DXH5hux1.js +97 -0
  10. package/dist/doctor-contract-api.js +2 -0
  11. package/dist/{drive-D0lIhxqZ.js → drive-Bpe8ONK_.js} +181 -33
  12. package/dist/{monitor-CsbheK9J.js → monitor-M3iYtoh4.js} +3 -3
  13. package/dist/{monitor.account-Dr7do33p.js → monitor.account-F99J862T.js} +474 -493
  14. package/dist/monitor.startup-DpZzunQn.js +43 -0
  15. package/dist/{probe-Dxyo9zlw.js → probe-CAloGqgG.js} +3 -6
  16. package/dist/{secret-contract-DLaBl9m4.js → secret-contract-DnlMcrn5.js} +14 -69
  17. package/dist/secret-contract-api.js +1 -1
  18. package/dist/{send-Be2GMA6Z.js → send-CpnLYueT.js} +12 -35
  19. package/dist/send-result-CPS7AozW.js +766 -0
  20. package/dist/{session-conversation-BYuoVJwl.js → session-conversation-BksWrfzm.js} +1 -1
  21. package/dist/session-key-api.js +1 -1
  22. package/dist/setup-api.js +1 -1
  23. package/dist/setup-entry.js +0 -5
  24. package/dist/{subagent-hooks-B2iWPYJ1.js → subagent-hooks-BKTOxB-T.js} +9 -5
  25. package/dist/subagent-hooks-api.js +1 -1
  26. package/node_modules/@types/debug/LICENSE +21 -0
  27. package/node_modules/@types/debug/README.md +69 -0
  28. package/node_modules/@types/debug/index.d.ts +50 -0
  29. package/node_modules/@types/debug/package.json +58 -0
  30. package/node_modules/@types/mdast/LICENSE +21 -0
  31. package/node_modules/@types/mdast/README.md +15 -0
  32. package/node_modules/@types/mdast/index.d.ts +1123 -0
  33. package/node_modules/@types/mdast/package.json +47 -0
  34. package/node_modules/@types/ms/LICENSE +21 -0
  35. package/node_modules/@types/ms/README.md +82 -0
  36. package/node_modules/@types/ms/index.d.ts +63 -0
  37. package/node_modules/@types/ms/package.json +26 -0
  38. package/node_modules/@types/unist/LICENSE +21 -0
  39. package/node_modules/@types/unist/README.md +15 -0
  40. package/node_modules/@types/unist/index.d.ts +119 -0
  41. package/node_modules/@types/unist/package.json +60 -0
  42. package/node_modules/character-entities/index.d.ts +6 -0
  43. package/node_modules/character-entities/index.js +2132 -0
  44. package/node_modules/character-entities/license +22 -0
  45. package/node_modules/character-entities/package.json +78 -0
  46. package/node_modules/character-entities/readme.md +152 -0
  47. package/node_modules/debug/LICENSE +20 -0
  48. package/node_modules/debug/README.md +481 -0
  49. package/node_modules/debug/package.json +64 -0
  50. package/node_modules/debug/src/browser.js +272 -0
  51. package/node_modules/debug/src/common.js +292 -0
  52. package/node_modules/debug/src/index.js +10 -0
  53. package/node_modules/debug/src/node.js +263 -0
  54. package/node_modules/decode-named-character-reference/index.d.ts +13 -0
  55. package/node_modules/decode-named-character-reference/index.d.ts.map +1 -0
  56. package/node_modules/decode-named-character-reference/index.dom.d.ts +6 -0
  57. package/node_modules/decode-named-character-reference/index.dom.d.ts.map +1 -0
  58. package/node_modules/decode-named-character-reference/index.dom.js +32 -0
  59. package/node_modules/decode-named-character-reference/index.js +19 -0
  60. package/node_modules/decode-named-character-reference/license +22 -0
  61. package/node_modules/decode-named-character-reference/package.json +90 -0
  62. package/node_modules/decode-named-character-reference/readme.md +136 -0
  63. package/node_modules/dequal/dist/index.js +86 -0
  64. package/node_modules/dequal/dist/index.min.js +1 -0
  65. package/node_modules/dequal/dist/index.mjs +84 -0
  66. package/node_modules/dequal/index.d.ts +1 -0
  67. package/node_modules/dequal/license +21 -0
  68. package/node_modules/dequal/lite/index.d.ts +1 -0
  69. package/node_modules/dequal/lite/index.js +31 -0
  70. package/node_modules/dequal/lite/index.min.js +1 -0
  71. package/node_modules/dequal/lite/index.mjs +29 -0
  72. package/node_modules/dequal/package.json +57 -0
  73. package/node_modules/dequal/readme.md +112 -0
  74. package/node_modules/devlop/lib/default.js +9 -0
  75. package/node_modules/devlop/lib/development.d.ts +84 -0
  76. package/node_modules/devlop/lib/development.js +238 -0
  77. package/node_modules/devlop/license +22 -0
  78. package/node_modules/devlop/package.json +80 -0
  79. package/node_modules/devlop/readme.md +360 -0
  80. package/node_modules/longest-streak/index.d.ts +11 -0
  81. package/node_modules/longest-streak/index.js +36 -0
  82. package/node_modules/longest-streak/license +22 -0
  83. package/node_modules/longest-streak/package.json +73 -0
  84. package/node_modules/longest-streak/readme.md +150 -0
  85. package/node_modules/markdown-table/index.d.ts +171 -0
  86. package/node_modules/markdown-table/index.d.ts.map +1 -0
  87. package/node_modules/markdown-table/index.js +393 -0
  88. package/node_modules/markdown-table/license +22 -0
  89. package/node_modules/markdown-table/package.json +77 -0
  90. package/node_modules/markdown-table/readme.md +344 -0
  91. package/node_modules/mdast-util-from-markdown/dev/index.d.ts +23 -0
  92. package/node_modules/mdast-util-from-markdown/dev/index.js +2 -0
  93. package/node_modules/mdast-util-from-markdown/dev/lib/index.d.ts +53 -0
  94. package/node_modules/mdast-util-from-markdown/dev/lib/index.d.ts.map +1 -0
  95. package/node_modules/mdast-util-from-markdown/dev/lib/index.js +1348 -0
  96. package/node_modules/mdast-util-from-markdown/dev/lib/types.d.ts +295 -0
  97. package/node_modules/mdast-util-from-markdown/dev/lib/types.js +2 -0
  98. package/node_modules/mdast-util-from-markdown/index.d.ts +23 -0
  99. package/node_modules/mdast-util-from-markdown/index.js +2 -0
  100. package/node_modules/mdast-util-from-markdown/lib/index.d.ts +53 -0
  101. package/node_modules/mdast-util-from-markdown/lib/index.d.ts.map +1 -0
  102. package/node_modules/mdast-util-from-markdown/lib/index.js +1177 -0
  103. package/node_modules/mdast-util-from-markdown/lib/types.d.ts +295 -0
  104. package/node_modules/mdast-util-from-markdown/lib/types.js +2 -0
  105. package/node_modules/mdast-util-from-markdown/license +22 -0
  106. package/node_modules/mdast-util-from-markdown/package.json +99 -0
  107. package/node_modules/mdast-util-from-markdown/readme.md +535 -0
  108. package/node_modules/mdast-util-gfm-table/index.d.ts +54 -0
  109. package/node_modules/mdast-util-gfm-table/index.js +2 -0
  110. package/node_modules/mdast-util-gfm-table/lib/index.d.ts +51 -0
  111. package/node_modules/mdast-util-gfm-table/lib/index.js +300 -0
  112. package/node_modules/mdast-util-gfm-table/license +22 -0
  113. package/node_modules/mdast-util-gfm-table/package.json +101 -0
  114. package/node_modules/mdast-util-gfm-table/readme.md +605 -0
  115. package/node_modules/mdast-util-phrasing/index.d.ts +1 -0
  116. package/node_modules/mdast-util-phrasing/index.js +1 -0
  117. package/node_modules/mdast-util-phrasing/lib/index.d.ts +3 -0
  118. package/node_modules/mdast-util-phrasing/lib/index.js +45 -0
  119. package/node_modules/mdast-util-phrasing/license +23 -0
  120. package/node_modules/mdast-util-phrasing/package.json +78 -0
  121. package/node_modules/mdast-util-phrasing/readme.md +200 -0
  122. package/node_modules/mdast-util-to-markdown/index.d.ts +16 -0
  123. package/node_modules/mdast-util-to-markdown/index.js +3 -0
  124. package/node_modules/mdast-util-to-markdown/lib/configure.d.ts +9 -0
  125. package/node_modules/mdast-util-to-markdown/lib/configure.d.ts.map +1 -0
  126. package/node_modules/mdast-util-to-markdown/lib/configure.js +79 -0
  127. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts +17 -0
  128. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts.map +1 -0
  129. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js +29 -0
  130. package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts +13 -0
  131. package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts.map +1 -0
  132. package/node_modules/mdast-util-to-markdown/lib/handle/break.js +30 -0
  133. package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts +13 -0
  134. package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts.map +1 -0
  135. package/node_modules/mdast-util-to-markdown/lib/handle/code.js +75 -0
  136. package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts +13 -0
  137. package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts.map +1 -0
  138. package/node_modules/mdast-util-to-markdown/lib/handle/definition.js +76 -0
  139. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts +24 -0
  140. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts.map +1 -0
  141. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js +69 -0
  142. package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts +13 -0
  143. package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts.map +1 -0
  144. package/node_modules/mdast-util-to-markdown/lib/handle/heading.js +75 -0
  145. package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts +15 -0
  146. package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts.map +1 -0
  147. package/node_modules/mdast-util-to-markdown/lib/handle/html.js +20 -0
  148. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts +21 -0
  149. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts.map +1 -0
  150. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js +63 -0
  151. package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts +21 -0
  152. package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts.map +1 -0
  153. package/node_modules/mdast-util-to-markdown/lib/handle/image.js +82 -0
  154. package/node_modules/mdast-util-to-markdown/lib/handle/index.d.ts +42 -0
  155. package/node_modules/mdast-util-to-markdown/lib/handle/index.d.ts.map +1 -0
  156. package/node_modules/mdast-util-to-markdown/lib/handle/index.js +45 -0
  157. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts +19 -0
  158. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts.map +1 -0
  159. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js +76 -0
  160. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts +21 -0
  161. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts.map +1 -0
  162. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js +63 -0
  163. package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts +24 -0
  164. package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts.map +1 -0
  165. package/node_modules/mdast-util-to-markdown/lib/handle/link.js +114 -0
  166. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts +13 -0
  167. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts.map +1 -0
  168. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.js +62 -0
  169. package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts +13 -0
  170. package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts.map +1 -0
  171. package/node_modules/mdast-util-to-markdown/lib/handle/list.js +100 -0
  172. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts +17 -0
  173. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts.map +1 -0
  174. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js +20 -0
  175. package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts +13 -0
  176. package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts.map +1 -0
  177. package/node_modules/mdast-util-to-markdown/lib/handle/root.js +23 -0
  178. package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts +24 -0
  179. package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts.map +1 -0
  180. package/node_modules/mdast-util-to-markdown/lib/handle/strong.js +69 -0
  181. package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts +17 -0
  182. package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts.map +1 -0
  183. package/node_modules/mdast-util-to-markdown/lib/handle/text.js +15 -0
  184. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts +11 -0
  185. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts.map +1 -0
  186. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js +21 -0
  187. package/node_modules/mdast-util-to-markdown/lib/index.d.ts +14 -0
  188. package/node_modules/mdast-util-to-markdown/lib/index.d.ts.map +1 -0
  189. package/node_modules/mdast-util-to-markdown/lib/index.js +187 -0
  190. package/node_modules/mdast-util-to-markdown/lib/join.d.ts +4 -0
  191. package/node_modules/mdast-util-to-markdown/lib/join.d.ts.map +1 -0
  192. package/node_modules/mdast-util-to-markdown/lib/join.js +39 -0
  193. package/node_modules/mdast-util-to-markdown/lib/types.d.ts +965 -0
  194. package/node_modules/mdast-util-to-markdown/lib/types.js +2 -0
  195. package/node_modules/mdast-util-to-markdown/lib/unsafe.d.ts +4 -0
  196. package/node_modules/mdast-util-to-markdown/lib/unsafe.d.ts.map +1 -0
  197. package/node_modules/mdast-util-to-markdown/lib/unsafe.js +146 -0
  198. package/node_modules/mdast-util-to-markdown/lib/util/association.d.ts +2 -0
  199. package/node_modules/mdast-util-to-markdown/lib/util/association.d.ts.map +1 -0
  200. package/node_modules/mdast-util-to-markdown/lib/util/association.js +33 -0
  201. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts +11 -0
  202. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts.map +1 -0
  203. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js +21 -0
  204. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts +8 -0
  205. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts.map +1 -0
  206. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js +38 -0
  207. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts +11 -0
  208. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts.map +1 -0
  209. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js +21 -0
  210. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts +11 -0
  211. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts.map +1 -0
  212. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js +21 -0
  213. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts +11 -0
  214. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts.map +1 -0
  215. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.js +21 -0
  216. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts +11 -0
  217. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts.map +1 -0
  218. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js +21 -0
  219. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts +11 -0
  220. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts.map +1 -0
  221. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.js +21 -0
  222. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts +11 -0
  223. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts.map +1 -0
  224. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js +21 -0
  225. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts +11 -0
  226. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts.map +1 -0
  227. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.js +21 -0
  228. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts +11 -0
  229. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts.map +1 -0
  230. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.js +21 -0
  231. package/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.d.ts +2 -0
  232. package/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.d.ts.map +1 -0
  233. package/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js +24 -0
  234. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts +19 -0
  235. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts.map +1 -0
  236. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.js +84 -0
  237. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts +19 -0
  238. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts.map +1 -0
  239. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js +125 -0
  240. package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts +7 -0
  241. package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts.map +1 -0
  242. package/node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.d.ts +10 -0
  243. package/node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.d.ts.map +1 -0
  244. package/node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js +11 -0
  245. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts +33 -0
  246. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts.map +1 -0
  247. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.js +82 -0
  248. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts +13 -0
  249. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts.map +1 -0
  250. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js +22 -0
  251. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts +9 -0
  252. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts.map +1 -0
  253. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js +34 -0
  254. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts +9 -0
  255. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts.map +1 -0
  256. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js +34 -0
  257. package/node_modules/mdast-util-to-markdown/lib/util/indent-lines.d.ts +2 -0
  258. package/node_modules/mdast-util-to-markdown/lib/util/indent-lines.d.ts.map +1 -0
  259. package/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js +35 -0
  260. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts +12 -0
  261. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts.map +1 -0
  262. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js +41 -0
  263. package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts +29 -0
  264. package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts.map +1 -0
  265. package/node_modules/mdast-util-to-markdown/lib/util/safe.js +174 -0
  266. package/node_modules/mdast-util-to-markdown/lib/util/track.d.ts +2 -0
  267. package/node_modules/mdast-util-to-markdown/lib/util/track.d.ts.map +1 -0
  268. package/node_modules/mdast-util-to-markdown/lib/util/track.js +55 -0
  269. package/node_modules/mdast-util-to-markdown/license +22 -0
  270. package/node_modules/mdast-util-to-markdown/package.json +132 -0
  271. package/node_modules/mdast-util-to-markdown/readme.md +750 -0
  272. package/node_modules/mdast-util-to-string/index.d.ts +2 -0
  273. package/node_modules/mdast-util-to-string/index.js +5 -0
  274. package/node_modules/mdast-util-to-string/lib/index.d.ts +31 -0
  275. package/node_modules/mdast-util-to-string/lib/index.js +108 -0
  276. package/node_modules/mdast-util-to-string/license +22 -0
  277. package/node_modules/mdast-util-to-string/package.json +78 -0
  278. package/node_modules/mdast-util-to-string/readme.md +218 -0
  279. package/node_modules/micromark/dev/index.d.ts +82 -0
  280. package/node_modules/micromark/dev/index.d.ts.map +1 -0
  281. package/node_modules/micromark/dev/index.js +68 -0
  282. package/node_modules/micromark/dev/lib/compile.d.ts +16 -0
  283. package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -0
  284. package/node_modules/micromark/dev/lib/compile.js +1152 -0
  285. package/node_modules/micromark/dev/lib/constructs.d.ts +73 -0
  286. package/node_modules/micromark/dev/lib/constructs.d.ts.map +1 -0
  287. package/node_modules/micromark/dev/lib/constructs.js +101 -0
  288. package/node_modules/micromark/dev/lib/create-tokenizer.d.ts +46 -0
  289. package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -0
  290. package/node_modules/micromark/dev/lib/create-tokenizer.js +717 -0
  291. package/node_modules/micromark/dev/lib/initialize/content.d.ts +4 -0
  292. package/node_modules/micromark/dev/lib/initialize/content.d.ts.map +1 -0
  293. package/node_modules/micromark/dev/lib/initialize/content.js +99 -0
  294. package/node_modules/micromark/dev/lib/initialize/document.d.ts +10 -0
  295. package/node_modules/micromark/dev/lib/initialize/document.d.ts.map +1 -0
  296. package/node_modules/micromark/dev/lib/initialize/document.js +445 -0
  297. package/node_modules/micromark/dev/lib/initialize/flow.d.ts +4 -0
  298. package/node_modules/micromark/dev/lib/initialize/flow.d.ts.map +1 -0
  299. package/node_modules/micromark/dev/lib/initialize/flow.js +86 -0
  300. package/node_modules/micromark/dev/lib/initialize/text.d.ts +8 -0
  301. package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -0
  302. package/node_modules/micromark/dev/lib/initialize/text.js +244 -0
  303. package/node_modules/micromark/dev/lib/parse.d.ts +10 -0
  304. package/node_modules/micromark/dev/lib/parse.d.ts.map +1 -0
  305. package/node_modules/micromark/dev/lib/parse.js +58 -0
  306. package/node_modules/micromark/dev/lib/postprocess.d.ts +9 -0
  307. package/node_modules/micromark/dev/lib/postprocess.d.ts.map +1 -0
  308. package/node_modules/micromark/dev/lib/postprocess.js +19 -0
  309. package/node_modules/micromark/dev/lib/preprocess.d.ts +13 -0
  310. package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -0
  311. package/node_modules/micromark/dev/lib/preprocess.js +141 -0
  312. package/node_modules/micromark/dev/stream.d.ts +35 -0
  313. package/node_modules/micromark/dev/stream.d.ts.map +1 -0
  314. package/node_modules/micromark/dev/stream.js +270 -0
  315. package/node_modules/micromark/index.d.ts +82 -0
  316. package/node_modules/micromark/index.d.ts.map +1 -0
  317. package/node_modules/micromark/index.js +60 -0
  318. package/node_modules/micromark/lib/compile.d.ts +16 -0
  319. package/node_modules/micromark/lib/compile.d.ts.map +1 -0
  320. package/node_modules/micromark/lib/compile.js +1060 -0
  321. package/node_modules/micromark/lib/constructs.d.ts +73 -0
  322. package/node_modules/micromark/lib/constructs.d.ts.map +1 -0
  323. package/node_modules/micromark/lib/constructs.js +85 -0
  324. package/node_modules/micromark/lib/create-tokenizer.d.ts +46 -0
  325. package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -0
  326. package/node_modules/micromark/lib/create-tokenizer.js +611 -0
  327. package/node_modules/micromark/lib/initialize/content.d.ts +4 -0
  328. package/node_modules/micromark/lib/initialize/content.d.ts.map +1 -0
  329. package/node_modules/micromark/lib/initialize/content.js +79 -0
  330. package/node_modules/micromark/lib/initialize/document.d.ts +10 -0
  331. package/node_modules/micromark/lib/initialize/document.d.ts.map +1 -0
  332. package/node_modules/micromark/lib/initialize/document.js +362 -0
  333. package/node_modules/micromark/lib/initialize/flow.d.ts +4 -0
  334. package/node_modules/micromark/lib/initialize/flow.d.ts.map +1 -0
  335. package/node_modules/micromark/lib/initialize/flow.js +58 -0
  336. package/node_modules/micromark/lib/initialize/text.d.ts +8 -0
  337. package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -0
  338. package/node_modules/micromark/lib/initialize/text.js +212 -0
  339. package/node_modules/micromark/lib/parse.d.ts +10 -0
  340. package/node_modules/micromark/lib/parse.d.ts.map +1 -0
  341. package/node_modules/micromark/lib/parse.js +56 -0
  342. package/node_modules/micromark/lib/postprocess.d.ts +9 -0
  343. package/node_modules/micromark/lib/postprocess.d.ts.map +1 -0
  344. package/node_modules/micromark/lib/postprocess.js +18 -0
  345. package/node_modules/micromark/lib/preprocess.d.ts +13 -0
  346. package/node_modules/micromark/lib/preprocess.d.ts.map +1 -0
  347. package/node_modules/micromark/lib/preprocess.js +115 -0
  348. package/node_modules/micromark/license +22 -0
  349. package/node_modules/micromark/package.json +100 -0
  350. package/node_modules/micromark/readme.md +488 -0
  351. package/node_modules/micromark/stream.d.ts +35 -0
  352. package/node_modules/micromark/stream.d.ts.map +1 -0
  353. package/node_modules/micromark/stream.js +256 -0
  354. package/node_modules/micromark-core-commonmark/dev/index.d.ts +23 -0
  355. package/node_modules/micromark-core-commonmark/dev/index.d.ts.map +1 -0
  356. package/node_modules/micromark-core-commonmark/dev/index.js +22 -0
  357. package/node_modules/micromark-core-commonmark/dev/lib/attention.d.ts +4 -0
  358. package/node_modules/micromark-core-commonmark/dev/lib/attention.d.ts.map +1 -0
  359. package/node_modules/micromark-core-commonmark/dev/lib/attention.js +300 -0
  360. package/node_modules/micromark-core-commonmark/dev/lib/autolink.d.ts +4 -0
  361. package/node_modules/micromark-core-commonmark/dev/lib/autolink.d.ts.map +1 -0
  362. package/node_modules/micromark-core-commonmark/dev/lib/autolink.js +269 -0
  363. package/node_modules/micromark-core-commonmark/dev/lib/blank-line.d.ts +4 -0
  364. package/node_modules/micromark-core-commonmark/dev/lib/blank-line.d.ts.map +1 -0
  365. package/node_modules/micromark-core-commonmark/dev/lib/blank-line.js +62 -0
  366. package/node_modules/micromark-core-commonmark/dev/lib/block-quote.d.ts +4 -0
  367. package/node_modules/micromark-core-commonmark/dev/lib/block-quote.d.ts.map +1 -0
  368. package/node_modules/micromark-core-commonmark/dev/lib/block-quote.js +162 -0
  369. package/node_modules/micromark-core-commonmark/dev/lib/character-escape.d.ts +4 -0
  370. package/node_modules/micromark-core-commonmark/dev/lib/character-escape.d.ts.map +1 -0
  371. package/node_modules/micromark-core-commonmark/dev/lib/character-escape.js +69 -0
  372. package/node_modules/micromark-core-commonmark/dev/lib/character-reference.d.ts +4 -0
  373. package/node_modules/micromark-core-commonmark/dev/lib/character-reference.d.ts.map +1 -0
  374. package/node_modules/micromark-core-commonmark/dev/lib/character-reference.js +166 -0
  375. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts +4 -0
  376. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -0
  377. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +514 -0
  378. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.d.ts +4 -0
  379. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.d.ts.map +1 -0
  380. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +202 -0
  381. package/node_modules/micromark-core-commonmark/dev/lib/code-text.d.ts +4 -0
  382. package/node_modules/micromark-core-commonmark/dev/lib/code-text.d.ts.map +1 -0
  383. package/node_modules/micromark-core-commonmark/dev/lib/code-text.js +257 -0
  384. package/node_modules/micromark-core-commonmark/dev/lib/content.d.ts +7 -0
  385. package/node_modules/micromark-core-commonmark/dev/lib/content.d.ts.map +1 -0
  386. package/node_modules/micromark-core-commonmark/dev/lib/content.js +185 -0
  387. package/node_modules/micromark-core-commonmark/dev/lib/definition.d.ts +4 -0
  388. package/node_modules/micromark-core-commonmark/dev/lib/definition.d.ts.map +1 -0
  389. package/node_modules/micromark-core-commonmark/dev/lib/definition.js +295 -0
  390. package/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.d.ts +4 -0
  391. package/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.d.ts.map +1 -0
  392. package/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js +65 -0
  393. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.d.ts +4 -0
  394. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.d.ts.map +1 -0
  395. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +233 -0
  396. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts +4 -0
  397. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -0
  398. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +989 -0
  399. package/node_modules/micromark-core-commonmark/dev/lib/html-text.d.ts +4 -0
  400. package/node_modules/micromark-core-commonmark/dev/lib/html-text.d.ts.map +1 -0
  401. package/node_modules/micromark-core-commonmark/dev/lib/html-text.js +783 -0
  402. package/node_modules/micromark-core-commonmark/dev/lib/label-end.d.ts +4 -0
  403. package/node_modules/micromark-core-commonmark/dev/lib/label-end.d.ts.map +1 -0
  404. package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +656 -0
  405. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts +4 -0
  406. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -0
  407. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +110 -0
  408. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts +4 -0
  409. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -0
  410. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +62 -0
  411. package/node_modules/micromark-core-commonmark/dev/lib/line-ending.d.ts +4 -0
  412. package/node_modules/micromark-core-commonmark/dev/lib/line-ending.d.ts.map +1 -0
  413. package/node_modules/micromark-core-commonmark/dev/lib/line-ending.js +34 -0
  414. package/node_modules/micromark-core-commonmark/dev/lib/list.d.ts +4 -0
  415. package/node_modules/micromark-core-commonmark/dev/lib/list.d.ts.map +1 -0
  416. package/node_modules/micromark-core-commonmark/dev/lib/list.js +306 -0
  417. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts +4 -0
  418. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -0
  419. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +210 -0
  420. package/node_modules/micromark-core-commonmark/dev/lib/thematic-break.d.ts +4 -0
  421. package/node_modules/micromark-core-commonmark/dev/lib/thematic-break.d.ts.map +1 -0
  422. package/node_modules/micromark-core-commonmark/dev/lib/thematic-break.js +120 -0
  423. package/node_modules/micromark-core-commonmark/index.d.ts +23 -0
  424. package/node_modules/micromark-core-commonmark/index.d.ts.map +1 -0
  425. package/node_modules/micromark-core-commonmark/index.js +22 -0
  426. package/node_modules/micromark-core-commonmark/lib/attention.d.ts +4 -0
  427. package/node_modules/micromark-core-commonmark/lib/attention.d.ts.map +1 -0
  428. package/node_modules/micromark-core-commonmark/lib/attention.js +241 -0
  429. package/node_modules/micromark-core-commonmark/lib/autolink.d.ts +4 -0
  430. package/node_modules/micromark-core-commonmark/lib/autolink.d.ts.map +1 -0
  431. package/node_modules/micromark-core-commonmark/lib/autolink.js +233 -0
  432. package/node_modules/micromark-core-commonmark/lib/blank-line.d.ts +4 -0
  433. package/node_modules/micromark-core-commonmark/lib/blank-line.d.ts.map +1 -0
  434. package/node_modules/micromark-core-commonmark/lib/blank-line.js +61 -0
  435. package/node_modules/micromark-core-commonmark/lib/block-quote.d.ts +4 -0
  436. package/node_modules/micromark-core-commonmark/lib/block-quote.d.ts.map +1 -0
  437. package/node_modules/micromark-core-commonmark/lib/block-quote.js +143 -0
  438. package/node_modules/micromark-core-commonmark/lib/character-escape.d.ts +4 -0
  439. package/node_modules/micromark-core-commonmark/lib/character-escape.d.ts.map +1 -0
  440. package/node_modules/micromark-core-commonmark/lib/character-escape.js +64 -0
  441. package/node_modules/micromark-core-commonmark/lib/character-reference.d.ts +4 -0
  442. package/node_modules/micromark-core-commonmark/lib/character-reference.d.ts.map +1 -0
  443. package/node_modules/micromark-core-commonmark/lib/character-reference.js +149 -0
  444. package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts +4 -0
  445. package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -0
  446. package/node_modules/micromark-core-commonmark/lib/code-fenced.js +460 -0
  447. package/node_modules/micromark-core-commonmark/lib/code-indented.d.ts +4 -0
  448. package/node_modules/micromark-core-commonmark/lib/code-indented.d.ts.map +1 -0
  449. package/node_modules/micromark-core-commonmark/lib/code-indented.js +177 -0
  450. package/node_modules/micromark-core-commonmark/lib/code-text.d.ts +4 -0
  451. package/node_modules/micromark-core-commonmark/lib/code-text.d.ts.map +1 -0
  452. package/node_modules/micromark-core-commonmark/lib/code-text.js +225 -0
  453. package/node_modules/micromark-core-commonmark/lib/content.d.ts +7 -0
  454. package/node_modules/micromark-core-commonmark/lib/content.d.ts.map +1 -0
  455. package/node_modules/micromark-core-commonmark/lib/content.js +163 -0
  456. package/node_modules/micromark-core-commonmark/lib/definition.d.ts +4 -0
  457. package/node_modules/micromark-core-commonmark/lib/definition.d.ts.map +1 -0
  458. package/node_modules/micromark-core-commonmark/lib/definition.js +254 -0
  459. package/node_modules/micromark-core-commonmark/lib/hard-break-escape.d.ts +4 -0
  460. package/node_modules/micromark-core-commonmark/lib/hard-break-escape.d.ts.map +1 -0
  461. package/node_modules/micromark-core-commonmark/lib/hard-break-escape.js +60 -0
  462. package/node_modules/micromark-core-commonmark/lib/heading-atx.d.ts +4 -0
  463. package/node_modules/micromark-core-commonmark/lib/heading-atx.d.ts.map +1 -0
  464. package/node_modules/micromark-core-commonmark/lib/heading-atx.js +195 -0
  465. package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts +4 -0
  466. package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -0
  467. package/node_modules/micromark-core-commonmark/lib/html-flow.js +876 -0
  468. package/node_modules/micromark-core-commonmark/lib/html-text.d.ts +4 -0
  469. package/node_modules/micromark-core-commonmark/lib/html-text.d.ts.map +1 -0
  470. package/node_modules/micromark-core-commonmark/lib/html-text.js +678 -0
  471. package/node_modules/micromark-core-commonmark/lib/label-end.d.ts +4 -0
  472. package/node_modules/micromark-core-commonmark/lib/label-end.d.ts.map +1 -0
  473. package/node_modules/micromark-core-commonmark/lib/label-end.js +560 -0
  474. package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts +4 -0
  475. package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -0
  476. package/node_modules/micromark-core-commonmark/lib/label-start-image.js +102 -0
  477. package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts +4 -0
  478. package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -0
  479. package/node_modules/micromark-core-commonmark/lib/label-start-link.js +55 -0
  480. package/node_modules/micromark-core-commonmark/lib/line-ending.d.ts +4 -0
  481. package/node_modules/micromark-core-commonmark/lib/line-ending.d.ts.map +1 -0
  482. package/node_modules/micromark-core-commonmark/lib/line-ending.js +33 -0
  483. package/node_modules/micromark-core-commonmark/lib/list.d.ts +4 -0
  484. package/node_modules/micromark-core-commonmark/lib/list.d.ts.map +1 -0
  485. package/node_modules/micromark-core-commonmark/lib/list.js +213 -0
  486. package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts +4 -0
  487. package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -0
  488. package/node_modules/micromark-core-commonmark/lib/setext-underline.js +185 -0
  489. package/node_modules/micromark-core-commonmark/lib/thematic-break.d.ts +4 -0
  490. package/node_modules/micromark-core-commonmark/lib/thematic-break.d.ts.map +1 -0
  491. package/node_modules/micromark-core-commonmark/lib/thematic-break.js +102 -0
  492. package/node_modules/micromark-core-commonmark/license +22 -0
  493. package/node_modules/micromark-core-commonmark/package.json +74 -0
  494. package/node_modules/micromark-core-commonmark/readme.md +171 -0
  495. package/node_modules/micromark-extension-gfm-table/dev/index.d.ts +55 -0
  496. package/node_modules/micromark-extension-gfm-table/dev/index.js +2 -0
  497. package/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.d.ts +38 -0
  498. package/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.d.ts.map +1 -0
  499. package/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.js +212 -0
  500. package/node_modules/micromark-extension-gfm-table/dev/lib/html.d.ts +11 -0
  501. package/node_modules/micromark-extension-gfm-table/dev/lib/html.d.ts.map +1 -0
  502. package/node_modules/micromark-extension-gfm-table/dev/lib/html.js +148 -0
  503. package/node_modules/micromark-extension-gfm-table/dev/lib/infer.d.ts +14 -0
  504. package/node_modules/micromark-extension-gfm-table/dev/lib/infer.d.ts.map +1 -0
  505. package/node_modules/micromark-extension-gfm-table/dev/lib/infer.js +64 -0
  506. package/node_modules/micromark-extension-gfm-table/dev/lib/syntax.d.ts +18 -0
  507. package/node_modules/micromark-extension-gfm-table/dev/lib/syntax.d.ts.map +1 -0
  508. package/node_modules/micromark-extension-gfm-table/dev/lib/syntax.js +941 -0
  509. package/node_modules/micromark-extension-gfm-table/index.d.ts +55 -0
  510. package/node_modules/micromark-extension-gfm-table/index.js +2 -0
  511. package/node_modules/micromark-extension-gfm-table/lib/edit-map.d.ts +38 -0
  512. package/node_modules/micromark-extension-gfm-table/lib/edit-map.d.ts.map +1 -0
  513. package/node_modules/micromark-extension-gfm-table/lib/edit-map.js +202 -0
  514. package/node_modules/micromark-extension-gfm-table/lib/html.d.ts +11 -0
  515. package/node_modules/micromark-extension-gfm-table/lib/html.d.ts.map +1 -0
  516. package/node_modules/micromark-extension-gfm-table/lib/html.js +130 -0
  517. package/node_modules/micromark-extension-gfm-table/lib/infer.d.ts +14 -0
  518. package/node_modules/micromark-extension-gfm-table/lib/infer.d.ts.map +1 -0
  519. package/node_modules/micromark-extension-gfm-table/lib/infer.js +52 -0
  520. package/node_modules/micromark-extension-gfm-table/lib/syntax.d.ts +18 -0
  521. package/node_modules/micromark-extension-gfm-table/lib/syntax.d.ts.map +1 -0
  522. package/node_modules/micromark-extension-gfm-table/lib/syntax.js +819 -0
  523. package/node_modules/micromark-extension-gfm-table/license +22 -0
  524. package/node_modules/micromark-extension-gfm-table/package.json +128 -0
  525. package/node_modules/micromark-extension-gfm-table/readme.md +515 -0
  526. package/node_modules/micromark-factory-destination/dev/index.d.ts +42 -0
  527. package/node_modules/micromark-factory-destination/dev/index.d.ts.map +1 -0
  528. package/node_modules/micromark-factory-destination/dev/index.js +255 -0
  529. package/node_modules/micromark-factory-destination/index.d.ts +42 -0
  530. package/node_modules/micromark-factory-destination/index.d.ts.map +1 -0
  531. package/node_modules/micromark-factory-destination/index.js +206 -0
  532. package/node_modules/micromark-factory-destination/license +22 -0
  533. package/node_modules/micromark-factory-destination/package.json +57 -0
  534. package/node_modules/micromark-factory-destination/readme.md +234 -0
  535. package/node_modules/micromark-factory-label/dev/index.d.ts +37 -0
  536. package/node_modules/micromark-factory-label/dev/index.d.ts.map +1 -0
  537. package/node_modules/micromark-factory-label/dev/index.js +172 -0
  538. package/node_modules/micromark-factory-label/index.d.ts +37 -0
  539. package/node_modules/micromark-factory-label/index.d.ts.map +1 -0
  540. package/node_modules/micromark-factory-label/index.js +148 -0
  541. package/node_modules/micromark-factory-label/license +22 -0
  542. package/node_modules/micromark-factory-label/package.json +60 -0
  543. package/node_modules/micromark-factory-label/readme.md +224 -0
  544. package/node_modules/micromark-factory-space/dev/index.d.ts +37 -0
  545. package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -0
  546. package/node_modules/micromark-factory-space/dev/index.js +67 -0
  547. package/node_modules/micromark-factory-space/index.d.ts +37 -0
  548. package/node_modules/micromark-factory-space/index.d.ts.map +1 -0
  549. package/node_modules/micromark-factory-space/index.js +64 -0
  550. package/node_modules/micromark-factory-space/license +22 -0
  551. package/node_modules/micromark-factory-space/package.json +55 -0
  552. package/node_modules/micromark-factory-space/readme.md +225 -0
  553. package/node_modules/micromark-factory-title/dev/index.d.ts +36 -0
  554. package/node_modules/micromark-factory-title/dev/index.d.ts.map +1 -0
  555. package/node_modules/micromark-factory-title/dev/index.js +169 -0
  556. package/node_modules/micromark-factory-title/index.d.ts +36 -0
  557. package/node_modules/micromark-factory-title/index.d.ts.map +1 -0
  558. package/node_modules/micromark-factory-title/index.js +158 -0
  559. package/node_modules/micromark-factory-title/license +22 -0
  560. package/node_modules/micromark-factory-title/package.json +58 -0
  561. package/node_modules/micromark-factory-title/readme.md +229 -0
  562. package/node_modules/micromark-factory-whitespace/dev/index.d.ts +22 -0
  563. package/node_modules/micromark-factory-whitespace/dev/index.d.ts.map +1 -0
  564. package/node_modules/micromark-factory-whitespace/dev/index.js +53 -0
  565. package/node_modules/micromark-factory-whitespace/index.d.ts +22 -0
  566. package/node_modules/micromark-factory-whitespace/index.d.ts.map +1 -0
  567. package/node_modules/micromark-factory-whitespace/index.js +44 -0
  568. package/node_modules/micromark-factory-whitespace/license +22 -0
  569. package/node_modules/micromark-factory-whitespace/package.json +57 -0
  570. package/node_modules/micromark-factory-whitespace/readme.md +205 -0
  571. package/node_modules/micromark-util-character/dev/index.d.ts +195 -0
  572. package/node_modules/micromark-util-character/dev/index.d.ts.map +1 -0
  573. package/node_modules/micromark-util-character/dev/index.js +252 -0
  574. package/node_modules/micromark-util-character/index.d.ts +195 -0
  575. package/node_modules/micromark-util-character/index.d.ts.map +1 -0
  576. package/node_modules/micromark-util-character/index.js +246 -0
  577. package/node_modules/micromark-util-character/license +22 -0
  578. package/node_modules/micromark-util-character/package.json +57 -0
  579. package/node_modules/micromark-util-character/readme.md +446 -0
  580. package/node_modules/micromark-util-chunked/dev/index.d.ts +41 -0
  581. package/node_modules/micromark-util-chunked/dev/index.d.ts.map +1 -0
  582. package/node_modules/micromark-util-chunked/dev/index.js +89 -0
  583. package/node_modules/micromark-util-chunked/index.d.ts +41 -0
  584. package/node_modules/micromark-util-chunked/index.d.ts.map +1 -0
  585. package/node_modules/micromark-util-chunked/index.js +81 -0
  586. package/node_modules/micromark-util-chunked/license +22 -0
  587. package/node_modules/micromark-util-chunked/package.json +57 -0
  588. package/node_modules/micromark-util-chunked/readme.md +219 -0
  589. package/node_modules/micromark-util-classify-character/dev/index.d.ts +18 -0
  590. package/node_modules/micromark-util-classify-character/dev/index.d.ts.map +1 -0
  591. package/node_modules/micromark-util-classify-character/dev/index.js +38 -0
  592. package/node_modules/micromark-util-classify-character/index.d.ts +18 -0
  593. package/node_modules/micromark-util-classify-character/index.d.ts.map +1 -0
  594. package/node_modules/micromark-util-classify-character/index.js +27 -0
  595. package/node_modules/micromark-util-classify-character/license +22 -0
  596. package/node_modules/micromark-util-classify-character/package.json +59 -0
  597. package/node_modules/micromark-util-classify-character/readme.md +205 -0
  598. package/node_modules/micromark-util-combine-extensions/index.d.ts +22 -0
  599. package/node_modules/micromark-util-combine-extensions/index.d.ts.map +1 -0
  600. package/node_modules/micromark-util-combine-extensions/index.js +143 -0
  601. package/node_modules/micromark-util-combine-extensions/license +22 -0
  602. package/node_modules/micromark-util-combine-extensions/package.json +52 -0
  603. package/node_modules/micromark-util-combine-extensions/readme.md +201 -0
  604. package/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts +16 -0
  605. package/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts.map +1 -0
  606. package/node_modules/micromark-util-decode-numeric-character-reference/dev/index.js +42 -0
  607. package/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts +16 -0
  608. package/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts.map +1 -0
  609. package/node_modules/micromark-util-decode-numeric-character-reference/index.js +32 -0
  610. package/node_modules/micromark-util-decode-numeric-character-reference/license +22 -0
  611. package/node_modules/micromark-util-decode-numeric-character-reference/package.json +59 -0
  612. package/node_modules/micromark-util-decode-numeric-character-reference/readme.md +184 -0
  613. package/node_modules/micromark-util-decode-string/dev/index.d.ts +14 -0
  614. package/node_modules/micromark-util-decode-string/dev/index.d.ts.map +1 -0
  615. package/node_modules/micromark-util-decode-string/dev/index.js +53 -0
  616. package/node_modules/micromark-util-decode-string/index.d.ts +14 -0
  617. package/node_modules/micromark-util-decode-string/index.d.ts.map +1 -0
  618. package/node_modules/micromark-util-decode-string/index.js +45 -0
  619. package/node_modules/micromark-util-decode-string/license +22 -0
  620. package/node_modules/micromark-util-decode-string/package.json +63 -0
  621. package/node_modules/micromark-util-decode-string/readme.md +179 -0
  622. package/node_modules/micromark-util-encode/index.d.ts +14 -0
  623. package/node_modules/micromark-util-encode/index.d.ts.map +1 -0
  624. package/node_modules/micromark-util-encode/index.js +33 -0
  625. package/node_modules/micromark-util-encode/license +22 -0
  626. package/node_modules/micromark-util-encode/package.json +47 -0
  627. package/node_modules/micromark-util-encode/readme.md +176 -0
  628. package/node_modules/micromark-util-html-tag-name/index.d.ts +30 -0
  629. package/node_modules/micromark-util-html-tag-name/index.d.ts.map +1 -0
  630. package/node_modules/micromark-util-html-tag-name/index.js +93 -0
  631. package/node_modules/micromark-util-html-tag-name/license +22 -0
  632. package/node_modules/micromark-util-html-tag-name/package.json +47 -0
  633. package/node_modules/micromark-util-html-tag-name/readme.md +193 -0
  634. package/node_modules/micromark-util-normalize-identifier/dev/index.d.ts +21 -0
  635. package/node_modules/micromark-util-normalize-identifier/dev/index.d.ts.map +1 -0
  636. package/node_modules/micromark-util-normalize-identifier/dev/index.js +38 -0
  637. package/node_modules/micromark-util-normalize-identifier/index.d.ts +21 -0
  638. package/node_modules/micromark-util-normalize-identifier/index.d.ts.map +1 -0
  639. package/node_modules/micromark-util-normalize-identifier/index.js +33 -0
  640. package/node_modules/micromark-util-normalize-identifier/license +22 -0
  641. package/node_modules/micromark-util-normalize-identifier/package.json +58 -0
  642. package/node_modules/micromark-util-normalize-identifier/readme.md +187 -0
  643. package/node_modules/micromark-util-resolve-all/index.d.ts +22 -0
  644. package/node_modules/micromark-util-resolve-all/index.d.ts.map +1 -0
  645. package/node_modules/micromark-util-resolve-all/index.js +32 -0
  646. package/node_modules/micromark-util-resolve-all/license +22 -0
  647. package/node_modules/micromark-util-resolve-all/package.json +48 -0
  648. package/node_modules/micromark-util-resolve-all/readme.md +238 -0
  649. package/node_modules/micromark-util-sanitize-uri/dev/index.d.ts +36 -0
  650. package/node_modules/micromark-util-sanitize-uri/dev/index.d.ts.map +1 -0
  651. package/node_modules/micromark-util-sanitize-uri/dev/index.js +124 -0
  652. package/node_modules/micromark-util-sanitize-uri/index.d.ts +36 -0
  653. package/node_modules/micromark-util-sanitize-uri/index.d.ts.map +1 -0
  654. package/node_modules/micromark-util-sanitize-uri/index.js +107 -0
  655. package/node_modules/micromark-util-sanitize-uri/license +22 -0
  656. package/node_modules/micromark-util-sanitize-uri/package.json +59 -0
  657. package/node_modules/micromark-util-sanitize-uri/readme.md +214 -0
  658. package/node_modules/micromark-util-subtokenize/dev/index.d.ts +12 -0
  659. package/node_modules/micromark-util-subtokenize/dev/index.d.ts.map +1 -0
  660. package/node_modules/micromark-util-subtokenize/dev/index.js +284 -0
  661. package/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.d.ts +161 -0
  662. package/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.d.ts.map +1 -0
  663. package/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.js +288 -0
  664. package/node_modules/micromark-util-subtokenize/index.d.ts +12 -0
  665. package/node_modules/micromark-util-subtokenize/index.d.ts.map +1 -0
  666. package/node_modules/micromark-util-subtokenize/index.js +228 -0
  667. package/node_modules/micromark-util-subtokenize/lib/splice-buffer.d.ts +161 -0
  668. package/node_modules/micromark-util-subtokenize/lib/splice-buffer.d.ts.map +1 -0
  669. package/node_modules/micromark-util-subtokenize/lib/splice-buffer.js +251 -0
  670. package/node_modules/micromark-util-subtokenize/license +22 -0
  671. package/node_modules/micromark-util-subtokenize/package.json +60 -0
  672. package/node_modules/micromark-util-subtokenize/readme.md +181 -0
  673. package/node_modules/micromark-util-symbol/lib/codes.d.ts +139 -0
  674. package/node_modules/micromark-util-symbol/lib/codes.d.ts.map +1 -0
  675. package/node_modules/micromark-util-symbol/lib/codes.js +158 -0
  676. package/node_modules/micromark-util-symbol/lib/constants.d.ts +37 -0
  677. package/node_modules/micromark-util-symbol/lib/constants.d.ts.map +1 -0
  678. package/node_modules/micromark-util-symbol/lib/constants.js +44 -0
  679. package/node_modules/micromark-util-symbol/lib/default.d.ts +5 -0
  680. package/node_modules/micromark-util-symbol/lib/default.d.ts.map +1 -0
  681. package/node_modules/micromark-util-symbol/lib/default.js +4 -0
  682. package/node_modules/micromark-util-symbol/lib/types.d.ts +106 -0
  683. package/node_modules/micromark-util-symbol/lib/types.d.ts.map +1 -0
  684. package/node_modules/micromark-util-symbol/lib/types.js +453 -0
  685. package/node_modules/micromark-util-symbol/lib/values.d.ts +102 -0
  686. package/node_modules/micromark-util-symbol/lib/values.d.ts.map +1 -0
  687. package/node_modules/micromark-util-symbol/lib/values.js +109 -0
  688. package/node_modules/micromark-util-symbol/license +22 -0
  689. package/node_modules/micromark-util-symbol/package.json +43 -0
  690. package/node_modules/micromark-util-symbol/readme.md +168 -0
  691. package/node_modules/micromark-util-types/index.d.ts +1312 -0
  692. package/node_modules/micromark-util-types/index.js +2 -0
  693. package/node_modules/micromark-util-types/license +22 -0
  694. package/node_modules/micromark-util-types/package.json +71 -0
  695. package/node_modules/micromark-util-types/readme.md +151 -0
  696. package/node_modules/ms/index.js +162 -0
  697. package/node_modules/ms/license.md +21 -0
  698. package/node_modules/ms/package.json +38 -0
  699. package/node_modules/ms/readme.md +59 -0
  700. package/node_modules/unist-util-is/index.d.ts +5 -0
  701. package/node_modules/unist-util-is/index.d.ts.map +1 -0
  702. package/node_modules/unist-util-is/index.js +7 -0
  703. package/node_modules/unist-util-is/lib/index.d.ts +111 -0
  704. package/node_modules/unist-util-is/lib/index.d.ts.map +1 -0
  705. package/node_modules/unist-util-is/lib/index.js +296 -0
  706. package/node_modules/unist-util-is/license +22 -0
  707. package/node_modules/unist-util-is/package.json +103 -0
  708. package/node_modules/unist-util-is/readme.md +351 -0
  709. package/node_modules/unist-util-stringify-position/index.d.ts +1 -0
  710. package/node_modules/unist-util-stringify-position/index.js +1 -0
  711. package/node_modules/unist-util-stringify-position/lib/index.d.ts +61 -0
  712. package/node_modules/unist-util-stringify-position/lib/index.js +84 -0
  713. package/node_modules/unist-util-stringify-position/license +22 -0
  714. package/node_modules/unist-util-stringify-position/package.json +80 -0
  715. package/node_modules/unist-util-stringify-position/readme.md +206 -0
  716. package/node_modules/unist-util-visit/index.d.ts +9 -0
  717. package/node_modules/unist-util-visit/index.js +2 -0
  718. package/node_modules/unist-util-visit/lib/index.d.ts +195 -0
  719. package/node_modules/unist-util-visit/lib/index.d.ts.map +1 -0
  720. package/node_modules/unist-util-visit/lib/index.js +312 -0
  721. package/node_modules/unist-util-visit/license +22 -0
  722. package/node_modules/unist-util-visit/package.json +108 -0
  723. package/node_modules/unist-util-visit/readme.md +313 -0
  724. package/node_modules/unist-util-visit-parents/index.d.ts +14 -0
  725. package/node_modules/unist-util-visit-parents/index.js +2 -0
  726. package/node_modules/unist-util-visit-parents/lib/color.d.ts +6 -0
  727. package/node_modules/unist-util-visit-parents/lib/color.d.ts.map +1 -0
  728. package/node_modules/unist-util-visit-parents/lib/color.js +7 -0
  729. package/node_modules/unist-util-visit-parents/lib/color.node.d.ts +6 -0
  730. package/node_modules/unist-util-visit-parents/lib/color.node.d.ts.map +1 -0
  731. package/node_modules/unist-util-visit-parents/lib/color.node.js +7 -0
  732. package/node_modules/unist-util-visit-parents/lib/index.d.ts +219 -0
  733. package/node_modules/unist-util-visit-parents/lib/index.d.ts.map +1 -0
  734. package/node_modules/unist-util-visit-parents/lib/index.js +399 -0
  735. package/node_modules/unist-util-visit-parents/license +22 -0
  736. package/node_modules/unist-util-visit-parents/package.json +106 -0
  737. package/node_modules/unist-util-visit-parents/readme.md +388 -0
  738. package/node_modules/zwitch/index.d.ts +67 -0
  739. package/node_modules/zwitch/index.js +118 -0
  740. package/node_modules/zwitch/license +22 -0
  741. package/node_modules/zwitch/package.json +72 -0
  742. package/node_modules/zwitch/readme.md +226 -0
  743. package/npm-shrinkwrap.json +737 -3
  744. package/openclaw.plugin.json +154 -81
  745. package/package.json +10 -7
  746. package/skills/feishu-drive/SKILL.md +5 -2
  747. package/dist/legacy-state-migrations-api.js +0 -73
  748. package/dist/monitor.state-DAHbcR2N.js +0 -173
  749. package/dist/send-result-BMQw-YhV.js +0 -287
@@ -1,45 +1,88 @@
1
- import { _ as normalizeCommentFileType, c as encodeQuery, d as isRecord$1, f as normalizeString, g as buildFeishuCommentTarget, h as requestFeishuApi, l as extractReplyText, m as readString, o as resolveFeishuAccount, p as parseCommentContentElements, s as resolveFeishuRuntimeAccount } from "./accounts-Bs5uJ4h0.js";
1
+ import { _ as normalizeCommentFileType, c as encodeQuery, d as isRecord$1, f as normalizeString, g as buildFeishuCommentTarget, h as requestFeishuApi, l as extractReplyText, m as readString, o as resolveFeishuAccount, p as parseCommentContentElements, s as resolveFeishuRuntimeAccount } from "./accounts-BDoGHJDk.js";
2
2
  import { i as resolveReceiveIdType } from "./targets-BUjQ1TcA.js";
3
- import { c as normalizeFeishuAllowEntry, d as resolveFeishuGroupConversationIngressAccess, f as resolveFeishuGroupSenderActivationIngressAccess, l as resolveFeishuDmIngressAccess, p as resolveFeishuReplyPolicy, s as hasExplicitFeishuGroupConfig, u as resolveFeishuGroupConfig } from "./channel-DRQRQQQ3.js";
4
- import { d as decodeFeishuCardAction, l as buildFeishuCardActionTextFallback, o as resolveFeishuCardTemplate, u as createFeishuCardInteractionEnvelope } from "./send-result-BMQw-YhV.js";
5
- import { o as resolveConfiguredFeishuGroupSessionScope, t as buildFeishuConversationId } from "./conversation-id-CdLdoot3.js";
3
+ import { C as resolveFeishuGroupConfig, D as resolveFeishuReplyPolicy, M as createFeishuCardInteractionEnvelope, N as decodeFeishuCardAction, O as normalizeFeishuChatType$2, S as resolveFeishuDmIngressAccess, T as resolveFeishuGroupSenderActivationIngressAccess, b as hasExplicitFeishuGroupConfig, d as chunkFeishuPostMarkdown, f as materializeFeishuPostMarkdownSoftBreaks, j as buildFeishuCardActionTextFallback, k as resolveFeishuChatType, o as resolveFeishuCardTemplate, w as resolveFeishuGroupConversationIngressAccess, x as normalizeFeishuAllowEntry } from "./send-result-CPS7AozW.js";
4
+ import { o as resolveConfiguredFeishuGroupSessionScope, t as buildFeishuConversationId } from "./conversation-id-BeJL-wq7.js";
6
5
  import { t as getFeishuRuntime } from "./runtime-C5JxBWZp.js";
7
- import { a as getFeishuUserAgent, i as createFeishuWSClient, n as createEventDispatcher, r as createFeishuClient, s as resolveConfiguredHttpTimeoutMs } from "./client-B7EAV_Ss.js";
8
- import { i as createCommentTypingReactionLifecycle, s as getChatInfo, t as deliverCommentThreadText } from "./drive-D0lIhxqZ.js";
6
+ import { a as getFeishuUserAgent, i as createFeishuWSClient, n as createEventDispatcher, r as createFeishuClient, s as resolveConfiguredHttpTimeoutMs } from "./client-BUC-R2Wi.js";
7
+ import { i as createCommentTypingReactionLifecycle, l as getChatInfo, t as deliverCommentThreadText } from "./drive-Bpe8ONK_.js";
9
8
  import { t as createFeishuThreadBindingManager } from "./thread-bindings-V0bwk0A1.js";
10
9
  import { createReplyPrefixContext, evaluateSupplementalContextVisibility, getSessionEntry, normalizeAgentId as normalizeAgentId$2, resolveChannelContextVisibilityMode } from "./runtime-api.js";
11
10
  import { t as readFeishuJsonResponse } from "./json-response-CheljwGr.js";
12
- import { _ as resolveFeishuIdentityEmoji, c as parsePostContent, d as isMentionForwardRequest, f as isFeishuGroupChatType, g as normalizeFeishuExternalKey, h as shouldSuppressFeishuTextForVoiceMedia, i as sendCardFeishu, l as extractMentionTargets, m as sendMediaFeishu, n as getMessageFeishu, o as sendMessageFeishu, p as saveMessageResourceFeishu, r as listFeishuThreadMessages, s as sendStructuredCardFeishu, u as isFeishuBroadcastMention } from "./send-Be2GMA6Z.js";
13
- import { i as waitForAbortableDelay, r as raceWithTimeoutAndAbort } from "./probe-Dxyo9zlw.js";
14
- import { a as clearFeishuBotIdentityState, c as httpServers, d as wsClients, f as fetchBotIdentityForMonitor, i as botOpenIds, l as recordWebhookStatus, n as FEISHU_WEBHOOK_MAX_BODY_BYTES, o as closeTrackedFeishuHttpServer, r as botNames, s as feishuWebhookRateLimiter, t as FEISHU_WEBHOOK_BODY_TIMEOUT_MS, u as setFeishuBotIdentityState } from "./monitor.state-DAHbcR2N.js";
15
- import { createChannelMessageReplyPipeline, formatChannelProgressDraftLineForEntry, isChannelProgressDraftWorkToolName, resolveAgentOutboundIdentity } from "openclaw/plugin-sdk/channel-outbound";
11
+ import { _ as resolveFeishuIdentityEmoji, c as parsePostContent, d as isMentionForwardRequest, f as isFeishuGroupChatType, g as normalizeFeishuExternalKey, h as shouldSuppressFeishuTextForVoiceMedia, i as sendCardFeishu, l as extractMentionTargets, m as sendMediaFeishu, n as getMessageFeishu, o as sendMessageFeishu, p as saveMessageResourceFeishu, r as listFeishuThreadMessages, s as sendStructuredCardFeishu, u as isFeishuBroadcastMention } from "./send-CpnLYueT.js";
12
+ import { i as waitForAbortableDelay, r as raceWithTimeoutAndAbort } from "./probe-CAloGqgG.js";
13
+ import { t as fetchBotIdentityForMonitor } from "./monitor.startup-DpZzunQn.js";
14
+ import { createChannelMessageReplyPipeline, formatChannelProgressDraftLineForEntry, isChannelProgressDraftWorkToolName, resolveAgentOutboundIdentity, resolveChannelPreviewStreamMode, resolveChannelStreamingBlockEnabled } from "openclaw/plugin-sdk/channel-outbound";
16
15
  import { createChannelPairingController, createChannelPairingController as createChannelPairingController$1 } from "openclaw/plugin-sdk/channel-pairing";
17
16
  import { ensureConfiguredBindingRouteReady, resolveConfiguredBindingRoute, resolveRuntimeConversationBindingRoute } from "openclaw/plugin-sdk/conversation-runtime";
18
17
  import { asDateTimestampMs, isFutureDateTimestampMs, parseStrictNonNegativeInteger, resolveDateTimestampMs, resolveExpiresAtMsFromDurationMs, resolveExpiresAtMsFromDurationSeconds, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
19
18
  import { asBoolean, asNullableRecord, isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, readStringValue, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
20
19
  import { stripReasoningTagsFromText } from "openclaw/plugin-sdk/text-chunking";
20
+ import { resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
21
21
  import fs from "node:fs";
22
22
  import os from "node:os";
23
23
  import path from "node:path";
24
24
  import { normalizeAccountId, resolveAgentRoute, resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
25
25
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
26
26
  import * as Lark from "@larksuiteoapi/node-sdk";
27
- import * as crypto$1 from "node:crypto";
28
- import crypto, { createHash } from "node:crypto";
29
- import { applyBasicWebhookRequestGuards, resolveRequestClientIp } from "openclaw/plugin-sdk/webhook-ingress";
27
+ import { WEBHOOK_ANOMALY_COUNTER_DEFAULTS, WEBHOOK_RATE_LIMIT_DEFAULTS, applyBasicWebhookRequestGuards, createFixedWindowRateLimiter, createWebhookAnomalyTracker, resolveRequestClientIp } from "openclaw/plugin-sdk/webhook-ingress";
30
28
  import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
31
29
  import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback, sendMediaWithLeadingCaption } from "openclaw/plugin-sdk/reply-payload";
32
30
  import { resolvePinnedMainDmOwnerFromAllowlist, safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
31
+ import * as crypto$1 from "node:crypto";
32
+ import crypto, { createHash } from "node:crypto";
33
33
  import { buildChannelInboundEventContext, formatInboundMediaUnavailableText, toInboundMediaFacts } from "openclaw/plugin-sdk/channel-inbound";
34
34
  import { DEFAULT_GROUP_HISTORY_LIMIT, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
35
- import { resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
36
35
  import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
36
+ import { createClaimableDedupe } from "openclaw/plugin-sdk/persistent-dedupe";
37
37
  import { resolveChannelConfigWrites } from "openclaw/plugin-sdk/channel-config-writes";
38
38
  import { formatReasoningMessage } from "openclaw/plugin-sdk/agent-runtime";
39
39
  import { logTypingFailure } from "openclaw/plugin-sdk/channel-feedback";
40
40
  import * as http from "node:http";
41
41
  import { installRequestBodyLimitGuard, readWebhookBodyOrReject } from "openclaw/plugin-sdk/webhook-request-guards";
42
42
  import { isAbortRequestText, isBtwRequestText } from "openclaw/plugin-sdk/command-primitives-runtime";
43
+ //#region extensions/feishu/src/bot-agent-body.ts
44
+ const MAX_MENTION_CONTEXT_NAME_LENGTH = 80;
45
+ function formatMentionNameForAgentContext(name) {
46
+ const normalized = Array.from(name, (char) => {
47
+ return char.charCodeAt(0) < 32 || char === "[" || char === "]" ? " " : char;
48
+ }).join("").replace(/\s+/g, " ").trim();
49
+ const bounded = normalized.length > MAX_MENTION_CONTEXT_NAME_LENGTH ? `${truncateUtf16Safe(normalized, MAX_MENTION_CONTEXT_NAME_LENGTH - 3)}...` : normalized;
50
+ return JSON.stringify(bounded || "unknown");
51
+ }
52
+ function buildFeishuAgentBody(params) {
53
+ const { ctx, quotedContent, permissionErrorForAgent, botOpenId } = params;
54
+ let messageBody = ctx.content;
55
+ if (quotedContent) messageBody = `[Replying to: "${quotedContent}"]\n\n${ctx.content}`;
56
+ messageBody = `${ctx.senderName ?? ctx.senderOpenId}: ${messageBody}`;
57
+ if (ctx.hasAnyMention) {
58
+ const botIdHint = botOpenId?.trim();
59
+ messageBody += "\n\n[System: The content may include mention tags in the form <at user_id=\"...\">name</at>. Treat these as real mentions of Feishu entities (users or bots).]";
60
+ if (botIdHint) messageBody += `\n[System: If user_id is "${botIdHint}", that mention refers to you.]`;
61
+ }
62
+ if (ctx.mentionTargets && ctx.mentionTargets.length > 0) {
63
+ const targetNames = ctx.mentionTargets.map((target) => formatMentionNameForAgentContext(target.name)).join(", ");
64
+ messageBody += `\n\n[System: Feishu users mentioned in the incoming message, for context only: ${targetNames}. Do not notify or mention these users solely because they are listed here.]`;
65
+ }
66
+ messageBody = `[message_id: ${ctx.messageId}]\n${messageBody}`;
67
+ if (permissionErrorForAgent) {
68
+ const grantUrl = permissionErrorForAgent.grantUrl ?? "";
69
+ messageBody += `\n\n[System: The bot encountered a Feishu API permission error. Please inform the user about this issue and provide the permission grant URL for the admin to authorize. Permission grant URL: ${grantUrl}]`;
70
+ }
71
+ return messageBody;
72
+ }
73
+ //#endregion
74
+ //#region extensions/feishu/src/bot-broadcast.ts
75
+ function resolveBroadcastAgents(cfg, peerId) {
76
+ const broadcast = cfg.broadcast;
77
+ if (!broadcast || typeof broadcast !== "object") return null;
78
+ const agents = broadcast[peerId];
79
+ return Array.isArray(agents) && agents.length > 0 ? agents : null;
80
+ }
81
+ function buildBroadcastSessionKey(baseSessionKey, originalAgentId, targetAgentId) {
82
+ const prefix = `agent:${originalAgentId}:`;
83
+ return baseSessionKey.startsWith(prefix) ? `agent:${targetAgentId}:${baseSessionKey.slice(prefix.length)}` : baseSessionKey;
84
+ }
85
+ //#endregion
43
86
  //#region extensions/feishu/src/bot-content.ts
44
87
  function resolveFeishuGroupSession(params) {
45
88
  const { chatId, senderOpenId, messageId, rootId, threadId, chatType, groupConfig, feishuCfg } = params;
@@ -376,6 +419,65 @@ async function resolveFeishuMediaList(params) {
376
419
  };
377
420
  }
378
421
  //#endregion
422
+ //#region extensions/feishu/src/bot-group-name-state.ts
423
+ const feishuGroupNameCache = /* @__PURE__ */ new Map();
424
+ //#endregion
425
+ //#region extensions/feishu/src/bot-group-name.ts
426
+ const GROUP_NAME_CACHE_TTL_MS = 1800 * 1e3;
427
+ const GROUP_NAME_CACHE_MAX_SIZE = 500;
428
+ function evictGroupNameCache() {
429
+ const now = asDateTimestampMs(Date.now());
430
+ if (now === void 0) {
431
+ feishuGroupNameCache.clear();
432
+ return;
433
+ }
434
+ for (const [key, value] of feishuGroupNameCache) {
435
+ const expiresAt = asDateTimestampMs(value.expiresAt);
436
+ if (expiresAt === void 0 || expiresAt <= now) feishuGroupNameCache.delete(key);
437
+ }
438
+ const excess = feishuGroupNameCache.size - GROUP_NAME_CACHE_MAX_SIZE;
439
+ if (excess <= 0) return;
440
+ let removed = 0;
441
+ for (const key of feishuGroupNameCache.keys()) {
442
+ if (removed >= excess) break;
443
+ feishuGroupNameCache.delete(key);
444
+ removed++;
445
+ }
446
+ }
447
+ function setCacheEntry(key, name) {
448
+ const expiresAt = resolveExpiresAtMsFromDurationMs(GROUP_NAME_CACHE_TTL_MS);
449
+ feishuGroupNameCache.delete(key);
450
+ if (expiresAt !== void 0) feishuGroupNameCache.set(key, {
451
+ name,
452
+ expiresAt
453
+ });
454
+ }
455
+ async function resolveGroupName(params) {
456
+ const { account, chatId, log } = params;
457
+ if (!account.configured) return;
458
+ const cacheKey = `${account.accountId}:${chatId}`;
459
+ const cached = feishuGroupNameCache.get(cacheKey);
460
+ if (cached) {
461
+ const now = asDateTimestampMs(Date.now());
462
+ const expiresAt = asDateTimestampMs(cached.expiresAt);
463
+ if (now !== void 0 && expiresAt !== void 0 && expiresAt > now) return cached.name || void 0;
464
+ feishuGroupNameCache.delete(cacheKey);
465
+ }
466
+ let resolvedName;
467
+ try {
468
+ const name = (await getChatInfo(createFeishuClient(account), chatId))?.name?.trim();
469
+ if (name) {
470
+ setCacheEntry(cacheKey, name);
471
+ resolvedName = name;
472
+ } else setCacheEntry(cacheKey, "");
473
+ } catch (err) {
474
+ log(`feishu[${account.accountId}]: getChatInfo failed for ${chatId}: ${String(err)}`);
475
+ setCacheEntry(cacheKey, "");
476
+ }
477
+ evictGroupNameCache();
478
+ return resolvedName;
479
+ }
480
+ //#endregion
379
481
  //#region extensions/feishu/src/bot-sender-name.ts
380
482
  const IGNORED_PERMISSION_SCOPE_TOKENS = ["contact:contact.base:readonly"];
381
483
  const FEISHU_SCOPE_CORRECTIONS = { "contact:contact.base:readonly": "contact:user.base:readonly" };
@@ -455,207 +557,85 @@ async function resolveFeishuSenderName(params) {
455
557
  }
456
558
  }
457
559
  //#endregion
458
- //#region extensions/feishu/src/processing-claims.ts
459
- const EVENT_DEDUP_TTL_MS = 300 * 1e3;
460
- const EVENT_MEMORY_MAX_SIZE = 2e3;
461
- const processingClaims = /* @__PURE__ */ new Map();
462
- function resolveEventDedupeKey(namespace, messageId) {
463
- const trimmed = messageId?.trim();
464
- return trimmed ? `${namespace}:${trimmed}` : null;
465
- }
466
- function pruneProcessingClaims(now) {
467
- const cutoff = now - EVENT_DEDUP_TTL_MS;
468
- for (const [key, seenAt] of processingClaims) if (seenAt < cutoff) processingClaims.delete(key);
469
- while (processingClaims.size > EVENT_MEMORY_MAX_SIZE) {
470
- const oldestKey = processingClaims.keys().next().value;
471
- if (!oldestKey) return;
472
- processingClaims.delete(oldestKey);
473
- }
474
- }
475
- function tryBeginFeishuMessageProcessing(messageId, namespace = "global") {
476
- const key = resolveEventDedupeKey(namespace, messageId);
477
- if (!key) return true;
478
- const now = Date.now();
479
- pruneProcessingClaims(now);
480
- if (processingClaims.has(key)) {
481
- processingClaims.delete(key);
482
- processingClaims.set(key, now);
483
- pruneProcessingClaims(now);
484
- return false;
485
- }
486
- processingClaims.set(key, now);
487
- pruneProcessingClaims(now);
488
- return true;
489
- }
490
- function releaseFeishuMessageProcessing(messageId, namespace = "global") {
491
- const key = resolveEventDedupeKey(namespace, messageId);
492
- if (key) processingClaims.delete(key);
493
- }
494
- //#endregion
495
- //#region extensions/feishu/src/dedup.ts
560
+ //#region extensions/feishu/src/dedup-state.ts
561
+ const DEDUPE_NAMESPACE_PREFIX = "feishu.dedup";
496
562
  const DEDUP_TTL_MS = 1440 * 60 * 1e3;
497
563
  const MEMORY_MAX_SIZE = 1e3;
498
564
  const STORE_MAX_ENTRIES = 1e4;
499
- const memory = /* @__PURE__ */ new Map();
500
- const cachedDedupStores = /* @__PURE__ */ new Map();
501
- function normalizeMessageId(messageId) {
502
- const trimmed = messageId?.trim();
503
- return trimmed ? trimmed : null;
504
- }
505
- function normalizeNamespace(namespace) {
506
- return namespace?.trim() || "global";
507
- }
508
- function pluginStateNamespace(namespace) {
509
- return `dedup.${namespace.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
510
- }
511
- function openDedupStore(namespace) {
512
- const stateNamespace = pluginStateNamespace(namespace);
513
- const cached = cachedDedupStores.get(stateNamespace);
514
- if (cached) return cached;
515
- const store = getFeishuRuntime().state.openSyncKeyedStore({
516
- namespace: stateNamespace,
517
- maxEntries: STORE_MAX_ENTRIES,
518
- defaultTtlMs: DEDUP_TTL_MS
565
+ function createFeishuDedupeGuard() {
566
+ return createClaimableDedupe({
567
+ pluginId: "feishu",
568
+ namespacePrefix: DEDUPE_NAMESPACE_PREFIX,
569
+ ttlMs: DEDUP_TTL_MS,
570
+ memoryMaxSize: MEMORY_MAX_SIZE,
571
+ stateMaxEntries: STORE_MAX_ENTRIES
519
572
  });
520
- cachedDedupStores.set(stateNamespace, store);
521
- return store;
522
- }
523
- function dedupeStoreKey(namespace, messageId) {
524
- return createHash("sha256").update(`${namespace}\0${messageId}`, "utf8").digest("hex").slice(0, 32);
525
- }
526
- function memoryKey(namespace, messageId) {
527
- return `${namespace}\0${messageId}`;
528
573
  }
529
- function isRecent(seenAt, now = Date.now()) {
530
- return typeof seenAt === "number" && Number.isFinite(seenAt) && now - seenAt < DEDUP_TTL_MS;
531
- }
532
- function pruneMemory(now = Date.now()) {
533
- for (const [key, seenAt] of memory) if (!isRecent(seenAt, now)) memory.delete(key);
534
- if (memory.size <= MEMORY_MAX_SIZE) return;
535
- const toRemove = Array.from(memory.entries()).toSorted(([, left], [, right]) => left - right).slice(0, memory.size - MEMORY_MAX_SIZE);
536
- for (const [key] of toRemove) memory.delete(key);
537
- }
538
- function remember(namespace, messageId, seenAt = Date.now()) {
539
- memory.set(memoryKey(namespace, messageId), seenAt);
540
- pruneMemory(seenAt);
574
+ const feishuDedupeState = {
575
+ guard: createFeishuDedupeGuard(),
576
+ reset() {
577
+ this.guard = createFeishuDedupeGuard();
578
+ }
579
+ };
580
+ //#endregion
581
+ //#region extensions/feishu/src/dedup.ts
582
+ function dedupeKey(messageId) {
583
+ return messageId?.trim() ?? "";
541
584
  }
542
- function hasMemory(namespace, messageId, now = Date.now()) {
543
- const key = memoryKey(namespace, messageId);
544
- if (isRecent(memory.get(key), now)) return true;
545
- memory.delete(key);
546
- return false;
585
+ function dedupeOptions(namespace, log) {
586
+ return {
587
+ ...namespace ? { namespace } : {},
588
+ ...log ? { onDiskError: (error) => log(`feishu-dedup: persistent state error: ${String(error)}`) } : {}
589
+ };
547
590
  }
591
+ /**
592
+ * Claims a dedupe key for exclusive handling. Duplicate (already committed)
593
+ * and in-flight keys are reported; blank keys fail open as claimed so an
594
+ * unidentifiable event is never suppressed.
595
+ */
548
596
  async function claimUnprocessedFeishuMessage(params) {
549
- const { messageId, namespace = "global", log } = params;
550
- const normalizedMessageId = normalizeMessageId(messageId);
551
- if (!normalizedMessageId) return "invalid";
552
- if (await hasProcessedFeishuMessage(normalizedMessageId, namespace, log)) return "duplicate";
553
- if (!tryBeginFeishuMessageProcessing(normalizedMessageId, namespace)) return "inflight";
554
- return "claimed";
597
+ const key = dedupeKey(params.messageId);
598
+ if (!key) return "claimed";
599
+ return (await feishuDedupeState.guard.claim(key, dedupeOptions(params.namespace, params.log))).kind;
600
+ }
601
+ /** Drops an uncommitted claim so a failed handler can retry the message. */
602
+ function releaseFeishuMessageProcessing(messageId, namespace = "global") {
603
+ const key = dedupeKey(messageId);
604
+ if (key) feishuDedupeState.guard.release(key, { namespace });
555
605
  }
606
+ /**
607
+ * Claims (unless the caller already holds the claim) and commits a message.
608
+ * False means another handler owns it, it was already handled, or the key is
609
+ * blank; handlers must skip dispatch then.
610
+ */
556
611
  async function finalizeFeishuMessageProcessing(params) {
557
- const { messageId, namespace = "global", log, claimHeld = false } = params;
558
- const normalizedMessageId = normalizeMessageId(messageId);
559
- if (!normalizedMessageId) return false;
560
- if (!claimHeld && !tryBeginFeishuMessageProcessing(normalizedMessageId, namespace)) return false;
561
- if (!await tryRecordMessagePersistent(normalizedMessageId, namespace, log)) {
562
- releaseFeishuMessageProcessing(normalizedMessageId, namespace);
563
- return false;
564
- }
565
- return true;
612
+ const key = dedupeKey(params.messageId);
613
+ if (!key) return false;
614
+ const options = dedupeOptions(params.namespace, params.log);
615
+ if (!params.claimHeld && (await feishuDedupeState.guard.claim(key, options)).kind !== "claimed") return false;
616
+ return await feishuDedupeState.guard.commit(key, options);
566
617
  }
618
+ /** Records a handled message so restart/replay cannot dispatch it again; false when already recorded. */
567
619
  async function recordProcessedFeishuMessage(messageId, namespace = "global", log) {
568
- const normalizedMessageId = normalizeMessageId(messageId);
569
- if (!normalizedMessageId) return false;
570
- return await tryRecordMessagePersistent(normalizedMessageId, namespace, log);
620
+ const key = dedupeKey(messageId);
621
+ if (!key) return false;
622
+ return await feishuDedupeState.guard.commit(key, dedupeOptions(namespace, log));
571
623
  }
624
+ /** Forgets a recorded message so a retryable synthetic event can be handled on redelivery. */
572
625
  async function forgetProcessedFeishuMessage(messageId, namespace = "global", log) {
573
- const normalizedNamespace = normalizeNamespace(namespace);
574
- const normalizedMessageId = normalizeMessageId(messageId);
575
- if (!normalizedMessageId) return false;
576
- memory.delete(memoryKey(normalizedNamespace, normalizedMessageId));
577
- const key = dedupeStoreKey(normalizedNamespace, normalizedMessageId);
578
- try {
579
- return openDedupStore(normalizedNamespace).delete(key);
580
- } catch (error) {
581
- log?.(`feishu-dedup: persistent delete failed: ${String(error)}`);
582
- return false;
583
- }
626
+ const key = dedupeKey(messageId);
627
+ if (!key) return false;
628
+ return await feishuDedupeState.guard.forget(key, dedupeOptions(namespace, log));
584
629
  }
630
+ /** Checks recency without claiming or recording. */
585
631
  async function hasProcessedFeishuMessage(messageId, namespace = "global", log) {
586
- const normalizedMessageId = normalizeMessageId(messageId);
587
- if (!normalizedMessageId) return false;
588
- return hasRecordedMessagePersistent(normalizedMessageId, namespace, log);
589
- }
590
- async function tryRecordMessagePersistent(messageId, namespace = "global", log) {
591
- const normalizedNamespace = normalizeNamespace(namespace);
592
- const normalizedMessageId = normalizeMessageId(messageId);
593
- if (!normalizedMessageId) return true;
594
- const now = Date.now();
595
- if (hasMemory(normalizedNamespace, normalizedMessageId, now)) return false;
596
- const key = dedupeStoreKey(normalizedNamespace, normalizedMessageId);
597
- try {
598
- const store = openDedupStore(normalizedNamespace);
599
- const existingSeenAt = store.lookup(key)?.seenAt;
600
- if (isRecent(existingSeenAt, now)) {
601
- remember(normalizedNamespace, normalizedMessageId, existingSeenAt);
602
- return false;
603
- }
604
- if (!store.registerIfAbsent(key, {
605
- namespace: normalizedNamespace,
606
- messageId: normalizedMessageId,
607
- seenAt: now
608
- }, { ttlMs: DEDUP_TTL_MS })) {
609
- const currentSeenAt = store.lookup(key)?.seenAt;
610
- if (isRecent(currentSeenAt, now)) {
611
- remember(normalizedNamespace, normalizedMessageId, currentSeenAt);
612
- return false;
613
- }
614
- store.register(key, {
615
- namespace: normalizedNamespace,
616
- messageId: normalizedMessageId,
617
- seenAt: now
618
- }, { ttlMs: DEDUP_TTL_MS });
619
- }
620
- remember(normalizedNamespace, normalizedMessageId, now);
621
- return true;
622
- } catch (error) {
623
- log?.(`feishu-dedup: persistent state error, falling back to memory: ${String(error)}`);
624
- remember(normalizedNamespace, normalizedMessageId, now);
625
- return true;
626
- }
627
- }
628
- async function hasRecordedMessagePersistent(messageId, namespace = "global", log) {
629
- const normalizedNamespace = normalizeNamespace(namespace);
630
- const normalizedMessageId = normalizeMessageId(messageId);
631
- if (!normalizedMessageId) return false;
632
- const now = Date.now();
633
- if (hasMemory(normalizedNamespace, normalizedMessageId, now)) return true;
634
- try {
635
- const existingSeenAt = openDedupStore(normalizedNamespace).lookup(dedupeStoreKey(normalizedNamespace, normalizedMessageId))?.seenAt;
636
- if (!isRecent(existingSeenAt, now)) return false;
637
- remember(normalizedNamespace, normalizedMessageId, existingSeenAt);
638
- return true;
639
- } catch (error) {
640
- log?.(`feishu-dedup: persistent peek failed: ${String(error)}`);
641
- return hasMemory(normalizedNamespace, normalizedMessageId, now);
642
- }
632
+ const key = dedupeKey(messageId);
633
+ if (!key) return false;
634
+ return await feishuDedupeState.guard.hasRecent(key, dedupeOptions(namespace, log));
643
635
  }
636
+ /** Loads recent persisted entries into memory at account start; returns the loaded count. */
644
637
  async function warmupDedupFromPluginState(namespace, log) {
645
- const normalizedNamespace = normalizeNamespace(namespace);
646
- try {
647
- let loaded = 0;
648
- const now = Date.now();
649
- for (const entry of openDedupStore(normalizedNamespace).entries()) {
650
- if (entry.value.namespace !== normalizedNamespace || !isRecent(entry.value.seenAt, now)) continue;
651
- remember(normalizedNamespace, entry.value.messageId, entry.value.seenAt);
652
- loaded++;
653
- }
654
- return loaded;
655
- } catch (error) {
656
- log?.(`feishu-dedup: warmup persistent state error: ${String(error)}`);
657
- return 0;
658
- }
638
+ return await feishuDedupeState.guard.warmup(namespace, (error) => log?.(`feishu-dedup: warmup persistent state error: ${String(error)}`));
659
639
  }
660
640
  //#endregion
661
641
  //#region extensions/feishu/src/dedupe-key.ts
@@ -902,6 +882,16 @@ function resolveFeishuReasoningPreviewEnabled(params) {
902
882
  return configDefault === "stream";
903
883
  }
904
884
  //#endregion
885
+ //#region extensions/feishu/src/reply-dispatcher-state.ts
886
+ const streamingStartBackoffUntilByAccount = /* @__PURE__ */ new Map();
887
+ //#endregion
888
+ //#region extensions/feishu/src/streaming-card-send-mode.ts
889
+ function resolveStreamingCardSendMode(options) {
890
+ if (options?.replyToMessageId) return "reply";
891
+ if (options?.rootId) return "root_create";
892
+ return "create";
893
+ }
894
+ //#endregion
905
895
  //#region extensions/feishu/src/streaming-card.ts
906
896
  const STREAMING_UPDATE_THROTTLE_MS = 160;
907
897
  const STREAMING_SIGNIFICANT_DELTA_CHARS = 18;
@@ -926,6 +916,11 @@ function resolveAllowedHostnames(domain) {
926
916
  }
927
917
  return ["open.feishu.cn"];
928
918
  }
919
+ async function assertSuccessfulCardKitResponse(response, auditContext, action) {
920
+ if (!response.ok) throw new Error(`${action} failed with HTTP ${response.status}`);
921
+ const data = await readFeishuJsonResponse(response, auditContext);
922
+ if (data.code !== 0) throw new Error(`${action} failed: ${data.msg ?? "unknown error"} (code=${String(data.code)})`);
923
+ }
929
924
  async function getToken(creds, deps) {
930
925
  const key = `${creds.domain ?? "feishu"}|${creds.appId}`;
931
926
  const cached = tokenCache.get(key);
@@ -993,11 +988,6 @@ function mergeStreamingText(previousText, nextText) {
993
988
  for (let overlap = maxOverlap; overlap > 0; overlap -= 1) if (previous.slice(-overlap) === next.slice(0, overlap)) return `${previous}${next.slice(overlap)}`;
994
989
  return `${previous}${next}`;
995
990
  }
996
- function resolveStreamingCardSendMode(options) {
997
- if (options?.replyToMessageId) return "reply";
998
- if (options?.rootId) return "root_create";
999
- return "create";
1000
- }
1001
991
  /** Streaming card session manager */
1002
992
  var FeishuStreamingSession = class {
1003
993
  constructor(client, creds, log, deps) {
@@ -1152,10 +1142,10 @@ var FeishuStreamingSession = class {
1152
1142
  auditContext: "feishu.streaming-card.update",
1153
1143
  timeoutMs: this.creds.httpTimeoutMs ?? 3e4
1154
1144
  });
1155
- await release();
1156
- if (!response.ok) {
1157
- onError?.(/* @__PURE__ */ new Error(`Update card content failed with HTTP ${response.status}`));
1158
- return false;
1145
+ try {
1146
+ await assertSuccessfulCardKitResponse(response, "feishu.streaming-card.update", "Update card content");
1147
+ } finally {
1148
+ await release();
1159
1149
  }
1160
1150
  return true;
1161
1151
  } catch (error) {
@@ -1196,10 +1186,10 @@ var FeishuStreamingSession = class {
1196
1186
  auditContext: "feishu.streaming-card.replace",
1197
1187
  timeoutMs: this.creds.httpTimeoutMs ?? 3e4
1198
1188
  });
1199
- await release();
1200
- if (!response.ok) {
1201
- onError?.(/* @__PURE__ */ new Error(`Replace card content failed with HTTP ${response.status}`));
1202
- return false;
1189
+ try {
1190
+ await assertSuccessfulCardKitResponse(response, "feishu.streaming-card.replace", "Replace card content");
1191
+ } finally {
1192
+ await release();
1203
1193
  }
1204
1194
  return true;
1205
1195
  } catch (error) {
@@ -1218,35 +1208,35 @@ var FeishuStreamingSession = class {
1218
1208
  const delayMs = Math.max(0, this.updateThrottleMs - (Date.now() - this.lastUpdateTime));
1219
1209
  this.flushTimer = setTimeout(() => {
1220
1210
  this.flushTimer = null;
1221
- const pending = this.pendingText;
1222
- if (!pending || this.closed) return;
1223
- this.update(pending).catch((error) => this.log?.(`Scheduled flush update failed: ${String(error)}`));
1211
+ if (!this.pendingText || this.closed) return;
1212
+ this.lastUpdateTime = Date.now();
1213
+ this.flushPendingUpdate().catch((error) => this.log?.(`Scheduled flush update failed: ${String(error)}`));
1224
1214
  }, delayMs);
1225
1215
  }
1216
+ async flushPendingUpdate() {
1217
+ this.queue = this.queue.then(async () => {
1218
+ if (!this.state || this.closed) return;
1219
+ const nextText = this.pendingText;
1220
+ if (!nextText) return;
1221
+ this.pendingText = null;
1222
+ if (nextText === this.state.sentText) return;
1223
+ if (await this.updateCardContent(nextText, (e) => this.log?.(`Update failed: ${String(e)}`)) && this.state) this.state.sentText = nextText;
1224
+ });
1225
+ await this.queue;
1226
+ }
1226
1227
  async update(text) {
1227
- if (!this.state || this.closed) return;
1228
- const mergedInput = mergeStreamingText(this.pendingText ?? this.state.currentText, text);
1229
- if (!mergedInput || mergedInput === this.state.currentText) return;
1230
- this.pendingText = mergedInput;
1228
+ if (!this.state || this.closed || !text) return;
1229
+ this.state.currentText = text;
1230
+ this.pendingText = text;
1231
1231
  this.clearFlushTimer();
1232
- const shouldForceUpdate = shouldPushStreamingUpdate(this.state.currentText, mergedInput);
1232
+ const shouldForceUpdate = shouldPushStreamingUpdate(this.state.sentText, text);
1233
1233
  const now = Date.now();
1234
1234
  if (!shouldForceUpdate && now - this.lastUpdateTime < this.updateThrottleMs) {
1235
1235
  this.schedulePendingFlush();
1236
1236
  return;
1237
1237
  }
1238
1238
  this.lastUpdateTime = now;
1239
- this.queue = this.queue.then(async () => {
1240
- if (!this.state || this.closed) return;
1241
- const nextText = this.pendingText ?? mergedInput;
1242
- const mergedText = mergeStreamingText(this.state.currentText, nextText);
1243
- if (!mergedText || mergedText === this.state.currentText) return;
1244
- if (mergedText === this.state.sentText) return;
1245
- this.pendingText = null;
1246
- this.state.currentText = mergedText;
1247
- if (await this.updateCardContent(mergedText, (e) => this.log?.(`Update failed: ${String(e)}`)) && this.state) this.state.sentText = mergedText;
1248
- });
1249
- await this.queue;
1239
+ await this.flushPendingUpdate();
1250
1240
  }
1251
1241
  async updateNoteContent(note) {
1252
1242
  if (!this.state || !this.state.hasNote) return;
@@ -1275,8 +1265,12 @@ var FeishuStreamingSession = class {
1275
1265
  policy: { allowedHostnames: resolveAllowedHostnames(this.creds.domain) },
1276
1266
  auditContext: "feishu.streaming-card.note-update",
1277
1267
  timeoutMs: this.creds.httpTimeoutMs ?? 3e4
1278
- }).then(async ({ release }) => {
1279
- await release();
1268
+ }).then(async ({ response, release }) => {
1269
+ try {
1270
+ await assertSuccessfulCardKitResponse(response, "feishu.streaming-card.note-update", "Update card note");
1271
+ } finally {
1272
+ await release();
1273
+ }
1280
1274
  }).catch((e) => this.log?.(`Note update failed: ${String(e)}`));
1281
1275
  }
1282
1276
  async close(finalText, options) {
@@ -1284,8 +1278,7 @@ var FeishuStreamingSession = class {
1284
1278
  this.closed = true;
1285
1279
  this.clearFlushTimer();
1286
1280
  await this.queue;
1287
- const pendingMerged = mergeStreamingText(this.state.currentText, this.pendingText ?? void 0);
1288
- const text = finalText ?? pendingMerged;
1281
+ const text = finalText ?? this.pendingText ?? this.state.currentText;
1289
1282
  const apiBase = resolveApiBase(this.creds.domain);
1290
1283
  let visibleContentSent = Boolean(this.state.sentText.trim());
1291
1284
  if ((text || finalText !== void 0) && text !== this.state.sentText) {
@@ -1297,6 +1290,7 @@ var FeishuStreamingSession = class {
1297
1290
  }
1298
1291
  }
1299
1292
  if (options?.note) await this.updateNoteContent(options.note);
1293
+ const acceptedText = this.state.sentText;
1300
1294
  this.state.sequence += 1;
1301
1295
  await fetchWithSsrFGuard({
1302
1296
  url: `${apiBase}/cardkit/v1/cards/${this.state.cardId}/settings`,
@@ -1313,7 +1307,7 @@ var FeishuStreamingSession = class {
1313
1307
  body: JSON.stringify({
1314
1308
  settings: JSON.stringify({ config: {
1315
1309
  streaming_mode: false,
1316
- summary: { content: truncateSummary(text) }
1310
+ summary: { content: truncateSummary(acceptedText) }
1317
1311
  } }),
1318
1312
  sequence: this.state.sequence,
1319
1313
  uuid: `c_${this.state.cardId}_${this.state.sequence}`
@@ -1324,8 +1318,12 @@ var FeishuStreamingSession = class {
1324
1318
  policy: { allowedHostnames: resolveAllowedHostnames(this.creds.domain) },
1325
1319
  auditContext: "feishu.streaming-card.close",
1326
1320
  timeoutMs: this.creds.httpTimeoutMs ?? 3e4
1327
- }).then(async ({ release }) => {
1328
- await release();
1321
+ }).then(async ({ response, release }) => {
1322
+ try {
1323
+ await assertSuccessfulCardKitResponse(response, "feishu.streaming-card.close", "Close streaming card");
1324
+ } finally {
1325
+ await release();
1326
+ }
1329
1327
  }).catch((e) => this.log?.(`Close failed: ${String(e)}`));
1330
1328
  const finalState = this.state;
1331
1329
  this.state = null;
@@ -1356,29 +1354,13 @@ var FeishuStreamingSession = class {
1356
1354
  }
1357
1355
  };
1358
1356
  //#endregion
1359
- //#region extensions/feishu/src/typing.ts
1360
- const TYPING_EMOJI = "Typing";
1361
- /**
1362
- * Feishu API error codes that indicate the caller should back off.
1363
- * These must propagate to the typing circuit breaker so the keepalive loop
1364
- * can trip and stop retrying.
1365
- *
1366
- * - 99991400: Rate limit (too many requests per second)
1367
- * - 99991403: Monthly API call quota exceeded
1368
- * - 429: Standard HTTP 429 returned as a Feishu SDK error code
1369
- *
1370
- * @see https://open.feishu.cn/document/server-docs/api-call-guide/generic-error-code
1371
- */
1357
+ //#region extensions/feishu/src/typing-backoff.ts
1358
+ /** Feishu API codes that should trip the typing circuit breaker. */
1372
1359
  const FEISHU_BACKOFF_CODES = /* @__PURE__ */ new Set([
1373
1360
  99991400,
1374
1361
  99991403,
1375
1362
  429
1376
1363
  ]);
1377
- /**
1378
- * Custom error class for Feishu backoff conditions detected from non-throwing
1379
- * SDK responses. Carries a numeric `.code` so that `isFeishuBackoffError()`
1380
- * recognises it when the error is caught downstream.
1381
- */
1382
1364
  var FeishuBackoffError = class extends Error {
1383
1365
  constructor(code) {
1384
1366
  super(`Feishu API backoff: code ${code}`);
@@ -1386,14 +1368,6 @@ var FeishuBackoffError = class extends Error {
1386
1368
  this.code = code;
1387
1369
  }
1388
1370
  };
1389
- /**
1390
- * Check whether an error represents a rate-limit or quota-exceeded condition
1391
- * from the Feishu API that should stop the typing keepalive loop.
1392
- *
1393
- * Handles two shapes:
1394
- * 1. AxiosError with `response.status` and `response.data.code`
1395
- * 2. Feishu SDK error with a top-level `code` property
1396
- */
1397
1371
  function isFeishuBackoffError(err) {
1398
1372
  if (typeof err !== "object" || err === null) return false;
1399
1373
  const response = err.response;
@@ -1402,21 +1376,16 @@ function isFeishuBackoffError(err) {
1402
1376
  if (typeof response.data?.code === "number" && FEISHU_BACKOFF_CODES.has(response.data.code)) return true;
1403
1377
  }
1404
1378
  const code = err.code;
1405
- if (typeof code === "number" && FEISHU_BACKOFF_CODES.has(code)) return true;
1406
- return false;
1379
+ return typeof code === "number" && FEISHU_BACKOFF_CODES.has(code);
1407
1380
  }
1408
- /**
1409
- * Check whether a Feishu SDK response object contains a backoff error code.
1410
- *
1411
- * The Feishu SDK sometimes returns a normal response (no throw) with an
1412
- * API-level error code in the response body. This must be detected so the
1413
- * circuit breaker can trip. See codex review on #28157.
1414
- */
1415
1381
  function getBackoffCodeFromResponse(response) {
1416
1382
  if (typeof response !== "object" || response === null) return;
1417
1383
  const code = response.code;
1418
- if (typeof code === "number" && FEISHU_BACKOFF_CODES.has(code)) return code;
1384
+ return typeof code === "number" && FEISHU_BACKOFF_CODES.has(code) ? code : void 0;
1419
1385
  }
1386
+ //#endregion
1387
+ //#region extensions/feishu/src/typing.ts
1388
+ const TYPING_EMOJI = "Typing";
1420
1389
  /**
1421
1390
  * Add a typing indicator (reaction) to a message.
1422
1391
  *
@@ -1512,7 +1481,6 @@ const TYPING_INDICATOR_MAX_AGE_MS = 2 * 6e4;
1512
1481
  const MS_EPOCH_MIN = 0xe8d4a51000;
1513
1482
  const STREAMING_START_FAILURE_BACKOFF_MS = 6e4;
1514
1483
  const NO_VISIBLE_REPLY_FALLBACK_TEXT = "⚠️ This reply completed without visible content. The turn may have been interrupted; please retry or ask me to recover from recent context.";
1515
- const streamingStartBackoffUntilByAccount = /* @__PURE__ */ new Map();
1516
1484
  function isStreamingStartBackedOff(accountId, now = Date.now()) {
1517
1485
  const backoffUntil = streamingStartBackoffUntilByAccount.get(accountId);
1518
1486
  if (backoffUntil === void 0) return false;
@@ -1615,14 +1583,15 @@ function createFeishuReplyDispatcher(params) {
1615
1583
  }
1616
1584
  });
1617
1585
  const textChunkLimit = core.channel.text.resolveTextChunkLimit(cfg, "feishu", accountId, { fallbackLimit: 4e3 });
1618
- const chunkMode = core.channel.text.resolveChunkMode(cfg, "feishu");
1586
+ const chunkMode = core.channel.text.resolveChunkMode(cfg, "feishu", accountId);
1619
1587
  const tableMode = core.channel.text.resolveMarkdownTableMode({
1620
1588
  cfg,
1621
1589
  channel: "feishu"
1622
1590
  });
1623
1591
  const renderMode = account.config?.renderMode ?? "auto";
1624
- const streamingEnabled = account.config?.streaming !== false && renderMode !== "raw";
1625
- const coreBlockStreamingEnabled = account.config?.blockStreaming === true;
1592
+ const streamingEnabled = resolveChannelPreviewStreamMode(account.config, "partial") !== "off" && renderMode !== "raw";
1593
+ const blockStreamingEnabled = resolveChannelStreamingBlockEnabled(account.config);
1594
+ const coreBlockStreamingEnabled = blockStreamingEnabled === true;
1626
1595
  const reasoningPreviewEnabled = streamingEnabled && params.allowReasoningPreview === true;
1627
1596
  let streaming = null;
1628
1597
  let streamText = "";
@@ -1761,8 +1730,15 @@ function createFeishuReplyDispatcher(params) {
1761
1730
  flushStreamingCardUpdate(buildCombinedStreamText(reasoningText, streamText));
1762
1731
  };
1763
1732
  const sendChunkedTextReply = async (paramsLocal) => {
1764
- const chunkSource = paramsLocal.useCard ? paramsLocal.text : core.channel.text.convertMarkdownTables(paramsLocal.text, tableMode);
1765
- const chunks = resolveTextChunksWithFallback(chunkSource, (paramsLocal.useCard ? core.channel.text.chunkMarkdownTextWithMode : core.channel.text.chunkTextWithMode)(chunkSource, textChunkLimit, chunkMode));
1733
+ const chunkSource = paramsLocal.useCard ? paramsLocal.text : materializeFeishuPostMarkdownSoftBreaks(core.channel.text.convertMarkdownTables(paramsLocal.text, tableMode));
1734
+ const initialChunks = core.channel.text.chunkMarkdownTextWithMode(chunkSource, textChunkLimit, chunkMode);
1735
+ const chunks = resolveTextChunksWithFallback(chunkSource, paramsLocal.useCard ? initialChunks : chunkFeishuPostMarkdown({
1736
+ text: chunkSource,
1737
+ limit: textChunkLimit,
1738
+ mode: chunkMode,
1739
+ firstChunkMentions: paramsLocal.firstChunkMentions,
1740
+ initialChunks
1741
+ }));
1766
1742
  for (const [index, chunk] of chunks.entries()) {
1767
1743
  await paramsLocal.sendChunk({
1768
1744
  chunk,
@@ -1914,11 +1890,12 @@ function createFeishuReplyDispatcher(params) {
1914
1890
  if (info?.kind === "block") {
1915
1891
  if (!useStreamingCard) {
1916
1892
  if (coreBlockStreamingEnabled) {
1917
- const isFirstBlock = !sentIndependentBlockText;
1893
+ const firstChunkMentions = !sentIndependentBlockText && mentionTargets?.length ? mentionTargets : void 0;
1918
1894
  await sendChunkedTextReply({
1919
1895
  text,
1920
1896
  useCard: false,
1921
1897
  infoKind: "block",
1898
+ firstChunkMentions,
1922
1899
  sendChunk: async ({ chunk, isFirst }) => {
1923
1900
  await sendMessageFeishu({
1924
1901
  cfg,
@@ -1928,7 +1905,7 @@ function createFeishuReplyDispatcher(params) {
1928
1905
  replyInThread: effectiveReplyInThread,
1929
1906
  allowTopLevelReplyFallback,
1930
1907
  accountId,
1931
- ...isFirstBlock && isFirst && mentionTargets?.length ? { mentions: mentionTargets } : {}
1908
+ ...isFirst && firstChunkMentions ? { mentions: firstChunkMentions } : {}
1932
1909
  });
1933
1910
  }
1934
1911
  });
@@ -1981,23 +1958,27 @@ function createFeishuReplyDispatcher(params) {
1981
1958
  });
1982
1959
  }
1983
1960
  });
1984
- } else await sendChunkedTextReply({
1985
- text,
1986
- useCard: false,
1987
- infoKind: info?.kind,
1988
- sendChunk: async ({ chunk, isFirst }) => {
1989
- await sendMessageFeishu({
1990
- cfg,
1991
- to: sendTarget,
1992
- text: chunk,
1993
- replyToMessageId: sendReplyToMessageId,
1994
- replyInThread: effectiveReplyInThread,
1995
- allowTopLevelReplyFallback,
1996
- accountId,
1997
- ...info?.kind === "final" && isFirst && mentionTargets?.length ? { mentions: mentionTargets } : {}
1998
- });
1999
- }
2000
- });
1961
+ } else {
1962
+ const firstChunkMentions = info?.kind === "final" && mentionTargets?.length ? mentionTargets : void 0;
1963
+ await sendChunkedTextReply({
1964
+ text,
1965
+ useCard: false,
1966
+ infoKind: info?.kind,
1967
+ firstChunkMentions,
1968
+ sendChunk: async ({ chunk, isFirst }) => {
1969
+ await sendMessageFeishu({
1970
+ cfg,
1971
+ to: sendTarget,
1972
+ text: chunk,
1973
+ replyToMessageId: sendReplyToMessageId,
1974
+ replyInThread: effectiveReplyInThread,
1975
+ allowTopLevelReplyFallback,
1976
+ accountId,
1977
+ ...isFirst && firstChunkMentions ? { mentions: firstChunkMentions } : {}
1978
+ });
1979
+ }
1980
+ });
1981
+ }
2001
1982
  }
2002
1983
  if (hasMedia) await sendMediaReplies(payload, hasVoiceMedia && hasText ? { fallbackText: text } : void 0);
2003
1984
  },
@@ -2017,7 +1998,7 @@ function createFeishuReplyDispatcher(params) {
2017
1998
  replyOptions: {
2018
1999
  ...replyOptions,
2019
2000
  onModelSelected: prefixContext.onModelSelected,
2020
- disableBlockStreaming: typeof account.config?.blockStreaming === "boolean" ? !account.config.blockStreaming : true,
2001
+ disableBlockStreaming: typeof blockStreamingEnabled === "boolean" ? !blockStreamingEnabled : true,
2021
2002
  onPartialReply: streamingEnabled ? (payload) => {
2022
2003
  if (!payload.text) return;
2023
2004
  const cleaned = stripReasoningTagsFromText(payload.text, {
@@ -2069,9 +2050,6 @@ function createFeishuReplyDispatcher(params) {
2069
2050
  //#region extensions/feishu/src/bot.ts
2070
2051
  const permissionErrorNotifiedAt = /* @__PURE__ */ new Map();
2071
2052
  const PERMISSION_ERROR_COOLDOWN_MS = 300 * 1e3;
2072
- const groupNameCache = /* @__PURE__ */ new Map();
2073
- const GROUP_NAME_CACHE_TTL_MS = 1800 * 1e3;
2074
- const GROUP_NAME_CACHE_MAX_SIZE = 500;
2075
2053
  function shouldSendNoVisibleReplyFallback(dispatchResult) {
2076
2054
  const finalCount = dispatchResult.counts.final ?? 0;
2077
2055
  const failedFinalCount = dispatchResult.failedCounts?.final ?? 0;
@@ -2082,59 +2060,6 @@ function shouldSendNoVisibleReplyFallback(dispatchResult) {
2082
2060
  function isFeishuTopicSessionScope(scope) {
2083
2061
  return scope === "group_topic" || scope === "group_topic_sender";
2084
2062
  }
2085
- function evictGroupNameCache() {
2086
- const now = asDateTimestampMs(Date.now());
2087
- if (now === void 0) {
2088
- groupNameCache.clear();
2089
- return;
2090
- }
2091
- for (const [key, val] of groupNameCache) {
2092
- const expiresAt = asDateTimestampMs(val.expiresAt);
2093
- if (expiresAt === void 0 || expiresAt <= now) groupNameCache.delete(key);
2094
- }
2095
- if (groupNameCache.size > GROUP_NAME_CACHE_MAX_SIZE) {
2096
- const excess = groupNameCache.size - GROUP_NAME_CACHE_MAX_SIZE;
2097
- let removed = 0;
2098
- for (const key of groupNameCache.keys()) {
2099
- if (removed >= excess) break;
2100
- groupNameCache.delete(key);
2101
- removed++;
2102
- }
2103
- }
2104
- }
2105
- function setCacheEntry(key, name) {
2106
- const expiresAt = resolveExpiresAtMsFromDurationMs(GROUP_NAME_CACHE_TTL_MS);
2107
- groupNameCache.delete(key);
2108
- if (expiresAt !== void 0) groupNameCache.set(key, {
2109
- name,
2110
- expiresAt
2111
- });
2112
- }
2113
- async function resolveGroupName(params) {
2114
- const { account, chatId, log } = params;
2115
- if (!account.configured) return;
2116
- const cacheKey = `${account.accountId}:${chatId}`;
2117
- const cached = groupNameCache.get(cacheKey);
2118
- if (cached) {
2119
- const now = asDateTimestampMs(Date.now());
2120
- const expiresAt = asDateTimestampMs(cached.expiresAt);
2121
- if (now !== void 0 && expiresAt !== void 0 && expiresAt > now) return cached.name || void 0;
2122
- groupNameCache.delete(cacheKey);
2123
- }
2124
- let resolvedName;
2125
- try {
2126
- const name = (await getChatInfo(createFeishuClient(account), chatId))?.name?.trim();
2127
- if (name) {
2128
- setCacheEntry(cacheKey, name);
2129
- resolvedName = name;
2130
- } else setCacheEntry(cacheKey, "");
2131
- } catch (err) {
2132
- log(`feishu[${account.accountId}]: getChatInfo failed for ${chatId}: ${String(err)}`);
2133
- setCacheEntry(cacheKey, "");
2134
- }
2135
- evictGroupNameCache();
2136
- return resolvedName;
2137
- }
2138
2063
  async function resolveFeishuAudioPreflightTranscript(params) {
2139
2064
  if (params.content.trim() !== "<media:audio>") return;
2140
2065
  const audioMedia = params.mediaList.filter((media) => media.contentType?.startsWith("audio/"));
@@ -2154,18 +2079,6 @@ async function resolveFeishuAudioPreflightTranscript(params) {
2154
2079
  return;
2155
2080
  }
2156
2081
  }
2157
- function resolveBroadcastAgents(cfg, peerId) {
2158
- const broadcast = cfg.broadcast;
2159
- if (!broadcast || typeof broadcast !== "object") return null;
2160
- const agents = broadcast[peerId];
2161
- if (!Array.isArray(agents) || agents.length === 0) return null;
2162
- return agents;
2163
- }
2164
- function buildBroadcastSessionKey(baseSessionKey, originalAgentId, targetAgentId) {
2165
- const prefix = `agent:${originalAgentId}:`;
2166
- if (baseSessionKey.startsWith(prefix)) return `agent:${targetAgentId}:${baseSessionKey.slice(prefix.length)}`;
2167
- return baseSessionKey;
2168
- }
2169
2082
  /**
2170
2083
  * Build media payload for inbound context.
2171
2084
  * Similar to Discord's buildDiscordMediaPayload().
@@ -2202,35 +2115,6 @@ function parseFeishuMessageEvent(event, botOpenId, _botName) {
2202
2115
  }
2203
2116
  return ctx;
2204
2117
  }
2205
- const MAX_MENTION_CONTEXT_NAME_LENGTH = 80;
2206
- function formatMentionNameForAgentContext(name) {
2207
- const normalized = Array.from(name, (char) => {
2208
- return char.charCodeAt(0) < 32 || char === "[" || char === "]" ? " " : char;
2209
- }).join("").replace(/\s+/g, " ").trim();
2210
- const bounded = normalized.length > MAX_MENTION_CONTEXT_NAME_LENGTH ? `${truncateUtf16Safe(normalized, MAX_MENTION_CONTEXT_NAME_LENGTH - 3)}...` : normalized;
2211
- return JSON.stringify(bounded || "unknown");
2212
- }
2213
- function buildFeishuAgentBody(params) {
2214
- const { ctx, quotedContent, permissionErrorForAgent, botOpenId } = params;
2215
- let messageBody = ctx.content;
2216
- if (quotedContent) messageBody = `[Replying to: "${quotedContent}"]\n\n${ctx.content}`;
2217
- messageBody = `${ctx.senderName ?? ctx.senderOpenId}: ${messageBody}`;
2218
- if (ctx.hasAnyMention) {
2219
- const botIdHint = botOpenId?.trim();
2220
- messageBody += "\n\n[System: The content may include mention tags in the form <at user_id=\"...\">name</at>. Treat these as real mentions of Feishu entities (users or bots).]";
2221
- if (botIdHint) messageBody += `\n[System: If user_id is "${botIdHint}", that mention refers to you.]`;
2222
- }
2223
- if (ctx.mentionTargets && ctx.mentionTargets.length > 0) {
2224
- const targetNames = ctx.mentionTargets.map((t) => formatMentionNameForAgentContext(t.name)).join(", ");
2225
- messageBody += `\n\n[System: Feishu users mentioned in the incoming message, for context only: ${targetNames}. Do not notify or mention these users solely because they are listed here.]`;
2226
- }
2227
- messageBody = `[message_id: ${ctx.messageId}]\n${messageBody}`;
2228
- if (permissionErrorForAgent) {
2229
- const grantUrl = permissionErrorForAgent.grantUrl ?? "";
2230
- messageBody += `\n\n[System: The bot encountered a Feishu API permission error. Please inform the user about this issue and provide the permission grant URL for the admin to authorize. Permission grant URL: ${grantUrl}]`;
2231
- }
2232
- return messageBody;
2233
- }
2234
2118
  async function shouldIncludeFetchedGroupContextMessage(params) {
2235
2119
  let senderAllowed = !params.isGroup || params.allowFrom.length === 0 || params.senderType === "app";
2236
2120
  const senderId = params.senderId?.trim();
@@ -2916,6 +2800,7 @@ async function handleFeishuMessage(params) {
2916
2800
  conversation: {
2917
2801
  kind: isGroup ? "group" : "direct",
2918
2802
  id: ctx.chatId,
2803
+ nativeChannelId: ctx.chatId,
2919
2804
  label: isGroup && groupName && !isTopicSessionForThread ? groupName : void 0,
2920
2805
  threadId: ctx.rootId && isTopicSessionForThread ? ctx.rootId : void 0
2921
2806
  },
@@ -2985,7 +2870,7 @@ async function handleFeishuMessage(params) {
2985
2870
  };
2986
2871
  };
2987
2872
  if (broadcastAgents) {
2988
- if (!await tryRecordMessagePersistent(messageDedupeKey ?? ctx.messageId, "broadcast", log)) {
2873
+ if (!await recordProcessedFeishuMessage(messageDedupeKey ?? ctx.messageId, "broadcast", log)) {
2989
2874
  log(`feishu[${account.accountId}]: broadcast already claimed by another account for message ${ctx.messageId}; skipping`);
2990
2875
  return;
2991
2876
  }
@@ -3146,7 +3031,11 @@ async function handleFeishuMessage(params) {
3146
3031
  }
3147
3032
  else {
3148
3033
  const results = await Promise.allSettled(broadcastAgents.map(dispatchForAgent));
3149
- for (let i = 0; i < results.length; i++) if (results[i].status === "rejected") log(`feishu[${account.accountId}]: broadcast dispatch failed for agent=${broadcastAgents[i]}: ${String(results[i].reason)}`);
3034
+ for (const [i, result] of results.entries()) if (result.status === "rejected") {
3035
+ const agentId = broadcastAgents.at(i);
3036
+ if (agentId === void 0) continue;
3037
+ log(`feishu[${account.accountId}]: broadcast dispatch failed for agent=${agentId}: ${String(result.reason)}`);
3038
+ }
3150
3039
  }
3151
3040
  if (isGroup && historyKey && chatHistories) createChannelHistoryWindow({ historyMap: chatHistories }).clear({
3152
3041
  historyKey,
@@ -3255,6 +3144,10 @@ async function handleFeishuMessage(params) {
3255
3144
  }
3256
3145
  }
3257
3146
  //#endregion
3147
+ //#region extensions/feishu/src/card-action-state.ts
3148
+ const processedCardActions = /* @__PURE__ */ new Map();
3149
+ const resolvedCardActionChatTypes = /* @__PURE__ */ new Map();
3150
+ //#endregion
3258
3151
  //#region extensions/feishu/src/card-ux-shared.ts
3259
3152
  function buildFeishuCardButton(params) {
3260
3153
  return {
@@ -3322,20 +3215,13 @@ function createApprovalCard(params) {
3322
3215
  //#region extensions/feishu/src/card-action.ts
3323
3216
  const FEISHU_APPROVAL_CARD_TTL_MS = 5 * 6e4;
3324
3217
  const FEISHU_CARD_ACTION_TOKEN_TTL_MS = 15 * 6e4;
3325
- const processedCardActionTokens = /* @__PURE__ */ new Map();
3326
- var FeishuRetryableCardActionError = class extends Error {
3327
- constructor(message, options) {
3328
- super(message, options);
3329
- this.name = "FeishuRetryableCardActionError";
3330
- }
3331
- };
3332
3218
  function pruneProcessedCardActionTokens(now) {
3333
3219
  const validNow = asDateTimestampMs(now);
3334
3220
  if (validNow === void 0) {
3335
- processedCardActionTokens.clear();
3221
+ processedCardActions.clear();
3336
3222
  return;
3337
3223
  }
3338
- for (const [key, entry] of processedCardActionTokens.entries()) if (!isFutureDateTimestampMs(entry.expiresAt, { nowMs: validNow })) processedCardActionTokens.delete(key);
3224
+ for (const [key, entry] of processedCardActions.entries()) if (!isFutureDateTimestampMs(entry.expiresAt, { nowMs: validNow })) processedCardActions.delete(key);
3339
3225
  }
3340
3226
  function resolveProcessedCardActionTokenExpiresAt(now) {
3341
3227
  return resolveExpiresAtMsFromDurationMs(FEISHU_CARD_ACTION_TOKEN_TTL_MS, { nowMs: now });
@@ -3346,36 +3232,30 @@ function beginFeishuCardActionToken(params) {
3346
3232
  const normalizedToken = params.token.trim();
3347
3233
  if (!normalizedToken) return false;
3348
3234
  const key = `${params.accountId}:${normalizedToken}`;
3349
- const existing = processedCardActionTokens.get(key);
3235
+ const existing = processedCardActions.get(key);
3350
3236
  if (existing && isFutureDateTimestampMs(existing.expiresAt, { nowMs: now })) return false;
3351
- processedCardActionTokens.delete(key);
3237
+ processedCardActions.delete(key);
3352
3238
  const expiresAt = resolveProcessedCardActionTokenExpiresAt(now);
3353
- if (expiresAt !== void 0) processedCardActionTokens.set(key, {
3239
+ if (expiresAt !== void 0) processedCardActions.set(key, {
3354
3240
  status: "inflight",
3355
3241
  expiresAt
3356
3242
  });
3357
3243
  return true;
3358
3244
  }
3359
- function completeFeishuCardActionToken(params) {
3360
- const now = params.now ?? Date.now();
3361
- const normalizedToken = params.token.trim();
3362
- if (!normalizedToken) return;
3363
- const key = `${params.accountId}:${normalizedToken}`;
3245
+ function completeFeishuCardAction(actionId, accountId, now = Date.now()) {
3246
+ const normalizedActionId = actionId.trim();
3247
+ if (!normalizedActionId) return;
3248
+ const key = `${accountId}:${normalizedActionId}`;
3364
3249
  const expiresAt = resolveProcessedCardActionTokenExpiresAt(now);
3365
3250
  if (expiresAt === void 0) {
3366
- processedCardActionTokens.delete(key);
3251
+ processedCardActions.delete(key);
3367
3252
  return;
3368
3253
  }
3369
- processedCardActionTokens.set(key, {
3254
+ processedCardActions.set(key, {
3370
3255
  status: "completed",
3371
3256
  expiresAt
3372
3257
  });
3373
3258
  }
3374
- function releaseFeishuCardActionToken(params) {
3375
- const normalizedToken = params.token.trim();
3376
- if (!normalizedToken) return;
3377
- processedCardActionTokens.delete(`${params.accountId}:${normalizedToken}`);
3378
- }
3379
3259
  function buildSyntheticMessageEvent(event, content, chatType) {
3380
3260
  const replyTargetMessageId = event.context.open_message_id ?? event.open_message_id;
3381
3261
  const isTemporaryCardActionId = replyTargetMessageId?.startsWith("card-action-c-");
@@ -3419,11 +3299,7 @@ async function dispatchSyntheticCommand(params) {
3419
3299
  accountId: params.accountId
3420
3300
  });
3421
3301
  }
3422
- function normalizeResolvedCardActionChatType(value) {
3423
- if (value === "group" || value === "topic" || value === "public") return "group";
3424
- if (value === "p2p" || value === "private") return "p2p";
3425
- }
3426
- const resolvedChatTypeCache = /* @__PURE__ */ new Map();
3302
+ const resolvedChatTypeCache = resolvedCardActionChatTypes;
3427
3303
  const CHAT_TYPE_CACHE_TTL_MS = 30 * 6e4;
3428
3304
  const CHAT_TYPE_CACHE_MAX_SIZE = 5e3;
3429
3305
  function pruneChatTypeCache(now) {
@@ -3461,7 +3337,7 @@ function cacheResolvedCardActionChatType(cacheKey, value, now) {
3461
3337
  });
3462
3338
  }
3463
3339
  async function resolveCardActionChatType(params) {
3464
- const explicitChatType = normalizeResolvedCardActionChatType(params.chatType);
3340
+ const explicitChatType = normalizeFeishuChatType$2(params.chatType);
3465
3341
  if (explicitChatType) return explicitChatType;
3466
3342
  const chatId = params.event.context.chat_id?.trim();
3467
3343
  if (!chatId) return "p2p";
@@ -3475,7 +3351,7 @@ async function resolveCardActionChatType(params) {
3475
3351
  try {
3476
3352
  const response = await createFeishuClient(params.account).im.chat.get({ path: { chat_id: chatId } });
3477
3353
  if (response.code === 0) {
3478
- const resolvedChatType = normalizeResolvedCardActionChatType(response.data?.chat_mode) ?? normalizeResolvedCardActionChatType(response.data?.chat_type);
3354
+ const resolvedChatType = resolveFeishuChatType(response.data ?? {});
3479
3355
  if (resolvedChatType) {
3480
3356
  cacheResolvedCardActionChatType(cacheKey, resolvedChatType, now);
3481
3357
  return resolvedChatType;
@@ -3513,7 +3389,7 @@ async function handleFeishuCardAction(params) {
3513
3389
  token: event.token,
3514
3390
  accountId: account.accountId
3515
3391
  })) {
3516
- log(`feishu[${account.accountId}]: skipping duplicate card action token ${event.token}`);
3392
+ log(`feishu[${account.accountId}]: skipping duplicate card action token`);
3517
3393
  return;
3518
3394
  }
3519
3395
  try {
@@ -3525,10 +3401,7 @@ async function handleFeishuCardAction(params) {
3525
3401
  reason: decoded.reason,
3526
3402
  accountId
3527
3403
  });
3528
- completeFeishuCardActionToken({
3529
- token: event.token,
3530
- accountId: account.accountId
3531
- });
3404
+ completeFeishuCardAction(event.token, account.accountId);
3532
3405
  return;
3533
3406
  }
3534
3407
  if (decoded.kind === "structured") {
@@ -3543,10 +3416,7 @@ async function handleFeishuCardAction(params) {
3543
3416
  reason: "malformed",
3544
3417
  accountId
3545
3418
  });
3546
- completeFeishuCardActionToken({
3547
- token: event.token,
3548
- accountId: account.accountId
3549
- });
3419
+ completeFeishuCardAction(event.token, account.accountId);
3550
3420
  return;
3551
3421
  }
3552
3422
  const prompt = typeof envelope.m?.prompt === "string" && envelope.m.prompt.trim() ? envelope.m.prompt : `Run \`${command}\` in this Feishu conversation?`;
@@ -3558,10 +3428,7 @@ async function handleFeishuCardAction(params) {
3558
3428
  reason: "malformed",
3559
3429
  accountId
3560
3430
  });
3561
- completeFeishuCardActionToken({
3562
- token: event.token,
3563
- accountId: account.accountId
3564
- });
3431
+ completeFeishuCardAction(event.token, account.accountId);
3565
3432
  return;
3566
3433
  }
3567
3434
  await sendCardFeishu({
@@ -3584,10 +3451,7 @@ async function handleFeishuCardAction(params) {
3584
3451
  }),
3585
3452
  accountId
3586
3453
  });
3587
- completeFeishuCardActionToken({
3588
- token: event.token,
3589
- accountId: account.accountId
3590
- });
3454
+ completeFeishuCardAction(event.token, account.accountId);
3591
3455
  return;
3592
3456
  }
3593
3457
  if (envelope.a === "feishu.approval.cancel") {
@@ -3597,10 +3461,7 @@ async function handleFeishuCardAction(params) {
3597
3461
  text: "Cancelled.",
3598
3462
  accountId
3599
3463
  });
3600
- completeFeishuCardActionToken({
3601
- token: event.token,
3602
- accountId: account.accountId
3603
- });
3464
+ completeFeishuCardAction(event.token, account.accountId);
3604
3465
  return;
3605
3466
  }
3606
3467
  if (envelope.a === "feishu.approval.confirm" || envelope.k === "quick") {
@@ -3612,10 +3473,7 @@ async function handleFeishuCardAction(params) {
3612
3473
  reason: "malformed",
3613
3474
  accountId
3614
3475
  });
3615
- completeFeishuCardActionToken({
3616
- token: event.token,
3617
- accountId: account.accountId
3618
- });
3476
+ completeFeishuCardAction(event.token, account.accountId);
3619
3477
  return;
3620
3478
  }
3621
3479
  await dispatchSyntheticCommand({
@@ -3629,10 +3487,7 @@ async function handleFeishuCardAction(params) {
3629
3487
  accountId,
3630
3488
  chatType: envelope.c?.t
3631
3489
  });
3632
- completeFeishuCardActionToken({
3633
- token: event.token,
3634
- accountId: account.accountId
3635
- });
3490
+ completeFeishuCardAction(event.token, account.accountId);
3636
3491
  return;
3637
3492
  }
3638
3493
  await sendInvalidInteractionNotice({
@@ -3641,10 +3496,7 @@ async function handleFeishuCardAction(params) {
3641
3496
  reason: "malformed",
3642
3497
  accountId
3643
3498
  });
3644
- completeFeishuCardActionToken({
3645
- token: event.token,
3646
- accountId: account.accountId
3647
- });
3499
+ completeFeishuCardAction(event.token, account.accountId);
3648
3500
  return;
3649
3501
  }
3650
3502
  const content = buildFeishuCardActionTextFallback(event);
@@ -3659,23 +3511,146 @@ async function handleFeishuCardAction(params) {
3659
3511
  channelRuntime: params.channelRuntime,
3660
3512
  accountId
3661
3513
  });
3662
- completeFeishuCardActionToken({
3663
- token: event.token,
3664
- accountId: account.accountId
3665
- });
3514
+ completeFeishuCardAction(event.token, account.accountId);
3666
3515
  } catch (err) {
3667
- if (err instanceof FeishuRetryableCardActionError) releaseFeishuCardActionToken({
3668
- token: event.token,
3669
- accountId: account.accountId
3670
- });
3671
- else completeFeishuCardActionToken({
3672
- token: event.token,
3673
- accountId: account.accountId
3674
- });
3516
+ completeFeishuCardAction(event.token, account.accountId);
3675
3517
  throw err;
3676
3518
  }
3677
3519
  }
3678
3520
  //#endregion
3521
+ //#region extensions/feishu/src/monitor-defaults.ts
3522
+ const FEISHU_WEBHOOK_RATE_LIMIT_FALLBACK_DEFAULTS = {
3523
+ windowMs: 6e4,
3524
+ maxRequests: 120,
3525
+ maxTrackedKeys: 4096
3526
+ };
3527
+ const FEISHU_WEBHOOK_ANOMALY_FALLBACK_DEFAULTS = {
3528
+ maxTrackedKeys: 4096,
3529
+ ttlMs: 360 * 6e4,
3530
+ logEvery: 25
3531
+ };
3532
+ function coercePositiveInt(value, fallback) {
3533
+ if (typeof value !== "number" || !Number.isFinite(value)) return fallback;
3534
+ const normalized = Math.floor(value);
3535
+ return normalized > 0 ? normalized : fallback;
3536
+ }
3537
+ function resolveFeishuWebhookRateLimitDefaults(defaults) {
3538
+ const resolved = defaults;
3539
+ return {
3540
+ windowMs: coercePositiveInt(resolved?.windowMs, FEISHU_WEBHOOK_RATE_LIMIT_FALLBACK_DEFAULTS.windowMs),
3541
+ maxRequests: coercePositiveInt(resolved?.maxRequests, FEISHU_WEBHOOK_RATE_LIMIT_FALLBACK_DEFAULTS.maxRequests),
3542
+ maxTrackedKeys: coercePositiveInt(resolved?.maxTrackedKeys, FEISHU_WEBHOOK_RATE_LIMIT_FALLBACK_DEFAULTS.maxTrackedKeys)
3543
+ };
3544
+ }
3545
+ function resolveFeishuWebhookAnomalyDefaults(defaults) {
3546
+ const resolved = defaults;
3547
+ return {
3548
+ maxTrackedKeys: coercePositiveInt(resolved?.maxTrackedKeys, FEISHU_WEBHOOK_ANOMALY_FALLBACK_DEFAULTS.maxTrackedKeys),
3549
+ ttlMs: coercePositiveInt(resolved?.ttlMs, FEISHU_WEBHOOK_ANOMALY_FALLBACK_DEFAULTS.ttlMs),
3550
+ logEvery: coercePositiveInt(resolved?.logEvery, FEISHU_WEBHOOK_ANOMALY_FALLBACK_DEFAULTS.logEvery)
3551
+ };
3552
+ }
3553
+ //#endregion
3554
+ //#region extensions/feishu/src/monitor.state.ts
3555
+ const wsClients = /* @__PURE__ */ new Map();
3556
+ const httpServers = /* @__PURE__ */ new Map();
3557
+ const botOpenIds = /* @__PURE__ */ new Map();
3558
+ const botNames = /* @__PURE__ */ new Map();
3559
+ const botIdentityRevisions = /* @__PURE__ */ new Map();
3560
+ const FEISHU_WEBHOOK_MAX_BODY_BYTES = 64 * 1024;
3561
+ const FEISHU_WEBHOOK_BODY_TIMEOUT_MS = 5e3;
3562
+ const FEISHU_HTTP_SERVER_CLOSE_TIMEOUT_MS = 5e3;
3563
+ const feishuWebhookRateLimitDefaults = resolveFeishuWebhookRateLimitDefaults(WEBHOOK_RATE_LIMIT_DEFAULTS);
3564
+ const feishuWebhookAnomalyDefaults = resolveFeishuWebhookAnomalyDefaults(WEBHOOK_ANOMALY_COUNTER_DEFAULTS);
3565
+ const feishuWebhookRateLimiter = createFixedWindowRateLimiter({
3566
+ windowMs: feishuWebhookRateLimitDefaults.windowMs,
3567
+ maxRequests: feishuWebhookRateLimitDefaults.maxRequests,
3568
+ maxTrackedKeys: feishuWebhookRateLimitDefaults.maxTrackedKeys
3569
+ });
3570
+ const feishuWebhookAnomalyTracker = createWebhookAnomalyTracker({
3571
+ maxTrackedKeys: feishuWebhookAnomalyDefaults.maxTrackedKeys,
3572
+ ttlMs: feishuWebhookAnomalyDefaults.ttlMs,
3573
+ logEvery: feishuWebhookAnomalyDefaults.logEvery
3574
+ });
3575
+ function readBotIdentityRevision(accountId) {
3576
+ return botIdentityRevisions.get(accountId) ?? 0;
3577
+ }
3578
+ function bumpBotIdentityRevision(accountId) {
3579
+ botIdentityRevisions.set(accountId, readBotIdentityRevision(accountId) + 1);
3580
+ }
3581
+ function captureBotIdentitySnapshot(accountId) {
3582
+ return { revision: readBotIdentityRevision(accountId) };
3583
+ }
3584
+ function clearFeishuBotIdentityStateIfUnchanged(accountId, snapshot) {
3585
+ if (readBotIdentityRevision(accountId) !== snapshot.revision) return;
3586
+ botOpenIds.delete(accountId);
3587
+ botNames.delete(accountId);
3588
+ bumpBotIdentityRevision(accountId);
3589
+ }
3590
+ function setFeishuBotIdentityState(accountId, identity) {
3591
+ botOpenIds.set(accountId, identity.botOpenId);
3592
+ if (identity.botName) botNames.set(accountId, identity.botName);
3593
+ else botNames.delete(accountId);
3594
+ bumpBotIdentityRevision(accountId);
3595
+ }
3596
+ function clearFeishuBotIdentityState(accountId) {
3597
+ botOpenIds.delete(accountId);
3598
+ botNames.delete(accountId);
3599
+ bumpBotIdentityRevision(accountId);
3600
+ }
3601
+ function isServerNotRunningError(error) {
3602
+ return error.code === "ERR_SERVER_NOT_RUNNING";
3603
+ }
3604
+ async function closeFeishuHttpServer(server) {
3605
+ await new Promise((resolve, reject) => {
3606
+ let settled = false;
3607
+ const settle = (err) => {
3608
+ if (settled) return;
3609
+ settled = true;
3610
+ clearTimeout(fallbackTimer);
3611
+ if (!err || isServerNotRunningError(err)) {
3612
+ resolve();
3613
+ return;
3614
+ }
3615
+ reject(err);
3616
+ };
3617
+ const fallbackTimer = setTimeout(() => {
3618
+ try {
3619
+ server.closeAllConnections();
3620
+ settle();
3621
+ } catch (err) {
3622
+ settle(err instanceof Error ? err : new Error(String(err)));
3623
+ }
3624
+ }, FEISHU_HTTP_SERVER_CLOSE_TIMEOUT_MS);
3625
+ try {
3626
+ server.close((err) => {
3627
+ settle(err);
3628
+ });
3629
+ } catch (err) {
3630
+ settle(err instanceof Error ? err : new Error(String(err)));
3631
+ }
3632
+ });
3633
+ }
3634
+ async function closeTrackedFeishuHttpServer(accountId, server) {
3635
+ const identitySnapshot = captureBotIdentitySnapshot(accountId);
3636
+ try {
3637
+ await closeFeishuHttpServer(server);
3638
+ } finally {
3639
+ if (httpServers.get(accountId) === server) {
3640
+ httpServers.delete(accountId);
3641
+ clearFeishuBotIdentityStateIfUnchanged(accountId, identitySnapshot);
3642
+ }
3643
+ }
3644
+ }
3645
+ function recordWebhookStatus(runtime, accountId, path, statusCode) {
3646
+ feishuWebhookAnomalyTracker.record({
3647
+ key: `${accountId}:${path}:${statusCode}`,
3648
+ statusCode,
3649
+ log: runtime?.log ?? console.log,
3650
+ message: (count) => `feishu[${accountId}]: webhook anomaly path=${path} status=${statusCode} count=${count}`
3651
+ });
3652
+ }
3653
+ //#endregion
3679
3654
  //#region extensions/feishu/src/monitor.bot-identity.ts
3680
3655
  const BOT_IDENTITY_RETRY_DELAYS_MS = [
3681
3656
  6e4,
@@ -3699,9 +3674,10 @@ function applyBotIdentityState(accountId, identity) {
3699
3674
  async function retryBotIdentityProbe(account, accountId, runtime, abortSignal) {
3700
3675
  const log = runtime?.log ?? console.log;
3701
3676
  const error = runtime?.error ?? console.error;
3702
- for (let i = 0; i < BOT_IDENTITY_RETRY_DELAYS_MS.length; i += 1) {
3677
+ const nextDelays = BOT_IDENTITY_RETRY_DELAYS_MS.slice(1)[Symbol.iterator]();
3678
+ for (const [i, delayMs] of BOT_IDENTITY_RETRY_DELAYS_MS.entries()) {
3703
3679
  if (abortSignal?.aborted) return;
3704
- if (!await waitForAbortableDelay(BOT_IDENTITY_RETRY_DELAYS_MS[i], abortSignal)) return;
3680
+ if (!await waitForAbortableDelay(delayMs, abortSignal)) return;
3705
3681
  const resolved = applyBotIdentityState(accountId, await fetchBotIdentityForMonitor(account, {
3706
3682
  runtime,
3707
3683
  abortSignal
@@ -3710,7 +3686,8 @@ async function retryBotIdentityProbe(account, accountId, runtime, abortSignal) {
3710
3686
  log(`feishu[${accountId}]: bot open_id recovered via background retry: ${resolved.botOpenId}`);
3711
3687
  return;
3712
3688
  }
3713
- const nextDelay = BOT_IDENTITY_RETRY_DELAYS_MS[i + 1];
3689
+ const nextDelayResult = nextDelays.next();
3690
+ const nextDelay = nextDelayResult.done ? void 0 : nextDelayResult.value;
3714
3691
  error(`feishu[${accountId}]: bot identity background retry ${i + 1}/${BOT_IDENTITY_RETRY_DELAYS_MS.length} failed` + (nextDelay ? `; next attempt in ${nextDelay / 1e3}s` : ""));
3715
3692
  }
3716
3693
  error(`feishu[${accountId}]: bot identity background retry exhausted; requireMention group messages may be skipped until restart`);
@@ -3951,7 +3928,7 @@ function createFeishuCommentReplyDispatcher(params) {
3951
3928
  accountId: params.accountId
3952
3929
  }));
3953
3930
  const textChunkLimit = core.channel.text.resolveTextChunkLimit(params.cfg, "feishu", params.accountId, { fallbackLimit: 4e3 });
3954
- const chunkMode = core.channel.text.resolveChunkMode(params.cfg, "feishu");
3931
+ const chunkMode = core.channel.text.resolveChunkMode(params.cfg, "feishu", params.accountId);
3955
3932
  const typingReaction = createCommentTypingReactionLifecycle({
3956
3933
  cfg: params.cfg,
3957
3934
  fileToken: params.fileToken,
@@ -4513,7 +4490,7 @@ async function resolveDriveCommentEventCore(params) {
4513
4490
  return null;
4514
4491
  }
4515
4492
  const context = await fetchDriveCommentContext({
4516
- client: createClient ? createClient(account ?? { accountId }) : createFeishuClient((await import("./accounts-Bs5uJ4h0.js").then((n) => n.t)).resolveFeishuAccount({
4493
+ client: createClient ? createClient(account ?? { accountId }) : createFeishuClient((await import("./accounts-BDoGHJDk.js").then((n) => n.t)).resolveFeishuAccount({
4517
4494
  cfg,
4518
4495
  accountId
4519
4496
  })),
@@ -5042,10 +5019,7 @@ function dedupeFeishuDebounceEntriesByDedupeKey(entries) {
5042
5019
  function resolveFeishuDebounceMentions(params) {
5043
5020
  const { entries, botOpenId } = params;
5044
5021
  if (entries.length === 0) return;
5045
- for (let index = entries.length - 1; index >= 0; index -= 1) {
5046
- const entry = entries[index];
5047
- if (isMentionForwardRequest(entry, botOpenId)) return mergeFeishuDebounceMentions([entry]);
5048
- }
5022
+ for (const entry of entries.toReversed()) if (isMentionForwardRequest(entry, botOpenId)) return mergeFeishuDebounceMentions([entry]);
5049
5023
  const merged = mergeFeishuDebounceMentions(entries);
5050
5024
  if (!merged) return;
5051
5025
  const normalizedBotOpenId = botOpenId?.trim();
@@ -5168,8 +5142,13 @@ function createFeishuMessageReceiveHandler({ cfg, channelRuntime, accountId, run
5168
5142
  return;
5169
5143
  }
5170
5144
  const messageDedupeKey = resolveFeishuMessageDedupeKey(event);
5171
- if (!tryBeginFeishuMessageProcessing(messageDedupeKey, accountId)) {
5172
- log(`feishu[${accountId}]: dropping duplicate event for message ${messageId}`);
5145
+ const claim = await claimUnprocessedFeishuMessage({
5146
+ messageId: messageDedupeKey,
5147
+ namespace: accountId,
5148
+ log
5149
+ });
5150
+ if (claim !== "claimed") {
5151
+ log(`feishu[${accountId}]: dropping ${claim} event for message ${messageId}`);
5173
5152
  return;
5174
5153
  }
5175
5154
  const processMessage = async () => {
@@ -5191,6 +5170,16 @@ function createFeishuMessageReceiveHandler({ cfg, channelRuntime, accountId, run
5191
5170
  };
5192
5171
  }
5193
5172
  //#endregion
5173
+ //#region extensions/feishu/src/monitor-rate-limit-key.ts
5174
+ function normalizeFeishuWebhookRateLimitClient(clientIp) {
5175
+ if (!clientIp) return "unknown";
5176
+ if (clientIp === "::1" || clientIp.startsWith("127.")) return "loopback";
5177
+ return clientIp;
5178
+ }
5179
+ function buildFeishuWebhookRateLimitKey(params) {
5180
+ return `${params.accountId}:${params.path}:${normalizeFeishuWebhookRateLimitClient(params.clientIp)}`;
5181
+ }
5182
+ //#endregion
5194
5183
  //#region extensions/feishu/src/monitor.transport.ts
5195
5184
  const FEISHU_WS_RECONNECT_INITIAL_DELAY_MS = 1e3;
5196
5185
  const FEISHU_WS_RECONNECT_MAX_DELAY_MS = 3e4;
@@ -5228,14 +5217,6 @@ function respondText(res, statusCode, body) {
5228
5217
  res.setHeader("Content-Type", "text/plain; charset=utf-8");
5229
5218
  res.end(body);
5230
5219
  }
5231
- function normalizeFeishuWebhookRateLimitClient(clientIp) {
5232
- if (!clientIp) return "unknown";
5233
- if (clientIp === "::1" || clientIp.startsWith("127.")) return "loopback";
5234
- return clientIp;
5235
- }
5236
- function buildFeishuWebhookRateLimitKey(params) {
5237
- return `${params.accountId}:${params.path}:${normalizeFeishuWebhookRateLimitClient(params.clientIp)}`;
5238
- }
5239
5220
  function getFeishuWsReconnectDelayMs(attempt) {
5240
5221
  return Math.min(FEISHU_WS_RECONNECT_INITIAL_DELAY_MS * 2 ** Math.max(0, attempt - 1), FEISHU_WS_RECONNECT_MAX_DELAY_MS);
5241
5222
  }
@@ -5529,7 +5510,7 @@ async function resolveReactionSyntheticEvent(params) {
5529
5510
  const senderId = event.user_id?.open_id;
5530
5511
  const senderUserId = event.user_id?.user_id;
5531
5512
  if (!emoji || !messageId || !senderId) return null;
5532
- const { resolveFeishuAccount } = await import("./accounts-Bs5uJ4h0.js").then((n) => n.t);
5513
+ const { resolveFeishuAccount } = await import("./accounts-BDoGHJDk.js").then((n) => n.t);
5533
5514
  const reactionNotifications = resolveFeishuAccount({
5534
5515
  cfg,
5535
5516
  accountId