@openclaw/slack 2026.8.1-beta.3 → 2026.8.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 (237) hide show
  1. package/dist/account-configured-sUohAxZr.js +33 -0
  2. package/dist/account-inspect-CN2hBsim.js +87 -0
  3. package/dist/account-inspect-api.js +1 -1
  4. package/dist/{accounts-BlzxuYle.js → accounts-Dm_H77gH.js} +7 -10
  5. package/dist/{accounts.runtime-CbabBL8x.js → accounts.runtime-DRuEK6mL.js} +1 -1
  6. package/dist/{action-runtime-D6jg2CQd.js → action-runtime-044ldvNL.js} +53 -48
  7. package/dist/action-runtime.runtime-BL3KzX13.js +2 -0
  8. package/dist/{actions-DFk0ANVB.js → actions-BI7JkfVm.js} +266 -96
  9. package/dist/api.js +12 -12
  10. package/dist/{approval-handler.runtime-BNvAoKdK.js → approval-handler.runtime-DYv0UIZS.js} +53 -176
  11. package/dist/{channel-CA5w7qDF.js → channel-1vIJOzPx.js} +77 -142
  12. package/dist/channel-config-api.js +1 -1
  13. package/dist/channel-plugin-api.js +1 -1
  14. package/dist/{channel-type-CZWv55Wu.js → channel-type-DlFSKeIZ.js} +3 -3
  15. package/dist/{channel.setup-CpyYsEXH.js → channel.setup-ofDi3_Pu.js} +34 -49
  16. package/dist/{config-schema-CN3XZRX5.js → config-schema-BVIMyiDN.js} +19 -12
  17. package/dist/configured-state.js +34 -0
  18. package/dist/{directory-config-BGYyuzWh.js → directory-config-DqfQ42OV.js} +1 -1
  19. package/dist/directory-contract-api.js +1 -1
  20. package/dist/{directory-live-DjUJQLbq.js → directory-live-BPaNHjmP.js} +2 -2
  21. package/dist/{group-policy-DyfB_ZIE.js → group-policy-BdwszjYn.js} +581 -743
  22. package/dist/{message-tool-api-CqMr5Rmc.js → message-tool-api-CJ0kjcg5.js} +23 -5
  23. package/dist/message-tool-api.js +1 -1
  24. package/dist/{monitor-Chrecrb9.js → monitor-Dq5Cmrvp.js} +3 -3
  25. package/dist/{outbound-adapter-DuRqAQXK.js → outbound-adapter-DYaI8ThX.js} +93 -68
  26. package/dist/{pipeline.runtime-Bbfd5VFW.js → pipeline.runtime-Bd22U0ga.js} +128 -160
  27. package/dist/{policy-BKXSxrIS.js → policy-CtQVbde1.js} +2 -1
  28. package/dist/{probe-BVA65leh.js → probe-0usmAb0i.js} +209 -22
  29. package/dist/{provider-CUUiwsg2.js → provider-CN_8hFv2.js} +243 -146
  30. package/dist/{relay-source-mhpMMRG-.js → relay-source-BNGpsdwV.js} +1 -1
  31. package/dist/{replies-SnWyXcsL.js → replies-BSiRQOJ1.js} +15 -5
  32. package/dist/{resolve-channels-BSpqC8jU.js → resolve-channels-Czheznc8.js} +1 -1
  33. package/dist/{resolve-users-Dvz9pDe0.js → resolve-users-BAOlNimr.js} +1 -1
  34. package/dist/runtime-api.js +11 -11
  35. package/dist/{scopes-BSk4GZvZ.js → scopes-COSlmhnH.js} +1 -1
  36. package/dist/{send-CtnOxKCc.js → send-DS9ICrBI.js} +39 -31
  37. package/dist/send-results-eeOu_HYm.js +23 -0
  38. package/dist/{send.runtime-kYctMHSd.js → send.runtime-D_Bb6IuH.js} +1 -1
  39. package/dist/setup-plugin-api.js +1 -1
  40. package/dist/{setup-surface-BPFfp6So.js → setup-surface-BGnd2pSe.js} +6 -6
  41. package/dist/{shared-DJBaslN7.js → shared-D5B-5hBg.js} +26 -6
  42. package/dist/{slash-dispatch.runtime-Cf2FTrnf.js → slash-dispatch.runtime-CilDmI0c.js} +3 -3
  43. package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
  44. package/node_modules/@slack/bolt/node_modules/@types/node/child_process.d.ts +0 -1
  45. package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +6 -6
  46. package/node_modules/@slack/bolt/node_modules/@types/node/dns/promises.d.ts +5 -5
  47. package/node_modules/@slack/bolt/node_modules/@types/node/dns.d.ts +5 -5
  48. package/node_modules/@slack/bolt/node_modules/@types/node/fs.d.ts +7 -0
  49. package/node_modules/@slack/bolt/node_modules/@types/node/http.d.ts +30 -0
  50. package/node_modules/@slack/bolt/node_modules/@types/node/http2.d.ts +4 -4
  51. package/node_modules/@slack/bolt/node_modules/@types/node/os.d.ts +30 -30
  52. package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
  53. package/node_modules/@slack/bolt/node_modules/@types/node/perf_hooks.d.ts +2 -1
  54. package/node_modules/@slack/bolt/node_modules/@types/node/process.d.ts +42 -43
  55. package/node_modules/@slack/bolt/node_modules/@types/node/quic.d.ts +1049 -84
  56. package/node_modules/@slack/bolt/node_modules/@types/node/sqlite.d.ts +14 -1
  57. package/node_modules/@slack/bolt/node_modules/@types/node/stream/iter.d.ts +3 -2
  58. package/node_modules/@slack/bolt/node_modules/@types/node/test.d.ts +61 -0
  59. package/node_modules/@slack/bolt/node_modules/@types/node/v8.d.ts +20 -23
  60. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/README.md +2 -0
  61. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
  62. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
  63. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
  64. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/package.json +1 -1
  65. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/README.md +2 -0
  66. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
  67. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
  68. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
  69. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/package.json +1 -1
  70. package/node_modules/@slack/socket-mode/node_modules/@types/node/README.md +1 -1
  71. package/node_modules/@slack/socket-mode/node_modules/@types/node/child_process.d.ts +0 -1
  72. package/node_modules/@slack/socket-mode/node_modules/@types/node/crypto.d.ts +6 -6
  73. package/node_modules/@slack/socket-mode/node_modules/@types/node/dns/promises.d.ts +5 -5
  74. package/node_modules/@slack/socket-mode/node_modules/@types/node/dns.d.ts +5 -5
  75. package/node_modules/@slack/socket-mode/node_modules/@types/node/fs.d.ts +7 -0
  76. package/node_modules/@slack/socket-mode/node_modules/@types/node/http.d.ts +30 -0
  77. package/node_modules/@slack/socket-mode/node_modules/@types/node/http2.d.ts +4 -4
  78. package/node_modules/@slack/socket-mode/node_modules/@types/node/os.d.ts +30 -30
  79. package/node_modules/@slack/socket-mode/node_modules/@types/node/package.json +2 -2
  80. package/node_modules/@slack/socket-mode/node_modules/@types/node/perf_hooks.d.ts +2 -1
  81. package/node_modules/@slack/socket-mode/node_modules/@types/node/process.d.ts +42 -43
  82. package/node_modules/@slack/socket-mode/node_modules/@types/node/quic.d.ts +1049 -84
  83. package/node_modules/@slack/socket-mode/node_modules/@types/node/sqlite.d.ts +14 -1
  84. package/node_modules/@slack/socket-mode/node_modules/@types/node/stream/iter.d.ts +3 -2
  85. package/node_modules/@slack/socket-mode/node_modules/@types/node/test.d.ts +61 -0
  86. package/node_modules/@slack/socket-mode/node_modules/@types/node/v8.d.ts +20 -23
  87. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
  88. package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +0 -1
  89. package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +6 -6
  90. package/node_modules/@slack/web-api/node_modules/@types/node/dns/promises.d.ts +5 -5
  91. package/node_modules/@slack/web-api/node_modules/@types/node/dns.d.ts +5 -5
  92. package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +7 -0
  93. package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +30 -0
  94. package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +4 -4
  95. package/node_modules/@slack/web-api/node_modules/@types/node/os.d.ts +30 -30
  96. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
  97. package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +2 -1
  98. package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +42 -43
  99. package/node_modules/@slack/web-api/node_modules/@types/node/quic.d.ts +1049 -84
  100. package/node_modules/@slack/web-api/node_modules/@types/node/sqlite.d.ts +14 -1
  101. package/node_modules/@slack/web-api/node_modules/@types/node/stream/iter.d.ts +3 -2
  102. package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +61 -0
  103. package/node_modules/@slack/web-api/node_modules/@types/node/v8.d.ts +20 -23
  104. package/node_modules/typebox/build/format/date.d.mts +1 -1
  105. package/node_modules/typebox/build/format/date.mjs +1 -1
  106. package/node_modules/typebox/build/format/date_time.d.mts +2 -2
  107. package/node_modules/typebox/build/format/date_time.mjs +3 -3
  108. package/node_modules/typebox/build/format/email.d.mts +1 -1
  109. package/node_modules/typebox/build/format/email.mjs +2 -2
  110. package/node_modules/typebox/build/format/hostname.mjs +2 -10
  111. package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
  112. package/node_modules/typebox/build/format/idn_email.mjs +3 -3
  113. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
  114. package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
  115. package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
  116. package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
  117. package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
  118. package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
  119. package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
  120. package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
  121. package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
  122. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
  123. package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
  124. package/node_modules/typebox/build/format/idna/index.mjs +2 -0
  125. package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
  126. package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
  127. package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
  128. package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
  129. package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
  130. package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
  131. package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
  132. package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
  133. package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
  134. package/node_modules/typebox/build/format/ipv4.mjs +2 -32
  135. package/node_modules/typebox/build/format/ipv6.mjs +2 -61
  136. package/node_modules/typebox/build/format/iri.d.mts +2 -2
  137. package/node_modules/typebox/build/format/iri.mjs +26 -8
  138. package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
  139. package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
  140. package/node_modules/typebox/build/format/regex.d.mts +1 -2
  141. package/node_modules/typebox/build/format/regex.mjs +2 -6
  142. package/node_modules/typebox/build/format/time.d.mts +2 -2
  143. package/node_modules/typebox/build/format/time.mjs +19 -14
  144. package/node_modules/typebox/build/format/uri.d.mts +1 -1
  145. package/node_modules/typebox/build/format/uri.mjs +3 -130
  146. package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
  147. package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
  148. package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
  149. package/node_modules/typebox/build/format/uri_template.mjs +4 -5
  150. package/node_modules/typebox/build/format/url.d.mts +3 -3
  151. package/node_modules/typebox/build/format/url.mjs +4 -5
  152. package/node_modules/typebox/build/guard/emit.d.mts +3 -1
  153. package/node_modules/typebox/build/guard/emit.mjs +12 -5
  154. package/node_modules/typebox/build/guard/guard.d.mts +8 -2
  155. package/node_modules/typebox/build/guard/guard.mjs +25 -4
  156. package/node_modules/typebox/build/guard/string.d.mts +2 -2
  157. package/node_modules/typebox/build/guard/string.mjs +7 -7
  158. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
  159. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
  160. package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
  161. package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
  162. package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
  163. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
  164. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
  165. package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
  166. package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
  167. package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
  168. package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
  169. package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
  170. package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
  171. package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
  172. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
  173. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
  174. package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
  175. package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
  176. package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
  177. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
  178. package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
  179. package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
  180. package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
  181. package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
  182. package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
  183. package/node_modules/typebox/build/schema/types/index.mjs +0 -2
  184. package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
  185. package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
  186. package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
  187. package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
  188. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
  189. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
  190. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
  191. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
  192. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
  193. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
  194. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
  195. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
  196. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
  197. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
  198. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
  199. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
  200. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
  201. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
  202. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
  203. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
  204. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
  205. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
  206. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
  207. package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
  208. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
  209. package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
  210. package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
  211. package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
  212. package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
  213. package/node_modules/typebox/build/type/script/parser.mjs +27 -23
  214. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  215. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  216. package/node_modules/typebox/package.json +27 -27
  217. package/node_modules/typebox/readme.md +79 -82
  218. package/node_modules/ws/lib/permessage-deflate.js +3 -1
  219. package/node_modules/ws/package.json +1 -1
  220. package/openclaw.plugin.json +14 -6
  221. package/package.json +9 -7
  222. package/dist/account-configured-BwfXBo_F.js +0 -14
  223. package/dist/account-inspect-YJvFBbCR.js +0 -89
  224. package/dist/action-runtime.runtime-JtoOK9l5.js +0 -2
  225. package/dist/actions.runtime-CYLsYRai.js +0 -2
  226. package/dist/runtime-api-DBi7xc_g.js +0 -10
  227. package/dist/slack-client-kind-BXyOOICI.js +0 -94
  228. package/node_modules/typebox/build/format/_idna.d.mts +0 -2
  229. package/node_modules/typebox/build/format/_idna.mjs +0 -246
  230. package/node_modules/typebox/build/format/_puny.d.mts +0 -1
  231. package/node_modules/typebox/build/format/_puny.mjs +0 -77
  232. package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
  233. package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
  234. package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
  235. package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
  236. package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
  237. package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
@@ -1,12 +1,14 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { a as resolveSlackAccount, f as resolveSlackBotToken } from "./accounts-BlzxuYle.js";
3
- import { B as SLACK_EDIT_TEXT_MAX_BYTES, F as normalizeSlackOutboundText, I as buildSlackBlocksFallbackText, L as buildSlackCompleteBlocksFallbackText, Lt as SLACK_PRIVATE_ACTION_DELIVERY_RESULT, M as stripSlackNativeDataBlocks, O as hasSlackNativeDataBlock, T as appendSlackNativeDataPlainTextFallback, Y as truncateSlackTextByUtf8Bytes, ct as escapeSlackMrkdwn, g as assertSlackDetachedTargetAllowed, k as isSlackInvalidBlocksError, mt as validateSlackBlocksArray, q as countSlackTextUtf8Bytes, w as appendSlackNativeDataFallbackText } from "./group-policy-DyfB_ZIE.js";
4
- import { d as getSlackWriteClient, i as createSlackLookupClient } from "./probe-BVA65leh.js";
5
- import { c as resolveSlackMessageText, i as hasSlackMessageTableBlock, n as fetchWithRuntimeDispatcher, r as saveRemoteMedia, t as isGovSlackClient } from "./slack-client-kind-BXyOOICI.js";
6
- import { m as buildSlackNativeDataDeliveryPlan, r as sendMessageSlack } from "./send-CtnOxKCc.js";
2
+ import { a as resolveSlackAccount, f as resolveSlackBotToken, i as resolveDefaultSlackAccountId } from "./accounts-Dm_H77gH.js";
3
+ import { n as formatSlackTarget } from "./target-parsing-BnMD2ZqZ.js";
4
+ import { At as SLACK_PRIVATE_ACTION_DELIVERY_RESULT, D as renderSlackBlockFallbackText, E as buildSlackCompleteBlocksFallbackText, I as countSlackTextUtf8Bytes, Q as normalizeSlackOutboundText, R as truncateSlackTextByUtf8Bytes, T as buildSlackBlocksFallbackText, _ as appendSlackNativeDataPlainTextFallback, b as hasSlackNativeDataBlock, c as assertSlackDetachedTargetAllowed, et as escapeSlackMrkdwn, g as appendSlackNativeDataFallbackText, k as SLACK_EDIT_TEXT_MAX_BYTES, st as validateSlackBlocksArray, w as stripSlackNativeDataBlocks, x as isSlackInvalidBlocksError } from "./group-policy-BdwszjYn.js";
5
+ import { S as getSlackWriteClient, h as createSlackLookupClient } from "./probe-0usmAb0i.js";
6
+ import { m as buildSlackNativeDataDeliveryPlan, r as sendMessageSlack } from "./send-DS9ICrBI.js";
7
7
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
8
8
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
9
- import { logVerbose, logVerbose as logVerbose$1 } from "openclaw/plugin-sdk/runtime-env";
9
+ import { createSubsystemLogger, logVerbose, logVerbose as logVerbose$1 } from "openclaw/plugin-sdk/runtime-env";
10
+ import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
11
+ import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
10
12
  import { z } from "zod";
11
13
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
12
14
  import fs from "node:fs/promises";
@@ -14,6 +16,31 @@ import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime
14
16
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
15
17
  import { normalizeHostname } from "openclaw/plugin-sdk/host-runtime";
16
18
  import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
19
+ import { fetchWithRuntimeDispatcher } from "openclaw/plugin-sdk/runtime-fetch";
20
+ import { saveRemoteMedia } from "openclaw/plugin-sdk/media-runtime";
21
+ //#region extensions/slack/src/conversation-open.ts
22
+ function parseSlackConversationOpenInput(userIds, teamId) {
23
+ const users = z.array(z.string().trim().regex(/^[UW][A-Z0-9]+$/)).min(1).max(8).parse(userIds);
24
+ if (new Set(users).size !== users.length) throw new Error("Slack conversation-open requires distinct userIds.");
25
+ return {
26
+ users,
27
+ teamId: teamId === void 0 ? void 0 : z.string().trim().regex(/^T[A-Z0-9]+$/i).parse(teamId)
28
+ };
29
+ }
30
+ async function openSlackConversationWithClient(client, input) {
31
+ const channelId = (await client.conversations.open({ users: input.users.join(",") })).channel?.id?.trim();
32
+ if (!channelId || !/^[CDG][A-Z0-9]+$/i.test(channelId)) throw new Error("Slack conversations.open did not return a valid conversation ID.");
33
+ return {
34
+ channelId,
35
+ target: formatSlackTarget({
36
+ teamId: input.teamId,
37
+ kind: "channel",
38
+ id: channelId,
39
+ explicitKind: true
40
+ })
41
+ };
42
+ }
43
+ //#endregion
17
44
  //#region extensions/slack/src/edit-text.ts
18
45
  function buildSlackEditTextPayload(content, blocks) {
19
46
  const trimmedContent = content.trim();
@@ -27,6 +54,85 @@ function buildSlackEditTextPayload(content, blocks) {
27
54
  return " ";
28
55
  }
29
56
  //#endregion
57
+ //#region extensions/slack/src/monitor/block-text.ts
58
+ function readSlackBlockType(block) {
59
+ return block && typeof block === "object" && !Array.isArray(block) ? block.type : void 0;
60
+ }
61
+ function hasSlackTableBlock(blocks) {
62
+ return blocks?.some((block) => readSlackBlockType(block) === "table") ?? false;
63
+ }
64
+ function hasSlackMessageTableBlock(message) {
65
+ return hasSlackTableBlock(message.blocks) || message.attachments?.some((attachment) => !isSlackUnfurlAttachment(attachment) && hasSlackTableBlock(attachment.blocks)) === true;
66
+ }
67
+ function isSlackUnfurlAttachment(attachment) {
68
+ return attachment.is_msg_unfurl === true || attachment.is_app_unfurl === true || typeof attachment.app_unfurl_url === "string" && attachment.app_unfurl_url.trim().length > 0;
69
+ }
70
+ function resolveSlackBlocksText(blocks) {
71
+ if (!blocks?.length) return;
72
+ const parts = [];
73
+ let hasRichText = false;
74
+ let hasNativeData = false;
75
+ for (const block of blocks) {
76
+ const blockType = readSlackBlockType(block);
77
+ hasRichText ||= blockType === "rich_text";
78
+ hasNativeData ||= blockType === "data_visualization" || blockType === "data_table" || blockType === "table";
79
+ const text = renderSlackBlockFallbackText(block, {
80
+ nativeDataFormat: "plain",
81
+ nativeReferenceFormat: "plain"
82
+ });
83
+ if (text) parts.push(text);
84
+ }
85
+ return parts.length > 0 ? {
86
+ text: parts.join("\n"),
87
+ hasRichText,
88
+ hasNativeData
89
+ } : void 0;
90
+ }
91
+ function appendDistinctSlackText(base, addition) {
92
+ if (!base) return addition;
93
+ const comparableBase = `\n${base.replace(/\r\n?/g, "\n")}\n`;
94
+ const comparableAddition = `\n${addition.replace(/\r\n?/g, "\n")}\n`;
95
+ if (comparableBase.includes(comparableAddition)) return base;
96
+ return `${base}\n${addition}`;
97
+ }
98
+ function resolveSlackAttachmentTableTexts(attachments) {
99
+ const seen = /* @__PURE__ */ new Set();
100
+ const texts = [];
101
+ for (const attachment of attachments ?? []) {
102
+ if (isSlackUnfurlAttachment(attachment)) continue;
103
+ for (const block of attachment.blocks ?? []) {
104
+ if (readSlackBlockType(block) !== "table") continue;
105
+ const text = renderSlackBlockFallbackText(block, { nativeDataFormat: "plain" });
106
+ if (!text || seen.has(text)) continue;
107
+ seen.add(text);
108
+ texts.push(text);
109
+ }
110
+ }
111
+ return texts;
112
+ }
113
+ /** Resolve agent-visible Slack text while admitting only native tables from attachments. */
114
+ function resolveSlackMessageText(message, options = {}) {
115
+ let resolved = chooseSlackPrimaryText({
116
+ messageText: options.preserveMessageTextWhitespace ? typeof message.text === "string" && message.text.trim().length > 0 ? message.text : void 0 : normalizeOptionalString(message.text),
117
+ blocksText: resolveSlackBlocksText(message.blocks)
118
+ });
119
+ for (const tableText of resolveSlackAttachmentTableTexts(message.attachments)) resolved = appendDistinctSlackText(resolved, tableText);
120
+ return resolved;
121
+ }
122
+ function chooseSlackPrimaryText(params) {
123
+ const { messageText, blocksText } = params;
124
+ if (!blocksText) return messageText;
125
+ if (!messageText) return blocksText.text;
126
+ if (blocksText.hasNativeData) {
127
+ const comparableMessageText = messageText.replace(/\s+/g, " ").trim();
128
+ const comparableBlocksText = blocksText.text.replace(/\s+/g, " ").trim();
129
+ if (comparableMessageText.includes(comparableBlocksText)) return messageText;
130
+ return comparableBlocksText.startsWith(comparableMessageText) ? blocksText.text : `${messageText}\n${blocksText.text}`;
131
+ }
132
+ if (blocksText.hasRichText && blocksText.text.length > messageText.length) return blocksText.text;
133
+ return blocksText.text.length > messageText.length && blocksText.text.startsWith(messageText) ? blocksText.text : messageText;
134
+ }
135
+ //#endregion
30
136
  //#region extensions/slack/src/file-reference.ts
31
137
  function formatSlackFileReference(file) {
32
138
  const name = normalizeOptionalString(file?.name) ?? "file";
@@ -45,6 +151,21 @@ function formatSlackFileReferenceList(files) {
45
151
  return files.map((file) => formatSlackFileReference(file)).join(", ");
46
152
  }
47
153
  //#endregion
154
+ //#region extensions/slack/src/monitor/media.runtime.ts
155
+ const slackMediaLog = createSubsystemLogger("gateway/channels/slack").child("media");
156
+ //#endregion
157
+ //#region extensions/slack/src/monitor/slack-client-kind.ts
158
+ /** Detects the isolated GovSlack API plane without consulting mutable config. */
159
+ function isGovSlackClient(client) {
160
+ if (!client?.slackApiUrl) return false;
161
+ try {
162
+ const apiUrl = new URL(client.slackApiUrl);
163
+ return apiUrl.protocol === "https:" && !apiUrl.port && normalizeHostname(apiUrl.hostname) === "slack-gov.com";
164
+ } catch {
165
+ return false;
166
+ }
167
+ }
168
+ //#endregion
48
169
  //#region extensions/slack/src/monitor/media.ts
49
170
  var media_exports = /* @__PURE__ */ __exportAll({
50
171
  SLACK_MEDIA_READ_IDLE_TIMEOUT_MS: () => SLACK_MEDIA_READ_IDLE_TIMEOUT_MS,
@@ -180,10 +301,18 @@ async function looksLikeHtmlFile(filePath) {
180
301
  }
181
302
  const MAX_SLACK_MEDIA_CONCURRENCY = 3;
182
303
  const MAX_SLACK_FORWARDED_ATTACHMENTS = 8;
304
+ const SLACK_MEDIA_LIMIT_REASON = `omitted: 8-file limit`;
305
+ function formatSlackMediaFailure(error) {
306
+ return redactToolPayloadText(formatErrorMessage(error)).replace(/\s+/g, " ").slice(0, 200);
307
+ }
183
308
  async function fetchFreshSlackFileUrl(params) {
184
309
  if (!params.file.id || !params.client) return null;
185
310
  try {
186
311
  const freshFile = (await params.client.files.info({ file: params.file.id })).file;
312
+ if (freshFile && params.isRefreshedFileAllowed?.(freshFile) === false) {
313
+ logVerbose$1(`slack: refreshed file metadata rejected for file id=${params.file.id}`);
314
+ return null;
315
+ }
187
316
  const freshUrl = freshFile?.url_private_download ?? freshFile?.url_private;
188
317
  if (freshUrl) {
189
318
  logVerbose$1(`slack: refreshed file URL via files.info for file id=${params.file.id}`);
@@ -217,7 +346,7 @@ async function downloadSlackMediaFile(params) {
217
346
  if (!(fileMime === "text/html" || fileName.endsWith(".html") || fileName.endsWith(".htm"))) {
218
347
  if (normalizeOptionalLowercaseString(saved.contentType?.split(";")[0]) === "text/html" || await looksLikeHtmlFile(saved.path)) {
219
348
  await fs.rm(saved.path, { force: true }).catch(() => void 0);
220
- return null;
349
+ throw new Error("blocked: unexpected HTML content");
221
350
  }
222
351
  }
223
352
  const effectiveMime = resolveSlackMediaMimetype(params.file, saved.contentType);
@@ -226,6 +355,7 @@ async function downloadSlackMediaFile(params) {
226
355
  return {
227
356
  path: saved.path,
228
357
  ...contentType ? { contentType } : {},
358
+ ...label ? { fileName: label } : {},
229
359
  placeholder: `[Slack file: ${formatSlackFileReference({
230
360
  ...params.file,
231
361
  name: label
@@ -253,42 +383,36 @@ function resolveForwardedAttachmentImageUrl(attachment, govSlack) {
253
383
  async function resolveSlackMedia(params) {
254
384
  const govSlack = isGovSlackClient(params.client);
255
385
  const files = params.files ?? [];
386
+ const limitedFiles = files.length > 8 ? files.slice(0, 8) : files;
387
+ for (const file of files.slice(8)) params.unavailableFiles?.set(file, SLACK_MEDIA_LIMIT_REASON);
388
+ const refreshFileUrl = (file) => fetchFreshSlackFileUrl({
389
+ file,
390
+ client: params.client,
391
+ isRefreshedFileAllowed: params.isRefreshedFileAllowed
392
+ });
256
393
  const { results } = await runTasksWithConcurrency({
257
- tasks: (files.length > 8 ? files.slice(0, 8) : files).map((file) => async () => {
394
+ tasks: limitedFiles.map((file) => async () => {
258
395
  const preloaded = params.preloadedMedia?.get(file);
259
396
  if (preloaded) return preloaded;
260
397
  const eventUrl = file.url_private_download ?? file.url_private;
261
- const url = eventUrl ?? await fetchFreshSlackFileUrl({
262
- file,
263
- client: params.client
264
- });
265
- if (!url) return null;
266
- const result = await downloadSlackMediaFile({
267
- file,
268
- url,
269
- token: params.token,
270
- maxBytes: params.maxBytes,
271
- readIdleTimeoutMs: params.readIdleTimeoutMs,
272
- totalTimeoutMs: params.totalTimeoutMs,
273
- abortSignal: params.abortSignal,
274
- govSlack
275
- }).catch(() => null);
276
- if (result || !eventUrl) return result;
277
- const freshUrl = await fetchFreshSlackFileUrl({
278
- file,
279
- client: params.client
280
- });
281
- if (!freshUrl) return null;
282
- return await downloadSlackMediaFile({
283
- file,
284
- url: freshUrl,
285
- token: params.token,
286
- maxBytes: params.maxBytes,
287
- readIdleTimeoutMs: params.readIdleTimeoutMs,
288
- totalTimeoutMs: params.totalTimeoutMs,
289
- abortSignal: params.abortSignal,
290
- govSlack
291
- }).catch(() => null);
398
+ let url = eventUrl ?? await refreshFileUrl(file);
399
+ let reason = "no private download URL";
400
+ for (let attempt = 0; url && attempt < 2; attempt += 1) {
401
+ try {
402
+ return await downloadSlackMediaFile({
403
+ ...params,
404
+ file,
405
+ url,
406
+ govSlack
407
+ });
408
+ } catch (error) {
409
+ reason = formatSlackMediaFailure(error);
410
+ }
411
+ url = attempt === 0 && eventUrl ? await refreshFileUrl(file) : null;
412
+ }
413
+ params.unavailableFiles?.set(file, reason);
414
+ slackMediaLog.warn(`slack: file ${formatSlackFileReference(file)} unavailable (${reason})`);
415
+ return null;
292
416
  }),
293
417
  limit: MAX_SLACK_MEDIA_CONCURRENCY,
294
418
  errorMode: "stop",
@@ -299,14 +423,41 @@ async function resolveSlackMedia(params) {
299
423
  }
300
424
  /** Extracts text and media from forwarded-message attachments. Returns null when empty. */
301
425
  async function resolveSlackAttachmentContent(params) {
302
- const attachments = params.attachments;
303
- if (!attachments || attachments.length === 0) return null;
304
- const forwardedAttachments = attachments.filter((attachment) => isForwardedSlackAttachment(attachment)).slice(0, MAX_SLACK_FORWARDED_ATTACHMENTS);
305
- if (forwardedAttachments.length === 0) return null;
426
+ const forwardedAttachments = (params.attachments ?? []).filter((attachment) => isForwardedSlackAttachment(attachment)).slice(0, MAX_SLACK_FORWARDED_ATTACHMENTS);
427
+ const candidates = [...params.files ?? [], ...forwardedAttachments.flatMap((attachment) => attachment.files ?? [])];
428
+ if (forwardedAttachments.length === 0 && candidates.length === 0) return null;
429
+ const fileIds = /* @__PURE__ */ new Set();
430
+ const allFiles = candidates.filter((file) => {
431
+ const fileId = normalizeOptionalString(file.id);
432
+ if (!fileId) return true;
433
+ if (fileIds.has(fileId)) return false;
434
+ fileIds.add(fileId);
435
+ return true;
436
+ }).map((file, index) => {
437
+ if (index >= 8) return file;
438
+ const fileId = normalizeOptionalString(file.id);
439
+ const preloaded = fileId && candidates.find((candidate) => normalizeOptionalString(candidate.id) === fileId && params.preloadedMedia?.has(candidate));
440
+ if (preloaded) return preloaded;
441
+ if (!fileId || file.url_private_download || file.url_private) return file;
442
+ const downloadable = candidates.find((candidate) => normalizeOptionalString(candidate.id) === fileId && (candidate.url_private_download || candidate.url_private));
443
+ return downloadable ? Object.assign({}, file, downloadable) : file;
444
+ });
445
+ const pendingFiles = new Map(allFiles.slice(0, 8).map((file) => [normalizeOptionalString(file.id) ?? file, file]));
446
+ const unavailableFileReasons = /* @__PURE__ */ new Map();
447
+ const resolveFiles = (files) => resolveSlackMedia({
448
+ ...params,
449
+ unavailableFiles: unavailableFileReasons,
450
+ files: files?.flatMap((file) => {
451
+ const key = normalizeOptionalString(file.id) ?? file;
452
+ const selected = pendingFiles.get(key);
453
+ pendingFiles.delete(key);
454
+ return selected ? [selected] : [];
455
+ })
456
+ });
457
+ const directMediaPromise = resolveFiles(params.files);
306
458
  const textBlocks = [];
307
- const allMedia = [];
308
- const allFiles = forwardedAttachments.flatMap((attachment) => attachment.files ?? []);
309
- let unavailableImageCount = 0;
459
+ const attachmentMedia = [];
460
+ let unavailableMediaCount = 0;
310
461
  const govSlack = isGovSlackClient(params.client);
311
462
  for (const att of forwardedAttachments) {
312
463
  const text = att.text?.trim() || att.fallback?.trim();
@@ -331,38 +482,57 @@ async function resolveSlackAttachmentContent(params) {
331
482
  abortSignal: params.abortSignal
332
483
  });
333
484
  const label = saved.fileName ?? "forwarded image";
334
- allMedia.push({
485
+ attachmentMedia.push({
335
486
  path: saved.path,
336
487
  contentType: saved.contentType,
488
+ ...saved.fileName ? { fileName: saved.fileName } : {},
337
489
  placeholder: `[Forwarded image: ${label}]`
338
490
  });
339
- } catch {
340
- unavailableImageCount += 1;
341
- }
342
- if (att.files && att.files.length > 0) {
343
- const fileMedia = await resolveSlackMedia({
344
- files: att.files,
345
- client: params.client,
346
- token: params.token,
347
- maxBytes: params.maxBytes,
348
- readIdleTimeoutMs: params.readIdleTimeoutMs,
349
- totalTimeoutMs: params.totalTimeoutMs,
350
- abortSignal: params.abortSignal
351
- });
352
- if (fileMedia) allMedia.push(...fileMedia);
491
+ } catch (error) {
492
+ unavailableMediaCount += 1;
493
+ slackMediaLog.warn(`slack: forwarded image unavailable (${formatSlackMediaFailure(error)})`);
353
494
  }
495
+ attachmentMedia.push(...await resolveFiles(att.files) ?? []);
354
496
  }
497
+ const allMedia = [...await directMediaPromise ?? [], ...attachmentMedia];
498
+ const unavailableFiles = allFiles.flatMap((file, index) => {
499
+ const reason = index >= 8 ? SLACK_MEDIA_LIMIT_REASON : unavailableFileReasons.get(file);
500
+ return reason ? [{
501
+ ...file,
502
+ reason
503
+ }] : [];
504
+ });
505
+ unavailableMediaCount += unavailableFiles.length;
355
506
  const combinedText = textBlocks.join("\n\n");
356
- if (!combinedText && allMedia.length === 0 && allFiles.length === 0 && unavailableImageCount === 0) return null;
507
+ if (!combinedText && allMedia.length === 0 && allFiles.length === 0 && unavailableMediaCount === 0) return null;
357
508
  return {
358
509
  text: combinedText,
359
510
  media: allMedia,
360
- unavailableImageCount,
361
- ...allFiles.length > 0 ? { files: allFiles } : {}
511
+ unavailableMediaCount,
512
+ ...unavailableFiles.length > 0 ? { files: unavailableFiles } : {}
362
513
  };
363
514
  }
364
515
  //#endregion
365
516
  //#region extensions/slack/src/actions.ts
517
+ var actions_exports = /* @__PURE__ */ __exportAll({
518
+ deleteSlackMessage: () => deleteSlackMessage,
519
+ downloadSlackFile: () => downloadSlackFile,
520
+ editSlackMessage: () => editSlackMessage,
521
+ editSlackRenderedMessage: () => editSlackRenderedMessage,
522
+ getSlackMemberInfo: () => getSlackMemberInfo,
523
+ listSlackEmojis: () => listSlackEmojis,
524
+ listSlackPins: () => listSlackPins,
525
+ listSlackReactions: () => listSlackReactions,
526
+ openSlackConversation: () => openSlackConversation,
527
+ pinSlackMessage: () => pinSlackMessage,
528
+ reactSlackMessage: () => reactSlackMessage,
529
+ readSlackMessages: () => readSlackMessages,
530
+ removeOwnSlackReactions: () => removeOwnSlackReactions,
531
+ removeSlackReaction: () => removeSlackReaction,
532
+ resolveSlackConversationName: () => resolveSlackConversationName,
533
+ sendSlackMessage: () => sendSlackMessage,
534
+ unpinSlackMessage: () => unpinSlackMessage
535
+ });
366
536
  function renderSlackReadMessageText(message) {
367
537
  if (!hasSlackMessageTableBlock(message)) return message;
368
538
  const text = resolveSlackMessageText(message, { preserveMessageTextWhitespace: true });
@@ -553,7 +723,12 @@ async function sendSlackMessage(to, content, opts) {
553
723
  });
554
724
  }
555
725
  async function editSlackMessage(channelId, messageId, content, opts = {}) {
556
- await editSlackRenderedMessage(channelId, messageId, normalizeSlackOutboundText(content), opts);
726
+ const accountId = opts.accountId ?? (opts.cfg ? resolveDefaultSlackAccountId(opts.cfg) : void 0);
727
+ await editSlackRenderedMessage(channelId, messageId, normalizeSlackOutboundText(content, { tableMode: resolveMarkdownTableMode({
728
+ cfg: opts.cfg,
729
+ channel: "slack",
730
+ accountId
731
+ }) }), opts);
557
732
  }
558
733
  async function editSlackRenderedMessage(channelId, messageId, content, opts = {}) {
559
734
  const client = await getClient(opts, "write");
@@ -598,6 +773,13 @@ async function deleteSlackMessage(channelId, messageId, opts = {}) {
598
773
  ts: messageId
599
774
  });
600
775
  }
776
+ async function openSlackConversation(userIds, opts = {}) {
777
+ const input = parseSlackConversationOpenInput(userIds, opts.teamId);
778
+ return await openSlackConversationWithClient(await getClient({
779
+ ...opts,
780
+ teamId: input.teamId
781
+ }, "write"), input);
782
+ }
601
783
  async function resolveSlackConversationName(channelId, opts = {}) {
602
784
  return (await (await getClient(opts, "read")).conversations.info({ channel: channelId })).channel?.name?.trim() || void 0;
603
785
  }
@@ -682,48 +864,34 @@ function collectSlackShareMaps(file) {
682
864
  const shares = file.shares;
683
865
  return [shares.public, shares.private].filter((value) => Boolean(value) && typeof value === "object" && !Array.isArray(value));
684
866
  }
685
- function collectSlackSharedChannelIds(file) {
686
- const ids = /* @__PURE__ */ new Set();
687
- for (const shareMap of collectSlackShareMaps(file)) for (const channelId of Object.keys(shareMap)) {
688
- const normalized = normalizeOptionalString(channelId);
689
- if (normalized) ids.add(normalized);
690
- }
691
- return ids;
692
- }
693
- function collectSlackThreadShares(file, channelId) {
694
- const matches = [];
695
- for (const shareMap of collectSlackShareMaps(file)) {
696
- const rawEntries = shareMap[channelId];
697
- if (!Array.isArray(rawEntries)) continue;
867
+ function collectSlackShares(file) {
868
+ const shares = [];
869
+ for (const shareMap of collectSlackShareMaps(file)) for (const [rawChannelId, rawEntries] of Object.entries(shareMap)) {
870
+ const channelId = normalizeOptionalString(rawChannelId);
871
+ if (!channelId || !Array.isArray(rawEntries)) continue;
698
872
  for (const rawEntry of rawEntries) {
699
873
  if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) continue;
700
874
  const entry = rawEntry;
701
875
  const ts = typeof entry.ts === "string" ? normalizeOptionalString(entry.ts) : void 0;
702
876
  const threadTs = typeof entry.thread_ts === "string" ? normalizeOptionalString(entry.thread_ts) : void 0;
703
- matches.push({
877
+ if (ts || threadTs) shares.push({
704
878
  channelId,
705
879
  ts,
706
880
  threadTs
707
881
  });
708
882
  }
709
883
  }
710
- return matches;
884
+ return shares;
711
885
  }
712
- function hasSlackScopeMismatch(params) {
886
+ function lacksSlackScopeProof(params) {
713
887
  const channelId = normalizeOptionalString(params.channelId);
714
- if (!channelId) return false;
888
+ if (!channelId) return true;
715
889
  const threadId = normalizeOptionalString(params.threadId);
716
890
  const directIds = collectSlackDirectShareChannelIds(params.file);
717
- const sharedIds = collectSlackSharedChannelIds(params.file);
718
- const hasChannelEvidence = directIds.size > 0 || sharedIds.size > 0;
719
- const inChannel = directIds.has(channelId) || sharedIds.has(channelId);
720
- if (hasChannelEvidence && !inChannel) return true;
891
+ const shares = collectSlackShares(params.file);
892
+ if (!(directIds.has(channelId) || shares.some((entry) => entry.channelId === channelId))) return true;
721
893
  if (!threadId) return false;
722
- const threadShares = collectSlackThreadShares(params.file, channelId);
723
- if (threadShares.length === 0) return false;
724
- const threadEvidence = threadShares.filter((entry) => entry.threadTs || entry.ts);
725
- if (threadEvidence.length === 0) return false;
726
- return !threadEvidence.some((entry) => entry.threadTs === threadId || entry.ts === threadId);
894
+ return !shares.some((entry) => entry.channelId === channelId && (entry.threadTs === threadId || entry.ts === threadId));
727
895
  }
728
896
  /**
729
897
  * Downloads a Slack file by ID and saves it to the local media store.
@@ -733,13 +901,14 @@ function hasSlackScopeMismatch(params) {
733
901
  async function downloadSlackFile(fileId, opts) {
734
902
  const token = resolveToken(opts.token, opts.accountId, opts.cfg);
735
903
  const client = await getClient(opts);
736
- const file = (await client.files.info({ file: fileId })).file;
737
- if (!file?.url_private_download && !file?.url_private) return null;
738
- if (hasSlackScopeMismatch({
904
+ const isFileAllowed = (file) => !lacksSlackScopeProof({
739
905
  file,
740
906
  channelId: opts.channelId,
741
907
  threadId: opts.threadId
742
- })) return null;
908
+ });
909
+ const file = (await client.files.info({ file: fileId })).file;
910
+ if (!file?.url_private_download && !file?.url_private) return null;
911
+ if (!isFileAllowed(file)) return null;
743
912
  return (await resolveSlackMedia({
744
913
  files: [{
745
914
  id: file.id,
@@ -749,9 +918,10 @@ async function downloadSlackFile(fileId, opts) {
749
918
  url_private_download: file.url_private_download
750
919
  }],
751
920
  client,
921
+ isRefreshedFileAllowed: isFileAllowed,
752
922
  token,
753
923
  maxBytes: opts.maxBytes
754
924
  }))?.[0] ?? null;
755
925
  }
756
926
  //#endregion
757
- export { media_exports as _, getSlackMemberInfo as a, formatSlackFileReferenceList as b, listSlackReactions as c, readSlackMessages as d, removeOwnSlackReactions as f, unpinSlackMessage as g, sendSlackMessage as h, editSlackRenderedMessage as i, pinSlackMessage as l, resolveSlackConversationName as m, downloadSlackFile as n, listSlackEmojis as o, removeSlackReaction as p, editSlackMessage as r, listSlackPins as s, deleteSlackMessage as t, reactSlackMessage as u, logVerbose$1 as v, buildSlackEditTextPayload as x, formatSlackFileReference as y };
927
+ export { hasSlackMessageTableBlock as C, resolveSlackMessageText as D, resolveSlackBlocksText as E, buildSlackEditTextPayload as O, formatSlackFileReferenceList as S, isSlackUnfurlAttachment as T, media_exports as _, editSlackRenderedMessage as a, saveRemoteMedia as b, listSlackPins as c, reactSlackMessage as d, readSlackMessages as f, unpinSlackMessage as g, sendSlackMessage as h, editSlackMessage as i, listSlackReactions as l, removeSlackReaction as m, deleteSlackMessage as n, getSlackMemberInfo as o, removeOwnSlackReactions as p, downloadSlackFile as r, listSlackEmojis as s, actions_exports as t, pinSlackMessage as u, logVerbose$1 as v, hasSlackTableBlock as w, formatSlackFileReference as x, isGovSlackClient as y };
package/dist/api.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import { n as registerSlackHttpHandler, r as normalizeSlackWebhookPath, t as handleSlackHttpRequest } from "./registry-bbjH7IHX.js";
2
- import { a as resolveSlackAccount, i as resolveDefaultSlackAccountId, n as listSlackAccountIds, r as mergeSlackAccountConfig, t as listEnabledSlackAccounts } from "./accounts-BlzxuYle.js";
2
+ import { a as resolveSlackAccount, i as resolveDefaultSlackAccountId, n as listSlackAccountIds, r as mergeSlackAccountConfig, t as listEnabledSlackAccounts } from "./accounts-Dm_H77gH.js";
3
3
  import { r as resolveSlackReplyToMode } from "./conversation-binding-route-DFVLUdYF.js";
4
- import { t as inspectSlackAccount } from "./account-inspect-YJvFBbCR.js";
4
+ import { t as inspectSlackAccount } from "./account-inspect-CN2hBsim.js";
5
5
  import { a as parseSlackTarget, i as normalizeSlackMessagingTarget, o as resolveSlackChannelId, r as looksLikeSlackTargetId } from "./target-parsing-BnMD2ZqZ.js";
6
6
  import "./targets-Cx5W_n3W.js";
7
- import { G as buildSlackPresentationBlocks, Rt as resolveSlackAutoThreadId, W as buildSlackInteractiveBlocks, c as allowListMatches, d as normalizeSlackAllowOwnerEntry, f as normalizeSlackSlug, ft as SLACK_MAX_BLOCKS, h as resolveSlackUserAllowed, i as resolveSlackGroupToolPolicy, l as normalizeAllowList, mt as validateSlackBlocksArray, p as resolveSlackAllowListMatch, pt as parseSlackBlocksInput, r as resolveSlackGroupRequireMention, u as normalizeAllowListLower } from "./group-policy-DyfB_ZIE.js";
8
- import { n as buildSlackThreadingToolContext, t as slackPlugin } from "./channel-CA5w7qDF.js";
9
- import { n as extractSlackToolSend, r as listSlackMessageActions } from "./message-tool-api-CqMr5Rmc.js";
10
- import { _ as resolveSlackWriteClientOptions, c as createSlackWebClient, d as getSlackWriteClient, f as SLACK_DEFAULT_RETRY_OPTIONS, g as resolveSlackWebClientOptions, l as createSlackWriteClient, p as SLACK_WRITE_RETRY_OPTIONS, s as createSlackTokenCacheKey, t as probeSlack } from "./probe-BVA65leh.js";
11
- import { n as resolveSlackChannelType } from "./channel-type-CZWv55Wu.js";
12
- import { t as slackSetupPlugin } from "./channel.setup-CpyYsEXH.js";
13
- import { a as getSlackMemberInfo, c as listSlackReactions, d as readSlackMessages, f as removeOwnSlackReactions, g as unpinSlackMessage, h as sendSlackMessage, l as pinSlackMessage, n as downloadSlackFile, o as listSlackEmojis, p as removeSlackReaction, r as editSlackMessage, s as listSlackPins, t as deleteSlackMessage, u as reactSlackMessage } from "./actions-DFk0ANVB.js";
14
- import { f as recordSlackThreadParticipation, l as hasSlackThreadParticipation, s as clearSlackThreadParticipationCache } from "./send-CtnOxKCc.js";
15
- import { n as listSlackDirectoryGroupsFromConfig, r as listSlackDirectoryPeersFromConfig } from "./directory-config-BGYyuzWh.js";
7
+ import { N as buildSlackInteractiveBlocks, P as buildSlackPresentationBlocks, at as SLACK_MAX_BLOCKS, i as resolveSlackGroupToolPolicy, jt as resolveSlackAutoThreadId, ot as parseSlackBlocksInput, r as resolveSlackGroupRequireMention, st as validateSlackBlocksArray } from "./group-policy-BdwszjYn.js";
8
+ import { n as buildSlackThreadingToolContext, t as slackPlugin } from "./channel-1vIJOzPx.js";
9
+ import { n as extractSlackToolSend, r as listSlackMessageActions } from "./message-tool-api-CJ0kjcg5.js";
10
+ import { C as SLACK_DEFAULT_RETRY_OPTIONS, D as resolveSlackWebClientOptions, O as resolveSlackWriteClientOptions, S as getSlackWriteClient, b as createSlackWriteClient, c as normalizeAllowList, d as normalizeSlackSlug, f as resolveSlackAllowListMatch, l as normalizeAllowListLower, m as resolveSlackUserAllowed, s as allowListMatches, t as probeSlack, u as normalizeSlackAllowOwnerEntry, v as createSlackTokenCacheKey, w as SLACK_WRITE_RETRY_OPTIONS, y as createSlackWebClient } from "./probe-0usmAb0i.js";
11
+ import { n as resolveSlackChannelType } from "./channel-type-DlFSKeIZ.js";
12
+ import { t as slackSetupPlugin } from "./channel.setup-ofDi3_Pu.js";
13
+ import { c as listSlackPins, d as reactSlackMessage, f as readSlackMessages, g as unpinSlackMessage, h as sendSlackMessage, i as editSlackMessage, l as listSlackReactions, m as removeSlackReaction, n as deleteSlackMessage, o as getSlackMemberInfo, p as removeOwnSlackReactions, r as downloadSlackFile, s as listSlackEmojis, u as pinSlackMessage } from "./actions-BI7JkfVm.js";
14
+ import { f as recordSlackThreadParticipation, l as hasSlackThreadParticipation, s as clearSlackThreadParticipationCache } from "./send-DS9ICrBI.js";
15
+ import { n as listSlackDirectoryGroupsFromConfig, r as listSlackDirectoryPeersFromConfig } from "./directory-config-DqfQ42OV.js";
16
16
  import { t as collectSlackSecurityAuditFindings } from "./security-audit-B_yKr7MW.js";
17
- import { n as resolveSlackRuntimeGroupPolicy } from "./provider-CUUiwsg2.js";
17
+ import { n as resolveSlackRuntimeGroupPolicy } from "./provider-CN_8hFv2.js";
18
18
  export { SLACK_DEFAULT_RETRY_OPTIONS, SLACK_MAX_BLOCKS, SLACK_WRITE_RETRY_OPTIONS, allowListMatches, buildSlackInteractiveBlocks, buildSlackPresentationBlocks, buildSlackThreadingToolContext, clearSlackThreadParticipationCache, collectSlackSecurityAuditFindings, createSlackTokenCacheKey, createSlackWebClient, createSlackWriteClient, deleteSlackMessage, downloadSlackFile, editSlackMessage, extractSlackToolSend, getSlackMemberInfo, getSlackWriteClient, handleSlackHttpRequest, hasSlackThreadParticipation, inspectSlackAccount, listEnabledSlackAccounts, listSlackAccountIds, listSlackDirectoryGroupsFromConfig, listSlackDirectoryPeersFromConfig, listSlackEmojis, listSlackMessageActions, listSlackPins, listSlackReactions, looksLikeSlackTargetId, mergeSlackAccountConfig, normalizeAllowList, normalizeAllowListLower, normalizeSlackAllowOwnerEntry, normalizeSlackMessagingTarget, normalizeSlackSlug, normalizeSlackWebhookPath, parseSlackBlocksInput, parseSlackTarget, pinSlackMessage, probeSlack, reactSlackMessage, readSlackMessages, recordSlackThreadParticipation, registerSlackHttpHandler, removeOwnSlackReactions, removeSlackReaction, resolveDefaultSlackAccountId, resolveSlackAccount, resolveSlackAllowListMatch, resolveSlackAutoThreadId, resolveSlackChannelId, resolveSlackChannelType, resolveSlackGroupRequireMention, resolveSlackGroupToolPolicy, resolveSlackReplyToMode, resolveSlackRuntimeGroupPolicy, resolveSlackUserAllowed, resolveSlackWebClientOptions, resolveSlackWriteClientOptions, sendSlackMessage, slackPlugin, slackSetupPlugin, unpinSlackMessage, validateSlackBlocksArray };