@openclaw/slack 2026.9.6 → 2026.9.8
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/assets/icon.png +0 -0
- package/dist/.setup/{account-inspect-DP1Bcwj4.mjs → account-inspect-DWBXpER6.mjs} +1 -1
- package/dist/.setup/{accounts-BBHvg0pY.mjs → accounts-D_N9IqNA.mjs} +23 -1
- package/dist/.setup/{action-runtime-B01d85zt.mjs → action-runtime-DfWvuiZd.mjs} +26 -41
- package/dist/.setup/action-runtime.runtime-Ck4bAWOX.mjs +2 -0
- package/dist/.setup/{actions-DKCtBgCI.mjs → actions-Df0CzcDl.mjs} +88 -175
- package/dist/.setup/{approval-handler.runtime-DMszKn_7.mjs → approval-handler.runtime-Ed6Sw5VK.mjs} +37 -47
- package/dist/.setup/{approval-message-updates-Tb_qRokK.mjs → approval-message-updates-BadvtA7R.mjs} +1 -2
- package/dist/.setup/{channel-CErYZ5zw.mjs → channel-C7bgPSTE.mjs} +181 -273
- package/dist/.setup/channel-meta-C443t-lI.mjs +27 -0
- package/dist/.setup/{channel-type-Dxk8VJUb.mjs → channel-type-ClOttrZ5.mjs} +13 -21
- package/dist/.setup/{channel.setup-BVoUtdPn.mjs → channel.setup-Dh2jzAjN.mjs} +35 -42
- package/dist/.setup/{config-schema-CyL279e7.mjs → config-schema-BZCxmHKG.mjs} +24 -21
- package/dist/.setup/{directory-config-CQTSH45W.mjs → directory-config-BOUWH3hR.mjs} +7 -10
- package/dist/.setup/{directory-live-BCcj89QV.mjs → directory-live-B2O4B_Ho.mjs} +9 -21
- package/dist/.setup/doctor-contract-CRN1Z_c7.mjs +342 -0
- package/dist/.setup/{message-tool-api-C0PTFaNV.mjs → message-tool-api-Cu4lwlGy.mjs} +34 -48
- package/dist/.setup/{provider-C-jPaGt2.mjs → monitor-BPVfkumU.mjs} +2181 -2693
- package/dist/.setup/{outbound-adapter-A7Wdn8ZT.mjs → outbound-adapter-Bv48XUjq.mjs} +10 -21
- package/dist/.setup/{pipeline.runtime-BlPOexmJ.mjs → pipeline.runtime-B1H63Frf.mjs} +311 -457
- package/dist/.setup/{plugin-routes-C3X0eVaK.mjs → plugin-routes-B8tooDLj.mjs} +1 -1
- package/dist/.setup/{policy-BApW53pI.mjs → policy-D-jfM174.mjs} +5 -5
- package/dist/.setup/{probe-DiYIMPJo.mjs → probe-B2Y9qc_z.mjs} +101 -39
- package/dist/.setup/{registry-bbjH7IHX.mjs → registry-CIbMfuf8.mjs} +6 -2
- package/dist/.setup/{relay-source-DfOnjJTE.mjs → relay-source-BpKdjsll.mjs} +10 -12
- package/dist/.setup/{replies-BBAJxUOQ.mjs → replies-BAnUtr2f.mjs} +16 -76
- package/dist/.setup/{reply-blocks-Bm8kf6mK.mjs → reply-blocks-SE1kTE3I.mjs} +27 -154
- package/dist/.setup/{resolve-channels-BXbMBbJD.mjs → resolve-channels-XXBn8UU_.mjs} +4 -5
- package/dist/.setup/{resolve-users-65WqvIqD.mjs → resolve-users-DW0ngD03.mjs} +20 -22
- package/dist/.setup/{scopes-h3YB-mMs.mjs → scopes-CasuDvaa.mjs} +6 -17
- package/dist/.setup/{secret-contract-DxmvbxBF.mjs → secret-contract-BaZcu6P_.mjs} +15 -20
- package/dist/.setup/{secret-contract-api-D9UfYujm.mjs → secret-contract-api-Dp6290Vg.mjs} +1 -1
- package/dist/.setup/{security-audit-BypHqcq5.mjs → security-audit-BqDc-6VL.mjs} +1 -1
- package/dist/.setup/{send-Cp6omkOg.mjs → send-BOVLQi3n.mjs} +84 -171
- package/dist/.setup/{session-status-Cf7AvWOt.mjs → session-status-DscajIsd.mjs} +315 -238
- package/dist/.setup/{setup-plugin-api-dLPkL06L.mjs → setup-plugin-api-DTtbTKNk.mjs} +1 -1
- package/dist/.setup/{setup-surface-D3DLcCxu.mjs → setup-surface-Dn7QgWRE.mjs} +24 -56
- package/dist/.setup/{shared-CJ3arAFL.mjs → shared-qau-uDGl.mjs} +30 -56
- package/dist/.setup/{slash-dispatch.runtime-HFy_XvyO.mjs → slash-dispatch.runtime--AEzLVBF.mjs} +1 -1
- package/dist/.setup/{streaming-compat-B-e0mqM0.mjs → streaming-compat-C5Wut626.mjs} +31 -8
- package/dist/.setup/{target-parsing-DEsPjngB.mjs → target-parsing-FFE26kOV.mjs} +1 -7
- package/dist/.setup/{targets-Cku2KCvg.mjs → targets-C6LZQL1Q.mjs} +1 -1
- package/dist/.setup/{thread-ts-CukseRVL.mjs → thread-ts-Cvt7WD6B.mjs} +0 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/api.js +18 -17
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/http-routes-api.js +1 -1
- package/dist/index.js +1 -1
- package/dist/message-tool-api.js +1 -1
- package/dist/runtime-api.js +11 -12
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/setup-entry.js +2 -2
- package/dist/setup-plugin-api.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 +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +20 -8
- package/node_modules/@slack/bolt/node_modules/@types/node/ffi.d.ts +14 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/http2.d.ts +3 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/net.d.ts +16 -4
- package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/process.d.ts +1 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/quic.d.ts +39 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/stream/iter.d.ts +9 -12
- package/node_modules/@slack/bolt/node_modules/@types/node/test/reporters.d.ts +1 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/test.d.ts +72 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/tls.d.ts +14 -10
- package/node_modules/@slack/bolt/node_modules/@types/node/vm.d.ts +2 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/worker_threads.d.ts +4 -1
- 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 +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +20 -8
- package/node_modules/@slack/web-api/node_modules/@types/node/ffi.d.ts +14 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +3 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/net.d.ts +16 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +1 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/quic.d.ts +39 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/iter.d.ts +9 -12
- package/node_modules/@slack/web-api/node_modules/@types/node/test/reporters.d.ts +1 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +72 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/tls.d.ts +14 -10
- package/node_modules/@slack/web-api/node_modules/@types/node/vm.d.ts +2 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/worker_threads.d.ts +4 -1
- package/node_modules/get-east-asian-width/index.js +8 -3
- package/node_modules/get-east-asian-width/lookup-data.js +1 -1
- package/node_modules/get-east-asian-width/lookup.js +4 -4
- package/node_modules/get-east-asian-width/package.json +1 -1
- package/node_modules/typebox/build/compile/code.mjs +1 -2
- package/node_modules/typebox/build/compile/validator.mjs +5 -1
- package/node_modules/typebox/build/format/iri.mjs +16 -9
- package/node_modules/typebox/build/guard/emit.mjs +2 -2
- package/node_modules/typebox/build/guard/guard.d.mts +7 -5
- package/node_modules/typebox/build/guard/guard.mjs +14 -9
- package/node_modules/typebox/build/guard/index.mjs +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
- package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
- package/node_modules/typebox/build/schema/build.mjs +2 -3
- package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
- package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
- package/node_modules/typebox/build/schema/parse.mjs +3 -0
- package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
- package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
- package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
- package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
- package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
- package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
- package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
- package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
- package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
- package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +3 -1
- package/node_modules/undici/README.md +81 -25
- package/node_modules/undici/docs/docs/api/Agent.md +249 -42
- package/node_modules/undici/docs/docs/api/BalancedPool.md +246 -48
- package/node_modules/undici/docs/docs/api/CacheStorage.md +171 -13
- package/node_modules/undici/docs/docs/api/CacheStore.md +294 -98
- package/node_modules/undici/docs/docs/api/Client.md +407 -162
- package/node_modules/undici/docs/docs/api/ClientStats.md +80 -14
- package/node_modules/undici/docs/docs/api/Connector.md +118 -35
- package/node_modules/undici/docs/docs/api/ContentType.md +65 -25
- package/node_modules/undici/docs/docs/api/Cookies.md +122 -71
- package/node_modules/undici/docs/docs/api/Debug.md +34 -18
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +364 -164
- package/node_modules/undici/docs/docs/api/Dispatcher.md +490 -1055
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +105 -93
- package/node_modules/undici/docs/docs/api/Errors.md +503 -28
- package/node_modules/undici/docs/docs/api/EventSource.md +326 -13
- package/node_modules/undici/docs/docs/api/Fetch.md +681 -30
- package/node_modules/undici/docs/docs/api/GlobalInstallation.md +78 -96
- package/node_modules/undici/docs/docs/api/H2CClient.md +298 -176
- package/node_modules/undici/docs/docs/api/Interceptors.md +418 -0
- package/node_modules/undici/docs/docs/api/MockAgent.md +333 -314
- package/node_modules/undici/docs/docs/api/MockCallHistory.md +272 -98
- package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +189 -26
- package/node_modules/undici/docs/docs/api/MockClient.md +151 -33
- package/node_modules/undici/docs/docs/api/MockErrors.md +56 -5
- package/node_modules/undici/docs/docs/api/MockPool.md +321 -258
- package/node_modules/undici/docs/docs/api/Pool.md +236 -41
- package/node_modules/undici/docs/docs/api/PoolStats.md +119 -13
- package/node_modules/undici/docs/docs/api/ProxyAgent.md +179 -160
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +238 -55
- package/node_modules/undici/docs/docs/api/RetryAgent.md +113 -27
- package/node_modules/undici/docs/docs/api/RetryHandler.md +161 -79
- package/node_modules/undici/docs/docs/api/RoundRobinPool.md +166 -72
- package/node_modules/undici/docs/docs/api/SnapshotAgent.md +262 -517
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +177 -196
- package/node_modules/undici/docs/docs/api/Util.md +68 -11
- package/node_modules/undici/docs/docs/api/WebSocket.md +475 -80
- package/node_modules/undici/docs/docs/api/api-lifecycle.md +100 -32
- package/node_modules/undici/docs/docs/best-practices/client-certificate.md +2 -0
- package/node_modules/undici/docs/docs/best-practices/crawling.md +3 -1
- package/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +233 -0
- package/node_modules/undici/docs/docs/best-practices/mocking-request.md +9 -7
- package/node_modules/undici/docs/docs/best-practices/proxy.md +3 -1
- package/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +10 -8
- package/node_modules/undici/docs/docs/best-practices/writing-tests.md +2 -0
- package/node_modules/undici/docs/docs/getting-started.md +281 -0
- package/node_modules/undici/docs/docs/index.md +784 -0
- package/node_modules/undici/docs/docs/site.json +125 -0
- package/node_modules/undici/docs/docs/type-map.json +79 -0
- package/node_modules/undici/index.js +4 -2
- package/node_modules/undici/lib/api/api-connect.js +13 -11
- package/node_modules/undici/lib/api/api-pipeline.js +26 -13
- package/node_modules/undici/lib/api/api-request.js +51 -21
- package/node_modules/undici/lib/api/api-stream.js +81 -20
- package/node_modules/undici/lib/api/api-upgrade.js +21 -11
- package/node_modules/undici/lib/api/readable.js +45 -9
- package/node_modules/undici/lib/cache/memory-cache-store.js +3 -3
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +3 -1
- package/node_modules/undici/lib/core/connect.js +46 -7
- package/node_modules/undici/lib/core/constants.js +1 -24
- package/node_modules/undici/lib/core/errors.js +22 -2
- package/node_modules/undici/lib/core/request.js +100 -18
- package/node_modules/undici/lib/core/symbols.js +4 -0
- package/node_modules/undici/lib/core/util.js +105 -48
- package/node_modules/undici/lib/dispatcher/agent.js +51 -32
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +23 -27
- package/node_modules/undici/lib/dispatcher/client-h1.js +86 -24
- package/node_modules/undici/lib/dispatcher/client-h2.js +1091 -361
- package/node_modules/undici/lib/dispatcher/client.js +109 -36
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +19 -6
- package/node_modules/undici/lib/dispatcher/dispatcher.js +15 -5
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +110 -0
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +37 -8
- package/node_modules/undici/lib/dispatcher/h2c-client.js +4 -4
- package/node_modules/undici/lib/dispatcher/pool-base.js +28 -10
- package/node_modules/undici/lib/dispatcher/pool.js +30 -5
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +95 -19
- package/node_modules/undici/lib/dispatcher/retry-agent.js +3 -0
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +32 -10
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +153 -63
- package/node_modules/undici/lib/global.js +37 -14
- package/node_modules/undici/lib/handler/cache-handler.js +49 -7
- package/node_modules/undici/lib/handler/cache-revalidation-handler.js +10 -0
- package/node_modules/undici/lib/handler/decorator-handler.js +8 -3
- package/node_modules/undici/lib/handler/deduplication-handler.js +12 -6
- package/node_modules/undici/lib/handler/redirect-handler.js +66 -66
- package/node_modules/undici/lib/handler/retry-handler.js +191 -50
- package/node_modules/undici/lib/interceptor/cache.js +75 -25
- package/node_modules/undici/lib/interceptor/decompress.js +5 -2
- package/node_modules/undici/lib/interceptor/deduplicate.js +5 -4
- package/node_modules/undici/lib/interceptor/dns.js +12 -1
- package/node_modules/undici/lib/interceptor/redirect.js +3 -3
- package/node_modules/undici/lib/llhttp/llhttp-wasm.js +1 -1
- package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +1 -1
- package/node_modules/undici/lib/mock/mock-agent.js +21 -9
- package/node_modules/undici/lib/mock/mock-call-history.js +1 -1
- package/node_modules/undici/lib/mock/mock-interceptor.js +25 -7
- package/node_modules/undici/lib/mock/mock-utils.js +281 -47
- package/node_modules/undici/lib/mock/snapshot-agent.js +25 -7
- package/node_modules/undici/lib/mock/snapshot-recorder.js +38 -3
- package/node_modules/undici/lib/util/cache.js +92 -10
- package/node_modules/undici/lib/util/runtime-features.js +3 -34
- package/node_modules/undici/lib/web/cache/cache.js +6 -8
- package/node_modules/undici/lib/web/cookies/parse.js +150 -146
- package/node_modules/undici/lib/web/cookies/util.js +1 -1
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +28 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +20 -21
- package/node_modules/undici/lib/web/eventsource/util.js +32 -1
- package/node_modules/undici/lib/web/fetch/body.js +48 -10
- package/node_modules/undici/lib/web/fetch/constants.js +1 -1
- package/node_modules/undici/lib/web/fetch/formdata.js +21 -2
- package/node_modules/undici/lib/web/fetch/index.js +242 -223
- package/node_modules/undici/lib/web/fetch/request.js +35 -6
- package/node_modules/undici/lib/web/fetch/response.js +1 -3
- package/node_modules/undici/lib/web/fetch/util.js +10 -2
- package/node_modules/undici/lib/web/webidl/index.js +5 -7
- package/node_modules/undici/lib/web/websocket/frame.js +1 -7
- package/node_modules/undici/lib/web/websocket/receiver.js +1 -1
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +10 -10
- package/node_modules/undici/lib/web/websocket/websocket.js +25 -3
- package/node_modules/undici/package.json +10 -10
- package/node_modules/undici/types/agent.d.ts +0 -2
- package/node_modules/undici/types/client.d.ts +69 -24
- package/node_modules/undici/types/connector.d.ts +1 -0
- package/node_modules/undici/types/cookies.d.ts +1 -1
- package/node_modules/undici/types/dispatcher.d.ts +8 -30
- package/node_modules/undici/types/dispatcher1-wrapper.d.ts +7 -0
- package/node_modules/undici/types/errors.d.ts +10 -0
- package/node_modules/undici/types/fetch.d.ts +5 -1
- package/node_modules/undici/types/formdata.d.ts +0 -6
- package/node_modules/undici/types/h2c-client.d.ts +6 -6
- package/node_modules/undici/types/handlers.d.ts +2 -0
- package/node_modules/undici/types/header.d.ts +5 -0
- package/node_modules/undici/types/index.d.ts +3 -1
- package/node_modules/undici/types/interceptors.d.ts +1 -1
- package/node_modules/undici/types/mock-agent.d.ts +11 -10
- package/node_modules/undici/types/mock-interceptor.d.ts +5 -1
- package/node_modules/undici/types/pool.d.ts +0 -2
- package/node_modules/undici/types/proxy-agent.d.ts +9 -2
- package/node_modules/undici/types/round-robin-pool.d.ts +0 -2
- package/node_modules/undici/types/snapshot-agent.d.ts +4 -0
- package/node_modules/undici/types/socks5-proxy-agent.d.ts +4 -2
- package/node_modules/undici/types/webidl.d.ts +0 -1
- package/openclaw.plugin.json +31 -3
- package/package.json +7 -7
- package/dist/.setup/accounts.runtime-DN-PPocC.mjs +0 -2
- package/dist/.setup/action-runtime.runtime-C8R8CUan.mjs +0 -2
- package/dist/.setup/doctor-contract-CtMUqjvk.mjs +0 -186
- package/dist/.setup/monitor-_Sht7Dqy.mjs +0 -13
- package/dist/.setup/rolldown-runtime-D7D4PA-g.mjs +0 -13
- package/dist/.setup/send.runtime-B4caZU6T.mjs +0 -2
- package/dist/.setup/slash-commands.runtime-BpSH0b3q.mjs +0 -2
- package/dist/.setup/slash-skill-commands.runtime-Bi1JWZHY.mjs +0 -2
- package/node_modules/undici/lib/handler/unwrap-handler.js +0 -106
- package/node_modules/undici/lib/handler/wrap-handler.js +0 -105
- package/node_modules/undici/lib/llhttp/.gitkeep +0 -0
- package/node_modules/undici/lib/util/promise.js +0 -28
- /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as isSlackPluginAccountConfigured } from "./account-configured-sUohAxZr.mjs";
|
|
2
|
-
import { a as
|
|
3
|
-
import { a as parseSlackTarget, n as formatSlackTarget, t as canonicalizeSlackApiTargetId } from "./target-parsing-
|
|
4
|
-
import { t as slackContextTargetsMatch } from "./targets-
|
|
5
|
-
import {
|
|
2
|
+
import { a as mergeSlackAccountConfig, c as resolveSlackAccountAllowFrom, i as listSlackAccountIds, o as resolveDefaultSlackAccountId, s as resolveSlackAccount } from "./accounts-D_N9IqNA.mjs";
|
|
3
|
+
import { a as parseSlackTarget, n as formatSlackTarget, t as canonicalizeSlackApiTargetId } from "./target-parsing-FFE26kOV.mjs";
|
|
4
|
+
import { t as slackContextTargetsMatch } from "./targets-C6LZQL1Q.mjs";
|
|
5
|
+
import { A as resolveSlackUserAllowListForTeam, k as resolveSlackAllowListMatch, o as formatSlackError } from "./probe-B2Y9qc_z.mjs";
|
|
6
6
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
7
7
|
import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString, readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { normalizeMessageChannel } from "openclaw/plugin-sdk/routing";
|
|
@@ -13,29 +13,19 @@ import { isSingleUseReplyToMode } from "openclaw/plugin-sdk/reply-reference";
|
|
|
13
13
|
import { buildChannelKeyCandidates } from "openclaw/plugin-sdk/channel-targets";
|
|
14
14
|
import { createNativeApprovalChannelRouteGates, doesApprovalRequestSelectChannelAccount, resolveApprovalKind, resolveApprovalRequestSessionConversation } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
15
15
|
import { createChannelApprovalAuth, resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
16
|
+
import { normalizeHyphenSlug, normalizeStringEntriesLower } from "openclaw/plugin-sdk/string-normalization-runtime";
|
|
16
17
|
import { createChannelExecApprovalProfile, isChannelExecApprovalClientEnabledFromConfig, isChannelExecApprovalTargetRecipient, matchesApprovalRequestFilters } from "openclaw/plugin-sdk/approval-client-runtime";
|
|
17
|
-
import { normalizeHyphenSlug } from "openclaw/plugin-sdk/string-normalization-runtime";
|
|
18
|
-
import { channelRouteTargetsMatchExact, stringifyRouteThreadId } from "openclaw/plugin-sdk/channel-route";
|
|
19
18
|
import { resolveGlobalMap } from "openclaw/plugin-sdk/global-singleton";
|
|
19
|
+
import { channelRouteTargetsMatchExact, stringifyRouteThreadId } from "openclaw/plugin-sdk/channel-route";
|
|
20
20
|
import { normalizeMessagePresentation, renderMessagePresentationChartFallbackText, renderMessagePresentationFallbackText, renderMessagePresentationTableFallbackText } from "openclaw/plugin-sdk/interactive-runtime";
|
|
21
|
+
import { buildApprovalResolutionRef } from "openclaw/plugin-sdk/approval-reference-runtime";
|
|
21
22
|
import { eastAsianWidthType } from "get-east-asian-width";
|
|
22
23
|
import { resolveIntegerOption } from "openclaw/plugin-sdk/number-runtime";
|
|
24
|
+
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
23
25
|
import { readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
26
|
+
import { inspectRuntimeConversationBindingRoute } from "openclaw/plugin-sdk/conversation-binding-runtime";
|
|
24
27
|
import { resolveConfiguredBindingRoute, resolveRuntimeConversationBindingRoute } from "openclaw/plugin-sdk/conversation-runtime";
|
|
25
28
|
import { resolveScopeRequireMention, resolveScopeToolsPolicy } from "openclaw/plugin-sdk/channel-policy";
|
|
26
|
-
//#region extensions/slack/src/account-reply-mode.ts
|
|
27
|
-
function normalizeSlackChatType(raw) {
|
|
28
|
-
const value = raw?.trim().toLowerCase();
|
|
29
|
-
if (!value) return;
|
|
30
|
-
if (value === "direct" || value === "dm") return "direct";
|
|
31
|
-
if (value === "group" || value === "channel") return value;
|
|
32
|
-
}
|
|
33
|
-
function resolveSlackReplyToMode(account, chatType) {
|
|
34
|
-
const normalized = normalizeSlackChatType(chatType ?? void 0);
|
|
35
|
-
if (normalized && account.replyToModeByChatType?.[normalized] !== void 0) return account.replyToModeByChatType[normalized] ?? "off";
|
|
36
|
-
return account.replyToMode ?? "off";
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
39
29
|
//#region extensions/slack/src/action-threading.ts
|
|
40
30
|
const SLACK_PRIVATE_ACTION_DELIVERY_RESULT = Symbol("slack.action.delivery-result");
|
|
41
31
|
function resolveSlackAutoThreadId(params) {
|
|
@@ -51,6 +41,24 @@ function resolveSlackAutoThreadId(params) {
|
|
|
51
41
|
return context.currentThreadTs;
|
|
52
42
|
}
|
|
53
43
|
//#endregion
|
|
44
|
+
//#region extensions/slack/src/approval-plugin-policy.ts
|
|
45
|
+
/** Returns undefined only when Slack plugin approvals retain legacy account authorization. */
|
|
46
|
+
function resolvePluginApprovalSlackApprovers(cfg, request) {
|
|
47
|
+
const policy = cfg.approvals?.plugin?.slack;
|
|
48
|
+
if (!policy) return;
|
|
49
|
+
const subject = request.request.policySubject;
|
|
50
|
+
const plugins = policy.plugins;
|
|
51
|
+
if (!subject && plugins && Object.keys(plugins).length > 0) return [];
|
|
52
|
+
const plugin = subject && plugins && Object.hasOwn(plugins, subject.pluginKey) ? plugins[subject.pluginKey] : void 0;
|
|
53
|
+
const tools = plugin?.tools;
|
|
54
|
+
if (tools && Object.keys(tools).length > 0) {
|
|
55
|
+
if (!subject?.tool) return [];
|
|
56
|
+
const toolKey = encodeURIComponent(subject.tool);
|
|
57
|
+
if (Object.hasOwn(tools, toolKey)) return tools[toolKey]?.approvers ?? [];
|
|
58
|
+
}
|
|
59
|
+
return plugin?.approvers ?? policy.approvers;
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
54
62
|
//#region extensions/slack/src/exec-approvals.ts
|
|
55
63
|
function normalizeSlackUserLikeId(value) {
|
|
56
64
|
const upper = value.toUpperCase();
|
|
@@ -109,6 +117,40 @@ const isSlackExecApprovalAuthorizedSender = slackExecApprovalProfile.isAuthorize
|
|
|
109
117
|
const resolveSlackExecApprovalTarget = slackExecApprovalProfile.resolveTarget;
|
|
110
118
|
const shouldSuppressLocalSlackExecApprovalPrompt = slackExecApprovalProfile.shouldSuppressLocalPrompt;
|
|
111
119
|
//#endregion
|
|
120
|
+
//#region extensions/slack/src/installation-identity-state.ts
|
|
121
|
+
const slackInstallationStates = resolveGlobalMap(Symbol.for("openclaw.slack.installation-identities"), "close-and-restart");
|
|
122
|
+
function registerSlackInstallationState(accountId, kind, teamId) {
|
|
123
|
+
const normalizedAccountId = normalizeAccountId(accountId);
|
|
124
|
+
const owner = Symbol(`slack-installation:${normalizedAccountId}`);
|
|
125
|
+
slackInstallationStates.set(normalizedAccountId, {
|
|
126
|
+
kind,
|
|
127
|
+
teamId,
|
|
128
|
+
owner
|
|
129
|
+
});
|
|
130
|
+
return {
|
|
131
|
+
update: (nextKind, nextTeamId) => {
|
|
132
|
+
if (slackInstallationStates.get(normalizedAccountId)?.owner === owner) slackInstallationStates.set(normalizedAccountId, {
|
|
133
|
+
kind: nextKind,
|
|
134
|
+
teamId: nextTeamId,
|
|
135
|
+
owner
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
release: () => {
|
|
139
|
+
if (slackInstallationStates.get(normalizedAccountId)?.owner === owner) slackInstallationStates.delete(normalizedAccountId);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function getSlackInstallationKind(accountId) {
|
|
144
|
+
return slackInstallationStates.get(normalizeAccountId(accountId))?.kind;
|
|
145
|
+
}
|
|
146
|
+
function getSlackInstallationTeamId(accountId) {
|
|
147
|
+
const state = slackInstallationStates.get(normalizeAccountId(accountId));
|
|
148
|
+
return state?.kind === "workspace" ? state.teamId : void 0;
|
|
149
|
+
}
|
|
150
|
+
function isSlackWorkspaceInstallation(accountId) {
|
|
151
|
+
return getSlackInstallationKind(accountId) === "workspace";
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
112
154
|
//#region extensions/slack/src/approval-auth.ts
|
|
113
155
|
function resolveSlackApprovalInputs(params) {
|
|
114
156
|
const account = resolveSlackAccount(params).config;
|
|
@@ -117,14 +159,22 @@ function resolveSlackApprovalInputs(params) {
|
|
|
117
159
|
defaultTo: account.defaultTo
|
|
118
160
|
};
|
|
119
161
|
}
|
|
120
|
-
function slackApprovalTargetMatches(senderId, approvers) {
|
|
162
|
+
function slackApprovalTargetMatches(senderId, approvers, accountTeamId) {
|
|
121
163
|
const sender = parseSlackTarget(senderId, { defaultKind: "user" });
|
|
122
|
-
return sender?.kind === "user" && resolveSlackAllowListMatch({
|
|
123
|
-
allowList:
|
|
164
|
+
return sender?.kind === "user" && (!accountTeamId || sender.teamId?.toLowerCase() === accountTeamId.toLowerCase()) && resolveSlackAllowListMatch({
|
|
165
|
+
allowList: normalizeStringEntriesLower([...approvers]),
|
|
124
166
|
teamId: sender.teamId,
|
|
125
167
|
id: sender.id
|
|
126
168
|
}).allowed;
|
|
127
169
|
}
|
|
170
|
+
function resolveSlackApprovalOriginTeamId(request) {
|
|
171
|
+
if (normalizeLowercaseStringOrEmpty(request.request.turnSourceChannel) !== "slack") return;
|
|
172
|
+
try {
|
|
173
|
+
return parseSlackTarget(request.request.turnSourceTo ?? "")?.teamId;
|
|
174
|
+
} catch {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
128
178
|
const slackApproval = createChannelApprovalAuth({
|
|
129
179
|
channelLabel: "Slack",
|
|
130
180
|
resolveInputs: resolveSlackApprovalInputs,
|
|
@@ -135,64 +185,71 @@ const slackApproval = createChannelApprovalAuth({
|
|
|
135
185
|
});
|
|
136
186
|
const getSlackApprovalApprovers = slackApproval.resolveApprovers;
|
|
137
187
|
const isSlackApprovalAuthorizedSender = slackApproval.isAuthorizedSender;
|
|
188
|
+
function isSlackPluginApprovalAuthorizedSender(params) {
|
|
189
|
+
if (!params.request) return params.cfg.approvals?.plugin?.slack ? Boolean(params.senderId && normalizeSlackApproverTarget(params.senderId)) : isSlackApprovalAuthorizedSender(params);
|
|
190
|
+
if (resolvePluginApprovalSlackApprovers(params.cfg, params.request) === void 0) return isSlackApprovalAuthorizedSender(params);
|
|
191
|
+
const teamId = resolveSlackApprovalTeamId({
|
|
192
|
+
...params,
|
|
193
|
+
request: params.request
|
|
194
|
+
});
|
|
195
|
+
return Boolean(params.senderId && slackApprovalTargetMatches(params.senderId, getSlackApprovalApproversForTeam({
|
|
196
|
+
...params,
|
|
197
|
+
teamId
|
|
198
|
+
}), teamId));
|
|
199
|
+
}
|
|
138
200
|
function getSlackApprovalApproversForTeam(params) {
|
|
201
|
+
const configured = params.request ? resolvePluginApprovalSlackApprovers(params.cfg, params.request) : void 0;
|
|
202
|
+
if (params.request) {
|
|
203
|
+
const accountId = resolveSlackAccount(params).accountId;
|
|
204
|
+
const installedTeamId = getSlackInstallationTeamId(accountId);
|
|
205
|
+
const originTeamId = resolveSlackApprovalOriginTeamId(params.request);
|
|
206
|
+
const enterprise = getSlackInstallationKind(accountId) === "enterprise";
|
|
207
|
+
if (installedTeamId && originTeamId && installedTeamId.toLowerCase() !== originTeamId.toLowerCase() || enterprise && !originTeamId || configured !== void 0 && !installedTeamId && !enterprise) return [];
|
|
208
|
+
}
|
|
209
|
+
const approvers = configured ?? getSlackApprovalApprovers(params);
|
|
139
210
|
return resolveApprovalApprovers({
|
|
140
211
|
allowFrom: resolveSlackUserAllowListForTeam({
|
|
141
|
-
allowList:
|
|
212
|
+
allowList: [...approvers],
|
|
142
213
|
teamId: params.teamId
|
|
143
214
|
}),
|
|
144
215
|
normalizeApprover: normalizeSlackApproverTarget
|
|
145
216
|
});
|
|
146
217
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const slackInstallationStates = resolveGlobalMap(Symbol.for("openclaw.slack.installation-identities"), "close-and-restart");
|
|
150
|
-
function registerSlackInstallationState(accountId, kind) {
|
|
151
|
-
const normalizedAccountId = normalizeAccountId(accountId);
|
|
152
|
-
const owner = Symbol(`slack-installation:${normalizedAccountId}`);
|
|
153
|
-
slackInstallationStates.set(normalizedAccountId, {
|
|
154
|
-
kind,
|
|
155
|
-
owner
|
|
156
|
-
});
|
|
157
|
-
return {
|
|
158
|
-
update: (nextKind) => {
|
|
159
|
-
if (slackInstallationStates.get(normalizedAccountId)?.owner === owner) slackInstallationStates.set(normalizedAccountId, {
|
|
160
|
-
kind: nextKind,
|
|
161
|
-
owner
|
|
162
|
-
});
|
|
163
|
-
},
|
|
164
|
-
release: () => {
|
|
165
|
-
if (slackInstallationStates.get(normalizedAccountId)?.owner === owner) slackInstallationStates.delete(normalizedAccountId);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
function getSlackInstallationKind(accountId) {
|
|
170
|
-
return slackInstallationStates.get(normalizeAccountId(accountId))?.kind;
|
|
171
|
-
}
|
|
172
|
-
function isSlackWorkspaceInstallation(accountId) {
|
|
173
|
-
return getSlackInstallationKind(accountId) === "workspace";
|
|
218
|
+
function resolveSlackApprovalTeamId(params) {
|
|
219
|
+
return getSlackInstallationTeamId(resolveSlackAccount(params).accountId) ?? resolveSlackApprovalOriginTeamId(params.request);
|
|
174
220
|
}
|
|
175
221
|
//#endregion
|
|
176
222
|
//#region extensions/slack/src/approval-native-gates.ts
|
|
177
|
-
|
|
223
|
+
function isSlackPluginApprovalRequest(request) {
|
|
224
|
+
return resolveApprovalKind(request) === "plugin";
|
|
225
|
+
}
|
|
226
|
+
function resolveSlackApproverDmTargets(params) {
|
|
227
|
+
if (!shouldHandleSlackNativeApprovalRequest(params)) return [];
|
|
228
|
+
const teamId = resolveSlackApprovalTeamId(params);
|
|
229
|
+
return (params.approvalKind === "plugin" ? isSlackPluginApprovalRequest(params.request) ? getSlackApprovalApproversForTeam({
|
|
230
|
+
...params,
|
|
231
|
+
teamId,
|
|
232
|
+
request: params.request
|
|
233
|
+
}) : [] : getSlackExecApprovalApprovers(params)).map((approver) => {
|
|
234
|
+
const target = parseSlackTarget(approver, { defaultKind: "user" });
|
|
235
|
+
if (!target || target.kind !== "user") throw new Error("Slack approval approver target must be a user");
|
|
236
|
+
return { to: formatSlackTarget({
|
|
237
|
+
kind: "user",
|
|
238
|
+
id: target.id,
|
|
239
|
+
teamId: target.teamId ?? teamId,
|
|
240
|
+
explicitKind: true
|
|
241
|
+
}) };
|
|
242
|
+
});
|
|
243
|
+
}
|
|
178
244
|
const SLACK_DM_CHANNEL_ID_RE = /^D[A-Z0-9]{8,}$/i;
|
|
179
245
|
const SLACK_USER_ID_RE = /^[UW][A-Z0-9]{8,}$/i;
|
|
180
246
|
function isSlackApprovalTransportEnabled(params) {
|
|
181
247
|
const account = resolveSlackAccount(params);
|
|
182
248
|
return isSlackPluginAccountConfigured(account);
|
|
183
249
|
}
|
|
184
|
-
function resolveSlackNativeApprovalConfig(params) {
|
|
185
|
-
return resolveSlackAccount(params).config.execApprovals;
|
|
186
|
-
}
|
|
187
|
-
function resolvePluginApprovalForwardingConfig(cfg) {
|
|
188
|
-
return cfg.approvals?.plugin;
|
|
189
|
-
}
|
|
190
250
|
function normalizeSlackThreadMatchKey(threadId) {
|
|
191
251
|
return threadId == null ? "" : String(threadId).trim();
|
|
192
252
|
}
|
|
193
|
-
function normalizeComparableTarget(value) {
|
|
194
|
-
return normalizeLowercaseStringOrEmpty(value);
|
|
195
|
-
}
|
|
196
253
|
function extractSlackSessionKind(sessionKey) {
|
|
197
254
|
if (!sessionKey) return null;
|
|
198
255
|
const match = sessionKey.match(/slack:(direct|channel|group):/i);
|
|
@@ -248,15 +305,12 @@ function resolveSlackFallbackOriginTarget(request) {
|
|
|
248
305
|
function normalizeSlackOriginTarget(target) {
|
|
249
306
|
return {
|
|
250
307
|
...target,
|
|
251
|
-
to:
|
|
308
|
+
to: normalizeLowercaseStringOrEmpty(target.to)
|
|
252
309
|
};
|
|
253
310
|
}
|
|
254
|
-
function parseComparableSlackTarget(target) {
|
|
255
|
-
return parseSlackTarget(target.to, { defaultKind: "channel" });
|
|
256
|
-
}
|
|
257
311
|
function isSlackDmChannelToUserRoutePair(a, b) {
|
|
258
|
-
const left =
|
|
259
|
-
const right =
|
|
312
|
+
const left = parseSlackTarget(a.to, { defaultKind: "channel" });
|
|
313
|
+
const right = parseSlackTarget(b.to, { defaultKind: "channel" });
|
|
260
314
|
if (!left || !right) return false;
|
|
261
315
|
if (left.teamId?.toLowerCase() !== right.teamId?.toLowerCase()) return false;
|
|
262
316
|
return left.kind === "channel" && SLACK_DM_CHANNEL_ID_RE.test(left.id) && right.kind === "user" || right.kind === "channel" && SLACK_DM_CHANNEL_ID_RE.test(right.id) && left.kind === "user";
|
|
@@ -293,7 +347,7 @@ function normalizeSlackForwardTarget(target) {
|
|
|
293
347
|
}
|
|
294
348
|
const { canApprovalPotentiallyRouteToChannel: canApprovalPotentiallyRouteToSlack, isSessionApprovalEligible: isForwardedSlackSessionApprovalEligible, isExplicitTargetEligible: isForwardedSlackExplicitTargetEligible } = createNativeApprovalChannelRouteGates({
|
|
295
349
|
channel: "slack",
|
|
296
|
-
defaultForwardingMode:
|
|
350
|
+
defaultForwardingMode: "session",
|
|
297
351
|
isTransportEnabled: isSlackApprovalTransportEnabled,
|
|
298
352
|
listAccountIds: listSlackAccountIds,
|
|
299
353
|
resolveDefaultAccountId: resolveDefaultSlackAccountId,
|
|
@@ -301,128 +355,91 @@ const { canApprovalPotentiallyRouteToChannel: canApprovalPotentiallyRouteToSlack
|
|
|
301
355
|
resolveTurnSourceTarget: resolveTurnSourceSlackOriginTarget,
|
|
302
356
|
targetsMatch: slackTargetsMatch
|
|
303
357
|
});
|
|
304
|
-
function hasSlackPluginApprovers(params) {
|
|
305
|
-
return getSlackApprovalApproversForTeam(params).length > 0;
|
|
306
|
-
}
|
|
307
358
|
function isSlackPluginNativeApprovalClientConfigEnabled(params) {
|
|
308
|
-
const slackNativeConfig =
|
|
309
|
-
|
|
359
|
+
const slackNativeConfig = resolveSlackAccount(params).config.execApprovals;
|
|
360
|
+
const policy = params.cfg.approvals?.plugin?.slack;
|
|
361
|
+
return (policy?.approvers?.length ?? 0) > 0 || Object.values(policy?.plugins ?? {}).some((plugin) => (plugin.approvers?.length ?? 0) > 0 || Object.values(plugin.tools ?? {}).some((tool) => tool.approvers.length > 0)) || isChannelExecApprovalClientEnabledFromConfig({
|
|
310
362
|
enabled: slackNativeConfig?.enabled,
|
|
311
363
|
approverCount: getSlackApprovalApprovers(params).length
|
|
312
364
|
});
|
|
313
365
|
}
|
|
314
|
-
function
|
|
315
|
-
return canApprovalPotentiallyRouteToSlack({
|
|
316
|
-
...params,
|
|
317
|
-
approvalKind: "plugin"
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
function isSlackPluginNativeApprovalClientEnabled(params) {
|
|
321
|
-
return isSlackPluginNativeApprovalClientConfigEnabled(params) || isSlackPluginForwardingRoutePotentiallyEnabled(params);
|
|
322
|
-
}
|
|
323
|
-
function shouldHandleSlackPluginViaNativeClientConfig(params) {
|
|
366
|
+
function shouldHandleSlackViaNativeClientConfig(params) {
|
|
324
367
|
if (!doesApprovalRequestSelectChannelAccount({
|
|
325
368
|
...params,
|
|
326
369
|
channel: "slack",
|
|
327
370
|
defaultAccountId: resolveDefaultSlackAccountId(params.cfg),
|
|
328
|
-
eligibleAccountIds: listSlackNativeApprovalEligibleAccountIds(
|
|
329
|
-
...params,
|
|
330
|
-
approvalKind: "plugin"
|
|
331
|
-
})
|
|
371
|
+
eligibleAccountIds: listSlackNativeApprovalEligibleAccountIds(params)
|
|
332
372
|
})) return false;
|
|
333
|
-
return isSlackNativeApprovalAccountEligible(
|
|
334
|
-
...params,
|
|
335
|
-
approvalKind: "plugin"
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
function matchesSlackNativeApprovalFilters(params) {
|
|
339
|
-
return matchesApprovalRequestFilters({
|
|
340
|
-
request: params.request.request,
|
|
341
|
-
agentFilter: params.agentFilter,
|
|
342
|
-
sessionFilter: params.sessionFilter
|
|
343
|
-
});
|
|
373
|
+
return isSlackNativeApprovalAccountEligible(params);
|
|
344
374
|
}
|
|
345
375
|
function isSlackNativeApprovalAccountEligible(params) {
|
|
346
|
-
const config =
|
|
376
|
+
const config = resolveSlackAccount(params).config.execApprovals;
|
|
377
|
+
const pluginRequest = params.approvalKind === "plugin" && isSlackPluginApprovalRequest(params.request) ? params.request : void 0;
|
|
378
|
+
if (params.approvalKind === "plugin" && !pluginRequest) return false;
|
|
347
379
|
const approverCount = params.approvalKind === "exec" ? getSlackExecApprovalApprovers(params).length : getSlackApprovalApproversForTeam({
|
|
348
|
-
|
|
349
|
-
|
|
380
|
+
cfg: params.cfg,
|
|
381
|
+
accountId: params.accountId,
|
|
382
|
+
teamId: resolveSlackApprovalTeamId(params),
|
|
383
|
+
...pluginRequest ? { request: pluginRequest } : {}
|
|
350
384
|
}).length;
|
|
351
|
-
|
|
385
|
+
const selectedPolicy = pluginRequest ? resolvePluginApprovalSlackApprovers(params.cfg, pluginRequest) : void 0;
|
|
386
|
+
return isSlackApprovalTransportEnabled(params) && (selectedPolicy !== void 0 ? approverCount > 0 : isChannelExecApprovalClientEnabledFromConfig({
|
|
352
387
|
enabled: config?.enabled,
|
|
353
388
|
approverCount
|
|
354
|
-
}) &&
|
|
355
|
-
request: params.request,
|
|
389
|
+
}) && matchesApprovalRequestFilters({
|
|
390
|
+
request: params.request.request,
|
|
356
391
|
agentFilter: config?.agentFilter,
|
|
357
392
|
sessionFilter: config?.sessionFilter
|
|
358
|
-
});
|
|
393
|
+
}));
|
|
359
394
|
}
|
|
360
395
|
function listSlackNativeApprovalEligibleAccountIds(params) {
|
|
396
|
+
if (params.approvalKind === "plugin") return listSlackAccountIds(params.cfg).filter((accountId) => isSlackNativeApprovalAccountEligible({
|
|
397
|
+
...params,
|
|
398
|
+
accountId
|
|
399
|
+
}));
|
|
361
400
|
const accountId = params.accountId ?? resolveDefaultSlackAccountId(params.cfg);
|
|
362
401
|
return isSlackNativeApprovalAccountEligible({
|
|
363
402
|
...params,
|
|
364
403
|
accountId
|
|
365
404
|
}) ? [accountId] : [];
|
|
366
405
|
}
|
|
367
|
-
function isAnyForwardedSlackExplicitTargetEligible(params) {
|
|
368
|
-
return (resolvePluginApprovalForwardingConfig(params.cfg)?.targets ?? []).some((target) => isForwardedSlackExplicitTargetEligible({
|
|
369
|
-
...params,
|
|
370
|
-
approvalKind: "plugin",
|
|
371
|
-
target
|
|
372
|
-
}));
|
|
373
|
-
}
|
|
374
|
-
function shouldHandleSlackPluginViaForwarding(params) {
|
|
375
|
-
return isForwardedSlackSessionApprovalEligible({
|
|
376
|
-
...params,
|
|
377
|
-
approvalKind: "plugin"
|
|
378
|
-
}) || isAnyForwardedSlackExplicitTargetEligible(params);
|
|
379
|
-
}
|
|
380
406
|
function shouldHandleSlackPluginViaForwardingSession(params) {
|
|
381
407
|
return isForwardedSlackSessionApprovalEligible({
|
|
382
408
|
...params,
|
|
383
409
|
approvalKind: "plugin"
|
|
384
410
|
});
|
|
385
411
|
}
|
|
386
|
-
function isSlackNativeApprovalClientEnabled(params) {
|
|
387
|
-
if (params.approvalKind === "exec") return isSlackExecApprovalClientEnabled(params);
|
|
388
|
-
return isSlackPluginNativeApprovalClientEnabled(params);
|
|
389
|
-
}
|
|
390
412
|
function isSlackAnyNativeApprovalClientEnabled(params) {
|
|
391
|
-
return
|
|
392
|
-
...params,
|
|
393
|
-
approvalKind: "exec"
|
|
394
|
-
}) || isSlackNativeApprovalClientEnabled({
|
|
413
|
+
return isSlackExecApprovalClientEnabled(params) || isSlackPluginNativeApprovalClientConfigEnabled(params) || canApprovalPotentiallyRouteToSlack({
|
|
395
414
|
...params,
|
|
396
415
|
approvalKind: "plugin"
|
|
397
416
|
});
|
|
398
417
|
}
|
|
399
418
|
function shouldHandleSlackNativeApprovalRequest(params) {
|
|
400
|
-
if (getSlackInstallationKind(resolveSlackAccount(params).accountId) === "enterprise" && !
|
|
401
|
-
|
|
419
|
+
if (getSlackInstallationKind(resolveSlackAccount(params).accountId) === "enterprise" && !resolveSlackApprovalOriginTeamId(params.request)) return false;
|
|
420
|
+
const approvalKind = resolveApprovalKind(params.request, params.approvalKind);
|
|
421
|
+
if (approvalKind === "plugin") {
|
|
422
|
+
if (!isSlackPluginApprovalRequest(params.request)) return false;
|
|
423
|
+
if (resolvePluginApprovalSlackApprovers(params.cfg, params.request) !== void 0) return shouldHandleSlackViaNativeClientConfig({
|
|
424
|
+
...params,
|
|
425
|
+
approvalKind
|
|
426
|
+
});
|
|
427
|
+
return shouldHandleSlackViaNativeClientConfig({
|
|
428
|
+
...params,
|
|
429
|
+
approvalKind
|
|
430
|
+
}) || shouldHandleSlackPluginViaForwardingSession(params) || (params.cfg.approvals?.plugin?.targets ?? []).some((target) => isForwardedSlackExplicitTargetEligible({
|
|
431
|
+
...params,
|
|
432
|
+
approvalKind,
|
|
433
|
+
target
|
|
434
|
+
}));
|
|
435
|
+
}
|
|
402
436
|
const turnSourceChannel = normalizeMessageChannel(params.request.request.turnSourceChannel);
|
|
403
437
|
if (turnSourceChannel && turnSourceChannel !== "slack") return false;
|
|
404
|
-
|
|
405
|
-
...params,
|
|
406
|
-
channel: "slack",
|
|
407
|
-
defaultAccountId: resolveDefaultSlackAccountId(params.cfg),
|
|
408
|
-
eligibleAccountIds: listSlackNativeApprovalEligibleAccountIds({
|
|
409
|
-
...params,
|
|
410
|
-
approvalKind: "exec"
|
|
411
|
-
})
|
|
412
|
-
})) return false;
|
|
413
|
-
return isSlackNativeApprovalAccountEligible({
|
|
438
|
+
return shouldHandleSlackViaNativeClientConfig({
|
|
414
439
|
...params,
|
|
415
440
|
approvalKind: "exec"
|
|
416
441
|
});
|
|
417
442
|
}
|
|
418
|
-
function resolveEnterpriseApprovalTeamId(request) {
|
|
419
|
-
try {
|
|
420
|
-
const target = resolveTurnSourceSlackOriginTarget(request);
|
|
421
|
-
return target ? parseSlackTarget(target.to)?.teamId : void 0;
|
|
422
|
-
} catch {
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
443
|
//#endregion
|
|
427
444
|
//#region extensions/slack/src/blocks-input.ts
|
|
428
445
|
const SLACK_MAX_BLOCKS = 50;
|
|
@@ -433,7 +450,7 @@ function parseBlocksJson(raw) {
|
|
|
433
450
|
throw new Error("blocks must be valid JSON");
|
|
434
451
|
}
|
|
435
452
|
}
|
|
436
|
-
function
|
|
453
|
+
function validateSlackBlocksArray(raw) {
|
|
437
454
|
if (!Array.isArray(raw)) throw new Error("blocks must be an array");
|
|
438
455
|
if (raw.length === 0) throw new Error("blocks must contain at least one block");
|
|
439
456
|
if (raw.length > 50) throw new Error(`blocks cannot exceed 50 items`);
|
|
@@ -442,15 +459,77 @@ function assertBlocksArray(raw) {
|
|
|
442
459
|
const type = block.type;
|
|
443
460
|
if (typeof type !== "string" || type.trim().length === 0) throw new Error("each block must include a non-empty string type");
|
|
444
461
|
}
|
|
445
|
-
}
|
|
446
|
-
function validateSlackBlocksArray(raw) {
|
|
447
|
-
assertBlocksArray(raw);
|
|
448
462
|
return raw;
|
|
449
463
|
}
|
|
450
464
|
function parseSlackBlocksInput(raw) {
|
|
451
465
|
if (raw == null) return;
|
|
452
466
|
return validateSlackBlocksArray(typeof raw === "string" ? parseBlocksJson(raw) : raw);
|
|
453
467
|
}
|
|
468
|
+
const SLACK_BUTTON_VALUE_MAX = 2e3;
|
|
469
|
+
const SLACK_SECTION_TEXT_MAX = 3e3;
|
|
470
|
+
const SLACK_PRESENTATION_CAPABILITIES = {
|
|
471
|
+
supported: true,
|
|
472
|
+
buttons: true,
|
|
473
|
+
selects: true,
|
|
474
|
+
context: true,
|
|
475
|
+
divider: true,
|
|
476
|
+
charts: true,
|
|
477
|
+
tables: true,
|
|
478
|
+
limits: {
|
|
479
|
+
actions: {
|
|
480
|
+
maxActionsPerRow: 25,
|
|
481
|
+
maxValueBytes: SLACK_BUTTON_VALUE_MAX,
|
|
482
|
+
supportsStyles: true
|
|
483
|
+
},
|
|
484
|
+
selects: {
|
|
485
|
+
maxOptions: 100,
|
|
486
|
+
maxValueBytes: 150
|
|
487
|
+
},
|
|
488
|
+
text: {
|
|
489
|
+
encoding: "characters",
|
|
490
|
+
markdownDialect: "slack-mrkdwn",
|
|
491
|
+
supportsEdit: true
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
//#endregion
|
|
496
|
+
//#region extensions/slack/src/approval-actions.ts
|
|
497
|
+
const SLACK_APPROVAL_VALUE_PREFIX = "openclaw:approval:v1:";
|
|
498
|
+
const SLACK_APPROVAL_HEADER_BLOCK_ID = "openclaw_approval_header";
|
|
499
|
+
function isApprovalDecision(value) {
|
|
500
|
+
return value === "allow-once" || value === "allow-always" || value === "deny";
|
|
501
|
+
}
|
|
502
|
+
/** Encode portable approval facts without exposing a slash command to Slack callbacks. */
|
|
503
|
+
function encodeSlackApprovalAction(action) {
|
|
504
|
+
const encode = (approvalId) => `${SLACK_APPROVAL_VALUE_PREFIX}${JSON.stringify({
|
|
505
|
+
approvalId,
|
|
506
|
+
approvalKind: action.approvalKind,
|
|
507
|
+
decision: action.decision
|
|
508
|
+
})}`;
|
|
509
|
+
const exact = encode(action.approvalId);
|
|
510
|
+
return exact.length <= 2e3 ? exact : encode(buildApprovalResolutionRef({
|
|
511
|
+
approvalId: action.approvalId,
|
|
512
|
+
approvalKind: action.approvalKind
|
|
513
|
+
}));
|
|
514
|
+
}
|
|
515
|
+
/** Decode only the exact Slack-owned approval envelope. Malformed callbacks fail closed. */
|
|
516
|
+
function decodeSlackApprovalAction(value) {
|
|
517
|
+
if (typeof value !== "string" || !value.startsWith(SLACK_APPROVAL_VALUE_PREFIX)) return null;
|
|
518
|
+
try {
|
|
519
|
+
const decoded = JSON.parse(value.slice(21));
|
|
520
|
+
if (!decoded || typeof decoded !== "object" || Array.isArray(decoded)) return null;
|
|
521
|
+
const record = decoded;
|
|
522
|
+
if (Object.keys(record).length !== 3 || typeof record.approvalId !== "string" || record.approvalId.length === 0 || record.approvalKind !== "exec" && record.approvalKind !== "plugin" && record.approvalKind !== "system-agent" || !isApprovalDecision(record.decision)) return null;
|
|
523
|
+
return {
|
|
524
|
+
type: "approval",
|
|
525
|
+
approvalId: record.approvalId,
|
|
526
|
+
approvalKind: record.approvalKind,
|
|
527
|
+
decision: record.decision
|
|
528
|
+
};
|
|
529
|
+
} catch {
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
454
533
|
//#endregion
|
|
455
534
|
//#region extensions/slack/src/monitor/mrkdwn.ts
|
|
456
535
|
function escapeSlackMrkdwn(value) {
|
|
@@ -717,61 +796,37 @@ function buildSlackDataTableBlock(block, options = {}) {
|
|
|
717
796
|
...block.rowHeaderColumnIndex !== void 0 ? { row_header_column_index: block.rowHeaderColumnIndex } : {}
|
|
718
797
|
};
|
|
719
798
|
}
|
|
720
|
-
|
|
721
|
-
function renderSlackDataTableFallbackText(value) {
|
|
799
|
+
function renderSlackDataTable(value, render, mrkdwnSafe = false) {
|
|
722
800
|
const block = asOptionalRecord(value);
|
|
723
801
|
if (block?.type !== "data_table") return;
|
|
724
802
|
const parsed = parseSlackDataTable(block);
|
|
725
|
-
if (parsed) return
|
|
803
|
+
if (parsed) return render({
|
|
726
804
|
type: "table",
|
|
727
805
|
caption: parsed.caption,
|
|
728
806
|
headers: parsed.headers,
|
|
729
807
|
rows: parsed.rows
|
|
730
808
|
});
|
|
731
|
-
|
|
809
|
+
const caption = readNonBlankString(block.caption)?.trim();
|
|
810
|
+
return caption && mrkdwnSafe ? escapeSlackMrkdwn(caption) : caption;
|
|
811
|
+
}
|
|
812
|
+
/** Extract a deterministic accessible summary from a native Slack table block. */
|
|
813
|
+
function renderSlackDataTableFallbackText(value, mrkdwnSafe = false) {
|
|
814
|
+
return renderSlackDataTable(value, mrkdwnSafe ? renderSlackMessagePresentationTableFallbackText : renderMessagePresentationTableFallbackText, mrkdwnSafe);
|
|
732
815
|
}
|
|
733
816
|
function escapeCompactFallbackCell(value) {
|
|
734
817
|
return value.replaceAll("\\", "\\\\").replaceAll(" ", "\\t").replaceAll("\r", "\\r").replaceAll("\n", "\\n");
|
|
735
818
|
}
|
|
736
|
-
function escapeSlackBasicTableCell(value, mrkdwnSafe) {
|
|
737
|
-
return escapeCompactFallbackCell(mrkdwnSafe ? escapeSlackMrkdwn(value) : value);
|
|
738
|
-
}
|
|
739
|
-
function renderSlackBasicTableRows(value, mrkdwnSafe) {
|
|
740
|
-
return parseSlackBasicTableRows(value)?.map((row) => row.map((cell) => escapeSlackBasicTableCell(cell, mrkdwnSafe)).join(" ")).join("\n");
|
|
741
|
-
}
|
|
742
819
|
/** Render Slack's inbound `table` block as ordered, delimiter-safe TSV. */
|
|
743
|
-
function renderSlackTableFallbackText(value) {
|
|
744
|
-
return
|
|
745
|
-
}
|
|
746
|
-
/** Render Slack's inbound `table` block without activating mrkdwn control tokens. */
|
|
747
|
-
function renderSlackTableMrkdwnFallbackText(value) {
|
|
748
|
-
return renderSlackBasicTableRows(value, true);
|
|
820
|
+
function renderSlackTableFallbackText(value, mrkdwnSafe = false) {
|
|
821
|
+
return parseSlackBasicTableRows(value)?.map((row) => row.map((cell) => escapeCompactFallbackCell(mrkdwnSafe ? escapeSlackMrkdwn(cell) : cell)).join(" ")).join("\n");
|
|
749
822
|
}
|
|
750
823
|
/** Render each native table cell once for bounded, formatting-disabled delivery. */
|
|
751
824
|
function renderSlackDataTableCompactPlainTextFallback(value) {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
`${escapeCompactFallbackCell(parsed.caption)} (table)`,
|
|
758
|
-
parsed.headers.map(escapeCompactFallbackCell).join(" "),
|
|
759
|
-
...parsed.rows.map((row) => row.map(escapeCompactFallbackCell).join(" "))
|
|
760
|
-
].join("\n");
|
|
761
|
-
}
|
|
762
|
-
/** Render a native table as mrkdwn without activating raw cell control tokens. */
|
|
763
|
-
function renderSlackDataTableMrkdwnFallbackText(value) {
|
|
764
|
-
const block = asOptionalRecord(value);
|
|
765
|
-
if (block?.type !== "data_table") return;
|
|
766
|
-
const parsed = parseSlackDataTable(block);
|
|
767
|
-
if (parsed) return renderSlackMessagePresentationTableFallbackText({
|
|
768
|
-
type: "table",
|
|
769
|
-
caption: parsed.caption,
|
|
770
|
-
headers: parsed.headers,
|
|
771
|
-
rows: parsed.rows
|
|
772
|
-
});
|
|
773
|
-
const caption = readNonBlankString(block.caption)?.trim();
|
|
774
|
-
return caption ? escapeSlackMrkdwn(caption) : void 0;
|
|
825
|
+
return renderSlackDataTable(value, (table) => [
|
|
826
|
+
`${escapeCompactFallbackCell(table.caption)} (table)`,
|
|
827
|
+
table.headers.map(escapeCompactFallbackCell).join(" "),
|
|
828
|
+
...table.rows.map((row) => row.map(escapeCompactFallbackCell).join(" "))
|
|
829
|
+
].join("\n"));
|
|
775
830
|
}
|
|
776
831
|
//#endregion
|
|
777
832
|
//#region extensions/slack/src/data-visualization.ts
|
|
@@ -883,41 +938,31 @@ function parseSlackDataVisualizationBlock(value) {
|
|
|
883
938
|
}] })?.blocks[0];
|
|
884
939
|
return normalizedBlock?.type === "chart" ? normalizedBlock : void 0;
|
|
885
940
|
}
|
|
886
|
-
/** Extract
|
|
887
|
-
function renderSlackDataVisualizationFallbackText(value) {
|
|
888
|
-
const block = asOptionalRecord(value);
|
|
889
|
-
if (block?.type !== "data_visualization") return;
|
|
890
|
-
const parsed = parseSlackDataVisualizationBlock(block);
|
|
891
|
-
if (parsed) return renderMessagePresentationChartFallbackText(parsed);
|
|
892
|
-
return typeof block.title === "string" && block.title.trim() ? block.title.trim() : void 0;
|
|
893
|
-
}
|
|
894
|
-
/** Render a native chart as mrkdwn without activating raw data control tokens. */
|
|
895
|
-
function renderSlackDataVisualizationMrkdwnFallbackText(value) {
|
|
941
|
+
/** Extract an accessible summary, escaping mrkdwn control tokens when requested. */
|
|
942
|
+
function renderSlackDataVisualizationFallbackText(value, mrkdwnSafe = false) {
|
|
896
943
|
const block = asOptionalRecord(value);
|
|
897
944
|
if (block?.type !== "data_visualization") return;
|
|
898
945
|
const parsed = parseSlackDataVisualizationBlock(block);
|
|
899
|
-
if (parsed) return renderSlackMessagePresentationChartFallbackText(parsed);
|
|
900
|
-
|
|
946
|
+
if (parsed) return mrkdwnSafe ? renderSlackMessagePresentationChartFallbackText(parsed) : renderMessagePresentationChartFallbackText(parsed);
|
|
947
|
+
const title = typeof block.title === "string" ? block.title.trim() : "";
|
|
948
|
+
return title ? mrkdwnSafe ? escapeSlackMrkdwn(title) : title : void 0;
|
|
901
949
|
}
|
|
902
950
|
//#endregion
|
|
903
951
|
//#region extensions/slack/src/format.ts
|
|
904
952
|
const SLACK_ANGLE_TOKEN_RE = /<[^>\n]+>/g;
|
|
905
953
|
function isAllowedSlackAngleToken(token) {
|
|
906
|
-
if (!token.startsWith("<") || !token.endsWith(">")) return false;
|
|
907
954
|
const inner = token.slice(1, -1);
|
|
908
955
|
return inner.startsWith("@") || inner.startsWith("#") || inner.startsWith("!") || inner.startsWith("mailto:") || inner.startsWith("tel:") || inner.startsWith("http://") || inner.startsWith("https://") || inner.startsWith("slack://");
|
|
909
956
|
}
|
|
910
957
|
function escapeSlackMrkdwnContent(text, mentions) {
|
|
911
958
|
if (mentions === "escape") return escapeSlackMrkdwn(text);
|
|
912
|
-
if (!text) return "";
|
|
913
959
|
if (!text.includes("&") && !text.includes("<") && !text.includes(">")) return text;
|
|
914
|
-
SLACK_ANGLE_TOKEN_RE.lastIndex = 0;
|
|
915
960
|
const out = [];
|
|
916
961
|
let lastIndex = 0;
|
|
917
|
-
for (
|
|
918
|
-
const matchIndex = match.index
|
|
962
|
+
for (const match of text.matchAll(SLACK_ANGLE_TOKEN_RE)) {
|
|
963
|
+
const matchIndex = match.index;
|
|
919
964
|
out.push(escapeSlackMrkdwn(text.slice(lastIndex, matchIndex)));
|
|
920
|
-
const token = match[0]
|
|
965
|
+
const token = match[0];
|
|
921
966
|
out.push(isAllowedSlackAngleToken(token) ? token : escapeSlackMrkdwn(token));
|
|
922
967
|
lastIndex = matchIndex + token.length;
|
|
923
968
|
}
|
|
@@ -925,7 +970,6 @@ function escapeSlackMrkdwnContent(text, mentions) {
|
|
|
925
970
|
return out.join("");
|
|
926
971
|
}
|
|
927
972
|
function escapeSlackMrkdwnText(text, mentions) {
|
|
928
|
-
if (!text) return "";
|
|
929
973
|
if (!text.includes("&") && !text.includes("<") && !text.includes(">")) return text;
|
|
930
974
|
return text.split("\n").map((line) => {
|
|
931
975
|
if (line.startsWith("> ")) return `> ${escapeSlackMrkdwnContent(line.slice(2), mentions)}`;
|
|
@@ -1235,6 +1279,39 @@ function markdownToSlackMrkdwnChunks(markdown, limit, options = {}) {
|
|
|
1235
1279
|
}).map(({ rendered }) => rendered.length > normalizedLimit ? protectSlackAssistantTranscriptRoleHeaders(rendered) : rendered);
|
|
1236
1280
|
}
|
|
1237
1281
|
//#endregion
|
|
1282
|
+
//#region extensions/slack/src/question-actions.ts
|
|
1283
|
+
const SLACK_QUESTION_VALUE_PREFIX = "slq1:";
|
|
1284
|
+
const QUESTION_RECORD_ID_PATTERN = /^ask_[a-f0-9]{32}$/u;
|
|
1285
|
+
function encodeSlackQuestionAction(action) {
|
|
1286
|
+
if (!QUESTION_RECORD_ID_PATTERN.test(action.questionId) || !Number.isInteger(action.optionIndex) || action.optionIndex < 0 || action.optionIndex > 3) return;
|
|
1287
|
+
const value = `${SLACK_QUESTION_VALUE_PREFIX}${action.questionId}:${action.optionIndex}`;
|
|
1288
|
+
return value.length <= 2e3 ? value : void 0;
|
|
1289
|
+
}
|
|
1290
|
+
function decodeSlackQuestionAction(value) {
|
|
1291
|
+
if (typeof value !== "string" || value.length > 2e3) return null;
|
|
1292
|
+
const match = /^slq1:(ask_[a-f0-9]{32}):([0-3])$/u.exec(value);
|
|
1293
|
+
return match?.[1] && match[2] ? {
|
|
1294
|
+
questionId: match[1],
|
|
1295
|
+
optionIndex: Number(match[2])
|
|
1296
|
+
} : null;
|
|
1297
|
+
}
|
|
1298
|
+
async function resolveSlackQuestionAction(params) {
|
|
1299
|
+
let result;
|
|
1300
|
+
try {
|
|
1301
|
+
result = await (params.resolveQuestion ?? questionGatewayRuntime.resolveOption)({
|
|
1302
|
+
cfg: params.cfg,
|
|
1303
|
+
questionId: params.action.questionId,
|
|
1304
|
+
optionIndex: params.action.optionIndex,
|
|
1305
|
+
senderId: params.userId,
|
|
1306
|
+
clientDisplayName: `Slack question (${params.accountId})`
|
|
1307
|
+
});
|
|
1308
|
+
} catch {
|
|
1309
|
+
await params.respond("Could not submit this answer.").catch(() => {});
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1312
|
+
await params.respond(result.status === "answered" ? "Answer submitted." : "This question was already answered.").catch(() => {});
|
|
1313
|
+
}
|
|
1314
|
+
//#endregion
|
|
1238
1315
|
//#region extensions/slack/src/reply-action-ids.ts
|
|
1239
1316
|
const SLACK_REPLY_BUTTON_ACTION_ID = "openclaw:reply_button";
|
|
1240
1317
|
const SLACK_REPLY_LINK_ACTION_ID = "openclaw:reply_link";
|
|
@@ -1349,15 +1426,8 @@ function readControlElementText(value, options = {}) {
|
|
|
1349
1426
|
}
|
|
1350
1427
|
}
|
|
1351
1428
|
function readControlElementsText(values, options = {}) {
|
|
1352
|
-
const
|
|
1353
|
-
|
|
1354
|
-
for (const value of values) {
|
|
1355
|
-
const candidate = readControlElementText(value, options);
|
|
1356
|
-
if (!candidate || seen.has(candidate)) continue;
|
|
1357
|
-
seen.add(candidate);
|
|
1358
|
-
labels.push(candidate);
|
|
1359
|
-
}
|
|
1360
|
-
return labels.length > 0 ? labels.join("\n") : void 0;
|
|
1429
|
+
const labels = values.map((value) => readControlElementText(value, options)).filter(Boolean);
|
|
1430
|
+
return [...new Set(labels)].join("\n") || void 0;
|
|
1361
1431
|
}
|
|
1362
1432
|
function readSectionText(block, options = {}) {
|
|
1363
1433
|
const parts = [readTextObject(block.text, options)];
|
|
@@ -1382,9 +1452,9 @@ function renderSlackBlockFallbackText(raw, options = {}) {
|
|
|
1382
1452
|
case "file": return "Shared a file";
|
|
1383
1453
|
case "context": return readContextText(block, options);
|
|
1384
1454
|
case "actions": return readActionsText(block, options);
|
|
1385
|
-
case "data_visualization": return options.nativeDataFormat
|
|
1386
|
-
case "data_table": return options.nativeDataFormat
|
|
1387
|
-
case "table": return options.nativeDataFormat
|
|
1455
|
+
case "data_visualization": return renderSlackDataVisualizationFallbackText(block, options.nativeDataFormat !== "plain");
|
|
1456
|
+
case "data_table": return renderSlackDataTableFallbackText(block, options.nativeDataFormat !== "plain");
|
|
1457
|
+
case "table": return renderSlackTableFallbackText(block, options.nativeDataFormat !== "plain");
|
|
1388
1458
|
default: return;
|
|
1389
1459
|
}
|
|
1390
1460
|
}
|
|
@@ -1446,12 +1516,6 @@ function isSlackNativeResponseUrlRejection(error) {
|
|
|
1446
1516
|
const record = asOptionalRecord(error);
|
|
1447
1517
|
return record?.code === "slack_bolt_respond_error" && record.statusCode === 400;
|
|
1448
1518
|
}
|
|
1449
|
-
/** Extract a complete accessible summary from a supported native data block. */
|
|
1450
|
-
function renderSlackNativeDataFallbackText(value) {
|
|
1451
|
-
const type = asOptionalRecord(value)?.type;
|
|
1452
|
-
if (type === "data_visualization") return renderSlackDataVisualizationMrkdwnFallbackText(value);
|
|
1453
|
-
if (type === "data_table") return renderSlackDataTableMrkdwnFallbackText(value);
|
|
1454
|
-
}
|
|
1455
1519
|
function comparableText(value) {
|
|
1456
1520
|
return value.replace(/\s+/gu, " ").trim();
|
|
1457
1521
|
}
|
|
@@ -1515,7 +1579,7 @@ function buildSlackNativeDataAccessibilityText(text, blocks) {
|
|
|
1515
1579
|
}
|
|
1516
1580
|
/** Preserve every native data block's content once when Slack requires a text-only retry. */
|
|
1517
1581
|
function appendSlackNativeDataFallbackText(text, blocks) {
|
|
1518
|
-
return appendSlackNativeDataFallback(text, blocks,
|
|
1582
|
+
return appendSlackNativeDataFallback(text, blocks, (block) => hasSlackNativeDataBlock([block]) ? renderSlackBlockFallbackText(block) : void 0);
|
|
1519
1583
|
}
|
|
1520
1584
|
/** Build a bounded plain-text retry without activating control tokens. */
|
|
1521
1585
|
function appendSlackNativeDataPlainTextFallback(text, blocks) {
|
|
@@ -1586,8 +1650,22 @@ function normalizeSlackRouteBindingConfig(cfg) {
|
|
|
1586
1650
|
return normalizedCfg;
|
|
1587
1651
|
}
|
|
1588
1652
|
function resolveSlackConversationBindingRoute(params) {
|
|
1653
|
+
const { resolveRoute } = params;
|
|
1654
|
+
let baseRuntimeRoute;
|
|
1655
|
+
const resolveBaseRoute = (threadInspection) => baseRuntimeRoute ??= resolveRuntimeConversationBindingRoute({
|
|
1656
|
+
resolveRoute: threadInspection ? (selection) => inspectRuntimeConversationBindingRoute({
|
|
1657
|
+
route: resolveRoute(selection),
|
|
1658
|
+
inspection: threadInspection
|
|
1659
|
+
}).route : resolveRoute,
|
|
1660
|
+
touchBinding: params.touchBinding,
|
|
1661
|
+
conversation: {
|
|
1662
|
+
channel: "slack",
|
|
1663
|
+
accountId: params.accountId,
|
|
1664
|
+
conversationId: params.baseConversationId
|
|
1665
|
+
}
|
|
1666
|
+
});
|
|
1589
1667
|
const boundThreadRoute = params.bindingsEnabled && params.runtimeBindingThreadId ? resolveRuntimeConversationBindingRoute({
|
|
1590
|
-
|
|
1668
|
+
resolveRoute: (selection) => selection.bindingRecord || !selection.bindingOwnerAvailable ? resolveRoute(selection) : resolveBaseRoute(selection.inspection).route,
|
|
1591
1669
|
touchBinding: params.touchBinding,
|
|
1592
1670
|
conversation: {
|
|
1593
1671
|
channel: "slack",
|
|
@@ -1598,18 +1676,17 @@ function resolveSlackConversationBindingRoute(params) {
|
|
|
1598
1676
|
}) : null;
|
|
1599
1677
|
const runtimeRoute = !params.bindingsEnabled ? {
|
|
1600
1678
|
bindingOwnerAvailable: true,
|
|
1601
|
-
route:
|
|
1679
|
+
route: resolveRoute({
|
|
1680
|
+
inspection: {
|
|
1681
|
+
status: "available",
|
|
1682
|
+
binding: null
|
|
1683
|
+
},
|
|
1684
|
+
bindingOwnerAvailable: true,
|
|
1685
|
+
bindingRecord: null
|
|
1686
|
+
}),
|
|
1602
1687
|
bindingRecord: null,
|
|
1603
1688
|
boundSessionKey: void 0
|
|
1604
|
-
} : boundThreadRoute
|
|
1605
|
-
route: boundThreadRoute?.route ?? params.route,
|
|
1606
|
-
touchBinding: params.touchBinding,
|
|
1607
|
-
conversation: {
|
|
1608
|
-
channel: "slack",
|
|
1609
|
-
accountId: params.accountId,
|
|
1610
|
-
conversationId: params.baseConversationId
|
|
1611
|
-
}
|
|
1612
|
-
});
|
|
1689
|
+
} : boundThreadRoute && (boundThreadRoute.bindingRecord || boundThreadRoute.bindingOwnerAvailable === false) ? boundThreadRoute : resolveBaseRoute();
|
|
1613
1690
|
const configuredRoute = params.bindingsEnabled && !runtimeRoute.boundSessionKey && !runtimeRoute.bindingRecord ? resolveConfiguredBindingRoute({
|
|
1614
1691
|
cfg: params.cfg,
|
|
1615
1692
|
route: runtimeRoute.route,
|
|
@@ -1734,4 +1811,4 @@ async function renameSlackSession(params) {
|
|
|
1734
1811
|
}
|
|
1735
1812
|
}
|
|
1736
1813
|
//#endregion
|
|
1737
|
-
export {
|
|
1814
|
+
export { buildSlackDataVisualizationBlock as $, countSlackTextUtf8Bytes as A, getSlackApprovalApproversForTeam as At, SLACK_REPLY_LINK_ACTION_ID as B, resolveSlackExecApprovalTarget as Bt, buildSlackBlocksFallbackText as C, resolveSessionSlackOriginTarget as Ct, SLACK_MESSAGE_TEXT_HARD_LIMIT as D, shouldHandleSlackNativeApprovalRequest as Dt, SLACK_EDIT_TEXT_MAX_BYTES as E, resolveTurnSourceSlackOriginTarget as Et, SLACK_CALLBACK_BUTTON_ACTION_ID as F, registerSlackInstallationState as Ft, isSlackQuestionActionId as G, SLACK_SESSION_LINK_ACTION_ID as H, resolvePluginApprovalSlackApprovers as Ht, SLACK_CALLBACK_SELECT_ACTION_ID as I, getSlackExecApprovalApprovers as It, encodeSlackQuestionAction as J, resolveSlackQuestionActionIds as K, SLACK_QUESTION_BUTTON_ACTION_ID as L, isSlackExecApprovalAuthorizedSender as Lt, truncateSlackTextByUtf8Bytes as M, resolveSlackApprovalTeamId as Mt, SLACK_APPROVAL_BUTTON_ACTION_ID as N, getSlackInstallationKind as Nt, SLACK_MESSAGE_TEXT_RECOMMENDED_LIMIT as O, shouldHandleSlackPluginViaForwardingSession as Ot, SLACK_APPROVAL_SELECT_ACTION_ID as P, isSlackWorkspaceInstallation as Pt, normalizeSlackOutboundText as Q, SLACK_QUESTION_FINALIZATION_BLOCKS as R, isSlackExecApprovalClientEnabled as Rt, stripSlackNativeDataBlocks as S, normalizeSlackOriginTarget as St, renderSlackBlockFallbackText as T, resolveSlackFallbackOriginTarget as Tt, isSlackApprovalActionId as U, SLACK_PRIVATE_ACTION_DELIVERY_RESULT as Ut, SLACK_REPLY_SELECT_ACTION_ID as V, shouldSuppressLocalSlackExecApprovalPrompt as Vt, isSlackCallbackActionId as W, resolveSlackAutoThreadId as Wt, chunkSlackMrkdwnText as X, resolveSlackQuestionAction as Y, markdownToSlackMrkdwnChunks as Z, createSlackNativeDataBaseTextConsumer as _, parseSlackBlocksInput as _t, resolveSlackGroupRequireMention as a, countSlackDataTableCellCharacters as at, isSlackInvalidBlocksResponse as b, isSlackPluginApprovalRequest as bt, qualifySlackRoutePeerId as c, renderSlackMessagePresentationFallbackText as ct, resolveSlackConversationBindingRoute as d, decodeSlackApprovalAction as dt, canRenderSlackDataVisualization as et, assertSlackDetachedTargetAllowed as f, encodeSlackApprovalAction as ft, buildSlackNativeDataAccessibilityText as g, SLACK_MAX_BLOCKS as gt, appendSlackNativeDataPlainTextFallback as h, SLACK_SECTION_TEXT_MAX as ht, buildSlackChannelPolicyScope as i, countSlackDataTableBlocksCellCharacters as it, truncateSlackText as j, isSlackPluginApprovalAuthorizedSender as jt, SLACK_TEXT_LIMIT as k, slackTargetsMatch as kt, resolveSlackEnterpriseMainDmSessionKey as l, escapeSlackMrkdwn as lt, appendSlackNativeDataFallbackText as m, SLACK_PRESENTATION_CAPABILITIES as mt, setSlackSessionStatus as n, SLACK_DATA_TABLE_AGGREGATE_CELL_CHARACTERS_MAX as nt, resolveSlackGroupToolPolicy as o, resolveSlackDataTableCellCharacterCount as ot, SLACK_MALFORMED_NATIVE_DATA_FALLBACK as p, SLACK_BUTTON_VALUE_MAX as pt, decodeSlackQuestionAction as q, buildSlackChannelIdCandidates as r, buildSlackDataTableBlock as rt, qualifySlackConversationId as s, renderSlackMessagePresentationChartFallbackText as st, renameSlackSession as t, hasSlackDataVisualizationBlock as tt, normalizeSlackRouteBindingConfig as u, SLACK_APPROVAL_HEADER_BLOCK_ID as ut, hasSlackNativeDataBlock as v, validateSlackBlocksArray as vt, buildSlackCompleteBlocksFallbackText as w, resolveSlackApproverDmTargets as wt, isSlackNativeResponseUrlRejection as x, normalizeSlackForwardTarget as xt, isSlackInvalidBlocksError as y, isSlackAnyNativeApprovalClientEnabled as yt, SLACK_REPLY_BUTTON_ACTION_ID as z, normalizeSlackApproverId as zt };
|