@openclaw/slack 2026.8.1-beta.3 → 2026.8.2
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.
- package/dist/account-configured-sUohAxZr.js +33 -0
- package/dist/account-inspect-C3sePHWa.js +87 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-BlzxuYle.js → accounts-Dm_H77gH.js} +7 -10
- package/dist/{accounts.runtime-CbabBL8x.js → accounts.runtime-DRuEK6mL.js} +1 -1
- package/dist/{action-runtime-D6jg2CQd.js → action-runtime-B0kRJ69h.js} +90 -75
- package/dist/action-runtime.runtime-IuA14rev.js +2 -0
- package/dist/{actions-DFk0ANVB.js → actions-BOxiu2Vy.js} +278 -102
- package/dist/api.js +15 -15
- package/dist/{approval-handler.runtime-BNvAoKdK.js → approval-handler.runtime-l5_2JLqi.js} +58 -180
- package/dist/{channel-CA5w7qDF.js → channel-BguxhhNG.js} +97 -154
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-CZWv55Wu.js → channel-type-ChkODKBW.js} +3 -3
- package/dist/{channel.setup-CpyYsEXH.js → channel.setup-BJohRJha.js} +54 -68
- package/dist/{config-schema-CN3XZRX5.js → config-schema-B9GwoRlE.js} +24 -15
- package/dist/configured-state.js +34 -0
- package/dist/{conversation-binding-route-DFVLUdYF.js → conversation-binding-route-Vee8Dgbf.js} +2 -2
- package/dist/{directory-config-BGYyuzWh.js → directory-config-Bmw4ykSy.js} +5 -4
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DjUJQLbq.js → directory-live-BOILcXPo.js} +2 -2
- package/dist/{doctor-contract-BAy7-EUQ.js → doctor-contract-BNjw9bxb.js} +5 -4
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{group-policy-DyfB_ZIE.js → group-policy-BYH74y50.js} +643 -774
- package/dist/{message-tool-api-CqMr5Rmc.js → message-tool-api-BsZbsulu.js} +23 -5
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-Chrecrb9.js → monitor-B72wWXWg.js} +3 -3
- package/dist/{outbound-adapter-DuRqAQXK.js → outbound-adapter-CPgYQ-BM.js} +94 -69
- package/dist/{pipeline.runtime-Bbfd5VFW.js → pipeline.runtime-CcdujV99.js} +357 -544
- package/dist/{policy-BKXSxrIS.js → policy-CUpBeOt9.js} +7 -4
- package/dist/{probe-BVA65leh.js → probe-gj5yQgN2.js} +209 -21
- package/dist/{provider-CUUiwsg2.js → provider-DW9YC_no.js} +301 -179
- package/dist/{relay-source-mhpMMRG-.js → relay-source-BLMdBrAw.js} +6 -4
- package/dist/{replies-SnWyXcsL.js → replies-DLjQ8RYU.js} +25 -10
- package/dist/{resolve-channels-BSpqC8jU.js → resolve-channels-Bv6IiGZ4.js} +4 -3
- package/dist/{resolve-users-Dvz9pDe0.js → resolve-users-BXw2pA7y.js} +4 -3
- package/dist/runtime-api.js +11 -11
- package/dist/{scopes-BSk4GZvZ.js → scopes-B9HRguDe.js} +1 -1
- package/dist/{send-CtnOxKCc.js → send-GUz4_v2E.js} +58 -42
- package/dist/send-results-eeOu_HYm.js +23 -0
- package/dist/{send.runtime-kYctMHSd.js → send.runtime-rScD-UJi.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BPFfp6So.js → setup-surface-Cc3P-z35.js} +6 -6
- package/dist/{shared-DJBaslN7.js → shared-CQGVZ_8a.js} +28 -8
- package/dist/{slash-dispatch.runtime-Cf2FTrnf.js → slash-dispatch.runtime-C2015r6s.js} +3 -3
- package/dist/{target-parsing-BnMD2ZqZ.js → target-parsing-PbxGDbr9.js} +11 -6
- package/dist/{targets-Cx5W_n3W.js → targets-7FexXJ62.js} +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/bolt/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/bolt/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/bolt/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/bolt/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/bolt/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/bolt/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/README.md +2 -0
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/package.json +1 -1
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/README.md +71 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/package.json +52 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/package.json +16 -10
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/README.md +2 -0
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/package.json +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/socket-mode/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/socket-mode/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/socket-mode/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/socket-mode/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/socket-mode/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/socket-mode/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/socket-mode/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/socket-mode/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/socket-mode/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/web-api/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/web-api/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/web-api/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +41 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +14 -6
- package/package.json +9 -7
- package/dist/account-configured-BwfXBo_F.js +0 -14
- package/dist/account-inspect-YJvFBbCR.js +0 -89
- package/dist/action-runtime.runtime-JtoOK9l5.js +0 -2
- package/dist/actions.runtime-CYLsYRai.js +0 -2
- package/dist/runtime-api-DBi7xc_g.js +0 -10
- package/dist/slack-client-kind-BXyOOICI.js +0 -94
- package/node_modules/@slack/bolt/node_modules/negotiator/HISTORY.md +0 -114
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- 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-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { m as buildSlackNativeDataDeliveryPlan, r as sendMessageSlack } from "./send-
|
|
2
|
+
import { a as resolveSlackAccount, f as resolveSlackBotToken, i as resolveDefaultSlackAccountId } from "./accounts-Dm_H77gH.js";
|
|
3
|
+
import { n as formatSlackTarget } from "./target-parsing-PbxGDbr9.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-BYH74y50.js";
|
|
5
|
+
import { m as getSlackWriteClient, s as createSlackLookupClient } from "./probe-gj5yQgN2.js";
|
|
6
|
+
import { m as buildSlackNativeDataDeliveryPlan, r as sendMessageSlack } from "./send-GUz4_v2E.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();
|
|
@@ -21,12 +48,92 @@ function buildSlackEditTextPayload(content, blocks) {
|
|
|
21
48
|
if (trimmedContent && !blockText) return trimmedContent;
|
|
22
49
|
if (trimmedContent) {
|
|
23
50
|
const nativePlainText = blocks?.length ? appendSlackNativeDataPlainTextFallback("", blocks).trim() : "";
|
|
24
|
-
|
|
51
|
+
const fallbackText = Boolean(blockText && trimmedContent.includes(blockText)) || Boolean(nativePlainText && trimmedContent.includes(nativePlainText)) ? trimmedContent : blockText && !blockText.includes(trimmedContent) ? `${trimmedContent}\n\n${blockText}` : blockText || trimmedContent;
|
|
52
|
+
return truncateSlackTextByUtf8Bytes(fallbackText, SLACK_EDIT_TEXT_MAX_BYTES);
|
|
25
53
|
}
|
|
26
54
|
if (blockText) return truncateSlackTextByUtf8Bytes(blockText, SLACK_EDIT_TEXT_MAX_BYTES);
|
|
27
55
|
return " ";
|
|
28
56
|
}
|
|
29
57
|
//#endregion
|
|
58
|
+
//#region extensions/slack/src/monitor/block-text.ts
|
|
59
|
+
function readSlackBlockType(block) {
|
|
60
|
+
return block && typeof block === "object" && !Array.isArray(block) ? block.type : void 0;
|
|
61
|
+
}
|
|
62
|
+
function hasSlackTableBlock(blocks) {
|
|
63
|
+
return blocks?.some((block) => readSlackBlockType(block) === "table") ?? false;
|
|
64
|
+
}
|
|
65
|
+
function hasSlackMessageTableBlock(message) {
|
|
66
|
+
return hasSlackTableBlock(message.blocks) || message.attachments?.some((attachment) => !isSlackUnfurlAttachment(attachment) && hasSlackTableBlock(attachment.blocks)) === true;
|
|
67
|
+
}
|
|
68
|
+
function isSlackUnfurlAttachment(attachment) {
|
|
69
|
+
return attachment.is_msg_unfurl === true || attachment.is_app_unfurl === true || typeof attachment.app_unfurl_url === "string" && attachment.app_unfurl_url.trim().length > 0;
|
|
70
|
+
}
|
|
71
|
+
function resolveSlackBlocksText(blocks) {
|
|
72
|
+
if (!blocks?.length) return;
|
|
73
|
+
const parts = [];
|
|
74
|
+
let hasRichText = false;
|
|
75
|
+
let hasNativeData = false;
|
|
76
|
+
for (const block of blocks) {
|
|
77
|
+
const blockType = readSlackBlockType(block);
|
|
78
|
+
hasRichText ||= blockType === "rich_text";
|
|
79
|
+
hasNativeData ||= blockType === "data_visualization" || blockType === "data_table" || blockType === "table";
|
|
80
|
+
const text = renderSlackBlockFallbackText(block, {
|
|
81
|
+
nativeDataFormat: "plain",
|
|
82
|
+
nativeReferenceFormat: "plain"
|
|
83
|
+
});
|
|
84
|
+
if (text) parts.push(text);
|
|
85
|
+
}
|
|
86
|
+
return parts.length > 0 ? {
|
|
87
|
+
text: parts.join("\n"),
|
|
88
|
+
hasRichText,
|
|
89
|
+
hasNativeData
|
|
90
|
+
} : void 0;
|
|
91
|
+
}
|
|
92
|
+
function appendDistinctSlackText(base, addition) {
|
|
93
|
+
if (!base) return addition;
|
|
94
|
+
const comparableBase = `\n${base.replace(/\r\n?/g, "\n")}\n`;
|
|
95
|
+
const comparableAddition = `\n${addition.replace(/\r\n?/g, "\n")}\n`;
|
|
96
|
+
if (comparableBase.includes(comparableAddition)) return base;
|
|
97
|
+
return `${base}\n${addition}`;
|
|
98
|
+
}
|
|
99
|
+
function resolveSlackAttachmentTableTexts(attachments) {
|
|
100
|
+
const seen = /* @__PURE__ */ new Set();
|
|
101
|
+
const texts = [];
|
|
102
|
+
for (const attachment of attachments ?? []) {
|
|
103
|
+
if (isSlackUnfurlAttachment(attachment)) continue;
|
|
104
|
+
for (const block of attachment.blocks ?? []) {
|
|
105
|
+
if (readSlackBlockType(block) !== "table") continue;
|
|
106
|
+
const text = renderSlackBlockFallbackText(block, { nativeDataFormat: "plain" });
|
|
107
|
+
if (!text || seen.has(text)) continue;
|
|
108
|
+
seen.add(text);
|
|
109
|
+
texts.push(text);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return texts;
|
|
113
|
+
}
|
|
114
|
+
/** Resolve agent-visible Slack text while admitting only native tables from attachments. */
|
|
115
|
+
function resolveSlackMessageText(message, options = {}) {
|
|
116
|
+
let resolved = chooseSlackPrimaryText({
|
|
117
|
+
messageText: options.preserveMessageTextWhitespace ? typeof message.text === "string" && message.text.trim().length > 0 ? message.text : void 0 : normalizeOptionalString(message.text),
|
|
118
|
+
blocksText: resolveSlackBlocksText(message.blocks)
|
|
119
|
+
});
|
|
120
|
+
for (const tableText of resolveSlackAttachmentTableTexts(message.attachments)) resolved = appendDistinctSlackText(resolved, tableText);
|
|
121
|
+
return resolved;
|
|
122
|
+
}
|
|
123
|
+
function chooseSlackPrimaryText(params) {
|
|
124
|
+
const { messageText, blocksText } = params;
|
|
125
|
+
if (!blocksText) return messageText;
|
|
126
|
+
if (!messageText) return blocksText.text;
|
|
127
|
+
if (blocksText.hasNativeData) {
|
|
128
|
+
const comparableMessageText = messageText.replace(/\s+/g, " ").trim();
|
|
129
|
+
const comparableBlocksText = blocksText.text.replace(/\s+/g, " ").trim();
|
|
130
|
+
if (comparableMessageText.includes(comparableBlocksText)) return messageText;
|
|
131
|
+
return comparableBlocksText.startsWith(comparableMessageText) ? blocksText.text : `${messageText}\n${blocksText.text}`;
|
|
132
|
+
}
|
|
133
|
+
if (blocksText.hasRichText && blocksText.text.length > messageText.length) return blocksText.text;
|
|
134
|
+
return blocksText.text.length > messageText.length && blocksText.text.startsWith(messageText) ? blocksText.text : messageText;
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
30
137
|
//#region extensions/slack/src/file-reference.ts
|
|
31
138
|
function formatSlackFileReference(file) {
|
|
32
139
|
const name = normalizeOptionalString(file?.name) ?? "file";
|
|
@@ -45,6 +152,21 @@ function formatSlackFileReferenceList(files) {
|
|
|
45
152
|
return files.map((file) => formatSlackFileReference(file)).join(", ");
|
|
46
153
|
}
|
|
47
154
|
//#endregion
|
|
155
|
+
//#region extensions/slack/src/monitor/media.runtime.ts
|
|
156
|
+
const slackMediaLog = createSubsystemLogger("gateway/channels/slack").child("media");
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region extensions/slack/src/monitor/slack-client-kind.ts
|
|
159
|
+
/** Detects the isolated GovSlack API plane without consulting mutable config. */
|
|
160
|
+
function isGovSlackClient(client) {
|
|
161
|
+
if (!client?.slackApiUrl) return false;
|
|
162
|
+
try {
|
|
163
|
+
const apiUrl = new URL(client.slackApiUrl);
|
|
164
|
+
return apiUrl.protocol === "https:" && !apiUrl.port && normalizeHostname(apiUrl.hostname) === "slack-gov.com";
|
|
165
|
+
} catch {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
48
170
|
//#region extensions/slack/src/monitor/media.ts
|
|
49
171
|
var media_exports = /* @__PURE__ */ __exportAll({
|
|
50
172
|
SLACK_MEDIA_READ_IDLE_TIMEOUT_MS: () => SLACK_MEDIA_READ_IDLE_TIMEOUT_MS,
|
|
@@ -180,10 +302,18 @@ async function looksLikeHtmlFile(filePath) {
|
|
|
180
302
|
}
|
|
181
303
|
const MAX_SLACK_MEDIA_CONCURRENCY = 3;
|
|
182
304
|
const MAX_SLACK_FORWARDED_ATTACHMENTS = 8;
|
|
305
|
+
const SLACK_MEDIA_LIMIT_REASON = `omitted: 8-file limit`;
|
|
306
|
+
function formatSlackMediaFailure(error) {
|
|
307
|
+
return redactToolPayloadText(formatErrorMessage(error)).replace(/\s+/g, " ").slice(0, 200);
|
|
308
|
+
}
|
|
183
309
|
async function fetchFreshSlackFileUrl(params) {
|
|
184
310
|
if (!params.file.id || !params.client) return null;
|
|
185
311
|
try {
|
|
186
312
|
const freshFile = (await params.client.files.info({ file: params.file.id })).file;
|
|
313
|
+
if (freshFile && params.isRefreshedFileAllowed?.(freshFile) === false) {
|
|
314
|
+
logVerbose$1(`slack: refreshed file metadata rejected for file id=${params.file.id}`);
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
187
317
|
const freshUrl = freshFile?.url_private_download ?? freshFile?.url_private;
|
|
188
318
|
if (freshUrl) {
|
|
189
319
|
logVerbose$1(`slack: refreshed file URL via files.info for file id=${params.file.id}`);
|
|
@@ -217,7 +347,7 @@ async function downloadSlackMediaFile(params) {
|
|
|
217
347
|
if (!(fileMime === "text/html" || fileName.endsWith(".html") || fileName.endsWith(".htm"))) {
|
|
218
348
|
if (normalizeOptionalLowercaseString(saved.contentType?.split(";")[0]) === "text/html" || await looksLikeHtmlFile(saved.path)) {
|
|
219
349
|
await fs.rm(saved.path, { force: true }).catch(() => void 0);
|
|
220
|
-
|
|
350
|
+
throw new Error("blocked: unexpected HTML content");
|
|
221
351
|
}
|
|
222
352
|
}
|
|
223
353
|
const effectiveMime = resolveSlackMediaMimetype(params.file, saved.contentType);
|
|
@@ -226,6 +356,7 @@ async function downloadSlackMediaFile(params) {
|
|
|
226
356
|
return {
|
|
227
357
|
path: saved.path,
|
|
228
358
|
...contentType ? { contentType } : {},
|
|
359
|
+
...label ? { fileName: label } : {},
|
|
229
360
|
placeholder: `[Slack file: ${formatSlackFileReference({
|
|
230
361
|
...params.file,
|
|
231
362
|
name: label
|
|
@@ -253,42 +384,36 @@ function resolveForwardedAttachmentImageUrl(attachment, govSlack) {
|
|
|
253
384
|
async function resolveSlackMedia(params) {
|
|
254
385
|
const govSlack = isGovSlackClient(params.client);
|
|
255
386
|
const files = params.files ?? [];
|
|
387
|
+
const limitedFiles = files.length > 8 ? files.slice(0, 8) : files;
|
|
388
|
+
for (const file of files.slice(8)) params.unavailableFiles?.set(file, SLACK_MEDIA_LIMIT_REASON);
|
|
389
|
+
const refreshFileUrl = (file) => fetchFreshSlackFileUrl({
|
|
390
|
+
file,
|
|
391
|
+
client: params.client,
|
|
392
|
+
isRefreshedFileAllowed: params.isRefreshedFileAllowed
|
|
393
|
+
});
|
|
256
394
|
const { results } = await runTasksWithConcurrency({
|
|
257
|
-
tasks:
|
|
395
|
+
tasks: limitedFiles.map((file) => async () => {
|
|
258
396
|
const preloaded = params.preloadedMedia?.get(file);
|
|
259
397
|
if (preloaded) return preloaded;
|
|
260
398
|
const eventUrl = file.url_private_download ?? file.url_private;
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
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);
|
|
399
|
+
let url = eventUrl ?? await refreshFileUrl(file);
|
|
400
|
+
let reason = "no private download URL";
|
|
401
|
+
for (let attempt = 0; url && attempt < 2; attempt += 1) {
|
|
402
|
+
try {
|
|
403
|
+
return await downloadSlackMediaFile({
|
|
404
|
+
...params,
|
|
405
|
+
file,
|
|
406
|
+
url,
|
|
407
|
+
govSlack
|
|
408
|
+
});
|
|
409
|
+
} catch (error) {
|
|
410
|
+
reason = formatSlackMediaFailure(error);
|
|
411
|
+
}
|
|
412
|
+
url = attempt === 0 && eventUrl ? await refreshFileUrl(file) : null;
|
|
413
|
+
}
|
|
414
|
+
params.unavailableFiles?.set(file, reason);
|
|
415
|
+
slackMediaLog.warn(`slack: file ${formatSlackFileReference(file)} unavailable (${reason})`);
|
|
416
|
+
return null;
|
|
292
417
|
}),
|
|
293
418
|
limit: MAX_SLACK_MEDIA_CONCURRENCY,
|
|
294
419
|
errorMode: "stop",
|
|
@@ -299,14 +424,41 @@ async function resolveSlackMedia(params) {
|
|
|
299
424
|
}
|
|
300
425
|
/** Extracts text and media from forwarded-message attachments. Returns null when empty. */
|
|
301
426
|
async function resolveSlackAttachmentContent(params) {
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
427
|
+
const forwardedAttachments = (params.attachments ?? []).filter((attachment) => isForwardedSlackAttachment(attachment)).slice(0, MAX_SLACK_FORWARDED_ATTACHMENTS);
|
|
428
|
+
const candidates = [...params.files ?? [], ...forwardedAttachments.flatMap((attachment) => attachment.files ?? [])];
|
|
429
|
+
if (forwardedAttachments.length === 0 && candidates.length === 0) return null;
|
|
430
|
+
const fileIds = /* @__PURE__ */ new Set();
|
|
431
|
+
const allFiles = candidates.filter((file) => {
|
|
432
|
+
const fileId = normalizeOptionalString(file.id);
|
|
433
|
+
if (!fileId) return true;
|
|
434
|
+
if (fileIds.has(fileId)) return false;
|
|
435
|
+
fileIds.add(fileId);
|
|
436
|
+
return true;
|
|
437
|
+
}).map((file, index) => {
|
|
438
|
+
if (index >= 8) return file;
|
|
439
|
+
const fileId = normalizeOptionalString(file.id);
|
|
440
|
+
const preloaded = fileId && candidates.find((candidate) => normalizeOptionalString(candidate.id) === fileId && params.preloadedMedia?.has(candidate));
|
|
441
|
+
if (preloaded) return preloaded;
|
|
442
|
+
if (!fileId || file.url_private_download || file.url_private) return file;
|
|
443
|
+
const downloadable = candidates.find((candidate) => normalizeOptionalString(candidate.id) === fileId && (candidate.url_private_download || candidate.url_private));
|
|
444
|
+
return downloadable ? Object.assign({}, file, downloadable) : file;
|
|
445
|
+
});
|
|
446
|
+
const pendingFiles = new Map(allFiles.slice(0, 8).map((file) => [normalizeOptionalString(file.id) ?? file, file]));
|
|
447
|
+
const unavailableFileReasons = /* @__PURE__ */ new Map();
|
|
448
|
+
const resolveFiles = (files) => resolveSlackMedia({
|
|
449
|
+
...params,
|
|
450
|
+
unavailableFiles: unavailableFileReasons,
|
|
451
|
+
files: files?.flatMap((file) => {
|
|
452
|
+
const key = normalizeOptionalString(file.id) ?? file;
|
|
453
|
+
const selected = pendingFiles.get(key);
|
|
454
|
+
pendingFiles.delete(key);
|
|
455
|
+
return selected ? [selected] : [];
|
|
456
|
+
})
|
|
457
|
+
});
|
|
458
|
+
const directMediaPromise = resolveFiles(params.files);
|
|
306
459
|
const textBlocks = [];
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
let unavailableImageCount = 0;
|
|
460
|
+
const attachmentMedia = [];
|
|
461
|
+
let unavailableMediaCount = 0;
|
|
310
462
|
const govSlack = isGovSlackClient(params.client);
|
|
311
463
|
for (const att of forwardedAttachments) {
|
|
312
464
|
const text = att.text?.trim() || att.fallback?.trim();
|
|
@@ -331,38 +483,57 @@ async function resolveSlackAttachmentContent(params) {
|
|
|
331
483
|
abortSignal: params.abortSignal
|
|
332
484
|
});
|
|
333
485
|
const label = saved.fileName ?? "forwarded image";
|
|
334
|
-
|
|
486
|
+
attachmentMedia.push({
|
|
335
487
|
path: saved.path,
|
|
336
488
|
contentType: saved.contentType,
|
|
489
|
+
...saved.fileName ? { fileName: saved.fileName } : {},
|
|
337
490
|
placeholder: `[Forwarded image: ${label}]`
|
|
338
491
|
});
|
|
339
|
-
} catch {
|
|
340
|
-
|
|
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);
|
|
492
|
+
} catch (error) {
|
|
493
|
+
unavailableMediaCount += 1;
|
|
494
|
+
slackMediaLog.warn(`slack: forwarded image unavailable (${formatSlackMediaFailure(error)})`);
|
|
353
495
|
}
|
|
496
|
+
attachmentMedia.push(...await resolveFiles(att.files) ?? []);
|
|
354
497
|
}
|
|
498
|
+
const allMedia = [...await directMediaPromise ?? [], ...attachmentMedia];
|
|
499
|
+
const unavailableFiles = allFiles.flatMap((file, index) => {
|
|
500
|
+
const reason = index >= 8 ? SLACK_MEDIA_LIMIT_REASON : unavailableFileReasons.get(file);
|
|
501
|
+
return reason ? [{
|
|
502
|
+
...file,
|
|
503
|
+
reason
|
|
504
|
+
}] : [];
|
|
505
|
+
});
|
|
506
|
+
unavailableMediaCount += unavailableFiles.length;
|
|
355
507
|
const combinedText = textBlocks.join("\n\n");
|
|
356
|
-
if (!combinedText && allMedia.length === 0 && allFiles.length === 0 &&
|
|
508
|
+
if (!combinedText && allMedia.length === 0 && allFiles.length === 0 && unavailableMediaCount === 0) return null;
|
|
357
509
|
return {
|
|
358
510
|
text: combinedText,
|
|
359
511
|
media: allMedia,
|
|
360
|
-
|
|
361
|
-
...
|
|
512
|
+
unavailableMediaCount,
|
|
513
|
+
...unavailableFiles.length > 0 ? { files: unavailableFiles } : {}
|
|
362
514
|
};
|
|
363
515
|
}
|
|
364
516
|
//#endregion
|
|
365
517
|
//#region extensions/slack/src/actions.ts
|
|
518
|
+
var actions_exports = /* @__PURE__ */ __exportAll({
|
|
519
|
+
deleteSlackMessage: () => deleteSlackMessage,
|
|
520
|
+
downloadSlackFile: () => downloadSlackFile,
|
|
521
|
+
editSlackMessage: () => editSlackMessage,
|
|
522
|
+
editSlackRenderedMessage: () => editSlackRenderedMessage,
|
|
523
|
+
getSlackMemberInfo: () => getSlackMemberInfo,
|
|
524
|
+
listSlackEmojis: () => listSlackEmojis,
|
|
525
|
+
listSlackPins: () => listSlackPins,
|
|
526
|
+
listSlackReactions: () => listSlackReactions,
|
|
527
|
+
openSlackConversation: () => openSlackConversation,
|
|
528
|
+
pinSlackMessage: () => pinSlackMessage,
|
|
529
|
+
reactSlackMessage: () => reactSlackMessage,
|
|
530
|
+
readSlackMessages: () => readSlackMessages,
|
|
531
|
+
removeOwnSlackReactions: () => removeOwnSlackReactions,
|
|
532
|
+
removeSlackReaction: () => removeSlackReaction,
|
|
533
|
+
resolveSlackConversationName: () => resolveSlackConversationName,
|
|
534
|
+
sendSlackMessage: () => sendSlackMessage,
|
|
535
|
+
unpinSlackMessage: () => unpinSlackMessage
|
|
536
|
+
});
|
|
366
537
|
function renderSlackReadMessageText(message) {
|
|
367
538
|
if (!hasSlackMessageTableBlock(message)) return message;
|
|
368
539
|
const text = resolveSlackMessageText(message, { preserveMessageTextWhitespace: true });
|
|
@@ -377,8 +548,9 @@ function resolveToken(explicit, accountId, cfg) {
|
|
|
377
548
|
if (token) return token;
|
|
378
549
|
}
|
|
379
550
|
if (!cfg) throw new Error("Slack actions requires a resolved runtime config. Load and resolve config at the command or gateway boundary, then pass cfg through the runtime path.");
|
|
551
|
+
const resolvedCfg = requireRuntimeConfig(cfg, "Slack actions");
|
|
380
552
|
const account = resolveSlackAccount({
|
|
381
|
-
cfg:
|
|
553
|
+
cfg: resolvedCfg,
|
|
382
554
|
accountId
|
|
383
555
|
});
|
|
384
556
|
const token = resolveSlackBotToken(account.botToken ?? void 0);
|
|
@@ -465,10 +637,11 @@ function hasSlackPlatformError(err, code) {
|
|
|
465
637
|
}
|
|
466
638
|
async function getClient(opts = {}, mode = "read") {
|
|
467
639
|
if (opts.client) return opts.client;
|
|
468
|
-
|
|
640
|
+
const accountId = opts.cfg ? resolveSlackAccount({
|
|
469
641
|
cfg: requireRuntimeConfig(opts.cfg, "Slack actions"),
|
|
470
642
|
accountId: opts.accountId
|
|
471
|
-
}).accountId : normalizeAccountId(opts.accountId)
|
|
643
|
+
}).accountId : normalizeAccountId(opts.accountId);
|
|
644
|
+
assertSlackDetachedTargetAllowed(accountId, opts.teamId);
|
|
472
645
|
const token = resolveToken(opts.token, opts.accountId, opts.cfg);
|
|
473
646
|
if (mode === "write") return getSlackWriteClient(token, { teamId: opts.teamId });
|
|
474
647
|
return createSlackLookupClient(token, { teamId: opts.teamId });
|
|
@@ -553,7 +726,13 @@ async function sendSlackMessage(to, content, opts) {
|
|
|
553
726
|
});
|
|
554
727
|
}
|
|
555
728
|
async function editSlackMessage(channelId, messageId, content, opts = {}) {
|
|
556
|
-
|
|
729
|
+
const accountId = opts.accountId ?? (opts.cfg ? resolveDefaultSlackAccountId(opts.cfg) : void 0);
|
|
730
|
+
const tableMode = resolveMarkdownTableMode({
|
|
731
|
+
cfg: opts.cfg,
|
|
732
|
+
channel: "slack",
|
|
733
|
+
accountId
|
|
734
|
+
});
|
|
735
|
+
await editSlackRenderedMessage(channelId, messageId, normalizeSlackOutboundText(content, { tableMode }), opts);
|
|
557
736
|
}
|
|
558
737
|
async function editSlackRenderedMessage(channelId, messageId, content, opts = {}) {
|
|
559
738
|
const client = await getClient(opts, "write");
|
|
@@ -573,10 +752,12 @@ async function editSlackRenderedMessage(channelId, messageId, content, opts = {}
|
|
|
573
752
|
} catch (error) {
|
|
574
753
|
if (!hasSlackNativeDataBlock(blocks) || !isSlackInvalidBlocksError(error)) throw error;
|
|
575
754
|
logVerbose("slack edit: native data block rejected, retrying with text fallback");
|
|
576
|
-
const
|
|
755
|
+
const survivorBlocks = stripSlackNativeDataBlocks(blocks);
|
|
756
|
+
const survivorText = buildSlackBlocksFallbackText(survivorBlocks) ?? "";
|
|
577
757
|
const authoredEditText = content.trim();
|
|
758
|
+
const baseText = authoredEditText && !survivorText.includes(authoredEditText) ? authoredEditText : "";
|
|
578
759
|
const fallbackPlan = buildSlackNativeDataDeliveryPlan({
|
|
579
|
-
baseText
|
|
760
|
+
baseText,
|
|
580
761
|
blocks: blocks ?? []
|
|
581
762
|
});
|
|
582
763
|
if (fallbackPlan.fallbackMessages.length !== 1) throw new Error("Slack native chart or table edit fallback requires multiple messages. Send a new message instead.", { cause: error });
|
|
@@ -598,6 +779,13 @@ async function deleteSlackMessage(channelId, messageId, opts = {}) {
|
|
|
598
779
|
ts: messageId
|
|
599
780
|
});
|
|
600
781
|
}
|
|
782
|
+
async function openSlackConversation(userIds, opts = {}) {
|
|
783
|
+
const input = parseSlackConversationOpenInput(userIds, opts.teamId);
|
|
784
|
+
return await openSlackConversationWithClient(await getClient({
|
|
785
|
+
...opts,
|
|
786
|
+
teamId: input.teamId
|
|
787
|
+
}, "write"), input);
|
|
788
|
+
}
|
|
601
789
|
async function resolveSlackConversationName(channelId, opts = {}) {
|
|
602
790
|
return (await (await getClient(opts, "read")).conversations.info({ channel: channelId })).channel?.name?.trim() || void 0;
|
|
603
791
|
}
|
|
@@ -682,48 +870,34 @@ function collectSlackShareMaps(file) {
|
|
|
682
870
|
const shares = file.shares;
|
|
683
871
|
return [shares.public, shares.private].filter((value) => Boolean(value) && typeof value === "object" && !Array.isArray(value));
|
|
684
872
|
}
|
|
685
|
-
function
|
|
686
|
-
const
|
|
687
|
-
for (const shareMap of collectSlackShareMaps(file)) for (const
|
|
688
|
-
const
|
|
689
|
-
if (
|
|
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;
|
|
873
|
+
function collectSlackShares(file) {
|
|
874
|
+
const shares = [];
|
|
875
|
+
for (const shareMap of collectSlackShareMaps(file)) for (const [rawChannelId, rawEntries] of Object.entries(shareMap)) {
|
|
876
|
+
const channelId = normalizeOptionalString(rawChannelId);
|
|
877
|
+
if (!channelId || !Array.isArray(rawEntries)) continue;
|
|
698
878
|
for (const rawEntry of rawEntries) {
|
|
699
879
|
if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) continue;
|
|
700
880
|
const entry = rawEntry;
|
|
701
881
|
const ts = typeof entry.ts === "string" ? normalizeOptionalString(entry.ts) : void 0;
|
|
702
882
|
const threadTs = typeof entry.thread_ts === "string" ? normalizeOptionalString(entry.thread_ts) : void 0;
|
|
703
|
-
|
|
883
|
+
if (ts || threadTs) shares.push({
|
|
704
884
|
channelId,
|
|
705
885
|
ts,
|
|
706
886
|
threadTs
|
|
707
887
|
});
|
|
708
888
|
}
|
|
709
889
|
}
|
|
710
|
-
return
|
|
890
|
+
return shares;
|
|
711
891
|
}
|
|
712
|
-
function
|
|
892
|
+
function lacksSlackScopeProof(params) {
|
|
713
893
|
const channelId = normalizeOptionalString(params.channelId);
|
|
714
|
-
if (!channelId) return
|
|
894
|
+
if (!channelId) return true;
|
|
715
895
|
const threadId = normalizeOptionalString(params.threadId);
|
|
716
896
|
const directIds = collectSlackDirectShareChannelIds(params.file);
|
|
717
|
-
const
|
|
718
|
-
|
|
719
|
-
const inChannel = directIds.has(channelId) || sharedIds.has(channelId);
|
|
720
|
-
if (hasChannelEvidence && !inChannel) return true;
|
|
897
|
+
const shares = collectSlackShares(params.file);
|
|
898
|
+
if (!(directIds.has(channelId) || shares.some((entry) => entry.channelId === channelId))) return true;
|
|
721
899
|
if (!threadId) return false;
|
|
722
|
-
|
|
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);
|
|
900
|
+
return !shares.some((entry) => entry.channelId === channelId && (entry.threadTs === threadId || entry.ts === threadId));
|
|
727
901
|
}
|
|
728
902
|
/**
|
|
729
903
|
* Downloads a Slack file by ID and saves it to the local media store.
|
|
@@ -733,13 +907,14 @@ function hasSlackScopeMismatch(params) {
|
|
|
733
907
|
async function downloadSlackFile(fileId, opts) {
|
|
734
908
|
const token = resolveToken(opts.token, opts.accountId, opts.cfg);
|
|
735
909
|
const client = await getClient(opts);
|
|
736
|
-
const
|
|
737
|
-
if (!file?.url_private_download && !file?.url_private) return null;
|
|
738
|
-
if (hasSlackScopeMismatch({
|
|
910
|
+
const isFileAllowed = (file) => !lacksSlackScopeProof({
|
|
739
911
|
file,
|
|
740
912
|
channelId: opts.channelId,
|
|
741
913
|
threadId: opts.threadId
|
|
742
|
-
})
|
|
914
|
+
});
|
|
915
|
+
const file = (await client.files.info({ file: fileId })).file;
|
|
916
|
+
if (!file?.url_private_download && !file?.url_private) return null;
|
|
917
|
+
if (!isFileAllowed(file)) return null;
|
|
743
918
|
return (await resolveSlackMedia({
|
|
744
919
|
files: [{
|
|
745
920
|
id: file.id,
|
|
@@ -749,9 +924,10 @@ async function downloadSlackFile(fileId, opts) {
|
|
|
749
924
|
url_private_download: file.url_private_download
|
|
750
925
|
}],
|
|
751
926
|
client,
|
|
927
|
+
isRefreshedFileAllowed: isFileAllowed,
|
|
752
928
|
token,
|
|
753
929
|
maxBytes: opts.maxBytes
|
|
754
930
|
}))?.[0] ?? null;
|
|
755
931
|
}
|
|
756
932
|
//#endregion
|
|
757
|
-
export { media_exports as _,
|
|
933
|
+
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-
|
|
3
|
-
import { r as resolveSlackReplyToMode } from "./conversation-binding-route-
|
|
4
|
-
import { t as inspectSlackAccount } from "./account-inspect-
|
|
5
|
-
import { a as parseSlackTarget, i as normalizeSlackMessagingTarget, o as resolveSlackChannelId, r as looksLikeSlackTargetId } from "./target-parsing-
|
|
6
|
-
import "./targets-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { n as
|
|
10
|
-
import {
|
|
11
|
-
import { n as resolveSlackChannelType } from "./channel-type-
|
|
12
|
-
import { t as slackSetupPlugin } from "./channel.setup-
|
|
13
|
-
import {
|
|
14
|
-
import { f as recordSlackThreadParticipation, l as hasSlackThreadParticipation, s as clearSlackThreadParticipationCache } from "./send-
|
|
15
|
-
import { n as listSlackDirectoryGroupsFromConfig, r as listSlackDirectoryPeersFromConfig } from "./directory-config-
|
|
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-Vee8Dgbf.js";
|
|
4
|
+
import { t as inspectSlackAccount } from "./account-inspect-C3sePHWa.js";
|
|
5
|
+
import { a as parseSlackTarget, i as normalizeSlackMessagingTarget, o as resolveSlackChannelId, r as looksLikeSlackTargetId } from "./target-parsing-PbxGDbr9.js";
|
|
6
|
+
import "./targets-7FexXJ62.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-BYH74y50.js";
|
|
8
|
+
import { C as normalizeAllowListLower, E as resolveSlackAllowListMatch, O as resolveSlackUserAllowed, S as normalizeAllowList, T as normalizeSlackSlug, b as resolveSlackWriteClientOptions, d as createSlackWebClient, f as createSlackWriteClient, g as SLACK_WRITE_RETRY_OPTIONS, h as SLACK_DEFAULT_RETRY_OPTIONS, m as getSlackWriteClient, t as probeSlack, u as createSlackTokenCacheKey, w as normalizeSlackAllowOwnerEntry, x as allowListMatches, y as resolveSlackWebClientOptions } from "./probe-gj5yQgN2.js";
|
|
9
|
+
import { n as buildSlackThreadingToolContext, t as slackPlugin } from "./channel-BguxhhNG.js";
|
|
10
|
+
import { n as extractSlackToolSend, r as listSlackMessageActions } from "./message-tool-api-BsZbsulu.js";
|
|
11
|
+
import { n as resolveSlackChannelType } from "./channel-type-ChkODKBW.js";
|
|
12
|
+
import { t as slackSetupPlugin } from "./channel.setup-BJohRJha.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-BOxiu2Vy.js";
|
|
14
|
+
import { f as recordSlackThreadParticipation, l as hasSlackThreadParticipation, s as clearSlackThreadParticipationCache } from "./send-GUz4_v2E.js";
|
|
15
|
+
import { n as listSlackDirectoryGroupsFromConfig, r as listSlackDirectoryPeersFromConfig } from "./directory-config-Bmw4ykSy.js";
|
|
16
16
|
import { t as collectSlackSecurityAuditFindings } from "./security-audit-B_yKr7MW.js";
|
|
17
|
-
import { n as resolveSlackRuntimeGroupPolicy } from "./provider-
|
|
17
|
+
import { n as resolveSlackRuntimeGroupPolicy } from "./provider-DW9YC_no.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 };
|