@openclaw/slack 2026.10.1 → 2026.10.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/dist/.setup/account-configured-zcR9TJJN.mjs +35 -0
  2. package/dist/.setup/{account-inspect-Cs-7DXXW.mjs → account-inspect-D58VVDjk.mjs} +15 -35
  3. package/dist/.setup/{accounts-CDgkV7Cm.mjs → accounts-BMg9YLIv.mjs} +44 -53
  4. package/dist/.setup/{action-runtime-DJ1daRAZ.mjs → action-runtime-BiRZNsIG.mjs} +20 -22
  5. package/dist/.setup/action-runtime.runtime-C5xceJoS.mjs +2 -0
  6. package/dist/.setup/{actions-DDoAJnrH.mjs → actions-KGKwTAKO.mjs} +34 -43
  7. package/dist/.setup/{approval-handler.runtime-BcE_shWc.mjs → approval-handler.runtime-DYrsG2Ox.mjs} +44 -70
  8. package/dist/.setup/{approval-message-updates-EgKGmFXx.mjs → approval-message-updates-CwdDew9i.mjs} +1 -1
  9. package/dist/.setup/{channel-DgKSu8Iv.mjs → channel-C7MY-Hhg.mjs} +138 -97
  10. package/dist/.setup/{channel-type-B9zYYzBU.mjs → channel-type-NjX2SwvS.mjs} +3 -3
  11. package/dist/.setup/{channel.setup-BYIlwbQ7.mjs → channel.setup-BFpQowO3.mjs} +7 -14
  12. package/dist/.setup/{directory-config-B_by7zrc.mjs → directory-config-BEDZPfDn.mjs} +1 -1
  13. package/dist/.setup/{directory-live-C48wazJt.mjs → directory-live-FipfeCwt.mjs} +33 -36
  14. package/dist/.setup/{message-tool-api-CcjLPN3v.mjs → message-tool-api-C7im5ETh.mjs} +2 -2
  15. package/dist/.setup/{monitor-BuYBDmm7.mjs → monitor-BnN2px0N.mjs} +609 -801
  16. package/dist/.setup/{outbound-adapter-BZFkK-mw.mjs → outbound-adapter-4HdGq-8r.mjs} +4 -4
  17. package/dist/.setup/{pipeline.runtime-CIepKmZt.mjs → pipeline.runtime-ByPbC6MN.mjs} +287 -365
  18. package/dist/.setup/{policy-KKTqEiDv.mjs → policy-BaY9_eh1.mjs} +2 -2
  19. package/dist/.setup/{probe-BVlJ3dp0.mjs → probe-CyX52GtD.mjs} +54 -61
  20. package/dist/.setup/{relay-source-CC3h6M7y.mjs → relay-source-CVfH-fBO.mjs} +28 -45
  21. package/dist/.setup/{replies-DHbuthIR.mjs → replies-WmfwvQxc.mjs} +38 -49
  22. package/dist/.setup/{reply-blocks-CKnO4BSG.mjs → reply-blocks-rqHQ_3pr.mjs} +87 -138
  23. package/dist/.setup/{resolve-channels-HR0TgArR.mjs → resolve-channels-B96cgprw.mjs} +17 -41
  24. package/dist/.setup/{resolve-users-BNYBhF0q.mjs → resolve-users-Xz9aPdns.mjs} +22 -58
  25. package/dist/.setup/{scopes-DrDbyUH2.mjs → scopes-aMcMHhXk.mjs} +1 -1
  26. package/dist/.setup/{send-CgPI3Zj8.mjs → send-CLmsR42r.mjs} +157 -284
  27. package/dist/.setup/{session-status-D46GHwOV.mjs → session-status-CcXe10zN.mjs} +181 -238
  28. package/dist/.setup/{setup-plugin-api-ZrHs0N4U.mjs → setup-plugin-api-D92P5p51.mjs} +1 -1
  29. package/dist/.setup/{setup-surface-83lxvE2y.mjs → setup-surface-368jx6Uc.mjs} +6 -6
  30. package/dist/.setup/{shared-VtmYNj-v.mjs → shared-CtprVh_G.mjs} +5 -5
  31. package/dist/.setup/{slash-dispatch.runtime-gBj_uaLM.mjs → slash-dispatch.runtime-Dzwj6TPI.mjs} +1 -1
  32. package/dist/account-inspect-api.js +1 -1
  33. package/dist/api.js +12 -12
  34. package/dist/channel-plugin-api.js +1 -1
  35. package/dist/configured-state.js +6 -13
  36. package/dist/directory-contract-api.js +1 -1
  37. package/dist/message-tool-api.js +1 -1
  38. package/dist/runtime-api.js +10 -10
  39. package/dist/setup-entry.js +1 -1
  40. package/dist/setup-plugin-api.js +1 -1
  41. package/node_modules/@slack/types/dist/block-kit/block-elements.d.ts +1 -1
  42. package/node_modules/@slack/types/dist/block-kit/block-elements.d.ts.map +1 -1
  43. package/node_modules/@slack/types/dist/block-kit/blocks.d.ts +79 -4
  44. package/node_modules/@slack/types/dist/block-kit/blocks.d.ts.map +1 -1
  45. package/node_modules/@slack/types/dist/block-kit/composition-objects.d.ts +17 -0
  46. package/node_modules/@slack/types/dist/block-kit/composition-objects.d.ts.map +1 -1
  47. package/node_modules/@slack/types/package.json +1 -1
  48. package/node_modules/@slack/web-api/dist/methods.d.ts +49 -2
  49. package/node_modules/@slack/web-api/dist/methods.d.ts.map +1 -1
  50. package/node_modules/@slack/web-api/dist/methods.js +47 -0
  51. package/node_modules/@slack/web-api/dist/methods.js.map +1 -1
  52. package/node_modules/@slack/web-api/dist/types/request/agents.d.ts +186 -0
  53. package/node_modules/@slack/web-api/dist/types/request/agents.d.ts.map +1 -1
  54. package/node_modules/@slack/web-api/dist/types/request/index.d.ts +1 -1
  55. package/node_modules/@slack/web-api/dist/types/request/index.d.ts.map +1 -1
  56. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsArchiveResponse.d.ts +9 -0
  57. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsArchiveResponse.d.ts.map +1 -0
  58. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsArchiveResponse.js +11 -0
  59. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsArchiveResponse.js.map +1 -0
  60. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsCreateResponse.d.ts +10 -0
  61. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsCreateResponse.d.ts.map +1 -0
  62. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsCreateResponse.js +11 -0
  63. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsCreateResponse.js.map +1 -0
  64. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsGetCanvasResponse.d.ts +29 -0
  65. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsGetCanvasResponse.d.ts.map +1 -0
  66. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsGetCanvasResponse.js +11 -0
  67. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsGetCanvasResponse.js.map +1 -0
  68. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsListViewsResponse.d.ts +18 -0
  69. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsListViewsResponse.d.ts.map +1 -0
  70. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsListViewsResponse.js +11 -0
  71. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsListViewsResponse.js.map +1 -0
  72. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsRemoveViewResponse.d.ts +11 -0
  73. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsRemoveViewResponse.d.ts.map +1 -0
  74. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsRemoveViewResponse.js +11 -0
  75. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsRemoveViewResponse.js.map +1 -0
  76. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCanvasContentResponse.d.ts +11 -0
  77. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCanvasContentResponse.d.ts.map +1 -0
  78. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCanvasContentResponse.js +11 -0
  79. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCanvasContentResponse.js.map +1 -0
  80. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCommandsResponse.d.ts +11 -0
  81. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCommandsResponse.d.ts.map +1 -0
  82. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCommandsResponse.js +11 -0
  83. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetCommandsResponse.js.map +1 -0
  84. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetPropertiesResponse.d.ts +10 -0
  85. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetPropertiesResponse.d.ts.map +1 -0
  86. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetPropertiesResponse.js +11 -0
  87. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetPropertiesResponse.js.map +1 -0
  88. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetViewResponse.d.ts +15 -0
  89. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetViewResponse.d.ts.map +1 -0
  90. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetViewResponse.js +11 -0
  91. package/node_modules/@slack/web-api/dist/types/response/AgentsConversationsSetViewResponse.js.map +1 -0
  92. package/node_modules/@slack/web-api/dist/types/response/ConversationsInfoResponse.d.ts +31 -0
  93. package/node_modules/@slack/web-api/dist/types/response/ConversationsInfoResponse.d.ts.map +1 -1
  94. package/node_modules/@slack/web-api/dist/types/response/index.d.ts +9 -0
  95. package/node_modules/@slack/web-api/dist/types/response/index.d.ts.map +1 -1
  96. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/LICENSE +21 -0
  97. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/README.md +15 -0
  98. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/assert/strict.d.ts +68 -0
  99. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/assert.d.ts +1077 -0
  100. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/async_hooks.d.ts +711 -0
  101. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/buffer.buffer.d.ts +471 -0
  102. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/buffer.d.ts +1800 -0
  103. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/child_process.d.ts +1361 -0
  104. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/cluster.d.ts +432 -0
  105. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/console.d.ts +93 -0
  106. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/constants.d.ts +14 -0
  107. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/crypto.d.ts +3964 -0
  108. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/dgram.d.ts +652 -0
  109. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/diagnostics_channel.d.ts +794 -0
  110. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/dns/promises.d.ts +497 -0
  111. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/dns.d.ts +876 -0
  112. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/domain.d.ts +150 -0
  113. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/events.d.ts +1008 -0
  114. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/ffi.d.ts +500 -0
  115. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/fs/promises.d.ts +1477 -0
  116. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/fs.d.ts +4803 -0
  117. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/globals.d.ts +150 -0
  118. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/globals.typedarray.d.ts +101 -0
  119. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/http.d.ts +2218 -0
  120. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/http2.d.ts +2498 -0
  121. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/https.d.ts +400 -0
  122. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/index.d.ts +116 -0
  123. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/inspector/promises.d.ts +35 -0
  124. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/inspector.d.ts +265 -0
  125. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/inspector.generated.d.ts +4406 -0
  126. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/module.d.ts +726 -0
  127. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/net.d.ts +1074 -0
  128. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/os.d.ts +498 -0
  129. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/package.json +155 -0
  130. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/path/posix.d.ts +8 -0
  131. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/path/win32.d.ts +8 -0
  132. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/path.d.ts +178 -0
  133. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/perf_hooks.d.ts +617 -0
  134. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/process.d.ts +2269 -0
  135. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/punycode.d.ts +89 -0
  136. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/querystring.d.ts +139 -0
  137. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/quic.d.ts +2191 -0
  138. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/readline/promises.d.ts +158 -0
  139. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/readline.d.ts +508 -0
  140. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/repl.d.ts +420 -0
  141. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/sea.d.ts +47 -0
  142. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/sqlite.d.ts +1140 -0
  143. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/stream/consumers.d.ts +114 -0
  144. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/stream/iter.d.ts +449 -0
  145. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/stream/promises.d.ts +211 -0
  146. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/stream/web.d.ts +320 -0
  147. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/stream.d.ts +1806 -0
  148. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/string_decoder.d.ts +27 -0
  149. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/test/reporters.d.ts +60 -0
  150. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/test.d.ts +2558 -0
  151. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/timers/promises.d.ts +93 -0
  152. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/timers.d.ts +149 -0
  153. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/tls.d.ts +1232 -0
  154. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/trace_events.d.ts +103 -0
  155. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +467 -0
  156. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  157. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  158. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/ts5.6/index.d.ts +118 -0
  159. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  160. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/ts5.7/index.d.ts +118 -0
  161. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/tty.d.ts +226 -0
  162. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/url.d.ts +556 -0
  163. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/util/types.d.ts +558 -0
  164. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/util.d.ts +1677 -0
  165. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/v8.d.ts +1059 -0
  166. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/vfs.d.ts +211 -0
  167. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/vm.d.ts +1137 -0
  168. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/wasi.d.ts +131 -0
  169. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
  170. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  171. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/console.d.ts +9 -0
  172. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
  173. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/domexception.d.ts +83 -0
  174. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  175. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/events.d.ts +106 -0
  176. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
  177. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  178. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  179. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  180. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  181. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  182. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/streams.d.ts +119 -0
  183. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  184. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/web-globals/url.d.ts +24 -0
  185. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/worker_threads.d.ts +672 -0
  186. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/zlib/iter.d.ts +131 -0
  187. package/node_modules/@slack/web-api/node_modules/@slack/logger/node_modules/@types/node/zlib.d.ts +606 -0
  188. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +2 -2
  189. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -17
  190. package/node_modules/@slack/web-api/package.json +2 -2
  191. package/openclaw.plugin.json +0 -3
  192. package/package.json +6 -14
  193. package/dist/.setup/account-configured-sUohAxZr.mjs +0 -33
  194. package/dist/.setup/action-runtime.runtime-CdWL2mLC.mjs +0 -2
  195. package/dist/control-ui/2f4b1e827be6b68ced2ea0d8b7da8529a4eafbe72be27ee37e1064bdd530ec10/index.js +0 -1
@@ -1,16 +1,15 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { d as resolveSlackOperationToken, s as resolveSlackAccount } from "./accounts-CDgkV7Cm.mjs";
2
+ import { d as resolveSlackOperationToken, s as resolveSlackAccount } from "./accounts-BMg9YLIv.mjs";
3
3
  import { a as parseSlackTarget, t as canonicalizeSlackApiTargetId } from "./target-parsing-FFE26kOV.mjs";
4
- import { D as SLACK_MESSAGE_TEXT_HARD_LIMIT, E as SLACK_EDIT_TEXT_MAX_BYTES, J as markdownToSlackMrkdwnChunks, M as truncateSlackTextByUtf8Bytes, O as SLACK_MESSAGE_TEXT_RECOMMENDED_LIMIT, P as SLACK_QUESTION_FINALIZATION_BLOCKS, S as stripSlackNativeDataBlocks, T as renderSlackBlockFallbackText, U as resolveSlackQuestionActionIds, _ as createSlackNativeDataBaseTextConsumer, f as assertSlackDetachedTargetAllowed, g as buildSlackNativeDataAccessibilityText, h as appendSlackNativeDataPlainTextFallback, ht as validateSlackBlocksArray, j as truncateSlackText, k as SLACK_TEXT_LIMIT, q as chunkSlackMrkdwnText, v as hasSlackNativeDataBlock, w as buildSlackCompleteBlocksFallbackText, y as isSlackInvalidBlocksError } from "./session-status-D46GHwOV.mjs";
5
- import { _ as getSlackWriteClient, d as createSlackReadClient, h as createSlackWriteClient, o as formatSlackError, p as createSlackTokenCacheKey, s as getSlackWebApiErrorData } from "./probe-BVlJ3dp0.mjs";
4
+ import { A as SLACK_TEXT_LIMIT, C as stripSlackNativeDataBlocks, D as SLACK_EDIT_TEXT_MAX_BYTES, E as renderSlackBlockFallbackText, F as SLACK_QUESTION_FINALIZATION_BLOCKS, J as chunkSlackMrkdwnText, M as truncateSlackText, N as truncateSlackTextByUtf8Bytes, O as SLACK_MESSAGE_TEXT_HARD_LIMIT, S as renderSlackNativeDataPlainTextBlock, T as buildSlackCompleteBlocksFallbackText, W as resolveSlackQuestionActionIds, Y as markdownToSlackMrkdwnChunks, _ as createSlackNativeDataBaseTextConsumer, f as assertSlackDetachedTargetAllowed, g as buildSlackNativeDataAccessibilityText, k as SLACK_MESSAGE_TEXT_RECOMMENDED_LIMIT, mt as validateSlackBlocksArray, v as hasSlackNativeDataBlock, y as isSlackInvalidBlocksError } from "./session-status-CcXe10zN.mjs";
5
+ import { _ as getSlackWriteClient, b as writeLruMapEntry, d as createSlackReadClient, h as createSlackWriteClient, o as formatSlackError, p as createSlackTokenCacheKey, s as getSlackWebApiErrorData } from "./probe-CyX52GtD.mjs";
6
6
  import { r as resolveSlackThreadTsValue, t as normalizeSlackThreadTsCandidate } from "./thread-ts-Cvt7WD6B.mjs";
7
7
  import { t as getOptionalSlackRuntime } from "./runtime-JSVZSWAj.mjs";
8
- import { isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
8
+ import { asOptionalObjectRecord, asOptionalRecord, isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
9
9
  import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
10
10
  import { logVerbose, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
11
11
  import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
12
12
  import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
13
- import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
14
13
  import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
15
14
  import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
16
15
  import { createHash, createHmac } from "node:crypto";
@@ -35,47 +34,7 @@ function chunkSlackTextAtHardLimit(text, limit = SLACK_MESSAGE_TEXT_HARD_LIMIT)
35
34
  if (!text) return [];
36
35
  return chunkTextForOutbound(text, Math.max(1, Math.floor(limit)), { preserveWhitespace: true });
37
36
  }
38
- function buildPlainTextBlocks(text, textLimit) {
39
- return chunkSlackTextAtHardLimit(text, Math.min(textLimit, SLACK_SECTION_PLAIN_TEXT_MAX)).map((chunk, index) => {
40
- const fallbackBlock = {
41
- block: {
42
- type: "section",
43
- text: {
44
- type: "plain_text",
45
- text: chunk
46
- }
47
- },
48
- text: chunk
49
- };
50
- if (index > 0) fallbackBlock.continuesText = true;
51
- return fallbackBlock;
52
- });
53
- }
54
- function renderNativeDataPlainText(block) {
55
- return appendSlackNativeDataPlainTextFallback("", [block]).trim() || "Slack could not render this chart or table data.";
56
- }
57
- function buildOrderedFallbackBlocks(params) {
58
- const entries = [];
59
- const consumeFromBase = createSlackNativeDataBaseTextConsumer(params.baseText);
60
- if (params.baseText) entries.push(...buildPlainTextBlocks(params.baseText, params.textLimit));
61
- for (const block of params.blocks) {
62
- if (hasSlackNativeDataBlock([block])) {
63
- const nativeText = renderNativeDataPlainText(block);
64
- if (!consumeFromBase(nativeText)) entries.push(...buildPlainTextBlocks(nativeText, params.textLimit));
65
- continue;
66
- }
67
- const text = truncateSlackText(renderSlackBlockFallbackText(block, {
68
- nativeDataFormat: "plain",
69
- includeSelectOptions: true
70
- }) ?? "", SLACK_MESSAGE_TEXT_HARD_LIMIT);
71
- entries.push({
72
- block,
73
- ...text ? { text } : {}
74
- });
75
- }
76
- return entries;
77
- }
78
- function buildOrderedBlockMessages(entries, textLimit) {
37
+ function buildOrderedBlockMessages(params) {
79
38
  const messages = [];
80
39
  let blocks = [];
81
40
  let text = "";
@@ -89,14 +48,38 @@ function buildOrderedBlockMessages(entries, textLimit) {
89
48
  blocks = [];
90
49
  text = "";
91
50
  };
92
- for (const entry of entries) {
93
- const separator = text && entry.text && !entry.continuesText ? "\n\n" : "";
94
- const nextText = entry.text ? `${text}${separator}${entry.text}` : text;
95
- if (blocks.length >= 50 || nextText.length > textLimit) flush();
96
- const freshSeparator = text && entry.text && !entry.continuesText ? "\n\n" : "";
97
- const freshText = entry.text ? `${text}${freshSeparator}${entry.text}` : text;
98
- blocks.push(entry.block);
99
- text = freshText;
51
+ const append = (block, entryText = "", continuesText = false) => {
52
+ let nextText = entryText ? `${text}${text && entryText && !continuesText ? "\n\n" : ""}${entryText}` : text;
53
+ if (blocks.length >= 50 || nextText.length > params.textLimit) {
54
+ flush();
55
+ nextText = entryText;
56
+ }
57
+ blocks.push(block);
58
+ text = nextText;
59
+ };
60
+ const appendPlainText = (value) => {
61
+ chunkSlackTextAtHardLimit(value, Math.min(params.textLimit, SLACK_SECTION_PLAIN_TEXT_MAX)).forEach((chunk, index) => {
62
+ append({
63
+ type: "section",
64
+ text: {
65
+ type: "plain_text",
66
+ text: chunk
67
+ }
68
+ }, chunk, index > 0);
69
+ });
70
+ };
71
+ const consumeFromBase = createSlackNativeDataBaseTextConsumer(params.baseText);
72
+ appendPlainText(params.baseText);
73
+ for (const block of params.blocks) {
74
+ if (hasSlackNativeDataBlock([block])) {
75
+ const nativeText = renderSlackNativeDataPlainTextBlock(block)?.trim() || "Slack could not render this chart or table data.";
76
+ if (!consumeFromBase(nativeText)) appendPlainText(nativeText);
77
+ continue;
78
+ }
79
+ append(block, truncateSlackText(renderSlackBlockFallbackText(block, {
80
+ nativeDataFormat: "plain",
81
+ includeSelectOptions: true
82
+ }) ?? "", SLACK_MESSAGE_TEXT_HARD_LIMIT));
100
83
  }
101
84
  flush();
102
85
  return messages;
@@ -110,11 +93,11 @@ function buildSlackNativeDataDeliveryPlan(params) {
110
93
  const fallbackMessages = stripSlackNativeDataBlocks(params.blocks).length === 0 ? chunkSlackTextAtHardLimit(accessibilityText, textLimit).map((text) => ({
111
94
  text,
112
95
  mrkdwn: false
113
- })) : buildOrderedBlockMessages(buildOrderedFallbackBlocks({
96
+ })) : buildOrderedBlockMessages({
114
97
  baseText,
115
98
  blocks: params.blocks,
116
99
  textLimit
117
- }), textLimit);
100
+ });
118
101
  return {
119
102
  accessibilityText: truncateSlackText(accessibilityText, SLACK_MESSAGE_TEXT_HARD_LIMIT),
120
103
  fallbackMessages,
@@ -131,10 +114,10 @@ function buildSlackMessageIdentityPayload(identity) {
131
114
  }
132
115
  function classifySlackCustomIdentityError(err) {
133
116
  const data = getSlackWebApiErrorData(err);
134
- const code = normalizeLowercaseStringOrEmpty(normalizeOptionalString(data?.error));
117
+ const code = normalizeLowercaseStringOrEmpty(data?.error);
135
118
  if (code === "invalid_arguments" || code === "invalid_arg_name") return "argument";
136
119
  if (code !== "missing_scope") return;
137
- if (normalizeLowercaseStringOrEmpty(normalizeOptionalString(data?.needed)).includes("chat:write.customize")) return "scope";
120
+ if (normalizeLowercaseStringOrEmpty(data?.needed).includes("chat:write.customize")) return "scope";
138
121
  return [...normalizeTrimmedStringList(data?.response_metadata?.scopes), ...normalizeTrimmedStringList(data?.response_metadata?.acceptedScopes)].map((scope) => normalizeLowercaseStringOrEmpty(scope)).includes("chat:write.customize") ? "scope" : void 0;
139
122
  }
140
123
  function hasSlackMessageIdentity(identity) {
@@ -170,18 +153,11 @@ async function postSlackMessageWithIdentityFallback(params) {
170
153
  }
171
154
  //#endregion
172
155
  //#region extensions/slack/src/post-message-payload.ts
173
- function buildSlackUnfurlPayload(options) {
174
- return {
175
- unfurl_links: options?.unfurlLinks ?? false,
176
- ...typeof options?.unfurlMedia === "boolean" ? { unfurl_media: options.unfurlMedia } : {}
177
- };
178
- }
179
156
  function buildSlackPostMessagePayload(params) {
180
157
  const threadPayload = params.replyBroadcast && params.threadTs ? {
181
158
  thread_ts: params.threadTs,
182
159
  reply_broadcast: true
183
160
  } : params.threadTs ? { thread_ts: params.threadTs } : {};
184
- const unfurlPayload = buildSlackUnfurlPayload(params.unfurl);
185
161
  return {
186
162
  channel: params.channelId,
187
163
  text: params.text,
@@ -189,7 +165,8 @@ function buildSlackPostMessagePayload(params) {
189
165
  ...params.metadata ? { metadata: params.metadata } : {},
190
166
  ...typeof params.mrkdwn === "boolean" ? { mrkdwn: params.mrkdwn } : {},
191
167
  ...threadPayload,
192
- ...unfurlPayload
168
+ unfurl_links: params.unfurl?.unfurlLinks ?? false,
169
+ ...typeof params.unfurl?.unfurlMedia === "boolean" ? { unfurl_media: params.unfurl.unfurlMedia } : {}
193
170
  };
194
171
  }
195
172
  //#endregion
@@ -224,31 +201,23 @@ function rethrowSlackPermanentOutboundApiRejection(err) {
224
201
  });
225
202
  throw err;
226
203
  }
227
- function readSlackRequestErrorCode(value) {
228
- if (!value || typeof value !== "object") return;
229
- const code = value.code;
230
- return typeof code === "string" ? code.toUpperCase() : void 0;
231
- }
232
204
  function hasSlackDnsRequestSignal(err) {
233
- let current = err;
205
+ let current = asOptionalObjectRecord(err);
234
206
  const seen = /* @__PURE__ */ new Set();
235
- for (let depth = 0; current && typeof current === "object" && depth < 6; depth += 1) {
207
+ for (let depth = 0; current && depth < 6; depth += 1) {
236
208
  if (seen.has(current)) return false;
237
209
  seen.add(current);
238
- const code = readSlackRequestErrorCode(current);
210
+ const rawCode = current.code;
211
+ const code = typeof rawCode === "string" ? rawCode.toUpperCase() : void 0;
239
212
  if (code && SLACK_DNS_RETRY_CODES.has(code)) return true;
240
213
  const message = current instanceof Error ? current.message : "";
241
214
  if (/\b(EAI_AGAIN|ENOTFOUND|UND_ERR_DNS_RESOLVE_FAILED)\b/i.test(message)) return true;
242
- current = current.original ?? current.cause;
215
+ current = asOptionalObjectRecord(current.original ?? current.cause);
243
216
  }
244
217
  return false;
245
218
  }
246
219
  function resolveSlackUploadTimeoutLogUrl(url) {
247
- try {
248
- return new URL(url).origin;
249
- } catch {
250
- return;
251
- }
220
+ return URL.parse(url)?.origin;
252
221
  }
253
222
  function buildSlackUploadFailureCause(error) {
254
223
  const httpStatus = error instanceof Error ? /^Failed to upload file: HTTP (\d{3})$/u.exec(error.message)?.[1] : void 0;
@@ -259,30 +228,19 @@ function buildSlackUploadFailureCause(error) {
259
228
  return cause;
260
229
  }
261
230
  function parseSlackUploadHttpUrl(value, label) {
262
- try {
263
- const parsed = new URL(value);
264
- if (parsed.protocol === "http:" || parsed.protocol === "https:") return parsed;
265
- } catch {}
231
+ const parsed = URL.parse(value);
232
+ if (parsed && (parsed.protocol === "http:" || parsed.protocol === "https:")) return parsed;
266
233
  throw new Error(`${label} must use a valid HTTP or HTTPS URL`);
267
234
  }
268
235
  function normalizeSlackHostname(hostname) {
269
236
  return hostname.trim().toLowerCase().replace(/\.$/, "");
270
237
  }
271
- function resolveSlackOwnedUploadPolicy(url) {
272
- if (url.protocol !== "https:") return;
273
- switch (normalizeSlackHostname(url.hostname)) {
274
- case SLACK_COMMERCIAL_UPLOAD_HOSTNAME: return SLACK_COMMERCIAL_UPLOAD_SSRF_POLICY;
275
- case SLACK_GOV_UPLOAD_HOSTNAME: return SLACK_GOV_UPLOAD_SSRF_POLICY;
276
- default: return;
277
- }
278
- }
279
- function resolveOfficialSlackApiUploadPolicy(url) {
280
- if (url.protocol !== "https:" || url.port) return;
281
- switch (normalizeSlackHostname(url.hostname)) {
282
- case SLACK_COMMERCIAL_API_HOSTNAME: return SLACK_COMMERCIAL_UPLOAD_SSRF_POLICY;
283
- case SLACK_GOV_API_HOSTNAME: return SLACK_GOV_UPLOAD_SSRF_POLICY;
284
- default: return;
285
- }
238
+ function resolveSlackUploadPolicy(url, source) {
239
+ if (url.protocol !== "https:" || source === "api" && url.port) return;
240
+ const hostname = normalizeSlackHostname(url.hostname);
241
+ const [commercial, government] = source === "api" ? [SLACK_COMMERCIAL_API_HOSTNAME, SLACK_GOV_API_HOSTNAME] : [SLACK_COMMERCIAL_UPLOAD_HOSTNAME, SLACK_GOV_UPLOAD_HOSTNAME];
242
+ if (hostname === commercial) return SLACK_COMMERCIAL_UPLOAD_SSRF_POLICY;
243
+ if (hostname === government) return SLACK_GOV_UPLOAD_SSRF_POLICY;
286
244
  }
287
245
  function normalizeSlackOrigin(url) {
288
246
  const port = url.port ? `:${url.port}` : "";
@@ -294,13 +252,13 @@ function resolveSlackUploadTransportPolicy(params) {
294
252
  policy: SLACK_COMMERCIAL_UPLOAD_SSRF_POLICY
295
253
  };
296
254
  const apiUrl = parseSlackUploadHttpUrl(params.slackApiUrl, "Configured Slack API URL");
297
- const officialApiPolicy = resolveOfficialSlackApiUploadPolicy(apiUrl);
255
+ const officialApiPolicy = resolveSlackUploadPolicy(apiUrl, "api");
298
256
  if (officialApiPolicy) return {
299
257
  requireHttps: true,
300
258
  policy: officialApiPolicy
301
259
  };
302
260
  const uploadUrl = parseSlackUploadHttpUrl(params.uploadUrl, "Slack external upload URL");
303
- const slackOwnedUploadPolicy = resolveSlackOwnedUploadPolicy(uploadUrl);
261
+ const slackOwnedUploadPolicy = resolveSlackUploadPolicy(uploadUrl, "upload");
304
262
  if (slackOwnedUploadPolicy) return {
305
263
  requireHttps: true,
306
264
  policy: slackOwnedUploadPolicy
@@ -485,9 +443,7 @@ function recordSlackThreadFailureNotice(params) {
485
443
  if (!accountId || !channelId || !fingerprint) return false;
486
444
  const key = makeFailureNoticeKey(params);
487
445
  if (threadFailureNotices.get(key) === fingerprint) return false;
488
- threadFailureNotices.delete(key);
489
- threadFailureNotices.set(key, fingerprint);
490
- pruneMapToMaxSize(threadFailureNotices, MAX_FAILURE_NOTICES);
446
+ writeLruMapEntry(threadFailureNotices, key, fingerprint, MAX_FAILURE_NOTICES);
491
447
  return true;
492
448
  }
493
449
  /** Clears a thread or channel outage notice after a healthy model turn completes. */
@@ -520,9 +476,7 @@ function readCachedSlackDmChannelId(params) {
520
476
  function cacheSlackDmChannelId(params, channelId) {
521
477
  const cache = getSlackDmChannelCache(params.cacheOwner);
522
478
  const key = createSlackDmCacheKey(params);
523
- cache.delete(key);
524
- cache.set(key, channelId);
525
- pruneMapToMaxSize(cache, SLACK_DM_CHANNEL_CACHE_MAX);
479
+ writeLruMapEntry(cache, key, channelId, SLACK_DM_CHANNEL_CACHE_MAX);
526
480
  }
527
481
  //#endregion
528
482
  //#region extensions/slack/src/send.ts
@@ -563,15 +517,11 @@ function setSlackDefaultSendIdentity(accountId, identity) {
563
517
  if (normalizedIdentity) slackDefaultSendIdentities.set(normalizedAccountId, normalizedIdentity);
564
518
  else slackDefaultSendIdentities.delete(normalizedAccountId);
565
519
  }
566
- function getSlackDefaultSendIdentity(accountId) {
567
- const normalizedAccountId = normalizeOptionalString(accountId);
568
- return normalizedAccountId ? slackDefaultSendIdentities.get(normalizedAccountId) : void 0;
569
- }
570
- function formatSlackWebApiErrorMessage(err) {
571
- if (!(err instanceof Error)) return;
520
+ function enrichSlackWebApiError(err) {
521
+ if (!(err instanceof Error)) return err;
572
522
  const data = getSlackWebApiErrorData(err);
573
523
  const code = normalizeOptionalString(data?.error);
574
- if (!code) return;
524
+ if (!code) return err;
575
525
  const details = [];
576
526
  const needed = normalizeOptionalString(data?.needed);
577
527
  if (needed) details.push(`needed: ${needed}`);
@@ -579,12 +529,8 @@ function formatSlackWebApiErrorMessage(err) {
579
529
  if (scopes.length) details.push(`granted: ${scopes.join(", ")}`);
580
530
  const acceptedScopes = normalizeTrimmedStringList(data?.response_metadata?.acceptedScopes);
581
531
  if (acceptedScopes.length) details.push(`accepted: ${acceptedScopes.join(", ")}`);
582
- return `${err.message || `An API error occurred: ${code}`}${details.length ? ` (${details.join("; ")})` : ""}`;
583
- }
584
- function enrichSlackWebApiError(err) {
585
- const message = formatSlackWebApiErrorMessage(err);
586
- if (!message || !(err instanceof Error) || message === err.message) return err;
587
- return new Error(message);
532
+ const message = `${err.message || `An API error occurred: ${code}`}${details.length ? ` (${details.join("; ")})` : ""}`;
533
+ return message === err.message ? err : new Error(message);
588
534
  }
589
535
  function readSlackRequestErrorMessage(value) {
590
536
  if (value instanceof Error) return value.message;
@@ -616,13 +562,13 @@ async function updateMessageSlack(params) {
616
562
  function createSlackSendReceipt(params) {
617
563
  const platformMessageIds = params.platformMessageIds.map((messageId) => messageId.trim()).filter((messageId) => messageId && messageId !== "unknown");
618
564
  return createMessageReceiptFromOutboundResults({
619
- results: platformMessageIds.map((messageId) => {
620
- const result = {
621
- channel: "slack",
622
- messageId
623
- };
624
- if (params.channelId) result.channelId = params.channelId;
625
- return result;
565
+ results: platformMessageIds.map((messageId) => params.channelId ? {
566
+ channel: "slack",
567
+ messageId,
568
+ channelId: params.channelId
569
+ } : {
570
+ channel: "slack",
571
+ messageId
626
572
  }),
627
573
  kind: params.kind,
628
574
  threadId: params.threadTs
@@ -680,11 +626,6 @@ function parseEnterpriseEventRecipient(raw) {
680
626
  id: canonicalizeSlackApiTargetId("channel", match[1])
681
627
  };
682
628
  }
683
- function resolveSlackSendEventScope(scope) {
684
- if (!scope) return;
685
- if (!/^T[A-Z0-9]+$/i.test(scope.teamId) || !scope.client) throw new Error("invalid_enterprise_slack_listener_scope");
686
- return scope;
687
- }
688
629
  function resolveSlackDelivery(params) {
689
630
  if (params.eventScope) {
690
631
  if (!params.eventScope.writeClient) throw new Error("missing_enterprise_slack_write_client");
@@ -713,7 +654,7 @@ function resolveSlackDelivery(params) {
713
654
  client,
714
655
  ...client !== cachedClient ? { dmCacheOwner: cachedClient } : {},
715
656
  credential,
716
- identity: normalizeSlackSendIdentity(params.opts.identity) ?? getSlackDefaultSendIdentity(params.account.accountId),
657
+ identity: normalizeSlackSendIdentity(params.opts.identity) ?? slackDefaultSendIdentities.get(params.account.accountId),
717
658
  recipient: params.recipient,
718
659
  teamId: params.recipient.teamId,
719
660
  unfurl: params.recipient.teamId ? { unfurlMedia: params.account.config.unfurlMedia } : {
@@ -722,16 +663,8 @@ function resolveSlackDelivery(params) {
722
663
  }
723
664
  });
724
665
  }
725
- function createSlackSendQueueKey(params) {
726
- const recipientKey = `${params.recipient.kind}:${params.recipient.id}`;
727
- const workspaceScope = params.teamId ? `:${params.teamId}` : "";
728
- return `${params.accountId}:${createSlackTokenCacheKey(params.token)}${workspaceScope}:${recipientKey}:${params.threadTs ?? ""}`;
729
- }
730
- function resolvePostedMessageChannelId(response, fallback) {
731
- return (typeof response.channel === "string" ? normalizeOptionalString(response.channel) : null) ?? fallback;
732
- }
733
666
  async function resolveChannelId(client, recipient, params) {
734
- if (recipient.kind !== "user") return { channelId: recipient.id };
667
+ if (recipient.kind !== "user") return recipient.id;
735
668
  const cacheParams = {
736
669
  cacheOwner: params.dmCacheOwner ?? client,
737
670
  accountId: params.accountId,
@@ -739,19 +672,15 @@ async function resolveChannelId(client, recipient, params) {
739
672
  recipientId: recipient.id
740
673
  };
741
674
  const cachedChannelId = readCachedSlackDmChannelId(cacheParams);
742
- if (cachedChannelId) return { channelId: cachedChannelId };
675
+ if (cachedChannelId) return cachedChannelId;
743
676
  const channelId = (await withSlackDnsRequestRetry("conversations.open", () => client.conversations.open({ users: recipient.id })).catch(rethrowSlackPermanentOutboundApiRejection)).channel?.id;
744
677
  if (!channelId) throw new Error("Failed to open Slack DM channel");
745
678
  cacheSlackDmChannelId(cacheParams, channelId);
746
- return { channelId };
747
- }
748
- function resolveSlackTextChunkLimit(params) {
749
- const configuredLimit = params.textLimit ?? resolveTextChunkLimit(params.cfg, "slack", params.accountId, { fallbackLimit: 8e3 });
750
- return Math.min(configuredLimit, SLACK_TEXT_LIMIT);
679
+ return channelId;
751
680
  }
752
681
  function resolveSlackTextChunks(params) {
753
- const text = params.preservePlainText ? params.text : params.text.trim();
754
- const chunkLimit = resolveSlackTextChunkLimit(params);
682
+ const text = params.text;
683
+ const chunkLimit = params.chunkLimit;
755
684
  if (params.preservePlainText) return text ? chunkTextForOutbound(text, chunkLimit, { preserveWhitespace: true }) : [];
756
685
  if (params.textIsSlackMrkdwn) return resolveTextChunksWithFallback(text, chunkSlackMrkdwnText(text, chunkLimit));
757
686
  const tableMode = resolveMarkdownTableMode({
@@ -764,13 +693,13 @@ function resolveSlackTextChunks(params) {
764
693
  return resolveTextChunksWithFallback(text, chunks);
765
694
  }
766
695
  async function resolveSlackDmChannelId(params) {
767
- return (await resolveChannelId(params.client, {
696
+ return await resolveChannelId(params.client, {
768
697
  kind: "user",
769
698
  id: params.userId
770
699
  }, {
771
700
  accountId: params.accountId,
772
701
  token: params.token
773
- })).channelId;
702
+ });
774
703
  }
775
704
  function createSlackDeliveryMetadataId(queueId) {
776
705
  const normalized = normalizeOptionalString(queueId);
@@ -820,6 +749,13 @@ function formatSlackTimestampFromMs(ms) {
820
749
  function asSlackConversationMessages(response) {
821
750
  return Array.isArray(response.messages) ? response.messages.filter((message) => typeof message === "object" && message !== null && !Array.isArray(message)) : [];
822
751
  }
752
+ function unresolvedSlackDelivery(error, retryable) {
753
+ return {
754
+ status: "unresolved",
755
+ error,
756
+ retryable
757
+ };
758
+ }
823
759
  const SLACK_RECONCILIATION_EVIDENCE_RANK = {
824
760
  none: 0,
825
761
  partial: 1,
@@ -829,11 +765,8 @@ const SLACK_RECONCILIATION_EVIDENCE_RANK = {
829
765
  function findSlackConversationDeliveryParts(params) {
830
766
  const matches = [];
831
767
  for (const message of params.messages) {
832
- if (!message.metadata || typeof message.metadata !== "object" || Array.isArray(message.metadata)) continue;
833
- const eventPayload = message.metadata.event_payload;
834
- if (!eventPayload || typeof eventPayload !== "object" || Array.isArray(eventPayload)) continue;
835
- const marker = eventPayload;
836
- if (marker[SLACK_DELIVERY_METADATA_KEY] !== params.deliveryId) continue;
768
+ const marker = asOptionalRecord(asOptionalRecord(message.metadata)?.event_payload);
769
+ if (!marker || marker[SLACK_DELIVERY_METADATA_KEY] !== params.deliveryId) continue;
837
770
  const partIndex = marker[SLACK_DELIVERY_METADATA_PART_INDEX_KEY];
838
771
  const partCount = marker[SLACK_DELIVERY_METADATA_PART_COUNT_KEY];
839
772
  if (typeof partIndex !== "number" || !Number.isInteger(partIndex) || typeof partCount !== "number" || !Number.isInteger(partCount) || partIndex < 0 || partCount <= 0 || partIndex >= partCount) continue;
@@ -887,11 +820,7 @@ async function scanSlackConversationForDelivery(params) {
887
820
  expectedPartCount ??= match.partCount;
888
821
  const existing = deliveryParts.get(match.partIndex);
889
822
  if (expectedPartCount !== match.partCount || existing && existing.messageId !== match.messageId) return {
890
- reconciliation: {
891
- status: "unresolved",
892
- error: "Slack history contains conflicting durable delivery markers",
893
- retryable: false
894
- },
823
+ reconciliation: unresolvedSlackDelivery("Slack history contains conflicting durable delivery markers", false),
895
824
  evidence: "conflict"
896
825
  };
897
826
  deliveryParts.set(match.partIndex, match);
@@ -918,22 +847,14 @@ async function scanSlackConversationForDelivery(params) {
918
847
  if (!nextCursor) {
919
848
  if (response.has_more === true) break;
920
849
  return {
921
- reconciliation: {
922
- status: "unresolved",
923
- error: deliveryParts.size > 0 ? "Slack history contains an incomplete durable delivery marker set" : "Slack history contains no exact durable delivery marker",
924
- retryable: params.retryCount < 2
925
- },
850
+ reconciliation: unresolvedSlackDelivery(deliveryParts.size > 0 ? "Slack history contains an incomplete durable delivery marker set" : "Slack history contains no exact durable delivery marker", params.retryCount < 2),
926
851
  evidence: deliveryParts.size > 0 ? "partial" : "none"
927
852
  };
928
853
  }
929
854
  cursor = nextCursor;
930
855
  }
931
856
  return {
932
- reconciliation: {
933
- status: "unresolved",
934
- error: "Slack unknown-send reconciliation exceeded its history page budget",
935
- retryable: params.retryCount < 2
936
- },
857
+ reconciliation: unresolvedSlackDelivery("Slack unknown-send reconciliation exceeded its history page budget", params.retryCount < 2),
937
858
  evidence: deliveryParts.size > 0 ? "partial" : "none"
938
859
  };
939
860
  }
@@ -944,34 +865,18 @@ async function reconcileSlackUnknownSend(ctx) {
944
865
  accountId: ctx.accountId ?? void 0
945
866
  });
946
867
  const deliveryId = createSlackDeliveryMetadataId(ctx.queueId);
947
- if (!deliveryId) return {
948
- status: "unresolved",
949
- error: "Slack unknown-send reconciliation requires a durable delivery id",
950
- retryable: false
951
- };
868
+ if (!deliveryId) return unresolvedSlackDelivery("Slack unknown-send reconciliation requires a durable delivery id", false);
952
869
  const recipient = parseRecipient(ctx.to);
953
870
  try {
954
871
  assertSlackDetachedTargetAllowed(account.accountId, recipient.teamId);
955
872
  } catch (error) {
956
- return {
957
- status: "unresolved",
958
- error: error instanceof Error ? error.message : String(error),
959
- retryable: false
960
- };
873
+ return unresolvedSlackDelivery(error instanceof Error ? error.message : String(error), false);
961
874
  }
962
875
  const readToken = resolveSlackOperationToken(account, "read");
963
- if (!readToken) return {
964
- status: "unresolved",
965
- error: `Slack read token missing for account "${account.accountId}"`,
966
- retryable: false
967
- };
876
+ if (!readToken) return unresolvedSlackDelivery(`Slack read token missing for account "${account.accountId}"`, false);
968
877
  const userRecipient = recipient.kind === "user";
969
878
  const writeToken = resolveSlackOperationToken(account, "write");
970
- if (userRecipient && !writeToken) return {
971
- status: "unresolved",
972
- error: `Slack write token missing for direct-message reconciliation on account "${account.accountId}"`,
973
- retryable: false
974
- };
879
+ if (userRecipient && !writeToken) return unresolvedSlackDelivery(`Slack write token missing for direct-message reconciliation on account "${account.accountId}"`, false);
975
880
  const readClient = createSlackReadClient(readToken, { teamId: recipient.teamId });
976
881
  const writeClient = writeToken ? getSlackWriteClient(writeToken, { teamId: recipient.teamId }) : void 0;
977
882
  const payloadReplyToId = ctx.payloads[0]?.replyToId;
@@ -987,7 +892,7 @@ async function reconcileSlackUnknownSend(ctx) {
987
892
  const channelClient = userRecipient ? writeClient : readClient;
988
893
  const channelToken = userRecipient ? writeToken : readToken;
989
894
  if (!channelClient || !channelToken) throw new Error(`Slack channel resolution token missing for account "${account.accountId}"`);
990
- const { channelId } = await resolveChannelId(channelClient, recipient, {
895
+ const channelId = await resolveChannelId(channelClient, recipient, {
991
896
  accountId: account.accountId,
992
897
  token: channelToken
993
898
  });
@@ -1013,11 +918,7 @@ async function reconcileSlackUnknownSend(ctx) {
1013
918
  if (bestUnresolvedScan) return bestUnresolvedScan.reconciliation;
1014
919
  throw lookupError;
1015
920
  } catch (err) {
1016
- return {
1017
- status: "unresolved",
1018
- error: readSlackRequestErrorMessage(enrichSlackWebApiError(err)),
1019
- retryable: ctx.retryCount < 3
1020
- };
921
+ return unresolvedSlackDelivery(readSlackRequestErrorMessage(enrichSlackWebApiError(err)), ctx.retryCount < 3);
1021
922
  }
1022
923
  }
1023
924
  async function sendMessageSlack(to, message, opts) {
@@ -1028,7 +929,8 @@ async function sendMessageSlack(to, message, opts) {
1028
929
  cfg,
1029
930
  accountId: opts.accountId
1030
931
  });
1031
- const eventScope = resolveSlackSendEventScope(opts.eventScope);
932
+ const eventScope = opts.eventScope;
933
+ if (eventScope && (!/^T[A-Z0-9]+$/i.test(eventScope.teamId) || !eventScope.client)) throw new Error("invalid_enterprise_slack_listener_scope");
1032
934
  const recipient = eventScope ? parseEnterpriseEventRecipient(to) : parseRecipient(to);
1033
935
  if (!eventScope) assertSlackDetachedTargetAllowed(account.accountId, recipient.teamId);
1034
936
  const blocks = opts.blocks == null ? void 0 : validateSlackBlocksArray(opts.blocks);
@@ -1040,13 +942,8 @@ async function sendMessageSlack(to, message, opts) {
1040
942
  opts: queuedOpts,
1041
943
  recipient
1042
944
  });
1043
- const queueKey = createSlackSendQueueKey({
1044
- accountId: account.accountId,
1045
- token: delivery.credential,
1046
- recipient: delivery.recipient,
1047
- threadTs: opts.threadTs,
1048
- teamId: delivery.teamId
1049
- });
945
+ const workspaceScope = delivery.teamId ? `:${delivery.teamId}` : "";
946
+ const queueKey = `${account.accountId}:${createSlackTokenCacheKey(delivery.credential)}${workspaceScope}:${delivery.recipient.kind}:${delivery.recipient.id}:${opts.threadTs ?? ""}`;
1050
947
  const result = await slackSendQueue.enqueue(queueKey, () => sendMessageSlackQueued({
1051
948
  trimmedMessage,
1052
949
  opts: queuedOpts,
@@ -1066,7 +963,7 @@ async function sendMessageSlackQueued(params) {
1066
963
  const { client, identity, recipient, unfurl } = delivery;
1067
964
  if (opts.replyBroadcast && opts.mediaUrl) throw new Error("Slack replyBroadcast is only supported for text or block thread replies.");
1068
965
  const directUserPostChannelId = !opts.deliveryQueueId && recipient.kind === "user" && !opts.mediaUrl && !opts.threadTs ? recipient.id : void 0;
1069
- const { channelId } = directUserPostChannelId ? { channelId: directUserPostChannelId } : await resolveChannelId(client, recipient, {
966
+ const channelId = directUserPostChannelId ? directUserPostChannelId : await resolveChannelId(client, recipient, {
1070
967
  accountId: account.accountId,
1071
968
  token: delivery.credential,
1072
969
  ...delivery.dmCacheOwner ? { dmCacheOwner: delivery.dmCacheOwner } : {}
@@ -1096,11 +993,7 @@ async function sendMessageSlackQueued(params) {
1096
993
  const authoredTextPlacement = opts.authoredTextPlacement ?? "outside-blocks";
1097
994
  const nativeDataFallbackBase = blocks && authoredTextPlacement === "outside-blocks" ? explicitNativeDataFallbackBase ?? trimmedMessage : "";
1098
995
  const hasNativeData = Boolean(blocks && hasSlackNativeDataBlock(blocks));
1099
- const textChunkLimit = resolveSlackTextChunkLimit({
1100
- cfg,
1101
- accountId: account.accountId,
1102
- ...opts.textLimit !== void 0 ? { textLimit: opts.textLimit } : {}
1103
- });
996
+ const textChunkLimit = Math.min(opts.textLimit ?? resolveTextChunkLimit(cfg, "slack", account.accountId, { fallbackLimit: 8e3 }), SLACK_TEXT_LIMIT);
1104
997
  const usesOrderedBlockAccessibility = Boolean(blocks && (hasNativeData || opts.authoredTextPlacement !== void 0));
1105
998
  const orderedBlockDeliveryPlan = blocks && usesOrderedBlockAccessibility ? buildSlackNativeDataDeliveryPlan({
1106
999
  baseText: nativeDataFallbackBase,
@@ -1127,7 +1020,7 @@ async function sendMessageSlackQueued(params) {
1127
1020
  const { response } = posted;
1128
1021
  sendIdentity = posted.identity;
1129
1022
  lastMessageId = response.ts;
1130
- deliveredChannelId = resolvePostedMessageChannelId(response, deliveredChannelId);
1023
+ deliveredChannelId = (typeof response.channel === "string" ? normalizeOptionalString(response.channel) : null) ?? deliveredChannelId;
1131
1024
  const responseThreadTs = resolvePostedMessageThreadTs(response);
1132
1025
  canonicalDeliveredThreadTs ??= responseThreadTs;
1133
1026
  return await reportDelivery(createSlackSendResult(response.ts, deliveredChannelId, part.blocks ? "card" : "text", responseThreadTs ?? normalizeSlackThreadTsCandidate(opts.threadTs)), part.blocks);
@@ -1159,74 +1052,50 @@ async function sendMessageSlackQueued(params) {
1159
1052
  pendingBlockFallback = orderedBlockDeliveryPlan;
1160
1053
  }
1161
1054
  }
1162
- if (pendingBlockFallback) {
1163
- const fallbackMessages = pendingBlockFallback.fallbackMessages;
1164
- let questionDelivery;
1165
- for (const [partIndex, fallback] of fallbackMessages.entries()) {
1166
- const metadata = withSlackDeliveryMetadata(partIndex === 0 ? opts.metadata : void 0, {
1167
- queueId: opts.deliveryQueueId,
1168
- channelId,
1169
- threadTs: opts.threadTs,
1170
- partIndex,
1171
- partCount: fallbackMessages.length
1172
- });
1173
- if (partIndex === 0) await dispatchOnce();
1174
- const fallbackDelivery = await postPart({
1175
- text: fallback.text,
1176
- replyBroadcast: partIndex === 0 ? opts.replyBroadcast : void 0,
1177
- ...fallback.blocks ? { blocks: fallback.blocks } : {},
1178
- metadata,
1179
- mrkdwn: false
1180
- });
1181
- if (fallbackDelivery.meta?.slackQuestionActionIds.length) questionDelivery = fallbackDelivery;
1182
- }
1183
- const deliveredThreadTs = canonicalDeliveredThreadTs ?? normalizeSlackThreadTsCandidate(opts.threadTs);
1184
- return {
1185
- messageId: lastMessageId,
1186
- channelId: deliveredChannelId,
1187
- threadTs: deliveredThreadTs,
1188
- ...questionDelivery?.meta ? { meta: {
1189
- ...questionDelivery.meta,
1190
- slackQuestionMessageId: questionDelivery.messageId
1191
- } } : {},
1192
- receipt: createSlackSendReceiptFromResults(deliveredResults, deliveredThreadTs)
1193
- };
1194
- }
1195
1055
  }
1196
- const resolvedChunks = resolveSlackTextChunks({
1197
- cfg,
1198
- accountId: account.accountId,
1199
- text: trimmedMessage,
1200
- textLimit: textChunkLimit,
1201
- ...opts.textIsSlackMrkdwn ? { textIsSlackMrkdwn: true } : {},
1202
- ...opts.textIsSlackPlainText ? { preservePlainText: true } : {}
1203
- });
1204
- const mediaMaxBytes = opts.mediaMaxBytes ?? (typeof account.config.mediaMaxMb === "number" ? account.config.mediaMaxMb * 1024 * 1024 : void 0);
1205
- let chunksToPost;
1206
- if (opts.mediaUrl) {
1207
- const [firstChunk, ...rest] = resolvedChunks;
1208
- lastMessageId = await uploadSlackFile({
1209
- client: delivery.upload?.client ?? client,
1210
- completionClient: client,
1211
- channelId,
1212
- mediaUrl: opts.mediaUrl,
1213
- mediaAccess: opts.mediaAccess,
1214
- uploadFileName: opts.uploadFileName,
1215
- uploadTitle: opts.uploadTitle,
1216
- mediaLocalRoots: opts.mediaLocalRoots,
1217
- mediaReadFile: opts.mediaReadFile,
1218
- caption: firstChunk,
1219
- threadTs: opts.threadTs,
1220
- maxBytes: mediaMaxBytes,
1221
- ...opts.forceDocument ? { optimizeImages: false } : {},
1222
- onPlatformSendDispatch: dispatchOnce,
1223
- assertDirectAdapterHandoff: opts.assertDirectAdapterHandoff,
1224
- ...delivery.upload ? { auditContext: delivery.upload.auditContext } : {}
1056
+ let messages;
1057
+ if (pendingBlockFallback) messages = pendingBlockFallback.fallbackMessages;
1058
+ else {
1059
+ const resolvedChunks = resolveSlackTextChunks({
1060
+ cfg,
1061
+ accountId: account.accountId,
1062
+ text: trimmedMessage,
1063
+ chunkLimit: textChunkLimit,
1064
+ ...opts.textIsSlackMrkdwn ? { textIsSlackMrkdwn: true } : {},
1065
+ ...opts.textIsSlackPlainText ? { preservePlainText: true } : {}
1225
1066
  });
1226
- await reportDelivery(createSlackSendResult(lastMessageId, channelId, "media", normalizeSlackThreadTsCandidate(opts.threadTs)));
1227
- chunksToPost = rest;
1228
- } else chunksToPost = resolvedChunks.length ? resolvedChunks : [""];
1229
- for (const [partIndex, chunk] of chunksToPost.entries()) {
1067
+ const mediaMaxBytes = opts.mediaMaxBytes ?? (typeof account.config.mediaMaxMb === "number" ? account.config.mediaMaxMb * 1024 * 1024 : void 0);
1068
+ let chunksToPost;
1069
+ if (opts.mediaUrl) {
1070
+ const [firstChunk, ...rest] = resolvedChunks;
1071
+ lastMessageId = await uploadSlackFile({
1072
+ client: delivery.upload?.client ?? client,
1073
+ completionClient: client,
1074
+ channelId,
1075
+ mediaUrl: opts.mediaUrl,
1076
+ mediaAccess: opts.mediaAccess,
1077
+ uploadFileName: opts.uploadFileName,
1078
+ uploadTitle: opts.uploadTitle,
1079
+ mediaLocalRoots: opts.mediaLocalRoots,
1080
+ mediaReadFile: opts.mediaReadFile,
1081
+ caption: firstChunk,
1082
+ threadTs: opts.threadTs,
1083
+ maxBytes: mediaMaxBytes,
1084
+ ...opts.forceDocument ? { optimizeImages: false } : {},
1085
+ onPlatformSendDispatch: dispatchOnce,
1086
+ assertDirectAdapterHandoff: opts.assertDirectAdapterHandoff,
1087
+ ...delivery.upload ? { auditContext: delivery.upload.auditContext } : {}
1088
+ });
1089
+ await reportDelivery(createSlackSendResult(lastMessageId, channelId, "media", normalizeSlackThreadTsCandidate(opts.threadTs)));
1090
+ chunksToPost = rest;
1091
+ } else chunksToPost = resolvedChunks.length ? resolvedChunks : [""];
1092
+ messages = chunksToPost.map((text) => opts.textIsSlackPlainText ? {
1093
+ text,
1094
+ mrkdwn: false
1095
+ } : { text });
1096
+ }
1097
+ let questionDelivery;
1098
+ for (const [partIndex, part] of messages.entries()) {
1230
1099
  const carriesPrimaryMessageOptions = partIndex === 0 && !opts.mediaUrl;
1231
1100
  const baseMetadata = carriesPrimaryMessageOptions ? opts.metadata : void 0;
1232
1101
  const metadata = opts.mediaUrl ? baseMetadata : withSlackDeliveryMetadata(baseMetadata, {
@@ -1234,21 +1103,25 @@ async function sendMessageSlackQueued(params) {
1234
1103
  channelId,
1235
1104
  threadTs: opts.threadTs,
1236
1105
  partIndex,
1237
- partCount: chunksToPost.length
1106
+ partCount: messages.length
1238
1107
  });
1239
1108
  if (partIndex === 0 && !opts.mediaUrl) await dispatchOnce();
1240
- await postPart({
1241
- text: chunk,
1109
+ const partDelivery = await postPart({
1110
+ ...part,
1242
1111
  replyBroadcast: carriesPrimaryMessageOptions ? opts.replyBroadcast : void 0,
1243
- metadata,
1244
- ...opts.textIsSlackPlainText ? { mrkdwn: false } : {}
1112
+ metadata
1245
1113
  });
1114
+ if (pendingBlockFallback && partDelivery.meta?.slackQuestionActionIds.length) questionDelivery = partDelivery;
1246
1115
  }
1247
1116
  const deliveredThreadTs = canonicalDeliveredThreadTs ?? normalizeSlackThreadTsCandidate(opts.threadTs);
1248
1117
  return {
1249
1118
  messageId: lastMessageId,
1250
1119
  channelId: deliveredChannelId,
1251
1120
  threadTs: deliveredThreadTs,
1121
+ ...questionDelivery?.meta ? { meta: {
1122
+ ...questionDelivery.meta,
1123
+ slackQuestionMessageId: questionDelivery.messageId
1124
+ } } : {},
1252
1125
  receipt: createSlackSendReceiptFromResults(deliveredResults, deliveredThreadTs)
1253
1126
  };
1254
1127
  }