@openclaw/mattermost 2026.9.4 → 2026.9.6

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 (573) hide show
  1. package/assets/activity.svg +40 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/.setup/channel-plugin-api-CCmaCFdK.mjs +3 -0
  4. package/dist/.setup/channel-plugin-api-CzBhdovL.mjs +40 -0
  5. package/dist/{channel-plugin-runtime-Dhr44A2Y.js → .setup/channel-plugin-runtime-yAOg5GcM.mjs} +40 -30
  6. package/dist/{channel.runtime-CYxC0VaI.js → .setup/channel.runtime-CihvzY84.mjs} +419 -200
  7. package/dist/{client-Dt7Q-j5B.js → .setup/client-BSSVve1x.mjs} +64 -22
  8. package/dist/{interactions-DF1FH27_.js → .setup/interactions-rBQWCbK8.mjs} +3 -3
  9. package/dist/{monitor-auth-C6RGYyn-.js → .setup/monitor-auth-CCpN0z_f.mjs} +18 -5
  10. package/dist/{normalize-R-ATEEHC.js → .setup/normalize-DM54w7ud.mjs} +47 -7
  11. package/dist/.setup/secret-contract-api-Drab0Nqx.mjs +3 -0
  12. package/dist/{slash-state-BjBTvP7u.js → .setup/slash-state-DfnmzXMr.mjs} +92 -31
  13. package/dist/api.js +2 -2
  14. package/dist/channel-plugin-api.js +2 -39
  15. package/dist/channel-plugin-runtime.js +1 -1
  16. package/dist/doctor-contract-api.js +1 -1
  17. package/dist/gateway-auth-api.js +1 -1
  18. package/dist/policy-api.js +1 -1
  19. package/dist/runtime-api.js +1 -1
  20. package/dist/secret-contract-api.js +1 -1
  21. package/dist/setup-entry.js +3 -2
  22. package/dist/slash-route-api.js +1 -1
  23. package/node_modules/zod/README.md +29 -2
  24. package/node_modules/zod/compile.cjs +96 -0
  25. package/node_modules/zod/compile.d.cts +1 -0
  26. package/node_modules/zod/compile.d.ts +1 -0
  27. package/node_modules/zod/compile.js +52 -0
  28. package/node_modules/zod/index.cjs +21 -2
  29. package/node_modules/zod/index.d.cts +1 -2
  30. package/node_modules/zod/index.d.ts +1 -2
  31. package/node_modules/zod/index.js +5 -2
  32. package/node_modules/zod/locales/index.cjs +19 -0
  33. package/node_modules/zod/mini/index.cjs +19 -0
  34. package/node_modules/zod/package.json +20 -8
  35. package/node_modules/zod/src/compile.ts +56 -0
  36. package/node_modules/zod/src/index.ts +5 -2
  37. package/node_modules/zod/src/v3/ZodError.ts +22 -12
  38. package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
  39. package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
  40. package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
  41. package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
  42. package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
  43. package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
  44. package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
  45. package/node_modules/zod/src/v3/types.ts +5 -5
  46. package/node_modules/zod/src/v4/classic/checks.ts +1 -0
  47. package/node_modules/zod/src/v4/classic/compat.ts +26 -18
  48. package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
  49. package/node_modules/zod/src/v4/classic/errors.ts +59 -44
  50. package/node_modules/zod/src/v4/classic/external.ts +14 -9
  51. package/node_modules/zod/src/v4/classic/from-json-schema.ts +363 -78
  52. package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
  53. package/node_modules/zod/src/v4/classic/index.ts +2 -2
  54. package/node_modules/zod/src/v4/classic/iso.ts +2 -72
  55. package/node_modules/zod/src/v4/classic/parse.ts +10 -4
  56. package/node_modules/zod/src/v4/classic/schemas.ts +640 -375
  57. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
  58. package/node_modules/zod/src/v4/classic/tests/array.test.ts +2 -2
  59. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +186 -0
  60. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +36 -1
  61. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
  62. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
  63. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
  64. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +3 -3
  65. package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
  66. package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
  67. package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
  68. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
  69. package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
  70. package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
  71. package/node_modules/zod/src/v4/classic/tests/default.test.ts +46 -0
  72. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
  73. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +261 -13
  74. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +20 -0
  75. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
  76. package/node_modules/zod/src/v4/classic/tests/error.test.ts +403 -6
  77. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +582 -10
  78. package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
  79. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
  80. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
  81. package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
  82. package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
  83. package/node_modules/zod/src/v4/classic/tests/index.test.ts +21 -2
  84. package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
  85. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +67 -0
  86. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
  87. package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
  88. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +3 -10
  89. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
  90. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
  91. package/node_modules/zod/src/v4/classic/tests/map.test.ts +12 -0
  92. package/node_modules/zod/src/v4/classic/tests/number.test.ts +85 -9
  93. package/node_modules/zod/src/v4/classic/tests/object.test.ts +301 -12
  94. package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
  95. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +49 -16
  96. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
  97. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
  98. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
  99. package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
  100. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
  101. package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
  102. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +79 -3
  103. package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
  104. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
  105. package/node_modules/zod/src/v4/classic/tests/set.test.ts +9 -0
  106. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
  107. package/node_modules/zod/src/v4/classic/tests/string.test.ts +222 -6
  108. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
  109. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +44 -3
  110. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1812 -204
  111. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
  112. package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
  113. package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
  114. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
  115. package/node_modules/zod/src/v4/core/api.ts +87 -35
  116. package/node_modules/zod/src/v4/core/checks.ts +119 -146
  117. package/node_modules/zod/src/v4/core/compile.ts +2313 -0
  118. package/node_modules/zod/src/v4/core/core.ts +99 -22
  119. package/node_modules/zod/src/v4/core/doc.ts +17 -9
  120. package/node_modules/zod/src/v4/core/errors.ts +113 -25
  121. package/node_modules/zod/src/v4/core/index.ts +3 -0
  122. package/node_modules/zod/src/v4/core/json-schema-generator.ts +8 -3
  123. package/node_modules/zod/src/v4/core/json-schema-processors.ts +424 -156
  124. package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
  125. package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
  126. package/node_modules/zod/src/v4/core/parse.ts +164 -50
  127. package/node_modules/zod/src/v4/core/regexes.ts +42 -15
  128. package/node_modules/zod/src/v4/core/registries.ts +2 -2
  129. package/node_modules/zod/src/v4/core/schemas.ts +1000 -538
  130. package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
  131. package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
  132. package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
  133. package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
  134. package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
  135. package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
  136. package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
  137. package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
  138. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
  139. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
  140. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
  141. package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
  142. package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
  143. package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
  144. package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
  145. package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
  146. package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
  147. package/node_modules/zod/src/v4/core/to-json-schema.ts +283 -48
  148. package/node_modules/zod/src/v4/core/util.ts +454 -157
  149. package/node_modules/zod/src/v4/core/versions.ts +2 -2
  150. package/node_modules/zod/src/v4/core/visit.ts +193 -0
  151. package/node_modules/zod/src/v4/index.ts +3 -3
  152. package/node_modules/zod/src/v4/locales/ar.ts +5 -0
  153. package/node_modules/zod/src/v4/locales/az.ts +5 -0
  154. package/node_modules/zod/src/v4/locales/be.ts +12 -0
  155. package/node_modules/zod/src/v4/locales/bg.ts +5 -0
  156. package/node_modules/zod/src/v4/locales/bn.ts +123 -0
  157. package/node_modules/zod/src/v4/locales/ca.ts +5 -0
  158. package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
  159. package/node_modules/zod/src/v4/locales/cs.ts +5 -0
  160. package/node_modules/zod/src/v4/locales/da.ts +7 -2
  161. package/node_modules/zod/src/v4/locales/de.ts +5 -0
  162. package/node_modules/zod/src/v4/locales/el.ts +3 -0
  163. package/node_modules/zod/src/v4/locales/en.ts +17 -4
  164. package/node_modules/zod/src/v4/locales/eo.ts +5 -0
  165. package/node_modules/zod/src/v4/locales/es.ts +4 -0
  166. package/node_modules/zod/src/v4/locales/fa.ts +5 -0
  167. package/node_modules/zod/src/v4/locales/fi.ts +5 -0
  168. package/node_modules/zod/src/v4/locales/fr-CA.ts +5 -0
  169. package/node_modules/zod/src/v4/locales/fr.ts +21 -14
  170. package/node_modules/zod/src/v4/locales/gu.ts +123 -0
  171. package/node_modules/zod/src/v4/locales/he.ts +8 -1
  172. package/node_modules/zod/src/v4/locales/hi.ts +126 -0
  173. package/node_modules/zod/src/v4/locales/hr.ts +4 -0
  174. package/node_modules/zod/src/v4/locales/hu.ts +5 -0
  175. package/node_modules/zod/src/v4/locales/hy.ts +11 -0
  176. package/node_modules/zod/src/v4/locales/id.ts +5 -0
  177. package/node_modules/zod/src/v4/locales/index.ts +11 -0
  178. package/node_modules/zod/src/v4/locales/is.ts +5 -0
  179. package/node_modules/zod/src/v4/locales/it.ts +5 -0
  180. package/node_modules/zod/src/v4/locales/ja.ts +5 -0
  181. package/node_modules/zod/src/v4/locales/ka.ts +5 -0
  182. package/node_modules/zod/src/v4/locales/km.ts +5 -0
  183. package/node_modules/zod/src/v4/locales/kn.ts +126 -0
  184. package/node_modules/zod/src/v4/locales/ko.ts +5 -0
  185. package/node_modules/zod/src/v4/locales/lt.ts +4 -0
  186. package/node_modules/zod/src/v4/locales/mk.ts +5 -0
  187. package/node_modules/zod/src/v4/locales/ms.ts +5 -0
  188. package/node_modules/zod/src/v4/locales/ne.ts +128 -0
  189. package/node_modules/zod/src/v4/locales/nl.ts +5 -0
  190. package/node_modules/zod/src/v4/locales/nn.ts +121 -0
  191. package/node_modules/zod/src/v4/locales/no.ts +7 -2
  192. package/node_modules/zod/src/v4/locales/ota.ts +5 -0
  193. package/node_modules/zod/src/v4/locales/pl.ts +5 -0
  194. package/node_modules/zod/src/v4/locales/ps.ts +5 -0
  195. package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
  196. package/node_modules/zod/src/v4/locales/pt.ts +101 -58
  197. package/node_modules/zod/src/v4/locales/ro.ts +3 -0
  198. package/node_modules/zod/src/v4/locales/ru.ts +12 -0
  199. package/node_modules/zod/src/v4/locales/sk.ts +123 -0
  200. package/node_modules/zod/src/v4/locales/sl.ts +5 -0
  201. package/node_modules/zod/src/v4/locales/sv.ts +7 -2
  202. package/node_modules/zod/src/v4/locales/ta.ts +5 -0
  203. package/node_modules/zod/src/v4/locales/tg.ts +135 -0
  204. package/node_modules/zod/src/v4/locales/th.ts +5 -0
  205. package/node_modules/zod/src/v4/locales/tk.ts +113 -0
  206. package/node_modules/zod/src/v4/locales/tr.ts +5 -0
  207. package/node_modules/zod/src/v4/locales/uk.ts +5 -0
  208. package/node_modules/zod/src/v4/locales/ur.ts +5 -0
  209. package/node_modules/zod/src/v4/locales/uz.ts +3 -0
  210. package/node_modules/zod/src/v4/locales/vi.ts +5 -0
  211. package/node_modules/zod/src/v4/locales/yo.ts +5 -0
  212. package/node_modules/zod/src/v4/locales/zh-CN.ts +5 -0
  213. package/node_modules/zod/src/v4/locales/zh-TW.ts +5 -0
  214. package/node_modules/zod/src/v4/mini/checks.ts +1 -0
  215. package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
  216. package/node_modules/zod/src/v4/mini/external.ts +12 -1
  217. package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
  218. package/node_modules/zod/src/v4/mini/parse.ts +2 -0
  219. package/node_modules/zod/src/v4/mini/schemas.ts +167 -63
  220. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
  221. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
  222. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
  223. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
  224. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
  225. package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
  226. package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
  227. package/node_modules/zod/src/v4/mini/tests/error.test.ts +23 -4
  228. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
  229. package/node_modules/zod/src/v4/mini/tests/index.test.ts +158 -5
  230. package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
  231. package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
  232. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
  233. package/node_modules/zod/src/v4/mini/tests/string.test.ts +44 -0
  234. package/node_modules/zod/v3/ZodError.cjs +41 -12
  235. package/node_modules/zod/v3/ZodError.d.cts +1 -1
  236. package/node_modules/zod/v3/ZodError.d.ts +1 -1
  237. package/node_modules/zod/v3/ZodError.js +22 -12
  238. package/node_modules/zod/v3/errors.cjs +19 -0
  239. package/node_modules/zod/v3/external.cjs +19 -0
  240. package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
  241. package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
  242. package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
  243. package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
  244. package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
  245. package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
  246. package/node_modules/zod/v3/helpers/util.cjs +19 -0
  247. package/node_modules/zod/v3/index.cjs +19 -0
  248. package/node_modules/zod/v3/standard-schema.cjs +19 -0
  249. package/node_modules/zod/v3/types.cjs +26 -5
  250. package/node_modules/zod/v3/types.js +7 -5
  251. package/node_modules/zod/v4/classic/checks.cjs +21 -1
  252. package/node_modules/zod/v4/classic/checks.d.cts +1 -1
  253. package/node_modules/zod/v4/classic/checks.d.ts +1 -1
  254. package/node_modules/zod/v4/classic/checks.js +1 -1
  255. package/node_modules/zod/v4/classic/coerce.cjs +19 -0
  256. package/node_modules/zod/v4/classic/compat.cjs +19 -0
  257. package/node_modules/zod/v4/classic/compat.d.cts +9 -11
  258. package/node_modules/zod/v4/classic/compat.d.ts +9 -11
  259. package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
  260. package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
  261. package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
  262. package/node_modules/zod/v4/classic/deep-partial.js +13 -0
  263. package/node_modules/zod/v4/classic/errors.cjs +62 -34
  264. package/node_modules/zod/v4/classic/errors.d.cts +3 -4
  265. package/node_modules/zod/v4/classic/errors.d.ts +3 -4
  266. package/node_modules/zod/v4/classic/errors.js +43 -34
  267. package/node_modules/zod/v4/classic/external.cjs +51 -27
  268. package/node_modules/zod/v4/classic/external.d.cts +5 -2
  269. package/node_modules/zod/v4/classic/external.d.ts +5 -2
  270. package/node_modules/zod/v4/classic/external.js +5 -8
  271. package/node_modules/zod/v4/classic/from-json-schema.cjs +376 -75
  272. package/node_modules/zod/v4/classic/from-json-schema.js +357 -75
  273. package/node_modules/zod/v4/classic/in-out.cjs +82 -0
  274. package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
  275. package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
  276. package/node_modules/zod/v4/classic/in-out.js +36 -0
  277. package/node_modules/zod/v4/classic/index.cjs +21 -2
  278. package/node_modules/zod/v4/classic/index.d.cts +1 -2
  279. package/node_modules/zod/v4/classic/index.d.ts +1 -2
  280. package/node_modules/zod/v4/classic/index.js +2 -2
  281. package/node_modules/zod/v4/classic/iso.cjs +30 -22
  282. package/node_modules/zod/v4/classic/iso.d.cts +2 -17
  283. package/node_modules/zod/v4/classic/iso.d.ts +2 -17
  284. package/node_modules/zod/v4/classic/iso.js +2 -17
  285. package/node_modules/zod/v4/classic/parse.cjs +23 -1
  286. package/node_modules/zod/v4/classic/parse.d.cts +17 -4
  287. package/node_modules/zod/v4/classic/parse.d.ts +17 -4
  288. package/node_modules/zod/v4/classic/parse.js +1 -0
  289. package/node_modules/zod/v4/classic/schemas.cjs +591 -426
  290. package/node_modules/zod/v4/classic/schemas.d.cts +68 -19
  291. package/node_modules/zod/v4/classic/schemas.d.ts +68 -19
  292. package/node_modules/zod/v4/classic/schemas.js +564 -424
  293. package/node_modules/zod/v4/core/api.cjs +66 -24
  294. package/node_modules/zod/v4/core/api.d.cts +22 -12
  295. package/node_modules/zod/v4/core/api.d.ts +22 -12
  296. package/node_modules/zod/v4/core/api.js +44 -24
  297. package/node_modules/zod/v4/core/checks.cjs +88 -128
  298. package/node_modules/zod/v4/core/checks.d.cts +29 -13
  299. package/node_modules/zod/v4/core/checks.d.ts +29 -13
  300. package/node_modules/zod/v4/core/checks.js +68 -127
  301. package/node_modules/zod/v4/core/compile.cjs +1908 -0
  302. package/node_modules/zod/v4/core/compile.d.cts +65 -0
  303. package/node_modules/zod/v4/core/compile.d.ts +65 -0
  304. package/node_modules/zod/v4/core/compile.js +1858 -0
  305. package/node_modules/zod/v4/core/core.cjs +101 -19
  306. package/node_modules/zod/v4/core/core.d.cts +16 -4
  307. package/node_modules/zod/v4/core/core.d.ts +16 -4
  308. package/node_modules/zod/v4/core/core.js +83 -20
  309. package/node_modules/zod/v4/core/doc.cjs +31 -9
  310. package/node_modules/zod/v4/core/doc.d.cts +3 -1
  311. package/node_modules/zod/v4/core/doc.d.ts +3 -1
  312. package/node_modules/zod/v4/core/doc.js +12 -9
  313. package/node_modules/zod/v4/core/errors.cjs +126 -25
  314. package/node_modules/zod/v4/core/errors.d.cts +4 -0
  315. package/node_modules/zod/v4/core/errors.d.ts +4 -0
  316. package/node_modules/zod/v4/core/errors.js +107 -25
  317. package/node_modules/zod/v4/core/index.cjs +24 -1
  318. package/node_modules/zod/v4/core/index.d.cts +3 -0
  319. package/node_modules/zod/v4/core/index.d.ts +3 -0
  320. package/node_modules/zod/v4/core/index.js +3 -0
  321. package/node_modules/zod/v4/core/json-schema-generator.cjs +24 -1
  322. package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
  323. package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
  324. package/node_modules/zod/v4/core/json-schema-generator.js +6 -2
  325. package/node_modules/zod/v4/core/json-schema-processors.cjs +441 -156
  326. package/node_modules/zod/v4/core/json-schema-processors.d.cts +16 -0
  327. package/node_modules/zod/v4/core/json-schema-processors.d.ts +16 -0
  328. package/node_modules/zod/v4/core/json-schema-processors.js +400 -158
  329. package/node_modules/zod/v4/core/json-schema.cjs +19 -0
  330. package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
  331. package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
  332. package/node_modules/zod/v4/core/memoizer.cjs +360 -0
  333. package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
  334. package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
  335. package/node_modules/zod/v4/core/memoizer.js +311 -0
  336. package/node_modules/zod/v4/core/parse.cjs +148 -46
  337. package/node_modules/zod/v4/core/parse.d.cts +14 -11
  338. package/node_modules/zod/v4/core/parse.d.ts +14 -11
  339. package/node_modules/zod/v4/core/parse.js +127 -45
  340. package/node_modules/zod/v4/core/regexes.cjs +54 -17
  341. package/node_modules/zod/v4/core/regexes.d.cts +5 -0
  342. package/node_modules/zod/v4/core/regexes.d.ts +5 -0
  343. package/node_modules/zod/v4/core/regexes.js +32 -15
  344. package/node_modules/zod/v4/core/registries.cjs +19 -0
  345. package/node_modules/zod/v4/core/registries.js +2 -2
  346. package/node_modules/zod/v4/core/schemas.cjs +785 -386
  347. package/node_modules/zod/v4/core/schemas.d.cts +123 -34
  348. package/node_modules/zod/v4/core/schemas.d.ts +123 -34
  349. package/node_modules/zod/v4/core/schemas.js +753 -386
  350. package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
  351. package/node_modules/zod/v4/core/to-json-schema.cjs +269 -45
  352. package/node_modules/zod/v4/core/to-json-schema.d.cts +45 -5
  353. package/node_modules/zod/v4/core/to-json-schema.d.ts +45 -5
  354. package/node_modules/zod/v4/core/to-json-schema.js +247 -44
  355. package/node_modules/zod/v4/core/util.cjs +372 -157
  356. package/node_modules/zod/v4/core/util.d.cts +79 -1
  357. package/node_modules/zod/v4/core/util.d.ts +79 -1
  358. package/node_modules/zod/v4/core/util.js +341 -156
  359. package/node_modules/zod/v4/core/versions.cjs +21 -2
  360. package/node_modules/zod/v4/core/versions.d.cts +1 -1
  361. package/node_modules/zod/v4/core/versions.d.ts +1 -1
  362. package/node_modules/zod/v4/core/versions.js +2 -2
  363. package/node_modules/zod/v4/core/visit.cjs +214 -0
  364. package/node_modules/zod/v4/core/visit.d.cts +30 -0
  365. package/node_modules/zod/v4/core/visit.d.ts +30 -0
  366. package/node_modules/zod/v4/core/visit.js +169 -0
  367. package/node_modules/zod/v4/index.cjs +34 -5
  368. package/node_modules/zod/v4/index.d.cts +2 -2
  369. package/node_modules/zod/v4/index.d.ts +2 -2
  370. package/node_modules/zod/v4/index.js +3 -2
  371. package/node_modules/zod/v4/locales/ar.cjs +5 -0
  372. package/node_modules/zod/v4/locales/ar.js +5 -0
  373. package/node_modules/zod/v4/locales/az.cjs +5 -0
  374. package/node_modules/zod/v4/locales/az.js +5 -0
  375. package/node_modules/zod/v4/locales/be.cjs +12 -0
  376. package/node_modules/zod/v4/locales/be.js +12 -0
  377. package/node_modules/zod/v4/locales/bg.cjs +5 -0
  378. package/node_modules/zod/v4/locales/bg.js +5 -0
  379. package/node_modules/zod/v4/locales/bn.cjs +140 -0
  380. package/node_modules/zod/v4/locales/bn.d.cts +5 -0
  381. package/node_modules/zod/v4/locales/bn.d.ts +4 -0
  382. package/node_modules/zod/v4/locales/bn.js +113 -0
  383. package/node_modules/zod/v4/locales/ca.cjs +5 -0
  384. package/node_modules/zod/v4/locales/ca.js +5 -0
  385. package/node_modules/zod/v4/locales/ckb.cjs +160 -0
  386. package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
  387. package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
  388. package/node_modules/zod/v4/locales/ckb.js +133 -0
  389. package/node_modules/zod/v4/locales/cs.cjs +5 -0
  390. package/node_modules/zod/v4/locales/cs.js +5 -0
  391. package/node_modules/zod/v4/locales/da.cjs +7 -2
  392. package/node_modules/zod/v4/locales/da.js +7 -2
  393. package/node_modules/zod/v4/locales/de.cjs +5 -0
  394. package/node_modules/zod/v4/locales/de.js +5 -0
  395. package/node_modules/zod/v4/locales/el.cjs +3 -0
  396. package/node_modules/zod/v4/locales/el.js +3 -0
  397. package/node_modules/zod/v4/locales/en.cjs +16 -4
  398. package/node_modules/zod/v4/locales/en.js +16 -4
  399. package/node_modules/zod/v4/locales/eo.cjs +5 -0
  400. package/node_modules/zod/v4/locales/eo.js +5 -0
  401. package/node_modules/zod/v4/locales/es.cjs +4 -0
  402. package/node_modules/zod/v4/locales/es.js +4 -0
  403. package/node_modules/zod/v4/locales/fa.cjs +5 -0
  404. package/node_modules/zod/v4/locales/fa.js +5 -0
  405. package/node_modules/zod/v4/locales/fi.cjs +5 -0
  406. package/node_modules/zod/v4/locales/fi.js +5 -0
  407. package/node_modules/zod/v4/locales/fr-CA.cjs +5 -0
  408. package/node_modules/zod/v4/locales/fr-CA.js +5 -0
  409. package/node_modules/zod/v4/locales/fr.cjs +18 -14
  410. package/node_modules/zod/v4/locales/fr.js +18 -14
  411. package/node_modules/zod/v4/locales/gu.cjs +140 -0
  412. package/node_modules/zod/v4/locales/gu.d.cts +5 -0
  413. package/node_modules/zod/v4/locales/gu.d.ts +4 -0
  414. package/node_modules/zod/v4/locales/gu.js +113 -0
  415. package/node_modules/zod/v4/locales/he.cjs +7 -0
  416. package/node_modules/zod/v4/locales/he.js +7 -0
  417. package/node_modules/zod/v4/locales/hi.cjs +138 -0
  418. package/node_modules/zod/v4/locales/hi.d.cts +5 -0
  419. package/node_modules/zod/v4/locales/hi.d.ts +4 -0
  420. package/node_modules/zod/v4/locales/hi.js +111 -0
  421. package/node_modules/zod/v4/locales/hr.cjs +4 -0
  422. package/node_modules/zod/v4/locales/hr.js +4 -0
  423. package/node_modules/zod/v4/locales/hu.cjs +5 -0
  424. package/node_modules/zod/v4/locales/hu.js +5 -0
  425. package/node_modules/zod/v4/locales/hy.cjs +11 -0
  426. package/node_modules/zod/v4/locales/hy.js +11 -0
  427. package/node_modules/zod/v4/locales/id.cjs +5 -0
  428. package/node_modules/zod/v4/locales/id.js +5 -0
  429. package/node_modules/zod/v4/locales/index.cjs +43 -2
  430. package/node_modules/zod/v4/locales/index.d.cts +11 -0
  431. package/node_modules/zod/v4/locales/index.d.ts +11 -0
  432. package/node_modules/zod/v4/locales/index.js +11 -0
  433. package/node_modules/zod/v4/locales/is.cjs +5 -0
  434. package/node_modules/zod/v4/locales/is.js +5 -0
  435. package/node_modules/zod/v4/locales/it.cjs +5 -0
  436. package/node_modules/zod/v4/locales/it.js +5 -0
  437. package/node_modules/zod/v4/locales/ja.cjs +5 -0
  438. package/node_modules/zod/v4/locales/ja.js +5 -0
  439. package/node_modules/zod/v4/locales/ka.cjs +5 -0
  440. package/node_modules/zod/v4/locales/ka.js +5 -0
  441. package/node_modules/zod/v4/locales/km.cjs +5 -0
  442. package/node_modules/zod/v4/locales/km.js +5 -0
  443. package/node_modules/zod/v4/locales/kn.cjs +143 -0
  444. package/node_modules/zod/v4/locales/kn.d.cts +5 -0
  445. package/node_modules/zod/v4/locales/kn.d.ts +4 -0
  446. package/node_modules/zod/v4/locales/kn.js +116 -0
  447. package/node_modules/zod/v4/locales/ko.cjs +5 -0
  448. package/node_modules/zod/v4/locales/ko.js +5 -0
  449. package/node_modules/zod/v4/locales/lt.cjs +4 -0
  450. package/node_modules/zod/v4/locales/lt.js +4 -0
  451. package/node_modules/zod/v4/locales/mk.cjs +5 -0
  452. package/node_modules/zod/v4/locales/mk.js +5 -0
  453. package/node_modules/zod/v4/locales/ms.cjs +5 -0
  454. package/node_modules/zod/v4/locales/ms.js +5 -0
  455. package/node_modules/zod/v4/locales/ne.cjs +138 -0
  456. package/node_modules/zod/v4/locales/ne.d.cts +5 -0
  457. package/node_modules/zod/v4/locales/ne.d.ts +4 -0
  458. package/node_modules/zod/v4/locales/ne.js +111 -0
  459. package/node_modules/zod/v4/locales/nl.cjs +5 -0
  460. package/node_modules/zod/v4/locales/nl.js +5 -0
  461. package/node_modules/zod/v4/locales/nn.cjs +140 -0
  462. package/node_modules/zod/v4/locales/nn.d.cts +5 -0
  463. package/node_modules/zod/v4/locales/nn.d.ts +4 -0
  464. package/node_modules/zod/v4/locales/nn.js +113 -0
  465. package/node_modules/zod/v4/locales/no.cjs +7 -2
  466. package/node_modules/zod/v4/locales/no.js +7 -2
  467. package/node_modules/zod/v4/locales/ota.cjs +5 -0
  468. package/node_modules/zod/v4/locales/ota.js +5 -0
  469. package/node_modules/zod/v4/locales/pl.cjs +5 -0
  470. package/node_modules/zod/v4/locales/pl.js +5 -0
  471. package/node_modules/zod/v4/locales/ps.cjs +5 -0
  472. package/node_modules/zod/v4/locales/ps.js +5 -0
  473. package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
  474. package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
  475. package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
  476. package/node_modules/zod/v4/locales/pt-BR.js +143 -0
  477. package/node_modules/zod/v4/locales/pt.cjs +89 -55
  478. package/node_modules/zod/v4/locales/pt.js +89 -55
  479. package/node_modules/zod/v4/locales/ro.cjs +3 -0
  480. package/node_modules/zod/v4/locales/ro.js +3 -0
  481. package/node_modules/zod/v4/locales/ru.cjs +12 -0
  482. package/node_modules/zod/v4/locales/ru.js +12 -0
  483. package/node_modules/zod/v4/locales/sk.cjs +143 -0
  484. package/node_modules/zod/v4/locales/sk.d.cts +5 -0
  485. package/node_modules/zod/v4/locales/sk.d.ts +4 -0
  486. package/node_modules/zod/v4/locales/sk.js +116 -0
  487. package/node_modules/zod/v4/locales/sl.cjs +5 -0
  488. package/node_modules/zod/v4/locales/sl.js +5 -0
  489. package/node_modules/zod/v4/locales/sv.cjs +7 -2
  490. package/node_modules/zod/v4/locales/sv.js +7 -2
  491. package/node_modules/zod/v4/locales/ta.cjs +5 -0
  492. package/node_modules/zod/v4/locales/ta.js +5 -0
  493. package/node_modules/zod/v4/locales/tg.cjs +144 -0
  494. package/node_modules/zod/v4/locales/tg.d.cts +5 -0
  495. package/node_modules/zod/v4/locales/tg.d.ts +4 -0
  496. package/node_modules/zod/v4/locales/tg.js +117 -0
  497. package/node_modules/zod/v4/locales/th.cjs +5 -0
  498. package/node_modules/zod/v4/locales/th.js +5 -0
  499. package/node_modules/zod/v4/locales/tk.cjs +134 -0
  500. package/node_modules/zod/v4/locales/tk.d.cts +5 -0
  501. package/node_modules/zod/v4/locales/tk.d.ts +4 -0
  502. package/node_modules/zod/v4/locales/tk.js +107 -0
  503. package/node_modules/zod/v4/locales/tr.cjs +5 -0
  504. package/node_modules/zod/v4/locales/tr.js +5 -0
  505. package/node_modules/zod/v4/locales/uk.cjs +5 -0
  506. package/node_modules/zod/v4/locales/uk.js +5 -0
  507. package/node_modules/zod/v4/locales/ur.cjs +5 -0
  508. package/node_modules/zod/v4/locales/ur.js +5 -0
  509. package/node_modules/zod/v4/locales/uz.cjs +3 -0
  510. package/node_modules/zod/v4/locales/uz.js +3 -0
  511. package/node_modules/zod/v4/locales/vi.cjs +5 -0
  512. package/node_modules/zod/v4/locales/vi.js +5 -0
  513. package/node_modules/zod/v4/locales/yo.cjs +5 -0
  514. package/node_modules/zod/v4/locales/yo.js +5 -0
  515. package/node_modules/zod/v4/locales/zh-CN.cjs +5 -0
  516. package/node_modules/zod/v4/locales/zh-CN.js +5 -0
  517. package/node_modules/zod/v4/locales/zh-TW.cjs +5 -0
  518. package/node_modules/zod/v4/locales/zh-TW.js +5 -0
  519. package/node_modules/zod/v4/mini/checks.cjs +21 -1
  520. package/node_modules/zod/v4/mini/checks.d.cts +1 -1
  521. package/node_modules/zod/v4/mini/checks.d.ts +1 -1
  522. package/node_modules/zod/v4/mini/checks.js +1 -1
  523. package/node_modules/zod/v4/mini/coerce.cjs +19 -0
  524. package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
  525. package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
  526. package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
  527. package/node_modules/zod/v4/mini/deep-partial.js +13 -0
  528. package/node_modules/zod/v4/mini/external.cjs +33 -1
  529. package/node_modules/zod/v4/mini/external.d.cts +5 -2
  530. package/node_modules/zod/v4/mini/external.d.ts +5 -2
  531. package/node_modules/zod/v4/mini/external.js +3 -1
  532. package/node_modules/zod/v4/mini/in-out.cjs +82 -0
  533. package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
  534. package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
  535. package/node_modules/zod/v4/mini/in-out.js +36 -0
  536. package/node_modules/zod/v4/mini/index.cjs +19 -0
  537. package/node_modules/zod/v4/mini/iso.cjs +19 -0
  538. package/node_modules/zod/v4/mini/parse.cjs +22 -1
  539. package/node_modules/zod/v4/mini/parse.d.cts +1 -1
  540. package/node_modules/zod/v4/mini/parse.d.ts +1 -1
  541. package/node_modules/zod/v4/mini/parse.js +1 -1
  542. package/node_modules/zod/v4/mini/schemas.cjs +117 -53
  543. package/node_modules/zod/v4/mini/schemas.d.cts +49 -14
  544. package/node_modules/zod/v4/mini/schemas.d.ts +49 -14
  545. package/node_modules/zod/v4/mini/schemas.js +92 -51
  546. package/node_modules/zod/v4-mini/index.cjs +19 -0
  547. package/openclaw.plugin.json +13 -29
  548. package/package.json +8 -8
  549. package/node_modules/ws/LICENSE +0 -20
  550. package/node_modules/ws/README.md +0 -548
  551. package/node_modules/ws/browser.js +0 -8
  552. package/node_modules/ws/index.js +0 -22
  553. package/node_modules/ws/lib/buffer-util.js +0 -131
  554. package/node_modules/ws/lib/constants.js +0 -19
  555. package/node_modules/ws/lib/event-target.js +0 -292
  556. package/node_modules/ws/lib/extension.js +0 -203
  557. package/node_modules/ws/lib/limiter.js +0 -55
  558. package/node_modules/ws/lib/permessage-deflate.js +0 -530
  559. package/node_modules/ws/lib/receiver.js +0 -743
  560. package/node_modules/ws/lib/sender.js +0 -607
  561. package/node_modules/ws/lib/stream.js +0 -161
  562. package/node_modules/ws/lib/subprotocol.js +0 -62
  563. package/node_modules/ws/lib/validation.js +0 -152
  564. package/node_modules/ws/lib/websocket-server.js +0 -562
  565. package/node_modules/ws/lib/websocket.js +0 -1407
  566. package/node_modules/ws/package.json +0 -74
  567. package/node_modules/ws/wrapper.mjs +0 -21
  568. package/node_modules/zod/src/v4/core/config.ts +0 -15
  569. /package/dist/{doctor-contract-mvORF4f6.js → .setup/doctor-contract-mvORF4f6.mjs} +0 -0
  570. /package/dist/{gateway-auth-bypass-B93t91oq.js → .setup/gateway-auth-bypass-B93t91oq.mjs} +0 -0
  571. /package/dist/{ingress-identity-DNl4yQSc.js → .setup/ingress-identity-DNl4yQSc.mjs} +0 -0
  572. /package/dist/{runtime-CNB4YGqJ.js → .setup/runtime-CNB4YGqJ.mjs} +0 -0
  573. /package/dist/{secret-contract-qg3NXRlS.js → .setup/secret-contract-qg3NXRlS.mjs} +0 -0
@@ -1,12 +1,12 @@
1
1
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
2
2
  import { bufferToBlobPart } from "openclaw/plugin-sdk/blob-runtime";
3
3
  import { createChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
4
- import { collectErrorGraphCandidates } from "openclaw/plugin-sdk/error-runtime";
4
+ import { PlatformMessageNotDispatchedError, collectErrorGraphCandidates } from "openclaw/plugin-sdk/error-runtime";
5
5
  import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
6
- import { responseWithRelease } from "openclaw/plugin-sdk/fetch-runtime";
6
+ import { captureChannelReadAuthority, responseWithRelease } from "openclaw/plugin-sdk/fetch-runtime";
7
7
  import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
8
- import { readProviderJsonResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
9
- import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
8
+ import { readProviderJsonResponse, redactProviderResponseErrorText } from "openclaw/plugin-sdk/provider-http";
9
+ import { readResponseTextPrefix, readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
10
10
  import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
11
11
  import { fetchWithSsrFGuard, ssrfPolicyFromPrivateNetworkOptIn } from "openclaw/plugin-sdk/ssrf-runtime";
12
12
  import { z } from "zod";
@@ -63,17 +63,18 @@ async function readMattermostSuccessText(res, path) {
63
63
  const bytes = await readResponseWithLimit(res, MATTERMOST_TEXT_RESPONSE_LIMIT_BYTES, { onOverflow: ({ maxBytes }) => /* @__PURE__ */ new Error(`Mattermost API ${path}: text response exceeds ${maxBytes} bytes`) });
64
64
  return new TextDecoder().decode(bytes);
65
65
  }
66
- async function readMattermostError(res) {
66
+ async function readMattermostError(res, requestHeaders) {
67
67
  const contentType = res.headers.get("content-type") ?? "";
68
- const text = await readResponseTextLimited(res, MATTERMOST_ERROR_BODY_LIMIT_BYTES);
68
+ const { text, truncated } = await readResponseTextPrefix(res, MATTERMOST_ERROR_BODY_LIMIT_BYTES, {
69
+ chunkTimeoutMs: 1e4,
70
+ onIdleTimeout: ({ chunkTimeoutMs }) => /* @__PURE__ */ new Error(`error body read stalled for ${chunkTimeoutMs}ms`)
71
+ });
72
+ let detail = text;
69
73
  if (contentType.includes("application/json")) try {
70
74
  const data = JSON.parse(text);
71
- if (data?.message) return data.message;
72
- return JSON.stringify(data);
73
- } catch {
74
- return text;
75
- }
76
- return text;
75
+ detail = data !== null && typeof data === "object" && "message" in data && typeof data.message === "string" && data.message ? data.message : JSON.stringify(data);
76
+ } catch {}
77
+ return redactProviderResponseErrorText(detail, requestHeaders, { sourceTruncated: truncated });
77
78
  }
78
79
  function createMattermostClient(params) {
79
80
  const baseUrl = normalizeMattermostBaseUrl(params.baseUrl);
@@ -81,14 +82,36 @@ function createMattermostClient(params) {
81
82
  const apiBaseUrl = `${baseUrl}/api/v4`;
82
83
  const token = params.botToken.trim();
83
84
  const requestTimeoutMs = resolveTimerTimeoutMs(params.timeoutMs, MATTERMOST_REQUEST_TIMEOUT_MS);
85
+ const assertSenderCurrent = params.assertRequestCurrent;
86
+ let postDispatchStarted = false;
87
+ const assertRequestCurrent = assertSenderCurrent ? () => {
88
+ try {
89
+ assertSenderCurrent();
90
+ } catch (error) {
91
+ const message = error instanceof Error ? error.message : String(error);
92
+ if (postDispatchStarted) throw new AggregateError([error, /* @__PURE__ */ new Error("A Mattermost post request was already dispatched")], message, { cause: error });
93
+ throw new PlatformMessageNotDispatchedError(message, {
94
+ cause: error,
95
+ retryable: false
96
+ });
97
+ }
98
+ } : void 0;
84
99
  const externalFetchImpl = params.fetchImpl;
85
100
  const guardedFetchImpl = async (input, init) => {
101
+ const assertReadAuthority = captureChannelReadAuthority();
102
+ assertReadAuthority?.();
103
+ assertRequestCurrent?.();
86
104
  const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
87
- const { timeoutMs: initTimeoutMs, ...requestInit } = init ?? {};
105
+ const { timeoutMs: initTimeoutMs, isMessagePost, ...requestInit } = init ?? {};
88
106
  const timeoutMs = resolveTimerTimeoutMs(initTimeoutMs, requestTimeoutMs);
89
107
  const { response, release } = await fetchWithSsrFGuard({
90
108
  url,
91
109
  init: requestInit,
110
+ beforeRequest: () => {
111
+ assertReadAuthority?.();
112
+ assertRequestCurrent?.();
113
+ if (isMessagePost) postDispatchStarted = true;
114
+ },
92
115
  auditContext: "mattermost-api",
93
116
  policy: ssrfPolicyFromPrivateNetworkOptIn(params.allowPrivateNetwork),
94
117
  signal: requestInit.signal ?? void 0,
@@ -97,8 +120,9 @@ function createMattermostClient(params) {
97
120
  return responseWithRelease(response, release);
98
121
  };
99
122
  const fetchImpl = (externalFetchImpl ? async (input, init) => {
123
+ captureChannelReadAuthority()?.();
100
124
  const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
101
- const { timeoutMs: initTimeoutMs, ...requestInit } = init ?? {};
125
+ const { timeoutMs: initTimeoutMs, isMessagePost, ...requestInit } = init ?? {};
102
126
  const timeoutMs = resolveTimerTimeoutMs(initTimeoutMs, requestTimeoutMs);
103
127
  const { signal: timeoutSignal, cleanup } = buildTimeoutAbortSignal({
104
128
  timeoutMs,
@@ -108,6 +132,8 @@ function createMattermostClient(params) {
108
132
  const callerSignal = requestInit.signal ?? void 0;
109
133
  const signal = callerSignal && timeoutSignal ? AbortSignal.any([callerSignal, timeoutSignal]) : callerSignal ?? timeoutSignal;
110
134
  try {
135
+ assertRequestCurrent?.();
136
+ if (isMessagePost) postDispatchStarted = true;
111
137
  const response = await externalFetchImpl(input, {
112
138
  ...requestInit,
113
139
  signal
@@ -123,20 +149,28 @@ function createMattermostClient(params) {
123
149
  const headers = new Headers(init?.headers);
124
150
  headers.set("Authorization", `Bearer ${token}`);
125
151
  if (typeof init?.body === "string" && !headers.has("Content-Type")) headers.set("Content-Type", "application/json");
152
+ const isMessagePost = path === "/posts" && init?.method?.toUpperCase() === "POST";
126
153
  const res = await fetchImpl(url, {
127
154
  ...init,
128
- headers
155
+ headers,
156
+ isMessagePost
129
157
  });
130
158
  if (!res.ok) {
131
- const detail = await readMattermostError(res);
159
+ const detail = await readMattermostError(res, headers);
132
160
  throw new Error(`Mattermost API ${res.status} ${res.statusText}: ${detail || "unknown error"}`);
133
161
  }
134
162
  if (res.status === 204) return;
163
+ if (path === "/reactions" && init?.method?.toUpperCase() === "POST") {
164
+ try {
165
+ await res.body?.cancel();
166
+ } catch {}
167
+ return;
168
+ }
135
169
  try {
136
170
  if ((res.headers.get("content-type") ?? "").includes("application/json")) return await readProviderJsonResponse(res, `Mattermost API ${path}`);
137
171
  return await readMattermostSuccessText(res, path);
138
172
  } catch (error) {
139
- if (path === "/posts" && init?.method?.toUpperCase() === "POST") throw createChannelPartialDeliveryError(error, {
173
+ if (isMessagePost) throw createChannelPartialDeliveryError(error, {
140
174
  messageIds: [],
141
175
  visibleReplySent: true
142
176
  });
@@ -148,7 +182,8 @@ function createMattermostClient(params) {
148
182
  apiBaseUrl,
149
183
  token,
150
184
  request,
151
- fetchImpl
185
+ fetchImpl,
186
+ ...assertRequestCurrent ? { assertRequestCurrent } : {}
152
187
  };
153
188
  }
154
189
  async function fetchMattermostMe(client) {
@@ -266,6 +301,7 @@ async function createMattermostDirectChannelWithRetry(client, userIds, options =
266
301
  });
267
302
  }
268
303
  function isRetryableError(error) {
304
+ if (error instanceof PlatformMessageNotDispatchedError && !error.retryable) return false;
269
305
  const candidates = collectErrorGraphCandidates(error, (current) => [
270
306
  current.cause,
271
307
  current.reason,
@@ -343,7 +379,12 @@ async function updateMattermostPost(client, postId, params) {
343
379
  const payload = { id: postId };
344
380
  if (params.message !== void 0) payload.message = params.message;
345
381
  if (params.props !== void 0) payload.props = params.props;
346
- return await client.request(`/posts/${postId}`, {
382
+ else if (params.message !== void 0 && /\B@(channel|all|here)\b/i.test(params.message)) {
383
+ const current = MattermostPostSchema.parse(await client.request(`/posts/${postId}`));
384
+ if (current.id !== postId) throw new Error("Mattermost post lookup returned a different post id");
385
+ payload.props = current.props ?? {};
386
+ }
387
+ return await client.request(`/posts/${postId}/patch`, {
347
388
  method: "PUT",
348
389
  body: JSON.stringify(payload)
349
390
  });
@@ -357,13 +398,14 @@ async function uploadMattermostFile(client, params) {
357
398
  const blob = new Blob([bufferToBlobPart(params.buffer)], { type: params.contentType });
358
399
  form.append("files", blob, fileName);
359
400
  form.append("channel_id", params.channelId);
401
+ const headers = { Authorization: `Bearer ${client.token}` };
360
402
  const res = await client.fetchImpl(`${client.apiBaseUrl}/files`, {
361
403
  method: "POST",
362
- headers: { Authorization: `Bearer ${client.token}` },
404
+ headers,
363
405
  body: form
364
406
  });
365
407
  if (!res.ok) {
366
- const detail = await readMattermostError(res);
408
+ const detail = await readMattermostError(res, headers);
367
409
  throw new Error(`Mattermost API ${res.status} ${res.statusText}: ${detail || "unknown error"}`);
368
410
  }
369
411
  const info = (await readProviderJsonResponse(res, "Mattermost API /files")).file_infos?.[0];
@@ -371,4 +413,4 @@ async function uploadMattermostFile(client, params) {
371
413
  return info;
372
414
  }
373
415
  //#endregion
374
- export { sendMattermostTyping as _, createMattermostPost as a, fetchMattermostChannelByName as c, fetchMattermostUser as d, fetchMattermostUserByUsername as f, readMattermostError as g, parseMattermostApiStatus as h, createMattermostDirectChannelWithRetry as i, fetchMattermostChannelPosts as l, normalizeMattermostBaseUrl as m, buildMattermostApiUrl as n, deleteMattermostPost as o, fetchMattermostUserTeams as p, createMattermostClient as r, fetchMattermostChannel as s, MattermostPostSchema as t, fetchMattermostMe as u, updateMattermostPost as v, uploadMattermostFile as y };
416
+ export { readMattermostError as _, createMattermostPost as a, uploadMattermostFile as b, fetchMattermostChannelByName as c, fetchMattermostUser as d, fetchMattermostUserByUsername as f, parseMattermostApiStatus as g, normalizeMattermostBaseUrl as h, createMattermostDirectChannelWithRetry as i, fetchMattermostChannelPosts as l, isRetryableError as m, buildMattermostApiUrl as n, deleteMattermostPost as o, fetchMattermostUserTeams as p, createMattermostClient as r, fetchMattermostChannel as s, MattermostPostSchema as t, fetchMattermostMe as u, sendMattermostTyping as v, updateMattermostPost as y };
@@ -1,6 +1,6 @@
1
- import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
2
- import { v as updateMattermostPost } from "./client-Dt7Q-j5B.js";
3
- import { S as resolveClientIp, f as isRequestBodyLimitError, p as isTrustedProxyAddress, v as readRequestBodyWithLimit, w as sendHttpRequestRejection } from "./monitor-auth-C6RGYyn-.js";
1
+ import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
2
+ import { y as updateMattermostPost } from "./client-BSSVve1x.mjs";
3
+ import { D as sendHttpRequestRejection, T as resolveClientIp, g as isTrustedProxyAddress, h as isRequestBodyLimitError, x as readRequestBodyWithLimit } from "./monitor-auth-CCpN0z_f.mjs";
4
4
  import { createHmac } from "node:crypto";
5
5
  import { resolveGatewayPort } from "openclaw/plugin-sdk/gateway-config-runtime";
6
6
  import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
@@ -1,4 +1,5 @@
1
- import { n as normalizeMattermostAllowEntry, t as mattermostIngressIdentity } from "./ingress-identity-DNl4yQSc.js";
1
+ import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
2
+ import { n as normalizeMattermostAllowEntry, t as mattermostIngressIdentity } from "./ingress-identity-DNl4yQSc.mjs";
2
3
  import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
3
4
  import { logInboundDrop } from "openclaw/plugin-sdk/channel-inbound";
4
5
  import { resolveAllowlistMatchSimple } from "openclaw/plugin-sdk/allow-from";
@@ -14,9 +15,9 @@ import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
14
15
  import { DEFAULT_GROUP_HISTORY_LIMIT, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
15
16
  import { registerPluginHttpRoute } from "openclaw/plugin-sdk/webhook-targets";
16
17
  import { isRequestBodyLimitError } from "openclaw/plugin-sdk/webhook-ingress";
17
- import { readRequestBodyWithLimit, sendHttpRequestRejection } from "openclaw/plugin-sdk/webhook-request-guards";
18
+ import { createWebhookInFlightLimiter, readRequestBodyWithLimit, sendHttpRequestRejection } from "openclaw/plugin-sdk/webhook-request-guards";
18
19
  import { isTrustedProxyAddress, resolveClientIp } from "openclaw/plugin-sdk/core";
19
- import { resolveStableChannelMessageIngress } from "openclaw/plugin-sdk/channel-ingress-runtime";
20
+ import { resolveChannelContextVisibilityMode, shouldIncludeSupplementalContext } from "openclaw/plugin-sdk/context-visibility-runtime";
20
21
  //#region extensions/mattermost/src/mattermost/monitor-auth.ts
21
22
  function normalizeMattermostAllowList(entries) {
22
23
  const normalized = entries.map((entry) => normalizeMattermostAllowEntry(String(entry))).filter(Boolean);
@@ -54,7 +55,7 @@ async function resolveMattermostMonitorInboundAccess(params) {
54
55
  const configAllowFrom = account.config.allowFrom ?? [];
55
56
  const configGroupAllowFrom = account.config.groupAllowFrom ?? [];
56
57
  const readStoreAllowFrom = params.readStoreAllowFrom ?? (storeAllowFrom != null ? async () => [...storeAllowFrom] : void 0);
57
- return await resolveStableChannelMessageIngress({
58
+ return await getMattermostRuntime().channel.inbound.ingress.resolveStable({
58
59
  channelId: "mattermost",
59
60
  accountId: account.accountId,
60
61
  identity: mattermostIngressIdentity,
@@ -89,6 +90,18 @@ async function resolveMattermostMonitorInboundAccess(params) {
89
90
  }
90
91
  });
91
92
  }
93
+ /** Live and recovered history share the same trigger-versus-visibility policy. */
94
+ function shouldRetainMattermostSenderHistory(params) {
95
+ return params.ingress.decision === "allow" || params.kind !== "direct" && params.ingress.reasonCode === "group_policy_not_allowlisted" && shouldIncludeSupplementalContext({
96
+ mode: resolveChannelContextVisibilityMode({
97
+ cfg: params.cfg,
98
+ channel: "mattermost",
99
+ accountId: params.accountId
100
+ }),
101
+ kind: "history",
102
+ senderAllowed: false
103
+ });
104
+ }
92
105
  function resolveMattermostCommandDenyReason(params) {
93
106
  if (params.decision.decision === "allow") return null;
94
107
  if (params.kind === "direct") {
@@ -162,4 +175,4 @@ async function authorizeMattermostCommandInvocation(params) {
162
175
  };
163
176
  }
164
177
  //#endregion
165
- export { resolveDefaultGroupPolicy as C, resolveClientIp as S, warnMissingProviderGroupPolicyFallbackOnce as T, logTypingFailure as _, resolveMattermostMonitorInboundAccess as a, resolveAllowlistProviderRuntimeGroupPolicy$1 as b, buildPreparedModelsProviderData as c, createChannelPairingController as d, isRequestBodyLimitError as f, logInboundDrop as g, loadOutboundMediaFromUrl as h, normalizeMattermostAllowList as i, createChannelHistoryWindow as l, listSkillCommandsForAgents as m, formatMattermostDirectMessageDropLog as n, resolveMattermostTrustedChatKind as o, isTrustedProxyAddress as p, isMattermostSenderAllowed as r, DEFAULT_GROUP_HISTORY_LIMIT as s, authorizeMattermostCommandInvocation as t, createChannelMessageReplyPipeline as u, readRequestBodyWithLimit as v, sendHttpRequestRejection as w, resolveChannelMediaMaxBytes$1 as x, registerPluginHttpRoute as y };
178
+ export { resolveAllowlistProviderRuntimeGroupPolicy$1 as C, sendHttpRequestRejection as D, resolveDefaultGroupPolicy as E, warnMissingProviderGroupPolicyFallbackOnce as O, registerPluginHttpRoute as S, resolveClientIp as T, listSkillCommandsForAgents as _, resolveMattermostMonitorInboundAccess as a, logTypingFailure as b, DEFAULT_GROUP_HISTORY_LIMIT as c, createChannelMessageReplyPipeline as d, createChannelPairingController as f, isTrustedProxyAddress as g, isRequestBodyLimitError as h, normalizeMattermostAllowList as i, buildPreparedModelsProviderData as l, isDangerousNameMatchingEnabled as m, formatMattermostDirectMessageDropLog as n, resolveMattermostTrustedChatKind as o, createWebhookInFlightLimiter as p, isMattermostSenderAllowed as r, shouldRetainMattermostSenderHistory as s, authorizeMattermostCommandInvocation as t, createChannelHistoryWindow as u, loadOutboundMediaFromUrl as v, resolveChannelMediaMaxBytes$1 as w, readRequestBodyWithLimit as x, logInboundDrop as y };
@@ -1,8 +1,9 @@
1
- import { m as normalizeMattermostBaseUrl } from "./client-Dt7Q-j5B.js";
1
+ import { h as normalizeMattermostBaseUrl } from "./client-BSSVve1x.mjs";
2
2
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { resolveChannelPreviewStreamMode, resolveChannelStreamingBlockCoalesce, resolveChannelStreamingBlockEnabled, resolveChannelStreamingChunkMode } from "openclaw/plugin-sdk/channel-outbound";
4
4
  import { createAccountListHelpers, hasConfiguredAccountValue } from "openclaw/plugin-sdk/account-helpers";
5
5
  import { normalizeMessagePresentation, renderMessagePresentationFallbackText, resolveMessagePresentationControlValue } from "openclaw/plugin-sdk/interactive-runtime";
6
+ import { resolveAskUserQuestionOptionIndex, resolveAskUserQuestionOptionIndices } from "openclaw/plugin-sdk/reply-payload";
6
7
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
7
8
  import { buildSecretInputSchema, hasConfiguredSecretInput, resolveSecretInputString } from "openclaw/plugin-sdk/secret-input";
8
9
  //#region extensions/mattermost/src/mattermost/accounts.ts
@@ -93,15 +94,54 @@ function resolveMattermostReplyToMode(account, kind) {
93
94
  }
94
95
  //#endregion
95
96
  //#region extensions/mattermost/src/normalize.ts
97
+ /** Marks a button context as one this plugin answers through the question Gateway. */
98
+ const MATTERMOST_QUESTION_CONTEXT_KEY = "oc_question";
99
+ /**
100
+ * Read a question selection back out of a verified interaction context.
101
+ *
102
+ * The context is HMAC-signed on the way out and verified before this runs, so
103
+ * the ids here are the ones this Gateway wrote, not the clicker's input.
104
+ */
105
+ function parseMattermostQuestionContext(context) {
106
+ if (context[MATTERMOST_QUESTION_CONTEXT_KEY] !== true) return null;
107
+ const questionId = context.question_id;
108
+ const optionIndex = context.option_index;
109
+ if (typeof questionId !== "string" || !questionId || typeof optionIndex !== "number") return null;
110
+ return Number.isInteger(optionIndex) && optionIndex >= 0 ? {
111
+ questionId,
112
+ optionIndex
113
+ } : null;
114
+ }
96
115
  function resolveMattermostPresentation(params) {
97
116
  const presentation = normalizeMessagePresentation(params.presentation);
117
+ const text = !presentation || params.presentationTextMode === "fallback" && params.text !== void 0 ? params.text ?? "" : renderMessagePresentationFallbackText({
118
+ text: params.text,
119
+ presentation
120
+ });
121
+ const questionOptionIndices = resolveAskUserQuestionOptionIndices({ channelData: params.channelData });
98
122
  return {
99
- text: !presentation || params.presentationTextMode === "fallback" && params.text !== void 0 ? params.text ?? "" : renderMessagePresentationFallbackText({
100
- text: params.text,
101
- presentation
102
- }),
123
+ text,
103
124
  buttons: presentation ? presentation.blocks.filter((block) => block.type === "buttons").map((block) => block.buttons.flatMap((button) => {
104
- if (button.action) return [];
125
+ const action = button.action;
126
+ if (action?.type === "question") {
127
+ if ("intent" in action) return [];
128
+ const optionIndex = resolveAskUserQuestionOptionIndex({
129
+ questionOptionIndices,
130
+ questionId: action.questionId,
131
+ optionValue: action.optionValue
132
+ });
133
+ return optionIndex === void 0 ? [] : [{
134
+ id: `question-${optionIndex}`,
135
+ text: button.label,
136
+ context: {
137
+ [MATTERMOST_QUESTION_CONTEXT_KEY]: true,
138
+ question_id: action.questionId,
139
+ option_index: optionIndex
140
+ },
141
+ style: button.style
142
+ }];
143
+ }
144
+ if (action) return [];
105
145
  const value = resolveMessagePresentationControlValue(button);
106
146
  return value ? [{
107
147
  id: value,
@@ -156,4 +196,4 @@ function looksLikeMattermostTargetId(raw, _normalized) {
156
196
  return /^[a-z0-9]{26}$/i.test(trimmed) || /^[a-z0-9]{26}__[a-z0-9]{26}$/i.test(trimmed);
157
197
  }
158
198
  //#endregion
159
- export { inspectMattermostAccount as a, resolveDefaultMattermostAccountId as c, buildSecretInputSchema as d, hasConfiguredSecretInput as f, resolveMattermostPresentation as i, resolveMattermostAccount as l, normalizeMattermostMessagingTarget as n, isMattermostConfigured as o, requiresMattermostMediaUpload as r, listMattermostAccountIds as s, looksLikeMattermostTargetId as t, resolveMattermostReplyToMode as u };
199
+ export { resolveMattermostPresentation as a, listMattermostAccountIds as c, resolveMattermostReplyToMode as d, buildSecretInputSchema as f, requiresMattermostMediaUpload as i, resolveDefaultMattermostAccountId as l, normalizeMattermostMessagingTarget as n, inspectMattermostAccount as o, hasConfiguredSecretInput as p, parseMattermostQuestionContext as r, isMattermostConfigured as s, looksLikeMattermostTargetId as t, resolveMattermostAccount as u };
@@ -0,0 +1,3 @@
1
+ import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-qg3NXRlS.mjs";
2
+ import "../secret-contract-api.js";
3
+ export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };
@@ -1,8 +1,8 @@
1
- import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
2
- import { c as setInteractionSecret, l as isWildcardBindHost, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-DF1FH27_.js";
3
- import { _ as sendMattermostTyping, a as createMattermostPost, c as fetchMattermostChannelByName, d as fetchMattermostUser, f as fetchMattermostUserByUsername, h as parseMattermostApiStatus, i as createMattermostDirectChannelWithRetry, m as normalizeMattermostBaseUrl, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, u as fetchMattermostMe, y as uploadMattermostFile } from "./client-Dt7Q-j5B.js";
4
- import { _ as logTypingFailure, c as buildPreparedModelsProviderData, f as isRequestBodyLimitError, h as loadOutboundMediaFromUrl, i as normalizeMattermostAllowList, o as resolveMattermostTrustedChatKind, t as authorizeMattermostCommandInvocation, v as readRequestBodyWithLimit, w as sendHttpRequestRejection } from "./monitor-auth-C6RGYyn-.js";
5
- import { i as resolveMattermostPresentation, l as resolveMattermostAccount, r as requiresMattermostMediaUpload } from "./normalize-R-ATEEHC.js";
1
+ import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
2
+ import { c as setInteractionSecret, l as isWildcardBindHost, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-rBQWCbK8.mjs";
3
+ import { a as createMattermostPost, b as uploadMattermostFile, c as fetchMattermostChannelByName, d as fetchMattermostUser, f as fetchMattermostUserByUsername, g as parseMattermostApiStatus, h as normalizeMattermostBaseUrl, i as createMattermostDirectChannelWithRetry, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, u as fetchMattermostMe, v as sendMattermostTyping } from "./client-BSSVve1x.mjs";
4
+ import { D as sendHttpRequestRejection, b as logTypingFailure, h as isRequestBodyLimitError, i as normalizeMattermostAllowList, l as buildPreparedModelsProviderData, o as resolveMattermostTrustedChatKind, p as createWebhookInFlightLimiter, t as authorizeMattermostCommandInvocation, v as loadOutboundMediaFromUrl, x as readRequestBodyWithLimit } from "./monitor-auth-CCpN0z_f.mjs";
5
+ import { a as resolveMattermostPresentation, i as requiresMattermostMediaUpload, u as resolveMattermostAccount } from "./normalize-DM54w7ud.mjs";
6
6
  import { createHash } from "node:crypto";
7
7
  import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
8
8
  import { asFiniteNumber, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -976,23 +976,31 @@ async function resolveMattermostSendContext(to, opts) {
976
976
  const client = createMattermostClient({
977
977
  baseUrl,
978
978
  botToken: token,
979
- allowPrivateNetwork: isPrivateNetworkOptInEnabled(account.config)
980
- });
981
- const trimmedTo = normalizeOptionalString(to) ?? "";
982
- const channelId = await resolveTargetChannelId({
983
- target: parseMattermostTarget((await resolveMattermostOpaqueTarget({
984
- input: trimmedTo,
985
- client
986
- }))?.to ?? trimmedTo),
987
- client,
988
- dmRetryOptions: mergeDmRetryOptions(account.config.dmChannelRetry ? {
989
- maxRetries: account.config.dmChannelRetry.maxRetries,
990
- initialDelayMs: account.config.dmChannelRetry.initialDelayMs,
991
- maxDelayMs: account.config.dmChannelRetry.maxDelayMs,
992
- timeoutMs: account.config.dmChannelRetry.timeoutMs
993
- } : void 0, opts.dmRetryOptions),
994
- logger: core.logging.shouldLogVerbose() ? logger : void 0
979
+ allowPrivateNetwork: isPrivateNetworkOptInEnabled(account.config),
980
+ assertRequestCurrent: opts.assertDirectAdapterHandoff
995
981
  });
982
+ const dmRetryOptions = mergeDmRetryOptions(account.config.dmChannelRetry ? {
983
+ maxRetries: account.config.dmChannelRetry.maxRetries,
984
+ initialDelayMs: account.config.dmChannelRetry.initialDelayMs,
985
+ maxDelayMs: account.config.dmChannelRetry.maxDelayMs,
986
+ timeoutMs: account.config.dmChannelRetry.timeoutMs
987
+ } : void 0, opts.dmRetryOptions);
988
+ let channelId;
989
+ try {
990
+ const trimmedTo = normalizeOptionalString(to) ?? "";
991
+ channelId = await resolveTargetChannelId({
992
+ target: parseMattermostTarget((await resolveMattermostOpaqueTarget({
993
+ input: trimmedTo,
994
+ client
995
+ }))?.to ?? trimmedTo),
996
+ client,
997
+ dmRetryOptions,
998
+ logger: core.logging.shouldLogVerbose() ? logger : void 0
999
+ });
1000
+ } catch (error) {
1001
+ client.assertRequestCurrent?.();
1002
+ throw error;
1003
+ }
996
1004
  return {
997
1005
  cfg,
998
1006
  accountId: account.accountId,
@@ -1009,6 +1017,7 @@ async function sendMessageMattermost(to, text, opts) {
1009
1017
  const core = getCore();
1010
1018
  const logger = core.logging.getChildLogger({ module: "mattermost" });
1011
1019
  const { cfg, accountId, client, channelId, mediaMaxBytes } = await resolveMattermostSendContext(to, opts);
1020
+ client.assertRequestCurrent?.();
1012
1021
  let props = opts.props;
1013
1022
  if (!props && Array.isArray(opts.buttons) && opts.buttons.length > 0) {
1014
1023
  setInteractionSecret(accountId, client.token);
@@ -1044,6 +1053,7 @@ async function sendMessageMattermost(to, text, opts) {
1044
1053
  contentType: media.contentType ?? void 0
1045
1054
  })).id];
1046
1055
  } catch (err) {
1056
+ client.assertRequestCurrent?.();
1047
1057
  uploadError = err instanceof Error ? err : new Error(String(err));
1048
1058
  if (opts.requireMediaUpload || mediaMaxBytes !== void 0) throw new Error(`Mattermost media upload failed: ${uploadError.message}`, { cause: err });
1049
1059
  if (core.logging.shouldLogVerbose()) logger.debug?.(`mattermost send: media upload failed, falling back to URL text: ${String(err)}`);
@@ -1061,6 +1071,13 @@ async function sendMessageMattermost(to, text, opts) {
1061
1071
  if (uploadError) throw new Error(`Mattermost media upload failed: ${uploadError.message}`, { cause: uploadError });
1062
1072
  throw new Error("Mattermost message is empty");
1063
1073
  }
1074
+ client.assertRequestCurrent?.();
1075
+ try {
1076
+ await opts.onPlatformSendDispatch?.();
1077
+ } catch (error) {
1078
+ client.assertRequestCurrent?.();
1079
+ throw error;
1080
+ }
1064
1081
  const post = await createMattermostPost(client, {
1065
1082
  channelId,
1066
1083
  message,
@@ -1423,7 +1440,7 @@ async function authorizeSlashInvocation(params) {
1423
1440
  */
1424
1441
  function createSlashCommandHttpHandler(params) {
1425
1442
  const { account, cfg, runtime, registeredCommands, triggerMap, log, bodyTimeoutMs } = params;
1426
- return async (req, res, bufferedBody) => {
1443
+ return async (req, res, bufferedBody, onRequestAuthenticated) => {
1427
1444
  if (req.method !== "POST") {
1428
1445
  res.statusCode = 405;
1429
1446
  res.setHeader("Allow", "POST");
@@ -1454,7 +1471,7 @@ function createSlashCommandHttpHandler(params) {
1454
1471
  registeredCommands,
1455
1472
  payload
1456
1473
  });
1457
- if (registeredCommands.length === 0 || !registeredCommand || !safeEqualSecret(payload.token, registeredCommand.token)) {
1474
+ if (!registeredCommand || !safeEqualSecret(payload.token, registeredCommand.token)) {
1458
1475
  sendJsonResponse(res, 401, {
1459
1476
  response_type: "ephemeral",
1460
1477
  text: "Unauthorized: invalid command token."
@@ -1479,6 +1496,7 @@ function createSlashCommandHttpHandler(params) {
1479
1496
  });
1480
1497
  return;
1481
1498
  }
1499
+ onRequestAuthenticated?.();
1482
1500
  const trigger = normalizeSlashCommandTrigger(payload.command);
1483
1501
  const commandText = resolveCommandText(trigger, payload.text, triggerMap);
1484
1502
  const channelId = payload.channel_id;
@@ -1554,9 +1572,14 @@ async function handleSlashCommandAsync(params) {
1554
1572
  const to = kind === "direct" ? `user:${senderId}` : `channel:${channelId}`;
1555
1573
  const pickerEntry = resolveMattermostModelPickerEntry(commandText);
1556
1574
  if (pickerEntry) {
1557
- const data = await buildPreparedModelsProviderData(cfg, route.agentId);
1575
+ const sessionEntry = getSessionEntry({
1576
+ storePath: resolveStorePath(cfg.session?.store, { agentId: route.agentId }),
1577
+ sessionKey: route.sessionKey,
1578
+ readConsistency: "latest"
1579
+ });
1580
+ const data = await buildPreparedModelsProviderData(cfg, route.agentId, { sessionEntry });
1558
1581
  if (data.providers.length === 0) {
1559
- await sendMessageMattermost(`channel:${channelId}`, "No models available.", {
1582
+ await sendMessageMattermost(`channel:${channelId}`, [data.refreshWarning, "No models available."].filter(Boolean).join("\n\n"), {
1560
1583
  cfg,
1561
1584
  accountId: account.accountId
1562
1585
  });
@@ -1581,7 +1604,7 @@ async function handleSlashCommandAsync(params) {
1581
1604
  page: 1,
1582
1605
  currentModel
1583
1606
  });
1584
- await sendMessageMattermost(`channel:${channelId}`, view.text, {
1607
+ await sendMessageMattermost(`channel:${channelId}`, [data.refreshWarning, view.text].filter(Boolean).join("\n\n"), {
1585
1608
  cfg,
1586
1609
  accountId: account.accountId,
1587
1610
  buttons: view.buttons
@@ -1623,7 +1646,6 @@ async function handleSlashCommandAsync(params) {
1623
1646
  channel: "mattermost",
1624
1647
  accountId: account.accountId
1625
1648
  });
1626
- const humanDelay = resolveHumanDelayConfig(cfg, route.agentId);
1627
1649
  await core.channel.inbound.dispatch({
1628
1650
  cfg,
1629
1651
  channel: "mattermost",
@@ -1666,14 +1688,28 @@ async function handleSlashCommandAsync(params) {
1666
1688
  });
1667
1689
  }
1668
1690
  } },
1669
- dispatcherOptions: { humanDelay },
1691
+ dispatcherOptions: { humanDelay: resolveHumanDelayConfig(cfg, route.agentId) },
1670
1692
  replyOptions: { disableBlockStreaming: typeof account.blockStreaming === "boolean" ? !account.blockStreaming : void 0 }
1671
1693
  });
1672
1694
  }
1673
1695
  //#endregion
1674
1696
  //#region extensions/mattermost/src/mattermost/slash-state.ts
1697
+ /**
1698
+ * Shared state for Mattermost slash commands.
1699
+ *
1700
+ * Bridges the plugin registration phase (HTTP route) with the monitor phase
1701
+ * (command registration with MM API). The HTTP handler needs to know which
1702
+ * tokens are known for fast-path routing, and the monitor needs to store
1703
+ * registered command IDs.
1704
+ *
1705
+ * State is kept per-account so that multi-account deployments don't
1706
+ * overwrite each other's tokens, registered commands, or handlers.
1707
+ */
1675
1708
  const MULTI_ACCOUNT_BODY_MAX_BYTES = 65536;
1676
1709
  const MULTI_ACCOUNT_BODY_TIMEOUT_MS = 5e3;
1710
+ const slashRouteInFlightLimiter = createWebhookInFlightLimiter();
1711
+ const SLASH_ROUTE_IN_FLIGHT_KEY = "mattermost:slash";
1712
+ const SLASH_AUTHENTICATED_IN_FLIGHT_KEY = `${SLASH_ROUTE_IN_FLIGHT_KEY}:authenticated`;
1677
1713
  /**
1678
1714
  * Map from accountId → per-account slash command state.
1679
1715
  *
@@ -1693,6 +1729,13 @@ function getSlashAccountStates() {
1693
1729
  return accountStates;
1694
1730
  }
1695
1731
  const accountStates = getSlashAccountStates();
1732
+ function resolveSlashRouteInFlightKey(authorization) {
1733
+ const token = authorization?.match(/^Token ([^,\s]+)$/iu)?.[1];
1734
+ if (!token) return SLASH_ROUTE_IN_FLIGHT_KEY;
1735
+ let matched = false;
1736
+ for (const state of accountStates.values()) for (const commandToken of state.commandTokens) matched = safeEqualSecret(token, commandToken) || matched;
1737
+ return matched ? `${SLASH_AUTHENTICATED_IN_FLIGHT_KEY}:${createHash("sha256").update(`${SLASH_AUTHENTICATED_IN_FLIGHT_KEY}:${token}`).digest("hex")}` : SLASH_ROUTE_IN_FLIGHT_KEY;
1738
+ }
1696
1739
  function resolveSlashHandlerForToken(token) {
1697
1740
  const matches = [];
1698
1741
  for (const [accountId, state] of accountStates) if (state.commandTokens.has(token) && state.handler) matches.push({
@@ -1822,7 +1865,7 @@ function registerSlashCommandRoute(api) {
1822
1865
  const accountCommandsRaw = accountsRaw[accountId]?.commands;
1823
1866
  addCallbackPaths(accountCommandsRaw);
1824
1867
  }
1825
- const routeHandler = async (req, res) => {
1868
+ const dispatchRoute = async (req, res, onRequestAuthenticated) => {
1826
1869
  if (accountStates.size === 0) {
1827
1870
  res.statusCode = 503;
1828
1871
  res.setHeader("Content-Type", "application/json; charset=utf-8");
@@ -1843,7 +1886,7 @@ function registerSlashCommandRoute(api) {
1843
1886
  }));
1844
1887
  return;
1845
1888
  }
1846
- await state.handler(req, res);
1889
+ await state.handler(req, res, void 0, onRequestAuthenticated);
1847
1890
  return;
1848
1891
  }
1849
1892
  let bodyStr;
@@ -1895,7 +1938,25 @@ function registerSlashCommandRoute(api) {
1895
1938
  }));
1896
1939
  return;
1897
1940
  }
1898
- await match.handler(req, res, bodyStr);
1941
+ await match.handler(req, res, bodyStr, onRequestAuthenticated);
1942
+ };
1943
+ const routeHandler = async (req, res) => {
1944
+ const inFlightKey = resolveSlashRouteInFlightKey(req.headers.authorization);
1945
+ if (!slashRouteInFlightLimiter.tryAcquire(inFlightKey)) {
1946
+ await sendHttpRequestRejection(req, res, 429, "Too Many Requests");
1947
+ return;
1948
+ }
1949
+ let released = false;
1950
+ const release = () => {
1951
+ if (released) return;
1952
+ released = true;
1953
+ slashRouteInFlightLimiter.release(inFlightKey);
1954
+ };
1955
+ try {
1956
+ await dispatchRoute(req, res, release);
1957
+ } finally {
1958
+ release();
1959
+ }
1899
1960
  };
1900
1961
  for (const callbackPath of callbackPaths) api.registerHttpRoute({
1901
1962
  path: callbackPath,
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as buildButtonAttachments } from "./interactions-DF1FH27_.js";
2
- import { r as isMattermostSenderAllowed } from "./monitor-auth-C6RGYyn-.js";
1
+ import { t as buildButtonAttachments } from "./.setup/interactions-rBQWCbK8.mjs";
2
+ import { r as isMattermostSenderAllowed } from "./.setup/monitor-auth-CCpN0z_f.mjs";
3
3
  export { buildButtonAttachments, isMattermostSenderAllowed };
@@ -1,40 +1,3 @@
1
- import { o as isMattermostConfigured } from "./normalize-R-ATEEHC.js";
2
- import { a as describeMattermostAccount, i as MattermostChannelConfigSchema, n as mattermostSetupWizard, o as mattermostConfigAdapter, r as mattermostSetupContract, s as mattermostMeta, t as mattermostPlugin } from "./channel-plugin-runtime-Dhr44A2Y.js";
3
- import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.js";
4
- //#region extensions/mattermost/src/channel.setup.ts
5
- const mattermostSetupPlugin = {
6
- id: "mattermost",
7
- meta: { ...mattermostMeta },
8
- capabilities: {
9
- chatTypes: [
10
- "direct",
11
- "channel",
12
- "group",
13
- "thread"
14
- ],
15
- reactions: true,
16
- threads: true,
17
- media: true,
18
- nativeCommands: true
19
- },
20
- reload: {
21
- configPrefixes: ["channels.mattermost"],
22
- noopPrefixes: ["messages.inbound"],
23
- /**
24
- * accounts.default is promoted; named resolution merges only channel-wide fields
25
- * plus the selected account. Runtime monitor, debounce, and ingress use accountId.
26
- */
27
- accountScopedRestart: true
28
- },
29
- configSchema: MattermostChannelConfigSchema,
30
- config: {
31
- ...mattermostConfigAdapter,
32
- isConfigured: isMattermostConfigured,
33
- describeAccount: describeMattermostAccount
34
- },
35
- gateway: { resolveGatewayAuthBypassPaths: resolveMattermostGatewayAuthBypassPaths },
36
- setupContract: mattermostSetupContract,
37
- setupWizard: mattermostSetupWizard
38
- };
39
- //#endregion
1
+ import { t as mattermostPlugin } from "./.setup/channel-plugin-runtime-yAOg5GcM.mjs";
2
+ import { t as mattermostSetupPlugin } from "./.setup/channel-plugin-api-CzBhdovL.mjs";
40
3
  export { mattermostPlugin, mattermostSetupPlugin };
@@ -1,2 +1,2 @@
1
- import { t as mattermostPlugin } from "./channel-plugin-runtime-Dhr44A2Y.js";
1
+ import { t as mattermostPlugin } from "./.setup/channel-plugin-runtime-yAOg5GcM.mjs";
2
2
  export { mattermostPlugin };
@@ -1,2 +1,2 @@
1
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-mvORF4f6.js";
1
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./.setup/doctor-contract-mvORF4f6.mjs";
2
2
  export { legacyConfigRules, normalizeCompatibilityConfig };
@@ -1,2 +1,2 @@
1
- import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.js";
1
+ import { t as resolveMattermostGatewayAuthBypassPaths } from "./.setup/gateway-auth-bypass-B93t91oq.mjs";
2
2
  export { resolveMattermostGatewayAuthBypassPaths as resolveGatewayAuthBypassPaths };
@@ -1,2 +1,2 @@
1
- import { r as isMattermostSenderAllowed } from "./monitor-auth-C6RGYyn-.js";
1
+ import { r as isMattermostSenderAllowed } from "./.setup/monitor-auth-CCpN0z_f.mjs";
2
2
  export { isMattermostSenderAllowed };