@openclaw/slack 2026.7.2-beta.7 → 2026.7.33

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 (1339) hide show
  1. package/README.md +1 -1
  2. package/dist/.setup/account-configured-DzC407uv.mjs +14 -0
  3. package/dist/.setup/account-inspect-CcqRNkC3.mjs +79 -0
  4. package/dist/.setup/account-reply-mode-Bvoq75cS.mjs +15 -0
  5. package/dist/.setup/accounts-uGn8E6uq.mjs +187 -0
  6. package/dist/.setup/accounts.runtime-k_V5-EOr.mjs +2 -0
  7. package/dist/.setup/action-runtime-iq6ZxO_b.mjs +395 -0
  8. package/dist/.setup/action-runtime.runtime-DXY8CdWJ.mjs +2 -0
  9. package/dist/.setup/actions-2VEX4Wdz.mjs +950 -0
  10. package/dist/.setup/actions.runtime-CfX8mK8Y.mjs +2 -0
  11. package/dist/.setup/approval-handler.runtime-COMbf4Ud.mjs +368 -0
  12. package/dist/.setup/channel-BqOekthS.mjs +1120 -0
  13. package/dist/.setup/channel.setup-DBlZCEvc.mjs +73 -0
  14. package/dist/.setup/client-B6i83rHk.mjs +116 -0
  15. package/dist/.setup/config-api-DnT9ohtE.mjs +2 -0
  16. package/dist/.setup/config-schema-DV93lEJ7.mjs +227 -0
  17. package/dist/.setup/directory-config-DB0OcZzw.mjs +55 -0
  18. package/dist/.setup/directory-live-O3jkDEJH.mjs +131 -0
  19. package/dist/.setup/doctor-contract-Dxk57DKz.mjs +147 -0
  20. package/dist/.setup/format-xuAop9a-.mjs +108 -0
  21. package/dist/.setup/interactive-replies-BLw4HEPS.mjs +193 -0
  22. package/dist/.setup/message-tool-api-D2m68v1f.mjs +128 -0
  23. package/dist/.setup/monitor-jTrujB_u.mjs +13 -0
  24. package/dist/.setup/outbound-adapter-DwAvZVk8.mjs +273 -0
  25. package/dist/.setup/pipeline.runtime-qFsXbTJf.mjs +3646 -0
  26. package/dist/.setup/plugin-routes-C3X0eVaK.mjs +22 -0
  27. package/dist/.setup/policy-C6VVHqUf.mjs +67 -0
  28. package/dist/.setup/probe-tmU762D2.mjs +48 -0
  29. package/dist/.setup/provider-Bjv1R5E2.mjs +4720 -0
  30. package/dist/.setup/relay-source-DR--lDW8.mjs +289 -0
  31. package/dist/.setup/replies-BO37R07g.mjs +288 -0
  32. package/dist/.setup/reply-blocks-Cwu6LYJI.mjs +882 -0
  33. package/dist/.setup/resolve-allowlist-common-CP8SH0Zf.mjs +43 -0
  34. package/dist/.setup/resolve-channels-CivvCeZv.mjs +81 -0
  35. package/dist/.setup/resolve-users-D5Qb64BJ.mjs +113 -0
  36. package/dist/.setup/rolldown-runtime-D7D4PA-g.mjs +13 -0
  37. package/dist/.setup/runtime-BOk7xkOl.mjs +8 -0
  38. package/dist/.setup/runtime-api-BnavgpzD.mjs +9 -0
  39. package/dist/.setup/runtime-setter-api-C-6lgBvk.mjs +3 -0
  40. package/dist/.setup/scopes-CYSKlU91.mjs +74 -0
  41. package/dist/.setup/secret-contract-C3ChHo5A.mjs +181 -0
  42. package/dist/.setup/secret-contract-api-CcCSHlV7.mjs +3 -0
  43. package/dist/.setup/security-audit-HMEYeSrJ.mjs +51 -0
  44. package/dist/.setup/send-DEOvcVM4.mjs +933 -0
  45. package/dist/.setup/send.runtime-Bmals7DV.mjs +2 -0
  46. package/dist/.setup/setup-core-uPGudyJH.mjs +344 -0
  47. package/dist/.setup/setup-plugin-api-DMKdqvij.mjs +3 -0
  48. package/dist/.setup/setup-surface-_4luZsPQ.mjs +130 -0
  49. package/dist/.setup/shared-BqyNq0up.mjs +269 -0
  50. package/dist/.setup/slash-dispatch.runtime-eyQo6mTA.mjs +32 -0
  51. package/dist/.setup/streaming-compat-DjlgH-Be.mjs +43 -0
  52. package/dist/.setup/target-parsing-C36VFWHQ.mjs +65 -0
  53. package/dist/.setup/targets-DnpzC22e.mjs +13 -0
  54. package/dist/account-inspect-api.js +1 -1
  55. package/dist/api.js +19 -18
  56. package/dist/channel-config-api.js +1 -1
  57. package/dist/channel-plugin-api.js +1 -1
  58. package/dist/configured-state.js +11 -0
  59. package/dist/directory-contract-api.js +1 -1
  60. package/dist/doctor-contract-api.js +1 -1
  61. package/dist/http-routes-api.js +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/interactive-replies-api.js +2 -0
  64. package/dist/message-tool-api.js +1 -1
  65. package/dist/runtime-api.js +13 -13
  66. package/dist/runtime-setter-api.js +1 -1
  67. package/dist/secret-contract-api.js +1 -1
  68. package/dist/security-contract-api.js +1 -1
  69. package/dist/setup-entry.js +5 -4
  70. package/dist/setup-plugin-api.js +1 -1
  71. package/node_modules/@slack/bolt/dist/App.d.ts +19 -4
  72. package/node_modules/@slack/bolt/dist/App.d.ts.map +1 -1
  73. package/node_modules/@slack/bolt/dist/App.js +40 -21
  74. package/node_modules/@slack/bolt/dist/App.js.map +1 -1
  75. package/node_modules/@slack/bolt/dist/WorkflowStep.d.ts +159 -0
  76. package/node_modules/@slack/bolt/dist/WorkflowStep.d.ts.map +1 -0
  77. package/node_modules/@slack/bolt/dist/WorkflowStep.js +217 -0
  78. package/node_modules/@slack/bolt/dist/WorkflowStep.js.map +1 -0
  79. package/node_modules/@slack/bolt/dist/context/create-respond.d.ts +3 -3
  80. package/node_modules/@slack/bolt/dist/context/create-respond.d.ts.map +1 -1
  81. package/node_modules/@slack/bolt/dist/context/create-respond.js +2 -13
  82. package/node_modules/@slack/bolt/dist/context/create-respond.js.map +1 -1
  83. package/node_modules/@slack/bolt/dist/errors.d.ts +8 -6
  84. package/node_modules/@slack/bolt/dist/errors.d.ts.map +1 -1
  85. package/node_modules/@slack/bolt/dist/errors.js +11 -11
  86. package/node_modules/@slack/bolt/dist/errors.js.map +1 -1
  87. package/node_modules/@slack/bolt/dist/helpers.d.ts.map +1 -1
  88. package/node_modules/@slack/bolt/dist/helpers.js +2 -1
  89. package/node_modules/@slack/bolt/dist/helpers.js.map +1 -1
  90. package/node_modules/@slack/bolt/dist/index.d.ts +1 -0
  91. package/node_modules/@slack/bolt/dist/index.d.ts.map +1 -1
  92. package/node_modules/@slack/bolt/dist/index.js +3 -1
  93. package/node_modules/@slack/bolt/dist/index.js.map +1 -1
  94. package/node_modules/@slack/bolt/dist/receivers/AwsLambdaReceiver.d.ts +1 -10
  95. package/node_modules/@slack/bolt/dist/receivers/AwsLambdaReceiver.d.ts.map +1 -1
  96. package/node_modules/@slack/bolt/dist/receivers/AwsLambdaReceiver.js +1 -5
  97. package/node_modules/@slack/bolt/dist/receivers/AwsLambdaReceiver.js.map +1 -1
  98. package/node_modules/@slack/bolt/dist/receivers/HTTPModuleFunctions.d.ts.map +1 -1
  99. package/node_modules/@slack/bolt/dist/receivers/HTTPModuleFunctions.js +14 -10
  100. package/node_modules/@slack/bolt/dist/receivers/HTTPModuleFunctions.js.map +1 -1
  101. package/node_modules/@slack/bolt/dist/receivers/SocketModeFunctions.d.ts.map +1 -1
  102. package/node_modules/@slack/bolt/dist/receivers/SocketModeFunctions.js +1 -1
  103. package/node_modules/@slack/bolt/dist/receivers/SocketModeFunctions.js.map +1 -1
  104. package/node_modules/@slack/bolt/dist/receivers/SocketModeReceiver.d.ts +1 -3
  105. package/node_modules/@slack/bolt/dist/receivers/SocketModeReceiver.d.ts.map +1 -1
  106. package/node_modules/@slack/bolt/dist/receivers/SocketModeReceiver.js +1 -2
  107. package/node_modules/@slack/bolt/dist/receivers/SocketModeReceiver.js.map +1 -1
  108. package/node_modules/@slack/bolt/dist/types/actions/index.d.ts +4 -2
  109. package/node_modules/@slack/bolt/dist/types/actions/index.d.ts.map +1 -1
  110. package/node_modules/@slack/bolt/dist/types/actions/index.js +2 -0
  111. package/node_modules/@slack/bolt/dist/types/actions/index.js.map +1 -1
  112. package/node_modules/@slack/bolt/dist/types/actions/workflow-step-edit.d.ts +49 -0
  113. package/node_modules/@slack/bolt/dist/types/actions/workflow-step-edit.d.ts.map +1 -0
  114. package/node_modules/@slack/bolt/dist/types/actions/workflow-step-edit.js +3 -0
  115. package/node_modules/@slack/bolt/dist/types/actions/workflow-step-edit.js.map +1 -0
  116. package/node_modules/@slack/bolt/dist/types/events/index.d.ts +0 -2
  117. package/node_modules/@slack/bolt/dist/types/events/index.d.ts.map +1 -1
  118. package/node_modules/@slack/bolt/dist/types/utilities.d.ts +2 -2
  119. package/node_modules/@slack/bolt/dist/types/utilities.d.ts.map +1 -1
  120. package/node_modules/@slack/bolt/dist/types/view/index.d.ts +31 -1
  121. package/node_modules/@slack/bolt/dist/types/view/index.d.ts.map +1 -1
  122. package/node_modules/@slack/bolt/node_modules/@slack/logger/README.md +1 -1
  123. package/node_modules/@slack/bolt/node_modules/@slack/logger/dist/index.js +13 -17
  124. package/node_modules/@slack/bolt/node_modules/@slack/logger/dist/index.js.map +1 -1
  125. package/node_modules/@slack/bolt/node_modules/@slack/logger/package.json +7 -6
  126. package/node_modules/@slack/bolt/node_modules/@slack/oauth/README.md +1 -1
  127. package/node_modules/@slack/bolt/node_modules/@slack/oauth/dist/errors.d.ts +14 -25
  128. package/node_modules/@slack/bolt/node_modules/@slack/oauth/dist/errors.d.ts.map +1 -1
  129. package/node_modules/@slack/bolt/node_modules/@slack/oauth/dist/errors.js +33 -24
  130. package/node_modules/@slack/bolt/node_modules/@slack/oauth/dist/errors.js.map +1 -1
  131. package/node_modules/@slack/bolt/node_modules/@slack/oauth/dist/install-provider.js +16 -58
  132. package/node_modules/@slack/bolt/node_modules/@slack/oauth/dist/install-provider.js.map +1 -1
  133. package/node_modules/@slack/bolt/node_modules/@slack/oauth/dist/installation-stores/file-store.js +2 -4
  134. package/node_modules/@slack/bolt/node_modules/@slack/oauth/dist/installation-stores/file-store.js.map +1 -1
  135. package/node_modules/@slack/bolt/node_modules/@slack/oauth/dist/installation-stores/memory-store.js +16 -3
  136. package/node_modules/@slack/bolt/node_modules/@slack/oauth/dist/installation-stores/memory-store.js.map +1 -1
  137. package/node_modules/@slack/bolt/node_modules/@slack/oauth/dist/state-stores/clear-state-store.js +0 -2
  138. package/node_modules/@slack/bolt/node_modules/@slack/oauth/dist/state-stores/clear-state-store.js.map +1 -1
  139. package/node_modules/@slack/bolt/node_modules/@slack/oauth/dist/state-stores/file-state-store.js +0 -3
  140. package/node_modules/@slack/bolt/node_modules/@slack/oauth/dist/state-stores/file-state-store.js.map +1 -1
  141. package/node_modules/@slack/bolt/node_modules/@slack/oauth/package.json +9 -8
  142. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/README.md +221 -0
  143. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/package.json +67 -0
  144. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.d.ts +96 -0
  145. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.d.ts.map +1 -0
  146. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js +242 -0
  147. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js.map +1 -0
  148. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SocketModeClient.d.ts +98 -0
  149. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SocketModeClient.d.ts.map +1 -0
  150. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SocketModeClient.js +363 -0
  151. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SocketModeClient.js.map +1 -0
  152. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SocketModeOptions.d.ts +47 -0
  153. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/SocketModeOptions.d.ts.map +1 -0
  154. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/errors.d.ts +60 -0
  155. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/errors.d.ts.map +1 -0
  156. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/errors.js +68 -0
  157. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/errors.js.map +1 -0
  158. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/index.d.ts +6 -0
  159. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/index.d.ts.map +1 -0
  160. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/index.js +13 -0
  161. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/dist/src/index.js.map +1 -0
  162. package/node_modules/@slack/bolt/node_modules/@slack/socket-mode/package.json +67 -0
  163. package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
  164. package/node_modules/@slack/bolt/node_modules/@types/node/fs/promises.d.ts +6 -16
  165. package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
  166. package/node_modules/@slack/bolt/node_modules/@types/ws/README.md +15 -0
  167. package/node_modules/@slack/bolt/node_modules/@types/ws/index.d.mts +451 -0
  168. package/node_modules/@slack/bolt/node_modules/@types/ws/index.d.ts +445 -0
  169. package/node_modules/@slack/bolt/node_modules/@types/ws/package.json +72 -0
  170. package/node_modules/@slack/bolt/node_modules/agent-base/README.md +145 -0
  171. package/node_modules/@slack/bolt/node_modules/agent-base/dist/src/index.d.ts +78 -0
  172. package/node_modules/@slack/bolt/node_modules/agent-base/dist/src/index.js +203 -0
  173. package/node_modules/@slack/bolt/node_modules/agent-base/dist/src/index.js.map +1 -0
  174. package/node_modules/@slack/bolt/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
  175. package/node_modules/@slack/bolt/node_modules/agent-base/dist/src/promisify.js +18 -0
  176. package/node_modules/@slack/bolt/node_modules/agent-base/dist/src/promisify.js.map +1 -0
  177. package/node_modules/@slack/bolt/node_modules/agent-base/package.json +64 -0
  178. package/node_modules/@slack/bolt/node_modules/agent-base/src/index.ts +345 -0
  179. package/node_modules/@slack/bolt/node_modules/agent-base/src/promisify.ts +33 -0
  180. package/node_modules/@slack/bolt/node_modules/asynckit/LICENSE +21 -0
  181. package/node_modules/@slack/bolt/node_modules/asynckit/README.md +233 -0
  182. package/node_modules/@slack/bolt/node_modules/asynckit/bench.js +76 -0
  183. package/node_modules/@slack/bolt/node_modules/asynckit/index.js +6 -0
  184. package/node_modules/@slack/bolt/node_modules/asynckit/lib/abort.js +29 -0
  185. package/node_modules/@slack/bolt/node_modules/asynckit/lib/async.js +34 -0
  186. package/node_modules/@slack/bolt/node_modules/asynckit/lib/defer.js +26 -0
  187. package/node_modules/@slack/bolt/node_modules/asynckit/lib/iterate.js +75 -0
  188. package/node_modules/@slack/bolt/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  189. package/node_modules/@slack/bolt/node_modules/asynckit/lib/readable_parallel.js +25 -0
  190. package/node_modules/@slack/bolt/node_modules/asynckit/lib/readable_serial.js +25 -0
  191. package/node_modules/@slack/bolt/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  192. package/node_modules/@slack/bolt/node_modules/asynckit/lib/state.js +37 -0
  193. package/node_modules/@slack/bolt/node_modules/asynckit/lib/streamify.js +141 -0
  194. package/node_modules/@slack/bolt/node_modules/asynckit/lib/terminator.js +29 -0
  195. package/node_modules/@slack/bolt/node_modules/asynckit/package.json +63 -0
  196. package/node_modules/@slack/bolt/node_modules/asynckit/parallel.js +43 -0
  197. package/node_modules/@slack/bolt/node_modules/asynckit/serial.js +17 -0
  198. package/node_modules/@slack/bolt/node_modules/asynckit/serialOrdered.js +75 -0
  199. package/node_modules/@slack/bolt/node_modules/asynckit/stream.js +21 -0
  200. package/node_modules/@slack/bolt/node_modules/axios/CHANGELOG.md +1934 -0
  201. package/node_modules/@slack/bolt/node_modules/axios/LICENSE +7 -0
  202. package/node_modules/@slack/bolt/node_modules/axios/MIGRATION_GUIDE.md +877 -0
  203. package/node_modules/@slack/bolt/node_modules/axios/README.md +2851 -0
  204. package/node_modules/@slack/bolt/node_modules/axios/dist/axios.js +5807 -0
  205. package/node_modules/@slack/bolt/node_modules/axios/dist/axios.min.js +5 -0
  206. package/node_modules/@slack/bolt/node_modules/axios/dist/axios.min.js.map +1 -0
  207. package/node_modules/@slack/bolt/node_modules/axios/dist/browser/axios.cjs +5829 -0
  208. package/node_modules/@slack/bolt/node_modules/axios/dist/esm/axios.js +5850 -0
  209. package/node_modules/@slack/bolt/node_modules/axios/dist/esm/axios.min.js +3 -0
  210. package/node_modules/@slack/bolt/node_modules/axios/dist/esm/axios.min.js.map +1 -0
  211. package/node_modules/@slack/bolt/node_modules/axios/dist/node/axios.cjs +6808 -0
  212. package/node_modules/@slack/bolt/node_modules/axios/index.d.cts +766 -0
  213. package/node_modules/@slack/bolt/node_modules/axios/index.d.ts +787 -0
  214. package/node_modules/@slack/bolt/node_modules/axios/index.js +45 -0
  215. package/node_modules/@slack/bolt/node_modules/axios/lib/adapters/README.md +36 -0
  216. package/node_modules/@slack/bolt/node_modules/axios/lib/adapters/adapters.js +132 -0
  217. package/node_modules/@slack/bolt/node_modules/axios/lib/adapters/fetch.js +696 -0
  218. package/node_modules/@slack/bolt/node_modules/axios/lib/adapters/http.js +1490 -0
  219. package/node_modules/@slack/bolt/node_modules/axios/lib/adapters/xhr.js +277 -0
  220. package/node_modules/@slack/bolt/node_modules/axios/lib/axios.js +89 -0
  221. package/node_modules/@slack/bolt/node_modules/axios/lib/cancel/CancelToken.js +135 -0
  222. package/node_modules/@slack/bolt/node_modules/axios/lib/cancel/CanceledError.js +22 -0
  223. package/node_modules/@slack/bolt/node_modules/axios/lib/cancel/isCancel.js +5 -0
  224. package/node_modules/@slack/bolt/node_modules/axios/lib/core/Axios.js +306 -0
  225. package/node_modules/@slack/bolt/node_modules/axios/lib/core/AxiosError.js +219 -0
  226. package/node_modules/@slack/bolt/node_modules/axios/lib/core/AxiosHeaders.js +474 -0
  227. package/node_modules/@slack/bolt/node_modules/axios/lib/core/InterceptorManager.js +171 -0
  228. package/node_modules/@slack/bolt/node_modules/axios/lib/core/README.md +8 -0
  229. package/node_modules/@slack/bolt/node_modules/axios/lib/core/buildFullPath.js +76 -0
  230. package/node_modules/@slack/bolt/node_modules/axios/lib/core/dispatchRequest.js +95 -0
  231. package/node_modules/@slack/bolt/node_modules/axios/lib/core/mergeConfig.js +174 -0
  232. package/node_modules/@slack/bolt/node_modules/axios/lib/core/methodList.js +17 -0
  233. package/node_modules/@slack/bolt/node_modules/axios/lib/core/setFormDataHeaders.js +27 -0
  234. package/node_modules/@slack/bolt/node_modules/axios/lib/core/settle.js +27 -0
  235. package/node_modules/@slack/bolt/node_modules/axios/lib/core/transformData.js +28 -0
  236. package/node_modules/@slack/bolt/node_modules/axios/lib/defaults/index.js +178 -0
  237. package/node_modules/@slack/bolt/node_modules/axios/lib/defaults/transitional.js +10 -0
  238. package/node_modules/@slack/bolt/node_modules/axios/lib/env/README.md +3 -0
  239. package/node_modules/@slack/bolt/node_modules/axios/lib/env/classes/FormData.js +2 -0
  240. package/node_modules/@slack/bolt/node_modules/axios/lib/env/data.js +1 -0
  241. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/AxiosTransformStream.js +156 -0
  242. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +59 -0
  243. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/Http2Sessions.js +121 -0
  244. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/HttpStatusCode.js +88 -0
  245. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/README.md +7 -0
  246. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +29 -0
  247. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/bind.js +14 -0
  248. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/buildURL.js +69 -0
  249. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/callbackify.js +18 -0
  250. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/combineURLs.js +23 -0
  251. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/composeSignals.js +68 -0
  252. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/cookies.js +64 -0
  253. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/deprecatedMethod.js +31 -0
  254. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +166 -0
  255. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/formDataToJSON.js +125 -0
  256. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/formDataToStream.js +119 -0
  257. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/fromDataURI.js +69 -0
  258. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/isAbsoluteURL.js +19 -0
  259. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
  260. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/isURLSameOrigin.js +16 -0
  261. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
  262. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/null.js +2 -0
  263. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/parseHeaders.js +71 -0
  264. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
  265. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/progressEventReducer.js +54 -0
  266. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/readBlob.js +15 -0
  267. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/resolveConfig.js +107 -0
  268. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
  269. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/shouldBypassProxy.js +505 -0
  270. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/speedometer.js +55 -0
  271. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/spread.js +28 -0
  272. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/throttle.js +45 -0
  273. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/toFormData.js +279 -0
  274. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/toURLEncodedForm.js +19 -0
  275. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/trackStream.js +89 -0
  276. package/node_modules/@slack/bolt/node_modules/axios/lib/helpers/validator.js +112 -0
  277. package/node_modules/@slack/bolt/node_modules/axios/lib/platform/browser/classes/Blob.js +3 -0
  278. package/node_modules/@slack/bolt/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
  279. package/node_modules/@slack/bolt/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +4 -0
  280. package/node_modules/@slack/bolt/node_modules/axios/lib/platform/browser/index.js +13 -0
  281. package/node_modules/@slack/bolt/node_modules/axios/lib/platform/common/utils.js +52 -0
  282. package/node_modules/@slack/bolt/node_modules/axios/lib/platform/index.js +7 -0
  283. package/node_modules/@slack/bolt/node_modules/axios/lib/platform/node/classes/Buffer.js +11 -0
  284. package/node_modules/@slack/bolt/node_modules/axios/lib/platform/node/classes/FormData.js +3 -0
  285. package/node_modules/@slack/bolt/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +4 -0
  286. package/node_modules/@slack/bolt/node_modules/axios/lib/platform/node/index.js +37 -0
  287. package/node_modules/@slack/bolt/node_modules/axios/lib/utils.js +1150 -0
  288. package/node_modules/@slack/bolt/node_modules/axios/package.json +203 -0
  289. package/node_modules/@slack/bolt/node_modules/combined-stream/License +19 -0
  290. package/node_modules/@slack/bolt/node_modules/combined-stream/Readme.md +138 -0
  291. package/node_modules/@slack/bolt/node_modules/combined-stream/lib/combined_stream.js +208 -0
  292. package/node_modules/@slack/bolt/node_modules/combined-stream/package.json +25 -0
  293. package/node_modules/@slack/bolt/node_modules/delayed-stream/.npmignore +1 -0
  294. package/node_modules/@slack/bolt/node_modules/delayed-stream/License +19 -0
  295. package/node_modules/@slack/bolt/node_modules/delayed-stream/Makefile +7 -0
  296. package/node_modules/@slack/bolt/node_modules/delayed-stream/Readme.md +141 -0
  297. package/node_modules/@slack/bolt/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  298. package/node_modules/@slack/bolt/node_modules/delayed-stream/package.json +27 -0
  299. package/node_modules/@slack/bolt/node_modules/es-set-tostringtag/.eslintrc +13 -0
  300. package/node_modules/@slack/bolt/node_modules/es-set-tostringtag/.nycrc +9 -0
  301. package/node_modules/@slack/bolt/node_modules/es-set-tostringtag/CHANGELOG.md +67 -0
  302. package/node_modules/@slack/bolt/node_modules/es-set-tostringtag/LICENSE +21 -0
  303. package/node_modules/@slack/bolt/node_modules/es-set-tostringtag/README.md +53 -0
  304. package/node_modules/@slack/bolt/node_modules/es-set-tostringtag/index.d.ts +10 -0
  305. package/node_modules/@slack/bolt/node_modules/es-set-tostringtag/index.js +35 -0
  306. package/node_modules/@slack/bolt/node_modules/es-set-tostringtag/package.json +78 -0
  307. package/node_modules/@slack/bolt/node_modules/es-set-tostringtag/test/index.js +85 -0
  308. package/node_modules/@slack/bolt/node_modules/es-set-tostringtag/tsconfig.json +9 -0
  309. package/node_modules/@slack/bolt/node_modules/follow-redirects/LICENSE +18 -0
  310. package/node_modules/@slack/bolt/node_modules/follow-redirects/README.md +157 -0
  311. package/node_modules/@slack/bolt/node_modules/follow-redirects/debug.js +15 -0
  312. package/node_modules/@slack/bolt/node_modules/follow-redirects/http.js +1 -0
  313. package/node_modules/@slack/bolt/node_modules/follow-redirects/https.js +1 -0
  314. package/node_modules/@slack/bolt/node_modules/follow-redirects/index.js +709 -0
  315. package/node_modules/@slack/bolt/node_modules/follow-redirects/package.json +58 -0
  316. package/node_modules/@slack/bolt/node_modules/form-data/CHANGELOG.md +669 -0
  317. package/node_modules/@slack/bolt/node_modules/form-data/License +19 -0
  318. package/node_modules/@slack/bolt/node_modules/form-data/README.md +350 -0
  319. package/node_modules/@slack/bolt/node_modules/form-data/index.d.ts +51 -0
  320. package/node_modules/@slack/bolt/node_modules/form-data/lib/browser.js +4 -0
  321. package/node_modules/@slack/bolt/node_modules/form-data/lib/form_data.js +514 -0
  322. package/node_modules/@slack/bolt/node_modules/form-data/lib/populate.js +10 -0
  323. package/node_modules/@slack/bolt/node_modules/form-data/node_modules/mime-db/HISTORY.md +507 -0
  324. package/node_modules/@slack/bolt/node_modules/form-data/node_modules/mime-db/LICENSE +23 -0
  325. package/node_modules/@slack/bolt/node_modules/form-data/node_modules/mime-db/README.md +100 -0
  326. package/node_modules/@slack/bolt/node_modules/form-data/node_modules/mime-db/db.json +8519 -0
  327. package/node_modules/@slack/bolt/node_modules/form-data/node_modules/mime-db/index.js +12 -0
  328. package/node_modules/@slack/bolt/node_modules/form-data/node_modules/mime-db/package.json +60 -0
  329. package/node_modules/@slack/bolt/node_modules/form-data/node_modules/mime-types/HISTORY.md +397 -0
  330. package/node_modules/@slack/bolt/node_modules/form-data/node_modules/mime-types/LICENSE +23 -0
  331. package/node_modules/@slack/bolt/node_modules/form-data/node_modules/mime-types/README.md +113 -0
  332. package/node_modules/@slack/bolt/node_modules/form-data/node_modules/mime-types/index.js +188 -0
  333. package/node_modules/@slack/bolt/node_modules/form-data/node_modules/mime-types/package.json +44 -0
  334. package/node_modules/@slack/bolt/node_modules/form-data/package.json +83 -0
  335. package/node_modules/@slack/bolt/node_modules/has-tostringtag/.eslintrc +5 -0
  336. package/node_modules/@slack/bolt/node_modules/has-tostringtag/.github/FUNDING.yml +12 -0
  337. package/node_modules/@slack/bolt/node_modules/has-tostringtag/.nycrc +13 -0
  338. package/node_modules/@slack/bolt/node_modules/has-tostringtag/CHANGELOG.md +42 -0
  339. package/node_modules/@slack/bolt/node_modules/has-tostringtag/LICENSE +21 -0
  340. package/node_modules/@slack/bolt/node_modules/has-tostringtag/README.md +46 -0
  341. package/node_modules/@slack/bolt/node_modules/has-tostringtag/index.d.ts +3 -0
  342. package/node_modules/@slack/bolt/node_modules/has-tostringtag/index.js +8 -0
  343. package/node_modules/@slack/bolt/node_modules/has-tostringtag/package.json +108 -0
  344. package/node_modules/@slack/bolt/node_modules/has-tostringtag/shams.d.ts +3 -0
  345. package/node_modules/@slack/bolt/node_modules/has-tostringtag/shams.js +8 -0
  346. package/node_modules/@slack/bolt/node_modules/has-tostringtag/test/index.js +21 -0
  347. package/node_modules/@slack/bolt/node_modules/has-tostringtag/test/shams/core-js.js +31 -0
  348. package/node_modules/@slack/bolt/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +30 -0
  349. package/node_modules/@slack/bolt/node_modules/has-tostringtag/test/tests.js +15 -0
  350. package/node_modules/@slack/bolt/node_modules/has-tostringtag/tsconfig.json +49 -0
  351. package/node_modules/@slack/bolt/node_modules/https-proxy-agent/README.md +137 -0
  352. package/node_modules/@slack/bolt/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
  353. package/node_modules/@slack/bolt/node_modules/https-proxy-agent/dist/agent.js +177 -0
  354. package/node_modules/@slack/bolt/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
  355. package/node_modules/@slack/bolt/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
  356. package/node_modules/@slack/bolt/node_modules/https-proxy-agent/dist/index.js +14 -0
  357. package/node_modules/@slack/bolt/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  358. package/node_modules/@slack/bolt/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
  359. package/node_modules/@slack/bolt/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
  360. package/node_modules/@slack/bolt/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
  361. package/node_modules/@slack/bolt/node_modules/https-proxy-agent/package.json +56 -0
  362. package/node_modules/@slack/bolt/node_modules/iconv-lite/encodings/sbcs-data.js +0 -2
  363. package/node_modules/@slack/bolt/node_modules/iconv-lite/encodings/utf32.js +3 -10
  364. package/node_modules/@slack/bolt/node_modules/iconv-lite/package.json +2 -2
  365. package/node_modules/@slack/bolt/node_modules/iconv-lite/types/encodings.d.ts +0 -2
  366. package/node_modules/@slack/bolt/node_modules/media-typer/README.md +14 -15
  367. package/node_modules/@slack/bolt/node_modules/media-typer/index.js +8 -0
  368. package/node_modules/@slack/bolt/node_modules/media-typer/package.json +12 -16
  369. package/node_modules/@slack/bolt/node_modules/path-to-regexp/Readme.md +3 -3
  370. package/node_modules/@slack/bolt/node_modules/path-to-regexp/dist/index.js +158 -135
  371. package/node_modules/@slack/bolt/node_modules/path-to-regexp/dist/index.js.map +1 -1
  372. package/node_modules/@slack/bolt/node_modules/path-to-regexp/package.json +2 -2
  373. package/node_modules/@slack/bolt/node_modules/proxy-addr/HISTORY.md +60 -54
  374. package/node_modules/@slack/bolt/node_modules/proxy-addr/README.md +1 -1
  375. package/node_modules/@slack/bolt/node_modules/proxy-addr/index.js +32 -0
  376. package/node_modules/@slack/bolt/node_modules/proxy-addr/package.json +8 -4
  377. package/node_modules/@slack/bolt/node_modules/proxy-from-env/LICENSE +20 -0
  378. package/node_modules/@slack/bolt/node_modules/proxy-from-env/README.md +163 -0
  379. package/node_modules/@slack/bolt/node_modules/proxy-from-env/index.cjs +105 -0
  380. package/node_modules/@slack/bolt/node_modules/proxy-from-env/index.js +103 -0
  381. package/node_modules/@slack/bolt/node_modules/proxy-from-env/package.json +43 -0
  382. package/node_modules/@slack/bolt/node_modules/qs/CHANGELOG.md +0 -11
  383. package/node_modules/@slack/bolt/node_modules/qs/dist/qs.js +17 -17
  384. package/node_modules/@slack/bolt/node_modules/qs/lib/parse.js +8 -19
  385. package/node_modules/@slack/bolt/node_modules/qs/lib/utils.js +8 -47
  386. package/node_modules/@slack/bolt/node_modules/qs/package.json +5 -6
  387. package/node_modules/@slack/bolt/node_modules/qs/test/parse.js +0 -230
  388. package/node_modules/@slack/bolt/node_modules/qs/test/utils.js +0 -194
  389. package/node_modules/@slack/bolt/package.json +11 -10
  390. package/node_modules/@slack/types/README.md +1 -1
  391. package/node_modules/@slack/types/dist/events/app.d.ts +0 -28
  392. package/node_modules/@slack/types/dist/events/app.d.ts.map +1 -1
  393. package/node_modules/@slack/types/dist/events/index.d.ts +2 -2
  394. package/node_modules/@slack/types/dist/events/index.d.ts.map +1 -1
  395. package/node_modules/@slack/types/dist/events/index.js.map +1 -1
  396. package/node_modules/@slack/types/dist/events/message.d.ts +0 -2
  397. package/node_modules/@slack/types/dist/events/message.d.ts.map +1 -1
  398. package/node_modules/@slack/types/package.json +3 -3
  399. package/node_modules/@slack/web-api/README.md +1 -1
  400. package/node_modules/@slack/web-api/dist/WebClient.d.ts +71 -42
  401. package/node_modules/@slack/web-api/dist/WebClient.d.ts.map +1 -1
  402. package/node_modules/@slack/web-api/dist/WebClient.js +248 -180
  403. package/node_modules/@slack/web-api/dist/WebClient.js.map +1 -1
  404. package/node_modules/@slack/web-api/dist/chat-stream.js +22 -37
  405. package/node_modules/@slack/web-api/dist/chat-stream.js.map +1 -1
  406. package/node_modules/@slack/web-api/dist/errors.d.ts +51 -32
  407. package/node_modules/@slack/web-api/dist/errors.d.ts.map +1 -1
  408. package/node_modules/@slack/web-api/dist/errors.js +55 -64
  409. package/node_modules/@slack/web-api/dist/errors.js.map +1 -1
  410. package/node_modules/@slack/web-api/dist/file-upload.d.ts +9 -0
  411. package/node_modules/@slack/web-api/dist/file-upload.d.ts.map +1 -1
  412. package/node_modules/@slack/web-api/dist/file-upload.js +46 -41
  413. package/node_modules/@slack/web-api/dist/file-upload.js.map +1 -1
  414. package/node_modules/@slack/web-api/dist/index.d.ts +2 -2
  415. package/node_modules/@slack/web-api/dist/index.d.ts.map +1 -1
  416. package/node_modules/@slack/web-api/dist/index.js +1 -8
  417. package/node_modules/@slack/web-api/dist/index.js.map +1 -1
  418. package/node_modules/@slack/web-api/dist/methods.d.ts +38 -2
  419. package/node_modules/@slack/web-api/dist/methods.d.ts.map +1 -1
  420. package/node_modules/@slack/web-api/dist/methods.js +1384 -1347
  421. package/node_modules/@slack/web-api/dist/methods.js.map +1 -1
  422. package/node_modules/@slack/web-api/dist/types/request/files.d.ts +1 -0
  423. package/node_modules/@slack/web-api/dist/types/request/files.d.ts.map +1 -1
  424. package/node_modules/@slack/web-api/dist/types/request/index.d.ts +3 -3
  425. package/node_modules/@slack/web-api/dist/types/request/index.d.ts.map +1 -1
  426. package/node_modules/@slack/web-api/dist/types/request/manifest.d.ts +1 -66
  427. package/node_modules/@slack/web-api/dist/types/request/manifest.d.ts.map +1 -1
  428. package/node_modules/@slack/web-api/dist/types/request/rtm.d.ts +14 -1
  429. package/node_modules/@slack/web-api/dist/types/request/rtm.d.ts.map +1 -1
  430. package/node_modules/@slack/web-api/dist/types/request/workflows.d.ts +29 -0
  431. package/node_modules/@slack/web-api/dist/types/request/workflows.d.ts.map +1 -1
  432. package/node_modules/@slack/web-api/node_modules/@slack/logger/README.md +1 -1
  433. package/node_modules/@slack/web-api/node_modules/@slack/logger/dist/index.js +13 -17
  434. package/node_modules/@slack/web-api/node_modules/@slack/logger/dist/index.js.map +1 -1
  435. package/node_modules/@slack/web-api/node_modules/@slack/logger/package.json +7 -6
  436. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
  437. package/node_modules/@slack/web-api/node_modules/@types/node/fs/promises.d.ts +6 -16
  438. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
  439. package/node_modules/@slack/web-api/node_modules/agent-base/README.md +145 -0
  440. package/node_modules/@slack/web-api/node_modules/agent-base/dist/src/index.d.ts +78 -0
  441. package/node_modules/@slack/web-api/node_modules/agent-base/dist/src/index.js +203 -0
  442. package/node_modules/@slack/web-api/node_modules/agent-base/dist/src/index.js.map +1 -0
  443. package/node_modules/@slack/web-api/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
  444. package/node_modules/@slack/web-api/node_modules/agent-base/dist/src/promisify.js +18 -0
  445. package/node_modules/@slack/web-api/node_modules/agent-base/dist/src/promisify.js.map +1 -0
  446. package/node_modules/@slack/web-api/node_modules/agent-base/package.json +64 -0
  447. package/node_modules/@slack/web-api/node_modules/agent-base/src/index.ts +345 -0
  448. package/node_modules/@slack/web-api/node_modules/agent-base/src/promisify.ts +33 -0
  449. package/node_modules/@slack/web-api/node_modules/asynckit/LICENSE +21 -0
  450. package/node_modules/@slack/web-api/node_modules/asynckit/README.md +233 -0
  451. package/node_modules/@slack/web-api/node_modules/asynckit/bench.js +76 -0
  452. package/node_modules/@slack/web-api/node_modules/asynckit/index.js +6 -0
  453. package/node_modules/@slack/web-api/node_modules/asynckit/lib/abort.js +29 -0
  454. package/node_modules/@slack/web-api/node_modules/asynckit/lib/async.js +34 -0
  455. package/node_modules/@slack/web-api/node_modules/asynckit/lib/defer.js +26 -0
  456. package/node_modules/@slack/web-api/node_modules/asynckit/lib/iterate.js +75 -0
  457. package/node_modules/@slack/web-api/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  458. package/node_modules/@slack/web-api/node_modules/asynckit/lib/readable_parallel.js +25 -0
  459. package/node_modules/@slack/web-api/node_modules/asynckit/lib/readable_serial.js +25 -0
  460. package/node_modules/@slack/web-api/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  461. package/node_modules/@slack/web-api/node_modules/asynckit/lib/state.js +37 -0
  462. package/node_modules/@slack/web-api/node_modules/asynckit/lib/streamify.js +141 -0
  463. package/node_modules/@slack/web-api/node_modules/asynckit/lib/terminator.js +29 -0
  464. package/node_modules/@slack/web-api/node_modules/asynckit/package.json +63 -0
  465. package/node_modules/@slack/web-api/node_modules/asynckit/parallel.js +43 -0
  466. package/node_modules/@slack/web-api/node_modules/asynckit/serial.js +17 -0
  467. package/node_modules/@slack/web-api/node_modules/asynckit/serialOrdered.js +75 -0
  468. package/node_modules/@slack/web-api/node_modules/asynckit/stream.js +21 -0
  469. package/node_modules/@slack/web-api/node_modules/axios/CHANGELOG.md +1934 -0
  470. package/node_modules/@slack/web-api/node_modules/axios/LICENSE +7 -0
  471. package/node_modules/@slack/web-api/node_modules/axios/MIGRATION_GUIDE.md +877 -0
  472. package/node_modules/@slack/web-api/node_modules/axios/README.md +2851 -0
  473. package/node_modules/@slack/web-api/node_modules/axios/dist/axios.js +5807 -0
  474. package/node_modules/@slack/web-api/node_modules/axios/dist/axios.min.js +5 -0
  475. package/node_modules/@slack/web-api/node_modules/axios/dist/axios.min.js.map +1 -0
  476. package/node_modules/@slack/web-api/node_modules/axios/dist/browser/axios.cjs +5829 -0
  477. package/node_modules/@slack/web-api/node_modules/axios/dist/esm/axios.js +5850 -0
  478. package/node_modules/@slack/web-api/node_modules/axios/dist/esm/axios.min.js +3 -0
  479. package/node_modules/@slack/web-api/node_modules/axios/dist/esm/axios.min.js.map +1 -0
  480. package/node_modules/@slack/web-api/node_modules/axios/dist/node/axios.cjs +6808 -0
  481. package/node_modules/@slack/web-api/node_modules/axios/index.d.cts +766 -0
  482. package/node_modules/@slack/web-api/node_modules/axios/index.d.ts +787 -0
  483. package/node_modules/@slack/web-api/node_modules/axios/index.js +45 -0
  484. package/node_modules/@slack/web-api/node_modules/axios/lib/adapters/README.md +36 -0
  485. package/node_modules/@slack/web-api/node_modules/axios/lib/adapters/adapters.js +132 -0
  486. package/node_modules/@slack/web-api/node_modules/axios/lib/adapters/fetch.js +696 -0
  487. package/node_modules/@slack/web-api/node_modules/axios/lib/adapters/http.js +1490 -0
  488. package/node_modules/@slack/web-api/node_modules/axios/lib/adapters/xhr.js +277 -0
  489. package/node_modules/@slack/web-api/node_modules/axios/lib/axios.js +89 -0
  490. package/node_modules/@slack/web-api/node_modules/axios/lib/cancel/CancelToken.js +135 -0
  491. package/node_modules/@slack/web-api/node_modules/axios/lib/cancel/CanceledError.js +22 -0
  492. package/node_modules/@slack/web-api/node_modules/axios/lib/cancel/isCancel.js +5 -0
  493. package/node_modules/@slack/web-api/node_modules/axios/lib/core/Axios.js +306 -0
  494. package/node_modules/@slack/web-api/node_modules/axios/lib/core/AxiosError.js +219 -0
  495. package/node_modules/@slack/web-api/node_modules/axios/lib/core/AxiosHeaders.js +474 -0
  496. package/node_modules/@slack/web-api/node_modules/axios/lib/core/InterceptorManager.js +171 -0
  497. package/node_modules/@slack/web-api/node_modules/axios/lib/core/README.md +8 -0
  498. package/node_modules/@slack/web-api/node_modules/axios/lib/core/buildFullPath.js +76 -0
  499. package/node_modules/@slack/web-api/node_modules/axios/lib/core/dispatchRequest.js +95 -0
  500. package/node_modules/@slack/web-api/node_modules/axios/lib/core/mergeConfig.js +174 -0
  501. package/node_modules/@slack/web-api/node_modules/axios/lib/core/methodList.js +17 -0
  502. package/node_modules/@slack/web-api/node_modules/axios/lib/core/setFormDataHeaders.js +27 -0
  503. package/node_modules/@slack/web-api/node_modules/axios/lib/core/settle.js +27 -0
  504. package/node_modules/@slack/web-api/node_modules/axios/lib/core/transformData.js +28 -0
  505. package/node_modules/@slack/web-api/node_modules/axios/lib/defaults/index.js +178 -0
  506. package/node_modules/@slack/web-api/node_modules/axios/lib/defaults/transitional.js +10 -0
  507. package/node_modules/@slack/web-api/node_modules/axios/lib/env/README.md +3 -0
  508. package/node_modules/@slack/web-api/node_modules/axios/lib/env/classes/FormData.js +2 -0
  509. package/node_modules/@slack/web-api/node_modules/axios/lib/env/data.js +1 -0
  510. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/AxiosTransformStream.js +156 -0
  511. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +59 -0
  512. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/Http2Sessions.js +121 -0
  513. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/HttpStatusCode.js +88 -0
  514. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/README.md +7 -0
  515. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +29 -0
  516. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/bind.js +14 -0
  517. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/buildURL.js +69 -0
  518. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/callbackify.js +18 -0
  519. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/combineURLs.js +23 -0
  520. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/composeSignals.js +68 -0
  521. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/cookies.js +64 -0
  522. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/deprecatedMethod.js +31 -0
  523. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +166 -0
  524. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/formDataToJSON.js +125 -0
  525. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/formDataToStream.js +119 -0
  526. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/fromDataURI.js +69 -0
  527. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/isAbsoluteURL.js +19 -0
  528. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
  529. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/isURLSameOrigin.js +16 -0
  530. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
  531. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/null.js +2 -0
  532. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/parseHeaders.js +71 -0
  533. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
  534. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/progressEventReducer.js +54 -0
  535. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/readBlob.js +15 -0
  536. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/resolveConfig.js +107 -0
  537. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
  538. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/shouldBypassProxy.js +505 -0
  539. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/speedometer.js +55 -0
  540. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/spread.js +28 -0
  541. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/throttle.js +45 -0
  542. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/toFormData.js +279 -0
  543. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/toURLEncodedForm.js +19 -0
  544. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/trackStream.js +89 -0
  545. package/node_modules/@slack/web-api/node_modules/axios/lib/helpers/validator.js +112 -0
  546. package/node_modules/@slack/web-api/node_modules/axios/lib/platform/browser/classes/Blob.js +3 -0
  547. package/node_modules/@slack/web-api/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
  548. package/node_modules/@slack/web-api/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +4 -0
  549. package/node_modules/@slack/web-api/node_modules/axios/lib/platform/browser/index.js +13 -0
  550. package/node_modules/@slack/web-api/node_modules/axios/lib/platform/common/utils.js +52 -0
  551. package/node_modules/@slack/web-api/node_modules/axios/lib/platform/index.js +7 -0
  552. package/node_modules/@slack/web-api/node_modules/axios/lib/platform/node/classes/Buffer.js +11 -0
  553. package/node_modules/@slack/web-api/node_modules/axios/lib/platform/node/classes/FormData.js +3 -0
  554. package/node_modules/@slack/web-api/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +4 -0
  555. package/node_modules/@slack/web-api/node_modules/axios/lib/platform/node/index.js +37 -0
  556. package/node_modules/@slack/web-api/node_modules/axios/lib/utils.js +1150 -0
  557. package/node_modules/@slack/web-api/node_modules/axios/package.json +203 -0
  558. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
  559. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
  560. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/.nycrc +9 -0
  561. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
  562. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/LICENSE +21 -0
  563. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/README.md +62 -0
  564. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
  565. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  566. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
  567. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
  568. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
  569. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  570. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
  571. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  572. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
  573. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/index.js +15 -0
  574. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/package.json +85 -0
  575. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
  576. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  577. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/test/index.js +63 -0
  578. package/node_modules/@slack/web-api/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
  579. package/node_modules/@slack/web-api/node_modules/combined-stream/License +19 -0
  580. package/node_modules/@slack/web-api/node_modules/combined-stream/Readme.md +138 -0
  581. package/node_modules/@slack/web-api/node_modules/combined-stream/lib/combined_stream.js +208 -0
  582. package/node_modules/@slack/web-api/node_modules/combined-stream/package.json +25 -0
  583. package/node_modules/@slack/web-api/node_modules/debug/LICENSE +20 -0
  584. package/node_modules/@slack/web-api/node_modules/debug/README.md +481 -0
  585. package/node_modules/@slack/web-api/node_modules/debug/package.json +64 -0
  586. package/node_modules/@slack/web-api/node_modules/debug/src/browser.js +272 -0
  587. package/node_modules/@slack/web-api/node_modules/debug/src/common.js +292 -0
  588. package/node_modules/@slack/web-api/node_modules/debug/src/index.js +10 -0
  589. package/node_modules/@slack/web-api/node_modules/debug/src/node.js +263 -0
  590. package/node_modules/@slack/web-api/node_modules/delayed-stream/.npmignore +1 -0
  591. package/node_modules/@slack/web-api/node_modules/delayed-stream/License +19 -0
  592. package/node_modules/@slack/web-api/node_modules/delayed-stream/Makefile +7 -0
  593. package/node_modules/@slack/web-api/node_modules/delayed-stream/Readme.md +141 -0
  594. package/node_modules/@slack/web-api/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  595. package/node_modules/@slack/web-api/node_modules/delayed-stream/package.json +27 -0
  596. package/node_modules/@slack/web-api/node_modules/dunder-proto/.eslintrc +5 -0
  597. package/node_modules/@slack/web-api/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
  598. package/node_modules/@slack/web-api/node_modules/dunder-proto/.nycrc +13 -0
  599. package/node_modules/@slack/web-api/node_modules/dunder-proto/CHANGELOG.md +24 -0
  600. package/node_modules/@slack/web-api/node_modules/dunder-proto/LICENSE +21 -0
  601. package/node_modules/@slack/web-api/node_modules/dunder-proto/README.md +54 -0
  602. package/node_modules/@slack/web-api/node_modules/dunder-proto/get.d.ts +5 -0
  603. package/node_modules/@slack/web-api/node_modules/dunder-proto/get.js +30 -0
  604. package/node_modules/@slack/web-api/node_modules/dunder-proto/package.json +76 -0
  605. package/node_modules/@slack/web-api/node_modules/dunder-proto/set.d.ts +5 -0
  606. package/node_modules/@slack/web-api/node_modules/dunder-proto/set.js +35 -0
  607. package/node_modules/@slack/web-api/node_modules/dunder-proto/test/get.js +34 -0
  608. package/node_modules/@slack/web-api/node_modules/dunder-proto/test/index.js +4 -0
  609. package/node_modules/@slack/web-api/node_modules/dunder-proto/test/set.js +50 -0
  610. package/node_modules/@slack/web-api/node_modules/dunder-proto/tsconfig.json +9 -0
  611. package/node_modules/@slack/web-api/node_modules/es-define-property/.eslintrc +13 -0
  612. package/node_modules/@slack/web-api/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  613. package/node_modules/@slack/web-api/node_modules/es-define-property/.nycrc +9 -0
  614. package/node_modules/@slack/web-api/node_modules/es-define-property/CHANGELOG.md +29 -0
  615. package/node_modules/@slack/web-api/node_modules/es-define-property/LICENSE +21 -0
  616. package/node_modules/@slack/web-api/node_modules/es-define-property/README.md +49 -0
  617. package/node_modules/@slack/web-api/node_modules/es-define-property/index.d.ts +3 -0
  618. package/node_modules/@slack/web-api/node_modules/es-define-property/index.js +14 -0
  619. package/node_modules/@slack/web-api/node_modules/es-define-property/package.json +81 -0
  620. package/node_modules/@slack/web-api/node_modules/es-define-property/test/index.js +56 -0
  621. package/node_modules/@slack/web-api/node_modules/es-define-property/tsconfig.json +10 -0
  622. package/node_modules/@slack/web-api/node_modules/es-errors/.eslintrc +5 -0
  623. package/node_modules/@slack/web-api/node_modules/es-errors/.github/FUNDING.yml +12 -0
  624. package/node_modules/@slack/web-api/node_modules/es-errors/CHANGELOG.md +40 -0
  625. package/node_modules/@slack/web-api/node_modules/es-errors/LICENSE +21 -0
  626. package/node_modules/@slack/web-api/node_modules/es-errors/README.md +55 -0
  627. package/node_modules/@slack/web-api/node_modules/es-errors/eval.d.ts +3 -0
  628. package/node_modules/@slack/web-api/node_modules/es-errors/eval.js +4 -0
  629. package/node_modules/@slack/web-api/node_modules/es-errors/index.d.ts +3 -0
  630. package/node_modules/@slack/web-api/node_modules/es-errors/index.js +4 -0
  631. package/node_modules/@slack/web-api/node_modules/es-errors/package.json +80 -0
  632. package/node_modules/@slack/web-api/node_modules/es-errors/range.d.ts +3 -0
  633. package/node_modules/@slack/web-api/node_modules/es-errors/range.js +4 -0
  634. package/node_modules/@slack/web-api/node_modules/es-errors/ref.d.ts +3 -0
  635. package/node_modules/@slack/web-api/node_modules/es-errors/ref.js +4 -0
  636. package/node_modules/@slack/web-api/node_modules/es-errors/syntax.d.ts +3 -0
  637. package/node_modules/@slack/web-api/node_modules/es-errors/syntax.js +4 -0
  638. package/node_modules/@slack/web-api/node_modules/es-errors/test/index.js +19 -0
  639. package/node_modules/@slack/web-api/node_modules/es-errors/tsconfig.json +49 -0
  640. package/node_modules/@slack/web-api/node_modules/es-errors/type.d.ts +3 -0
  641. package/node_modules/@slack/web-api/node_modules/es-errors/type.js +4 -0
  642. package/node_modules/@slack/web-api/node_modules/es-errors/uri.d.ts +3 -0
  643. package/node_modules/@slack/web-api/node_modules/es-errors/uri.js +4 -0
  644. package/node_modules/@slack/web-api/node_modules/es-object-atoms/.eslintrc +16 -0
  645. package/node_modules/@slack/web-api/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
  646. package/node_modules/@slack/web-api/node_modules/es-object-atoms/CHANGELOG.md +44 -0
  647. package/node_modules/@slack/web-api/node_modules/es-object-atoms/LICENSE +21 -0
  648. package/node_modules/@slack/web-api/node_modules/es-object-atoms/README.md +63 -0
  649. package/node_modules/@slack/web-api/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  650. package/node_modules/@slack/web-api/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  651. package/node_modules/@slack/web-api/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  652. package/node_modules/@slack/web-api/node_modules/es-object-atoms/ToObject.js +10 -0
  653. package/node_modules/@slack/web-api/node_modules/es-object-atoms/index.d.ts +3 -0
  654. package/node_modules/@slack/web-api/node_modules/es-object-atoms/index.js +4 -0
  655. package/node_modules/@slack/web-api/node_modules/es-object-atoms/isObject.d.ts +3 -0
  656. package/node_modules/@slack/web-api/node_modules/es-object-atoms/isObject.js +6 -0
  657. package/node_modules/@slack/web-api/node_modules/es-object-atoms/package.json +79 -0
  658. package/node_modules/@slack/web-api/node_modules/es-object-atoms/test/index.js +38 -0
  659. package/node_modules/@slack/web-api/node_modules/es-object-atoms/tsconfig.json +7 -0
  660. package/node_modules/@slack/web-api/node_modules/es-set-tostringtag/.eslintrc +13 -0
  661. package/node_modules/@slack/web-api/node_modules/es-set-tostringtag/.nycrc +9 -0
  662. package/node_modules/@slack/web-api/node_modules/es-set-tostringtag/CHANGELOG.md +67 -0
  663. package/node_modules/@slack/web-api/node_modules/es-set-tostringtag/LICENSE +21 -0
  664. package/node_modules/@slack/web-api/node_modules/es-set-tostringtag/README.md +53 -0
  665. package/node_modules/@slack/web-api/node_modules/es-set-tostringtag/index.d.ts +10 -0
  666. package/node_modules/@slack/web-api/node_modules/es-set-tostringtag/index.js +35 -0
  667. package/node_modules/@slack/web-api/node_modules/es-set-tostringtag/package.json +78 -0
  668. package/node_modules/@slack/web-api/node_modules/es-set-tostringtag/test/index.js +85 -0
  669. package/node_modules/@slack/web-api/node_modules/es-set-tostringtag/tsconfig.json +9 -0
  670. package/node_modules/@slack/web-api/node_modules/follow-redirects/LICENSE +18 -0
  671. package/node_modules/@slack/web-api/node_modules/follow-redirects/README.md +157 -0
  672. package/node_modules/@slack/web-api/node_modules/follow-redirects/debug.js +15 -0
  673. package/node_modules/@slack/web-api/node_modules/follow-redirects/http.js +1 -0
  674. package/node_modules/@slack/web-api/node_modules/follow-redirects/https.js +1 -0
  675. package/node_modules/@slack/web-api/node_modules/follow-redirects/index.js +709 -0
  676. package/node_modules/@slack/web-api/node_modules/follow-redirects/package.json +58 -0
  677. package/node_modules/@slack/web-api/node_modules/form-data/CHANGELOG.md +669 -0
  678. package/node_modules/@slack/web-api/node_modules/form-data/License +19 -0
  679. package/node_modules/@slack/web-api/node_modules/form-data/README.md +350 -0
  680. package/node_modules/@slack/web-api/node_modules/form-data/index.d.ts +51 -0
  681. package/node_modules/@slack/web-api/node_modules/form-data/lib/browser.js +4 -0
  682. package/node_modules/@slack/web-api/node_modules/form-data/lib/form_data.js +514 -0
  683. package/node_modules/@slack/web-api/node_modules/form-data/lib/populate.js +10 -0
  684. package/node_modules/@slack/web-api/node_modules/form-data/package.json +83 -0
  685. package/node_modules/@slack/web-api/node_modules/function-bind/.eslintrc +21 -0
  686. package/node_modules/@slack/web-api/node_modules/function-bind/.github/FUNDING.yml +12 -0
  687. package/node_modules/@slack/web-api/node_modules/function-bind/.github/SECURITY.md +3 -0
  688. package/node_modules/@slack/web-api/node_modules/function-bind/.nycrc +13 -0
  689. package/node_modules/@slack/web-api/node_modules/function-bind/CHANGELOG.md +136 -0
  690. package/node_modules/@slack/web-api/node_modules/function-bind/LICENSE +20 -0
  691. package/node_modules/@slack/web-api/node_modules/function-bind/README.md +46 -0
  692. package/node_modules/@slack/web-api/node_modules/function-bind/implementation.js +84 -0
  693. package/node_modules/@slack/web-api/node_modules/function-bind/index.js +5 -0
  694. package/node_modules/@slack/web-api/node_modules/function-bind/package.json +87 -0
  695. package/node_modules/@slack/web-api/node_modules/function-bind/test/.eslintrc +9 -0
  696. package/node_modules/@slack/web-api/node_modules/function-bind/test/index.js +252 -0
  697. package/node_modules/@slack/web-api/node_modules/get-intrinsic/.eslintrc +42 -0
  698. package/node_modules/@slack/web-api/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
  699. package/node_modules/@slack/web-api/node_modules/get-intrinsic/.nycrc +9 -0
  700. package/node_modules/@slack/web-api/node_modules/get-intrinsic/CHANGELOG.md +186 -0
  701. package/node_modules/@slack/web-api/node_modules/get-intrinsic/LICENSE +21 -0
  702. package/node_modules/@slack/web-api/node_modules/get-intrinsic/README.md +71 -0
  703. package/node_modules/@slack/web-api/node_modules/get-intrinsic/index.js +378 -0
  704. package/node_modules/@slack/web-api/node_modules/get-intrinsic/package.json +97 -0
  705. package/node_modules/@slack/web-api/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
  706. package/node_modules/@slack/web-api/node_modules/get-proto/.eslintrc +10 -0
  707. package/node_modules/@slack/web-api/node_modules/get-proto/.github/FUNDING.yml +12 -0
  708. package/node_modules/@slack/web-api/node_modules/get-proto/.nycrc +9 -0
  709. package/node_modules/@slack/web-api/node_modules/get-proto/CHANGELOG.md +21 -0
  710. package/node_modules/@slack/web-api/node_modules/get-proto/LICENSE +21 -0
  711. package/node_modules/@slack/web-api/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  712. package/node_modules/@slack/web-api/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  713. package/node_modules/@slack/web-api/node_modules/get-proto/README.md +50 -0
  714. package/node_modules/@slack/web-api/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  715. package/node_modules/@slack/web-api/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  716. package/node_modules/@slack/web-api/node_modules/get-proto/index.d.ts +5 -0
  717. package/node_modules/@slack/web-api/node_modules/get-proto/index.js +27 -0
  718. package/node_modules/@slack/web-api/node_modules/get-proto/package.json +81 -0
  719. package/node_modules/@slack/web-api/node_modules/get-proto/test/index.js +68 -0
  720. package/node_modules/@slack/web-api/node_modules/get-proto/tsconfig.json +9 -0
  721. package/node_modules/@slack/web-api/node_modules/gopd/.eslintrc +16 -0
  722. package/node_modules/@slack/web-api/node_modules/gopd/.github/FUNDING.yml +12 -0
  723. package/node_modules/@slack/web-api/node_modules/gopd/CHANGELOG.md +45 -0
  724. package/node_modules/@slack/web-api/node_modules/gopd/LICENSE +21 -0
  725. package/node_modules/@slack/web-api/node_modules/gopd/README.md +40 -0
  726. package/node_modules/@slack/web-api/node_modules/gopd/gOPD.d.ts +1 -0
  727. package/node_modules/@slack/web-api/node_modules/gopd/gOPD.js +4 -0
  728. package/node_modules/@slack/web-api/node_modules/gopd/index.d.ts +5 -0
  729. package/node_modules/@slack/web-api/node_modules/gopd/index.js +15 -0
  730. package/node_modules/@slack/web-api/node_modules/gopd/package.json +77 -0
  731. package/node_modules/@slack/web-api/node_modules/gopd/test/index.js +36 -0
  732. package/node_modules/@slack/web-api/node_modules/gopd/tsconfig.json +9 -0
  733. package/node_modules/@slack/web-api/node_modules/has-symbols/.eslintrc +11 -0
  734. package/node_modules/@slack/web-api/node_modules/has-symbols/.github/FUNDING.yml +12 -0
  735. package/node_modules/@slack/web-api/node_modules/has-symbols/.nycrc +9 -0
  736. package/node_modules/@slack/web-api/node_modules/has-symbols/CHANGELOG.md +91 -0
  737. package/node_modules/@slack/web-api/node_modules/has-symbols/LICENSE +21 -0
  738. package/node_modules/@slack/web-api/node_modules/has-symbols/README.md +46 -0
  739. package/node_modules/@slack/web-api/node_modules/has-symbols/index.d.ts +3 -0
  740. package/node_modules/@slack/web-api/node_modules/has-symbols/index.js +14 -0
  741. package/node_modules/@slack/web-api/node_modules/has-symbols/package.json +111 -0
  742. package/node_modules/@slack/web-api/node_modules/has-symbols/shams.d.ts +3 -0
  743. package/node_modules/@slack/web-api/node_modules/has-symbols/shams.js +45 -0
  744. package/node_modules/@slack/web-api/node_modules/has-symbols/test/index.js +22 -0
  745. package/node_modules/@slack/web-api/node_modules/has-symbols/test/shams/core-js.js +29 -0
  746. package/node_modules/@slack/web-api/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
  747. package/node_modules/@slack/web-api/node_modules/has-symbols/test/tests.js +58 -0
  748. package/node_modules/@slack/web-api/node_modules/has-symbols/tsconfig.json +10 -0
  749. package/node_modules/@slack/web-api/node_modules/has-tostringtag/.eslintrc +5 -0
  750. package/node_modules/@slack/web-api/node_modules/has-tostringtag/.github/FUNDING.yml +12 -0
  751. package/node_modules/@slack/web-api/node_modules/has-tostringtag/.nycrc +13 -0
  752. package/node_modules/@slack/web-api/node_modules/has-tostringtag/CHANGELOG.md +42 -0
  753. package/node_modules/@slack/web-api/node_modules/has-tostringtag/LICENSE +21 -0
  754. package/node_modules/@slack/web-api/node_modules/has-tostringtag/README.md +46 -0
  755. package/node_modules/@slack/web-api/node_modules/has-tostringtag/index.d.ts +3 -0
  756. package/node_modules/@slack/web-api/node_modules/has-tostringtag/index.js +8 -0
  757. package/node_modules/@slack/web-api/node_modules/has-tostringtag/package.json +108 -0
  758. package/node_modules/@slack/web-api/node_modules/has-tostringtag/shams.d.ts +3 -0
  759. package/node_modules/@slack/web-api/node_modules/has-tostringtag/shams.js +8 -0
  760. package/node_modules/@slack/web-api/node_modules/has-tostringtag/test/index.js +21 -0
  761. package/node_modules/@slack/web-api/node_modules/has-tostringtag/test/shams/core-js.js +31 -0
  762. package/node_modules/@slack/web-api/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +30 -0
  763. package/node_modules/@slack/web-api/node_modules/has-tostringtag/test/tests.js +15 -0
  764. package/node_modules/@slack/web-api/node_modules/has-tostringtag/tsconfig.json +49 -0
  765. package/node_modules/@slack/web-api/node_modules/hasown/.github/FUNDING.yml +12 -0
  766. package/node_modules/@slack/web-api/node_modules/hasown/.nycrc +13 -0
  767. package/node_modules/@slack/web-api/node_modules/hasown/CHANGELOG.md +58 -0
  768. package/node_modules/@slack/web-api/node_modules/hasown/LICENSE +21 -0
  769. package/node_modules/@slack/web-api/node_modules/hasown/README.md +40 -0
  770. package/node_modules/@slack/web-api/node_modules/hasown/eslint.config.mjs +6 -0
  771. package/node_modules/@slack/web-api/node_modules/hasown/index.d.ts +3 -0
  772. package/node_modules/@slack/web-api/node_modules/hasown/index.js +8 -0
  773. package/node_modules/@slack/web-api/node_modules/hasown/package.json +91 -0
  774. package/node_modules/@slack/web-api/node_modules/hasown/tsconfig.json +6 -0
  775. package/node_modules/@slack/web-api/node_modules/https-proxy-agent/README.md +137 -0
  776. package/node_modules/@slack/web-api/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
  777. package/node_modules/@slack/web-api/node_modules/https-proxy-agent/dist/agent.js +177 -0
  778. package/node_modules/@slack/web-api/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
  779. package/node_modules/@slack/web-api/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
  780. package/node_modules/@slack/web-api/node_modules/https-proxy-agent/dist/index.js +14 -0
  781. package/node_modules/@slack/web-api/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  782. package/node_modules/@slack/web-api/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
  783. package/node_modules/@slack/web-api/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
  784. package/node_modules/@slack/web-api/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
  785. package/node_modules/@slack/web-api/node_modules/https-proxy-agent/package.json +56 -0
  786. package/node_modules/@slack/web-api/node_modules/is-electron/LICENSE +21 -0
  787. package/node_modules/@slack/web-api/node_modules/is-electron/README.md +25 -0
  788. package/node_modules/@slack/web-api/node_modules/is-electron/index.d.ts +2 -0
  789. package/node_modules/@slack/web-api/node_modules/is-electron/index.js +21 -0
  790. package/node_modules/@slack/web-api/node_modules/is-electron/package.json +34 -0
  791. package/node_modules/@slack/web-api/node_modules/is-stream/index.d.ts +79 -0
  792. package/node_modules/@slack/web-api/node_modules/is-stream/index.js +28 -0
  793. package/node_modules/@slack/web-api/node_modules/is-stream/package.json +42 -0
  794. package/node_modules/@slack/web-api/node_modules/is-stream/readme.md +60 -0
  795. package/node_modules/@slack/web-api/node_modules/math-intrinsics/.eslintrc +16 -0
  796. package/node_modules/@slack/web-api/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  797. package/node_modules/@slack/web-api/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  798. package/node_modules/@slack/web-api/node_modules/math-intrinsics/LICENSE +21 -0
  799. package/node_modules/@slack/web-api/node_modules/math-intrinsics/README.md +50 -0
  800. package/node_modules/@slack/web-api/node_modules/math-intrinsics/abs.d.ts +1 -0
  801. package/node_modules/@slack/web-api/node_modules/math-intrinsics/abs.js +4 -0
  802. package/node_modules/@slack/web-api/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  803. package/node_modules/@slack/web-api/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  804. package/node_modules/@slack/web-api/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  805. package/node_modules/@slack/web-api/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  806. package/node_modules/@slack/web-api/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  807. package/node_modules/@slack/web-api/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  808. package/node_modules/@slack/web-api/node_modules/math-intrinsics/floor.d.ts +1 -0
  809. package/node_modules/@slack/web-api/node_modules/math-intrinsics/floor.js +4 -0
  810. package/node_modules/@slack/web-api/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  811. package/node_modules/@slack/web-api/node_modules/math-intrinsics/isFinite.js +12 -0
  812. package/node_modules/@slack/web-api/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  813. package/node_modules/@slack/web-api/node_modules/math-intrinsics/isInteger.js +16 -0
  814. package/node_modules/@slack/web-api/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  815. package/node_modules/@slack/web-api/node_modules/math-intrinsics/isNaN.js +6 -0
  816. package/node_modules/@slack/web-api/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  817. package/node_modules/@slack/web-api/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  818. package/node_modules/@slack/web-api/node_modules/math-intrinsics/max.d.ts +1 -0
  819. package/node_modules/@slack/web-api/node_modules/math-intrinsics/max.js +4 -0
  820. package/node_modules/@slack/web-api/node_modules/math-intrinsics/min.d.ts +1 -0
  821. package/node_modules/@slack/web-api/node_modules/math-intrinsics/min.js +4 -0
  822. package/node_modules/@slack/web-api/node_modules/math-intrinsics/mod.d.ts +3 -0
  823. package/node_modules/@slack/web-api/node_modules/math-intrinsics/mod.js +9 -0
  824. package/node_modules/@slack/web-api/node_modules/math-intrinsics/package.json +86 -0
  825. package/node_modules/@slack/web-api/node_modules/math-intrinsics/pow.d.ts +1 -0
  826. package/node_modules/@slack/web-api/node_modules/math-intrinsics/pow.js +4 -0
  827. package/node_modules/@slack/web-api/node_modules/math-intrinsics/round.d.ts +1 -0
  828. package/node_modules/@slack/web-api/node_modules/math-intrinsics/round.js +4 -0
  829. package/node_modules/@slack/web-api/node_modules/math-intrinsics/sign.d.ts +3 -0
  830. package/node_modules/@slack/web-api/node_modules/math-intrinsics/sign.js +11 -0
  831. package/node_modules/@slack/web-api/node_modules/math-intrinsics/test/index.js +192 -0
  832. package/node_modules/@slack/web-api/node_modules/math-intrinsics/tsconfig.json +3 -0
  833. package/node_modules/@slack/web-api/node_modules/mime-db/HISTORY.md +507 -0
  834. package/node_modules/@slack/web-api/node_modules/mime-db/LICENSE +23 -0
  835. package/node_modules/@slack/web-api/node_modules/mime-db/README.md +100 -0
  836. package/node_modules/@slack/web-api/node_modules/mime-db/db.json +8519 -0
  837. package/node_modules/@slack/web-api/node_modules/mime-db/index.js +12 -0
  838. package/node_modules/@slack/web-api/node_modules/mime-db/package.json +60 -0
  839. package/node_modules/@slack/web-api/node_modules/mime-types/HISTORY.md +397 -0
  840. package/node_modules/@slack/web-api/node_modules/mime-types/LICENSE +23 -0
  841. package/node_modules/@slack/web-api/node_modules/mime-types/README.md +113 -0
  842. package/node_modules/@slack/web-api/node_modules/mime-types/index.js +188 -0
  843. package/node_modules/@slack/web-api/node_modules/mime-types/package.json +44 -0
  844. package/node_modules/@slack/web-api/node_modules/ms/index.js +162 -0
  845. package/node_modules/@slack/web-api/node_modules/ms/license.md +21 -0
  846. package/node_modules/@slack/web-api/node_modules/ms/package.json +38 -0
  847. package/node_modules/@slack/web-api/node_modules/ms/readme.md +59 -0
  848. package/node_modules/@slack/web-api/node_modules/proxy-from-env/LICENSE +20 -0
  849. package/node_modules/@slack/web-api/node_modules/proxy-from-env/README.md +163 -0
  850. package/node_modules/@slack/web-api/node_modules/proxy-from-env/index.cjs +105 -0
  851. package/node_modules/@slack/web-api/node_modules/proxy-from-env/index.js +103 -0
  852. package/node_modules/@slack/web-api/node_modules/proxy-from-env/package.json +43 -0
  853. package/node_modules/@slack/web-api/node_modules/safe-buffer/LICENSE +21 -0
  854. package/node_modules/@slack/web-api/node_modules/safe-buffer/README.md +584 -0
  855. package/node_modules/@slack/web-api/node_modules/safe-buffer/index.d.ts +187 -0
  856. package/node_modules/@slack/web-api/node_modules/safe-buffer/index.js +65 -0
  857. package/node_modules/@slack/web-api/node_modules/safe-buffer/package.json +51 -0
  858. package/node_modules/@slack/web-api/package.json +10 -6
  859. package/node_modules/typebox/build/compile/validator.d.mts +4 -1
  860. package/node_modules/typebox/build/guard/guard.d.mts +1 -1
  861. package/node_modules/typebox/build/guard/guard.mjs +2 -5
  862. package/node_modules/typebox/build/guard/string.mjs +4 -16
  863. package/node_modules/typebox/build/schema/engine/_functions.mjs +15 -34
  864. package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
  865. package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -8
  866. package/node_modules/typebox/build/typebox.d.mts +1 -1
  867. package/node_modules/typebox/build/typebox.mjs +1 -1
  868. package/node_modules/typebox/package.json +1 -1
  869. package/node_modules/typebox/readme.md +32 -29
  870. package/node_modules/ws/lib/permessage-deflate.js +3 -1
  871. package/node_modules/ws/package.json +1 -1
  872. package/openclaw.plugin.json +1390 -1351
  873. package/package.json +19 -109
  874. package/dist/account-configured-BwfXBo_F.js +0 -14
  875. package/dist/account-inspect-DEKpg9Ip.js +0 -89
  876. package/dist/account-reply-mode-DrUXogvO.js +0 -14
  877. package/dist/accounts-CHAeNZOX.js +0 -186
  878. package/dist/accounts.runtime-BHD4Ma2R.js +0 -2
  879. package/dist/action-runtime-DfuYoMjG.js +0 -561
  880. package/dist/action-runtime.runtime-DQErZYpz.js +0 -2
  881. package/dist/actions-D3NuJvva.js +0 -876
  882. package/dist/actions.runtime-BIRU_G4M.js +0 -2
  883. package/dist/approval-handler.runtime-BA05P0QT.js +0 -367
  884. package/dist/block-text-DkHaoGem.js +0 -79
  885. package/dist/channel-B9fVdW3s.js +0 -1118
  886. package/dist/channel-type-DXyos1d2.js +0 -108
  887. package/dist/channel.setup-CLP5oTvh.js +0 -56
  888. package/dist/config-adapter-CxBQH8fq.js +0 -566
  889. package/dist/config-schema-SgZT6nXV.js +0 -373
  890. package/dist/cursor-pages-eX7p8Wwt.js +0 -19
  891. package/dist/directory-config-CnCIAktf.js +0 -54
  892. package/dist/directory-live-DKunWh3A.js +0 -131
  893. package/dist/doctor-contract-CsGH1Dfc.js +0 -158
  894. package/dist/group-policy-NQZti9t-.js +0 -2442
  895. package/dist/message-tool-api-DkhFpMoy.js +0 -127
  896. package/dist/monitor-CmKz0wtI.js +0 -13
  897. package/dist/outbound-adapter-BkuMp2Vs.js +0 -236
  898. package/dist/pipeline.runtime-DgtmuYCP.js +0 -4360
  899. package/dist/plugin-routes-CLp4obpN.js +0 -22
  900. package/dist/policy-PRysPn23.js +0 -65
  901. package/dist/preflight-audio.runtime-D5Bgags0.js +0 -3
  902. package/dist/probe-CgDsSops.js +0 -345
  903. package/dist/provider-DmRizMZt.js +0 -5900
  904. package/dist/relay-source-Blxj8xb4.js +0 -272
  905. package/dist/replies-4s_Vq_z9.js +0 -457
  906. package/dist/resolve-channels-yEqmM-3I.js +0 -92
  907. package/dist/resolve-users-BOrt5K-5.js +0 -118
  908. package/dist/rolldown-runtime-8H4AJuhK.js +0 -14
  909. package/dist/runtime-JSVZSWAj.js +0 -8
  910. package/dist/runtime-api-QMb-Q5Ko.js +0 -10
  911. package/dist/scopes-BJSrkAp6.js +0 -73
  912. package/dist/secret-contract-DxmvbxBF.js +0 -87
  913. package/dist/security-audit-DR097212.js +0 -41
  914. package/dist/send-DsLeZpST.js +0 -1269
  915. package/dist/send.runtime-gUdK6V3h.js +0 -2
  916. package/dist/setup-surface-BeNzrMrJ.js +0 -148
  917. package/dist/shared-DgIN3Dcr.js +0 -268
  918. package/dist/slash-dispatch.runtime-zPkyl7dB.js +0 -33
  919. package/dist/streaming-compat-3_X-21wW.js +0 -44
  920. package/dist/target-parsing-N6lHogYZ.js +0 -73
  921. package/dist/targets-KmjP2E8s.js +0 -13
  922. package/node_modules/@slack/socket-mode/README.md +0 -221
  923. package/node_modules/@slack/socket-mode/dist/package.json +0 -75
  924. package/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.d.ts +0 -102
  925. package/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.d.ts.map +0 -1
  926. package/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js +0 -330
  927. package/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js.map +0 -1
  928. package/node_modules/@slack/socket-mode/dist/src/SocketModeClient.d.ts +0 -104
  929. package/node_modules/@slack/socket-mode/dist/src/SocketModeClient.d.ts.map +0 -1
  930. package/node_modules/@slack/socket-mode/dist/src/SocketModeClient.js +0 -412
  931. package/node_modules/@slack/socket-mode/dist/src/SocketModeClient.js.map +0 -1
  932. package/node_modules/@slack/socket-mode/dist/src/SocketModeOptions.d.ts +0 -77
  933. package/node_modules/@slack/socket-mode/dist/src/SocketModeOptions.d.ts.map +0 -1
  934. package/node_modules/@slack/socket-mode/dist/src/errors.d.ts +0 -54
  935. package/node_modules/@slack/socket-mode/dist/src/errors.d.ts.map +0 -1
  936. package/node_modules/@slack/socket-mode/dist/src/errors.js +0 -64
  937. package/node_modules/@slack/socket-mode/dist/src/errors.js.map +0 -1
  938. package/node_modules/@slack/socket-mode/dist/src/index.d.ts +0 -6
  939. package/node_modules/@slack/socket-mode/dist/src/index.d.ts.map +0 -1
  940. package/node_modules/@slack/socket-mode/dist/src/index.js +0 -19
  941. package/node_modules/@slack/socket-mode/dist/src/index.js.map +0 -1
  942. package/node_modules/@slack/socket-mode/node_modules/@slack/logger/LICENSE +0 -23
  943. package/node_modules/@slack/socket-mode/node_modules/@slack/logger/README.md +0 -66
  944. package/node_modules/@slack/socket-mode/node_modules/@slack/logger/dist/index.d.ts +0 -94
  945. package/node_modules/@slack/socket-mode/node_modules/@slack/logger/dist/index.d.ts.map +0 -1
  946. package/node_modules/@slack/socket-mode/node_modules/@slack/logger/dist/index.js +0 -98
  947. package/node_modules/@slack/socket-mode/node_modules/@slack/logger/dist/index.js.map +0 -1
  948. package/node_modules/@slack/socket-mode/node_modules/@slack/logger/package.json +0 -42
  949. package/node_modules/@slack/socket-mode/node_modules/@types/node/README.md +0 -15
  950. package/node_modules/@slack/socket-mode/node_modules/@types/node/assert/strict.d.ts +0 -68
  951. package/node_modules/@slack/socket-mode/node_modules/@types/node/assert.d.ts +0 -1077
  952. package/node_modules/@slack/socket-mode/node_modules/@types/node/async_hooks.d.ts +0 -711
  953. package/node_modules/@slack/socket-mode/node_modules/@types/node/buffer.buffer.d.ts +0 -466
  954. package/node_modules/@slack/socket-mode/node_modules/@types/node/buffer.d.ts +0 -1799
  955. package/node_modules/@slack/socket-mode/node_modules/@types/node/child_process.d.ts +0 -1362
  956. package/node_modules/@slack/socket-mode/node_modules/@types/node/cluster.d.ts +0 -432
  957. package/node_modules/@slack/socket-mode/node_modules/@types/node/console.d.ts +0 -93
  958. package/node_modules/@slack/socket-mode/node_modules/@types/node/constants.d.ts +0 -14
  959. package/node_modules/@slack/socket-mode/node_modules/@types/node/crypto.d.ts +0 -3954
  960. package/node_modules/@slack/socket-mode/node_modules/@types/node/dgram.d.ts +0 -537
  961. package/node_modules/@slack/socket-mode/node_modules/@types/node/diagnostics_channel.d.ts +0 -794
  962. package/node_modules/@slack/socket-mode/node_modules/@types/node/dns/promises.d.ts +0 -497
  963. package/node_modules/@slack/socket-mode/node_modules/@types/node/dns.d.ts +0 -876
  964. package/node_modules/@slack/socket-mode/node_modules/@types/node/domain.d.ts +0 -150
  965. package/node_modules/@slack/socket-mode/node_modules/@types/node/events.d.ts +0 -1008
  966. package/node_modules/@slack/socket-mode/node_modules/@types/node/ffi.d.ts +0 -486
  967. package/node_modules/@slack/socket-mode/node_modules/@types/node/fs/promises.d.ts +0 -1481
  968. package/node_modules/@slack/socket-mode/node_modules/@types/node/fs.d.ts +0 -4786
  969. package/node_modules/@slack/socket-mode/node_modules/@types/node/globals.d.ts +0 -150
  970. package/node_modules/@slack/socket-mode/node_modules/@types/node/globals.typedarray.d.ts +0 -101
  971. package/node_modules/@slack/socket-mode/node_modules/@types/node/http.d.ts +0 -2172
  972. package/node_modules/@slack/socket-mode/node_modules/@types/node/http2.d.ts +0 -2489
  973. package/node_modules/@slack/socket-mode/node_modules/@types/node/https.d.ts +0 -400
  974. package/node_modules/@slack/socket-mode/node_modules/@types/node/index.d.ts +0 -115
  975. package/node_modules/@slack/socket-mode/node_modules/@types/node/inspector/promises.d.ts +0 -35
  976. package/node_modules/@slack/socket-mode/node_modules/@types/node/inspector.d.ts +0 -264
  977. package/node_modules/@slack/socket-mode/node_modules/@types/node/inspector.generated.d.ts +0 -4406
  978. package/node_modules/@slack/socket-mode/node_modules/@types/node/module.d.ts +0 -726
  979. package/node_modules/@slack/socket-mode/node_modules/@types/node/net.d.ts +0 -970
  980. package/node_modules/@slack/socket-mode/node_modules/@types/node/os.d.ts +0 -498
  981. package/node_modules/@slack/socket-mode/node_modules/@types/node/package.json +0 -155
  982. package/node_modules/@slack/socket-mode/node_modules/@types/node/path/posix.d.ts +0 -8
  983. package/node_modules/@slack/socket-mode/node_modules/@types/node/path/win32.d.ts +0 -8
  984. package/node_modules/@slack/socket-mode/node_modules/@types/node/path.d.ts +0 -178
  985. package/node_modules/@slack/socket-mode/node_modules/@types/node/perf_hooks.d.ts +0 -604
  986. package/node_modules/@slack/socket-mode/node_modules/@types/node/process.d.ts +0 -2217
  987. package/node_modules/@slack/socket-mode/node_modules/@types/node/punycode.d.ts +0 -89
  988. package/node_modules/@slack/socket-mode/node_modules/@types/node/querystring.d.ts +0 -139
  989. package/node_modules/@slack/socket-mode/node_modules/@types/node/quic.d.ts +0 -978
  990. package/node_modules/@slack/socket-mode/node_modules/@types/node/readline/promises.d.ts +0 -158
  991. package/node_modules/@slack/socket-mode/node_modules/@types/node/readline.d.ts +0 -508
  992. package/node_modules/@slack/socket-mode/node_modules/@types/node/repl.d.ts +0 -420
  993. package/node_modules/@slack/socket-mode/node_modules/@types/node/sea.d.ts +0 -47
  994. package/node_modules/@slack/socket-mode/node_modules/@types/node/sqlite.d.ts +0 -1123
  995. package/node_modules/@slack/socket-mode/node_modules/@types/node/stream/consumers.d.ts +0 -114
  996. package/node_modules/@slack/socket-mode/node_modules/@types/node/stream/iter.d.ts +0 -451
  997. package/node_modules/@slack/socket-mode/node_modules/@types/node/stream/promises.d.ts +0 -211
  998. package/node_modules/@slack/socket-mode/node_modules/@types/node/stream/web.d.ts +0 -300
  999. package/node_modules/@slack/socket-mode/node_modules/@types/node/stream.d.ts +0 -1806
  1000. package/node_modules/@slack/socket-mode/node_modules/@types/node/string_decoder.d.ts +0 -27
  1001. package/node_modules/@slack/socket-mode/node_modules/@types/node/test/reporters.d.ts +0 -59
  1002. package/node_modules/@slack/socket-mode/node_modules/@types/node/test.d.ts +0 -2389
  1003. package/node_modules/@slack/socket-mode/node_modules/@types/node/timers/promises.d.ts +0 -93
  1004. package/node_modules/@slack/socket-mode/node_modules/@types/node/timers.d.ts +0 -149
  1005. package/node_modules/@slack/socket-mode/node_modules/@types/node/tls.d.ts +0 -1193
  1006. package/node_modules/@slack/socket-mode/node_modules/@types/node/trace_events.d.ts +0 -103
  1007. package/node_modules/@slack/socket-mode/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -462
  1008. package/node_modules/@slack/socket-mode/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
  1009. package/node_modules/@slack/socket-mode/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -36
  1010. package/node_modules/@slack/socket-mode/node_modules/@types/node/ts5.6/index.d.ts +0 -117
  1011. package/node_modules/@slack/socket-mode/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
  1012. package/node_modules/@slack/socket-mode/node_modules/@types/node/ts5.7/index.d.ts +0 -117
  1013. package/node_modules/@slack/socket-mode/node_modules/@types/node/tty.d.ts +0 -225
  1014. package/node_modules/@slack/socket-mode/node_modules/@types/node/url.d.ts +0 -556
  1015. package/node_modules/@slack/socket-mode/node_modules/@types/node/util/types.d.ts +0 -558
  1016. package/node_modules/@slack/socket-mode/node_modules/@types/node/util.d.ts +0 -1677
  1017. package/node_modules/@slack/socket-mode/node_modules/@types/node/v8.d.ts +0 -1062
  1018. package/node_modules/@slack/socket-mode/node_modules/@types/node/vm.d.ts +0 -1136
  1019. package/node_modules/@slack/socket-mode/node_modules/@types/node/wasi.d.ts +0 -131
  1020. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -59
  1021. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/blob.d.ts +0 -23
  1022. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/console.d.ts +0 -9
  1023. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
  1024. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/domexception.d.ts +0 -83
  1025. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
  1026. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/events.d.ts +0 -106
  1027. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/fetch.d.ts +0 -69
  1028. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
  1029. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
  1030. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/navigator.d.ts +0 -25
  1031. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/performance.d.ts +0 -45
  1032. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/storage.d.ts +0 -24
  1033. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/streams.d.ts +0 -115
  1034. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/timers.d.ts +0 -44
  1035. package/node_modules/@slack/socket-mode/node_modules/@types/node/web-globals/url.d.ts +0 -24
  1036. package/node_modules/@slack/socket-mode/node_modules/@types/node/worker_threads.d.ts +0 -669
  1037. package/node_modules/@slack/socket-mode/node_modules/@types/node/zlib/iter.d.ts +0 -131
  1038. package/node_modules/@slack/socket-mode/node_modules/@types/node/zlib.d.ts +0 -589
  1039. package/node_modules/@slack/socket-mode/node_modules/undici-types/LICENSE +0 -21
  1040. package/node_modules/@slack/socket-mode/node_modules/undici-types/README.md +0 -6
  1041. package/node_modules/@slack/socket-mode/node_modules/undici-types/agent.d.ts +0 -30
  1042. package/node_modules/@slack/socket-mode/node_modules/undici-types/api.d.ts +0 -43
  1043. package/node_modules/@slack/socket-mode/node_modules/undici-types/balanced-pool.d.ts +0 -30
  1044. package/node_modules/@slack/socket-mode/node_modules/undici-types/cache-interceptor.d.ts +0 -179
  1045. package/node_modules/@slack/socket-mode/node_modules/undici-types/cache.d.ts +0 -36
  1046. package/node_modules/@slack/socket-mode/node_modules/undici-types/client-stats.d.ts +0 -15
  1047. package/node_modules/@slack/socket-mode/node_modules/undici-types/client.d.ts +0 -129
  1048. package/node_modules/@slack/socket-mode/node_modules/undici-types/connector.d.ts +0 -36
  1049. package/node_modules/@slack/socket-mode/node_modules/undici-types/content-type.d.ts +0 -21
  1050. package/node_modules/@slack/socket-mode/node_modules/undici-types/cookies.d.ts +0 -30
  1051. package/node_modules/@slack/socket-mode/node_modules/undici-types/diagnostics-channel.d.ts +0 -74
  1052. package/node_modules/@slack/socket-mode/node_modules/undici-types/dispatcher.d.ts +0 -253
  1053. package/node_modules/@slack/socket-mode/node_modules/undici-types/dispatcher1-wrapper.d.ts +0 -7
  1054. package/node_modules/@slack/socket-mode/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -22
  1055. package/node_modules/@slack/socket-mode/node_modules/undici-types/errors.d.ts +0 -177
  1056. package/node_modules/@slack/socket-mode/node_modules/undici-types/eventsource.d.ts +0 -66
  1057. package/node_modules/@slack/socket-mode/node_modules/undici-types/fetch.d.ts +0 -231
  1058. package/node_modules/@slack/socket-mode/node_modules/undici-types/formdata.d.ts +0 -108
  1059. package/node_modules/@slack/socket-mode/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  1060. package/node_modules/@slack/socket-mode/node_modules/undici-types/global-origin.d.ts +0 -7
  1061. package/node_modules/@slack/socket-mode/node_modules/undici-types/h2c-client.d.ts +0 -73
  1062. package/node_modules/@slack/socket-mode/node_modules/undici-types/handlers.d.ts +0 -14
  1063. package/node_modules/@slack/socket-mode/node_modules/undici-types/header.d.ts +0 -165
  1064. package/node_modules/@slack/socket-mode/node_modules/undici-types/index.d.ts +0 -93
  1065. package/node_modules/@slack/socket-mode/node_modules/undici-types/interceptors.d.ts +0 -80
  1066. package/node_modules/@slack/socket-mode/node_modules/undici-types/mock-agent.d.ts +0 -68
  1067. package/node_modules/@slack/socket-mode/node_modules/undici-types/mock-call-history.d.ts +0 -111
  1068. package/node_modules/@slack/socket-mode/node_modules/undici-types/mock-client.d.ts +0 -27
  1069. package/node_modules/@slack/socket-mode/node_modules/undici-types/mock-errors.d.ts +0 -12
  1070. package/node_modules/@slack/socket-mode/node_modules/undici-types/mock-interceptor.d.ts +0 -94
  1071. package/node_modules/@slack/socket-mode/node_modules/undici-types/mock-pool.d.ts +0 -27
  1072. package/node_modules/@slack/socket-mode/node_modules/undici-types/package.json +0 -55
  1073. package/node_modules/@slack/socket-mode/node_modules/undici-types/patch.d.ts +0 -29
  1074. package/node_modules/@slack/socket-mode/node_modules/undici-types/pool-stats.d.ts +0 -19
  1075. package/node_modules/@slack/socket-mode/node_modules/undici-types/pool.d.ts +0 -39
  1076. package/node_modules/@slack/socket-mode/node_modules/undici-types/proxy-agent.d.ts +0 -29
  1077. package/node_modules/@slack/socket-mode/node_modules/undici-types/readable.d.ts +0 -68
  1078. package/node_modules/@slack/socket-mode/node_modules/undici-types/retry-agent.d.ts +0 -8
  1079. package/node_modules/@slack/socket-mode/node_modules/undici-types/retry-handler.d.ts +0 -125
  1080. package/node_modules/@slack/socket-mode/node_modules/undici-types/round-robin-pool.d.ts +0 -39
  1081. package/node_modules/@slack/socket-mode/node_modules/undici-types/snapshot-agent.d.ts +0 -113
  1082. package/node_modules/@slack/socket-mode/node_modules/undici-types/socks5-proxy-agent.d.ts +0 -25
  1083. package/node_modules/@slack/socket-mode/node_modules/undici-types/util.d.ts +0 -18
  1084. package/node_modules/@slack/socket-mode/node_modules/undici-types/utility.d.ts +0 -7
  1085. package/node_modules/@slack/socket-mode/node_modules/undici-types/webidl.d.ts +0 -346
  1086. package/node_modules/@slack/socket-mode/node_modules/undici-types/websocket.d.ts +0 -188
  1087. package/node_modules/@slack/socket-mode/package.json +0 -75
  1088. package/node_modules/get-east-asian-width/index.d.ts +0 -60
  1089. package/node_modules/get-east-asian-width/index.js +0 -30
  1090. package/node_modules/get-east-asian-width/lookup-data.js +0 -21
  1091. package/node_modules/get-east-asian-width/lookup.js +0 -138
  1092. package/node_modules/get-east-asian-width/package.json +0 -71
  1093. package/node_modules/get-east-asian-width/readme.md +0 -65
  1094. package/node_modules/get-east-asian-width/utilities.js +0 -24
  1095. package/node_modules/p-map/index.d.ts +0 -155
  1096. package/node_modules/p-map/index.js +0 -285
  1097. package/node_modules/p-map/license +0 -9
  1098. package/node_modules/p-map/package.json +0 -57
  1099. package/node_modules/p-map/readme.md +0 -190
  1100. package/node_modules/undici/LICENSE +0 -21
  1101. package/node_modules/undici/README.md +0 -741
  1102. package/node_modules/undici/docs/docs/api/Agent.md +0 -84
  1103. package/node_modules/undici/docs/docs/api/BalancedPool.md +0 -99
  1104. package/node_modules/undici/docs/docs/api/CacheStorage.md +0 -30
  1105. package/node_modules/undici/docs/docs/api/CacheStore.md +0 -164
  1106. package/node_modules/undici/docs/docs/api/Client.md +0 -288
  1107. package/node_modules/undici/docs/docs/api/ClientStats.md +0 -27
  1108. package/node_modules/undici/docs/docs/api/Connector.md +0 -115
  1109. package/node_modules/undici/docs/docs/api/ContentType.md +0 -57
  1110. package/node_modules/undici/docs/docs/api/Cookies.md +0 -128
  1111. package/node_modules/undici/docs/docs/api/Debug.md +0 -62
  1112. package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +0 -315
  1113. package/node_modules/undici/docs/docs/api/Dispatcher.md +0 -1392
  1114. package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +0 -159
  1115. package/node_modules/undici/docs/docs/api/Errors.md +0 -49
  1116. package/node_modules/undici/docs/docs/api/EventSource.md +0 -45
  1117. package/node_modules/undici/docs/docs/api/Fetch.md +0 -60
  1118. package/node_modules/undici/docs/docs/api/GlobalInstallation.md +0 -139
  1119. package/node_modules/undici/docs/docs/api/H2CClient.md +0 -263
  1120. package/node_modules/undici/docs/docs/api/MockAgent.md +0 -603
  1121. package/node_modules/undici/docs/docs/api/MockCallHistory.md +0 -197
  1122. package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +0 -43
  1123. package/node_modules/undici/docs/docs/api/MockClient.md +0 -81
  1124. package/node_modules/undici/docs/docs/api/MockErrors.md +0 -12
  1125. package/node_modules/undici/docs/docs/api/MockPool.md +0 -555
  1126. package/node_modules/undici/docs/docs/api/Pool.md +0 -84
  1127. package/node_modules/undici/docs/docs/api/PoolStats.md +0 -35
  1128. package/node_modules/undici/docs/docs/api/ProxyAgent.md +0 -229
  1129. package/node_modules/undici/docs/docs/api/RedirectHandler.md +0 -93
  1130. package/node_modules/undici/docs/docs/api/RetryAgent.md +0 -50
  1131. package/node_modules/undici/docs/docs/api/RetryHandler.md +0 -118
  1132. package/node_modules/undici/docs/docs/api/RoundRobinPool.md +0 -145
  1133. package/node_modules/undici/docs/docs/api/SnapshotAgent.md +0 -616
  1134. package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +0 -275
  1135. package/node_modules/undici/docs/docs/api/Util.md +0 -25
  1136. package/node_modules/undici/docs/docs/api/WebSocket.md +0 -141
  1137. package/node_modules/undici/docs/docs/api/api-lifecycle.md +0 -91
  1138. package/node_modules/undici/docs/docs/best-practices/client-certificate.md +0 -64
  1139. package/node_modules/undici/docs/docs/best-practices/crawling.md +0 -58
  1140. package/node_modules/undici/docs/docs/best-practices/mocking-request.md +0 -190
  1141. package/node_modules/undici/docs/docs/best-practices/proxy.md +0 -127
  1142. package/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +0 -224
  1143. package/node_modules/undici/docs/docs/best-practices/writing-tests.md +0 -63
  1144. package/node_modules/undici/index-fetch.js +0 -65
  1145. package/node_modules/undici/index.d.ts +0 -3
  1146. package/node_modules/undici/index.js +0 -234
  1147. package/node_modules/undici/lib/api/abort-signal.js +0 -59
  1148. package/node_modules/undici/lib/api/api-connect.js +0 -110
  1149. package/node_modules/undici/lib/api/api-pipeline.js +0 -252
  1150. package/node_modules/undici/lib/api/api-request.js +0 -214
  1151. package/node_modules/undici/lib/api/api-stream.js +0 -209
  1152. package/node_modules/undici/lib/api/api-upgrade.js +0 -111
  1153. package/node_modules/undici/lib/api/index.js +0 -7
  1154. package/node_modules/undici/lib/api/readable.js +0 -580
  1155. package/node_modules/undici/lib/cache/memory-cache-store.js +0 -234
  1156. package/node_modules/undici/lib/cache/sqlite-cache-store.js +0 -461
  1157. package/node_modules/undici/lib/core/connect.js +0 -153
  1158. package/node_modules/undici/lib/core/constants.js +0 -143
  1159. package/node_modules/undici/lib/core/diagnostics.js +0 -227
  1160. package/node_modules/undici/lib/core/errors.js +0 -477
  1161. package/node_modules/undici/lib/core/request.js +0 -453
  1162. package/node_modules/undici/lib/core/socks5-client.js +0 -422
  1163. package/node_modules/undici/lib/core/socks5-utils.js +0 -212
  1164. package/node_modules/undici/lib/core/symbols.js +0 -75
  1165. package/node_modules/undici/lib/core/tree.js +0 -160
  1166. package/node_modules/undici/lib/core/util.js +0 -992
  1167. package/node_modules/undici/lib/dispatcher/agent.js +0 -158
  1168. package/node_modules/undici/lib/dispatcher/balanced-pool.js +0 -219
  1169. package/node_modules/undici/lib/dispatcher/client-h1.js +0 -1722
  1170. package/node_modules/undici/lib/dispatcher/client-h2.js +0 -995
  1171. package/node_modules/undici/lib/dispatcher/client.js +0 -664
  1172. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +0 -184
  1173. package/node_modules/undici/lib/dispatcher/dispatcher.js +0 -48
  1174. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +0 -146
  1175. package/node_modules/undici/lib/dispatcher/fixed-queue.js +0 -135
  1176. package/node_modules/undici/lib/dispatcher/h2c-client.js +0 -51
  1177. package/node_modules/undici/lib/dispatcher/pool-base.js +0 -214
  1178. package/node_modules/undici/lib/dispatcher/pool.js +0 -118
  1179. package/node_modules/undici/lib/dispatcher/proxy-agent.js +0 -319
  1180. package/node_modules/undici/lib/dispatcher/retry-agent.js +0 -35
  1181. package/node_modules/undici/lib/dispatcher/round-robin-pool.js +0 -137
  1182. package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +0 -260
  1183. package/node_modules/undici/lib/encoding/index.js +0 -33
  1184. package/node_modules/undici/lib/global.js +0 -59
  1185. package/node_modules/undici/lib/handler/cache-handler.js +0 -578
  1186. package/node_modules/undici/lib/handler/cache-revalidation-handler.js +0 -124
  1187. package/node_modules/undici/lib/handler/decorator-handler.js +0 -67
  1188. package/node_modules/undici/lib/handler/deduplication-handler.js +0 -460
  1189. package/node_modules/undici/lib/handler/redirect-handler.js +0 -238
  1190. package/node_modules/undici/lib/handler/retry-handler.js +0 -394
  1191. package/node_modules/undici/lib/handler/unwrap-handler.js +0 -106
  1192. package/node_modules/undici/lib/handler/wrap-handler.js +0 -105
  1193. package/node_modules/undici/lib/interceptor/cache.js +0 -495
  1194. package/node_modules/undici/lib/interceptor/decompress.js +0 -259
  1195. package/node_modules/undici/lib/interceptor/deduplicate.js +0 -117
  1196. package/node_modules/undici/lib/interceptor/dns.js +0 -571
  1197. package/node_modules/undici/lib/interceptor/dump.js +0 -112
  1198. package/node_modules/undici/lib/interceptor/redirect.js +0 -21
  1199. package/node_modules/undici/lib/interceptor/response-error.js +0 -95
  1200. package/node_modules/undici/lib/interceptor/retry.js +0 -19
  1201. package/node_modules/undici/lib/llhttp/.gitkeep +0 -0
  1202. package/node_modules/undici/lib/llhttp/constants.d.ts +0 -195
  1203. package/node_modules/undici/lib/llhttp/constants.js +0 -531
  1204. package/node_modules/undici/lib/llhttp/llhttp-wasm.js +0 -15
  1205. package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +0 -15
  1206. package/node_modules/undici/lib/llhttp/utils.d.ts +0 -2
  1207. package/node_modules/undici/lib/llhttp/utils.js +0 -12
  1208. package/node_modules/undici/lib/mock/mock-agent.js +0 -232
  1209. package/node_modules/undici/lib/mock/mock-call-history.js +0 -248
  1210. package/node_modules/undici/lib/mock/mock-client.js +0 -68
  1211. package/node_modules/undici/lib/mock/mock-errors.js +0 -29
  1212. package/node_modules/undici/lib/mock/mock-interceptor.js +0 -209
  1213. package/node_modules/undici/lib/mock/mock-pool.js +0 -68
  1214. package/node_modules/undici/lib/mock/mock-symbols.js +0 -32
  1215. package/node_modules/undici/lib/mock/mock-utils.js +0 -486
  1216. package/node_modules/undici/lib/mock/pending-interceptors-formatter.js +0 -43
  1217. package/node_modules/undici/lib/mock/snapshot-agent.js +0 -353
  1218. package/node_modules/undici/lib/mock/snapshot-recorder.js +0 -588
  1219. package/node_modules/undici/lib/mock/snapshot-utils.js +0 -158
  1220. package/node_modules/undici/lib/util/cache.js +0 -414
  1221. package/node_modules/undici/lib/util/date.js +0 -653
  1222. package/node_modules/undici/lib/util/promise.js +0 -28
  1223. package/node_modules/undici/lib/util/runtime-features.js +0 -124
  1224. package/node_modules/undici/lib/util/stats.js +0 -32
  1225. package/node_modules/undici/lib/util/timers.js +0 -425
  1226. package/node_modules/undici/lib/web/cache/cache.js +0 -864
  1227. package/node_modules/undici/lib/web/cache/cachestorage.js +0 -152
  1228. package/node_modules/undici/lib/web/cache/util.js +0 -45
  1229. package/node_modules/undici/lib/web/cookies/constants.js +0 -12
  1230. package/node_modules/undici/lib/web/cookies/index.js +0 -199
  1231. package/node_modules/undici/lib/web/cookies/parse.js +0 -314
  1232. package/node_modules/undici/lib/web/cookies/util.js +0 -282
  1233. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +0 -399
  1234. package/node_modules/undici/lib/web/eventsource/eventsource.js +0 -501
  1235. package/node_modules/undici/lib/web/eventsource/util.js +0 -29
  1236. package/node_modules/undici/lib/web/fetch/LICENSE +0 -21
  1237. package/node_modules/undici/lib/web/fetch/body.js +0 -509
  1238. package/node_modules/undici/lib/web/fetch/constants.js +0 -131
  1239. package/node_modules/undici/lib/web/fetch/data-url.js +0 -596
  1240. package/node_modules/undici/lib/web/fetch/formdata-parser.js +0 -586
  1241. package/node_modules/undici/lib/web/fetch/formdata.js +0 -259
  1242. package/node_modules/undici/lib/web/fetch/global.js +0 -40
  1243. package/node_modules/undici/lib/web/fetch/headers.js +0 -719
  1244. package/node_modules/undici/lib/web/fetch/index.js +0 -2413
  1245. package/node_modules/undici/lib/web/fetch/request.js +0 -1115
  1246. package/node_modules/undici/lib/web/fetch/response.js +0 -641
  1247. package/node_modules/undici/lib/web/fetch/util.js +0 -1522
  1248. package/node_modules/undici/lib/web/infra/index.js +0 -229
  1249. package/node_modules/undici/lib/web/subresource-integrity/Readme.md +0 -9
  1250. package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +0 -307
  1251. package/node_modules/undici/lib/web/webidl/index.js +0 -1006
  1252. package/node_modules/undici/lib/web/websocket/connection.js +0 -329
  1253. package/node_modules/undici/lib/web/websocket/constants.js +0 -126
  1254. package/node_modules/undici/lib/web/websocket/events.js +0 -331
  1255. package/node_modules/undici/lib/web/websocket/frame.js +0 -133
  1256. package/node_modules/undici/lib/web/websocket/permessage-deflate.js +0 -100
  1257. package/node_modules/undici/lib/web/websocket/receiver.js +0 -507
  1258. package/node_modules/undici/lib/web/websocket/sender.js +0 -109
  1259. package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +0 -104
  1260. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +0 -498
  1261. package/node_modules/undici/lib/web/websocket/util.js +0 -347
  1262. package/node_modules/undici/lib/web/websocket/websocket.js +0 -758
  1263. package/node_modules/undici/package.json +0 -152
  1264. package/node_modules/undici/scripts/strip-comments.js +0 -10
  1265. package/node_modules/undici/types/README.md +0 -6
  1266. package/node_modules/undici/types/agent.d.ts +0 -32
  1267. package/node_modules/undici/types/api.d.ts +0 -43
  1268. package/node_modules/undici/types/balanced-pool.d.ts +0 -30
  1269. package/node_modules/undici/types/cache-interceptor.d.ts +0 -179
  1270. package/node_modules/undici/types/cache.d.ts +0 -36
  1271. package/node_modules/undici/types/client-stats.d.ts +0 -15
  1272. package/node_modules/undici/types/client.d.ts +0 -139
  1273. package/node_modules/undici/types/connector.d.ts +0 -36
  1274. package/node_modules/undici/types/content-type.d.ts +0 -21
  1275. package/node_modules/undici/types/cookies.d.ts +0 -30
  1276. package/node_modules/undici/types/diagnostics-channel.d.ts +0 -74
  1277. package/node_modules/undici/types/dispatcher.d.ts +0 -275
  1278. package/node_modules/undici/types/env-http-proxy-agent.d.ts +0 -22
  1279. package/node_modules/undici/types/errors.d.ts +0 -177
  1280. package/node_modules/undici/types/eventsource.d.ts +0 -66
  1281. package/node_modules/undici/types/fetch.d.ts +0 -231
  1282. package/node_modules/undici/types/formdata.d.ts +0 -114
  1283. package/node_modules/undici/types/global-dispatcher.d.ts +0 -9
  1284. package/node_modules/undici/types/global-origin.d.ts +0 -7
  1285. package/node_modules/undici/types/h2c-client.d.ts +0 -73
  1286. package/node_modules/undici/types/handlers.d.ts +0 -14
  1287. package/node_modules/undici/types/header.d.ts +0 -160
  1288. package/node_modules/undici/types/index.d.ts +0 -91
  1289. package/node_modules/undici/types/interceptors.d.ts +0 -80
  1290. package/node_modules/undici/types/mock-agent.d.ts +0 -68
  1291. package/node_modules/undici/types/mock-call-history.d.ts +0 -111
  1292. package/node_modules/undici/types/mock-client.d.ts +0 -27
  1293. package/node_modules/undici/types/mock-errors.d.ts +0 -12
  1294. package/node_modules/undici/types/mock-interceptor.d.ts +0 -94
  1295. package/node_modules/undici/types/mock-pool.d.ts +0 -27
  1296. package/node_modules/undici/types/patch.d.ts +0 -29
  1297. package/node_modules/undici/types/pool-stats.d.ts +0 -19
  1298. package/node_modules/undici/types/pool.d.ts +0 -41
  1299. package/node_modules/undici/types/proxy-agent.d.ts +0 -29
  1300. package/node_modules/undici/types/readable.d.ts +0 -68
  1301. package/node_modules/undici/types/retry-agent.d.ts +0 -8
  1302. package/node_modules/undici/types/retry-handler.d.ts +0 -125
  1303. package/node_modules/undici/types/round-robin-pool.d.ts +0 -41
  1304. package/node_modules/undici/types/snapshot-agent.d.ts +0 -109
  1305. package/node_modules/undici/types/socks5-proxy-agent.d.ts +0 -25
  1306. package/node_modules/undici/types/util.d.ts +0 -18
  1307. package/node_modules/undici/types/utility.d.ts +0 -7
  1308. package/node_modules/undici/types/webidl.d.ts +0 -347
  1309. package/node_modules/undici/types/websocket.d.ts +0 -188
  1310. /package/dist/{registry-bbjH7IHX.js → .setup/registry-bbjH7IHX.mjs} +0 -0
  1311. /package/dist/{slash-commands.runtime-BTTMlmwy.js → .setup/slash-commands.runtime-BTTMlmwy.mjs} +0 -0
  1312. /package/dist/{slash-plugin-commands.runtime-Dosfcx3X.js → .setup/slash-plugin-commands.runtime-Dosfcx3X.mjs} +0 -0
  1313. /package/dist/{slash-skill-commands.runtime-CD1J2ODY.js → .setup/slash-skill-commands.runtime-CD1J2ODY.mjs} +0 -0
  1314. /package/dist/{thread-ts-DUGhaYKq.js → .setup/thread-ts-DUGhaYKq.mjs} +0 -0
  1315. /package/node_modules/@slack/{socket-mode → bolt/node_modules/@slack/socket-mode}/LICENSE +0 -0
  1316. /package/node_modules/@slack/{socket-mode → bolt/node_modules/@slack/socket-mode}/dist/src/SocketModeOptions.js +0 -0
  1317. /package/node_modules/@slack/{socket-mode → bolt/node_modules/@slack/socket-mode}/dist/src/SocketModeOptions.js.map +0 -0
  1318. /package/node_modules/@slack/{socket-mode → bolt/node_modules/@slack/socket-mode}/dist/src/UnrecoverableSocketModeStartError.d.ts +0 -0
  1319. /package/node_modules/@slack/{socket-mode → bolt/node_modules/@slack/socket-mode}/dist/src/UnrecoverableSocketModeStartError.d.ts.map +0 -0
  1320. /package/node_modules/@slack/{socket-mode → bolt/node_modules/@slack/socket-mode}/dist/src/UnrecoverableSocketModeStartError.js +0 -0
  1321. /package/node_modules/@slack/{socket-mode → bolt/node_modules/@slack/socket-mode}/dist/src/UnrecoverableSocketModeStartError.js.map +0 -0
  1322. /package/node_modules/@slack/{socket-mode → bolt/node_modules/@slack/socket-mode}/dist/src/logger.d.ts +0 -0
  1323. /package/node_modules/@slack/{socket-mode → bolt/node_modules/@slack/socket-mode}/dist/src/logger.d.ts.map +0 -0
  1324. /package/node_modules/@slack/{socket-mode → bolt/node_modules/@slack/socket-mode}/dist/src/logger.js +0 -0
  1325. /package/node_modules/@slack/{socket-mode → bolt/node_modules/@slack/socket-mode}/dist/src/logger.js.map +0 -0
  1326. /package/node_modules/@slack/{socket-mode/node_modules/@types/node → bolt/node_modules/@types/ws}/LICENSE +0 -0
  1327. /package/node_modules/@slack/{socket-mode → bolt}/node_modules/eventemitter3/LICENSE +0 -0
  1328. /package/node_modules/@slack/{socket-mode → bolt}/node_modules/eventemitter3/README.md +0 -0
  1329. /package/node_modules/@slack/{socket-mode → bolt}/node_modules/eventemitter3/dist/eventemitter3.esm.js +0 -0
  1330. /package/node_modules/@slack/{socket-mode → bolt}/node_modules/eventemitter3/dist/eventemitter3.esm.min.js +0 -0
  1331. /package/node_modules/@slack/{socket-mode → bolt}/node_modules/eventemitter3/dist/eventemitter3.esm.min.js.map +0 -0
  1332. /package/node_modules/@slack/{socket-mode → bolt}/node_modules/eventemitter3/dist/eventemitter3.umd.js +0 -0
  1333. /package/node_modules/@slack/{socket-mode → bolt}/node_modules/eventemitter3/dist/eventemitter3.umd.min.js +0 -0
  1334. /package/node_modules/@slack/{socket-mode → bolt}/node_modules/eventemitter3/dist/eventemitter3.umd.min.js.map +0 -0
  1335. /package/node_modules/@slack/{socket-mode → bolt}/node_modules/eventemitter3/index.d.ts +0 -0
  1336. /package/node_modules/@slack/{socket-mode → bolt}/node_modules/eventemitter3/index.js +0 -0
  1337. /package/node_modules/@slack/{socket-mode → bolt}/node_modules/eventemitter3/index.mjs +0 -0
  1338. /package/node_modules/@slack/{socket-mode → bolt}/node_modules/eventemitter3/package.json +0 -0
  1339. /package/node_modules/{get-east-asian-width → @slack/web-api/node_modules/is-stream}/license +0 -0
@@ -0,0 +1,3646 @@
1
+ import { t as resolveSlackReplyToMode } from "./account-reply-mode-Bvoq75cS.mjs";
2
+ import { r as parseSlackTarget } from "./target-parsing-C36VFWHQ.mjs";
3
+ import "./targets-DnpzC22e.mjs";
4
+ import { a as SLACK_TEXT_LIMIT, b as truncateSlackText, c as formatSlackError, d as normalizeAllowListLower, f as normalizeSlackAllowOwnerEntry, m as resolveSlackAllowListMatch } from "./reply-blocks-Cwu6LYJI.mjs";
5
+ import { n as isSlackInteractiveRepliesEnabled, t as compileSlackInteractiveReplies } from "./interactive-replies-BLw4HEPS.mjs";
6
+ import { n as resolveSlackNativeStreaming, r as resolveSlackStreamingMode, t as mapStreamingModeToSlackLegacyDraftStreamMode } from "./streaming-compat-DjlgH-Be.mjs";
7
+ import { c as recordSlackThreadParticipation, r as sendMessageSlack, s as hasSlackThreadParticipationWithPersistence } from "./send-DEOvcVM4.mjs";
8
+ import { C as buildSlackEditTextPayload, S as formatSlackFileReference, _ as resolveSlackThreadHistory, b as resolveSlackBlocksText, f as removeSlackReaction, l as reactSlackMessage, r as editSlackMessage, t as deleteSlackMessage, v as resolveSlackThreadStarter, y as chooseSlackPrimaryText } from "./actions-2VEX4Wdz.mjs";
9
+ import { n as normalizeSlackOutboundText } from "./format-xuAop9a-.mjs";
10
+ import { C as stripSlackMentionsForCommandDetection, _ as readSessionUpdatedAt, b as resolveStorePath, c as recordInboundSession, d as resolveSlackCommandIngress, f as resolveSlackEffectiveAllowFrom, g as resolveSlackChatType, h as normalizeSlackChannelType, i as authorizeSlackDirectMessage, l as resolveConversationLabel$1, m as parseSlackAssistantThreadMetadata, p as buildSlackAssistantThreadMetadata, r as resolveSlackRoomContextHints, s as escapeSlackMrkdwn, u as authorizeSlackBotRoomMessage, v as resolveChannelContextVisibilityMode, x as updateLastRoute, y as resolveChannelResetConfig } from "./provider-Bjv1R5E2.mjs";
11
+ import { n as resolveSlackChannelConfig } from "./policy-C6VVHqUf.mjs";
12
+ import { a as resolveDeliveredSlackReplyThreadTs, i as readSlackReplyBlocks, n as deliverReplies, o as resolveSlackThreadTs, s as emitSlackMessageSentHooks, t as createSlackReplyDeliveryPlan } from "./replies-BO37R07g.mjs";
13
+ import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
14
+ import { resolveAgentRoute, resolveInboundLastRouteSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
15
+ import { buildChannelProgressDraftLine, buildChannelProgressDraftLineForEntry, createChannelMessageReplyPipeline, createChannelProgressDraftGate, createDraftStreamLoop, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, formatChannelProgressDraftText, isChannelProgressDraftWorkToolName, mergeChannelProgressDraftLine, resolveAgentOutboundIdentity, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelProgressDraftConfig, resolveChannelProgressDraftMaxLineChars, resolveChannelProgressDraftMaxLines, resolveChannelProgressDraftRender, resolveChannelStreamingBlockEnabled, resolveChannelStreamingNativeTransport, resolveChannelStreamingPreviewToolProgress, resolveChannelStreamingSuppressDefaultToolProgressMessages } from "openclaw/plugin-sdk/channel-outbound";
16
+ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
17
+ import { danger, logVerbose, shouldLogVerbose, sleep } from "openclaw/plugin-sdk/runtime-env";
18
+ import { stripReasoningTagsFromText } from "openclaw/plugin-sdk/text-chunking";
19
+ import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
20
+ import { createHash } from "node:crypto";
21
+ import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
22
+ import { asDateTimestampMs, asFiniteNumberInRange, parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
23
+ import { buildTtsSupplementMediaPayload, getReplyPayloadTtsSupplement, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
24
+ import { ensureConfiguredBindingRouteReady, resolveConfiguredBindingRoute, resolveRuntimeConversationBindingRoute } from "openclaw/plugin-sdk/conversation-runtime";
25
+ import { createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
26
+ import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
27
+ import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
28
+ import { enqueueSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
29
+ import { buildChannelInboundEventContext, buildMentionRegexes, classifyChannelInboundEvent, dispatchChannelInboundReply, formatInboundEnvelope, hasVisibleInboundReplyDispatch, implicitMentionKindWhen, logInboundDrop, matchesMentionWithExplicit, recordDroppedChannelInboundHistory, resolveEnvelopeFormatOptions, resolveUnmentionedGroupInboundPolicy, toInboundMediaFacts } from "openclaw/plugin-sdk/channel-inbound";
30
+ import { filterSupplementalContextItems, resolvePinnedMainDmOwnerFromAllowlist, shouldIncludeSupplementalContext } from "openclaw/plugin-sdk/security-runtime";
31
+ import { DEFAULT_TIMING, createStatusReactionController, logAckFailure, logTypingFailure, removeAckReactionAfterReply, resolveAckReaction, shouldAckReaction } from "openclaw/plugin-sdk/channel-feedback";
32
+ import { dispatchReplyWithBufferedBlockDispatcher } from "openclaw/plugin-sdk/reply-runtime";
33
+ import { hasControlCommand } from "openclaw/plugin-sdk/command-detection";
34
+ import { isAbortRequestText } from "openclaw/plugin-sdk/command-primitives-runtime";
35
+ import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
36
+ import { mimeTypeFromFilePath } from "openclaw/plugin-sdk/media-mime";
37
+ import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
38
+ //#region extensions/slack/src/draft-stream.ts
39
+ const DEFAULT_THROTTLE_MS = 1e3;
40
+ function createSlackDraftStream(params) {
41
+ const maxChars = Math.min(params.maxChars ?? 8e3, SLACK_TEXT_LIMIT);
42
+ const throttleMs = Math.max(250, params.throttleMs ?? DEFAULT_THROTTLE_MS);
43
+ const send = params.send ?? sendMessageSlack;
44
+ const edit = params.edit ?? editSlackMessage;
45
+ const remove = params.remove ?? deleteSlackMessage;
46
+ let streamMessageId;
47
+ let streamChannelId;
48
+ let lastSentKey = "";
49
+ let pendingUpdate;
50
+ let stopped = false;
51
+ const normalizeUpdate = (update) => typeof update === "string" ? { text: update } : update;
52
+ const sendOrEditStreamMessage = async (text) => {
53
+ if (stopped) return;
54
+ const trimmed = text.trimEnd();
55
+ if (!trimmed) return;
56
+ if (trimmed.length > maxChars) {
57
+ stopped = true;
58
+ params.warn?.(`slack stream preview stopped (text length ${trimmed.length} > ${maxChars})`);
59
+ return;
60
+ }
61
+ const update = normalizeUpdate(pendingUpdate ?? text);
62
+ const blocks = update.text === text ? update.blocks : void 0;
63
+ const sentKey = `${trimmed}\n${blocks ? JSON.stringify(blocks) : ""}`;
64
+ if (sentKey === lastSentKey) return;
65
+ lastSentKey = sentKey;
66
+ try {
67
+ if (streamChannelId && streamMessageId) {
68
+ await edit(streamChannelId, streamMessageId, trimmed, {
69
+ cfg: params.cfg,
70
+ token: params.token,
71
+ accountId: params.accountId,
72
+ ...blocks ? { blocks } : {}
73
+ });
74
+ return;
75
+ }
76
+ const sent = await send(params.target, trimmed, {
77
+ cfg: params.cfg,
78
+ token: params.token,
79
+ accountId: params.accountId,
80
+ threadTs: params.resolveThreadTs?.(),
81
+ identity: params.identity,
82
+ ...params.metadata ? { metadata: params.metadata } : {},
83
+ ...blocks ? { blocks } : {}
84
+ });
85
+ streamChannelId = sent.channelId || streamChannelId;
86
+ streamMessageId = sent.messageId || streamMessageId;
87
+ if (!streamChannelId || !streamMessageId) {
88
+ stopped = true;
89
+ params.warn?.("slack stream preview stopped (missing identifiers from sendMessage)");
90
+ return;
91
+ }
92
+ params.onMessageSent?.();
93
+ } catch (err) {
94
+ stopped = true;
95
+ params.warn?.(`slack stream preview failed: ${formatSlackError(err)}`);
96
+ }
97
+ };
98
+ const loop = createDraftStreamLoop({
99
+ throttleMs,
100
+ isStopped: () => stopped,
101
+ sendOrEditStreamMessage
102
+ });
103
+ const stop = () => {
104
+ stopped = true;
105
+ loop.stop();
106
+ };
107
+ const discardPending = async () => {
108
+ stop();
109
+ await loop.waitForInFlight();
110
+ };
111
+ const clear = async () => {
112
+ await discardPending();
113
+ const channelId = streamChannelId;
114
+ const messageId = streamMessageId;
115
+ streamChannelId = void 0;
116
+ streamMessageId = void 0;
117
+ lastSentKey = "";
118
+ pendingUpdate = void 0;
119
+ if (!channelId || !messageId) return;
120
+ try {
121
+ await remove(channelId, messageId, {
122
+ token: params.token,
123
+ accountId: params.accountId
124
+ });
125
+ } catch (err) {
126
+ params.warn?.(`slack stream preview cleanup failed: ${formatSlackError(err)}`);
127
+ }
128
+ };
129
+ const forceNewMessage = () => {
130
+ streamMessageId = void 0;
131
+ streamChannelId = void 0;
132
+ lastSentKey = "";
133
+ pendingUpdate = void 0;
134
+ loop.resetPending();
135
+ };
136
+ params.log?.(`slack stream preview ready (maxChars=${maxChars}, throttleMs=${throttleMs})`);
137
+ return {
138
+ update: (update) => {
139
+ const normalized = normalizeUpdate(update);
140
+ pendingUpdate = update;
141
+ loop.update(normalized.text);
142
+ },
143
+ flush: loop.flush,
144
+ clear,
145
+ discardPending,
146
+ seal: discardPending,
147
+ stop,
148
+ forceNewMessage,
149
+ messageId: () => streamMessageId,
150
+ channelId: () => streamChannelId
151
+ };
152
+ }
153
+ //#endregion
154
+ //#region extensions/slack/src/progress-blocks.ts
155
+ const SLACK_PROGRESS_FIELD_MAX = 1800;
156
+ const DEFAULT_SLACK_PROGRESS_DETAIL_MAX_CHARS = 120;
157
+ const DEFAULT_SLACK_PROGRESS_TASK_DETAIL_MAX_CHARS = 48;
158
+ const SLACK_PROGRESS_CHUNK_TEXT_MAX = 256;
159
+ const SLACK_PROGRESS_TASK_TITLE_MAX = 120;
160
+ const SLACK_PROGRESS_PLAN_FALLBACK_TITLE = "Thinking";
161
+ function field(text) {
162
+ return {
163
+ type: "mrkdwn",
164
+ text: truncateSlackText(text, SLACK_PROGRESS_FIELD_MAX)
165
+ };
166
+ }
167
+ function resolveMaxLineChars(value, fallback) {
168
+ return value && value > 0 ? Math.floor(value) : fallback;
169
+ }
170
+ function compactDetail(value, maxChars) {
171
+ const normalized = value.replace(/\s+/g, " ").trim();
172
+ const chars = Array.from(normalized);
173
+ if (chars.length <= maxChars) return normalized;
174
+ if (maxChars <= 1) return "…";
175
+ const keepStart = Math.max(1, Math.ceil((maxChars - 1) * .45));
176
+ const keepEnd = Math.max(1, maxChars - keepStart - 1);
177
+ return `${chars.slice(0, keepStart).join("").trimEnd()}…${chars.slice(-keepEnd).join("").trimStart()}`;
178
+ }
179
+ function compactTitle(value) {
180
+ return truncateSlackText(value.replace(/\s+/g, " ").trim(), SLACK_PROGRESS_TASK_TITLE_MAX);
181
+ }
182
+ function compactChunkText(value) {
183
+ return truncateSlackText(value.replace(/\s+/g, " ").trim(), SLACK_PROGRESS_CHUNK_TEXT_MAX);
184
+ }
185
+ function lineDetailParts(line) {
186
+ return [line.detail, line.status && line.status !== "completed" && !line.detail?.includes(line.status) ? line.status : void 0].map((part) => part?.trim()).filter((part) => Boolean(part));
187
+ }
188
+ function legacyLineTitle(line) {
189
+ return `${line.icon ?? "•"} *${escapeSlackMrkdwn(line.label)}*`;
190
+ }
191
+ function legacyLineDetail(line, maxChars) {
192
+ const detail = lineDetailParts(line).join(" · ");
193
+ return detail ? escapeSlackMrkdwn(compactDetail(detail, maxChars)) : "—";
194
+ }
195
+ function lineTaskTitle(line, maxLineChars) {
196
+ const label = line.label.replace(/\s+/g, " ").trim() || line.toolName || line.kind || "Update";
197
+ const detail = lineDetailParts(line).join(" · ") || line.status?.trim();
198
+ const fallback = line.text.replace(/\s+/g, " ").trim();
199
+ if (detail) return compactTitle(`${label} — ${compactDetail(detail, maxLineChars)}`);
200
+ if (fallback && fallback !== label) return compactTitle(fallback);
201
+ return compactTitle(label);
202
+ }
203
+ function lineTaskStatus(line) {
204
+ const normalized = line.status?.replace(/\s+/g, " ").trim().toLowerCase();
205
+ if (!normalized) return "in_progress";
206
+ if (normalized === "complete" || normalized === "completed" || normalized === "done" || normalized === "ok" || normalized === "success" || normalized === "succeeded" || normalized === "successful" || normalized === "exit 0") return "complete";
207
+ if (normalized === "error" || normalized === "failed" || normalized === "failure" || normalized.startsWith("exit ")) return normalized === "exit 0" ? "complete" : "error";
208
+ return "in_progress";
209
+ }
210
+ function slugTaskIdPart(value) {
211
+ return value?.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "task";
212
+ }
213
+ function stableTaskIdPart(value) {
214
+ const suffix = createHash("sha256").update(value).digest("hex").slice(0, 8);
215
+ return `${slugTaskIdPart(value)}_${suffix}`;
216
+ }
217
+ function buildPlanTasks(params) {
218
+ const maxLineChars = resolveMaxLineChars(params.maxLineChars, DEFAULT_SLACK_PROGRESS_TASK_DETAIL_MAX_CHARS);
219
+ return params.lines.slice(-50).map((line, index) => ({
220
+ id: line.id ? stableTaskIdPart(line.id) : `${slugTaskIdPart(line.toolName ?? line.kind ?? line.label)}_${index + 1}`,
221
+ title: lineTaskTitle(line, maxLineChars),
222
+ status: lineTaskStatus(line)
223
+ }));
224
+ }
225
+ function resolvePlanTitle(params) {
226
+ return compactChunkText(params.title?.trim() || params.label?.trim() || params.tasks.at(-1)?.title || SLACK_PROGRESS_PLAN_FALLBACK_TITLE);
227
+ }
228
+ function buildSlackProgressStreamChunks(params) {
229
+ const tasks = buildPlanTasks({
230
+ lines: params.lines,
231
+ maxLineChars: params.maxLineChars
232
+ });
233
+ if (tasks.length === 0) return;
234
+ return [{
235
+ type: "plan_update",
236
+ title: resolvePlanTitle({
237
+ label: params.label,
238
+ title: params.title,
239
+ tasks
240
+ })
241
+ }, ...tasks.map((task) => ({
242
+ type: "task_update",
243
+ id: task.id,
244
+ title: task.title,
245
+ status: task.status === "in_progress" ? params.finalInProgressStatus ?? (params.completeInProgress ? "complete" : task.status) : task.status
246
+ }))];
247
+ }
248
+ function buildSlackProgressDraftBlocks(params) {
249
+ const label = params.label?.trim() || params.title?.trim();
250
+ const maxLineChars = resolveMaxLineChars(params.maxLineChars, DEFAULT_SLACK_PROGRESS_DETAIL_MAX_CHARS);
251
+ const renderedBlocks = [...label ? [{
252
+ type: "section",
253
+ text: field(`*${escapeSlackMrkdwn(label)}*`)
254
+ }] : [], ...params.lines.map((line) => ({
255
+ type: "section",
256
+ fields: [field(legacyLineTitle(line)), field(legacyLineDetail(line, maxLineChars))]
257
+ }))].slice(-50);
258
+ return renderedBlocks.length ? renderedBlocks : void 0;
259
+ }
260
+ function buildSlackProgressStreamStartChunks(params) {
261
+ return buildSlackProgressStreamChunks(params);
262
+ }
263
+ function buildSlackProgressStreamUpdateChunks(params) {
264
+ return buildSlackProgressStreamChunks(params);
265
+ }
266
+ function buildSlackProgressStreamCompletionChunks(params) {
267
+ return buildSlackProgressStreamChunks({
268
+ ...params,
269
+ completeInProgress: true
270
+ });
271
+ }
272
+ //#endregion
273
+ //#region extensions/slack/src/stream-mode.ts
274
+ function resolveSlackStreamingConfig(params) {
275
+ const mode = resolveSlackStreamingMode(params);
276
+ return {
277
+ mode,
278
+ nativeStreaming: resolveSlackNativeStreaming(params),
279
+ draftMode: mapStreamingModeToSlackLegacyDraftStreamMode(mode)
280
+ };
281
+ }
282
+ function applyAppendOnlyStreamUpdate(params) {
283
+ const incoming = params.incoming.trimEnd();
284
+ if (!incoming) return {
285
+ rendered: params.rendered,
286
+ source: params.source,
287
+ changed: false
288
+ };
289
+ if (!params.rendered) return {
290
+ rendered: incoming,
291
+ source: incoming,
292
+ changed: true
293
+ };
294
+ if (incoming === params.source) return {
295
+ rendered: params.rendered,
296
+ source: params.source,
297
+ changed: false
298
+ };
299
+ if (incoming.startsWith(params.source) || incoming.startsWith(params.rendered)) return {
300
+ rendered: incoming,
301
+ source: incoming,
302
+ changed: incoming !== params.rendered
303
+ };
304
+ if (params.source.startsWith(incoming)) return {
305
+ rendered: params.rendered,
306
+ source: params.source,
307
+ changed: false
308
+ };
309
+ const separator = params.rendered.endsWith("\n") ? "" : "\n";
310
+ return {
311
+ rendered: `${params.rendered}${separator}${incoming}`,
312
+ source: incoming,
313
+ changed: true
314
+ };
315
+ }
316
+ //#endregion
317
+ //#region extensions/slack/src/streaming.ts
318
+ /**
319
+ * Thrown when Slack definitively rejects a stream flush/finalize while text
320
+ * remains buffered locally by the Slack SDK. Carries the pending text so the
321
+ * caller can deliver it via the normal Slack reply path.
322
+ */
323
+ var SlackStreamNotDeliveredError = class extends Error {
324
+ constructor(pendingText, slackCode) {
325
+ super(`slack-stream: finalize failed with ${slackCode} before buffered text reached Slack (${pendingText.length} chars pending)`);
326
+ this.name = "SlackStreamNotDeliveredError";
327
+ this.pendingText = pendingText;
328
+ this.slackCode = slackCode;
329
+ }
330
+ };
331
+ /**
332
+ * Start a new Slack text stream.
333
+ *
334
+ * Returns a {@link SlackStreamSession} that should be passed to
335
+ * {@link appendSlackStream} and {@link stopSlackStream}.
336
+ *
337
+ * The first chunk of text can optionally be included via `text`.
338
+ */
339
+ async function startSlackStream(params) {
340
+ const { client, channel, threadTs, text, chunks, taskDisplayMode, teamId, userId, identity } = params;
341
+ const identityPayload = identity?.iconUrl ? {
342
+ ...identity.username ? { username: identity.username } : {},
343
+ icon_url: identity.iconUrl
344
+ } : identity?.iconEmoji ? {
345
+ ...identity.username ? { username: identity.username } : {},
346
+ icon_emoji: identity.iconEmoji
347
+ } : identity?.username ? { username: identity.username } : {};
348
+ logVerbose(`slack-stream: starting stream in ${channel} thread=${threadTs}${teamId ? ` team=${teamId}` : ""}${userId ? ` user=${userId}` : ""}`);
349
+ const streamer = client.chatStream({
350
+ channel,
351
+ thread_ts: threadTs,
352
+ ...taskDisplayMode ? { task_display_mode: taskDisplayMode } : {},
353
+ ...teamId ? { recipient_team_id: teamId } : {},
354
+ ...userId ? { recipient_user_id: userId } : {},
355
+ ...identityPayload
356
+ });
357
+ const session = {
358
+ streamer,
359
+ channel,
360
+ threadTs,
361
+ stopped: false,
362
+ delivered: false,
363
+ pendingText: ""
364
+ };
365
+ if (text || chunks?.length) {
366
+ if (text) session.pendingText += text;
367
+ try {
368
+ const result = await streamer.append({
369
+ ...text ? { markdown_text: text } : {},
370
+ ...chunks?.length ? { chunks } : {}
371
+ });
372
+ if (result) {
373
+ session.delivered = true;
374
+ session.pendingText = "";
375
+ }
376
+ logVerbose(`slack-stream: appended initial payload (${text?.length ?? 0} chars, ${chunks?.length ?? 0} chunks, ${result ? "flushed" : "buffered"})`);
377
+ } catch (err) {
378
+ if (isBenignSlackFinalizeError(err) && session.pendingText) throw new SlackStreamNotDeliveredError(session.pendingText, extractSlackErrorCode(err) ?? "unknown");
379
+ throw err;
380
+ }
381
+ }
382
+ return session;
383
+ }
384
+ /**
385
+ * Append markdown text to an active Slack stream.
386
+ */
387
+ async function appendSlackStream(params) {
388
+ const { session, text, chunks } = params;
389
+ if (session.stopped) {
390
+ logVerbose("slack-stream: attempted to append to a stopped stream, ignoring");
391
+ return;
392
+ }
393
+ if (!text && !chunks?.length) return;
394
+ if (text) session.pendingText += text;
395
+ try {
396
+ const result = await session.streamer.append({
397
+ ...text ? { markdown_text: text } : {},
398
+ ...chunks?.length ? { chunks } : {}
399
+ });
400
+ if (result) {
401
+ session.delivered = true;
402
+ session.pendingText = "";
403
+ }
404
+ logVerbose(`slack-stream: appended ${text?.length ?? 0} chars, ${chunks?.length ?? 0} chunks (${result ? "flushed" : "buffered"})`);
405
+ } catch (err) {
406
+ if (isBenignSlackFinalizeError(err) && session.pendingText) throw new SlackStreamNotDeliveredError(session.pendingText, extractSlackErrorCode(err) ?? "unknown");
407
+ throw err;
408
+ }
409
+ }
410
+ /**
411
+ * Stop (finalize) a Slack stream.
412
+ *
413
+ * After calling this the stream message becomes a normal Slack message.
414
+ * Optionally include final text to append before stopping.
415
+ *
416
+ * If Slack's `chat.stopStream` responds with a definitive recipient/channel
417
+ * rejection while text is still buffered locally, this function throws a
418
+ * {@link SlackStreamNotDeliveredError} carrying that pending text so the caller
419
+ * can deliver it through the normal Slack reply path. Ambiguous failures
420
+ * propagate unchanged because Slack may have committed the request.
421
+ *
422
+ * If Slack responds with a known benign finalize error (see
423
+ * {@link BENIGN_SLACK_FINALIZE_ERROR_CODES}) after prior `append` calls already
424
+ * landed, the error is swallowed and the session is marked stopped - the
425
+ * already-delivered text stays visible.
426
+ *
427
+ * Errors without buffered text propagate unchanged.
428
+ *
429
+ * On success, returns the finalized message's Slack `ts` (when reported) so the
430
+ * caller can emit the `message_sent` hook with a populated `messageId`.
431
+ */
432
+ async function stopSlackStream(params) {
433
+ const { session, text, chunks, metadata } = params;
434
+ if (session.stopped) {
435
+ logVerbose("slack-stream: stream already stopped, ignoring duplicate stop");
436
+ return {};
437
+ }
438
+ session.stopped = true;
439
+ if (text) session.pendingText += text;
440
+ logVerbose(`slack-stream: stopping stream in ${session.channel} thread=${session.threadTs}${text ? ` (final text: ${text.length} chars)` : ""}`);
441
+ try {
442
+ const stopResponse = await session.streamer.stop(text || chunks?.length || metadata ? {
443
+ ...text ? { markdown_text: text } : {},
444
+ ...chunks?.length ? { chunks } : {},
445
+ ...metadata ? { metadata } : {}
446
+ } : void 0);
447
+ session.delivered = true;
448
+ session.pendingText = "";
449
+ logVerbose("slack-stream: stream stopped");
450
+ const messageId = stopResponse?.ts ?? stopResponse?.message?.ts;
451
+ return messageId ? { messageId } : {};
452
+ } catch (err) {
453
+ const code = extractSlackErrorCode(err) ?? "unknown";
454
+ const benignFinalizeError = isBenignSlackFinalizeError(err);
455
+ if (session.pendingText && (benignFinalizeError || code === "missing_scope")) throw new SlackStreamNotDeliveredError(session.pendingText, code);
456
+ if (benignFinalizeError) {
457
+ if (session.delivered) {
458
+ logVerbose(`slack-stream: finalize rejected by Slack (${code}); prior appends delivered, treating stream as stopped`);
459
+ return {};
460
+ }
461
+ }
462
+ throw err;
463
+ }
464
+ }
465
+ /**
466
+ * Slack API error codes that indicate `chat.stopStream` (or the
467
+ * `chat.startStream` call the SDK issues inside `stop()` when the buffer
468
+ * never flushed) cannot finalize the stream for the current recipient or
469
+ * team. Either the caller falls back to a normal message (see
470
+ * {@link SlackStreamNotDeliveredError}) or, if prior appends already
471
+ * delivered text, the error is logged verbosely and swallowed.
472
+ */
473
+ const BENIGN_SLACK_FINALIZE_ERROR_CODES = /* @__PURE__ */ new Set([
474
+ "user_not_found",
475
+ "team_not_found",
476
+ "missing_recipient_user_id",
477
+ "method_not_supported_for_channel_type"
478
+ ]);
479
+ function isBenignSlackFinalizeError(err) {
480
+ const code = extractSlackErrorCode(err);
481
+ return code !== void 0 && BENIGN_SLACK_FINALIZE_ERROR_CODES.has(code);
482
+ }
483
+ function extractSlackErrorCode(err) {
484
+ if (!err || typeof err !== "object") return;
485
+ const record = err;
486
+ if (record.data && typeof record.data === "object") {
487
+ const inner = record.data.error;
488
+ if (typeof inner === "string") return inner;
489
+ }
490
+ return (typeof record.message === "string" ? record.message : "").match(/An API error occurred:\s*([a-z_][a-z0-9_]*)/i)?.[1];
491
+ }
492
+ function markSlackStreamFallbackDelivered(session) {
493
+ const nativeStreamWasStarted = session.delivered;
494
+ session.pendingText = "";
495
+ session.streamer.buffer = "";
496
+ session.stopped = !nativeStreamWasStarted;
497
+ }
498
+ //#endregion
499
+ //#region extensions/slack/src/threading.ts
500
+ function resolveSlackThreadContext(params) {
501
+ const incomingThreadTs = params.message.thread_ts;
502
+ const eventTs = params.message.event_ts;
503
+ const messageTs = params.message.ts ?? eventTs;
504
+ const hasThreadTs = typeof incomingThreadTs === "string" && incomingThreadTs.length > 0;
505
+ const isThreadReply = hasThreadTs && (incomingThreadTs !== messageTs || Boolean(params.message.parent_user_id));
506
+ const replyToId = incomingThreadTs ?? messageTs;
507
+ const isAssistantDmThreadRoot = hasThreadTs && !isThreadReply && params.isDirectMessage === true;
508
+ return {
509
+ incomingThreadTs,
510
+ messageTs,
511
+ isThreadReply,
512
+ replyToId,
513
+ messageThreadId: isThreadReply || isAssistantDmThreadRoot ? incomingThreadTs : params.replyToMode === "all" ? messageTs : void 0
514
+ };
515
+ }
516
+ /**
517
+ * Resolves Slack thread targeting for replies and status indicators.
518
+ *
519
+ * @returns replyThreadTs - Thread timestamp for reply messages
520
+ * @returns statusThreadTs - Thread timestamp for status indicators (typing, etc.)
521
+ * @returns isThreadReply - true if this is a genuine user reply in a thread,
522
+ * false if thread_ts comes from a bot status message (e.g. typing indicator)
523
+ */
524
+ function resolveSlackThreadTargets(params) {
525
+ const { incomingThreadTs, messageTs, isThreadReply } = resolveSlackThreadContext(params);
526
+ const replyThreadTs = isThreadReply ? incomingThreadTs : params.replyToMode === "all" ? messageTs : void 0;
527
+ return {
528
+ replyThreadTs,
529
+ statusThreadTs: replyThreadTs,
530
+ isThreadReply
531
+ };
532
+ }
533
+ //#endregion
534
+ //#region extensions/slack/src/monitor/message-handler/preview-finalize.ts
535
+ function buildExpectedSlackEditText(params) {
536
+ return buildSlackEditTextPayload(params.text, params.blocks);
537
+ }
538
+ function blocksMatch(expected, actual) {
539
+ if (!expected?.length) return !actual?.length;
540
+ if (!actual?.length) return false;
541
+ return JSON.stringify(expected) === JSON.stringify(actual);
542
+ }
543
+ async function readSlackMessageAfterEditError(params) {
544
+ if (params.threadTs) return ((await params.client.conversations.replies({
545
+ token: params.token,
546
+ channel: params.channelId,
547
+ ts: params.threadTs,
548
+ latest: params.messageId,
549
+ inclusive: true,
550
+ limit: 100
551
+ })).messages ?? []).find((message) => message?.ts === params.messageId) ?? null;
552
+ const message = (await params.client.conversations.history({
553
+ token: params.token,
554
+ channel: params.channelId,
555
+ latest: params.messageId,
556
+ oldest: params.messageId,
557
+ inclusive: true,
558
+ limit: 1
559
+ })).messages?.[0];
560
+ if (!message?.ts || message.ts !== params.messageId) return null;
561
+ return message;
562
+ }
563
+ async function didSlackPreviewEditApplyAfterError(params) {
564
+ const readback = await readSlackMessageAfterEditError(params);
565
+ if (!readback) return false;
566
+ const expectedText = buildExpectedSlackEditText({
567
+ text: params.text,
568
+ blocks: params.blocks
569
+ });
570
+ const actualText = normalizeSlackOutboundText((readback.text ?? "").trim());
571
+ if (params.blocks?.length) return actualText === expectedText && blocksMatch(params.blocks, readback.blocks);
572
+ return actualText === expectedText;
573
+ }
574
+ async function finalizeSlackPreviewEdit(params) {
575
+ try {
576
+ await editSlackMessage(params.channelId, params.messageId, params.text, {
577
+ token: params.token,
578
+ accountId: params.accountId,
579
+ client: params.client,
580
+ ...params.blocks?.length ? { blocks: params.blocks } : {}
581
+ });
582
+ } catch (err) {
583
+ try {
584
+ if (await didSlackPreviewEditApplyAfterError({
585
+ client: params.client,
586
+ token: params.token,
587
+ channelId: params.channelId,
588
+ messageId: params.messageId,
589
+ text: params.text,
590
+ blocks: params.blocks,
591
+ threadTs: params.threadTs
592
+ })) {
593
+ logVerbose(`slack: preview final edit response failed but readback matched message ${params.channelId}/${params.messageId}; suppressing duplicate fallback send`);
594
+ return;
595
+ }
596
+ } catch (readbackErr) {
597
+ logVerbose(`slack: preview final edit readback failed (${String(readbackErr)})`);
598
+ }
599
+ throw err;
600
+ }
601
+ }
602
+ //#endregion
603
+ //#region extensions/slack/src/monitor/message-handler/timestamp.ts
604
+ const SLACK_TIMESTAMP_RE = /^\d+(?:\.\d+)?$/;
605
+ const MAX_SAFE_SLACK_TIMESTAMP_SECONDS = Number.MAX_SAFE_INTEGER / 1e3;
606
+ function resolveSlackTimestampMs(ts) {
607
+ const trimmed = ts?.trim();
608
+ if (!trimmed || !SLACK_TIMESTAMP_RE.test(trimmed)) return;
609
+ const seconds = asFiniteNumberInRange(parseStrictFiniteNumber(trimmed), {
610
+ min: 0,
611
+ max: MAX_SAFE_SLACK_TIMESTAMP_SECONDS
612
+ });
613
+ return seconds === void 0 ? void 0 : Math.round(seconds * 1e3);
614
+ }
615
+ //#endregion
616
+ //#region extensions/slack/src/monitor/message-handler/dispatch.ts
617
+ const SLACK_REASONING_TAG_RE = /<\s*(\/?)\s*(?:(?:antml:|mm:)?(?:think(?:ing)?|thought)|antthinking)\b[^<>]*>/gi;
618
+ const SLACK_REASONING_LABEL_PREFIX_RE = /^\s*(?:>\s*)?Reasoning:\s*/iu;
619
+ const SLACK_THINKING_LABEL_PREFIX_RE = /^\s*(?:>\s*)?Thinking\.{0,3}(?=\s*(?:\n|_))/iu;
620
+ const SLACK_THREAD_LOADING_MESSAGES = [
621
+ "Reading the thread...",
622
+ "Checking context...",
623
+ "Working through the request...",
624
+ "Putting it all together..."
625
+ ];
626
+ function resolveSlackMessageTimestampMs(message) {
627
+ return resolveSlackTimestampMs(message.event_ts ?? message.ts);
628
+ }
629
+ function resolveSlackBotLoopProtection(prepared) {
630
+ const senderBotId = prepared.message.bot_id;
631
+ if (!senderBotId) return;
632
+ const receiverBotId = prepared.ctx.botId || prepared.ctx.botUserId;
633
+ if (!receiverBotId || senderBotId === prepared.ctx.botId || prepared.message.user === prepared.ctx.botUserId) return;
634
+ return {
635
+ scopeId: prepared.route.accountId,
636
+ conversationId: prepared.message.channel,
637
+ senderId: senderBotId,
638
+ receiverId: receiverBotId,
639
+ config: mergePairLoopGuardConfig(prepared.account.config.botLoopProtection, prepared.channelConfig?.botLoopProtection),
640
+ defaultsConfig: prepared.ctx.cfg.channels?.defaults?.botLoopProtection,
641
+ defaultEnabled: true,
642
+ nowMs: resolveSlackMessageTimestampMs(prepared.message)
643
+ };
644
+ }
645
+ function isSlackStreamingEnabled(params) {
646
+ if (params.mode === "partial") return params.nativeStreaming;
647
+ if (params.mode === "progress") return params.nativeStreaming && params.nativeProgressTaskCards === true;
648
+ return false;
649
+ }
650
+ function shouldEnableSlackPreviewStreaming(params) {
651
+ return params.mode !== "off";
652
+ }
653
+ function shouldInitializeSlackDraftStream(params) {
654
+ return params.previewStreamingEnabled && !params.useStreaming;
655
+ }
656
+ function resolveSlackDisableBlockStreaming(params) {
657
+ if (params.useStreaming || params.shouldUseDraftStream) return true;
658
+ return typeof params.blockStreamingEnabled === "boolean" ? !params.blockStreamingEnabled : void 0;
659
+ }
660
+ function resolveExplicitSlackProgressTitle(entry) {
661
+ const label = resolveChannelProgressDraftConfig(entry).label;
662
+ if (typeof label !== "string") return;
663
+ const trimmed = label.trim();
664
+ return trimmed && trimmed.toLowerCase() !== "auto" ? trimmed : void 0;
665
+ }
666
+ function resolveSlackNativeProgressTaskCards(entry) {
667
+ const streaming = entry?.streaming;
668
+ if (!streaming || typeof streaming !== "object" || Array.isArray(streaming)) return false;
669
+ const progressConfig = streaming.progress;
670
+ return Boolean(progressConfig) && typeof progressConfig === "object" && !Array.isArray(progressConfig) && progressConfig.nativeTaskCards === true;
671
+ }
672
+ function resolveSlackStreamingThreadHint(params) {
673
+ return resolveSlackThreadTs({
674
+ replyToMode: params.replyToMode,
675
+ incomingThreadTs: params.incomingThreadTs,
676
+ messageTs: params.messageTs,
677
+ hasReplied: false,
678
+ isThreadReply: params.isThreadReply
679
+ });
680
+ }
681
+ const SLACK_STREAM_RECIPIENT_TEAM_CACHE_MAX = 2e3;
682
+ const slackStreamRecipientTeamCache = /* @__PURE__ */ new Map();
683
+ function buildSlackEventDeliveryKey(params) {
684
+ const reply = resolveSendableOutboundReplyParts(params.payload, { text: params.textOverride });
685
+ const slackBlocks = readSlackReplyBlocks(params.payload);
686
+ if (!reply.hasContent && !slackBlocks?.length) return null;
687
+ return JSON.stringify({
688
+ kind: params.kind,
689
+ threadTs: params.threadTs ?? "",
690
+ replyToId: params.payload.replyToId ?? null,
691
+ text: reply.trimmedText,
692
+ mediaUrls: reply.mediaUrls,
693
+ blocks: slackBlocks ?? null
694
+ });
695
+ }
696
+ function readSlackStreamRecipientTeamCache(params) {
697
+ if (!params.fallbackTeamId || !params.userId) return;
698
+ const cacheKey = `${params.fallbackTeamId}:${params.userId}`;
699
+ const cached = slackStreamRecipientTeamCache.get(cacheKey);
700
+ if (!cached) return;
701
+ slackStreamRecipientTeamCache.delete(cacheKey);
702
+ slackStreamRecipientTeamCache.set(cacheKey, cached);
703
+ return cached;
704
+ }
705
+ function rememberSlackStreamRecipientTeam(params) {
706
+ if (!params.fallbackTeamId || !params.userId) return;
707
+ const cacheKey = `${params.fallbackTeamId}:${params.userId}`;
708
+ if (slackStreamRecipientTeamCache.has(cacheKey)) slackStreamRecipientTeamCache.delete(cacheKey);
709
+ slackStreamRecipientTeamCache.set(cacheKey, params.teamId);
710
+ if (slackStreamRecipientTeamCache.size > SLACK_STREAM_RECIPIENT_TEAM_CACHE_MAX) {
711
+ const oldest = slackStreamRecipientTeamCache.keys().next().value;
712
+ if (oldest) slackStreamRecipientTeamCache.delete(oldest);
713
+ }
714
+ }
715
+ function normalizeSlackReasoningProgressLine(text) {
716
+ return (extractSlackReasoningTagText(text) || stripReasoningTagsFromText(text, {
717
+ mode: "strict",
718
+ trim: "both"
719
+ })).replace(SLACK_REASONING_LABEL_PREFIX_RE, "").replace(SLACK_THINKING_LABEL_PREFIX_RE, "").split(/\r?\n/u).map((line) => stripSimpleItalicMarkers(line)).filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
720
+ }
721
+ function extractSlackReasoningTagText(text) {
722
+ if (!text) return "";
723
+ let result = "";
724
+ let lastIndex = 0;
725
+ let inReasoning = false;
726
+ SLACK_REASONING_TAG_RE.lastIndex = 0;
727
+ for (const match of text.matchAll(SLACK_REASONING_TAG_RE)) {
728
+ const index = match.index ?? 0;
729
+ if (inReasoning) result += text.slice(lastIndex, index);
730
+ inReasoning = match[1] !== "/";
731
+ lastIndex = index + match[0].length;
732
+ }
733
+ if (inReasoning) result += text.slice(lastIndex);
734
+ return result.trim();
735
+ }
736
+ function stripSimpleItalicMarkers(line) {
737
+ const trimmed = line.trim();
738
+ if (trimmed.length >= 2 && trimmed.startsWith("_") && trimmed.endsWith("_")) return trimmed.slice(1, -1).trim();
739
+ return trimmed;
740
+ }
741
+ function mergeSlackReasoningProgressText(current, incoming, options) {
742
+ if (!current) return incoming;
743
+ const normalizedCurrent = normalizeSlackReasoningProgressLine(current);
744
+ const normalizedIncoming = normalizeSlackReasoningProgressLine(incoming);
745
+ if (!normalizedIncoming || normalizedIncoming === normalizedCurrent) return current;
746
+ if (options?.snapshot === true || isSlackReasoningSnapshotText(incoming) || normalizedIncoming.startsWith(normalizedCurrent)) return incoming;
747
+ return `${current}${incoming}`;
748
+ }
749
+ function isSlackReasoningSnapshotText(text) {
750
+ return SLACK_REASONING_LABEL_PREFIX_RE.test(text) || SLACK_THINKING_LABEL_PREFIX_RE.test(text);
751
+ }
752
+ function createSlackEventDeliveryTracker() {
753
+ const deliveredKeys = /* @__PURE__ */ new Set();
754
+ return {
755
+ hasDelivered(params) {
756
+ const key = buildSlackEventDeliveryKey(params);
757
+ return key ? deliveredKeys.has(key) : false;
758
+ },
759
+ markDelivered(params) {
760
+ const key = buildSlackEventDeliveryKey(params);
761
+ if (key) deliveredKeys.add(key);
762
+ }
763
+ };
764
+ }
765
+ function shouldUseStreaming(params) {
766
+ if (!params.streamingEnabled) return false;
767
+ if (!params.threadTs) {
768
+ logVerbose("slack-stream: streaming disabled — no reply thread target available");
769
+ return false;
770
+ }
771
+ return true;
772
+ }
773
+ async function resolveSlackStreamRecipientTeamId(params) {
774
+ const cachedTeamId = readSlackStreamRecipientTeamCache(params);
775
+ if (cachedTeamId) return cachedTeamId;
776
+ if (params.userId) try {
777
+ const info = await params.client.users.info({
778
+ token: params.token,
779
+ user: params.userId
780
+ });
781
+ const teamId = info.user?.team_id ?? info.user?.profile?.team;
782
+ if (teamId) {
783
+ rememberSlackStreamRecipientTeam({
784
+ ...params,
785
+ teamId
786
+ });
787
+ return teamId;
788
+ }
789
+ } catch (err) {
790
+ logVerbose(`slack-stream: users.info team lookup failed (${formatErrorMessage(err)})`);
791
+ }
792
+ return params.fallbackTeamId;
793
+ }
794
+ async function dispatchPreparedSlackMessage(prepared) {
795
+ const { ctx, account, message, route } = prepared;
796
+ const cfg = ctx.cfg;
797
+ const runtime = ctx.runtime;
798
+ const outboundIdentity = resolveAgentOutboundIdentity(cfg, route.agentId);
799
+ const slackIdentity = outboundIdentity ? {
800
+ username: outboundIdentity.name,
801
+ iconUrl: outboundIdentity.avatarUrl,
802
+ iconEmoji: outboundIdentity.emoji
803
+ } : prepared.relayIdentity;
804
+ if (prepared.isDirectMessage) {
805
+ const sessionCfg = cfg.session;
806
+ const storePath = resolveStorePath(sessionCfg?.store, { agentId: route.agentId });
807
+ const pinnedMainDmOwner = resolvePinnedMainDmOwnerFromAllowlist({
808
+ dmScope: cfg.session?.dmScope,
809
+ allowFrom: ctx.allowFrom,
810
+ normalizeEntry: normalizeSlackAllowOwnerEntry
811
+ });
812
+ const senderRecipient = normalizeOptionalLowercaseString(message.user);
813
+ const inboundLastRouteSessionKey = resolveInboundLastRouteSessionKey({
814
+ route,
815
+ sessionKey: prepared.ctxPayload.SessionKey ?? route.sessionKey
816
+ });
817
+ if (inboundLastRouteSessionKey === route.mainSessionKey && pinnedMainDmOwner && senderRecipient && normalizeOptionalLowercaseString(pinnedMainDmOwner) !== senderRecipient) logVerbose(`slack: skip main-session last route for ${senderRecipient} (pinned owner ${pinnedMainDmOwner})`);
818
+ else await updateLastRoute({
819
+ storePath,
820
+ sessionKey: inboundLastRouteSessionKey,
821
+ deliveryContext: {
822
+ channel: "slack",
823
+ to: `user:${message.user}`,
824
+ accountId: route.accountId,
825
+ threadId: prepared.ctxPayload.MessageThreadId ?? prepared.ctxPayload.TransportThreadId
826
+ },
827
+ ctx: prepared.ctxPayload
828
+ });
829
+ }
830
+ const threadTargets = resolveSlackThreadTargets({
831
+ message,
832
+ replyToMode: prepared.replyToMode
833
+ });
834
+ const forcedReplyThreadTs = prepared.forcedReplyThreadTs;
835
+ const slackMessageMetadata = prepared.slackMessageMetadata;
836
+ const statusThreadTs = forcedReplyThreadTs ?? threadTargets.statusThreadTs;
837
+ const isThreadReply = threadTargets.isThreadReply;
838
+ const replyDeliveryMode = forcedReplyThreadTs ? "off" : prepared.replyToMode;
839
+ const sourceReplyDeliveryMode = resolveChannelMessageSourceReplyDeliveryMode({
840
+ cfg,
841
+ ctx: prepared.ctxPayload
842
+ });
843
+ const sourceRepliesAreToolOnly = sourceReplyDeliveryMode === "message_tool_only";
844
+ const messageSentHookTarget = prepared.ctxPayload.OriginatingTo ?? prepared.ctxPayload.To ?? prepared.replyTarget;
845
+ const messageSentHookContext = {
846
+ sessionKeyForInternalHooks: prepared.ctxPayload.SessionKey ?? route.sessionKey,
847
+ isGroup: prepared.isRoomish,
848
+ groupId: prepared.isRoomish ? message.channel : void 0
849
+ };
850
+ const messageSentDeliveryHookContext = {
851
+ ...messageSentHookContext,
852
+ messageSentHookTarget
853
+ };
854
+ const reactionMessageTs = prepared.ackReactionMessageTs;
855
+ const messageTs = message.ts ?? message.event_ts;
856
+ const incomingThreadTs = message.thread_ts;
857
+ let didSetStatus = false;
858
+ const statusReactionsEnabled = prepared.ctxPayload.InboundEventKind !== "room_event" && Boolean(prepared.ackReactionPromise) && Boolean(reactionMessageTs) && cfg.messages?.statusReactions?.enabled === true;
859
+ const slackStatusAdapter = {
860
+ setReaction: async (emoji) => {
861
+ await reactSlackMessage(message.channel, reactionMessageTs ?? "", emoji, {
862
+ token: ctx.botToken,
863
+ client: ctx.app.client
864
+ }).catch((err) => {
865
+ if (formatErrorMessage(err).includes("already_reacted")) return;
866
+ throw err;
867
+ });
868
+ },
869
+ removeReaction: async (emoji) => {
870
+ await removeSlackReaction(message.channel, reactionMessageTs ?? "", emoji, {
871
+ token: ctx.botToken,
872
+ client: ctx.app.client
873
+ }).catch((err) => {
874
+ if (formatErrorMessage(err).includes("no_reaction")) return;
875
+ throw err;
876
+ });
877
+ }
878
+ };
879
+ const statusReactionTiming = {
880
+ ...DEFAULT_TIMING,
881
+ ...cfg.messages?.statusReactions?.timing
882
+ };
883
+ const statusReactions = createStatusReactionController({
884
+ enabled: statusReactionsEnabled,
885
+ adapter: slackStatusAdapter,
886
+ initialEmoji: prepared.ackReactionValue || "eyes",
887
+ emojis: cfg.messages?.statusReactions?.emojis,
888
+ timing: cfg.messages?.statusReactions?.timing,
889
+ onError: (err) => {
890
+ logAckFailure({
891
+ log: logVerbose,
892
+ channel: "slack",
893
+ target: `${message.channel}/${message.ts}`,
894
+ error: err
895
+ });
896
+ }
897
+ });
898
+ if (statusReactionsEnabled) statusReactions.setQueued();
899
+ const hasRepliedRef = { value: false };
900
+ const replyPlan = createSlackReplyDeliveryPlan({
901
+ replyToMode: replyDeliveryMode,
902
+ incomingThreadTs: forcedReplyThreadTs ?? incomingThreadTs,
903
+ messageTs,
904
+ hasRepliedRef,
905
+ isThreadReply: Boolean(forcedReplyThreadTs) || isThreadReply
906
+ });
907
+ const typingTarget = statusThreadTs ? `${message.channel}/${statusThreadTs}` : message.channel;
908
+ const typingReaction = ctx.typingReaction;
909
+ const { onModelSelected, ...replyPipeline } = createChannelMessageReplyPipeline({
910
+ cfg,
911
+ agentId: route.agentId,
912
+ channel: "slack",
913
+ accountId: route.accountId,
914
+ transformReplyPayload: (payload) => {
915
+ if (payload.isReasoning === true) return null;
916
+ return isSlackInteractiveRepliesEnabled({
917
+ cfg,
918
+ accountId: route.accountId
919
+ }) ? compileSlackInteractiveReplies(payload) : payload;
920
+ },
921
+ typing: {
922
+ start: async () => {
923
+ didSetStatus = true;
924
+ await ctx.setSlackThreadStatus({
925
+ channelId: message.channel,
926
+ threadTs: statusThreadTs,
927
+ status: "is typing...",
928
+ loadingMessages: SLACK_THREAD_LOADING_MESSAGES
929
+ });
930
+ if (typingReaction && message.ts) await reactSlackMessage(message.channel, message.ts, typingReaction, {
931
+ token: ctx.botToken,
932
+ client: ctx.app.client
933
+ }).catch(() => {});
934
+ },
935
+ stop: async () => {
936
+ if (!didSetStatus) return;
937
+ didSetStatus = false;
938
+ await ctx.setSlackThreadStatus({
939
+ channelId: message.channel,
940
+ threadTs: statusThreadTs,
941
+ status: ""
942
+ });
943
+ if (typingReaction && message.ts) await removeSlackReaction(message.channel, message.ts, typingReaction, {
944
+ token: ctx.botToken,
945
+ client: ctx.app.client
946
+ }).catch(() => {});
947
+ },
948
+ onStartError: (err) => {
949
+ logTypingFailure({
950
+ log: (messageValue) => runtime.error?.(danger(messageValue)),
951
+ channel: "slack",
952
+ action: "start",
953
+ target: typingTarget,
954
+ error: err
955
+ });
956
+ },
957
+ onStopError: (err) => {
958
+ logTypingFailure({
959
+ log: (messageLocal) => runtime.error?.(danger(messageLocal)),
960
+ channel: "slack",
961
+ action: "stop",
962
+ target: typingTarget,
963
+ error: err
964
+ });
965
+ }
966
+ }
967
+ });
968
+ const slackStreaming = resolveSlackStreamingConfig({
969
+ streaming: account.config.streaming,
970
+ nativeStreaming: resolveChannelStreamingNativeTransport(account.config)
971
+ });
972
+ const streamThreadHint = forcedReplyThreadTs ?? resolveSlackStreamingThreadHint({
973
+ replyToMode: replyDeliveryMode,
974
+ incomingThreadTs,
975
+ messageTs,
976
+ isThreadReply
977
+ });
978
+ const previewStreamingEnabled = !sourceRepliesAreToolOnly && shouldEnableSlackPreviewStreaming({ mode: slackStreaming.mode });
979
+ const hasSlackCustomIdentity = Boolean(slackIdentity?.username || slackIdentity?.iconUrl || slackIdentity?.iconEmoji);
980
+ const useStreaming = shouldUseStreaming({
981
+ streamingEnabled: !sourceRepliesAreToolOnly && isSlackStreamingEnabled({
982
+ mode: slackStreaming.mode,
983
+ nativeStreaming: slackStreaming.nativeStreaming,
984
+ nativeProgressTaskCards: resolveSlackNativeProgressTaskCards(account.config)
985
+ }),
986
+ threadTs: streamThreadHint
987
+ });
988
+ const shouldUseDraftStream = !hasSlackCustomIdentity && shouldInitializeSlackDraftStream({
989
+ previewStreamingEnabled,
990
+ useStreaming
991
+ });
992
+ const blockStreamingEnabled = resolveChannelStreamingBlockEnabled(account.config);
993
+ const disableBlockStreaming = sourceRepliesAreToolOnly ? true : resolveSlackDisableBlockStreaming({
994
+ useStreaming,
995
+ shouldUseDraftStream,
996
+ blockStreamingEnabled
997
+ });
998
+ let streamSession = null;
999
+ let nativeProgressStreamStartPromise = null;
1000
+ let nativeProgressStreamThreadTs;
1001
+ let streamFailed = false;
1002
+ let usedReplyThreadTs;
1003
+ let usedBlockReplyThreadTs;
1004
+ let observedReplyDelivery = false;
1005
+ let observedFinalReplyDelivery = false;
1006
+ const streamedDeliveries = [];
1007
+ const streamedFailuresOwnedByDispatcher = {
1008
+ tool: 0,
1009
+ block: 0,
1010
+ final: 0
1011
+ };
1012
+ const refreshStreamedAcknowledgements = (session) => {
1013
+ if (session.pendingText.length === 0) for (const delivery of streamedDeliveries) delivery.acknowledged = true;
1014
+ };
1015
+ const recordStreamedDelivery = (kind, content) => {
1016
+ const delivery = {
1017
+ kind,
1018
+ content,
1019
+ acknowledged: false
1020
+ };
1021
+ streamedDeliveries.push(delivery);
1022
+ return delivery;
1023
+ };
1024
+ const rememberStreamedDelivery = (kind, content, session) => {
1025
+ recordStreamedDelivery(kind, content);
1026
+ refreshStreamedAcknowledgements(session);
1027
+ };
1028
+ const emitAcknowledgedStreamedDeliveries = (messageId) => {
1029
+ for (const delivery of streamedDeliveries) {
1030
+ if (!delivery.acknowledged || delivery.outcome) continue;
1031
+ emitSlackMessageSentHooks({
1032
+ ...messageSentHookContext,
1033
+ to: messageSentHookTarget,
1034
+ accountId: account.accountId,
1035
+ content: delivery.content,
1036
+ success: true,
1037
+ ...messageId ? { messageId } : {}
1038
+ });
1039
+ delivery.outcome = "success";
1040
+ }
1041
+ };
1042
+ const emitFailedPendingStreamedDeliveries = (error) => {
1043
+ for (const delivery of streamedDeliveries) {
1044
+ if (delivery.acknowledged || delivery.outcome) continue;
1045
+ emitSlackMessageSentHooks({
1046
+ ...messageSentHookContext,
1047
+ to: messageSentHookTarget,
1048
+ accountId: account.accountId,
1049
+ content: delivery.content,
1050
+ success: false,
1051
+ error
1052
+ });
1053
+ delivery.outcome = "failure";
1054
+ }
1055
+ };
1056
+ const emitSuccessfulPendingStreamedDeliveries = (messageId) => {
1057
+ for (const delivery of streamedDeliveries) {
1058
+ if (delivery.acknowledged || delivery.outcome) continue;
1059
+ emitSlackMessageSentHooks({
1060
+ ...messageSentHookContext,
1061
+ to: messageSentHookTarget,
1062
+ accountId: account.accountId,
1063
+ content: delivery.content,
1064
+ success: true,
1065
+ ...messageId ? { messageId } : {}
1066
+ });
1067
+ delivery.outcome = "success";
1068
+ }
1069
+ };
1070
+ const deliveryTracker = createSlackEventDeliveryTracker();
1071
+ const markPreviewPayloadDelivered = (params) => {
1072
+ deliveryTracker.markDelivered(params);
1073
+ const nextThreadTs = replyPlan.peekThreadTs();
1074
+ if (nextThreadTs !== params.threadTs) deliveryTracker.markDelivered({
1075
+ ...params,
1076
+ threadTs: nextThreadTs
1077
+ });
1078
+ };
1079
+ const resolveDeliveryThreadTs = (params) => {
1080
+ const plannedThreadTs = params.forcedThreadTs ? void 0 : replyPlan.nextThreadTs();
1081
+ return params.forcedThreadTs ?? plannedThreadTs ?? (params.kind === "block" ? usedBlockReplyThreadTs : void 0);
1082
+ };
1083
+ const rememberDeliveredThreadTs = (kind, deliveredThreadTs) => {
1084
+ if (!deliveredThreadTs) return;
1085
+ usedReplyThreadTs ??= deliveredThreadTs;
1086
+ if (kind === "block") usedBlockReplyThreadTs = deliveredThreadTs;
1087
+ };
1088
+ const deliverPendingStreamFallback = async (session, err) => {
1089
+ let fallbackError = err;
1090
+ if (!session.stopped) try {
1091
+ const stopResult = await stopSlackStream({
1092
+ session,
1093
+ ...slackMessageMetadata ? { metadata: slackMessageMetadata } : {}
1094
+ });
1095
+ for (const delivery of streamedDeliveries) delivery.acknowledged = true;
1096
+ emitAcknowledgedStreamedDeliveries(stopResult.messageId);
1097
+ observedReplyDelivery = true;
1098
+ usedReplyThreadTs ??= session.threadTs;
1099
+ return true;
1100
+ } catch (stopErr) {
1101
+ if (stopErr instanceof SlackStreamNotDeliveredError) fallbackError = stopErr;
1102
+ else runtime.error?.(danger(`slack-stream: failed to finalize buffered text before fallback: ${formatSlackError(stopErr)}`));
1103
+ }
1104
+ emitAcknowledgedStreamedDeliveries();
1105
+ const fallbackText = fallbackError.pendingText.trim();
1106
+ if (!fallbackText) return false;
1107
+ try {
1108
+ await deliverReplies({
1109
+ cfg: ctx.cfg,
1110
+ replies: [{ text: fallbackText }],
1111
+ target: prepared.replyTarget,
1112
+ token: ctx.botToken,
1113
+ accountId: account.accountId,
1114
+ runtime,
1115
+ textLimit: ctx.textLimit,
1116
+ replyThreadTs: session.threadTs,
1117
+ replyToMode: replyDeliveryMode,
1118
+ ...slackIdentity ? { identity: slackIdentity } : {},
1119
+ ...slackMessageMetadata ? { metadata: slackMessageMetadata } : {},
1120
+ ...messageSentDeliveryHookContext,
1121
+ deferMessageSentHooks: true
1122
+ });
1123
+ markSlackStreamFallbackDelivered(session);
1124
+ if (!session.stopped) try {
1125
+ await stopSlackStream({
1126
+ session,
1127
+ ...slackMessageMetadata ? { metadata: slackMessageMetadata } : {}
1128
+ });
1129
+ } catch (finalizeErr) {
1130
+ runtime.error?.(danger(`slack-stream: failed to finalize native stream after fallback delivery: ${formatSlackError(finalizeErr)}`));
1131
+ }
1132
+ emitSuccessfulPendingStreamedDeliveries();
1133
+ observedReplyDelivery = true;
1134
+ usedReplyThreadTs ??= session.threadTs;
1135
+ logVerbose(`slack-stream: streamed delivery failed (${fallbackError.slackCode}); delivered ${fallbackText.length} chars via deliverReplies fallback`);
1136
+ return true;
1137
+ } catch (postErr) {
1138
+ emitFailedPendingStreamedDeliveries(formatErrorMessage(postErr));
1139
+ runtime.error?.(danger(`slack-stream: fallback deliverReplies failed after ${fallbackError.slackCode}: ${formatErrorMessage(postErr)}`));
1140
+ return false;
1141
+ }
1142
+ };
1143
+ const deliverNormally = async (params) => {
1144
+ if (params.payload.isReasoning === true) return;
1145
+ const replyThreadTs = resolveDeliveryThreadTs(params);
1146
+ const deliveryReplyThreadTs = replyDeliveryMode === "off" && !forcedReplyThreadTs && !isThreadReply ? void 0 : replyThreadTs;
1147
+ if (deliveryTracker.hasDelivered({
1148
+ kind: params.kind,
1149
+ payload: params.payload,
1150
+ threadTs: deliveryReplyThreadTs
1151
+ })) {
1152
+ logVerbose("slack: suppressed duplicate normal delivery within the same turn");
1153
+ return deliveryReplyThreadTs;
1154
+ }
1155
+ await deliverReplies({
1156
+ cfg: ctx.cfg,
1157
+ replies: [params.payload],
1158
+ target: prepared.replyTarget,
1159
+ token: ctx.botToken,
1160
+ accountId: account.accountId,
1161
+ runtime,
1162
+ textLimit: ctx.textLimit,
1163
+ replyThreadTs: deliveryReplyThreadTs,
1164
+ replyToMode: replyDeliveryMode,
1165
+ ...slackIdentity ? { identity: slackIdentity } : {},
1166
+ ...slackMessageMetadata ? { metadata: slackMessageMetadata } : {},
1167
+ ...messageSentDeliveryHookContext
1168
+ });
1169
+ observedReplyDelivery = true;
1170
+ if (params.kind === "final") observedFinalReplyDelivery = true;
1171
+ const deliveredThreadTs = resolveDeliveredSlackReplyThreadTs({
1172
+ replyToMode: replyDeliveryMode,
1173
+ payloadReplyToId: params.payload.replyToId,
1174
+ replyThreadTs: deliveryReplyThreadTs
1175
+ });
1176
+ rememberDeliveredThreadTs(params.kind, deliveredThreadTs);
1177
+ replyPlan.markSent();
1178
+ deliveryTracker.markDelivered({
1179
+ kind: params.kind,
1180
+ payload: params.payload,
1181
+ threadTs: deliveryReplyThreadTs
1182
+ });
1183
+ return deliveryReplyThreadTs;
1184
+ };
1185
+ const deliverBufferedStreamFallback = async (params) => {
1186
+ if (!await deliverPendingStreamFallback(params.session, params.err)) {
1187
+ streamedFailuresOwnedByDispatcher[params.kind] += 1;
1188
+ return false;
1189
+ }
1190
+ replyPlan.markSent();
1191
+ if (params.kind === "final") observedFinalReplyDelivery = true;
1192
+ deliveryTracker.markDelivered({
1193
+ kind: params.kind,
1194
+ payload: params.payload,
1195
+ threadTs: params.session.threadTs,
1196
+ textOverride: params.textOverride
1197
+ });
1198
+ rememberDeliveredThreadTs(params.kind, params.session.threadTs);
1199
+ return true;
1200
+ };
1201
+ const deliverWithStreaming = async (params) => {
1202
+ if (params.payload.isReasoning === true) return;
1203
+ const reply = resolveSendableOutboundReplyParts(params.payload);
1204
+ if (streamFailed || reply.hasMedia || readSlackReplyBlocks(params.payload)?.length || !reply.hasText) {
1205
+ await deliverNormally({
1206
+ payload: params.payload,
1207
+ kind: params.kind,
1208
+ forcedThreadTs: streamSession?.threadTs ?? nativeProgressStreamThreadTs
1209
+ });
1210
+ return;
1211
+ }
1212
+ const text = reply.trimmedText;
1213
+ let plannedThreadTs;
1214
+ try {
1215
+ if (!streamSession && nativeProgressStreamStartPromise) await nativeProgressStreamStartPromise;
1216
+ if (streamFailed) {
1217
+ await deliverNormally({
1218
+ payload: params.payload,
1219
+ kind: params.kind,
1220
+ forcedThreadTs: streamSession?.threadTs ?? nativeProgressStreamThreadTs
1221
+ });
1222
+ return;
1223
+ }
1224
+ if (useNativeProgressStreaming && !streamSession) {
1225
+ await deliverNormally({
1226
+ payload: params.payload,
1227
+ kind: params.kind
1228
+ });
1229
+ return;
1230
+ }
1231
+ if (!streamSession) {
1232
+ const streamThreadTs = replyPlan.nextThreadTs();
1233
+ plannedThreadTs = streamThreadTs;
1234
+ if (!streamThreadTs) {
1235
+ logVerbose("slack-stream: no reply thread target for stream start, falling back to normal delivery");
1236
+ streamFailed = true;
1237
+ await deliverNormally({
1238
+ payload: params.payload,
1239
+ kind: params.kind
1240
+ });
1241
+ return;
1242
+ }
1243
+ if (deliveryTracker.hasDelivered({
1244
+ kind: params.kind,
1245
+ payload: params.payload,
1246
+ threadTs: streamThreadTs,
1247
+ textOverride: text
1248
+ })) {
1249
+ logVerbose("slack-stream: suppressed duplicate stream start payload");
1250
+ return;
1251
+ }
1252
+ streamSession = await startSlackStream({
1253
+ client: ctx.app.client,
1254
+ channel: message.channel,
1255
+ threadTs: streamThreadTs,
1256
+ text,
1257
+ ...slackIdentity ? { identity: slackIdentity } : {},
1258
+ teamId: await resolveSlackStreamRecipientTeamId({
1259
+ client: ctx.app.client,
1260
+ token: ctx.botToken,
1261
+ userId: message.user,
1262
+ fallbackTeamId: ctx.teamId
1263
+ }),
1264
+ userId: message.user
1265
+ });
1266
+ refreshStreamedAcknowledgements(streamSession);
1267
+ if (streamSession.delivered) {
1268
+ observedReplyDelivery = true;
1269
+ if (params.kind === "final") observedFinalReplyDelivery = true;
1270
+ }
1271
+ if (text) rememberStreamedDelivery(params.kind, text, streamSession);
1272
+ rememberDeliveredThreadTs(params.kind, streamThreadTs);
1273
+ replyPlan.markSent();
1274
+ deliveryTracker.markDelivered({
1275
+ kind: params.kind,
1276
+ payload: params.payload,
1277
+ threadTs: streamThreadTs,
1278
+ textOverride: text
1279
+ });
1280
+ return;
1281
+ }
1282
+ if (deliveryTracker.hasDelivered({
1283
+ kind: params.kind,
1284
+ payload: params.payload,
1285
+ threadTs: streamSession.threadTs,
1286
+ textOverride: text
1287
+ })) {
1288
+ logVerbose("slack-stream: suppressed duplicate append payload");
1289
+ return;
1290
+ }
1291
+ const completionChunks = useNativeProgressStreaming && !nativeProgressCompletionSent && previewToolProgressLines.length > 0 ? buildSlackProgressStreamCompletionChunks({
1292
+ title: explicitProgressTitle,
1293
+ lines: previewToolProgressLines,
1294
+ maxLineChars: progressDraftMaxLineChars,
1295
+ finalInProgressStatus: params.payload.isError ? "error" : "complete"
1296
+ }) : void 0;
1297
+ if (useNativeProgressStreaming) {
1298
+ if (completionChunks?.length) {
1299
+ await appendSlackStream({
1300
+ session: streamSession,
1301
+ chunks: completionChunks
1302
+ });
1303
+ nativeProgressCompletionSent = true;
1304
+ if (streamSession.delivered) observedReplyDelivery = true;
1305
+ }
1306
+ await deliverNormally({
1307
+ payload: params.payload,
1308
+ kind: params.kind,
1309
+ forcedThreadTs: streamSession.threadTs
1310
+ });
1311
+ return;
1312
+ }
1313
+ if (text) recordStreamedDelivery(params.kind, text);
1314
+ await appendSlackStream({
1315
+ session: streamSession,
1316
+ text: "\n" + text,
1317
+ chunks: completionChunks
1318
+ });
1319
+ refreshStreamedAcknowledgements(streamSession);
1320
+ if (completionChunks?.length) nativeProgressCompletionSent = true;
1321
+ if (streamSession.delivered) {
1322
+ observedReplyDelivery = true;
1323
+ if (params.kind === "final") observedFinalReplyDelivery = true;
1324
+ }
1325
+ deliveryTracker.markDelivered({
1326
+ kind: params.kind,
1327
+ payload: params.payload,
1328
+ threadTs: streamSession.threadTs,
1329
+ textOverride: text
1330
+ });
1331
+ } catch (err) {
1332
+ if (err instanceof SlackStreamNotDeliveredError) {
1333
+ streamFailed = true;
1334
+ if (streamSession) {
1335
+ if (await deliverBufferedStreamFallback({
1336
+ session: streamSession,
1337
+ err,
1338
+ payload: params.payload,
1339
+ kind: params.kind,
1340
+ textOverride: text
1341
+ })) return;
1342
+ throw err;
1343
+ }
1344
+ await deliverNormally({
1345
+ payload: params.payload,
1346
+ kind: params.kind,
1347
+ forcedThreadTs: plannedThreadTs
1348
+ });
1349
+ return;
1350
+ }
1351
+ runtime.error?.(danger(`slack-stream: streaming API call failed: ${formatSlackError(err)}, falling back`));
1352
+ streamFailed = true;
1353
+ if (streamSession && streamSession.pendingText) {
1354
+ const bufferedFallbackErr = new SlackStreamNotDeliveredError(streamSession.pendingText, "unknown");
1355
+ if (await deliverBufferedStreamFallback({
1356
+ session: streamSession,
1357
+ err: bufferedFallbackErr,
1358
+ payload: params.payload,
1359
+ kind: params.kind,
1360
+ textOverride: text
1361
+ })) return;
1362
+ throw err;
1363
+ }
1364
+ await deliverNormally({
1365
+ payload: params.payload,
1366
+ kind: params.kind,
1367
+ forcedThreadTs: streamSession?.threadTs ?? plannedThreadTs
1368
+ });
1369
+ }
1370
+ };
1371
+ let draftPreviewCommitted = false;
1372
+ const deliverSlackPayload = async (payload, info) => {
1373
+ if (payload.isReasoning === true) return { visibleReplySent: false };
1374
+ if (useStreaming) {
1375
+ await deliverWithStreaming({
1376
+ payload,
1377
+ kind: info.kind
1378
+ });
1379
+ return;
1380
+ }
1381
+ const reply = resolveSendableOutboundReplyParts(payload);
1382
+ const slackBlocks = readSlackReplyBlocks(payload);
1383
+ const ttsSupplement = getReplyPayloadTtsSupplement(payload);
1384
+ const trimmedFinalText = (payload.text ?? ttsSupplement?.spokenText ?? "").trim();
1385
+ const shouldRestoreTtsSupplementTextForPreviewFallback = Boolean(ttsSupplement) && ttsSupplement?.visibleTextAlreadyDelivered !== true && Boolean(draftStream) && !draftPreviewCommitted && !observedFinalReplyDelivery && previewStreamingEnabled && !payload.text?.trim();
1386
+ if (info.kind === "final" && ttsSupplement && draftStream && !draftPreviewCommitted && !observedFinalReplyDelivery && previewStreamingEnabled && !payload.isError && trimmedFinalText.length > 0) {
1387
+ const channelId = draftStream.channelId();
1388
+ const messageId = draftStream.messageId();
1389
+ if (channelId && messageId) {
1390
+ const finalThreadTs = usedReplyThreadTs ?? statusThreadTs;
1391
+ await draftStream.flush();
1392
+ await draftStream.seal();
1393
+ try {
1394
+ await finalizeSlackPreviewEdit({
1395
+ client: ctx.app.client,
1396
+ token: ctx.botToken,
1397
+ accountId: account.accountId,
1398
+ channelId,
1399
+ messageId,
1400
+ text: normalizeSlackOutboundText(trimmedFinalText),
1401
+ ...slackBlocks?.length ? { blocks: slackBlocks } : {},
1402
+ threadTs: finalThreadTs
1403
+ });
1404
+ } catch (err) {
1405
+ logVerbose(`slack: preview final edit failed; falling back to standard send (${formatSlackError(err)})`);
1406
+ await draftStream.discardPending();
1407
+ let delivered = false;
1408
+ try {
1409
+ await deliverNormally({
1410
+ payload: payload.text?.trim() ? payload : {
1411
+ ...payload,
1412
+ text: trimmedFinalText
1413
+ },
1414
+ kind: info.kind,
1415
+ forcedThreadTs: finalThreadTs
1416
+ });
1417
+ delivered = true;
1418
+ } finally {
1419
+ if (delivered) await draftStream.clear();
1420
+ }
1421
+ return;
1422
+ }
1423
+ draftPreviewCommitted = true;
1424
+ observedFinalReplyDelivery = true;
1425
+ observedReplyDelivery = true;
1426
+ replyPlan.markSent();
1427
+ await deliverNormally({
1428
+ payload: buildTtsSupplementMediaPayload(payload),
1429
+ kind: info.kind,
1430
+ forcedThreadTs: finalThreadTs
1431
+ });
1432
+ markPreviewPayloadDelivered({
1433
+ kind: info.kind,
1434
+ payload,
1435
+ threadTs: finalThreadTs
1436
+ });
1437
+ return;
1438
+ }
1439
+ }
1440
+ await deliverWithFinalizableLivePreviewAdapter({
1441
+ kind: info.kind,
1442
+ payload,
1443
+ adapter: defineFinalizableLivePreviewAdapter({
1444
+ draft: draftStream && !draftPreviewCommitted && !observedFinalReplyDelivery ? {
1445
+ flush: draftStream.flush,
1446
+ clear: draftStream.clear,
1447
+ discardPending: draftStream.discardPending,
1448
+ seal: draftStream.seal,
1449
+ id: () => {
1450
+ const channelId = draftStream.channelId();
1451
+ const messageId = draftStream.messageId();
1452
+ return channelId && messageId ? {
1453
+ channelId,
1454
+ messageId
1455
+ } : void 0;
1456
+ }
1457
+ } : void 0,
1458
+ buildFinalEdit: () => {
1459
+ if (!previewStreamingEnabled || reply.hasMedia && !ttsSupplement || payload.isError || trimmedFinalText.length === 0 && !slackBlocks?.length) return;
1460
+ return {
1461
+ text: normalizeSlackOutboundText(trimmedFinalText),
1462
+ blocks: slackBlocks,
1463
+ threadTs: usedReplyThreadTs ?? statusThreadTs
1464
+ };
1465
+ },
1466
+ editFinal: async (preview, edit) => {
1467
+ if (deliveryTracker.hasDelivered({
1468
+ kind: info.kind,
1469
+ payload,
1470
+ threadTs: edit.threadTs
1471
+ })) return;
1472
+ await finalizeSlackPreviewEdit({
1473
+ client: ctx.app.client,
1474
+ token: ctx.botToken,
1475
+ accountId: account.accountId,
1476
+ channelId: preview.channelId,
1477
+ messageId: preview.messageId,
1478
+ text: edit.text,
1479
+ ...edit.blocks?.length ? { blocks: edit.blocks } : {},
1480
+ threadTs: edit.threadTs
1481
+ });
1482
+ if (!ttsSupplement) emitSlackMessageSentHooks({
1483
+ ...messageSentHookContext,
1484
+ to: messageSentHookTarget,
1485
+ accountId: account.accountId,
1486
+ content: trimmedFinalText,
1487
+ success: true,
1488
+ messageId: preview.messageId
1489
+ });
1490
+ draftPreviewCommitted = true;
1491
+ observedFinalReplyDelivery = true;
1492
+ },
1493
+ onPreviewFinalized: (_preview) => {
1494
+ draftPreviewCommitted = true;
1495
+ observedFinalReplyDelivery = true;
1496
+ const finalThreadTs = usedReplyThreadTs ?? statusThreadTs;
1497
+ observedReplyDelivery = true;
1498
+ replyPlan.markSent();
1499
+ if (!ttsSupplement) markPreviewPayloadDelivered({
1500
+ kind: info.kind,
1501
+ payload,
1502
+ threadTs: finalThreadTs
1503
+ });
1504
+ },
1505
+ buildSupplementalPayload: () => ttsSupplement ? buildTtsSupplementMediaPayload(payload) : void 0,
1506
+ deliverSupplemental: async (supplementalPayload) => {
1507
+ const previewThreadTs = usedReplyThreadTs ?? statusThreadTs;
1508
+ const supplementalThreadTs = await deliverNormally({
1509
+ payload: supplementalPayload,
1510
+ kind: info.kind,
1511
+ forcedThreadTs: previewThreadTs
1512
+ });
1513
+ markPreviewPayloadDelivered({
1514
+ kind: info.kind,
1515
+ payload,
1516
+ threadTs: supplementalThreadTs
1517
+ });
1518
+ },
1519
+ logPreviewEditFailure: (err) => {
1520
+ logVerbose(`slack: preview final edit failed; falling back to standard send (${formatSlackError(err)})`);
1521
+ }
1522
+ }),
1523
+ deliverNormally: async () => {
1524
+ await deliverNormally({
1525
+ payload: shouldRestoreTtsSupplementTextForPreviewFallback ? {
1526
+ ...payload,
1527
+ text: ttsSupplement?.spokenText
1528
+ } : payload,
1529
+ kind: info.kind
1530
+ });
1531
+ }
1532
+ });
1533
+ };
1534
+ const onSlackDeliveryError = (err, info) => {
1535
+ runtime.error?.(danger(`slack ${info.kind} reply failed: ${formatSlackError(err)}`));
1536
+ replyPipeline.typingCallbacks?.onIdle?.();
1537
+ };
1538
+ const draftStream = shouldUseDraftStream ? createSlackDraftStream({
1539
+ target: prepared.replyTarget,
1540
+ cfg,
1541
+ token: ctx.botToken,
1542
+ accountId: account.accountId,
1543
+ identity: slackIdentity,
1544
+ ...slackMessageMetadata ? { metadata: slackMessageMetadata } : {},
1545
+ maxChars: Math.min(ctx.textLimit, SLACK_TEXT_LIMIT),
1546
+ resolveThreadTs: () => {
1547
+ const ts = replyPlan.peekThreadTs();
1548
+ if (ts) usedReplyThreadTs ??= ts;
1549
+ return ts;
1550
+ },
1551
+ log: logVerbose,
1552
+ warn: logVerbose
1553
+ }) : void 0;
1554
+ let hasStreamedMessage = false;
1555
+ const streamMode = slackStreaming.draftMode;
1556
+ const useNativeProgressStreaming = useStreaming && slackStreaming.mode === "progress";
1557
+ const previewToolProgressEnabled = (Boolean(draftStream) || useNativeProgressStreaming) && resolveChannelStreamingPreviewToolProgress(account.config);
1558
+ const suppressDefaultToolProgressMessages = resolveChannelStreamingSuppressDefaultToolProgressMessages(account.config, {
1559
+ draftStreamActive: Boolean(draftStream) || useNativeProgressStreaming,
1560
+ previewToolProgressEnabled,
1561
+ previewStreamingEnabled
1562
+ });
1563
+ let previewToolProgressSuppressed = false;
1564
+ let previewToolProgressLines = [];
1565
+ let lastNonEmptyPreviewToolProgressLines = [];
1566
+ let appendRenderedText = "";
1567
+ let appendSourceText = "";
1568
+ let reasoningProgressRawText = "";
1569
+ let statusUpdateCount = 0;
1570
+ let nativeProgressCompletionSent = false;
1571
+ let nativeProgressChunkKey;
1572
+ const progressSeed = `${account.accountId}:${message.channel}`;
1573
+ const useRichProgressDraft = streamMode === "status_final" && resolveChannelProgressDraftRender(account.config) === "rich";
1574
+ const explicitProgressTitle = resolveExplicitSlackProgressTitle(account.config);
1575
+ const progressDraftMaxLineChars = resolveChannelProgressDraftMaxLineChars(account.config);
1576
+ const renderProgressDraft = () => {
1577
+ if (!draftStream || streamMode !== "status_final") return;
1578
+ const progressLines = previewToolProgressLines.length === 0 ? lastNonEmptyPreviewToolProgressLines : previewToolProgressLines;
1579
+ const previewText = formatChannelProgressDraftText({
1580
+ entry: account.config,
1581
+ lines: progressLines,
1582
+ seed: progressSeed,
1583
+ formatLine: escapeSlackMrkdwn
1584
+ });
1585
+ if (!previewText) return;
1586
+ const richProgressBlocks = useRichProgressDraft ? buildSlackProgressDraftBlocks({
1587
+ title: explicitProgressTitle,
1588
+ lines: progressLines,
1589
+ maxLineChars: resolveChannelProgressDraftMaxLineChars(account.config)
1590
+ }) : void 0;
1591
+ draftStream.update(useRichProgressDraft && richProgressBlocks ? {
1592
+ text: previewText,
1593
+ blocks: richProgressBlocks
1594
+ } : previewText);
1595
+ hasStreamedMessage = true;
1596
+ };
1597
+ const waitForNativeProgressStreamStart = async () => {
1598
+ if (streamSession || !nativeProgressStreamStartPromise) return true;
1599
+ try {
1600
+ await nativeProgressStreamStartPromise;
1601
+ } catch {
1602
+ streamFailed = true;
1603
+ return false;
1604
+ }
1605
+ return !streamFailed;
1606
+ };
1607
+ const buildNativeProgressChunks = () => streamSession ? buildSlackProgressStreamUpdateChunks({
1608
+ title: explicitProgressTitle,
1609
+ lines: previewToolProgressLines,
1610
+ maxLineChars: progressDraftMaxLineChars
1611
+ }) : buildSlackProgressStreamStartChunks({
1612
+ title: explicitProgressTitle,
1613
+ lines: previewToolProgressLines,
1614
+ maxLineChars: progressDraftMaxLineChars
1615
+ });
1616
+ const markNativeProgressDelivered = (session, threadTs) => {
1617
+ if (session.delivered) observedReplyDelivery = true;
1618
+ if (threadTs) {
1619
+ usedReplyThreadTs ??= threadTs;
1620
+ rememberDeliveredThreadTs("block", threadTs);
1621
+ }
1622
+ };
1623
+ const startNativeProgressStream = async (chunks, chunkKey) => {
1624
+ const streamThreadTs = replyPlan.nextThreadTs();
1625
+ if (!streamThreadTs) {
1626
+ logVerbose("slack-stream: no reply thread target for native progress stream start, falling back");
1627
+ streamFailed = true;
1628
+ return;
1629
+ }
1630
+ nativeProgressStreamThreadTs = streamThreadTs;
1631
+ const startPromise = (async () => {
1632
+ const session = await startSlackStream({
1633
+ client: ctx.app.client,
1634
+ channel: message.channel,
1635
+ threadTs: streamThreadTs,
1636
+ chunks,
1637
+ taskDisplayMode: "plan",
1638
+ ...slackIdentity ? { identity: slackIdentity } : {},
1639
+ teamId: await resolveSlackStreamRecipientTeamId({
1640
+ client: ctx.app.client,
1641
+ token: ctx.botToken,
1642
+ userId: message.user,
1643
+ fallbackTeamId: ctx.teamId
1644
+ }),
1645
+ userId: message.user
1646
+ });
1647
+ streamSession = session;
1648
+ return session;
1649
+ })();
1650
+ nativeProgressStreamStartPromise = startPromise;
1651
+ let startedSession;
1652
+ try {
1653
+ startedSession = await startPromise;
1654
+ } finally {
1655
+ if (nativeProgressStreamStartPromise === startPromise) nativeProgressStreamStartPromise = null;
1656
+ }
1657
+ if (startedSession) markNativeProgressDelivered(startedSession, streamThreadTs);
1658
+ nativeProgressChunkKey = chunkKey;
1659
+ replyPlan.markSent();
1660
+ };
1661
+ const appendNativeProgressStream = async (chunks, chunkKey) => {
1662
+ if (!streamSession) return;
1663
+ await appendSlackStream({
1664
+ session: streamSession,
1665
+ chunks
1666
+ });
1667
+ markNativeProgressDelivered(streamSession);
1668
+ nativeProgressChunkKey = chunkKey;
1669
+ };
1670
+ const updateNativeProgressStream = async () => {
1671
+ if (!useNativeProgressStreaming || streamFailed || previewToolProgressLines.length === 0) return;
1672
+ if (!await waitForNativeProgressStreamStart()) return;
1673
+ const chunks = buildNativeProgressChunks();
1674
+ if (!chunks?.length) return;
1675
+ const chunkKey = JSON.stringify(chunks);
1676
+ if (chunkKey === nativeProgressChunkKey) return;
1677
+ try {
1678
+ if (!streamSession) {
1679
+ await startNativeProgressStream(chunks, chunkKey);
1680
+ return;
1681
+ }
1682
+ await appendNativeProgressStream(chunks, chunkKey);
1683
+ } catch (err) {
1684
+ runtime.error?.(danger(`slack-stream: native progress stream failed: ${formatSlackError(err)}, falling back`));
1685
+ streamFailed = true;
1686
+ }
1687
+ };
1688
+ const progressDraftGate = createChannelProgressDraftGate({ onStart: useNativeProgressStreaming ? updateNativeProgressStream : renderProgressDraft });
1689
+ const refreshStartedProgressDraft = async () => {
1690
+ if (useNativeProgressStreaming) await updateNativeProgressStream();
1691
+ else renderProgressDraft();
1692
+ };
1693
+ const pushPreviewToolProgress = async (line, options) => {
1694
+ if (!draftStream && !useNativeProgressStreaming) return;
1695
+ if (options?.toolName !== void 0 && !isChannelProgressDraftWorkToolName(options.toolName)) return;
1696
+ const normalized = line?.text.replace(/\s+/g, " ").trim();
1697
+ if (!line || !normalized) {
1698
+ if (streamMode !== "status_final") return;
1699
+ const alreadyStarted = progressDraftGate.hasStarted;
1700
+ const progressActive = await progressDraftGate.noteWork();
1701
+ if ((alreadyStarted || progressActive) && progressDraftGate.hasStarted) await refreshStartedProgressDraft();
1702
+ return;
1703
+ }
1704
+ if (streamMode !== "status_final") {
1705
+ if (!previewToolProgressEnabled || previewToolProgressSuppressed) return;
1706
+ const nextLines = mergeChannelProgressDraftLine(previewToolProgressLines, line, { maxLines: resolveChannelProgressDraftMaxLines(account.config) });
1707
+ if (nextLines === previewToolProgressLines) return;
1708
+ previewToolProgressLines = nextLines;
1709
+ draftStream?.update(formatChannelProgressDraftText({
1710
+ entry: account.config,
1711
+ lines: previewToolProgressLines,
1712
+ seed: progressSeed,
1713
+ formatLine: escapeSlackMrkdwn
1714
+ }));
1715
+ hasStreamedMessage = true;
1716
+ return;
1717
+ }
1718
+ if (previewToolProgressEnabled && !previewToolProgressSuppressed) {
1719
+ previewToolProgressLines = mergeChannelProgressDraftLine(previewToolProgressLines, line, { maxLines: resolveChannelProgressDraftMaxLines(account.config) });
1720
+ if (previewToolProgressLines.length > 0) lastNonEmptyPreviewToolProgressLines = previewToolProgressLines;
1721
+ }
1722
+ if (useNativeProgressStreaming) {
1723
+ if (progressDraftGate.hasStarted) await updateNativeProgressStream();
1724
+ else {
1725
+ await progressDraftGate.startNow();
1726
+ if (progressDraftGate.hasStarted) await updateNativeProgressStream();
1727
+ }
1728
+ return;
1729
+ }
1730
+ const alreadyStarted = progressDraftGate.hasStarted;
1731
+ const progressActive = await progressDraftGate.noteWork();
1732
+ if ((alreadyStarted || progressActive) && progressDraftGate.hasStarted) await refreshStartedProgressDraft();
1733
+ };
1734
+ const updateDraftFromPartial = (text) => {
1735
+ const trimmed = text?.trimEnd();
1736
+ if (!trimmed) return;
1737
+ if (streamMode === "append") {
1738
+ previewToolProgressSuppressed = true;
1739
+ previewToolProgressLines = [];
1740
+ const next = applyAppendOnlyStreamUpdate({
1741
+ incoming: trimmed,
1742
+ rendered: appendRenderedText,
1743
+ source: appendSourceText
1744
+ });
1745
+ appendRenderedText = next.rendered;
1746
+ appendSourceText = next.source;
1747
+ if (!next.changed) return;
1748
+ draftStream?.update(next.rendered);
1749
+ hasStreamedMessage = true;
1750
+ return;
1751
+ }
1752
+ if (streamMode === "status_final") {
1753
+ if (!progressDraftGate.hasStarted) return;
1754
+ statusUpdateCount += 1;
1755
+ if (statusUpdateCount > 1 && statusUpdateCount % 4 !== 0) return;
1756
+ renderProgressDraft();
1757
+ return;
1758
+ }
1759
+ previewToolProgressSuppressed = true;
1760
+ previewToolProgressLines = [];
1761
+ draftStream?.update(trimmed);
1762
+ hasStreamedMessage = true;
1763
+ };
1764
+ const pushReasoningProgress = async (payload) => {
1765
+ if (!payload?.text) return;
1766
+ reasoningProgressRawText = mergeSlackReasoningProgressText(reasoningProgressRawText, payload.text, { snapshot: payload.isReasoningSnapshot === true });
1767
+ const normalized = normalizeSlackReasoningProgressLine(reasoningProgressRawText);
1768
+ if (!normalized) return;
1769
+ await pushPreviewToolProgress({
1770
+ id: "reasoning",
1771
+ kind: "item",
1772
+ text: normalized,
1773
+ label: "Reasoning"
1774
+ });
1775
+ };
1776
+ const onDraftBoundary = !shouldUseDraftStream ? void 0 : async () => {
1777
+ if (hasStreamedMessage && streamMode !== "status_final") {
1778
+ draftStream?.forceNewMessage();
1779
+ hasStreamedMessage = false;
1780
+ appendRenderedText = "";
1781
+ appendSourceText = "";
1782
+ statusUpdateCount = 0;
1783
+ }
1784
+ reasoningProgressRawText = "";
1785
+ previewToolProgressSuppressed = false;
1786
+ previewToolProgressLines = [];
1787
+ };
1788
+ let dispatchError;
1789
+ let queuedFinal = false;
1790
+ let counts = {};
1791
+ try {
1792
+ const turnResult = await dispatchChannelInboundReply({
1793
+ cfg,
1794
+ channel: "slack",
1795
+ accountId: route.accountId,
1796
+ agentId: route.agentId,
1797
+ routeSessionKey: route.sessionKey,
1798
+ storePath: prepared.turn.storePath,
1799
+ ctxPayload: prepared.ctxPayload,
1800
+ recordInboundSession,
1801
+ dispatchReplyWithBufferedBlockDispatcher,
1802
+ dispatcherOptions: {
1803
+ ...replyPipeline,
1804
+ humanDelay: resolveHumanDelayConfig(cfg, route.agentId)
1805
+ },
1806
+ delivery: {
1807
+ deliver: deliverSlackPayload,
1808
+ onError: onSlackDeliveryError
1809
+ },
1810
+ record: prepared.turn.record,
1811
+ history: prepared.turn.history,
1812
+ botLoopProtection: resolveSlackBotLoopProtection(prepared),
1813
+ replyOptions: {
1814
+ skillFilter: prepared.channelConfig?.skills,
1815
+ sourceReplyDeliveryMode,
1816
+ hasRepliedRef,
1817
+ disableBlockStreaming,
1818
+ onModelSelected,
1819
+ suppressDefaultToolProgressMessages: suppressDefaultToolProgressMessages ? true : void 0,
1820
+ allowProgressCallbacksWhenSourceDeliverySuppressed: sourceReplyDeliveryMode === "message_tool_only" && statusReactionsEnabled ? true : void 0,
1821
+ allowToolLifecycleWhenProgressHidden: statusReactionsEnabled ? true : void 0,
1822
+ onPartialReply: useStreaming ? void 0 : !previewStreamingEnabled ? void 0 : async (payload) => {
1823
+ updateDraftFromPartial(payload.text);
1824
+ },
1825
+ onAssistantMessageStart: onDraftBoundary,
1826
+ onReasoningEnd: onDraftBoundary,
1827
+ onReasoningStream: statusReactionsEnabled || previewToolProgressEnabled ? async (payload) => {
1828
+ await pushReasoningProgress(payload);
1829
+ if (!statusReactionsEnabled) return;
1830
+ await statusReactions.setThinking();
1831
+ } : void 0,
1832
+ onToolStart: async (payload) => {
1833
+ if (statusReactionsEnabled) await statusReactions.setTool(payload.name);
1834
+ await pushPreviewToolProgress(buildChannelProgressDraftLineForEntry(account.config, {
1835
+ event: "tool",
1836
+ itemId: payload.itemId,
1837
+ toolCallId: payload.toolCallId,
1838
+ name: payload.name,
1839
+ phase: payload.phase,
1840
+ args: payload.args
1841
+ }, payload.detailMode ? { detailMode: payload.detailMode } : void 0), { toolName: payload.name });
1842
+ },
1843
+ onItemEvent: async (payload) => {
1844
+ await pushPreviewToolProgress(buildChannelProgressDraftLineForEntry(account.config, {
1845
+ event: "item",
1846
+ itemId: payload.itemId,
1847
+ toolCallId: payload.toolCallId,
1848
+ itemKind: payload.kind,
1849
+ title: payload.title,
1850
+ name: payload.name,
1851
+ phase: payload.phase,
1852
+ status: payload.status,
1853
+ summary: payload.summary,
1854
+ progressText: payload.progressText,
1855
+ meta: payload.meta
1856
+ }));
1857
+ },
1858
+ onPlanUpdate: async (payload) => {
1859
+ if (payload.phase !== "update") return;
1860
+ await pushPreviewToolProgress(buildChannelProgressDraftLine({
1861
+ event: "plan",
1862
+ phase: payload.phase,
1863
+ title: payload.title,
1864
+ explanation: payload.explanation,
1865
+ steps: payload.steps
1866
+ }));
1867
+ },
1868
+ onApprovalEvent: async (payload) => {
1869
+ if (payload.phase !== "requested") return;
1870
+ await pushPreviewToolProgress(buildChannelProgressDraftLine({
1871
+ event: "approval",
1872
+ phase: payload.phase,
1873
+ title: payload.title,
1874
+ command: payload.command,
1875
+ reason: payload.reason,
1876
+ message: payload.message
1877
+ }));
1878
+ },
1879
+ onCommandOutput: async (payload) => {
1880
+ if (payload.phase !== "end") return;
1881
+ await pushPreviewToolProgress(buildChannelProgressDraftLine({
1882
+ event: "command-output",
1883
+ itemId: payload.itemId,
1884
+ toolCallId: payload.toolCallId,
1885
+ phase: payload.phase,
1886
+ title: payload.title,
1887
+ name: payload.name,
1888
+ status: payload.status,
1889
+ exitCode: payload.exitCode
1890
+ }));
1891
+ },
1892
+ onPatchSummary: async (payload) => {
1893
+ if (payload.phase !== "end") return;
1894
+ await pushPreviewToolProgress(buildChannelProgressDraftLine({
1895
+ event: "patch",
1896
+ itemId: payload.itemId,
1897
+ toolCallId: payload.toolCallId,
1898
+ phase: payload.phase,
1899
+ title: payload.title,
1900
+ name: payload.name,
1901
+ added: payload.added,
1902
+ modified: payload.modified,
1903
+ deleted: payload.deleted,
1904
+ summary: payload.summary
1905
+ }));
1906
+ }
1907
+ }
1908
+ });
1909
+ if (turnResult.dispatched) {
1910
+ const result = turnResult.dispatchResult;
1911
+ queuedFinal = result.queuedFinal;
1912
+ counts = result.counts;
1913
+ }
1914
+ } catch (err) {
1915
+ dispatchError = err;
1916
+ } finally {
1917
+ progressDraftGate.cancel();
1918
+ await draftStream?.discardPending();
1919
+ }
1920
+ let streamFallbackDelivered = false;
1921
+ const finalStream = streamSession;
1922
+ if (finalStream && !finalStream.stopped) try {
1923
+ const completionChunks = useNativeProgressStreaming && !nativeProgressCompletionSent && previewToolProgressLines.length > 0 ? buildSlackProgressStreamCompletionChunks({
1924
+ title: explicitProgressTitle,
1925
+ lines: previewToolProgressLines,
1926
+ maxLineChars: progressDraftMaxLineChars,
1927
+ finalInProgressStatus: dispatchError ? "error" : "complete"
1928
+ }) : void 0;
1929
+ if (completionChunks?.length) nativeProgressCompletionSent = true;
1930
+ const stopResult = await stopSlackStream({
1931
+ session: finalStream,
1932
+ ...completionChunks?.length ? { chunks: completionChunks } : {},
1933
+ ...slackMessageMetadata ? { metadata: slackMessageMetadata } : {}
1934
+ });
1935
+ for (const delivery of streamedDeliveries) delivery.acknowledged = true;
1936
+ emitAcknowledgedStreamedDeliveries(stopResult?.messageId);
1937
+ } catch (err) {
1938
+ if (err instanceof SlackStreamNotDeliveredError) {
1939
+ streamFallbackDelivered = await deliverPendingStreamFallback(finalStream, err);
1940
+ if (!streamFallbackDelivered) dispatchError ??= err;
1941
+ } else {
1942
+ const error = formatSlackError(err);
1943
+ emitAcknowledgedStreamedDeliveries();
1944
+ emitFailedPendingStreamedDeliveries(error);
1945
+ runtime.error?.(danger(`slack-stream: failed to stop stream: ${error}`));
1946
+ if (!finalStream.delivered) dispatchError ??= err;
1947
+ }
1948
+ }
1949
+ for (const kind of [
1950
+ "tool",
1951
+ "block",
1952
+ "final"
1953
+ ]) {
1954
+ const failedStreamedCount = streamedDeliveries.filter((delivery) => delivery.kind === kind && delivery.outcome === "failure").length;
1955
+ const additionalFailedStreamed = Math.max(0, failedStreamedCount - streamedFailuresOwnedByDispatcher[kind]);
1956
+ if (additionalFailedStreamed > 0) counts = {
1957
+ ...counts,
1958
+ [kind]: Math.max(0, (counts[kind] ?? 0) - additionalFailedStreamed)
1959
+ };
1960
+ }
1961
+ queuedFinal = queuedFinal && (counts.final ?? 0) > 0;
1962
+ const anyReplyDelivered = hasVisibleInboundReplyDispatch({
1963
+ queuedFinal,
1964
+ counts
1965
+ }, {
1966
+ observedReplyDelivery,
1967
+ fallbackDelivered: streamFallbackDelivered
1968
+ });
1969
+ if (statusReactionsEnabled) {
1970
+ if (dispatchError) {
1971
+ await statusReactions.setError();
1972
+ if (ctx.removeAckAfterReply) (async () => {
1973
+ await sleep(statusReactionTiming.errorHoldMs);
1974
+ if (anyReplyDelivered) await statusReactions.clear();
1975
+ })();
1976
+ } else if (anyReplyDelivered) {
1977
+ await statusReactions.setDone();
1978
+ if (ctx.removeAckAfterReply) (async () => {
1979
+ await sleep(statusReactionTiming.doneHoldMs);
1980
+ await statusReactions.clear();
1981
+ })();
1982
+ else statusReactions.restoreInitial();
1983
+ } else await statusReactions.restoreInitial();
1984
+ }
1985
+ const participationThreadTs = usedReplyThreadTs ?? statusThreadTs;
1986
+ if (anyReplyDelivered && participationThreadTs) recordSlackThreadParticipation(account.accountId, message.channel, participationThreadTs, { agentId: route.agentId });
1987
+ if (dispatchError) throw toLintErrorObject(dispatchError, "Slack dispatch failed");
1988
+ if (!anyReplyDelivered && !draftPreviewCommitted) {
1989
+ await draftStream?.clear();
1990
+ return;
1991
+ }
1992
+ if (shouldLogVerbose()) {
1993
+ const finalCount = counts.final;
1994
+ logVerbose(`slack: delivered ${finalCount} reply${finalCount === 1 ? "" : "ies"} to ${prepared.replyTarget}`);
1995
+ }
1996
+ if (!statusReactionsEnabled) removeAckReactionAfterReply({
1997
+ removeAfterReply: ctx.removeAckAfterReply && anyReplyDelivered,
1998
+ ackReactionPromise: prepared.ackReactionPromise,
1999
+ ackReactionValue: prepared.ackReactionValue,
2000
+ remove: () => removeSlackReaction(message.channel, prepared.ackReactionMessageTs ?? "", prepared.ackReactionValue, {
2001
+ token: ctx.botToken,
2002
+ client: ctx.app.client
2003
+ }),
2004
+ onError: (err) => {
2005
+ logAckFailure({
2006
+ log: logVerbose,
2007
+ channel: "slack",
2008
+ target: `${message.channel}/${message.ts}`,
2009
+ error: err
2010
+ });
2011
+ }
2012
+ });
2013
+ }
2014
+ function toLintErrorObject(value, fallbackMessage) {
2015
+ if (value instanceof Error) return value;
2016
+ if (typeof value === "string") return new Error(value);
2017
+ const error = new Error(fallbackMessage, { cause: value });
2018
+ if (typeof value === "object" && value !== null || typeof value === "function") Object.assign(error, value);
2019
+ return error;
2020
+ }
2021
+ //#endregion
2022
+ //#region extensions/slack/src/monitor/message-handler/prepare-content.ts
2023
+ const SLACK_MENTION_RESOLUTION_CONCURRENCY = 4;
2024
+ const SLACK_MENTION_RESOLUTION_MAX_LOOKUPS_PER_MESSAGE = 20;
2025
+ const SLACK_USER_MENTION_RE$1 = /<@([A-Z0-9]+)(?:\|[^>]+)?>/gi;
2026
+ const loadSlackMediaModule$1 = createLazyRuntimeModule(() => import("./actions-2VEX4Wdz.mjs").then((n) => n.g));
2027
+ function collectUniqueSlackMentionIds$1(texts) {
2028
+ const seen = /* @__PURE__ */ new Set();
2029
+ const mentionIds = [];
2030
+ for (const text of texts) {
2031
+ if (!text) continue;
2032
+ SLACK_USER_MENTION_RE$1.lastIndex = 0;
2033
+ for (const match of text.matchAll(SLACK_USER_MENTION_RE$1)) {
2034
+ const userId = match[1];
2035
+ if (!userId || seen.has(userId)) continue;
2036
+ seen.add(userId);
2037
+ mentionIds.push(userId);
2038
+ }
2039
+ }
2040
+ return mentionIds;
2041
+ }
2042
+ function renderSlackUserMentions(text, renderedMentions) {
2043
+ if (!text || renderedMentions.size === 0) return text;
2044
+ SLACK_USER_MENTION_RE$1.lastIndex = 0;
2045
+ return text.replace(SLACK_USER_MENTION_RE$1, (full, userId) => {
2046
+ return renderedMentions.get(userId) ?? full;
2047
+ });
2048
+ }
2049
+ function filterInheritedParentFiles(params) {
2050
+ const { files, isThreadReply, threadStarter } = params;
2051
+ if (!isThreadReply || !files?.length) return files;
2052
+ if (!threadStarter?.files?.length) return files;
2053
+ const starterFileIds = new Set(threadStarter.files.map((file) => file.id));
2054
+ const filtered = files.filter((file) => !file.id || !starterFileIds.has(file.id));
2055
+ if (filtered.length < files.length) logVerbose(`slack: filtered ${files.length - filtered.length} inherited parent file(s) from thread reply`);
2056
+ return filtered.length > 0 ? filtered : void 0;
2057
+ }
2058
+ async function resolveSlackMessageContent(params) {
2059
+ const ownFiles = filterInheritedParentFiles({
2060
+ files: params.message.files,
2061
+ isThreadReply: params.isThreadReply,
2062
+ threadStarter: params.threadStarter
2063
+ });
2064
+ const mediaPromise = ownFiles && ownFiles.length > 0 ? loadSlackMediaModule$1().then(({ resolveSlackMedia }) => resolveSlackMedia({
2065
+ files: ownFiles,
2066
+ client: params.client,
2067
+ token: params.botToken,
2068
+ maxBytes: params.mediaMaxBytes,
2069
+ readIdleTimeoutMs: params.mediaReadIdleTimeoutMs,
2070
+ totalTimeoutMs: params.mediaTotalTimeoutMs,
2071
+ abortSignal: params.abortSignal
2072
+ })) : Promise.resolve(null);
2073
+ const attachmentContentPromise = params.message.attachments && params.message.attachments.length > 0 ? loadSlackMediaModule$1().then(({ resolveSlackAttachmentContent }) => resolveSlackAttachmentContent({
2074
+ attachments: params.message.attachments,
2075
+ client: params.client,
2076
+ token: params.botToken,
2077
+ maxBytes: params.mediaMaxBytes,
2078
+ readIdleTimeoutMs: params.mediaReadIdleTimeoutMs,
2079
+ totalTimeoutMs: params.mediaTotalTimeoutMs,
2080
+ abortSignal: params.abortSignal
2081
+ })) : Promise.resolve(null);
2082
+ const [media, attachmentContent] = await Promise.all([mediaPromise, attachmentContentPromise]);
2083
+ const mergedMedia = [...media ?? [], ...attachmentContent?.media ?? []];
2084
+ const effectiveDirectMedia = mergedMedia.length > 0 ? mergedMedia : null;
2085
+ const mediaPlaceholder = effectiveDirectMedia ? effectiveDirectMedia.map((item) => item.placeholder).join(" ") : void 0;
2086
+ const fallbackFiles = ownFiles ?? [];
2087
+ const fileOnlyFallback = !mediaPlaceholder && fallbackFiles.length > 0 ? fallbackFiles.slice(0, 8).map((file) => formatSlackFileReference(file)).join(", ") : void 0;
2088
+ const fileOnlyPlaceholder = fileOnlyFallback ? `[Slack file: ${fileOnlyFallback}]` : void 0;
2089
+ let botAttachmentText;
2090
+ if (params.isBotMessage && !attachmentContent?.text) {
2091
+ const botAttachmentTextParts = [];
2092
+ for (const attachment of params.message.attachments ?? []) {
2093
+ const text = normalizeOptionalString(attachment.text) ?? normalizeOptionalString(attachment.fallback);
2094
+ if (text) botAttachmentTextParts.push(text);
2095
+ }
2096
+ botAttachmentText = botAttachmentTextParts.length > 0 ? botAttachmentTextParts.join("\n") : void 0;
2097
+ }
2098
+ const blocksText = resolveSlackBlocksText(params.message.blocks);
2099
+ const textParts = [
2100
+ chooseSlackPrimaryText({
2101
+ messageText: normalizeOptionalString(params.message.text),
2102
+ blocksText
2103
+ }),
2104
+ attachmentContent?.text,
2105
+ botAttachmentText
2106
+ ];
2107
+ const renderedMentions = /* @__PURE__ */ new Map();
2108
+ const resolveUserName = params.resolveUserName;
2109
+ if (resolveUserName) {
2110
+ const mentionIds = collectUniqueSlackMentionIds$1(textParts);
2111
+ const lookupIds = mentionIds.slice(0, SLACK_MENTION_RESOLUTION_MAX_LOOKUPS_PER_MESSAGE);
2112
+ const skippedLookups = mentionIds.length - lookupIds.length;
2113
+ if (skippedLookups > 0) logVerbose(`slack: skipping ${skippedLookups} mention lookup(s) beyond per-message cap (${SLACK_MENTION_RESOLUTION_MAX_LOOKUPS_PER_MESSAGE})`);
2114
+ const { results } = await runTasksWithConcurrency({
2115
+ tasks: lookupIds.map((userId) => async () => {
2116
+ const user = await resolveUserName(userId);
2117
+ const renderedName = normalizeOptionalString(user?.name);
2118
+ return {
2119
+ userId,
2120
+ rendered: renderedName ? `<@${userId}> (${renderedName})` : null
2121
+ };
2122
+ }),
2123
+ limit: SLACK_MENTION_RESOLUTION_CONCURRENCY
2124
+ });
2125
+ for (const result of results) {
2126
+ if (!result) continue;
2127
+ renderedMentions.set(result.userId, result.rendered);
2128
+ }
2129
+ }
2130
+ const rawBody = [
2131
+ renderSlackUserMentions(textParts[0], renderedMentions),
2132
+ renderSlackUserMentions(textParts[1], renderedMentions),
2133
+ renderSlackUserMentions(textParts[2], renderedMentions),
2134
+ mediaPlaceholder,
2135
+ fileOnlyPlaceholder
2136
+ ].filter(Boolean).join("\n") || "";
2137
+ if (!rawBody) return null;
2138
+ return {
2139
+ rawBody,
2140
+ effectiveDirectMedia
2141
+ };
2142
+ }
2143
+ //#endregion
2144
+ //#region extensions/slack/src/monitor/message-handler/prepare-dm-history.ts
2145
+ function resolveSlackDmHistoryLimit(params) {
2146
+ const override = params.userId && params.account.config.dms?.[params.userId]?.historyLimit !== void 0 ? params.account.config.dms[params.userId]?.historyLimit : void 0;
2147
+ return Math.max(0, override ?? params.defaultLimit);
2148
+ }
2149
+ async function resolveSlackDmHistoryContext(params) {
2150
+ const maxMessages = Math.max(0, Math.floor(params.limit));
2151
+ if (maxMessages <= 0) return {
2152
+ body: void 0,
2153
+ inboundHistory: void 0
2154
+ };
2155
+ try {
2156
+ const messages = ((await params.ctx.app.client.conversations.history({
2157
+ token: params.ctx.botToken,
2158
+ channel: params.channelId,
2159
+ ...params.currentMessageTs ? {
2160
+ latest: params.currentMessageTs,
2161
+ inclusive: true
2162
+ } : {},
2163
+ limit: maxMessages + 1
2164
+ })).messages ?? []).filter((message) => {
2165
+ if (params.currentMessageTs && message.ts === params.currentMessageTs) return false;
2166
+ return Boolean(normalizeOptionalString(message.text));
2167
+ }).slice(0, maxMessages).toReversed();
2168
+ if (messages.length === 0) return {
2169
+ body: void 0,
2170
+ inboundHistory: void 0
2171
+ };
2172
+ const userNames = /* @__PURE__ */ new Map();
2173
+ const resolveUserLabel = async (userId) => {
2174
+ const cached = userNames.get(userId);
2175
+ if (cached) return cached;
2176
+ const label = normalizeOptionalString((await params.ctx.resolveUserName(userId)).name) ?? userId;
2177
+ userNames.set(userId, label);
2178
+ return label;
2179
+ };
2180
+ const entries = [];
2181
+ const formatted = [];
2182
+ for (const message of messages) {
2183
+ const body = normalizeOptionalString(message.text);
2184
+ if (!body) continue;
2185
+ const isCurrentBot = params.ctx.botUserId && message.user === params.ctx.botUserId || params.ctx.botId && message.bot_id === params.ctx.botId;
2186
+ const role = isCurrentBot || message.bot_id ? "assistant" : "user";
2187
+ const sender = `${isCurrentBot ? "Assistant" : message.user ? await resolveUserLabel(message.user) : normalizeOptionalString(message.username) ?? (message.bot_id ? "Bot" : "Unknown")} (${role})`;
2188
+ const timestamp = resolveSlackTimestampMs(message.ts);
2189
+ entries.push({
2190
+ sender,
2191
+ body,
2192
+ timestamp
2193
+ });
2194
+ formatted.push(formatInboundEnvelope({
2195
+ channel: "Slack",
2196
+ from: sender,
2197
+ timestamp,
2198
+ body: `${body}\n[slack message id: ${message.ts ?? "unknown"} channel: ${params.channelId}]`,
2199
+ chatType: "direct",
2200
+ envelope: params.envelopeOptions
2201
+ }));
2202
+ }
2203
+ return {
2204
+ body: formatted.length > 0 ? formatted.join("\n\n") : void 0,
2205
+ inboundHistory: entries.length > 0 ? entries : void 0
2206
+ };
2207
+ } catch (err) {
2208
+ logVerbose(`slack: failed to fetch DM history for channel ${params.channelId}: ${formatErrorMessage(err)}`);
2209
+ return {
2210
+ body: void 0,
2211
+ inboundHistory: void 0
2212
+ };
2213
+ }
2214
+ }
2215
+ //#endregion
2216
+ //#region extensions/slack/src/monitor/message-handler/prepare-routing.ts
2217
+ const slackRouteBindingConfigCache = /* @__PURE__ */ new WeakMap();
2218
+ function slackTargetDefaultKindForPeer(kind) {
2219
+ return kind === "direct" ? "user" : "channel";
2220
+ }
2221
+ function slackTargetKindMatchesPeer(peerKind, targetKind) {
2222
+ if (targetKind === "user") return peerKind === "direct";
2223
+ return peerKind === "channel" || peerKind === "group";
2224
+ }
2225
+ function normalizeSlackRouteBindingPeer(peer) {
2226
+ const rawId = peer.id.trim();
2227
+ if (!rawId || rawId === "*") return peer;
2228
+ const target = (() => {
2229
+ try {
2230
+ return parseSlackTarget(rawId, { defaultKind: slackTargetDefaultKindForPeer(peer.kind) });
2231
+ } catch {
2232
+ return;
2233
+ }
2234
+ })();
2235
+ if (!target || !slackTargetKindMatchesPeer(peer.kind, target.kind) || target.id === peer.id) return peer;
2236
+ return {
2237
+ ...peer,
2238
+ id: target.id
2239
+ };
2240
+ }
2241
+ function normalizeSlackRouteBindingConfig(cfg) {
2242
+ const bindings = cfg.bindings;
2243
+ const cached = slackRouteBindingConfigCache.get(cfg);
2244
+ if (cached && cached.bindingsRef === bindings) return cached.normalizedCfg;
2245
+ if (!Array.isArray(bindings)) return cfg;
2246
+ let changed = false;
2247
+ const normalizedBindings = bindings.map((binding) => {
2248
+ if (binding.type === "acp" || binding.match.channel.trim().toLowerCase() !== "slack") return binding;
2249
+ const peer = binding.match.peer;
2250
+ if (!peer) return binding;
2251
+ const normalizedPeer = normalizeSlackRouteBindingPeer(peer);
2252
+ if (normalizedPeer === peer) return binding;
2253
+ changed = true;
2254
+ return {
2255
+ ...binding,
2256
+ match: {
2257
+ ...binding.match,
2258
+ peer: normalizedPeer
2259
+ }
2260
+ };
2261
+ });
2262
+ const normalizedCfg = changed ? {
2263
+ ...cfg,
2264
+ bindings: normalizedBindings
2265
+ } : cfg;
2266
+ slackRouteBindingConfigCache.set(cfg, {
2267
+ bindingsRef: bindings,
2268
+ normalizedCfg
2269
+ });
2270
+ return normalizedCfg;
2271
+ }
2272
+ function resolveSlackBaseConversationId(params) {
2273
+ return params.isDirectMessage ? `user:${params.message.user ?? "unknown"}` : params.message.channel;
2274
+ }
2275
+ function resolveSlackInitialAgentRoute(params) {
2276
+ return resolveAgentRoute({
2277
+ cfg: normalizeSlackRouteBindingConfig(params.ctx.cfg),
2278
+ channel: "slack",
2279
+ accountId: params.account.accountId,
2280
+ teamId: params.ctx.teamId || void 0,
2281
+ peer: {
2282
+ kind: params.isDirectMessage ? "direct" : params.isRoom ? "channel" : "group",
2283
+ id: params.isDirectMessage ? params.message.user ?? "unknown" : params.message.channel
2284
+ }
2285
+ });
2286
+ }
2287
+ function resolveSlackRoutingContext(params) {
2288
+ const { ctx, account, message, isDirectMessage, isGroupDm, isRoom, isRoomish, channelConfig, seedTopLevelRoomThread, assistantThreadTs } = params;
2289
+ let route = resolveSlackInitialAgentRoute({
2290
+ ctx,
2291
+ account,
2292
+ message,
2293
+ isDirectMessage,
2294
+ isRoom
2295
+ });
2296
+ const chatType = isDirectMessage ? "direct" : isGroupDm ? "group" : "channel";
2297
+ const replyToMode = channelConfig?.replyToMode ?? resolveSlackReplyToMode(account, chatType);
2298
+ const threadContext = resolveSlackThreadContext({
2299
+ message,
2300
+ replyToMode,
2301
+ isDirectMessage
2302
+ });
2303
+ const threadTs = threadContext.incomingThreadTs;
2304
+ const isThreadReply = threadContext.isThreadReply;
2305
+ const autoThreadId = !isThreadReply && replyToMode === "all" && threadContext.messageTs ? threadContext.messageTs : void 0;
2306
+ const seedCandidateThreadId = threadContext.incomingThreadTs ?? threadContext.messageTs;
2307
+ const routedThreadId = (isDirectMessage ? assistantThreadTs : isRoomish ? isThreadReply && threadTs ? threadTs : void 0 : isThreadReply ? threadTs : autoThreadId) ?? (isRoomish ? !isThreadReply && isRoom && seedTopLevelRoomThread && replyToMode !== "off" && seedCandidateThreadId ? seedCandidateThreadId : void 0 : void 0);
2308
+ const baseConversationId = resolveSlackBaseConversationId({
2309
+ message,
2310
+ isDirectMessage
2311
+ });
2312
+ const runtimeBindingThreadId = routedThreadId ?? (isDirectMessage && isThreadReply ? threadTs : void 0);
2313
+ const boundThreadRoute = runtimeBindingThreadId ? resolveRuntimeConversationBindingRoute({
2314
+ route,
2315
+ conversation: {
2316
+ channel: "slack",
2317
+ accountId: account.accountId,
2318
+ conversationId: runtimeBindingThreadId,
2319
+ parentConversationId: baseConversationId
2320
+ }
2321
+ }) : null;
2322
+ const runtimeRoute = boundThreadRoute?.boundSessionKey || boundThreadRoute?.bindingRecord ? boundThreadRoute : resolveRuntimeConversationBindingRoute({
2323
+ route,
2324
+ conversation: {
2325
+ channel: "slack",
2326
+ accountId: account.accountId,
2327
+ conversationId: baseConversationId
2328
+ }
2329
+ });
2330
+ let configuredBinding = null;
2331
+ let configuredBindingSessionKey = "";
2332
+ if (runtimeRoute.boundSessionKey || runtimeRoute.bindingRecord) route = runtimeRoute.route;
2333
+ else {
2334
+ const configuredRoute = resolveConfiguredBindingRoute({
2335
+ cfg: ctx.cfg,
2336
+ route,
2337
+ conversation: {
2338
+ channel: "slack",
2339
+ accountId: account.accountId,
2340
+ conversationId: baseConversationId
2341
+ }
2342
+ });
2343
+ configuredBinding = configuredRoute.bindingResolution;
2344
+ configuredBindingSessionKey = configuredRoute.boundSessionKey ?? "";
2345
+ route = configuredRoute.route;
2346
+ }
2347
+ const threadKeys = runtimeRoute.boundSessionKey || configuredBindingSessionKey ? {
2348
+ sessionKey: route.sessionKey,
2349
+ parentSessionKey: void 0
2350
+ } : resolveThreadSessionKeys({
2351
+ baseSessionKey: route.sessionKey,
2352
+ threadId: routedThreadId,
2353
+ parentSessionKey: routedThreadId && ctx.threadInheritParent ? route.sessionKey : void 0
2354
+ });
2355
+ const sessionKey = threadKeys.sessionKey;
2356
+ const historyKey = isThreadReply && ctx.threadHistoryScope === "thread" ? sessionKey : message.channel;
2357
+ return {
2358
+ route,
2359
+ runtimeBinding: runtimeRoute.bindingRecord,
2360
+ runtimeBoundSessionKey: runtimeRoute.boundSessionKey,
2361
+ configuredBinding,
2362
+ configuredBindingSessionKey,
2363
+ chatType,
2364
+ replyToMode,
2365
+ threadContext,
2366
+ threadTs,
2367
+ isThreadReply,
2368
+ threadKeys,
2369
+ sessionKey,
2370
+ historyKey
2371
+ };
2372
+ }
2373
+ //#endregion
2374
+ //#region extensions/slack/src/monitor/message-handler/prepare-thread-context-root.ts
2375
+ function isSlackThreadAuthorCurrentBot(params) {
2376
+ const { identity, author } = params;
2377
+ if (identity.botUserId && author.userId && author.userId === identity.botUserId) return true;
2378
+ if (identity.botId && author.botId && author.botId === identity.botId) return true;
2379
+ return false;
2380
+ }
2381
+ function resolveSlackThreadHistoryFilterPolicy(params) {
2382
+ if (!params.includeBotStarterAsRootContext || !params.starterTs) return {};
2383
+ return { retainCurrentBotRootTs: params.starterTs };
2384
+ }
2385
+ function applySlackThreadHistoryFilterPolicy(params) {
2386
+ const kept = [];
2387
+ let omittedCurrentBot = 0;
2388
+ for (const entry of params.history) {
2389
+ if (!isSlackThreadAuthorCurrentBot({
2390
+ identity: params.identity,
2391
+ author: entry
2392
+ })) {
2393
+ kept.push(entry);
2394
+ continue;
2395
+ }
2396
+ if (params.policy.retainCurrentBotRootTs && entry.ts === params.policy.retainCurrentBotRootTs) kept.push(entry);
2397
+ else omittedCurrentBot += 1;
2398
+ }
2399
+ return {
2400
+ kept,
2401
+ omittedCurrentBot
2402
+ };
2403
+ }
2404
+ function shouldIncludeBotThreadStarterContext(params) {
2405
+ if (!params.hasStarterText) return false;
2406
+ return params.starterIsCurrentBot && params.isNewThreadSession;
2407
+ }
2408
+ function ensureSlackThreadHistoryHasBotRoot(params) {
2409
+ if (!params.includeBotStarterAsRootContext || !params.threadStarter?.text) return params.history;
2410
+ if (params.history.some((entry) => entry.ts === params.threadStarter?.ts)) return params.history;
2411
+ return [params.threadStarter, ...params.history];
2412
+ }
2413
+ function formatSlackBotStarterThreadLabel(params) {
2414
+ const base = `Slack thread ${params.roomLabel}`;
2415
+ if (!params.starterText) return base;
2416
+ const snippet = formatSlackThreadLabelSnippet(params.starterText).trim();
2417
+ if (!snippet) return base;
2418
+ return `${base} (assistant root): ${snippet}`;
2419
+ }
2420
+ function formatSlackThreadLabelSnippet(text) {
2421
+ return truncateUtf16Safe(text.replace(/\s+/g, " "), 80);
2422
+ }
2423
+ //#endregion
2424
+ //#region extensions/slack/src/monitor/message-handler/prepare-thread-context.ts
2425
+ const loadSlackMediaModule = createLazyRuntimeModule(() => import("./actions-2VEX4Wdz.mjs").then((n) => n.g));
2426
+ const SLACK_THREAD_CONTEXT_USER_LOOKUP_CONCURRENCY = 4;
2427
+ function resolveSlackThreadSessionFreshness(params) {
2428
+ return params.ctx.channelRuntime?.session?.resolveEntryResetFreshness?.({
2429
+ storePath: params.storePath,
2430
+ sessionKey: params.sessionKey,
2431
+ sessionCfg: params.ctx.cfg.session,
2432
+ resetType: "thread",
2433
+ resetOverride: resolveChannelResetConfig({
2434
+ sessionCfg: params.ctx.cfg.session,
2435
+ channel: "slack"
2436
+ })
2437
+ });
2438
+ }
2439
+ function isSlackThreadContextSenderAllowed(params) {
2440
+ if (params.allowFromLower.length === 0 || params.botId) return true;
2441
+ if (!params.userId) return false;
2442
+ return resolveSlackAllowListMatch({
2443
+ allowList: params.allowFromLower,
2444
+ id: params.userId,
2445
+ name: params.userName,
2446
+ allowNameMatching: params.allowNameMatching
2447
+ }).allowed;
2448
+ }
2449
+ async function resolveSlackThreadUserMap(params) {
2450
+ const uniqueUserIds = [];
2451
+ const seen = /* @__PURE__ */ new Set();
2452
+ for (const item of params.messages) {
2453
+ if (!item.userId || seen.has(item.userId)) continue;
2454
+ seen.add(item.userId);
2455
+ uniqueUserIds.push(item.userId);
2456
+ }
2457
+ const userMap = /* @__PURE__ */ new Map();
2458
+ if (uniqueUserIds.length === 0) return userMap;
2459
+ const { results } = await runTasksWithConcurrency({
2460
+ tasks: uniqueUserIds.map((id) => async () => {
2461
+ const user = await params.ctx.resolveUserName(id);
2462
+ return user ? {
2463
+ id,
2464
+ user
2465
+ } : null;
2466
+ }),
2467
+ limit: SLACK_THREAD_CONTEXT_USER_LOOKUP_CONCURRENCY
2468
+ });
2469
+ for (const result of results) if (result) userMap.set(result.id, result.user);
2470
+ return userMap;
2471
+ }
2472
+ async function resolveSlackThreadContextData(params) {
2473
+ const botIdentity = {
2474
+ botUserId: params.ctx.botUserId,
2475
+ botId: params.ctx.botId
2476
+ };
2477
+ const isCurrentBotAuthor = (author) => isSlackThreadAuthorCurrentBot({
2478
+ identity: botIdentity,
2479
+ author
2480
+ });
2481
+ let threadStarterBody;
2482
+ let threadHistoryBody;
2483
+ let threadLabel;
2484
+ let threadStarterMedia = null;
2485
+ const threadSessionFreshness = params.isThreadReply && params.threadTs ? resolveSlackThreadSessionFreshness({
2486
+ ctx: params.ctx,
2487
+ storePath: params.storePath,
2488
+ sessionKey: params.sessionKey
2489
+ }) : void 0;
2490
+ const threadSessionPreviousTimestamp = params.isThreadReply && params.threadTs && !threadSessionFreshness ? readSessionUpdatedAt({
2491
+ storePath: params.storePath,
2492
+ sessionKey: params.sessionKey
2493
+ }) : void 0;
2494
+ const shouldSeedInitialThreadContext = Boolean(params.isThreadReply && params.threadTs && (threadSessionFreshness ? threadSessionFreshness.state !== "fresh" : threadSessionPreviousTimestamp === void 0));
2495
+ const shouldLoadInitialThreadHistory = shouldSeedInitialThreadContext || params.forceInitialHistory === true;
2496
+ if (!params.isThreadReply || !params.threadTs) return {
2497
+ threadStarterBody,
2498
+ threadHistoryBody,
2499
+ shouldSeedInitialThreadContext,
2500
+ threadLabel,
2501
+ threadStarterMedia
2502
+ };
2503
+ const starter = params.threadStarter;
2504
+ const starterSenderName = params.allowNameMatching && params.allowFromLower.length > 0 && starter?.userId ? (await params.ctx.resolveUserName(starter.userId))?.name : void 0;
2505
+ const starterIsCurrentBot = Boolean(starter && isCurrentBotAuthor({
2506
+ userId: starter.userId,
2507
+ botId: starter.botId
2508
+ }));
2509
+ const starterAllowed = !starter || !starterIsCurrentBot && isSlackThreadContextSenderAllowed({
2510
+ allowFromLower: params.allowFromLower,
2511
+ allowNameMatching: params.allowNameMatching,
2512
+ userId: starter.userId,
2513
+ userName: starterSenderName,
2514
+ botId: starter.botId
2515
+ });
2516
+ const includeStarterContext = !starter || !starterIsCurrentBot && shouldIncludeSupplementalContext({
2517
+ mode: params.contextVisibilityMode,
2518
+ kind: "thread",
2519
+ senderAllowed: starterAllowed
2520
+ });
2521
+ if (starter?.text && includeStarterContext) {
2522
+ threadStarterBody = starter.text;
2523
+ const snippet = formatSlackThreadLabelSnippet(starter.text);
2524
+ threadLabel = `Slack thread ${params.roomLabel}${snippet ? `: ${snippet}` : ""}`;
2525
+ if (shouldSeedInitialThreadContext && !params.effectiveDirectMedia && starter.files && starter.files.length > 0) {
2526
+ const { resolveSlackMedia } = await loadSlackMediaModule();
2527
+ threadStarterMedia = await resolveSlackMedia({
2528
+ files: starter.files,
2529
+ client: params.ctx.app.client,
2530
+ token: params.ctx.botToken,
2531
+ maxBytes: params.ctx.mediaMaxBytes
2532
+ });
2533
+ if (threadStarterMedia) {
2534
+ const starterPlaceholders = threadStarterMedia.map((item) => item.placeholder).join(", ");
2535
+ logVerbose(`slack: hydrated thread starter file ${starterPlaceholders} from root message`);
2536
+ }
2537
+ }
2538
+ } else threadLabel = `Slack thread ${params.roomLabel}`;
2539
+ const includeBotStarterAsRootContext = shouldIncludeBotThreadStarterContext({
2540
+ starterIsCurrentBot,
2541
+ isNewThreadSession: shouldSeedInitialThreadContext,
2542
+ hasStarterText: Boolean(starter?.text)
2543
+ });
2544
+ if (starter?.text && starterIsCurrentBot && !includeBotStarterAsRootContext) logVerbose("slack: omitted current-bot thread starter from context");
2545
+ else if (starter?.text && !includeStarterContext && !starterIsCurrentBot) logVerbose(`slack: omitted thread starter from context (mode=${params.contextVisibilityMode}, sender_allowed=${starterAllowed ? "yes" : "no"})`);
2546
+ else if (includeBotStarterAsRootContext) {
2547
+ threadLabel = formatSlackBotStarterThreadLabel({
2548
+ roomLabel: params.roomLabel,
2549
+ starterText: starter?.text
2550
+ });
2551
+ logVerbose("slack: retained current-bot thread starter as assistant root context");
2552
+ }
2553
+ const threadInitialHistoryLimit = params.account.config?.thread?.initialHistoryLimit ?? 20;
2554
+ if (threadInitialHistoryLimit > 0 && shouldLoadInitialThreadHistory) {
2555
+ const currentBotRootTs = starter?.ts ?? params.threadTs;
2556
+ const threadHistoryWithBotRoot = ensureSlackThreadHistoryHasBotRoot({
2557
+ history: await resolveSlackThreadHistory({
2558
+ channelId: params.message.channel,
2559
+ threadTs: params.threadTs,
2560
+ client: params.ctx.app.client,
2561
+ currentMessageTs: params.message.ts,
2562
+ limit: threadInitialHistoryLimit
2563
+ }),
2564
+ includeBotStarterAsRootContext,
2565
+ threadStarter: starter ? {
2566
+ ...starter,
2567
+ ts: currentBotRootTs
2568
+ } : null
2569
+ });
2570
+ if (threadHistoryWithBotRoot.length > 0) {
2571
+ const { kept: threadHistoryWithoutCurrentBot, omittedCurrentBot: omittedCurrentBotHistoryCount } = applySlackThreadHistoryFilterPolicy({
2572
+ history: threadHistoryWithBotRoot,
2573
+ policy: resolveSlackThreadHistoryFilterPolicy({
2574
+ includeBotStarterAsRootContext,
2575
+ starterTs: currentBotRootTs
2576
+ }),
2577
+ identity: botIdentity
2578
+ });
2579
+ const userMapForFilter = params.contextVisibilityMode !== "all" && params.allowNameMatching && params.allowFromLower.length > 0 ? await resolveSlackThreadUserMap({
2580
+ ctx: params.ctx,
2581
+ messages: threadHistoryWithoutCurrentBot
2582
+ }) : /* @__PURE__ */ new Map();
2583
+ const { items: filteredThreadHistory, omitted: omittedHistoryCount } = params.contextVisibilityMode === "all" ? {
2584
+ items: threadHistoryWithoutCurrentBot,
2585
+ omitted: 0
2586
+ } : filterSupplementalContextItems({
2587
+ items: threadHistoryWithoutCurrentBot,
2588
+ mode: params.contextVisibilityMode,
2589
+ kind: "thread",
2590
+ isSenderAllowed: (historyMsg) => {
2591
+ if (isCurrentBotAuthor({
2592
+ userId: historyMsg.userId,
2593
+ botId: historyMsg.botId
2594
+ })) return true;
2595
+ const msgUser = historyMsg.userId ? userMapForFilter.get(historyMsg.userId) : null;
2596
+ return isSlackThreadContextSenderAllowed({
2597
+ allowFromLower: params.allowFromLower,
2598
+ allowNameMatching: params.allowNameMatching,
2599
+ userId: historyMsg.userId,
2600
+ userName: msgUser?.name,
2601
+ botId: historyMsg.botId
2602
+ });
2603
+ }
2604
+ });
2605
+ const userMap = await resolveSlackThreadUserMap({
2606
+ ctx: params.ctx,
2607
+ messages: filteredThreadHistory
2608
+ });
2609
+ if (omittedHistoryCount > 0 || omittedCurrentBotHistoryCount > 0) logVerbose(`slack: omitted ${omittedHistoryCount + omittedCurrentBotHistoryCount} thread message(s) from context (mode=${params.contextVisibilityMode})`);
2610
+ const historyParts = [];
2611
+ for (const historyMsg of filteredThreadHistory) {
2612
+ const msgUser = historyMsg.userId ? userMap.get(historyMsg.userId) : null;
2613
+ const isOtherBot = Boolean(historyMsg.botId) && historyMsg.botId !== params.ctx.botId;
2614
+ const isCurrentBot = isCurrentBotAuthor({
2615
+ userId: historyMsg.userId,
2616
+ botId: historyMsg.botId
2617
+ });
2618
+ const role = isCurrentBot || isOtherBot || Boolean(historyMsg.botId) ? "assistant" : "user";
2619
+ const msgSenderName = isCurrentBot ? "Bot (this assistant)" : msgUser?.name ?? (historyMsg.botId ? `Bot (${historyMsg.botId})` : "Unknown");
2620
+ const msgWithId = `${historyMsg.text}\n[slack message id: ${historyMsg.ts ?? "unknown"} channel: ${params.message.channel}]`;
2621
+ historyParts.push(formatInboundEnvelope({
2622
+ channel: "Slack",
2623
+ from: `${msgSenderName} (${role})`,
2624
+ timestamp: resolveSlackTimestampMs(historyMsg.ts),
2625
+ body: msgWithId,
2626
+ chatType: "channel",
2627
+ envelope: params.envelopeOptions
2628
+ }));
2629
+ }
2630
+ if (historyParts.length > 0) {
2631
+ threadHistoryBody = historyParts.join("\n\n");
2632
+ logVerbose(`slack: populated thread history with ${filteredThreadHistory.length} messages for new session`);
2633
+ }
2634
+ }
2635
+ }
2636
+ return {
2637
+ threadStarterBody,
2638
+ threadHistoryBody,
2639
+ shouldSeedInitialThreadContext,
2640
+ threadLabel,
2641
+ threadStarterMedia
2642
+ };
2643
+ }
2644
+ //#endregion
2645
+ //#region extensions/slack/src/monitor/message-handler/subteam-mentions.ts
2646
+ const SUBTEAM_MENTION_RE = /<!subteam\^([A-Z0-9]+)(?:\|[^>]*)?>/gi;
2647
+ const SUBTEAM_MEMBER_CACHE_TTL_MS = 3e5;
2648
+ let subteamMemberCache = /* @__PURE__ */ new WeakMap();
2649
+ function normalizeSlackId(value) {
2650
+ return typeof value === "string" && value.trim() ? value.trim().toUpperCase() : void 0;
2651
+ }
2652
+ function extractSlackSubteamMentionIds(text) {
2653
+ if (!text) return [];
2654
+ const ids = /* @__PURE__ */ new Set();
2655
+ for (const match of text.matchAll(SUBTEAM_MENTION_RE)) {
2656
+ const id = normalizeSlackId(match[1]);
2657
+ if (id) ids.add(id);
2658
+ }
2659
+ return [...ids];
2660
+ }
2661
+ async function readSlackSubteamUsers(params) {
2662
+ let bySubteam = subteamMemberCache.get(params.client);
2663
+ if (!bySubteam) {
2664
+ bySubteam = /* @__PURE__ */ new Map();
2665
+ subteamMemberCache.set(params.client, bySubteam);
2666
+ }
2667
+ const cacheKey = `${normalizeSlackId(params.teamId) ?? ""}:${params.subteamId}`;
2668
+ const cached = bySubteam.get(cacheKey);
2669
+ const now = asDateTimestampMs(params.now);
2670
+ if (cached) {
2671
+ if (now !== void 0 && asDateTimestampMs(cached.expiresAt) !== void 0 && cached.expiresAt > now) return cached.users;
2672
+ bySubteam.delete(cacheKey);
2673
+ }
2674
+ try {
2675
+ const response = await params.client.usergroups.users.list({
2676
+ usergroup: params.subteamId,
2677
+ ...params.teamId ? { team_id: params.teamId } : {}
2678
+ });
2679
+ if (!response.ok) {
2680
+ params.log?.(`slack: failed to resolve user-group mention ${params.subteamId}: ${response.error ?? "unknown_error"}`);
2681
+ return /* @__PURE__ */ new Set();
2682
+ }
2683
+ const users = new Set((response.users ?? []).map((userId) => normalizeSlackId(userId)).filter(Boolean));
2684
+ const expiresAt = resolveExpiresAtMsFromDurationMs(SUBTEAM_MEMBER_CACHE_TTL_MS, { nowMs: params.now });
2685
+ if (expiresAt !== void 0) bySubteam.set(cacheKey, {
2686
+ expiresAt,
2687
+ users
2688
+ });
2689
+ return users;
2690
+ } catch (err) {
2691
+ params.log?.(`slack: failed to resolve user-group mention ${params.subteamId}: ${formatErrorMessage(err)}`);
2692
+ return /* @__PURE__ */ new Set();
2693
+ }
2694
+ }
2695
+ async function isSlackSubteamMentionForBot(params) {
2696
+ const botUserId = normalizeSlackId(params.botUserId);
2697
+ if (!botUserId) return false;
2698
+ const subteamIds = extractSlackSubteamMentionIds(params.text);
2699
+ if (subteamIds.length === 0) return false;
2700
+ const now = params.now ?? Date.now();
2701
+ for (const subteamId of subteamIds) if ((await readSlackSubteamUsers({
2702
+ client: params.client,
2703
+ subteamId,
2704
+ teamId: normalizeOptionalString(params.teamId),
2705
+ now,
2706
+ log: params.log
2707
+ })).has(botUserId)) return true;
2708
+ return false;
2709
+ }
2710
+ //#endregion
2711
+ //#region extensions/slack/src/monitor/message-handler/prepare.ts
2712
+ const mentionRegexCache = /* @__PURE__ */ new WeakMap();
2713
+ const SLACK_ANY_MENTION_RE = /<@[^>]+>|<!subteam\^[^>]+>/;
2714
+ const SLACK_USER_MENTION_RE = /<@([^>|]+)(?:\|[^>]+)?>/g;
2715
+ const SLACK_SUBTEAM_MENTION_RE = /<!subteam\^([^>|]+)(?:\|[^>]+)?>/g;
2716
+ const SLACK_SUBTEAM_MENTION_MARKER = "<!subteam^";
2717
+ const SLACK_HISTORY_MEDIA_MAX_ATTACHMENTS = 4;
2718
+ const SLACK_HISTORY_MEDIA_MAX_BYTES = 10485760;
2719
+ const SLACK_HISTORY_MEDIA_IDLE_TIMEOUT_MS = 1e3;
2720
+ const SLACK_HISTORY_MEDIA_TOTAL_TIMEOUT_MS = 3e3;
2721
+ function recordString(record, key) {
2722
+ return normalizeOptionalString(record?.[key]);
2723
+ }
2724
+ function recordNullableString(record, key) {
2725
+ if (!record || !(key in record)) return;
2726
+ if (record[key] === null) return null;
2727
+ return normalizeOptionalString(record[key]);
2728
+ }
2729
+ function mergeSlackAssistantThreadContext(primary, fallback) {
2730
+ if (!primary) return fallback;
2731
+ if (!fallback) return primary;
2732
+ return {
2733
+ assistantChannelId: primary.assistantChannelId || fallback.assistantChannelId,
2734
+ threadTs: primary.threadTs || fallback.threadTs,
2735
+ userId: primary.userId ?? fallback.userId,
2736
+ channelId: primary.channelId ?? fallback.channelId,
2737
+ teamId: primary.teamId ?? fallback.teamId,
2738
+ enterpriseId: primary.enterpriseId !== void 0 ? primary.enterpriseId : fallback.enterpriseId
2739
+ };
2740
+ }
2741
+ function hasSlackAssistantThreadMetadata(context) {
2742
+ return Boolean(context?.channelId || context?.teamId || context?.enterpriseId !== void 0);
2743
+ }
2744
+ function resolveSlackMessageAssistantThreadContext(message) {
2745
+ const thread = asOptionalRecord(message.assistant_thread);
2746
+ if (!thread) return;
2747
+ const context = asOptionalRecord(thread.context);
2748
+ const assistantChannelId = recordString(thread, "channel_id") ?? message.channel;
2749
+ const threadTs = recordString(thread, "thread_ts") ?? message.thread_ts ?? message.ts;
2750
+ if (!assistantChannelId || !threadTs) return;
2751
+ return {
2752
+ assistantChannelId,
2753
+ threadTs,
2754
+ userId: recordString(thread, "user_id") ?? message.user,
2755
+ channelId: recordString(context, "channel_id"),
2756
+ teamId: recordString(context, "team_id"),
2757
+ enterpriseId: recordNullableString(context, "enterprise_id")
2758
+ };
2759
+ }
2760
+ async function restoreSlackAssistantThreadContextFromMetadata(params) {
2761
+ const threadTs = params.message.thread_ts;
2762
+ const parentUserId = params.message.parent_user_id?.trim();
2763
+ if (!params.message.channel || !threadTs || !parentUserId || parentUserId !== params.ctx.botUserId && parentUserId !== params.ctx.botId) return;
2764
+ try {
2765
+ const response = await params.ctx.app.client.conversations.replies({
2766
+ channel: params.message.channel,
2767
+ ts: threadTs,
2768
+ oldest: threadTs,
2769
+ include_all_metadata: true,
2770
+ limit: 4
2771
+ });
2772
+ for (const message of response.messages ?? []) {
2773
+ const context = parseSlackAssistantThreadMetadata(message.metadata);
2774
+ if (!context) continue;
2775
+ return {
2776
+ assistantChannelId: params.message.channel,
2777
+ threadTs,
2778
+ userId: params.message.user,
2779
+ channelId: context.channelId,
2780
+ teamId: context.teamId,
2781
+ enterpriseId: context.enterpriseId
2782
+ };
2783
+ }
2784
+ } catch (err) {
2785
+ logVerbose(`slack assistant context restore failed channel=${params.message.channel} ts=${threadTs}: ${formatErrorMessage(err)}`);
2786
+ }
2787
+ }
2788
+ function resolveCachedMentionRegexes(ctx, agentId, options) {
2789
+ const key = [
2790
+ normalizeOptionalString(agentId) ?? "__default__",
2791
+ normalizeOptionalString(options?.provider),
2792
+ normalizeOptionalString(options?.conversationId ?? void 0),
2793
+ options?.providerPolicy ? JSON.stringify(options.providerPolicy) : ""
2794
+ ].join("");
2795
+ let byAgent = mentionRegexCache.get(ctx);
2796
+ if (!byAgent) {
2797
+ byAgent = /* @__PURE__ */ new Map();
2798
+ mentionRegexCache.set(ctx, byAgent);
2799
+ }
2800
+ const cached = byAgent.get(key);
2801
+ if (cached) return cached;
2802
+ const built = buildMentionRegexes(ctx.cfg, agentId, options);
2803
+ byAgent.set(key, built);
2804
+ return built;
2805
+ }
2806
+ function isSlackImageFileCandidate(file) {
2807
+ if ((file.mimetype?.split(";")[0]?.trim().toLowerCase())?.startsWith("image/")) return true;
2808
+ return Boolean(mimeTypeFromFilePath(file.name)?.startsWith("image/"));
2809
+ }
2810
+ function sliceSlackImageFileCandidates(files, limit) {
2811
+ if (limit <= 0 || !files?.length) return [];
2812
+ return files.filter(isSlackImageFileCandidate).slice(0, limit);
2813
+ }
2814
+ function sliceSlackHistoryAttachmentCandidates(attachments, limit) {
2815
+ if (limit <= 0 || !attachments?.length) return [];
2816
+ const out = [];
2817
+ let remaining = limit;
2818
+ for (const attachment of attachments) {
2819
+ if (attachment.is_share !== true) continue;
2820
+ const hasImageUrl = Boolean(normalizeOptionalString(attachment.image_url));
2821
+ const files = sliceSlackImageFileCandidates(attachment.files, remaining - (hasImageUrl ? 1 : 0));
2822
+ if (!hasImageUrl && files.length === 0) continue;
2823
+ out.push({
2824
+ ...attachment,
2825
+ files
2826
+ });
2827
+ remaining -= (hasImageUrl ? 1 : 0) + files.length;
2828
+ if (remaining <= 0) break;
2829
+ }
2830
+ return out;
2831
+ }
2832
+ function buildSlackHistoryMediaCandidateMessage(message) {
2833
+ const files = sliceSlackImageFileCandidates(message.files, SLACK_HISTORY_MEDIA_MAX_ATTACHMENTS);
2834
+ const attachments = sliceSlackHistoryAttachmentCandidates(message.attachments, Math.max(0, SLACK_HISTORY_MEDIA_MAX_ATTACHMENTS - files.length));
2835
+ if (files.length === 0 && attachments.length === 0) return null;
2836
+ return {
2837
+ ...message,
2838
+ files,
2839
+ attachments
2840
+ };
2841
+ }
2842
+ async function resolveSlackHistoryMediaForPendingRecord(params) {
2843
+ const mediaMessage = buildSlackHistoryMediaCandidateMessage(params.message);
2844
+ if (!mediaMessage) return [];
2845
+ const content = await resolveSlackMessageContent({
2846
+ message: mediaMessage,
2847
+ isThreadReply: params.isThreadReply,
2848
+ threadStarter: params.threadStarter,
2849
+ isBotMessage: params.isBotMessage,
2850
+ client: params.ctx.app.client,
2851
+ botToken: params.ctx.botToken,
2852
+ mediaMaxBytes: Math.min(params.ctx.mediaMaxBytes, SLACK_HISTORY_MEDIA_MAX_BYTES),
2853
+ mediaReadIdleTimeoutMs: SLACK_HISTORY_MEDIA_IDLE_TIMEOUT_MS,
2854
+ mediaTotalTimeoutMs: SLACK_HISTORY_MEDIA_TOTAL_TIMEOUT_MS
2855
+ });
2856
+ return toInboundMediaFacts(content?.effectiveDirectMedia, {
2857
+ kind: "image",
2858
+ messageId: params.message.ts
2859
+ });
2860
+ }
2861
+ function collectUniqueSlackMentionIds(text, regex) {
2862
+ const ids = [];
2863
+ regex.lastIndex = 0;
2864
+ for (const match of text.matchAll(regex)) {
2865
+ const id = normalizeSlackId(match[1]);
2866
+ if (id && !ids.includes(id)) ids.push(id);
2867
+ }
2868
+ return ids;
2869
+ }
2870
+ function collectSlackMentionMetadata(text) {
2871
+ return {
2872
+ mentionedUserIds: collectUniqueSlackMentionIds(text, SLACK_USER_MENTION_RE),
2873
+ mentionedSubteamIds: collectUniqueSlackMentionIds(text, SLACK_SUBTEAM_MENTION_RE),
2874
+ hasAnyMention: SLACK_ANY_MENTION_RE.test(text),
2875
+ hasSubteamMention: text.includes(SLACK_SUBTEAM_MENTION_MARKER)
2876
+ };
2877
+ }
2878
+ async function resolveSlackExplicitMentionState(params) {
2879
+ const normalizedBotUserId = normalizeSlackId(params.ctx.botUserId);
2880
+ const explicitlyMentionedBotUser = Boolean(normalizedBotUserId && params.mentionedUserIds.includes(normalizedBotUserId));
2881
+ const explicitlyMentionedBotSubteam = Boolean(params.ctx.botUserId && params.hasSubteamMention) && await isSlackSubteamMentionForBot({
2882
+ client: params.ctx.app.client,
2883
+ text: params.messageText,
2884
+ botUserId: params.ctx.botUserId,
2885
+ teamId: params.ctx.teamId,
2886
+ log: logVerbose
2887
+ });
2888
+ return {
2889
+ explicitlyMentionedBotUser,
2890
+ explicitlyMentionedBotSubteam,
2891
+ explicitlyMentioned: explicitlyMentionedBotUser || explicitlyMentionedBotSubteam || params.source === "app_mention"
2892
+ };
2893
+ }
2894
+ function resolveSlackMentionSource(params) {
2895
+ if (params.explicitBotMention) return "explicit_bot";
2896
+ if (params.explicitSubteamMention) return "subteam";
2897
+ if (params.shouldBypassMention) return "command_bypass";
2898
+ if (params.wasMentioned) return "mention_pattern";
2899
+ if (params.matchedImplicitMentionKinds.length > 0) return "implicit_thread";
2900
+ return "none";
2901
+ }
2902
+ function buildSlackMentionContextPayload(params) {
2903
+ if (!params.isRoomish) return {};
2904
+ return {
2905
+ WasMentioned: params.effectiveWasMentioned,
2906
+ ExplicitlyMentionedBot: params.explicitlyMentioned,
2907
+ MentionedUserIds: params.mentionedUserIds.length > 0 ? [...params.mentionedUserIds] : void 0,
2908
+ MentionedSubteamIds: params.mentionedSubteamIds.length > 0 ? [...params.mentionedSubteamIds] : void 0,
2909
+ ImplicitMentionKinds: params.matchedImplicitMentionKinds.length > 0 ? [...params.matchedImplicitMentionKinds] : void 0,
2910
+ MentionSource: params.mentionSource
2911
+ };
2912
+ }
2913
+ async function resolveSlackConversationContext(params) {
2914
+ const { ctx, account, message } = params;
2915
+ const cfg = ctx.cfg;
2916
+ let channelInfo = {};
2917
+ let resolvedChannelType = normalizeSlackChannelType(message.channel_type, message.channel);
2918
+ if (resolvedChannelType !== "im" && (!message.channel_type || message.channel_type !== "im")) {
2919
+ channelInfo = await ctx.resolveChannelName(message.channel);
2920
+ resolvedChannelType = normalizeSlackChannelType(message.channel_type ?? channelInfo.type, message.channel);
2921
+ }
2922
+ const channelName = channelInfo?.name;
2923
+ const isDirectMessage = resolvedChannelType === "im";
2924
+ const isGroupDm = resolvedChannelType === "mpim";
2925
+ const isRoom = resolvedChannelType === "channel" || resolvedChannelType === "group";
2926
+ const isRoomish = isRoom || isGroupDm;
2927
+ const channelConfig = isRoom ? resolveSlackChannelConfig({
2928
+ channelId: message.channel,
2929
+ channelName,
2930
+ channels: ctx.channelsConfig,
2931
+ channelKeys: ctx.channelsConfigKeys,
2932
+ defaultRequireMention: ctx.defaultRequireMention,
2933
+ allowNameMatching: ctx.allowNameMatching
2934
+ }) : null;
2935
+ const allowBotsSetting = channelConfig?.allowBots ?? account.config?.allowBots ?? cfg.channels?.slack?.allowBots ?? false;
2936
+ return {
2937
+ channelInfo,
2938
+ channelName,
2939
+ resolvedChannelType,
2940
+ isDirectMessage,
2941
+ isGroupDm,
2942
+ isRoom,
2943
+ isRoomish,
2944
+ channelConfig,
2945
+ allowBotsMode: allowBotsSetting === "mentions" ? "mentions" : allowBotsSetting ? "all" : "off",
2946
+ isBotMessage: Boolean(message.bot_id)
2947
+ };
2948
+ }
2949
+ async function authorizeSlackInboundMessage(params) {
2950
+ const { ctx, account, message, conversation } = params;
2951
+ const { isDirectMessage, channelName, resolvedChannelType, isBotMessage, allowBotsMode } = conversation;
2952
+ if (isBotMessage) {
2953
+ if (message.user && ctx.botUserId && message.user === ctx.botUserId) return null;
2954
+ if (allowBotsMode === "off") {
2955
+ logVerbose(`slack: drop bot message ${message.bot_id ?? "unknown"} (allowBots=false)`);
2956
+ return null;
2957
+ }
2958
+ }
2959
+ if (isDirectMessage && !message.user) {
2960
+ logVerbose("slack: drop dm message (missing user id)");
2961
+ return null;
2962
+ }
2963
+ const senderId = message.user ?? (isBotMessage ? message.bot_id : void 0);
2964
+ if (!senderId) {
2965
+ logVerbose("slack: drop message (missing sender id)");
2966
+ return null;
2967
+ }
2968
+ if (!ctx.isChannelAllowed({
2969
+ channelId: message.channel,
2970
+ channelName,
2971
+ channelType: resolvedChannelType
2972
+ })) {
2973
+ logVerbose("slack: drop message (channel not allowed)");
2974
+ return null;
2975
+ }
2976
+ const allowFromLower = await resolveSlackEffectiveAllowFrom(ctx, { includePairingStore: isDirectMessage });
2977
+ if (isDirectMessage) {
2978
+ const directUserId = message.user;
2979
+ if (!directUserId) {
2980
+ logVerbose("slack: drop dm message (missing user id)");
2981
+ return null;
2982
+ }
2983
+ if (!await authorizeSlackDirectMessage({
2984
+ ctx,
2985
+ accountId: account.accountId,
2986
+ senderId: directUserId,
2987
+ allowFromLower,
2988
+ resolveSenderName: ctx.resolveUserName,
2989
+ sendPairingReply: async (text) => {
2990
+ await sendMessageSlack(message.channel, text, {
2991
+ cfg: ctx.cfg,
2992
+ token: ctx.botToken,
2993
+ client: ctx.app.client,
2994
+ accountId: account.accountId
2995
+ });
2996
+ },
2997
+ onDisabled: () => {
2998
+ logVerbose("slack: drop dm (dms disabled)");
2999
+ },
3000
+ onUnauthorized: ({ allowMatchMeta }) => {
3001
+ logVerbose(`Blocked unauthorized slack sender ${message.user} (dmPolicy=${ctx.dmPolicy}, ${allowMatchMeta})`);
3002
+ },
3003
+ log: logVerbose
3004
+ })) return null;
3005
+ }
3006
+ return {
3007
+ senderId,
3008
+ allowFromLower
3009
+ };
3010
+ }
3011
+ async function prepareSlackMessage(params) {
3012
+ const { ctx, account, message, opts } = params;
3013
+ const cfg = ctx.cfg;
3014
+ const conversation = await resolveSlackConversationContext({
3015
+ ctx,
3016
+ account,
3017
+ message
3018
+ });
3019
+ const { channelInfo, channelName, isDirectMessage, isGroupDm, isRoom, isRoomish, channelConfig, allowBotsMode, isBotMessage } = conversation;
3020
+ const authorization = await authorizeSlackInboundMessage({
3021
+ ctx,
3022
+ account,
3023
+ message,
3024
+ conversation
3025
+ });
3026
+ if (!authorization) return null;
3027
+ const { senderId, allowFromLower } = authorization;
3028
+ const messageText = message.text ?? "";
3029
+ let resolvedSenderName = normalizeOptionalString(message.username);
3030
+ const resolveSenderName = async () => {
3031
+ if (resolvedSenderName) return resolvedSenderName;
3032
+ if (message.user) {
3033
+ const sender = await ctx.resolveUserName(message.user);
3034
+ const normalized = normalizeOptionalString(sender?.name);
3035
+ if (normalized) {
3036
+ resolvedSenderName = normalized;
3037
+ return resolvedSenderName;
3038
+ }
3039
+ }
3040
+ resolvedSenderName = message.user ?? message.bot_id ?? "unknown";
3041
+ return resolvedSenderName;
3042
+ };
3043
+ const mentionMetadata = collectSlackMentionMetadata(messageText);
3044
+ const { mentionedUserIds, mentionedSubteamIds, hasAnyMention } = mentionMetadata;
3045
+ const messageAssistantThreadContext = resolveSlackMessageAssistantThreadContext(message);
3046
+ const assistantContextLookupChannelId = messageAssistantThreadContext?.assistantChannelId ?? message.channel;
3047
+ const assistantContextLookupThreadTs = messageAssistantThreadContext?.threadTs ?? message.thread_ts ?? message.ts;
3048
+ const cachedAssistantThreadContext = isDirectMessage ? ctx.getSlackAssistantThreadContext(assistantContextLookupChannelId, assistantContextLookupThreadTs) : void 0;
3049
+ const restoredAssistantThreadContextPromise = isDirectMessage && !cachedAssistantThreadContext && !hasSlackAssistantThreadMetadata(messageAssistantThreadContext) ? restoreSlackAssistantThreadContextFromMetadata({
3050
+ ctx,
3051
+ message
3052
+ }) : Promise.resolve(void 0);
3053
+ const { explicitlyMentionedBotUser, explicitlyMentionedBotSubteam, explicitlyMentioned } = await resolveSlackExplicitMentionState({
3054
+ ctx,
3055
+ messageText,
3056
+ mentionedUserIds,
3057
+ hasSubteamMention: mentionMetadata.hasSubteamMention,
3058
+ source: opts.source
3059
+ });
3060
+ const channelRequireMention = channelConfig?.requireMention ?? ctx.defaultRequireMention ?? true;
3061
+ const channelChatType = isDirectMessage ? "direct" : isGroupDm ? "group" : "channel";
3062
+ const restoredAssistantThreadContext = await restoredAssistantThreadContextPromise;
3063
+ const assistantThreadContext = mergeSlackAssistantThreadContext(messageAssistantThreadContext, cachedAssistantThreadContext ?? restoredAssistantThreadContext);
3064
+ const assistantThreadContextToCache = messageAssistantThreadContext || restoredAssistantThreadContext ? assistantThreadContext : void 0;
3065
+ if (assistantThreadContextToCache) ctx.saveSlackAssistantThreadContext(assistantThreadContextToCache);
3066
+ const channelReplyToMode = channelConfig?.replyToMode ?? resolveSlackReplyToMode(account, channelChatType);
3067
+ const willImplicitlyThreadReply = isRoom && !channelRequireMention && channelReplyToMode !== "off";
3068
+ const seedTopLevelRoomThreadBySource = opts.source === "app_mention" || opts.wasMentioned === true || explicitlyMentioned || willImplicitlyThreadReply;
3069
+ let routing = resolveSlackRoutingContext({
3070
+ ctx,
3071
+ account,
3072
+ message,
3073
+ isDirectMessage,
3074
+ isGroupDm,
3075
+ isRoom,
3076
+ isRoomish,
3077
+ channelConfig,
3078
+ seedTopLevelRoomThread: seedTopLevelRoomThreadBySource,
3079
+ assistantThreadTs: assistantThreadContext?.threadTs
3080
+ });
3081
+ const resolveWasMentioned = (mentionRegexes) => opts.wasMentioned ?? (!isDirectMessage && matchesMentionWithExplicit({
3082
+ text: messageText,
3083
+ mentionRegexes,
3084
+ explicit: {
3085
+ hasAnyMention,
3086
+ isExplicitlyMentioned: explicitlyMentioned,
3087
+ canResolveExplicit: Boolean(ctx.botUserId)
3088
+ }
3089
+ }));
3090
+ const buildPolicyMentionRegexes = (agentId) => resolveCachedMentionRegexes(ctx, agentId, {
3091
+ provider: "slack",
3092
+ conversationId: message.channel,
3093
+ providerPolicy: account.config.mentionPatterns
3094
+ });
3095
+ let mentionRegexes = buildPolicyMentionRegexes(routing.route.agentId);
3096
+ let wasMentioned = resolveWasMentioned(mentionRegexes);
3097
+ const hasBoundSession = Boolean(routing.runtimeBoundSessionKey || routing.configuredBindingSessionKey);
3098
+ if (!seedTopLevelRoomThreadBySource && wasMentioned && isRoom && !routing.isThreadReply && !hasBoundSession) {
3099
+ routing = resolveSlackRoutingContext({
3100
+ ctx,
3101
+ account,
3102
+ message,
3103
+ isDirectMessage,
3104
+ isGroupDm,
3105
+ isRoom,
3106
+ isRoomish,
3107
+ channelConfig,
3108
+ seedTopLevelRoomThread: true,
3109
+ assistantThreadTs: assistantThreadContext?.threadTs
3110
+ });
3111
+ mentionRegexes = buildPolicyMentionRegexes(routing.route.agentId);
3112
+ wasMentioned = resolveWasMentioned(mentionRegexes);
3113
+ }
3114
+ const { route, runtimeBinding, configuredBinding, configuredBindingSessionKey, replyToMode, threadContext, threadTs, isThreadReply, threadKeys, sessionKey, historyKey } = routing;
3115
+ const isAssistantThreadMessage = Boolean(isDirectMessage && messageAssistantThreadContext);
3116
+ const forcedAssistantReplyThreadTs = Boolean(assistantThreadContext?.threadTs && (isThreadReply || isAssistantThreadMessage || replyToMode !== "off")) ? assistantThreadContext?.threadTs : void 0;
3117
+ if (runtimeBinding && shouldLogVerbose()) logVerbose(`slack: routed via bound conversation ${runtimeBinding.conversation.conversationId} -> ${runtimeBinding.targetSessionKey}`);
3118
+ if (configuredBinding) {
3119
+ const ensured = await ensureConfiguredBindingRouteReady({
3120
+ cfg,
3121
+ bindingResolution: configuredBinding
3122
+ });
3123
+ if (ensured.ok) {
3124
+ if (shouldLogVerbose()) logVerbose(`slack: using configured ACP binding for ${configuredBinding.record.conversation.conversationId} -> ${configuredBindingSessionKey}`);
3125
+ } else {
3126
+ if (shouldLogVerbose()) logVerbose(`slack: configured ACP binding unavailable for ${configuredBinding.record.conversation.conversationId}: ${ensured.error}`);
3127
+ logInboundDrop({
3128
+ log: logVerbose,
3129
+ channel: "slack",
3130
+ reason: "configured ACP binding unavailable",
3131
+ target: configuredBinding.record.conversation.conversationId
3132
+ });
3133
+ return null;
3134
+ }
3135
+ }
3136
+ const senderNameForAuthPromise = ctx.allowNameMatching ? resolveSenderName().then((name) => ({
3137
+ ok: true,
3138
+ name
3139
+ }), (error) => ({
3140
+ ok: false,
3141
+ error
3142
+ })) : Promise.resolve({
3143
+ ok: true,
3144
+ name: void 0
3145
+ });
3146
+ const directThreadRoutedToDmSession = !assistantThreadContext && isDirectMessage && isThreadReply && threadTs && runtimeBinding?.conversation.conversationId !== threadTs;
3147
+ let implicitMentionKinds = [];
3148
+ if (!isDirectMessage && ctx.botUserId && message.thread_ts && !ctx.threadRequireExplicitMention && !wasMentioned) {
3149
+ const replyToBotKinds = implicitMentionKindWhen("reply_to_bot", message.parent_user_id === ctx.botUserId);
3150
+ implicitMentionKinds = replyToBotKinds.length > 0 ? replyToBotKinds : implicitMentionKindWhen("bot_thread_participant", await hasSlackThreadParticipationWithPersistence({
3151
+ accountId: account.accountId,
3152
+ channelId: message.channel,
3153
+ threadTs: message.thread_ts
3154
+ }));
3155
+ }
3156
+ const recordDroppedHistory = async (reason) => {
3157
+ const pendingText = (message.text ?? "").trim();
3158
+ const historyMediaCandidate = buildSlackHistoryMediaCandidateMessage(message);
3159
+ const fallbackFile = message.files?.length ? `[Slack file: ${formatSlackFileReference(message.files[0])}]` : "";
3160
+ const pendingBody = pendingText || fallbackFile || (!fallbackFile && historyMediaCandidate ? "[Slack media attachment]" : "");
3161
+ const skippedThreadStarter = historyMediaCandidate && isThreadReply && threadTs ? await resolveSlackThreadStarter({
3162
+ channelId: message.channel,
3163
+ threadTs,
3164
+ client: ctx.app.client
3165
+ }) : null;
3166
+ const senderName = pendingBody ? await resolveSenderName() : void 0;
3167
+ await recordDroppedChannelInboundHistory({
3168
+ input: {
3169
+ id: message.ts ?? `${message.channel}:${Date.now()}`,
3170
+ timestamp: resolveSlackTimestampMs(message.ts),
3171
+ rawText: pendingBody,
3172
+ textForAgent: pendingBody,
3173
+ raw: message
3174
+ },
3175
+ admission: {
3176
+ kind: "drop",
3177
+ reason,
3178
+ recordHistory: true
3179
+ },
3180
+ preflight: {
3181
+ message: pendingBody ? {
3182
+ rawBody: pendingBody,
3183
+ body: pendingBody,
3184
+ bodyForAgent: pendingBody,
3185
+ senderLabel: senderName,
3186
+ envelopeFrom: senderName
3187
+ } : void 0,
3188
+ history: {
3189
+ key: historyKey,
3190
+ historyMap: ctx.channelHistories,
3191
+ limit: ctx.historyLimit,
3192
+ recordOnDrop: true,
3193
+ mediaLimit: SLACK_HISTORY_MEDIA_MAX_ATTACHMENTS,
3194
+ shouldRecord: opts.shouldRecordDroppedHistory
3195
+ },
3196
+ media: () => resolveSlackHistoryMediaForPendingRecord({
3197
+ ctx,
3198
+ message,
3199
+ isThreadReply,
3200
+ threadStarter: skippedThreadStarter,
3201
+ isBotMessage
3202
+ })
3203
+ }
3204
+ });
3205
+ };
3206
+ const senderNameForAuthResult = await senderNameForAuthPromise;
3207
+ if (!senderNameForAuthResult.ok) throw senderNameForAuthResult.error;
3208
+ const senderNameForAuth = senderNameForAuthResult.name;
3209
+ const allowTextCommands = shouldHandleTextCommands({
3210
+ cfg,
3211
+ surface: "slack"
3212
+ });
3213
+ const shouldRequireMention = isRoom ? channelConfig?.requireMention ?? ctx.defaultRequireMention : false;
3214
+ if (message["_ambiguousThreadReply"]) {
3215
+ ctx.logger.info({
3216
+ channel: message.channel,
3217
+ ts: message.ts,
3218
+ parentUserId: message.parent_user_id
3219
+ }, "skipping ambiguous slack thread reply");
3220
+ return null;
3221
+ }
3222
+ const canDetectMention = Boolean(ctx.botUserId) || mentionRegexes.length > 0;
3223
+ const textForCommandDetection = stripSlackMentionsForCommandDetection(message.text ?? "");
3224
+ const hasControlCommandInMessage = hasControlCommand(textForCommandDetection, cfg);
3225
+ const hasAbortRequest = isAbortRequestText(textForCommandDetection);
3226
+ const channelUsersAllowlistConfigured = isRoom && Array.isArray(channelConfig?.users) && channelConfig.users.length > 0;
3227
+ const messageIngress = await resolveSlackCommandIngress({
3228
+ ctx,
3229
+ senderId,
3230
+ senderName: senderNameForAuth,
3231
+ channelType: conversation.resolvedChannelType ?? "channel",
3232
+ channelId: message.channel,
3233
+ ownerAllowFromLower: allowFromLower,
3234
+ channelUsers: isRoom ? channelConfig?.users : void 0,
3235
+ allowTextCommands,
3236
+ hasControlCommand: hasControlCommandInMessage,
3237
+ mentionFacts: {
3238
+ canDetectMention,
3239
+ wasMentioned,
3240
+ hasAnyMention,
3241
+ implicitMentionKinds
3242
+ },
3243
+ activation: {
3244
+ requireMention: shouldRequireMention,
3245
+ allowTextCommands,
3246
+ ...ctx.threadRequireExplicitMention ? { allowedImplicitMentionKinds: [] } : {}
3247
+ }
3248
+ });
3249
+ const effectiveWasMentioned = messageIngress.activationAccess.effectiveWasMentioned ?? false;
3250
+ const shouldBypassMention = messageIngress.activationAccess.shouldBypassMention ?? false;
3251
+ const matchedImplicitMentionKinds = implicitMentionKinds;
3252
+ const mentionSource = resolveSlackMentionSource({
3253
+ explicitBotMention: explicitlyMentionedBotUser || opts.source === "app_mention",
3254
+ explicitSubteamMention: explicitlyMentionedBotSubteam,
3255
+ matchedImplicitMentionKinds,
3256
+ shouldBypassMention,
3257
+ wasMentioned
3258
+ });
3259
+ const senderGate = messageIngress.senderAccess.gate;
3260
+ if (isRoom && senderGate?.allowed === false) {
3261
+ logVerbose(`Blocked unauthorized slack sender ${senderId} (not in channel users)`);
3262
+ return null;
3263
+ }
3264
+ if (isRoom && isBotMessage && allowBotsMode !== "off" && !await authorizeSlackBotRoomMessage({
3265
+ ctx,
3266
+ channelId: message.channel,
3267
+ senderId,
3268
+ senderName: senderNameForAuth,
3269
+ channelUsers: channelConfig?.users,
3270
+ allowFromLower
3271
+ })) return null;
3272
+ if (isBotMessage && allowBotsMode === "mentions") {
3273
+ if (!(isDirectMessage || effectiveWasMentioned || shouldBypassMention)) {
3274
+ logVerbose("slack: drop bot message (allowBots=mentions, missing mention)");
3275
+ return null;
3276
+ }
3277
+ }
3278
+ const threadContextAllowFromLower = isRoom ? channelUsersAllowlistConfigured ? normalizeAllowListLower(channelConfig?.users) : [] : isDirectMessage ? allowFromLower : [];
3279
+ const contextVisibilityMode = resolveChannelContextVisibilityMode({
3280
+ cfg: ctx.cfg,
3281
+ channel: "slack",
3282
+ accountId: account.accountId
3283
+ });
3284
+ const commandAuthorized = messageIngress.commandAccess.authorized;
3285
+ if (isRoomish && messageIngress.commandAccess.shouldBlockControlCommand) {
3286
+ logInboundDrop({
3287
+ log: logVerbose,
3288
+ channel: "slack",
3289
+ reason: "control command (unauthorized)",
3290
+ target: senderId
3291
+ });
3292
+ return null;
3293
+ }
3294
+ if (isRoom && shouldRequireMention && !canDetectMention && !effectiveWasMentioned) {
3295
+ ctx.logger.info({
3296
+ channel: message.channel,
3297
+ reason: "mention-detection-unavailable"
3298
+ }, "skipping channel message");
3299
+ await recordDroppedHistory("slack-mention-detection-unavailable");
3300
+ return null;
3301
+ }
3302
+ const ignoreOtherMentions = channelConfig?.ignoreOtherMentions ?? false;
3303
+ if (isRoom && ignoreOtherMentions && Boolean(ctx.botUserId) && hasAnyMention && !wasMentioned) {
3304
+ logInboundDrop({
3305
+ log: logVerbose,
3306
+ channel: "slack",
3307
+ reason: "other-mention",
3308
+ target: senderId
3309
+ });
3310
+ await recordDroppedHistory("slack-other-mention");
3311
+ return null;
3312
+ }
3313
+ if (isRoom && shouldRequireMention && messageIngress.activationAccess.shouldSkip) {
3314
+ ctx.logger.info({
3315
+ channel: message.channel,
3316
+ reason: "no-mention"
3317
+ }, "skipping channel message");
3318
+ await recordDroppedHistory("slack-no-mention");
3319
+ return null;
3320
+ }
3321
+ const threadStarterPromise = isThreadReply && threadTs ? resolveSlackThreadStarter({
3322
+ channelId: message.channel,
3323
+ threadTs,
3324
+ client: ctx.app.client
3325
+ }) : Promise.resolve(null);
3326
+ const chatType = resolveSlackChatType(conversation.resolvedChannelType);
3327
+ const inboundEventKind = classifyChannelInboundEvent({
3328
+ conversation: { kind: chatType },
3329
+ unmentionedGroupPolicy: resolveUnmentionedGroupInboundPolicy({
3330
+ cfg,
3331
+ agentId: route.agentId
3332
+ }),
3333
+ wasMentioned: effectiveWasMentioned,
3334
+ hasControlCommand: hasControlCommandInMessage,
3335
+ hasAbortRequest
3336
+ });
3337
+ const threadStarter = await threadStarterPromise;
3338
+ const resolvedMessageContent = await resolveSlackMessageContent({
3339
+ message,
3340
+ isThreadReply,
3341
+ threadStarter,
3342
+ isBotMessage,
3343
+ botToken: ctx.botToken,
3344
+ client: ctx.app.client,
3345
+ mediaMaxBytes: ctx.mediaMaxBytes,
3346
+ resolveUserName: ctx.resolveUserName
3347
+ });
3348
+ if (!resolvedMessageContent) return null;
3349
+ const { rawBody, effectiveDirectMedia } = resolvedMessageContent;
3350
+ const ackReaction = resolveAckReaction(cfg, route.agentId, {
3351
+ channel: "slack",
3352
+ accountId: account.accountId
3353
+ });
3354
+ const ackReactionValue = ackReaction ?? "";
3355
+ const sourceRepliesAreToolOnly = resolveChannelMessageSourceReplyDeliveryMode({
3356
+ cfg,
3357
+ ctx: {
3358
+ ChatType: chatType,
3359
+ InboundEventKind: inboundEventKind
3360
+ }
3361
+ }) === "message_tool_only";
3362
+ const statusReactionsExplicitlyEnabled = cfg.messages?.statusReactions?.enabled === true;
3363
+ const isRoomEvent = inboundEventKind === "room_event";
3364
+ const shouldAckReaction$1 = () => Boolean(ackReaction && shouldAckReaction({
3365
+ scope: ctx.ackReactionScope,
3366
+ inboundEventKind,
3367
+ isDirect: isDirectMessage,
3368
+ isGroup: isRoomish,
3369
+ isMentionableGroup: isRoom,
3370
+ requireMention: shouldRequireMention,
3371
+ canDetectMention,
3372
+ effectiveWasMentioned,
3373
+ shouldBypassMention
3374
+ }));
3375
+ const ackReactionMessageTs = message.ts;
3376
+ const allowToolOnlyStatusReaction = statusReactionsExplicitlyEnabled && (effectiveWasMentioned || shouldBypassMention);
3377
+ const shouldSendAckReaction = shouldAckReaction$1() && (!sourceRepliesAreToolOnly || allowToolOnlyStatusReaction || isRoomEvent);
3378
+ const statusReactionsWillHandle = Boolean(ackReactionMessageTs) && !isRoomEvent && statusReactionsExplicitlyEnabled && shouldSendAckReaction;
3379
+ const ackReactionPromise = !statusReactionsWillHandle && shouldSendAckReaction && ackReactionMessageTs && ackReactionValue ? reactSlackMessage(message.channel, ackReactionMessageTs, ackReactionValue, {
3380
+ token: ctx.botToken,
3381
+ client: ctx.app.client
3382
+ }).then(() => true, (err) => {
3383
+ logVerbose(`slack react failed for channel ${message.channel}: ${formatSlackError(err)}`);
3384
+ return false;
3385
+ }) : statusReactionsWillHandle ? Promise.resolve(true) : null;
3386
+ const roomLabel = channelName ? `#${channelName}` : `#${message.channel}`;
3387
+ const senderName = await resolveSenderName();
3388
+ const preview = rawBody.replace(/\s+/g, " ").slice(0, 160);
3389
+ const inboundLabel = isDirectMessage ? `Slack DM from ${senderName}` : `Slack message in ${roomLabel} from ${senderName}`;
3390
+ const slackFrom = isDirectMessage ? `slack:${message.user}` : isRoom ? `slack:channel:${message.channel}` : `slack:group:${message.channel}`;
3391
+ enqueueSystemEvent(inboundLabel, {
3392
+ sessionKey,
3393
+ contextKey: `slack:message:${message.channel}:${message.ts ?? "unknown"}`
3394
+ });
3395
+ const envelopeFrom = resolveConversationLabel$1({
3396
+ ChatType: chatType,
3397
+ SenderName: senderName,
3398
+ GroupSubject: isRoomish ? roomLabel : void 0,
3399
+ From: slackFrom
3400
+ }) ?? (isDirectMessage ? senderName : roomLabel);
3401
+ const threadInfo = isThreadReply && threadTs ? ` thread_ts: ${threadTs}${message.parent_user_id ? ` parent_user_id: ${message.parent_user_id}` : ""}` : "";
3402
+ const textWithId = `${rawBody}\n[slack message id: ${message.ts} channel: ${message.channel}${threadInfo}]`;
3403
+ const storePath = resolveStorePath(ctx.cfg.session?.store, { agentId: route.agentId });
3404
+ const envelopeOptions = resolveEnvelopeFormatOptions(ctx.cfg);
3405
+ const previousTimestamp = readSessionUpdatedAt({
3406
+ storePath,
3407
+ sessionKey
3408
+ });
3409
+ if (opts.source === "app_mention" && !ctx.botUserId && message.ts) {
3410
+ const pendingHistory = ctx.channelHistories.get(historyKey);
3411
+ if (pendingHistory) ctx.channelHistories.set(historyKey, pendingHistory.filter((entry) => entry.messageId !== message.ts));
3412
+ }
3413
+ const channelHistory = createChannelHistoryWindow({ historyMap: ctx.channelHistories });
3414
+ const dmHistoryLimit = isDirectMessage ? resolveSlackDmHistoryLimit({
3415
+ account,
3416
+ userId: message.user,
3417
+ defaultLimit: ctx.dmHistoryLimit
3418
+ }) : 0;
3419
+ let combinedBody = formatInboundEnvelope({
3420
+ channel: "Slack",
3421
+ from: envelopeFrom,
3422
+ timestamp: resolveSlackTimestampMs(message.ts),
3423
+ body: textWithId,
3424
+ chatType,
3425
+ sender: {
3426
+ name: senderName,
3427
+ id: senderId
3428
+ },
3429
+ previousTimestamp,
3430
+ envelope: envelopeOptions
3431
+ });
3432
+ const dmHistoryContext = isDirectMessage && !isThreadReply && dmHistoryLimit > 0 && !previousTimestamp ? await resolveSlackDmHistoryContext({
3433
+ ctx,
3434
+ channelId: message.channel,
3435
+ currentMessageTs: message.ts,
3436
+ limit: dmHistoryLimit,
3437
+ envelopeOptions
3438
+ }) : {
3439
+ body: void 0,
3440
+ inboundHistory: void 0
3441
+ };
3442
+ if (dmHistoryContext.body) combinedBody = `${dmHistoryContext.body}\n\n${combinedBody}`;
3443
+ if (isRoomish && ctx.historyLimit > 0) combinedBody = channelHistory.buildPendingContext({
3444
+ historyKey,
3445
+ limit: ctx.historyLimit,
3446
+ currentMessage: combinedBody,
3447
+ formatEntry: (entry) => formatInboundEnvelope({
3448
+ channel: "Slack",
3449
+ from: roomLabel,
3450
+ timestamp: entry.timestamp,
3451
+ body: `${entry.body}${entry.messageId ? ` [id:${entry.messageId} channel:${message.channel}]` : ""}`,
3452
+ chatType: "channel",
3453
+ senderLabel: entry.sender,
3454
+ envelope: envelopeOptions
3455
+ })
3456
+ });
3457
+ const slackTo = isDirectMessage ? `user:${message.user}` : `channel:${message.channel}`;
3458
+ const { untrustedChannelMetadata, groupSystemPrompt } = resolveSlackRoomContextHints({
3459
+ isRoomish,
3460
+ channelInfo,
3461
+ channelConfig
3462
+ });
3463
+ const { threadStarterBody, threadHistoryBody, shouldSeedInitialThreadContext, threadLabel, threadStarterMedia } = await resolveSlackThreadContextData({
3464
+ ctx,
3465
+ account,
3466
+ message,
3467
+ isThreadReply,
3468
+ threadTs,
3469
+ threadStarter,
3470
+ roomLabel,
3471
+ storePath,
3472
+ sessionKey,
3473
+ forceInitialHistory: Boolean(directThreadRoutedToDmSession),
3474
+ allowFromLower: threadContextAllowFromLower,
3475
+ allowNameMatching: ctx.allowNameMatching,
3476
+ contextVisibilityMode,
3477
+ envelopeOptions,
3478
+ effectiveDirectMedia
3479
+ });
3480
+ const effectiveMedia = effectiveDirectMedia ?? threadStarterMedia;
3481
+ const inboundHistory = isRoomish && ctx.historyLimit > 0 ? channelHistory.buildInboundHistory({
3482
+ historyKey,
3483
+ limit: ctx.historyLimit
3484
+ }) : dmHistoryContext.inboundHistory;
3485
+ const commandBody = textForCommandDetection.trim();
3486
+ const supplementalThreadHistoryBody = directThreadRoutedToDmSession && !threadHistoryBody ? threadStarterBody : threadHistoryBody;
3487
+ const effectiveMessageThreadId = assistantThreadContext?.threadTs ?? threadContext.messageThreadId;
3488
+ const ctxPayload = buildChannelInboundEventContext({
3489
+ channel: "slack",
3490
+ accountId: route.accountId,
3491
+ messageId: message.ts,
3492
+ timestamp: resolveSlackTimestampMs(message.ts),
3493
+ from: slackFrom,
3494
+ sender: {
3495
+ id: senderId,
3496
+ name: senderName,
3497
+ displayLabel: senderName,
3498
+ isBot: isBotMessage || void 0
3499
+ },
3500
+ conversation: {
3501
+ kind: chatType,
3502
+ id: message.channel,
3503
+ label: envelopeFrom,
3504
+ spaceId: ctx.teamId || void 0,
3505
+ threadId: directThreadRoutedToDmSession ? void 0 : effectiveMessageThreadId,
3506
+ nativeChannelId: message.channel
3507
+ },
3508
+ route: {
3509
+ agentId: route.agentId,
3510
+ accountId: route.accountId,
3511
+ routeSessionKey: sessionKey,
3512
+ parentSessionKey: threadKeys.parentSessionKey
3513
+ },
3514
+ reply: {
3515
+ to: slackTo,
3516
+ replyToId: threadContext.replyToId,
3517
+ messageThreadId: directThreadRoutedToDmSession ? void 0 : effectiveMessageThreadId,
3518
+ nativeChannelId: message.channel
3519
+ },
3520
+ message: {
3521
+ inboundEventKind,
3522
+ body: combinedBody,
3523
+ bodyForAgent: rawBody,
3524
+ rawBody,
3525
+ commandBody,
3526
+ inboundHistory
3527
+ },
3528
+ access: {
3529
+ mentions: {
3530
+ canDetectMention: isRoomish,
3531
+ wasMentioned: effectiveWasMentioned,
3532
+ hasAnyMention: explicitlyMentioned || mentionedSubteamIds.length > 0,
3533
+ implicitMentionKinds: matchedImplicitMentionKinds,
3534
+ requireMention: shouldRequireMention,
3535
+ effectiveWasMentioned
3536
+ },
3537
+ commands: { authorized: commandAuthorized }
3538
+ },
3539
+ media: toInboundMediaFacts(effectiveMedia),
3540
+ supplemental: {
3541
+ thread: {
3542
+ starterBody: !directThreadRoutedToDmSession && shouldSeedInitialThreadContext ? threadStarterBody : void 0,
3543
+ historyBody: supplementalThreadHistoryBody,
3544
+ label: directThreadRoutedToDmSession ? void 0 : threadLabel
3545
+ },
3546
+ groupSystemPrompt
3547
+ },
3548
+ extra: {
3549
+ GroupSubject: isRoomish ? roomLabel : void 0,
3550
+ UntrustedContext: untrustedChannelMetadata ? [untrustedChannelMetadata] : void 0,
3551
+ TransportThreadId: directThreadRoutedToDmSession ? threadContext.messageThreadId : void 0,
3552
+ SlackAssistantThread: assistantThreadContext ? true : void 0,
3553
+ SlackAssistantThreadContextChannelId: assistantThreadContext?.channelId,
3554
+ SlackAssistantThreadContextTeamId: assistantThreadContext?.teamId,
3555
+ SlackAssistantThreadContextEnterpriseId: assistantThreadContext?.enterpriseId ?? void 0,
3556
+ IsFirstThreadTurn: isThreadReply && threadTs && !directThreadRoutedToDmSession && shouldSeedInitialThreadContext ? true : void 0,
3557
+ ...buildSlackMentionContextPayload({
3558
+ isRoomish,
3559
+ effectiveWasMentioned,
3560
+ explicitlyMentioned,
3561
+ mentionedUserIds,
3562
+ mentionedSubteamIds,
3563
+ matchedImplicitMentionKinds,
3564
+ mentionSource
3565
+ })
3566
+ }
3567
+ });
3568
+ ctxPayload.ReplyToMode = replyToMode;
3569
+ if (isRoomish && !shouldRequireMention) channelHistory.record({
3570
+ historyKey,
3571
+ limit: ctx.historyLimit,
3572
+ entry: {
3573
+ sender: senderName,
3574
+ body: rawBody,
3575
+ timestamp: resolveSlackTimestampMs(message.ts),
3576
+ messageId: message.ts
3577
+ }
3578
+ });
3579
+ const pinnedMainDmOwner = isDirectMessage ? resolvePinnedMainDmOwnerFromAllowlist({
3580
+ dmScope: cfg.session?.dmScope,
3581
+ allowFrom: ctx.allowFrom,
3582
+ normalizeEntry: normalizeSlackAllowOwnerEntry
3583
+ }) : null;
3584
+ const replyTarget = isDirectMessage ? `channel:${message.channel}` : ctxPayload.To ?? void 0;
3585
+ if (!replyTarget) return null;
3586
+ if (shouldLogVerbose()) logVerbose(`slack inbound: account=${route.accountId} agent=${route.agentId} channel=${message.channel} message_ts=${message.ts ?? "unknown"} thread_ts=${effectiveMessageThreadId ?? "none"} from=${slackFrom} chat=${chatType} chars=${rawBody.length}`);
3587
+ const updateLastRouteSessionKey = resolveInboundLastRouteSessionKey({
3588
+ route,
3589
+ sessionKey
3590
+ });
3591
+ return {
3592
+ ctx,
3593
+ account,
3594
+ message,
3595
+ ...opts.relayIdentity ? { relayIdentity: opts.relayIdentity } : {},
3596
+ route,
3597
+ channelConfig,
3598
+ replyTarget,
3599
+ ctxPayload,
3600
+ turn: {
3601
+ storePath,
3602
+ record: {
3603
+ updateLastRoute: isDirectMessage ? {
3604
+ sessionKey: updateLastRouteSessionKey,
3605
+ channel: "slack",
3606
+ to: `user:${message.user}`,
3607
+ accountId: route.accountId,
3608
+ threadId: effectiveMessageThreadId,
3609
+ mainDmOwnerPin: updateLastRouteSessionKey === route.mainSessionKey && pinnedMainDmOwner && message.user ? {
3610
+ ownerRecipient: pinnedMainDmOwner,
3611
+ senderRecipient: normalizeLowercaseStringOrEmpty(message.user),
3612
+ onSkip: ({ ownerRecipient, senderRecipient }) => {
3613
+ logVerbose(`slack: skip main-session last route for ${senderRecipient} (pinned owner ${ownerRecipient})`);
3614
+ }
3615
+ } : void 0
3616
+ } : void 0,
3617
+ onRecordError: (err) => {
3618
+ ctx.logger.warn({
3619
+ error: formatErrorMessage(err),
3620
+ storePath,
3621
+ sessionKey
3622
+ }, "failed updating session meta");
3623
+ }
3624
+ },
3625
+ history: isRoomish && shouldRequireMention ? {
3626
+ isGroup: true,
3627
+ historyKey,
3628
+ historyMap: ctx.channelHistories,
3629
+ limit: ctx.historyLimit
3630
+ } : void 0
3631
+ },
3632
+ replyToMode,
3633
+ ...forcedAssistantReplyThreadTs ? { forcedReplyThreadTs: forcedAssistantReplyThreadTs } : {},
3634
+ ...assistantThreadContext ? { slackMessageMetadata: buildSlackAssistantThreadMetadata(assistantThreadContext) } : {},
3635
+ requireMention: shouldRequireMention,
3636
+ isDirectMessage,
3637
+ isRoomish,
3638
+ historyKey,
3639
+ preview,
3640
+ ackReactionMessageTs,
3641
+ ackReactionValue,
3642
+ ackReactionPromise
3643
+ };
3644
+ }
3645
+ //#endregion
3646
+ export { dispatchPreparedSlackMessage, prepareSlackMessage };