@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,15 +1,15 @@
|
|
|
1
1
|
import { n as registerSlackHttpHandler, r as normalizeSlackWebhookPath } from "./registry-bbjH7IHX.js";
|
|
2
|
-
import { a as resolveSlackAccount, d as resolveSlackAppToken, f as resolveSlackBotToken, i as resolveDefaultSlackAccountId, o as resolveSlackAccountAllowFrom, s as resolveSlackAccountDmPolicy, u as formatSlackBotTokenIdentityWarning } from "./accounts-
|
|
3
|
-
import { a as parseSlackTarget, n as formatSlackTarget } from "./target-parsing-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { a as resolveSlackAccount, d as resolveSlackAppToken, f as resolveSlackBotToken, i as resolveDefaultSlackAccountId, o as resolveSlackAccountAllowFrom, s as resolveSlackAccountDmPolicy, u as formatSlackBotTokenIdentityWarning } from "./accounts-Dm_H77gH.js";
|
|
3
|
+
import { a as parseSlackTarget, n as formatSlackTarget } from "./target-parsing-PbxGDbr9.js";
|
|
4
|
+
import { Ct as isSlackApprovalAuthorizedSender, G as isSlackCallbackActionId, J as decodeSlackQuestionAction, K as isSlackQuestionActionId, L as truncateSlackText, M as SLACK_TEXT_LIMIT, Tt as isSlackExecApprovalAuthorizedSender, W as isSlackApprovalActionId, Y as resolveSlackQuestionAction, a as qualifySlackConversationId, et as escapeSlackMrkdwn, lt as isSlackAnyNativeApprovalClientEnabled, nt as decodeSlackApprovalAction, o as qualifySlackRoutePeerId, s as resolveSlackEnterpriseMainDmSessionKey, t as buildSlackChannelIdCandidates, xt as registerSlackInstallationState } from "./group-policy-BYH74y50.js";
|
|
5
|
+
import { C as normalizeAllowListLower, D as resolveSlackUserAllowListForTeam, E as resolveSlackAllowListMatch, S as normalizeAllowList, T as normalizeSlackSlug, _ as resolveSlackLookupClientOptions, a as slackIngressIdentity, d as createSlackWebClient, i as createSlackIngressSubject, l as createSlackStartupAuthClient, o as formatSlackError, p as getSlackListenerUploadCompletionClient, v as resolveSlackProxyDispatcher, w as normalizeSlackAllowOwnerEntry, x as allowListMatches, y as resolveSlackWebClientOptions } from "./probe-gj5yQgN2.js";
|
|
6
6
|
import { n as getSlackRuntime, t as getOptionalSlackRuntime } from "./runtime-JSVZSWAj.js";
|
|
7
|
-
import {
|
|
8
|
-
import { i as setSlackDefaultSendIdentity, p as requireSlackPostMessageTimestamp } from "./send-
|
|
7
|
+
import { C as hasSlackMessageTableBlock, b as saveRemoteMedia, f as readSlackMessages, y as isGovSlackClient } from "./actions-BOxiu2Vy.js";
|
|
8
|
+
import { i as setSlackDefaultSendIdentity, p as requireSlackPostMessageTimestamp } from "./send-GUz4_v2E.js";
|
|
9
9
|
import { t as collectSlackCursorPages } from "./cursor-pages-eX7p8Wwt.js";
|
|
10
|
-
import { t as resolveSlackChannelAllowlist } from "./resolve-channels-
|
|
11
|
-
import { t as resolveSlackUserAllowlist } from "./resolve-users-
|
|
12
|
-
import { n as resolveSlackChannelConfig, r as resolveSlackChannelLabel, t as isSlackChannelAllowedByPolicy } from "./policy-
|
|
10
|
+
import { t as resolveSlackChannelAllowlist } from "./resolve-channels-Bv6IiGZ4.js";
|
|
11
|
+
import { t as resolveSlackUserAllowlist } from "./resolve-users-BXw2pA7y.js";
|
|
12
|
+
import { n as resolveSlackChannelConfig, r as resolveSlackChannelLabel, t as isSlackChannelAllowedByPolicy } from "./policy-CUpBeOt9.js";
|
|
13
13
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
14
14
|
import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
15
15
|
import { asNonArrayRecord, asOptionalRecord, isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries, normalizeUniqueTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -20,12 +20,13 @@ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
|
20
20
|
import { computeBackoff, createNonExitingRuntime, createSubsystemLogger, danger, getChildLogger, logVerbose, shouldLogVerbose, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
21
21
|
import { chunkItems } from "openclaw/plugin-sdk/text-chunking";
|
|
22
22
|
import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
23
|
+
import { addAllowlistUserEntriesFromConfigEntry, buildAllowlistResolutionSummary, formatAllowlistMatchMeta, mergeAllowlist, patchAllowlistUsersInConfigEntries, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
|
|
23
24
|
import { parseExecApprovalCommandText } from "openclaw/plugin-sdk/approval-reply-runtime";
|
|
24
25
|
import { withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
25
26
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
26
27
|
import { WebAPIHTTPError, WebAPIPlatformError, WebAPIRateLimitedError, WebAPIRequestError, WebClient } from "@slack/web-api";
|
|
27
|
-
import { addAllowlistUserEntriesFromConfigEntry, buildAllowlistResolutionSummary, formatAllowlistMatchMeta, mergeAllowlist, patchAllowlistUsersInConfigEntries, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
|
|
28
28
|
import { buildPluginBindingResolvedText, parsePluginBindingApprovalCustomId, resolveConversationLabel as resolveConversationLabel$1, resolvePluginConversationBindingApproval, resolveRuntimeConversationBindingRoute, upsertChannelPairingRequest } from "openclaw/plugin-sdk/conversation-runtime";
|
|
29
|
+
import { createChannelIngressResolver, readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
29
30
|
import { collectErrorGraphCandidates, extractErrorCode, formatErrorMessage, isApprovalNotFoundError, readErrorName, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
30
31
|
import { resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
|
|
31
32
|
import { buildChannelMetadata } from "openclaw/plugin-sdk/security-runtime";
|
|
@@ -44,12 +45,12 @@ import { resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy as res
|
|
|
44
45
|
import { resolveChannelConfigWrites } from "openclaw/plugin-sdk/channel-config-writes";
|
|
45
46
|
import { mutateConfigFile, readConfigFileSnapshotForWrite } from "openclaw/plugin-sdk/config-mutation";
|
|
46
47
|
import { enqueueRoutedSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
|
|
47
|
-
import { createChannelIngressResolver, defineStableChannelIngressIdentity, readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
48
48
|
import { asDateTimestampMs, parseFiniteNumber, parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
49
49
|
import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
|
|
50
50
|
import { formatCommandArgMenuTitle, resolveCommandAuthorization, resolveEffectiveAgentRuntime, resolveNativeCommandSessionTargets, resolveStoredModelOverride } from "openclaw/plugin-sdk/command-auth-native";
|
|
51
51
|
import { requestHeartbeat } from "openclaw/plugin-sdk/heartbeat-runtime";
|
|
52
52
|
import { createChannelInteractiveDispatcher } from "openclaw/plugin-sdk/plugin-runtime";
|
|
53
|
+
import { reportChannelRoomJoin } from "openclaw/plugin-sdk/channel-join-intro-runtime";
|
|
53
54
|
import { createChannelInboundDebouncer, shouldDebounceTextInbound } from "openclaw/plugin-sdk/channel-inbound";
|
|
54
55
|
import { createChannelReplayGuard, runClaimableDedupeClaimLoop } from "openclaw/plugin-sdk/persistent-dedupe";
|
|
55
56
|
import { channelBlockedPatch, channelReadyPatch } from "openclaw/plugin-sdk/gateway-runtime";
|
|
@@ -236,8 +237,8 @@ function createSlackAgentViewState(params) {
|
|
|
236
237
|
//#endregion
|
|
237
238
|
//#region extensions/slack/src/monitor/assistant-thread-context.ts
|
|
238
239
|
const SLACK_ASSISTANT_THREAD_CONTEXT_METADATA_EVENT = "assistant_thread_context";
|
|
239
|
-
const SLACK_ASSISTANT_CONTEXT_TTL_MS =
|
|
240
|
-
const SLACK_ASSISTANT_CONTEXT_CLEANUP_INTERVAL_MS =
|
|
240
|
+
const SLACK_ASSISTANT_CONTEXT_TTL_MS = 864e5;
|
|
241
|
+
const SLACK_ASSISTANT_CONTEXT_CLEANUP_INTERVAL_MS = 6e5;
|
|
241
242
|
function buildSlackAssistantThreadMetadata(context) {
|
|
242
243
|
const eventPayload = {};
|
|
243
244
|
if (context.channelId) eventPayload.channel_id = context.channelId;
|
|
@@ -476,12 +477,12 @@ function resolveSlackSystemEventRoute(params) {
|
|
|
476
477
|
const SLACK_CHANNEL_CACHE_MAX_ENTRIES = 1024;
|
|
477
478
|
const SLACK_USER_CACHE_MAX_ENTRIES = 2048;
|
|
478
479
|
const SLACK_AVATAR_CACHE_MAX_ENTRIES = 128;
|
|
479
|
-
const SLACK_AVATAR_MAX_BYTES =
|
|
480
|
+
const SLACK_AVATAR_MAX_BYTES = 262144;
|
|
480
481
|
const SLACK_AVATAR_SSRF_POLICY = {
|
|
481
482
|
allowedHostnames: ["avatars.slack-edge.com", "*.slack-edge.com"],
|
|
482
483
|
hostnameAllowlist: ["avatars.slack-edge.com", "*.slack-edge.com"]
|
|
483
484
|
};
|
|
484
|
-
const SLACK_CHANNEL_DENIAL_WARNING_TTL_MS =
|
|
485
|
+
const SLACK_CHANNEL_DENIAL_WARNING_TTL_MS = 3e5;
|
|
485
486
|
const SLACK_CHANNEL_DENIAL_WARNING_MAX_ENTRIES = 1024;
|
|
486
487
|
function createSlackMonitorContext(params) {
|
|
487
488
|
const channelHistories = /* @__PURE__ */ new Map();
|
|
@@ -586,7 +587,8 @@ function createSlackMonitorContext(params) {
|
|
|
586
587
|
}
|
|
587
588
|
};
|
|
588
589
|
const resolveUserAvatar = (userId, eventScope) => {
|
|
589
|
-
|
|
590
|
+
const client = eventScope?.client ?? params.app.client;
|
|
591
|
+
if (isGovSlackClient(client)) return;
|
|
590
592
|
const imageUrl = readLruMapEntry(userCache, scopedKey(userId, eventScope))?.imageUrl;
|
|
591
593
|
if (!imageUrl) return;
|
|
592
594
|
const cacheKey = scopedKey(`${userId}\0${imageUrl}`, eventScope);
|
|
@@ -705,6 +707,7 @@ function createSlackMonitorContext(params) {
|
|
|
705
707
|
}
|
|
706
708
|
return false;
|
|
707
709
|
};
|
|
710
|
+
const channelRuntime = params.channelRuntime;
|
|
708
711
|
const ctx = {
|
|
709
712
|
cfg: params.cfg,
|
|
710
713
|
accountId: params.accountId,
|
|
@@ -712,7 +715,8 @@ function createSlackMonitorContext(params) {
|
|
|
712
715
|
app: params.app,
|
|
713
716
|
runtime: params.runtime,
|
|
714
717
|
channelRuntime: params.channelRuntime,
|
|
715
|
-
buildContext:
|
|
718
|
+
buildContext: channelRuntime?.inbound.buildContext,
|
|
719
|
+
dispatchReplyFromConfig: channelRuntime?.reply?.dispatchReplyFromConfig,
|
|
716
720
|
botUserId: params.botUserId,
|
|
717
721
|
botId: params.botId,
|
|
718
722
|
identityHealth: params.identityHealth,
|
|
@@ -1278,6 +1282,8 @@ function resolveSlackIngressTurnLifecycle(context) {
|
|
|
1278
1282
|
function createSlackDurableIngress(options) {
|
|
1279
1283
|
let app;
|
|
1280
1284
|
let relayDispatch;
|
|
1285
|
+
const activeSessionTurns = /* @__PURE__ */ new Map();
|
|
1286
|
+
const activeChannelTurns = /* @__PURE__ */ new Map();
|
|
1281
1287
|
const monitor = createChannelIngressMonitor({
|
|
1282
1288
|
queue: options.queue ?? (() => getSlackRuntime().state.openChannelIngressQueue({ accountId: options.accountId })),
|
|
1283
1289
|
inspect: inspectSlackIngress,
|
|
@@ -1314,26 +1320,111 @@ function createSlackDurableIngress(options) {
|
|
|
1314
1320
|
onDurableAdmission: async (raw) => {
|
|
1315
1321
|
if (raw.kind === "events-api") await raw.afterDurableAdmission?.();
|
|
1316
1322
|
},
|
|
1317
|
-
deliver: async (raw, lifecycle) => {
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1323
|
+
deliver: async (raw, lifecycle, claim) => {
|
|
1324
|
+
const laneKey = claim.laneKey ?? inspectSlackIngress(raw).laneKey;
|
|
1325
|
+
let releaseSession;
|
|
1326
|
+
let releaseChannel;
|
|
1327
|
+
let routedSession;
|
|
1328
|
+
let adoptOnCompletion = false;
|
|
1329
|
+
const settleSession = () => {
|
|
1330
|
+
adoptOnCompletion = false;
|
|
1331
|
+
releaseSession?.();
|
|
1332
|
+
};
|
|
1333
|
+
const settleTurn = () => {
|
|
1334
|
+
settleSession();
|
|
1335
|
+
releaseChannel?.();
|
|
1336
|
+
lifecycle.abortSignal.removeEventListener("abort", settleTurn);
|
|
1337
|
+
};
|
|
1338
|
+
const routedLifecycle = {
|
|
1339
|
+
...lifecycle,
|
|
1340
|
+
onSessionRouted: async (sessionKey) => {
|
|
1341
|
+
if (routedSession !== void 0) {
|
|
1342
|
+
if (routedSession !== sessionKey) throw new Error("Slack ingress session ownership changed after routing.");
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
lifecycle.abortSignal.throwIfAborted();
|
|
1346
|
+
routedSession = sessionKey;
|
|
1347
|
+
adoptOnCompletion = true;
|
|
1348
|
+
const previousTurn = activeSessionTurns.get(sessionKey);
|
|
1349
|
+
const releasedCurrentTurn = createDeferred();
|
|
1350
|
+
const currentTurn = previousTurn ? previousTurn.then(() => releasedCurrentTurn.promise) : releasedCurrentTurn.promise;
|
|
1351
|
+
activeSessionTurns.set(sessionKey, currentTurn);
|
|
1352
|
+
const channelTurn = createDeferred();
|
|
1353
|
+
const channelTurns = activeChannelTurns.get(laneKey) ?? /* @__PURE__ */ new Set();
|
|
1354
|
+
channelTurns.add(channelTurn.promise);
|
|
1355
|
+
activeChannelTurns.set(laneKey, channelTurns);
|
|
1356
|
+
currentTurn.then(() => {
|
|
1357
|
+
if (activeSessionTurns.get(sessionKey) === currentTurn) activeSessionTurns.delete(sessionKey);
|
|
1358
|
+
});
|
|
1359
|
+
channelTurn.promise.then(() => {
|
|
1360
|
+
channelTurns.delete(channelTurn.promise);
|
|
1361
|
+
if (channelTurns.size === 0 && activeChannelTurns.get(laneKey) === channelTurns) activeChannelTurns.delete(laneKey);
|
|
1362
|
+
});
|
|
1363
|
+
releaseSession = () => releasedCurrentTurn.resolve();
|
|
1364
|
+
releaseChannel = () => channelTurn.resolve();
|
|
1365
|
+
lifecycle.abortSignal.addEventListener("abort", settleTurn, { once: true });
|
|
1366
|
+
lifecycle.onDeferred();
|
|
1367
|
+
if (previousTurn) lifecycle.onAdoptionFinalizing();
|
|
1368
|
+
monitor.requestDrain();
|
|
1369
|
+
await previousTurn;
|
|
1370
|
+
lifecycle.abortSignal.throwIfAborted();
|
|
1371
|
+
},
|
|
1372
|
+
onAdopted: async () => {
|
|
1373
|
+
try {
|
|
1374
|
+
await lifecycle.onAdopted();
|
|
1375
|
+
} finally {
|
|
1376
|
+
settleTurn();
|
|
1377
|
+
}
|
|
1378
|
+
},
|
|
1379
|
+
onDeferred: () => {
|
|
1380
|
+
lifecycle.onDeferred();
|
|
1381
|
+
settleSession();
|
|
1382
|
+
monitor.requestDrain();
|
|
1383
|
+
},
|
|
1384
|
+
onAbandoned: async () => {
|
|
1385
|
+
try {
|
|
1386
|
+
await lifecycle.onAbandoned();
|
|
1387
|
+
} finally {
|
|
1388
|
+
settleTurn();
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
try {
|
|
1393
|
+
const event = raw.kind === "events-api" ? asOptionalRecord(raw.body)?.event : void 0;
|
|
1394
|
+
if (asOptionalRecord(event)?.type === "channel_id_changed") {
|
|
1395
|
+
const channelTurns = activeChannelTurns.get(laneKey);
|
|
1396
|
+
if (channelTurns && channelTurns.size > 0) {
|
|
1397
|
+
adoptOnCompletion = true;
|
|
1398
|
+
lifecycle.onAdoptionFinalizing();
|
|
1399
|
+
await Promise.all(channelTurns);
|
|
1400
|
+
lifecycle.abortSignal.throwIfAborted();
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
if (raw.kind === "relay") {
|
|
1404
|
+
if (!relayDispatch) throw new Error("Slack relay ingress dispatcher is not attached.");
|
|
1405
|
+
await relayDispatch(raw.message, routedLifecycle);
|
|
1406
|
+
} else {
|
|
1407
|
+
if (!app) throw new Error("Slack ingress receiver is not attached to a Bolt app.");
|
|
1408
|
+
await app.processEvent({
|
|
1409
|
+
body: raw.body,
|
|
1410
|
+
ack: async () => {},
|
|
1411
|
+
...raw.retryNum === void 0 ? {} : { retryNum: raw.retryNum },
|
|
1412
|
+
...raw.retryReason === void 0 ? {} : { retryReason: raw.retryReason },
|
|
1413
|
+
customProperties: { [SLACK_INGRESS_LIFECYCLE_CONTEXT_KEY]: routedLifecycle }
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1416
|
+
if (adoptOnCompletion) await routedLifecycle.onAdopted();
|
|
1417
|
+
} catch (error) {
|
|
1418
|
+
settleTurn();
|
|
1419
|
+
throw error;
|
|
1322
1420
|
}
|
|
1323
|
-
if (!app) throw new Error("Slack ingress receiver is not attached to a Bolt app.");
|
|
1324
|
-
await app.processEvent({
|
|
1325
|
-
body: raw.body,
|
|
1326
|
-
ack: async () => {},
|
|
1327
|
-
...raw.retryNum === void 0 ? {} : { retryNum: raw.retryNum },
|
|
1328
|
-
...raw.retryReason === void 0 ? {} : { retryReason: raw.retryReason },
|
|
1329
|
-
customProperties: { [SLACK_INGRESS_LIFECYCLE_CONTEXT_KEY]: lifecycle }
|
|
1330
|
-
});
|
|
1331
1421
|
},
|
|
1332
1422
|
pollIntervalMs: options.pollIntervalMs ?? SLACK_INGRESS_POLL_INTERVAL_MS,
|
|
1333
1423
|
retention: "standard",
|
|
1334
1424
|
appendRetryDelaysMs: [0],
|
|
1335
1425
|
drain: {
|
|
1336
1426
|
resolveNonRetryableFailure: resolveSlackIngressNonRetryableFailure,
|
|
1427
|
+
deferredLaneOccupancy: "release",
|
|
1337
1428
|
deriveLaneKey: (record) => record.payload.kind === "relay" ? resolveSlackIngressLane({ event: record.payload.message }, record.id) : resolveSlackIngressLane(record.payload.body, record.id),
|
|
1338
1429
|
...options.adoptionStallTimeoutMs === void 0 ? {} : { adoptionStallTimeoutMs: options.adoptionStallTimeoutMs },
|
|
1339
1430
|
...options.onLog ? { onLog: options.onLog } : {}
|
|
@@ -1412,7 +1503,8 @@ async function resolveThreadTsFromHistory(params) {
|
|
|
1412
1503
|
inclusive: true,
|
|
1413
1504
|
limit: 1
|
|
1414
1505
|
});
|
|
1415
|
-
|
|
1506
|
+
const message = response.messages?.find((entry) => entry.ts === params.messageTs) ?? response.messages?.[0];
|
|
1507
|
+
return normalizeOptionalString(message?.thread_ts);
|
|
1416
1508
|
}
|
|
1417
1509
|
function createSlackThreadTsResolver(params) {
|
|
1418
1510
|
const ttlMs = Math.max(0, parseFiniteNumber(params.cacheTtlMs) ?? DEFAULT_THREAD_TS_CACHE_TTL_MS);
|
|
@@ -1498,88 +1590,7 @@ const slackChannelMembersCache = /* @__PURE__ */ new WeakMap();
|
|
|
1498
1590
|
const DEFAULT_CHANNEL_MEMBERS_CACHE_TTL_MS = 6e4;
|
|
1499
1591
|
const CHANNEL_MEMBERS_CACHE_MAX = 512;
|
|
1500
1592
|
const SLACK_CHANNEL_ID = "slack";
|
|
1501
|
-
const SLACK_USER_NAME_KIND = "plugin:slack-user-name";
|
|
1502
|
-
const SLACK_WORKSPACE_USER_ID_KIND = "plugin:slack-workspace-user-id";
|
|
1503
1593
|
var SlackSystemEventAuthRetryError = class extends Error {};
|
|
1504
|
-
function normalizeSlackUserId(raw) {
|
|
1505
|
-
const value = (raw ?? "").trim().toLowerCase();
|
|
1506
|
-
if (!value) return "";
|
|
1507
|
-
const mention = value.match(/^<@([a-z0-9_]+)>$/i);
|
|
1508
|
-
if (mention?.[1]) return mention[1];
|
|
1509
|
-
return value.replace(/^(slack:|user:)/, "");
|
|
1510
|
-
}
|
|
1511
|
-
function isSlackStableUserId(value) {
|
|
1512
|
-
return /^[ubw][a-z0-9_]+$/i.test(value);
|
|
1513
|
-
}
|
|
1514
|
-
function normalizeSlackWorkspaceUserEntry(entry) {
|
|
1515
|
-
const normalized = entry.trim().toLowerCase();
|
|
1516
|
-
if (!normalized) return null;
|
|
1517
|
-
try {
|
|
1518
|
-
const target = parseSlackTarget(normalized);
|
|
1519
|
-
if (target?.kind === "user" && target.teamId) return target.normalized;
|
|
1520
|
-
} catch {
|
|
1521
|
-
return null;
|
|
1522
|
-
}
|
|
1523
|
-
return null;
|
|
1524
|
-
}
|
|
1525
|
-
function normalizeSlackBareUserEntry(entry) {
|
|
1526
|
-
const normalized = entry.trim().toLowerCase();
|
|
1527
|
-
if (!normalized || normalizeSlackWorkspaceUserEntry(normalized)) return null;
|
|
1528
|
-
const userId = normalizeSlackUserId(normalized);
|
|
1529
|
-
return isSlackStableUserId(userId) ? userId : null;
|
|
1530
|
-
}
|
|
1531
|
-
function normalizeSlackStableEntry(entry) {
|
|
1532
|
-
return normalizeSlackBareUserEntry(entry) ?? normalizeSlackWorkspaceUserEntry(entry);
|
|
1533
|
-
}
|
|
1534
|
-
function normalizeSlackNameEntry(entry) {
|
|
1535
|
-
const normalized = entry.trim().toLowerCase();
|
|
1536
|
-
if (!normalized || normalizeSlackStableEntry(normalized)) return null;
|
|
1537
|
-
return normalized.replace(/^slack:/, "") || null;
|
|
1538
|
-
}
|
|
1539
|
-
function normalizeSlackNameSubject(value) {
|
|
1540
|
-
return value.trim().toLowerCase() || null;
|
|
1541
|
-
}
|
|
1542
|
-
function normalizeSlackNameSlugEntry(entry) {
|
|
1543
|
-
const name = normalizeSlackNameEntry(entry);
|
|
1544
|
-
if (!name) return null;
|
|
1545
|
-
const slug = normalizeSlackSlug(name);
|
|
1546
|
-
return slug && slug !== name ? slug : null;
|
|
1547
|
-
}
|
|
1548
|
-
const slackIngressIdentity = defineStableChannelIngressIdentity({
|
|
1549
|
-
key: "senderId",
|
|
1550
|
-
kind: "stable-id",
|
|
1551
|
-
normalizeEntry: normalizeSlackBareUserEntry,
|
|
1552
|
-
normalizeSubject: normalizeSlackUserId,
|
|
1553
|
-
sensitivity: "pii",
|
|
1554
|
-
aliases: [{
|
|
1555
|
-
key: "workspaceSenderId",
|
|
1556
|
-
kind: SLACK_WORKSPACE_USER_ID_KIND,
|
|
1557
|
-
normalizeEntry: normalizeSlackWorkspaceUserEntry,
|
|
1558
|
-
normalizeSubject: normalizeSlackWorkspaceUserEntry,
|
|
1559
|
-
sensitivity: "pii"
|
|
1560
|
-
}, ...[["senderName", normalizeSlackNameEntry], ["senderNameSlug", normalizeSlackNameSlugEntry]].map(([key, normalizeEntry]) => ({
|
|
1561
|
-
key,
|
|
1562
|
-
kind: SLACK_USER_NAME_KIND,
|
|
1563
|
-
normalizeEntry,
|
|
1564
|
-
normalizeSubject: normalizeSlackNameSubject,
|
|
1565
|
-
dangerous: true,
|
|
1566
|
-
sensitivity: "pii"
|
|
1567
|
-
}))]
|
|
1568
|
-
});
|
|
1569
|
-
function createSlackIngressSubject(params) {
|
|
1570
|
-
const senderId = normalizeSlackUserId(params.senderId);
|
|
1571
|
-
const teamId = normalizeOptionalLowercaseString(params.teamId);
|
|
1572
|
-
const senderName = params.senderName?.trim().toLowerCase();
|
|
1573
|
-
const senderNameSlug = senderName ? normalizeSlackSlug(senderName) : void 0;
|
|
1574
|
-
return {
|
|
1575
|
-
stableId: senderId,
|
|
1576
|
-
aliases: {
|
|
1577
|
-
workspaceSenderId: teamId && senderId ? `team:${teamId}:user:${senderId}` : void 0,
|
|
1578
|
-
senderName,
|
|
1579
|
-
senderNameSlug
|
|
1580
|
-
}
|
|
1581
|
-
};
|
|
1582
|
-
}
|
|
1583
1594
|
function createSlackIngressResolver(ctx) {
|
|
1584
1595
|
return createChannelIngressResolver({
|
|
1585
1596
|
channelId: SLACK_CHANNEL_ID,
|
|
@@ -1821,7 +1832,7 @@ async function decideSlackSystemIngress(params) {
|
|
|
1821
1832
|
} : void 0
|
|
1822
1833
|
};
|
|
1823
1834
|
const result = await resolver.message(input);
|
|
1824
|
-
if (result.ingress.decision !== "allow" && params.retryNameLookup && result.state.allowlists[isDirectMessage ? "dm" : "group"].normalizedEntries.some((entry) => entry.kind ===
|
|
1835
|
+
if (result.ingress.decision !== "allow" && params.retryNameLookup && result.state.allowlists[isDirectMessage ? "dm" : "group"].normalizedEntries.some((entry) => entry.kind === "plugin:slack-user-name")) {
|
|
1825
1836
|
const lookup = await params.ctx.resolveUserName(params.senderId, params.eventScope);
|
|
1826
1837
|
if (lookup.error && isTransientSlackThreadLookupError(lookup.error)) throw new SlackSystemEventAuthRetryError(formatErrorMessage(lookup.error));
|
|
1827
1838
|
if (lookup.name) return (await resolver.message({
|
|
@@ -1949,7 +1960,8 @@ function resolveSlackEventScope(params) {
|
|
|
1949
1960
|
ok: false,
|
|
1950
1961
|
reason: "enterprise_event_for_workspace_account"
|
|
1951
1962
|
} : { ok: true };
|
|
1952
|
-
const
|
|
1963
|
+
const body = params.body && typeof params.body === "object" ? params.body : {};
|
|
1964
|
+
const apiAppId = normalizeOptionalString(body.api_app_id);
|
|
1953
1965
|
if (apiAppId && params.identity.apiAppId && apiAppId !== params.identity.apiAppId) return {
|
|
1954
1966
|
ok: false,
|
|
1955
1967
|
reason: "wrong_app"
|
|
@@ -2015,6 +2027,7 @@ async function authorizeAndResolveSlackSystemEventContext(params) {
|
|
|
2015
2027
|
channelId,
|
|
2016
2028
|
channelType: auth.channelType,
|
|
2017
2029
|
senderId,
|
|
2030
|
+
threadTs: auth.channelType === "im" ? void 0 : params.threadTs,
|
|
2018
2031
|
eventScope: params.eventScope
|
|
2019
2032
|
})
|
|
2020
2033
|
};
|
|
@@ -2111,9 +2124,10 @@ function registerSlackChannelIdChangedEvent(params) {
|
|
|
2111
2124
|
const oldChannelId = payload.old_channel_id;
|
|
2112
2125
|
const newChannelId = payload.new_channel_id;
|
|
2113
2126
|
if (!oldChannelId || !newChannelId) return;
|
|
2127
|
+
const channelInfo = await ctx.resolveChannelName(newChannelId);
|
|
2114
2128
|
const label = resolveSlackChannelLabel({
|
|
2115
2129
|
channelId: newChannelId,
|
|
2116
|
-
channelName:
|
|
2130
|
+
channelName: channelInfo?.name
|
|
2117
2131
|
});
|
|
2118
2132
|
ctx.runtime.log?.(warn(`[slack] Channel ID changed: ${oldChannelId} → ${newChannelId} (${label})`));
|
|
2119
2133
|
if (!resolveChannelConfigWrites({
|
|
@@ -2366,7 +2380,8 @@ function isSlackReplyActionId(actionId) {
|
|
|
2366
2380
|
return actionId === "openclaw:reply_button" || actionId === "openclaw:reply_select" || actionId.startsWith(`openclaw:reply_button:`) || actionId.startsWith(`openclaw:reply_select:`);
|
|
2367
2381
|
}
|
|
2368
2382
|
function readSlackApprovalAction(parsed) {
|
|
2369
|
-
|
|
2383
|
+
const value = normalizeOptionalString(parsed.actionSummary.value) ?? parsed.actionSummary.selectedValues?.map((entry) => normalizeOptionalString(entry)).find((entry) => Boolean(entry));
|
|
2384
|
+
return decodeSlackApprovalAction(value);
|
|
2370
2385
|
}
|
|
2371
2386
|
function isSlackReplyLinkAction(parsed) {
|
|
2372
2387
|
if (parsed.actionId === "openclaw:session_link") return true;
|
|
@@ -2491,11 +2506,19 @@ async function handleSlackPluginBindingApproval(params) {
|
|
|
2491
2506
|
await respondEphemeral(params.respond, buildPluginBindingResolvedText(resolved));
|
|
2492
2507
|
return true;
|
|
2493
2508
|
}
|
|
2509
|
+
function formatSlackPluginApprovalSenderId(userId, eventScope) {
|
|
2510
|
+
return formatSlackTarget({
|
|
2511
|
+
kind: "user",
|
|
2512
|
+
id: userId,
|
|
2513
|
+
teamId: eventScope?.teamId
|
|
2514
|
+
});
|
|
2515
|
+
}
|
|
2494
2516
|
async function handleSlackApprovalInteraction(params) {
|
|
2517
|
+
const pluginSenderId = formatSlackPluginApprovalSenderId(params.parsed.userId, params.eventScope);
|
|
2495
2518
|
const pluginApprovalAuthorizedSender = isSlackApprovalAuthorizedSender({
|
|
2496
2519
|
cfg: params.ctx.cfg,
|
|
2497
2520
|
accountId: params.ctx.accountId,
|
|
2498
|
-
senderId:
|
|
2521
|
+
senderId: pluginSenderId
|
|
2499
2522
|
});
|
|
2500
2523
|
const execApprovalAuthorizedSender = isSlackExecApprovalAuthorizedSender({
|
|
2501
2524
|
cfg: params.ctx.cfg,
|
|
@@ -2515,7 +2538,7 @@ async function handleSlackApprovalInteraction(params) {
|
|
|
2515
2538
|
decision: params.approval.decision,
|
|
2516
2539
|
channel: "slack",
|
|
2517
2540
|
accountId: params.ctx.accountId,
|
|
2518
|
-
senderId: params.parsed.userId
|
|
2541
|
+
senderId: params.approval.approvalKind === "plugin" ? pluginSenderId : params.parsed.userId
|
|
2519
2542
|
});
|
|
2520
2543
|
const terminalLabel = resolveSlackApprovalTerminalLabel(result.approval);
|
|
2521
2544
|
const prefix = result.applied ? "Resolved" : "Already resolved";
|
|
@@ -2551,10 +2574,11 @@ async function handleSlackApprovalInteraction(params) {
|
|
|
2551
2574
|
async function handleSlackLegacyApprovalInteraction(params) {
|
|
2552
2575
|
const parsedApproval = parseExecApprovalCommandText(params.pluginInteractionData);
|
|
2553
2576
|
if (!parsedApproval) return false;
|
|
2577
|
+
const pluginSenderId = formatSlackPluginApprovalSenderId(params.parsed.userId, params.eventScope);
|
|
2554
2578
|
const pluginAuthorized = isSlackApprovalAuthorizedSender({
|
|
2555
2579
|
cfg: params.ctx.cfg,
|
|
2556
2580
|
accountId: params.ctx.accountId,
|
|
2557
|
-
senderId:
|
|
2581
|
+
senderId: pluginSenderId
|
|
2558
2582
|
});
|
|
2559
2583
|
const execAuthorized = isSlackExecApprovalAuthorizedSender({
|
|
2560
2584
|
cfg: params.ctx.cfg,
|
|
@@ -2576,7 +2600,7 @@ async function handleSlackLegacyApprovalInteraction(params) {
|
|
|
2576
2600
|
decision: parsedApproval.decision,
|
|
2577
2601
|
channel: "slack",
|
|
2578
2602
|
accountId: params.ctx.accountId,
|
|
2579
|
-
senderId: params.parsed.userId,
|
|
2603
|
+
senderId: resolveMethod === "plugin" ? pluginSenderId : params.parsed.userId,
|
|
2580
2604
|
resolveMethod
|
|
2581
2605
|
});
|
|
2582
2606
|
try {
|
|
@@ -3562,6 +3586,55 @@ function registerSlackMemberEvents(params) {
|
|
|
3562
3586
|
const channelId = payload.channel;
|
|
3563
3587
|
const channelInfo = channelId ? await ctx.resolveChannelName(channelId, eventScope) : {};
|
|
3564
3588
|
const channelType = payload.channel_type ?? channelInfo?.type;
|
|
3589
|
+
if (paramsLocal.verb === "joined" && payload.user === ctx.botUserId && channelId) {
|
|
3590
|
+
const roomType = normalizeSlackChannelType(channelType, channelId);
|
|
3591
|
+
if (roomType === "channel" || roomType === "group") {
|
|
3592
|
+
const roomAllowed = ctx.isChannelAllowed({
|
|
3593
|
+
teamId: eventScope?.teamId ?? ctx.teamId,
|
|
3594
|
+
channelId,
|
|
3595
|
+
channelName: channelInfo.name,
|
|
3596
|
+
channelType: roomType
|
|
3597
|
+
});
|
|
3598
|
+
const inviterLabel = roomAllowed && payload.inviter ? (await ctx.resolveUserName(payload.inviter, eventScope)).name ?? payload.inviter : void 0;
|
|
3599
|
+
await reportChannelRoomJoin({
|
|
3600
|
+
cfg: ctx.cfg,
|
|
3601
|
+
channel: "slack",
|
|
3602
|
+
accountId: ctx.accountId,
|
|
3603
|
+
conversationId: channelId,
|
|
3604
|
+
deliverTo: `channel:${channelId}`,
|
|
3605
|
+
route: ctx.resolveSlackSystemEventRoute({
|
|
3606
|
+
channelId,
|
|
3607
|
+
channelType: roomType,
|
|
3608
|
+
eventScope
|
|
3609
|
+
}),
|
|
3610
|
+
inviterLabel,
|
|
3611
|
+
roomAllowed,
|
|
3612
|
+
resolveRoomContext: async ({ messageLimit }) => {
|
|
3613
|
+
const purpose = [channelInfo.purpose, channelInfo.topic].filter((value) => Boolean(value?.trim())).join("\n");
|
|
3614
|
+
const roomContext = {
|
|
3615
|
+
title: channelInfo.name ? `#${channelInfo.name}` : void 0,
|
|
3616
|
+
purpose: purpose || void 0
|
|
3617
|
+
};
|
|
3618
|
+
try {
|
|
3619
|
+
const { messages } = await readSlackMessages(channelId, {
|
|
3620
|
+
limit: messageLimit,
|
|
3621
|
+
client: eventScope?.client ?? ctx.app.client
|
|
3622
|
+
});
|
|
3623
|
+
return {
|
|
3624
|
+
...roomContext,
|
|
3625
|
+
recentMessages: messages.toReversed().flatMap(({ user, text }) => text?.trim() ? [{
|
|
3626
|
+
sender: user,
|
|
3627
|
+
text
|
|
3628
|
+
}] : [])
|
|
3629
|
+
};
|
|
3630
|
+
} catch {
|
|
3631
|
+
return roomContext;
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3634
|
+
});
|
|
3635
|
+
return;
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3565
3638
|
const ingressContext = await authorizeAndResolveSlackSystemEventContext({
|
|
3566
3639
|
ctx,
|
|
3567
3640
|
senderId: payload.user,
|
|
@@ -3571,7 +3644,8 @@ function registerSlackMemberEvents(params) {
|
|
|
3571
3644
|
eventScope
|
|
3572
3645
|
});
|
|
3573
3646
|
if (!ingressContext) return;
|
|
3574
|
-
|
|
3647
|
+
const userLabel = (payload.user ? await ctx.resolveUserName(payload.user, eventScope) : {})?.name ?? payload.user ?? "someone";
|
|
3648
|
+
enqueueRoutedSystemEvent(`Slack: ${userLabel} ${paramsLocal.verb} ${ingressContext.channelLabel}.`, ingressContext.route, { contextKey: `slack:member:${eventScope ? `${eventScope.teamId}:` : ""}${paramsLocal.verb}:${channelId ?? "unknown"}:${payload.user ?? "unknown"}:${paramsLocal.eventId}` });
|
|
3575
3649
|
} catch (err) {
|
|
3576
3650
|
ctx.runtime.error?.(danger(`slack ${paramsLocal.verb} handler failed: ${formatErrorMessage(err)}`));
|
|
3577
3651
|
if (err instanceof SlackSystemEventAuthRetryError) throw err;
|
|
@@ -3653,10 +3727,57 @@ function noteSlackDraftConversationMessage(conversation) {
|
|
|
3653
3727
|
}
|
|
3654
3728
|
}
|
|
3655
3729
|
//#endregion
|
|
3730
|
+
//#region extensions/slack/src/threading.ts
|
|
3731
|
+
function resolveSlackThreadContext(params) {
|
|
3732
|
+
const incomingThreadTs = params.message.thread_ts;
|
|
3733
|
+
const eventTs = params.message.event_ts;
|
|
3734
|
+
const messageTs = params.message.ts ?? eventTs;
|
|
3735
|
+
const hasThreadTs = typeof incomingThreadTs === "string" && incomingThreadTs.length > 0;
|
|
3736
|
+
const isThreadReply = hasThreadTs && (incomingThreadTs !== messageTs || Boolean(params.message.parent_user_id));
|
|
3737
|
+
const replyToId = isThreadReply ? incomingThreadTs : void 0;
|
|
3738
|
+
const isAssistantDmThreadRoot = hasThreadTs && !isThreadReply && params.isDirectMessage === true;
|
|
3739
|
+
return {
|
|
3740
|
+
incomingThreadTs,
|
|
3741
|
+
messageTs,
|
|
3742
|
+
isThreadReply,
|
|
3743
|
+
replyToId,
|
|
3744
|
+
messageThreadId: isThreadReply || isAssistantDmThreadRoot ? incomingThreadTs : params.replyToMode === "all" ? messageTs : void 0
|
|
3745
|
+
};
|
|
3746
|
+
}
|
|
3747
|
+
/**
|
|
3748
|
+
* Resolves Slack thread targeting for replies and status indicators.
|
|
3749
|
+
*
|
|
3750
|
+
* @returns replyThreadTs - Thread timestamp for reply messages
|
|
3751
|
+
* @returns statusThreadTs - Thread timestamp for status indicators (typing, etc.)
|
|
3752
|
+
* @returns isThreadReply - true if this is a genuine user reply in a thread,
|
|
3753
|
+
* false if thread_ts comes from a bot status message (e.g. typing indicator)
|
|
3754
|
+
*/
|
|
3755
|
+
function resolveSlackThreadTargets(params) {
|
|
3756
|
+
const { incomingThreadTs, messageTs, isThreadReply } = resolveSlackThreadContext(params);
|
|
3757
|
+
const replyThreadTs = isThreadReply ? incomingThreadTs : params.replyToMode === "all" ? messageTs : void 0;
|
|
3758
|
+
return {
|
|
3759
|
+
replyThreadTs,
|
|
3760
|
+
statusThreadTs: replyThreadTs,
|
|
3761
|
+
isThreadReply
|
|
3762
|
+
};
|
|
3763
|
+
}
|
|
3764
|
+
//#endregion
|
|
3656
3765
|
//#region extensions/slack/src/monitor/events/message-subtype-handlers.ts
|
|
3766
|
+
function resolveNestedThreadTs(event) {
|
|
3767
|
+
const changed = event;
|
|
3768
|
+
const message = changed.message?.thread_ts ? changed.message : changed.previous_message;
|
|
3769
|
+
if (!message) return;
|
|
3770
|
+
return resolveSlackThreadContext({
|
|
3771
|
+
message: {
|
|
3772
|
+
type: "message",
|
|
3773
|
+
channel: event.channel,
|
|
3774
|
+
...message
|
|
3775
|
+
},
|
|
3776
|
+
replyToMode: "off"
|
|
3777
|
+
}).replyToId;
|
|
3778
|
+
}
|
|
3657
3779
|
const SUBTYPE_HANDLER_REGISTRY = {
|
|
3658
3780
|
message_changed: {
|
|
3659
|
-
subtype: "message_changed",
|
|
3660
3781
|
eventKind: "message_changed",
|
|
3661
3782
|
describe: (channelLabel) => `Slack message edited in ${channelLabel}.`,
|
|
3662
3783
|
contextKey: (event) => {
|
|
@@ -3667,11 +3788,9 @@ const SUBTYPE_HANDLER_REGISTRY = {
|
|
|
3667
3788
|
const changed = event;
|
|
3668
3789
|
return changed.message?.user ?? changed.previous_message?.user ?? changed.message?.bot_id ?? changed.previous_message?.bot_id;
|
|
3669
3790
|
},
|
|
3670
|
-
|
|
3671
|
-
resolveChannelType: () => void 0
|
|
3791
|
+
resolveThreadTs: resolveNestedThreadTs
|
|
3672
3792
|
},
|
|
3673
3793
|
message_deleted: {
|
|
3674
|
-
subtype: "message_deleted",
|
|
3675
3794
|
eventKind: "message_deleted",
|
|
3676
3795
|
describe: (channelLabel) => `Slack message deleted in ${channelLabel}.`,
|
|
3677
3796
|
contextKey: (event) => {
|
|
@@ -3682,8 +3801,7 @@ const SUBTYPE_HANDLER_REGISTRY = {
|
|
|
3682
3801
|
const deleted = event;
|
|
3683
3802
|
return deleted.previous_message?.user ?? deleted.previous_message?.bot_id;
|
|
3684
3803
|
},
|
|
3685
|
-
|
|
3686
|
-
resolveChannelType: () => void 0
|
|
3804
|
+
resolveThreadTs: resolveNestedThreadTs
|
|
3687
3805
|
}
|
|
3688
3806
|
};
|
|
3689
3807
|
function resolveSlackMessageSubtypeHandler(event) {
|
|
@@ -3717,7 +3835,8 @@ function addUserCandidate(candidates, value, botUserId) {
|
|
|
3717
3835
|
candidates.add(id);
|
|
3718
3836
|
}
|
|
3719
3837
|
function collectMetadataUserCandidates(candidates, value, botUserId) {
|
|
3720
|
-
const
|
|
3838
|
+
const metadata = asOptionalRecord(value);
|
|
3839
|
+
const payload = asOptionalRecord(metadata?.event_payload);
|
|
3721
3840
|
if (!payload) return;
|
|
3722
3841
|
for (const key of [
|
|
3723
3842
|
"user",
|
|
@@ -3827,12 +3946,11 @@ function registerSlackMessageEvents(params) {
|
|
|
3827
3946
|
})) return;
|
|
3828
3947
|
const subtypeHandler = resolveSlackMessageSubtypeHandler(message);
|
|
3829
3948
|
if (subtypeHandler) {
|
|
3830
|
-
const channelId = subtypeHandler.resolveChannelId(message);
|
|
3831
3949
|
const ingressContext = await authorizeAndResolveSlackSystemEventContext({
|
|
3832
3950
|
ctx,
|
|
3833
3951
|
senderId: subtypeHandler.resolveSenderId(message),
|
|
3834
|
-
channelId,
|
|
3835
|
-
|
|
3952
|
+
channelId: message.channel,
|
|
3953
|
+
threadTs: subtypeHandler.resolveThreadTs(message),
|
|
3836
3954
|
eventKind: subtypeHandler.eventKind,
|
|
3837
3955
|
eventScope
|
|
3838
3956
|
});
|
|
@@ -4018,7 +4136,8 @@ function registerSlackReactionEvents(params) {
|
|
|
4018
4136
|
const emojiLabel = event.reaction ?? "emoji";
|
|
4019
4137
|
const authorLabel = authorInfo?.name ?? event.item_user;
|
|
4020
4138
|
const baseText = `Slack reaction ${action}: :${emojiLabel}: by ${actorLabel} in ${ingressContext.channelLabel} msg ${item.ts}`;
|
|
4021
|
-
|
|
4139
|
+
const text = authorLabel ? `${baseText} from ${authorLabel}` : baseText;
|
|
4140
|
+
enqueueRoutedSystemEvent(text, ingressContext.route, { contextKey: `slack:reaction:${eventScope ? `${eventScope.teamId}:` : ""}${action}:${item.channel}:${item.ts}:${event.user}:${emojiLabel}:${eventId}` });
|
|
4022
4141
|
} catch (err) {
|
|
4023
4142
|
ctx.runtime.error?.(danger(`slack reaction handler failed: ${formatErrorMessage(err)}`));
|
|
4024
4143
|
}
|
|
@@ -4097,7 +4216,7 @@ function registerSlackWorkspaceEvents(params) {
|
|
|
4097
4216
|
}
|
|
4098
4217
|
//#endregion
|
|
4099
4218
|
//#region extensions/slack/src/monitor/message-dispatch-dedupe.ts
|
|
4100
|
-
const SLACK_MESSAGE_DISPATCH_DEDUPE_TTL_MS =
|
|
4219
|
+
const SLACK_MESSAGE_DISPATCH_DEDUPE_TTL_MS = 864e5;
|
|
4101
4220
|
const SLACK_MESSAGE_DISPATCH_DEDUPE_MEMORY_MAX_ENTRIES = 2e4;
|
|
4102
4221
|
const SLACK_MESSAGE_DISPATCH_DEDUPE_STATE_MAX_ENTRIES = 2e4;
|
|
4103
4222
|
const SLACK_MESSAGE_DISPATCH_DEDUPE_NAMESPACE = "global";
|
|
@@ -4164,19 +4283,7 @@ function buildSlackDebounceKey(message, accountId, teamId) {
|
|
|
4164
4283
|
}
|
|
4165
4284
|
//#endregion
|
|
4166
4285
|
//#region extensions/slack/src/monitor/message-handler.ts
|
|
4167
|
-
const loadSlackMessagePipeline = createLazyRuntimeModule(() => import("./pipeline.runtime-
|
|
4168
|
-
function createSlackDispatchCompletion() {
|
|
4169
|
-
let resolve;
|
|
4170
|
-
let reject;
|
|
4171
|
-
return {
|
|
4172
|
-
promise: new Promise((nextResolve, nextReject) => {
|
|
4173
|
-
resolve = nextResolve;
|
|
4174
|
-
reject = nextReject;
|
|
4175
|
-
}),
|
|
4176
|
-
resolve,
|
|
4177
|
-
reject
|
|
4178
|
-
};
|
|
4179
|
-
}
|
|
4286
|
+
const loadSlackMessagePipeline = createLazyRuntimeModule(() => import("./pipeline.runtime-CcdujV99.js"));
|
|
4180
4287
|
const RETRYABLE_FLUSH_MAX_ATTEMPTS = 3;
|
|
4181
4288
|
const RETRYABLE_FLUSH_RETRY_DELAY_MS = 1e3;
|
|
4182
4289
|
const REPLY_SESSION_INIT_CONFLICT_MESSAGE_RE = /reply session initialization conflicted for \S+/u;
|
|
@@ -4184,8 +4291,9 @@ function isRetryableSlackInboundError(error) {
|
|
|
4184
4291
|
return collectErrorGraphCandidates(error, (current) => [current.cause, current.error]).some((candidate) => REPLY_SESSION_INIT_CONFLICT_MESSAGE_RE.test(formatErrorMessage(candidate)));
|
|
4185
4292
|
}
|
|
4186
4293
|
function shouldDebounceSlackMessage(message, cfg) {
|
|
4294
|
+
const textForCommandDetection = stripSlackMentionsForCommandDetection(message.text ?? "");
|
|
4187
4295
|
return shouldDebounceTextInbound({
|
|
4188
|
-
text:
|
|
4296
|
+
text: textForCommandDetection,
|
|
4189
4297
|
cfg,
|
|
4190
4298
|
hasMedia: Boolean(message.files && message.files.length > 0) || hasSlackMessageTableBlock(message)
|
|
4191
4299
|
});
|
|
@@ -4243,6 +4351,19 @@ function createSlackMessageHandler(params) {
|
|
|
4243
4351
|
const completions = entries.map((entry) => entry.opts.dispatchCompletion).filter((completion) => completion !== void 0);
|
|
4244
4352
|
try {
|
|
4245
4353
|
await (async () => {
|
|
4354
|
+
const flushedEntry = entries.at(-1);
|
|
4355
|
+
if (flushedEntry) {
|
|
4356
|
+
const teamId = flushedEntry.opts.eventScope?.teamId;
|
|
4357
|
+
const flushedKey = buildSlackDebounceKey(flushedEntry.message, ctx.accountId, teamId);
|
|
4358
|
+
const topLevelConversationKey = buildTopLevelSlackConversationKey(flushedEntry.message, ctx.accountId, teamId);
|
|
4359
|
+
if (flushedKey && topLevelConversationKey) {
|
|
4360
|
+
const pendingKeys = pendingTopLevelDebounceKeys.get(topLevelConversationKey);
|
|
4361
|
+
if (pendingKeys) {
|
|
4362
|
+
pendingKeys.delete(flushedKey);
|
|
4363
|
+
if (pendingKeys.size === 0) pendingTopLevelDebounceKeys.delete(topLevelConversationKey);
|
|
4364
|
+
}
|
|
4365
|
+
}
|
|
4366
|
+
}
|
|
4246
4367
|
const claims = [];
|
|
4247
4368
|
const claimedKeys = /* @__PURE__ */ new Map();
|
|
4248
4369
|
const surviving = [];
|
|
@@ -4296,16 +4417,6 @@ function createSlackMessageHandler(params) {
|
|
|
4296
4417
|
releaseClaims();
|
|
4297
4418
|
return;
|
|
4298
4419
|
}
|
|
4299
|
-
const teamId = last.opts.eventScope?.teamId;
|
|
4300
|
-
const flushedKey = buildSlackDebounceKey(last.message, ctx.accountId, teamId);
|
|
4301
|
-
const topLevelConversationKey = buildTopLevelSlackConversationKey(last.message, ctx.accountId, teamId);
|
|
4302
|
-
if (flushedKey && topLevelConversationKey) {
|
|
4303
|
-
const pendingKeys = pendingTopLevelDebounceKeys.get(topLevelConversationKey);
|
|
4304
|
-
if (pendingKeys) {
|
|
4305
|
-
pendingKeys.delete(flushedKey);
|
|
4306
|
-
if (pendingKeys.size === 0) pendingTopLevelDebounceKeys.delete(topLevelConversationKey);
|
|
4307
|
-
}
|
|
4308
|
-
}
|
|
4309
4420
|
const combinedText = surviving.length === 1 ? last.message.text ?? "" : surviving.map((entry) => entry.message.text ?? "").filter(Boolean).join("\n");
|
|
4310
4421
|
const combinedMentioned = surviving.some((entry) => Boolean(entry.opts.wasMentioned));
|
|
4311
4422
|
const syntheticMessage = {
|
|
@@ -4338,6 +4449,7 @@ function createSlackMessageHandler(params) {
|
|
|
4338
4449
|
releaseClaims();
|
|
4339
4450
|
return;
|
|
4340
4451
|
}
|
|
4452
|
+
await turnAdoptionLifecycle?.onSessionRouted?.(prepared.route.sessionKey);
|
|
4341
4453
|
prepared.turnAdoptionLifecycle = {
|
|
4342
4454
|
...turnAdoptionLifecycle,
|
|
4343
4455
|
admission: turnAdoptionLifecycle?.admission ?? "exclusive",
|
|
@@ -4353,6 +4465,10 @@ function createSlackMessageHandler(params) {
|
|
|
4353
4465
|
if (admissionLifecycle.onDeferred() === false) return false;
|
|
4354
4466
|
settlementHandedOff = true;
|
|
4355
4467
|
},
|
|
4468
|
+
onDeferredHeartbeat: () => {
|
|
4469
|
+
turnAdoptionLifecycle?.onDeferredHeartbeat?.();
|
|
4470
|
+
admissionLifecycle.onDeferredHeartbeat?.();
|
|
4471
|
+
},
|
|
4356
4472
|
onAbandoned: () => {
|
|
4357
4473
|
settlementHandedOff = true;
|
|
4358
4474
|
releaseClaims();
|
|
@@ -4416,7 +4532,7 @@ function createSlackMessageHandler(params) {
|
|
|
4416
4532
|
pendingKeys.add(debounceKey);
|
|
4417
4533
|
pendingTopLevelDebounceKeys.set(conversationKey, pendingKeys);
|
|
4418
4534
|
}
|
|
4419
|
-
const dispatchCompletion = opts.awaitDispatch ?
|
|
4535
|
+
const dispatchCompletion = opts.awaitDispatch ? createDeferred() : void 0;
|
|
4420
4536
|
await debouncer.enqueue({
|
|
4421
4537
|
message: resolvedMessage,
|
|
4422
4538
|
opts: {
|
|
@@ -4435,11 +4551,11 @@ function createSlackMessageHandler(params) {
|
|
|
4435
4551
|
}
|
|
4436
4552
|
//#endregion
|
|
4437
4553
|
//#region extensions/slack/src/monitor/presence-monitor.ts
|
|
4438
|
-
const SLACK_PRESENCE_GREETING_COOLDOWN_MS =
|
|
4554
|
+
const SLACK_PRESENCE_GREETING_COOLDOWN_MS = 288e5;
|
|
4439
4555
|
const SLACK_PRESENCE_REQUEST_TIMEOUT_MS = 3e4;
|
|
4440
4556
|
const SLACK_PRESENCE_POLL_INTERVAL_MS = 6e4;
|
|
4441
4557
|
const SLACK_PRESENCE_AUTO_MAX_PARTICIPANTS = 8;
|
|
4442
|
-
const SLACK_PRESENCE_TARGET_TTL_MS =
|
|
4558
|
+
const SLACK_PRESENCE_TARGET_TTL_MS = 864e5;
|
|
4443
4559
|
const SLACK_PRESENCE_MAX_POLLS_PER_INTERVAL = 45;
|
|
4444
4560
|
const SLACK_PRESENCE_MAX_TARGETS = 2e3;
|
|
4445
4561
|
const DEFAULT_SLACK_PRESENCE_EVENT_PROMPT = ["Before greeting, retrieve relevant memory and wiki context for this immutable user_id, including a known timezone when available. Use their local time; if their timezone is unknown, do not guess.", "Send at most one short, natural greeting in this Slack conversation. Do not reveal private memory. If no greeting is appropriate, stay silent."];
|
|
@@ -5047,8 +5163,8 @@ async function authorizeSlackDirectMessage(params) {
|
|
|
5047
5163
|
//#endregion
|
|
5048
5164
|
//#region extensions/slack/src/monitor/external-arg-menu-store.ts
|
|
5049
5165
|
const SLACK_EXTERNAL_ARG_MENU_TOKEN_BYTES = 18;
|
|
5050
|
-
const SLACK_EXTERNAL_ARG_MENU_TOKEN_PATTERN = new RegExp(`^[A-Za-z0-9_-]{${Math.ceil(
|
|
5051
|
-
const SLACK_EXTERNAL_ARG_MENU_TTL_MS =
|
|
5166
|
+
const SLACK_EXTERNAL_ARG_MENU_TOKEN_PATTERN = new RegExp(`^[A-Za-z0-9_-]{${Math.ceil(24)}}$`);
|
|
5167
|
+
const SLACK_EXTERNAL_ARG_MENU_TTL_MS = 6e5;
|
|
5052
5168
|
const SLACK_EXTERNAL_ARG_MENU_PREFIX = "openclaw_cmdarg_ext:";
|
|
5053
5169
|
function pruneSlackExternalArgMenuStore(store, rawNow) {
|
|
5054
5170
|
const now = asDateTimestampMs(rawNow);
|
|
@@ -5140,7 +5256,7 @@ const SLACK_COMMAND_ARG_CONFIRM_TEXT_MAX = 300;
|
|
|
5140
5256
|
const SLACK_HEADER_TEXT_MAX = 150;
|
|
5141
5257
|
const SLACK_COMMAND_ARG_ACTION_BLOCKS_MAX = 47;
|
|
5142
5258
|
const loadSlashCommandsRuntime = createLazyRuntimeModule(() => import("./slash-commands.runtime-BTTMlmwy.js"));
|
|
5143
|
-
const loadSlashDispatchRuntime = createLazyRuntimeModule(() => import("./slash-dispatch.runtime-
|
|
5259
|
+
const loadSlashDispatchRuntime = createLazyRuntimeModule(() => import("./slash-dispatch.runtime-C2015r6s.js"));
|
|
5144
5260
|
const loadSlashSkillCommandsRuntime = createLazyRuntimeModule(() => import("./slash-skill-commands.runtime-CD1J2ODY.js"));
|
|
5145
5261
|
const loadPluginCommandRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/plugin-command-runtime"));
|
|
5146
5262
|
function resolveSlackCommandMenuModelContext(params) {
|
|
@@ -5191,6 +5307,8 @@ function resolveSlackCommandMenuModelContext(params) {
|
|
|
5191
5307
|
}
|
|
5192
5308
|
const slackExternalArgMenuStore = createSlackExternalArgMenuStore();
|
|
5193
5309
|
function buildSlackArgMenuConfirm(params) {
|
|
5310
|
+
const command = escapeSlackMrkdwn(params.command);
|
|
5311
|
+
const arg = escapeSlackMrkdwn(params.arg);
|
|
5194
5312
|
return {
|
|
5195
5313
|
title: {
|
|
5196
5314
|
type: "plain_text",
|
|
@@ -5198,7 +5316,7 @@ function buildSlackArgMenuConfirm(params) {
|
|
|
5198
5316
|
},
|
|
5199
5317
|
text: {
|
|
5200
5318
|
type: "mrkdwn",
|
|
5201
|
-
text: truncateSlackText(`Run */${
|
|
5319
|
+
text: truncateSlackText(`Run */${command}* with *${arg}* set to this value?`, SLACK_COMMAND_ARG_CONFIRM_TEXT_MAX)
|
|
5202
5320
|
},
|
|
5203
5321
|
confirm: {
|
|
5204
5322
|
type: "plain_text",
|
|
@@ -5602,7 +5720,7 @@ async function registerSlackMonitorSlashCommands(params) {
|
|
|
5602
5720
|
}
|
|
5603
5721
|
const channelName = channelInfo?.name;
|
|
5604
5722
|
const roomLabel = channelName ? `#${channelName}` : `#${command.channel_id}`;
|
|
5605
|
-
const { deliverSlackSlashReplies, dispatchChannelInboundTurn, finalizeInboundContext, isChannelPartialDeliveryError, resolveAgentRoute, resolveChunkMode, resolveConversationLabel, resolveMarkdownTableMode } = await loadSlashDispatchRuntime();
|
|
5723
|
+
const { deliverSlackSlashReplies, dispatchChannelInboundTurn, finalizeInboundContext, isChannelPartialDeliveryError, resolveAgentRoute, resolveChunkMode, resolveConversationLabel, resolveMarkdownTableMode, sanitizeSlackMonitorReplyPayload } = await loadSlashDispatchRuntime();
|
|
5606
5724
|
const route = resolvedSlashRoute ?? resolveAgentRoute({
|
|
5607
5725
|
cfg,
|
|
5608
5726
|
channel: "slack",
|
|
@@ -5702,10 +5820,8 @@ async function registerSlackMonitorSlashCommands(params) {
|
|
|
5702
5820
|
sessionKey: ctxPayload.SessionKey ?? route.sessionKey
|
|
5703
5821
|
},
|
|
5704
5822
|
ctxPayload,
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
return payload;
|
|
5708
|
-
} },
|
|
5823
|
+
dispatchReplyFromConfig: ctx.dispatchReplyFromConfig,
|
|
5824
|
+
replyPipeline: { transformReplyPayload: sanitizeSlackMonitorReplyPayload },
|
|
5709
5825
|
dispatcherOptions: { onSettled: async () => {
|
|
5710
5826
|
if (pendingSlashReplies.length === 0) return;
|
|
5711
5827
|
const pending = pendingSlashReplies.splice(0);
|
|
@@ -5920,11 +6036,13 @@ async function registerSlackMonitorSlashCommands(params) {
|
|
|
5920
6036
|
const respondFn = respond ?? (async (message) => {
|
|
5921
6037
|
if (!body.channel?.id || !body.user?.id) return new Response(null, { status: 204 });
|
|
5922
6038
|
const payload = typeof message === "string" ? { text: message } : message;
|
|
6039
|
+
const threadTs = body.container?.thread_ts ?? body.message?.thread_ts;
|
|
5923
6040
|
await args.client.chat.postEphemeral({
|
|
5924
6041
|
token: ctx.botToken,
|
|
5925
6042
|
channel: body.channel.id,
|
|
5926
6043
|
user: body.user.id,
|
|
5927
6044
|
text: payload.text ?? "",
|
|
6045
|
+
...threadTs ? { thread_ts: threadTs } : {},
|
|
5928
6046
|
...payload.blocks ? { blocks: payload.blocks } : {},
|
|
5929
6047
|
...typeof payload.mrkdwn === "boolean" ? { mrkdwn: payload.mrkdwn } : {}
|
|
5930
6048
|
});
|
|
@@ -5999,12 +6117,13 @@ async function deliverSlackSlashResponseWithWebApi(params) {
|
|
|
5999
6117
|
const mrkdwn = "mrkdwn" in payload && typeof payload.mrkdwn === "boolean" ? payload.mrkdwn : void 0;
|
|
6000
6118
|
if (payload.response_type === "in_channel") {
|
|
6001
6119
|
const postSlackMessage = params.client.chat.postMessage;
|
|
6002
|
-
|
|
6120
|
+
const response = await postSlackMessage({
|
|
6003
6121
|
channel: params.command.channel_id,
|
|
6004
6122
|
text,
|
|
6005
6123
|
...blocks ? { blocks } : {},
|
|
6006
6124
|
...mrkdwn !== void 0 ? { mrkdwn } : {}
|
|
6007
|
-
})
|
|
6125
|
+
});
|
|
6126
|
+
requireSlackPostMessageTimestamp(response);
|
|
6008
6127
|
} else await params.client.chat.postEphemeral({
|
|
6009
6128
|
channel: params.command.channel_id,
|
|
6010
6129
|
user: params.command.user_id,
|
|
@@ -6036,8 +6155,8 @@ async function getSlackBoltInterop() {
|
|
|
6036
6155
|
}
|
|
6037
6156
|
return slackBoltInterop;
|
|
6038
6157
|
}
|
|
6039
|
-
const loadSlackRelaySource = createLazyRuntimeModule(() => import("./relay-source-
|
|
6040
|
-
const SLACK_WEBHOOK_MAX_BODY_BYTES =
|
|
6158
|
+
const loadSlackRelaySource = createLazyRuntimeModule(() => import("./relay-source-BLMdBrAw.js"));
|
|
6159
|
+
const SLACK_WEBHOOK_MAX_BODY_BYTES = 1048576;
|
|
6041
6160
|
const SLACK_WEBHOOK_BODY_TIMEOUT_MS = 3e4;
|
|
6042
6161
|
function resolveSlackRuntimeIdentity(params) {
|
|
6043
6162
|
const botUserId = normalizeOptionalString(params.botUserId);
|
|
@@ -6178,8 +6297,9 @@ async function monitorSlackProvider(opts = {}) {
|
|
|
6178
6297
|
const groupDmChannels = dmConfig?.groupChannels;
|
|
6179
6298
|
let channelsConfig = slackCfg.channels;
|
|
6180
6299
|
const defaultGroupPolicy = resolveDefaultGroupPolicy(cfg);
|
|
6300
|
+
const providerConfigPresent = cfg.channels?.slack !== void 0;
|
|
6181
6301
|
const { groupPolicy, providerMissingFallbackApplied } = resolveOpenProviderRuntimeGroupPolicy$1({
|
|
6182
|
-
providerConfigPresent
|
|
6302
|
+
providerConfigPresent,
|
|
6183
6303
|
groupPolicy: slackCfg.groupPolicy,
|
|
6184
6304
|
defaultGroupPolicy
|
|
6185
6305
|
});
|
|
@@ -6480,10 +6600,11 @@ async function monitorSlackProvider(opts = {}) {
|
|
|
6480
6600
|
summarizeMapping("slack users", mapping, [], runtime);
|
|
6481
6601
|
}
|
|
6482
6602
|
if (allowNameMatching) try {
|
|
6483
|
-
const
|
|
6603
|
+
const resolvedUsers = await resolveSlackUserAllowlist({
|
|
6484
6604
|
token: resolveToken,
|
|
6485
6605
|
entries: allowEntries
|
|
6486
|
-
})
|
|
6606
|
+
});
|
|
6607
|
+
const { mapping, unresolved, additions } = buildAllowlistResolutionSummary(resolvedUsers, { formatResolved: formatSlackUserResolved });
|
|
6487
6608
|
allowFrom = mergeAllowlist({
|
|
6488
6609
|
existing: allowFrom,
|
|
6489
6610
|
additions
|
|
@@ -6510,10 +6631,11 @@ async function monitorSlackProvider(opts = {}) {
|
|
|
6510
6631
|
summarizeMapping("slack channel users", mapping, [], runtime);
|
|
6511
6632
|
}
|
|
6512
6633
|
if (allowNameMatching) try {
|
|
6513
|
-
const
|
|
6634
|
+
const resolvedUsers = await resolveSlackUserAllowlist({
|
|
6514
6635
|
token: resolveToken,
|
|
6515
6636
|
entries: Array.from(userEntries)
|
|
6516
|
-
})
|
|
6637
|
+
});
|
|
6638
|
+
const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(resolvedUsers, { formatResolved: formatSlackUserResolved });
|
|
6517
6639
|
const nextChannels = patchAllowlistUsersInConfigEntries({
|
|
6518
6640
|
entries: channelsConfig,
|
|
6519
6641
|
resolvedMap
|
|
@@ -6750,4 +6872,4 @@ function createSlackWorkspaceClientResolver(params) {
|
|
|
6750
6872
|
}
|
|
6751
6873
|
const resolveSlackRuntimeGroupPolicy = resolveOpenProviderRuntimeGroupPolicy$1;
|
|
6752
6874
|
//#endregion
|
|
6753
|
-
export {
|
|
6875
|
+
export { resolveStorePath$1 as C, stripSlackMentionsForCommandDetection as E, resolveChannelResetConfig as S, buildSlackSlashCommandMatcher as T, resolveSlackChatType as _, createSlackResponseUrlBudget as a, readSessionUpdatedAt as b, resolveSlackThreadTargets as c, authorizeSlackBotRoomMessage as d, resolveSlackCommandIngress as f, normalizeSlackChannelType as g, formatUnknownError as h, SlackResponseAlreadyReportedError as i, trackSlackDraftMessage as l, SLACK_SOCKET_RECONNECT_POLICY as m, resolveSlackRuntimeGroupPolicy as n, authorizeSlackDirectMessage as o, resolveSlackEffectiveAllowFrom as p, resolveSlackRoomContextHints as r, resolveSlackThreadContext as s, monitorSlackProvider as t, resolveConversationLabel$1 as u, buildSlackAssistantThreadMetadata as v, updateLastRoute as w, resolveChannelContextVisibilityMode as x, parseSlackAssistantThreadMetadata as y };
|