@openclaw/slack 2026.8.1-beta.2 → 2026.9.1-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 (245) 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-CK4AVI2_.js → accounts-Dm_H77gH.js} +12 -11
  5. package/dist/{accounts.runtime-Cb7QwWBz.js → accounts.runtime-DRuEK6mL.js} +1 -1
  6. package/dist/{action-runtime-BkGe7ny_.js → action-runtime-BoSeX09X.js} +76 -83
  7. package/dist/action-runtime.runtime-Dpa16J87.js +2 -0
  8. package/dist/{actions-BTDXwwE3.js → actions-XdQyjG_p.js} +134 -262
  9. package/dist/api.js +14 -14
  10. package/dist/{approval-handler.runtime-CJaNzAq2.js → approval-handler.runtime-DxXfGX_Z.js} +53 -174
  11. package/dist/{channel-D_tovcUL.js → channel-C_vnTgxo.js} +117 -72
  12. package/dist/channel-config-api.js +1 -1
  13. package/dist/channel-plugin-api.js +1 -1
  14. package/dist/{channel-type-B9MSdoGN.js → channel-type-j-2lalcC.js} +3 -7
  15. package/dist/{channel.setup-Bch9dYmA.js → channel.setup-aal8tokM.js} +34 -49
  16. package/dist/{config-schema-xto5jFIx.js → config-schema-CN3XZRX5.js} +23 -7
  17. package/dist/configured-state.js +34 -0
  18. package/dist/conversation-binding-route-DFVLUdYF.js +115 -0
  19. package/dist/{directory-config-CNBz8lJa.js → directory-config-DqfQ42OV.js} +1 -1
  20. package/dist/directory-contract-api.js +1 -1
  21. package/dist/{directory-live-CFKUtW9E.js → directory-live-lC6X_Ru-.js} +2 -2
  22. package/dist/{group-policy-c4RP9bjc.js → group-policy-CU1tEGpS.js} +583 -642
  23. package/dist/{message-tool-api-BykQB4AU.js → message-tool-api-CWosHSi5.js} +6 -5
  24. package/dist/message-tool-api.js +1 -1
  25. package/dist/{monitor-1nF1NtqT.js → monitor-DrNCGneD.js} +3 -3
  26. package/dist/{outbound-adapter-S81tsswN.js → outbound-adapter-DkT2vUE9.js} +50 -19
  27. package/dist/{pipeline.runtime-BvYsM5JO.js → pipeline.runtime-CRRng_Nw.js} +440 -451
  28. package/dist/{policy-TapwbeaT.js → policy-BoP6t88v.js} +1 -1
  29. package/dist/{probe-HoEg_WxB.js → probe-4_aHtVT3.js} +2 -21
  30. package/dist/{provider-CDNvBXUi.js → provider-D4nDgxCh.js} +240 -95
  31. package/dist/{relay-source-C9leF11u.js → relay-source-CEmze11m.js} +1 -1
  32. package/dist/{replies-CeOfv82I.js → replies-D9XMM_S0.js} +47 -26
  33. package/dist/{resolve-channels-CNPrxaXY.js → resolve-channels-DSamDgVs.js} +1 -1
  34. package/dist/{resolve-users-Dzomuwnr.js → resolve-users-CIzwbaJR.js} +1 -1
  35. package/dist/runtime-api.js +11 -11
  36. package/dist/{scopes-cYXKkrRD.js → scopes-BBrUzpBH.js} +1 -1
  37. package/dist/security-contract-api.js +1 -1
  38. package/dist/{send-Nor0iBwY.js → send-DtjEnlLh.js} +86 -98
  39. package/dist/{send.runtime-BmgNe6S9.js → send.runtime-DQeNKa2J.js} +1 -1
  40. package/dist/setup-plugin-api.js +1 -1
  41. package/dist/{setup-surface-CbX1-Knh.js → setup-surface-CsBCM4rP.js} +6 -6
  42. package/dist/{shared-zdT5AMp-.js → shared-D9GeeR9K.js} +33 -9
  43. package/dist/{block-text-YtiNkqmx.js → slack-client-kind-hSfjXyUM.js} +17 -2
  44. package/dist/{slash-dispatch.runtime-Bnr9GR1S.js → slash-dispatch.runtime-Chr3YHnT.js} +3 -3
  45. package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
  46. package/node_modules/@slack/bolt/node_modules/@types/node/child_process.d.ts +0 -1
  47. package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +6 -6
  48. package/node_modules/@slack/bolt/node_modules/@types/node/dns/promises.d.ts +5 -5
  49. package/node_modules/@slack/bolt/node_modules/@types/node/dns.d.ts +5 -5
  50. package/node_modules/@slack/bolt/node_modules/@types/node/fs.d.ts +7 -0
  51. package/node_modules/@slack/bolt/node_modules/@types/node/http.d.ts +30 -0
  52. package/node_modules/@slack/bolt/node_modules/@types/node/http2.d.ts +4 -4
  53. package/node_modules/@slack/bolt/node_modules/@types/node/os.d.ts +30 -30
  54. package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
  55. package/node_modules/@slack/bolt/node_modules/@types/node/perf_hooks.d.ts +2 -1
  56. package/node_modules/@slack/bolt/node_modules/@types/node/process.d.ts +42 -43
  57. package/node_modules/@slack/bolt/node_modules/@types/node/quic.d.ts +1049 -84
  58. package/node_modules/@slack/bolt/node_modules/@types/node/sqlite.d.ts +14 -1
  59. package/node_modules/@slack/bolt/node_modules/@types/node/stream/iter.d.ts +3 -2
  60. package/node_modules/@slack/bolt/node_modules/@types/node/test.d.ts +61 -0
  61. package/node_modules/@slack/bolt/node_modules/@types/node/v8.d.ts +20 -23
  62. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/README.md +2 -0
  63. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
  64. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
  65. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
  66. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/package.json +1 -1
  67. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/README.md +2 -0
  68. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
  69. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
  70. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
  71. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/package.json +1 -1
  72. package/node_modules/@slack/socket-mode/node_modules/@types/node/README.md +1 -1
  73. package/node_modules/@slack/socket-mode/node_modules/@types/node/child_process.d.ts +0 -1
  74. package/node_modules/@slack/socket-mode/node_modules/@types/node/crypto.d.ts +6 -6
  75. package/node_modules/@slack/socket-mode/node_modules/@types/node/dns/promises.d.ts +5 -5
  76. package/node_modules/@slack/socket-mode/node_modules/@types/node/dns.d.ts +5 -5
  77. package/node_modules/@slack/socket-mode/node_modules/@types/node/fs.d.ts +7 -0
  78. package/node_modules/@slack/socket-mode/node_modules/@types/node/http.d.ts +30 -0
  79. package/node_modules/@slack/socket-mode/node_modules/@types/node/http2.d.ts +4 -4
  80. package/node_modules/@slack/socket-mode/node_modules/@types/node/os.d.ts +30 -30
  81. package/node_modules/@slack/socket-mode/node_modules/@types/node/package.json +2 -2
  82. package/node_modules/@slack/socket-mode/node_modules/@types/node/perf_hooks.d.ts +2 -1
  83. package/node_modules/@slack/socket-mode/node_modules/@types/node/process.d.ts +42 -43
  84. package/node_modules/@slack/socket-mode/node_modules/@types/node/quic.d.ts +1049 -84
  85. package/node_modules/@slack/socket-mode/node_modules/@types/node/sqlite.d.ts +14 -1
  86. package/node_modules/@slack/socket-mode/node_modules/@types/node/stream/iter.d.ts +3 -2
  87. package/node_modules/@slack/socket-mode/node_modules/@types/node/test.d.ts +61 -0
  88. package/node_modules/@slack/socket-mode/node_modules/@types/node/v8.d.ts +20 -23
  89. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
  90. package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +0 -1
  91. package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +6 -6
  92. package/node_modules/@slack/web-api/node_modules/@types/node/dns/promises.d.ts +5 -5
  93. package/node_modules/@slack/web-api/node_modules/@types/node/dns.d.ts +5 -5
  94. package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +7 -0
  95. package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +30 -0
  96. package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +4 -4
  97. package/node_modules/@slack/web-api/node_modules/@types/node/os.d.ts +30 -30
  98. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
  99. package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +2 -1
  100. package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +42 -43
  101. package/node_modules/@slack/web-api/node_modules/@types/node/quic.d.ts +1049 -84
  102. package/node_modules/@slack/web-api/node_modules/@types/node/sqlite.d.ts +14 -1
  103. package/node_modules/@slack/web-api/node_modules/@types/node/stream/iter.d.ts +3 -2
  104. package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +61 -0
  105. package/node_modules/@slack/web-api/node_modules/@types/node/v8.d.ts +20 -23
  106. package/node_modules/typebox/build/format/date.d.mts +1 -1
  107. package/node_modules/typebox/build/format/date.mjs +1 -1
  108. package/node_modules/typebox/build/format/date_time.d.mts +2 -2
  109. package/node_modules/typebox/build/format/date_time.mjs +3 -3
  110. package/node_modules/typebox/build/format/email.d.mts +1 -1
  111. package/node_modules/typebox/build/format/email.mjs +2 -2
  112. package/node_modules/typebox/build/format/hostname.mjs +2 -10
  113. package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
  114. package/node_modules/typebox/build/format/idn_email.mjs +3 -3
  115. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
  116. package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
  117. package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
  118. package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
  119. package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
  120. package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
  121. package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
  122. package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
  123. package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
  124. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
  125. package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
  126. package/node_modules/typebox/build/format/idna/index.mjs +2 -0
  127. package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
  128. package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
  129. package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
  130. package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
  131. package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
  132. package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
  133. package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
  134. package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
  135. package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
  136. package/node_modules/typebox/build/format/ipv4.mjs +2 -32
  137. package/node_modules/typebox/build/format/ipv6.mjs +2 -61
  138. package/node_modules/typebox/build/format/iri.d.mts +2 -2
  139. package/node_modules/typebox/build/format/iri.mjs +26 -8
  140. package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
  141. package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
  142. package/node_modules/typebox/build/format/regex.d.mts +1 -2
  143. package/node_modules/typebox/build/format/regex.mjs +2 -6
  144. package/node_modules/typebox/build/format/time.d.mts +2 -2
  145. package/node_modules/typebox/build/format/time.mjs +19 -14
  146. package/node_modules/typebox/build/format/uri.d.mts +1 -1
  147. package/node_modules/typebox/build/format/uri.mjs +3 -130
  148. package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
  149. package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
  150. package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
  151. package/node_modules/typebox/build/format/uri_template.mjs +4 -5
  152. package/node_modules/typebox/build/format/url.d.mts +3 -3
  153. package/node_modules/typebox/build/format/url.mjs +4 -5
  154. package/node_modules/typebox/build/guard/emit.d.mts +3 -1
  155. package/node_modules/typebox/build/guard/emit.mjs +12 -5
  156. package/node_modules/typebox/build/guard/guard.d.mts +8 -2
  157. package/node_modules/typebox/build/guard/guard.mjs +25 -4
  158. package/node_modules/typebox/build/guard/string.d.mts +2 -2
  159. package/node_modules/typebox/build/guard/string.mjs +7 -7
  160. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
  161. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
  162. package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
  163. package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
  164. package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
  165. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
  166. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
  167. package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
  168. package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
  169. package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
  170. package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
  171. package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
  172. package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
  173. package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
  174. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
  175. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
  176. package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
  177. package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
  178. package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
  179. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
  180. package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
  181. package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
  182. package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
  183. package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
  184. package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
  185. package/node_modules/typebox/build/schema/types/index.mjs +0 -2
  186. package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
  187. package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
  188. package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
  189. package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
  190. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
  191. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
  192. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
  193. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
  194. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
  195. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
  196. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
  197. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
  198. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
  199. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
  200. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
  201. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
  202. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
  203. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
  204. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
  205. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
  206. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
  207. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
  208. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
  209. package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
  210. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
  211. package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
  212. package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
  213. package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
  214. package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
  215. package/node_modules/typebox/build/type/script/parser.mjs +27 -23
  216. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  217. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  218. package/node_modules/typebox/package.json +27 -27
  219. package/node_modules/typebox/readme.md +79 -82
  220. package/node_modules/ws/lib/permessage-deflate.js +3 -1
  221. package/node_modules/ws/package.json +1 -1
  222. package/openclaw.plugin.json +43 -1
  223. package/package.json +9 -9
  224. package/dist/account-configured-BwfXBo_F.js +0 -14
  225. package/dist/account-inspect-Drw2gAiN.js +0 -89
  226. package/dist/account-reply-mode-DrUXogvO.js +0 -14
  227. package/dist/action-runtime.runtime-D9I6uc0Q.js +0 -2
  228. package/dist/actions.runtime-DLFyUkvg.js +0 -2
  229. package/dist/runtime-api-Cj9nxBNv.js +0 -10
  230. package/node_modules/p-map/index.d.ts +0 -155
  231. package/node_modules/p-map/index.js +0 -285
  232. package/node_modules/p-map/license +0 -9
  233. package/node_modules/p-map/package.json +0 -57
  234. package/node_modules/p-map/readme.md +0 -190
  235. package/node_modules/typebox/build/format/_idna.d.mts +0 -2
  236. package/node_modules/typebox/build/format/_idna.mjs +0 -246
  237. package/node_modules/typebox/build/format/_puny.d.mts +0 -1
  238. package/node_modules/typebox/build/format/_puny.mjs +0 -77
  239. package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
  240. package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
  241. package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
  242. package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
  243. package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
  244. package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
  245. package/dist/{security-audit-DR097212.js → security-audit-B_yKr7MW.js} +1 -1
@@ -1,23 +1,19 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { a as resolveSlackAccount, f as resolveSlackBotToken } from "./accounts-CK4AVI2_.js";
3
- import { E as isSlackInvalidBlocksError, K as truncateSlackTextByUtf8Bytes, L as SLACK_EDIT_TEXT_MAX_BYTES, M as normalizeSlackOutboundText, N as buildSlackBlocksFallbackText, P as buildSlackCompleteBlocksFallbackText, S as appendSlackNativeDataPlainTextFallback, T as hasSlackNativeDataBlock, W as countSlackTextUtf8Bytes, at as escapeSlackMrkdwn, k as stripSlackNativeDataBlocks, p as assertSlackDetachedTargetAllowed, ut as validateSlackBlocksArray, x as appendSlackNativeDataFallbackText } from "./group-policy-c4RP9bjc.js";
4
- import { d as getSlackWriteClient, i as createSlackLookupClient } from "./probe-HoEg_WxB.js";
5
- import { a as resolveSlackMessageText$1, i as resolveSlackBlocksText, n as hasSlackTableBlock, r as isSlackUnfurlAttachment, t as hasSlackMessageTableBlock } from "./block-text-YtiNkqmx.js";
6
- import { p as buildSlackNativeDataDeliveryPlan, r as sendMessageSlack } from "./send-Nor0iBwY.js";
2
+ import { a as resolveSlackAccount, f as resolveSlackBotToken } from "./accounts-Dm_H77gH.js";
3
+ import { K as truncateSlackTextByUtf8Bytes, L as SLACK_EDIT_TEXT_MAX_BYTES, M as stripSlackNativeDataBlocks, N as buildSlackBlocksFallbackText, O as hasSlackNativeDataBlock, P as buildSlackCompleteBlocksFallbackText, Rt as SLACK_PRIVATE_ACTION_DELIVERY_RESULT, T as appendSlackNativeDataPlainTextFallback, W as countSlackTextUtf8Bytes, ct as escapeSlackMrkdwn, g as assertSlackDetachedTargetAllowed, ht as validateSlackBlocksArray, k as isSlackInvalidBlocksError, ot as normalizeSlackOutboundText, w as appendSlackNativeDataFallbackText } from "./group-policy-CU1tEGpS.js";
4
+ import { d as getSlackWriteClient, i as createSlackLookupClient } from "./probe-4_aHtVT3.js";
5
+ import { c as resolveSlackMessageText, i as hasSlackMessageTableBlock, n as fetchWithRuntimeDispatcher, r as saveRemoteMedia, t as isGovSlackClient } from "./slack-client-kind-hSfjXyUM.js";
6
+ import { m as buildSlackNativeDataDeliveryPlan, r as sendMessageSlack } from "./send-DtjEnlLh.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
9
  import { logVerbose, logVerbose as logVerbose$1 } from "openclaw/plugin-sdk/runtime-env";
10
- import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
11
10
  import { z } from "zod";
12
11
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
13
12
  import fs from "node:fs/promises";
13
+ import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
14
14
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
15
15
  import { normalizeHostname } from "openclaw/plugin-sdk/host-runtime";
16
16
  import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
17
- import pMap, { pMapSkip } from "p-map";
18
- import { fetchWithRuntimeDispatcher } from "openclaw/plugin-sdk/runtime-fetch";
19
- import { saveRemoteMedia } from "openclaw/plugin-sdk/media-runtime";
20
- import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
21
17
  //#region extensions/slack/src/edit-text.ts
22
18
  function buildSlackEditTextPayload(content, blocks) {
23
19
  const trimmedContent = content.trim();
@@ -49,173 +45,12 @@ function formatSlackFileReferenceList(files) {
49
45
  return files.map((file) => formatSlackFileReference(file)).join(", ");
50
46
  }
51
47
  //#endregion
52
- //#region extensions/slack/src/monitor/thread.ts
53
- const THREAD_STARTER_CACHE = /* @__PURE__ */ new Map();
54
- const THREAD_STARTER_CACHE_TTL_MS = 360 * 6e4;
55
- const THREAD_STARTER_CACHE_MAX = 2e3;
56
- function evictThreadStarterCache() {
57
- const now = asDateTimestampMs(Date.now());
58
- if (now === void 0) {
59
- THREAD_STARTER_CACHE.clear();
60
- return;
61
- }
62
- for (const [cacheKey, entry] of THREAD_STARTER_CACHE.entries()) if (asDateTimestampMs(entry.expiresAt) === void 0 || entry.expiresAt <= now) THREAD_STARTER_CACHE.delete(cacheKey);
63
- pruneMapToMaxSize(THREAD_STARTER_CACHE, THREAD_STARTER_CACHE_MAX);
64
- }
65
- function formatSlackFilePlaceholder(files) {
66
- return `[attached: ${formatSlackFileReferenceList(files)}]`;
67
- }
68
- function pushUniqueText(parts, value, options = {}) {
69
- const text = options.preserveWhitespace ? typeof value === "string" && value.trim().length > 0 ? value : void 0 : normalizeOptionalString(value);
70
- if (text && !parts.includes(text)) parts.push(text);
71
- }
72
- function resolveSlackBlocksFallbackText(blocks) {
73
- return resolveSlackBlocksText(blocks)?.text;
74
- }
75
- function resolveSlackAttachmentFallbackText(attachments) {
76
- if (!Array.isArray(attachments) || attachments.length === 0) return;
77
- const parts = [];
78
- for (const attachment of attachments) {
79
- const excludeTableBlocks = isSlackUnfurlAttachment(attachment);
80
- const fallbackBlocks = (blocks) => excludeTableBlocks ? blocks?.filter((block) => !hasSlackTableBlock([block])) : blocks;
81
- pushUniqueText(parts, attachment.pretext);
82
- pushUniqueText(parts, attachment.title);
83
- pushUniqueText(parts, attachment.text);
84
- if (!(hasSlackTableBlock(attachment.blocks) && normalizeOptionalString(attachment.fallback) === "[no preview available]")) pushUniqueText(parts, attachment.fallback);
85
- for (const field of attachment.fields ?? []) {
86
- pushUniqueText(parts, field.title);
87
- pushUniqueText(parts, field.value);
88
- }
89
- pushUniqueText(parts, resolveSlackBlocksFallbackText(fallbackBlocks(attachment.blocks)), { preserveWhitespace: true });
90
- pushUniqueText(parts, resolveSlackBlocksFallbackText(fallbackBlocks(attachment.message_blocks)), { preserveWhitespace: true });
91
- }
92
- return parts.length > 0 ? parts.join("\n") : void 0;
93
- }
94
- function resolveSlackMessageText(message) {
95
- const messageText = normalizeOptionalString(message.text) ?? resolveSlackAttachmentFallbackText(message.attachments);
96
- return resolveSlackMessageText$1({
97
- ...message,
98
- text: messageText
99
- }, { preserveMessageTextWhitespace: true });
100
- }
101
- async function resolveSlackThreadStarter(params) {
102
- evictThreadStarterCache();
103
- const cacheKey = JSON.stringify([
104
- params.workspaceScope.accountId,
105
- params.workspaceScope.teamId,
106
- params.channelId,
107
- params.threadTs
108
- ]);
109
- const cached = THREAD_STARTER_CACHE.get(cacheKey);
110
- if (cached) {
111
- const now = asDateTimestampMs(Date.now());
112
- if (now !== void 0 && cached.expiresAt > now) return cached.value;
113
- THREAD_STARTER_CACHE.delete(cacheKey);
114
- }
115
- try {
116
- const message = (await params.client.conversations.replies({
117
- channel: params.channelId,
118
- ts: params.threadTs,
119
- limit: 1,
120
- inclusive: true
121
- }))?.messages?.[0];
122
- const text = message ? resolveSlackMessageText(message) : void 0;
123
- const files = message?.files?.length ? message.files : void 0;
124
- if (!message || !text && !files) return null;
125
- const starter = {
126
- text: text || formatSlackFilePlaceholder(files),
127
- userId: message.user,
128
- botId: message.bot_id,
129
- ts: message.ts,
130
- files
131
- };
132
- const expiresAt = resolveExpiresAtMsFromDurationMs(THREAD_STARTER_CACHE_TTL_MS);
133
- if (expiresAt !== void 0) {
134
- if (THREAD_STARTER_CACHE.has(cacheKey)) THREAD_STARTER_CACHE.delete(cacheKey);
135
- THREAD_STARTER_CACHE.set(cacheKey, {
136
- value: starter,
137
- expiresAt
138
- });
139
- evictThreadStarterCache();
140
- }
141
- return starter;
142
- } catch (err) {
143
- logVerbose$1(`slack thread starter fetch failed channel=${params.channelId} ts=${params.threadTs}: ${formatErrorMessage(err)}`);
144
- return null;
145
- }
146
- }
147
- function resetSlackThreadStarterCacheForTest() {
148
- THREAD_STARTER_CACHE.clear();
149
- }
150
- const SLACK_THREAD_HISTORY_MAX_PAGES = 3;
151
- /**
152
- * Fetches the most recent messages in a Slack thread (excluding the current message).
153
- * Used to populate thread context when a new thread session starts.
154
- *
155
- * Uses cursor pagination and keeps only the latest N retained messages when the full
156
- * thread fits in the bounded fetch window.
157
- */
158
- async function resolveSlackThreadHistory(params) {
159
- const maxMessages = params.limit ?? 20;
160
- if (!Number.isFinite(maxMessages) || maxMessages <= 0) return [];
161
- const fetchLimit = 200;
162
- const retained = [];
163
- let cursor;
164
- let pagesFetched = 0;
165
- try {
166
- do {
167
- pagesFetched += 1;
168
- const response = await params.client.conversations.replies({
169
- channel: params.channelId,
170
- ts: params.threadTs,
171
- limit: fetchLimit,
172
- inclusive: true,
173
- ...cursor ? { cursor } : {}
174
- });
175
- for (const msg of response.messages ?? []) {
176
- if (!resolveSlackMessageText(msg) && !msg.files?.length) continue;
177
- if (params.currentMessageTs && msg.ts === params.currentMessageTs) continue;
178
- retained.push(msg);
179
- }
180
- if (retained.length > maxMessages) retained.splice(0, retained.length - maxMessages);
181
- const next = response.response_metadata?.next_cursor;
182
- cursor = typeof next === "string" && next.trim().length > 0 ? next.trim() : void 0;
183
- } while (cursor && pagesFetched < SLACK_THREAD_HISTORY_MAX_PAGES);
184
- if (cursor) {
185
- logVerbose$1(`slack thread history capped channel=${params.channelId} ts=${params.threadTs} pages=${SLACK_THREAD_HISTORY_MAX_PAGES}`);
186
- return [];
187
- }
188
- return retained.map((msg) => ({
189
- text: resolveSlackMessageText(msg) ?? formatSlackFilePlaceholder(msg.files),
190
- userId: msg.user,
191
- botId: msg.bot_id,
192
- ts: msg.ts,
193
- files: msg.files
194
- }));
195
- } catch (err) {
196
- logVerbose$1(`slack thread history fetch failed channel=${params.channelId} ts=${params.threadTs}: ${formatErrorMessage(err)}`);
197
- return [];
198
- }
199
- }
200
- //#endregion
201
48
  //#region extensions/slack/src/monitor/media.ts
202
49
  var media_exports = /* @__PURE__ */ __exportAll({
203
50
  SLACK_MEDIA_READ_IDLE_TIMEOUT_MS: () => SLACK_MEDIA_READ_IDLE_TIMEOUT_MS,
204
- resetSlackThreadStarterCacheForTest: () => resetSlackThreadStarterCacheForTest,
205
51
  resolveSlackAttachmentContent: () => resolveSlackAttachmentContent,
206
- resolveSlackMedia: () => resolveSlackMedia,
207
- resolveSlackThreadHistory: () => resolveSlackThreadHistory,
208
- resolveSlackThreadStarter: () => resolveSlackThreadStarter
52
+ resolveSlackMedia: () => resolveSlackMedia
209
53
  });
210
- function isGovSlackClient(client) {
211
- if (!client?.slackApiUrl) return false;
212
- try {
213
- const apiUrl = new URL(client.slackApiUrl);
214
- return apiUrl.protocol === "https:" && !apiUrl.port && normalizeHostname(apiUrl.hostname) === "slack-gov.com";
215
- } catch {
216
- return false;
217
- }
218
- }
219
54
  function isSlackHostname(hostname, govSlack) {
220
55
  const normalized = normalizeHostname(hostname);
221
56
  if (!normalized) return false;
@@ -349,6 +184,10 @@ async function fetchFreshSlackFileUrl(params) {
349
184
  if (!params.file.id || !params.client) return null;
350
185
  try {
351
186
  const freshFile = (await params.client.files.info({ file: params.file.id })).file;
187
+ if (freshFile && params.isRefreshedFileAllowed?.(freshFile) === false) {
188
+ logVerbose$1(`slack: refreshed file metadata rejected for file id=${params.file.id}`);
189
+ return null;
190
+ }
352
191
  const freshUrl = freshFile?.url_private_download ?? freshFile?.url_private;
353
192
  if (freshUrl) {
354
193
  logVerbose$1(`slack: refreshed file URL via files.info for file id=${params.file.id}`);
@@ -391,6 +230,7 @@ async function downloadSlackMediaFile(params) {
391
230
  return {
392
231
  path: saved.path,
393
232
  ...contentType ? { contentType } : {},
233
+ ...label ? { fileName: label } : {},
394
234
  placeholder: `[Slack file: ${formatSlackFileReference({
395
235
  ...params.file,
396
236
  name: label
@@ -418,56 +258,88 @@ function resolveForwardedAttachmentImageUrl(attachment, govSlack) {
418
258
  async function resolveSlackMedia(params) {
419
259
  const govSlack = isGovSlackClient(params.client);
420
260
  const files = params.files ?? [];
421
- const resolved = await pMap(files.length > 8 ? files.slice(0, 8) : files, async (file) => {
422
- const preloaded = params.preloadedMedia?.get(file);
423
- if (preloaded) return preloaded;
424
- const eventUrl = file.url_private_download ?? file.url_private;
425
- const url = eventUrl ?? await fetchFreshSlackFileUrl({
426
- file,
427
- client: params.client
428
- });
429
- if (!url) return pMapSkip;
430
- const result = await downloadSlackMediaFile({
431
- file,
432
- url,
433
- token: params.token,
434
- maxBytes: params.maxBytes,
435
- readIdleTimeoutMs: params.readIdleTimeoutMs,
436
- totalTimeoutMs: params.totalTimeoutMs,
437
- abortSignal: params.abortSignal,
438
- govSlack
439
- }).catch(() => null);
440
- if (result || !eventUrl) return result ?? pMapSkip;
441
- const freshUrl = await fetchFreshSlackFileUrl({
442
- file,
443
- client: params.client
444
- });
445
- if (!freshUrl) return pMapSkip;
446
- return await downloadSlackMediaFile({
447
- file,
448
- url: freshUrl,
449
- token: params.token,
450
- maxBytes: params.maxBytes,
451
- readIdleTimeoutMs: params.readIdleTimeoutMs,
452
- totalTimeoutMs: params.totalTimeoutMs,
453
- abortSignal: params.abortSignal,
454
- govSlack
455
- }).catch(() => null) ?? pMapSkip;
456
- }, {
457
- concurrency: MAX_SLACK_MEDIA_CONCURRENCY,
458
- stopOnError: true
261
+ const limitedFiles = files.length > 8 ? files.slice(0, 8) : files;
262
+ const refreshFileUrl = (file) => fetchFreshSlackFileUrl({
263
+ file,
264
+ client: params.client,
265
+ isRefreshedFileAllowed: params.isRefreshedFileAllowed
266
+ });
267
+ const { results } = await runTasksWithConcurrency({
268
+ tasks: limitedFiles.map((file) => async () => {
269
+ const preloaded = params.preloadedMedia?.get(file);
270
+ if (preloaded) return preloaded;
271
+ const eventUrl = file.url_private_download ?? file.url_private;
272
+ const url = eventUrl ?? await refreshFileUrl(file);
273
+ if (!url) return null;
274
+ const result = await downloadSlackMediaFile({
275
+ file,
276
+ url,
277
+ token: params.token,
278
+ maxBytes: params.maxBytes,
279
+ readIdleTimeoutMs: params.readIdleTimeoutMs,
280
+ totalTimeoutMs: params.totalTimeoutMs,
281
+ abortSignal: params.abortSignal,
282
+ govSlack
283
+ }).catch(() => null);
284
+ if (result || !eventUrl) return result;
285
+ const freshUrl = await refreshFileUrl(file);
286
+ if (!freshUrl) return null;
287
+ return await downloadSlackMediaFile({
288
+ file,
289
+ url: freshUrl,
290
+ token: params.token,
291
+ maxBytes: params.maxBytes,
292
+ readIdleTimeoutMs: params.readIdleTimeoutMs,
293
+ totalTimeoutMs: params.totalTimeoutMs,
294
+ abortSignal: params.abortSignal,
295
+ govSlack
296
+ }).catch(() => null);
297
+ }),
298
+ limit: MAX_SLACK_MEDIA_CONCURRENCY,
299
+ errorMode: "stop",
300
+ throwOnError: true
301
+ });
302
+ const resolved = results.filter((result, index) => {
303
+ if (result) params.resolvedFiles?.add(limitedFiles[index]);
304
+ return result !== null;
459
305
  });
460
306
  return resolved.length > 0 ? resolved : null;
461
307
  }
462
308
  /** Extracts text and media from forwarded-message attachments. Returns null when empty. */
463
309
  async function resolveSlackAttachmentContent(params) {
464
- const attachments = params.attachments;
465
- if (!attachments || attachments.length === 0) return null;
466
- const forwardedAttachments = attachments.filter((attachment) => isForwardedSlackAttachment(attachment)).slice(0, MAX_SLACK_FORWARDED_ATTACHMENTS);
467
- if (forwardedAttachments.length === 0) return null;
310
+ const forwardedAttachments = (params.attachments ?? []).filter((attachment) => isForwardedSlackAttachment(attachment)).slice(0, MAX_SLACK_FORWARDED_ATTACHMENTS);
311
+ const candidates = [...params.files ?? [], ...forwardedAttachments.flatMap((attachment) => attachment.files ?? [])];
312
+ if (forwardedAttachments.length === 0 && candidates.length === 0) return null;
313
+ const fileIds = /* @__PURE__ */ new Set();
314
+ const allFiles = candidates.filter((file) => {
315
+ const fileId = normalizeOptionalString(file.id);
316
+ if (!fileId) return true;
317
+ if (fileIds.has(fileId)) return false;
318
+ fileIds.add(fileId);
319
+ return true;
320
+ }).slice(0, 8).map((file) => {
321
+ const fileId = normalizeOptionalString(file.id);
322
+ const preloaded = fileId && candidates.find((candidate) => normalizeOptionalString(candidate.id) === fileId && params.preloadedMedia?.has(candidate));
323
+ if (preloaded) return preloaded;
324
+ if (!fileId || file.url_private_download || file.url_private) return file;
325
+ const downloadable = candidates.find((candidate) => normalizeOptionalString(candidate.id) === fileId && (candidate.url_private_download || candidate.url_private));
326
+ return downloadable ? Object.assign({}, file, downloadable) : file;
327
+ });
328
+ const pendingFiles = new Map(allFiles.map((file) => [normalizeOptionalString(file.id) ?? file, file]));
329
+ const resolvedFiles = /* @__PURE__ */ new Set();
330
+ const resolveFiles = (files) => resolveSlackMedia({
331
+ ...params,
332
+ resolvedFiles,
333
+ files: files?.flatMap((file) => {
334
+ const key = normalizeOptionalString(file.id) ?? file;
335
+ const selected = pendingFiles.get(key);
336
+ pendingFiles.delete(key);
337
+ return selected ? [selected] : [];
338
+ })
339
+ });
340
+ const directMediaPromise = resolveFiles(params.files);
468
341
  const textBlocks = [];
469
- const allMedia = [];
470
- const allFiles = forwardedAttachments.flatMap((attachment) => attachment.files ?? []);
342
+ const attachmentMedia = [];
471
343
  let unavailableImageCount = 0;
472
344
  const govSlack = isGovSlackClient(params.client);
473
345
  for (const att of forwardedAttachments) {
@@ -493,41 +365,51 @@ async function resolveSlackAttachmentContent(params) {
493
365
  abortSignal: params.abortSignal
494
366
  });
495
367
  const label = saved.fileName ?? "forwarded image";
496
- allMedia.push({
368
+ attachmentMedia.push({
497
369
  path: saved.path,
498
370
  contentType: saved.contentType,
371
+ ...saved.fileName ? { fileName: saved.fileName } : {},
499
372
  placeholder: `[Forwarded image: ${label}]`
500
373
  });
501
374
  } catch {
502
375
  unavailableImageCount += 1;
503
376
  }
504
- if (att.files && att.files.length > 0) {
505
- const fileMedia = await resolveSlackMedia({
506
- files: att.files,
507
- client: params.client,
508
- token: params.token,
509
- maxBytes: params.maxBytes,
510
- readIdleTimeoutMs: params.readIdleTimeoutMs,
511
- totalTimeoutMs: params.totalTimeoutMs,
512
- abortSignal: params.abortSignal
513
- });
514
- if (fileMedia) allMedia.push(...fileMedia);
515
- }
377
+ attachmentMedia.push(...await resolveFiles(att.files) ?? []);
516
378
  }
379
+ const allMedia = [...await directMediaPromise ?? [], ...attachmentMedia];
380
+ const unavailableFiles = allFiles.filter((file) => !resolvedFiles.has(file));
517
381
  const combinedText = textBlocks.join("\n\n");
518
382
  if (!combinedText && allMedia.length === 0 && allFiles.length === 0 && unavailableImageCount === 0) return null;
519
383
  return {
520
384
  text: combinedText,
521
385
  media: allMedia,
522
386
  unavailableImageCount,
523
- ...allFiles.length > 0 ? { files: allFiles } : {}
387
+ ...unavailableFiles.length > 0 ? { files: unavailableFiles } : {}
524
388
  };
525
389
  }
526
390
  //#endregion
527
391
  //#region extensions/slack/src/actions.ts
392
+ var actions_exports = /* @__PURE__ */ __exportAll({
393
+ deleteSlackMessage: () => deleteSlackMessage,
394
+ downloadSlackFile: () => downloadSlackFile,
395
+ editSlackMessage: () => editSlackMessage,
396
+ editSlackRenderedMessage: () => editSlackRenderedMessage,
397
+ getSlackMemberInfo: () => getSlackMemberInfo,
398
+ listSlackEmojis: () => listSlackEmojis,
399
+ listSlackPins: () => listSlackPins,
400
+ listSlackReactions: () => listSlackReactions,
401
+ pinSlackMessage: () => pinSlackMessage,
402
+ reactSlackMessage: () => reactSlackMessage,
403
+ readSlackMessages: () => readSlackMessages,
404
+ removeOwnSlackReactions: () => removeOwnSlackReactions,
405
+ removeSlackReaction: () => removeSlackReaction,
406
+ resolveSlackConversationName: () => resolveSlackConversationName,
407
+ sendSlackMessage: () => sendSlackMessage,
408
+ unpinSlackMessage: () => unpinSlackMessage
409
+ });
528
410
  function renderSlackReadMessageText(message) {
529
411
  if (!hasSlackMessageTableBlock(message)) return message;
530
- const text = resolveSlackMessageText$1(message, { preserveMessageTextWhitespace: true });
412
+ const text = resolveSlackMessageText(message, { preserveMessageTextWhitespace: true });
531
413
  return text && text !== message.text ? {
532
414
  ...message,
533
415
  text
@@ -691,6 +573,7 @@ async function listSlackReactions(channelId, messageId, opts = {}) {
691
573
  })).message?.reactions ?? [];
692
574
  }
693
575
  async function sendSlackMessage(to, content, opts) {
576
+ const onDeliveryResult = Object.getOwnPropertyDescriptor(opts, SLACK_PRIVATE_ACTION_DELIVERY_RESULT)?.value;
694
577
  return await sendMessageSlack(to, content, {
695
578
  accountId: opts.accountId,
696
579
  cfg: opts.cfg,
@@ -709,6 +592,7 @@ async function sendSlackMessage(to, content, opts) {
709
592
  ...Object.hasOwn(opts, "nativeDataFallbackBaseText") ? { nativeDataFallbackBaseText: opts.nativeDataFallbackBaseText } : {},
710
593
  ...opts.uploadFileName ? { uploadFileName: opts.uploadFileName } : {},
711
594
  ...opts.uploadTitle ? { uploadTitle: opts.uploadTitle } : {},
595
+ ...typeof onDeliveryResult === "function" ? { onDeliveryResult } : {},
712
596
  blocks: opts.blocks
713
597
  });
714
598
  }
@@ -842,48 +726,34 @@ function collectSlackShareMaps(file) {
842
726
  const shares = file.shares;
843
727
  return [shares.public, shares.private].filter((value) => Boolean(value) && typeof value === "object" && !Array.isArray(value));
844
728
  }
845
- function collectSlackSharedChannelIds(file) {
846
- const ids = /* @__PURE__ */ new Set();
847
- for (const shareMap of collectSlackShareMaps(file)) for (const channelId of Object.keys(shareMap)) {
848
- const normalized = normalizeOptionalString(channelId);
849
- if (normalized) ids.add(normalized);
850
- }
851
- return ids;
852
- }
853
- function collectSlackThreadShares(file, channelId) {
854
- const matches = [];
855
- for (const shareMap of collectSlackShareMaps(file)) {
856
- const rawEntries = shareMap[channelId];
857
- if (!Array.isArray(rawEntries)) continue;
729
+ function collectSlackShares(file) {
730
+ const shares = [];
731
+ for (const shareMap of collectSlackShareMaps(file)) for (const [rawChannelId, rawEntries] of Object.entries(shareMap)) {
732
+ const channelId = normalizeOptionalString(rawChannelId);
733
+ if (!channelId || !Array.isArray(rawEntries)) continue;
858
734
  for (const rawEntry of rawEntries) {
859
735
  if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) continue;
860
736
  const entry = rawEntry;
861
737
  const ts = typeof entry.ts === "string" ? normalizeOptionalString(entry.ts) : void 0;
862
738
  const threadTs = typeof entry.thread_ts === "string" ? normalizeOptionalString(entry.thread_ts) : void 0;
863
- matches.push({
739
+ if (ts || threadTs) shares.push({
864
740
  channelId,
865
741
  ts,
866
742
  threadTs
867
743
  });
868
744
  }
869
745
  }
870
- return matches;
746
+ return shares;
871
747
  }
872
- function hasSlackScopeMismatch(params) {
748
+ function lacksSlackScopeProof(params) {
873
749
  const channelId = normalizeOptionalString(params.channelId);
874
- if (!channelId) return false;
750
+ if (!channelId) return true;
875
751
  const threadId = normalizeOptionalString(params.threadId);
876
752
  const directIds = collectSlackDirectShareChannelIds(params.file);
877
- const sharedIds = collectSlackSharedChannelIds(params.file);
878
- const hasChannelEvidence = directIds.size > 0 || sharedIds.size > 0;
879
- const inChannel = directIds.has(channelId) || sharedIds.has(channelId);
880
- if (hasChannelEvidence && !inChannel) return true;
753
+ const shares = collectSlackShares(params.file);
754
+ if (!(directIds.has(channelId) || shares.some((entry) => entry.channelId === channelId))) return true;
881
755
  if (!threadId) return false;
882
- const threadShares = collectSlackThreadShares(params.file, channelId);
883
- if (threadShares.length === 0) return false;
884
- const threadEvidence = threadShares.filter((entry) => entry.threadTs || entry.ts);
885
- if (threadEvidence.length === 0) return false;
886
- return !threadEvidence.some((entry) => entry.threadTs === threadId || entry.ts === threadId);
756
+ return !shares.some((entry) => entry.channelId === channelId && (entry.threadTs === threadId || entry.ts === threadId));
887
757
  }
888
758
  /**
889
759
  * Downloads a Slack file by ID and saves it to the local media store.
@@ -893,13 +763,14 @@ function hasSlackScopeMismatch(params) {
893
763
  async function downloadSlackFile(fileId, opts) {
894
764
  const token = resolveToken(opts.token, opts.accountId, opts.cfg);
895
765
  const client = await getClient(opts);
896
- const file = (await client.files.info({ file: fileId })).file;
897
- if (!file?.url_private_download && !file?.url_private) return null;
898
- if (hasSlackScopeMismatch({
766
+ const isFileAllowed = (file) => !lacksSlackScopeProof({
899
767
  file,
900
768
  channelId: opts.channelId,
901
769
  threadId: opts.threadId
902
- })) return null;
770
+ });
771
+ const file = (await client.files.info({ file: fileId })).file;
772
+ if (!file?.url_private_download && !file?.url_private) return null;
773
+ if (!isFileAllowed(file)) return null;
903
774
  return (await resolveSlackMedia({
904
775
  files: [{
905
776
  id: file.id,
@@ -909,9 +780,10 @@ async function downloadSlackFile(fileId, opts) {
909
780
  url_private_download: file.url_private_download
910
781
  }],
911
782
  client,
783
+ isRefreshedFileAllowed: isFileAllowed,
912
784
  token,
913
785
  maxBytes: opts.maxBytes
914
786
  }))?.[0] ?? null;
915
787
  }
916
788
  //#endregion
917
- export { media_exports as _, getSlackMemberInfo as a, formatSlackFileReference 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, resolveSlackThreadHistory as v, buildSlackEditTextPayload as x, resolveSlackThreadStarter as y };
789
+ export { media_exports as _, editSlackRenderedMessage as a, formatSlackFileReferenceList 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, buildSlackEditTextPayload as x, formatSlackFileReference 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-CK4AVI2_.js";
3
- import { t as resolveSlackReplyToMode } from "./account-reply-mode-DrUXogvO.js";
4
- import { t as inspectSlackAccount } from "./account-inspect-Drw2gAiN.js";
2
+ import { a as resolveSlackAccount, i as resolveDefaultSlackAccountId, n as listSlackAccountIds, r as mergeSlackAccountConfig, t as listEnabledSlackAccounts } from "./accounts-Dm_H77gH.js";
3
+ import { r as resolveSlackReplyToMode } from "./conversation-binding-route-DFVLUdYF.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 { n as buildSlackThreadingToolContext, r as resolveSlackAutoThreadId, t as slackPlugin } from "./channel-D_tovcUL.js";
8
- import { H as buildSlackPresentationBlocks, V as buildSlackInteractiveBlocks, a as allowListMatches, c as normalizeSlackAllowOwnerEntry, ct as SLACK_MAX_BLOCKS, f as resolveSlackUserAllowed, i as resolveSlackGroupToolPolicy, l as normalizeSlackSlug, lt as parseSlackBlocksInput, o as normalizeAllowList, r as resolveSlackGroupRequireMention, s as normalizeAllowListLower, u as resolveSlackAllowListMatch, ut as validateSlackBlocksArray } from "./group-policy-c4RP9bjc.js";
9
- import { n as extractSlackToolSend, r as listSlackMessageActions } from "./message-tool-api-BykQB4AU.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-HoEg_WxB.js";
11
- import { n as resolveSlackChannelType } from "./channel-type-B9MSdoGN.js";
12
- import { t as slackSetupPlugin } from "./channel.setup-Bch9dYmA.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-BTDXwwE3.js";
14
- import { f as recordSlackThreadParticipation, l as hasSlackThreadParticipation, s as clearSlackThreadParticipationCache } from "./send-Nor0iBwY.js";
15
- import { n as listSlackDirectoryGroupsFromConfig, r as listSlackDirectoryPeersFromConfig } from "./directory-config-CNBz8lJa.js";
16
- import { t as collectSlackSecurityAuditFindings } from "./security-audit-DR097212.js";
17
- import { n as resolveSlackRuntimeGroupPolicy } from "./provider-CDNvBXUi.js";
7
+ import { H as buildSlackPresentationBlocks, V as buildSlackInteractiveBlocks, c as allowListMatches, d as normalizeSlackAllowOwnerEntry, f as normalizeSlackSlug, h as resolveSlackUserAllowed, ht as validateSlackBlocksArray, i as resolveSlackGroupToolPolicy, l as normalizeAllowList, mt as parseSlackBlocksInput, p as resolveSlackAllowListMatch, pt as SLACK_MAX_BLOCKS, r as resolveSlackGroupRequireMention, u as normalizeAllowListLower, zt as resolveSlackAutoThreadId } from "./group-policy-CU1tEGpS.js";
8
+ import { n as buildSlackThreadingToolContext, t as slackPlugin } from "./channel-C_vnTgxo.js";
9
+ import { n as extractSlackToolSend, r as listSlackMessageActions } from "./message-tool-api-CWosHSi5.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-4_aHtVT3.js";
11
+ import { n as resolveSlackChannelType } from "./channel-type-j-2lalcC.js";
12
+ import { t as slackSetupPlugin } from "./channel.setup-aal8tokM.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-XdQyjG_p.js";
14
+ import { f as recordSlackThreadParticipation, l as hasSlackThreadParticipation, s as clearSlackThreadParticipationCache } from "./send-DtjEnlLh.js";
15
+ import { n as listSlackDirectoryGroupsFromConfig, r as listSlackDirectoryPeersFromConfig } from "./directory-config-DqfQ42OV.js";
16
+ import { t as collectSlackSecurityAuditFindings } from "./security-audit-B_yKr7MW.js";
17
+ import { n as resolveSlackRuntimeGroupPolicy } from "./provider-D4nDgxCh.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 };