@openclaw/slack 2026.10.10-beta.5 → 2026.11.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{account-configured-zcR9TJJN.mjs → account-configured-35y0-Hso.mjs} +1 -2
- package/dist/.setup/{account-inspect-CmkKiSb9.mjs → account-inspect-DgQgj0wk.mjs} +13 -11
- package/dist/.setup/{accounts-msihSF3-.mjs → accounts-EaPP0fFY.mjs} +16 -11
- package/dist/.setup/{action-runtime-ChRfnnBu.mjs → action-runtime-CK9QZgQl.mjs} +39 -47
- package/dist/.setup/action-runtime.runtime-CpZktret.mjs +1 -0
- package/dist/.setup/{actions-By7tvpvv.mjs → actions-s3CcFO45.mjs} +98 -93
- package/dist/.setup/{approval-handler.runtime-D8ArtDQt.mjs → approval-handler.runtime-Ch7BecYK.mjs} +27 -32
- package/dist/.setup/{approval-message-updates-DT7XBPbV.mjs → approval-message-updates-CqcRoa28.mjs} +2 -3
- package/dist/.setup/{channel-6YzXl_63.mjs → channel-CAvo_WNZ.mjs} +573 -352
- package/dist/.setup/{channel-meta-C443t-lI.mjs → channel-meta-C5vsCo3a.mjs} +1 -2
- package/dist/.setup/{channel-type-BEFP2ORi.mjs → channel-type-9Lw6yLf2.mjs} +6 -11
- package/dist/.setup/{channel.setup-u6QQdbTa.mjs → channel.setup-BlgXNuCJ.mjs} +19 -23
- package/dist/.setup/{config-schema-DNnh6bWU.mjs → config-schema-Bx1tCZB0.mjs} +5 -11
- package/dist/.setup/cursor-pages-jVn3Vkfi.mjs +309 -0
- package/dist/.setup/{directory-config-Cjj0N8R0.mjs → directory-config-CGvKYg9F.mjs} +5 -6
- package/dist/.setup/{directory-live-BIKD-5B_.mjs → directory-live-DNdw97LA.mjs} +6 -7
- package/dist/.setup/{doctor-contract-Cd4-VzIM.mjs → doctor-contract-BB2KJ9Ni.mjs} +44 -58
- package/dist/.setup/{message-tool-api-BS5ekEA_.mjs → message-tool-api-B38BpEaE.mjs} +7 -8
- package/dist/.setup/{monitor-BFilOuM_.mjs → monitor-BD86SotB.mjs} +3416 -3750
- package/dist/.setup/{outbound-adapter-9dbnYtL1.mjs → outbound-adapter-BH6iPWBj.mjs} +32 -39
- package/dist/.setup/paths-CQZI_5WY.mjs +7 -0
- package/dist/.setup/{pipeline.runtime-BG5swHnj.mjs → pipeline.runtime-C4ELxaRU.mjs} +444 -590
- package/dist/.setup/{policy-yhn48xf5.mjs → policy-C6_DdlSf.mjs} +3 -6
- package/dist/.setup/{session-status-Dv8wNBEt.mjs → probe-B_Ax1vS1.mjs} +1015 -678
- package/dist/.setup/question-delivery-D3qAIwuv.mjs +38 -0
- package/dist/.setup/{relay-source-oY9SbDiX.mjs → relay-source-a8jodKuO.mjs} +12 -6
- package/dist/.setup/{replies-CJwjTqDr.mjs → replies-Bq7n0gfM.mjs} +37 -24
- package/dist/.setup/{reply-blocks-Ca-raz2z.mjs → reply-blocks-DyYYRrP_.mjs} +202 -210
- package/dist/.setup/{resolve-channels-DRRhElwz.mjs → resolve-channels-CF2JME9q.mjs} +6 -10
- package/dist/.setup/{resolve-users-Cz8e17ky.mjs → resolve-users-DDcCAjH1.mjs} +10 -19
- package/dist/.setup/{rolldown-runtime-B4FMCO8f.mjs → rolldown-runtime-nwUcYXjP.mjs} +1 -2
- package/dist/.setup/{runtime-JSVZSWAj.mjs → runtime-C6HKn7Av.mjs} +1 -2
- package/dist/.setup/runtime-setter-api-DrXr965r.mjs +2 -0
- package/dist/.setup/{scopes-DfQVi8Jw.mjs → scopes-CzHC_dwV.mjs} +3 -3
- package/dist/.setup/{secret-contract-B-Qm6aQQ.mjs → secret-contract-CqVqR7MP.mjs} +5 -4
- package/dist/.setup/{secret-contract-api-DB6CMdgc.mjs → secret-contract-api-DaCXZ47j.mjs} +1 -1
- package/dist/.setup/{security-audit-DFGiFLqd.mjs → security-audit-C3hXCfDt.mjs} +2 -3
- package/dist/.setup/{send-C-8wY0lK.mjs → send-WJZ73VSf.mjs} +306 -349
- package/dist/.setup/{send-results-eeOu_HYm.mjs → send-results-Bm6V1ekL.mjs} +4 -6
- package/dist/.setup/setup-plugin-api-DJXIB8CF.mjs +2 -0
- package/dist/.setup/{setup-surface-9WVQgYCT.mjs → setup-surface-uIqP2B0Y.mjs} +6 -8
- package/dist/.setup/{slash-dispatch.runtime-v5kQqJPh.mjs → slash-dispatch.runtime-Cwuwv7FL.mjs} +2 -2
- package/dist/.setup/{target-parsing-FFE26kOV.mjs → target-parsing-DwYAP3ts.mjs} +2 -4
- package/dist/.setup/{targets-C6LZQL1Q.mjs → targets-eeOxA_b_.mjs} +2 -3
- package/dist/.setup/{thread-ts-Cvt7WD6B.mjs → thread-ts-47Au2-Yn.mjs} +1 -2
- package/dist/.source-module-urls/c5ffd0957b234c7c12090e7de4eca2482ef339b8561e078da55b734211b0ba58.json +1 -0
- package/dist/account-inspect-api.js +2 -3
- package/dist/api.js +17 -18
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-entry.js +1 -2
- package/dist/channel-plugin-api.js +1 -1
- package/dist/configured-state.js +2 -3
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/index.js +1 -8
- package/dist/message-tool-api.js +1 -1
- package/dist/runtime-api.js +11 -13
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/setup-entry.js +4 -5
- 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/package.json +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/util.d.ts +6 -3
- package/node_modules/@slack/bolt/node_modules/content-disposition/README.md +105 -35
- package/node_modules/@slack/bolt/node_modules/content-disposition/dist/index.d.ts +72 -0
- package/node_modules/@slack/bolt/node_modules/content-disposition/dist/index.js +388 -0
- package/node_modules/@slack/bolt/node_modules/content-disposition/dist/index.js.map +1 -0
- package/node_modules/@slack/bolt/node_modules/content-disposition/package.json +31 -19
- package/node_modules/@slack/bolt/node_modules/content-type/README.md +34 -57
- package/node_modules/@slack/bolt/node_modules/content-type/package.json +35 -25
- package/node_modules/@slack/bolt/node_modules/express/Readme.md +15 -9
- package/node_modules/@slack/bolt/node_modules/express/lib/application.js +2 -2
- package/node_modules/@slack/bolt/node_modules/express/lib/request.js +32 -19
- package/node_modules/@slack/bolt/node_modules/express/lib/response.js +27 -30
- package/node_modules/@slack/bolt/node_modules/express/package.json +10 -10
- package/node_modules/@slack/bolt/node_modules/qs/.github/THREAT_MODEL.md +4 -2
- package/node_modules/@slack/bolt/node_modules/qs/CHANGELOG.md +38 -14
- package/node_modules/@slack/bolt/node_modules/qs/README.md +31 -3
- package/node_modules/@slack/bolt/node_modules/qs/dist/qs.js +20 -20
- package/node_modules/@slack/bolt/node_modules/qs/lib/parse.js +94 -4
- package/node_modules/@slack/bolt/node_modules/qs/lib/stringify.js +4 -4
- package/node_modules/@slack/bolt/node_modules/qs/lib/utils.js +130 -6
- package/node_modules/@slack/bolt/node_modules/qs/package.json +4 -4
- package/node_modules/@slack/bolt/node_modules/qs/test/parse.js +174 -0
- package/node_modules/@slack/bolt/node_modules/qs/test/stringify.js +263 -33
- package/node_modules/@slack/bolt/node_modules/qs/test/utils.js +184 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/util.d.ts +6 -3
- package/node_modules/typebox/build/format/duration.d.mts +2 -2
- package/node_modules/typebox/build/format/duration.mjs +2 -2
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_email.mjs +1 -0
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
- package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
- package/node_modules/typebox/build/format/ipv4.mjs +2 -2
- package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
- package/node_modules/typebox/build/format/ipv6.mjs +1 -1
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/schema/build.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
- package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
- package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
- package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
- package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
- package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
- package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
- package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
- package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
- package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
- package/node_modules/typebox/build/system/memory/create.mjs +18 -13
- package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
- package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
- package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
- package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
- package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
- package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
- package/node_modules/typebox/build/system/memory/update.mjs +43 -16
- package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
- package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
- package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
- package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
- package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
- package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
- package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +1 -1
- package/node_modules/undici/README.md +25 -3
- package/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
- package/node_modules/undici/docs/docs/api/Client.md +11 -6
- package/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
- package/node_modules/undici/docs/docs/api/Errors.md +76 -1
- package/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
- package/node_modules/undici/docs/docs/api/Interceptors.md +28 -8
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
- package/node_modules/undici/docs/docs/index.md +12 -12
- package/node_modules/undici/docs/docs/type-map.json +66 -66
- package/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
- package/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/undici/lib/core/constants.js +12 -1
- package/node_modules/undici/lib/core/errors.js +38 -1
- package/node_modules/undici/lib/core/request.js +16 -1
- package/node_modules/undici/lib/core/symbols.js +2 -0
- package/node_modules/undici/lib/core/util.js +26 -1
- package/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
- package/node_modules/undici/lib/dispatcher/client-h2.js +124 -17
- package/node_modules/undici/lib/dispatcher/client.js +4 -1
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
- package/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
- package/node_modules/undici/lib/dispatcher/pool-base.js +85 -31
- package/node_modules/undici/lib/dispatcher/pool.js +11 -8
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
- package/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
- package/node_modules/undici/lib/handler/cache-handler.js +153 -15
- package/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
- package/node_modules/undici/lib/handler/redirect-handler.js +28 -8
- package/node_modules/undici/lib/handler/retry-handler.js +44 -11
- package/node_modules/undici/lib/interceptor/cache.js +11 -3
- package/node_modules/undici/lib/interceptor/decompress.js +22 -9
- package/node_modules/undici/lib/interceptor/dns.js +11 -0
- package/node_modules/undici/lib/interceptor/response-error.js +72 -28
- package/node_modules/undici/lib/milo/LICENSE.md +7 -0
- package/node_modules/undici/lib/milo/no-simd.js +1002 -0
- package/node_modules/undici/lib/milo/simd.js +1002 -0
- package/node_modules/undici/lib/mock/mock-agent.js +11 -0
- package/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
- package/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
- package/node_modules/undici/lib/util/cache.js +11 -5
- package/node_modules/undici/lib/web/cookies/util.js +19 -2
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
- package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
- package/node_modules/undici/lib/web/fetch/body.js +47 -38
- package/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
- package/node_modules/undici/lib/web/fetch/headers.js +2 -2
- package/node_modules/undici/lib/web/fetch/index.js +8 -4
- package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/undici/lib/web/websocket/receiver.js +25 -4
- package/node_modules/undici/package.json +9 -7
- package/node_modules/undici/types/api.d.ts +1 -1
- package/node_modules/undici/types/cache-interceptor.d.ts +10 -0
- package/node_modules/undici/types/client.d.ts +10 -4
- package/node_modules/undici/types/errors.d.ts +16 -1
- package/node_modules/undici/types/h2c-client.d.ts +1 -1
- package/node_modules/undici/types/interceptors.d.ts +6 -1
- package/node_modules/undici/types/utility.d.ts +4 -4
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
- package/node_modules/zod/src/v4/core/compile.ts +9 -0
- package/node_modules/zod/src/v4/core/schemas.ts +35 -1
- package/node_modules/zod/src/v4/core/util.ts +13 -0
- package/node_modules/zod/src/v4/core/versions.ts +1 -1
- package/node_modules/zod/v4/core/compile.cjs +8 -0
- package/node_modules/zod/v4/core/compile.js +8 -0
- package/node_modules/zod/v4/core/schemas.cjs +30 -0
- package/node_modules/zod/v4/core/schemas.d.cts +3 -1
- package/node_modules/zod/v4/core/schemas.d.ts +3 -1
- package/node_modules/zod/v4/core/schemas.js +30 -0
- package/node_modules/zod/v4/core/util.cjs +15 -0
- package/node_modules/zod/v4/core/util.d.cts +2 -0
- package/node_modules/zod/v4/core/util.d.ts +2 -0
- package/node_modules/zod/v4/core/util.js +14 -0
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/openclaw.plugin.json +6 -30
- package/package.json +7 -7
- package/dist/.setup/action-runtime.runtime-Ck_j1YTn.mjs +0 -1
- package/dist/.setup/http-C9sM-FXe.mjs +0 -2
- package/dist/.setup/plugin-routes-D4qozHVn.mjs +0 -22
- package/dist/.setup/probe-IiHogLQN.mjs +0 -694
- package/dist/.setup/registry-DizWcnNp.mjs +0 -36
- package/dist/.setup/runtime-setter-api-Cx_PV-xu.mjs +0 -2
- package/dist/.setup/setup-plugin-api-B18kDKtr.mjs +0 -2
- package/dist/.setup/shared-DpHCoKy2.mjs +0 -259
- package/dist/.source-module-urls/562d694877afe9d9dcbb3b32a8883c16974738f2aa892c48d45572cdc9a62529.json +0 -1
- package/dist/http-routes-api.js +0 -1
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/LICENSE +0 -22
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/README.md +0 -71
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/package.json +0 -52
- package/node_modules/@slack/bolt/node_modules/content-disposition/index.js +0 -536
- package/node_modules/@slack/bolt/node_modules/content-type/HISTORY.md +0 -29
- package/node_modules/@slack/bolt/node_modules/content-type/index.js +0 -225
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/LICENSE +0 -22
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/README.md +0 -71
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +0 -46
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js +0 -176
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js.map +0 -1
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/package.json +0 -52
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/LICENSE +0 -22
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/README.md +0 -71
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.d.ts +0 -46
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js +0 -176
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js.map +0 -1
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/package.json +0 -52
- package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
- package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
- /package/node_modules/@slack/bolt/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.d.ts +0 -0
- /package/node_modules/@slack/bolt/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.js +0 -0
- /package/node_modules/@slack/bolt/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.js.map +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { a as parseSlackTarget, t as canonicalizeSlackApiTargetId } from "./target-parsing-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { t as getOptionalSlackRuntime } from "./runtime-
|
|
8
|
-
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
|
|
2
|
+
import { f as resolveSlackOperationToken, s as resolveSlackAccount } from "./accounts-EaPP0fFY.mjs";
|
|
3
|
+
import { a as parseSlackTarget, t as canonicalizeSlackApiTargetId } from "./target-parsing-DwYAP3ts.mjs";
|
|
4
|
+
import { Ct as markdownToSlackMrkdwnChunks, D as createSlackNativeDataBaseTextConsumer, E as buildSlackNativeDataAccessibilityText, F as truncateSlackText, I as truncateSlackTextByUtf8Bytes, J as resolveSlackQuestionActionIds, M as renderSlackNativeDataPlainTextBlock, N as stripSlackNativeDataBlocks, O as hasSlackNativeDataBlock, R as SLACK_QUESTION_FINALIZATION_BLOCKS, S as assertSlackDetachedTargetAllowed, St as chunkSlackMrkdwnText, at as buildSlackCompleteBlocksFallbackText, bt as SLACK_MESSAGE_TEXT_RECOMMENDED_LIMIT, h as getSlackWebApiErrorData, k as isSlackInvalidBlocksError, m as formatSlackError, ot as renderSlackBlockFallbackText, rt as validateSlackBlocksArray, vt as SLACK_EDIT_TEXT_MAX_BYTES, xt as SLACK_TEXT_LIMIT, yt as SLACK_MESSAGE_TEXT_HARD_LIMIT } from "./probe-B_Ax1vS1.mjs";
|
|
5
|
+
import { r as resolveSlackThreadTsValue, t as normalizeSlackThreadTsCandidate } from "./thread-ts-47Au2-Yn.mjs";
|
|
6
|
+
import { c as createSlackWriteClient, d as getOrCreateWeakOwnerMap, i as createSlackReadClient, m as writeLruMapEntry, o as createSlackTokenCacheKey, u as getSlackWriteClient } from "./cursor-pages-jVn3Vkfi.mjs";
|
|
7
|
+
import { t as getOptionalSlackRuntime } from "./runtime-C6HKn7Av.mjs";
|
|
9
8
|
import { asOptionalObjectRecord, asOptionalRecord, isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
+
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
10
10
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
11
11
|
import { logVerbose, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
12
12
|
import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
|
|
13
|
-
import {
|
|
13
|
+
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
14
14
|
import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
15
15
|
import { createHash, createHmac } from "node:crypto";
|
|
16
16
|
import { withTrustedEnvProxyGuardedFetchMode } from "openclaw/plugin-sdk/fetch-runtime";
|
|
@@ -27,7 +27,7 @@ import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
|
|
|
27
27
|
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
28
28
|
import { createPersistentDedupeCache } from "openclaw/plugin-sdk/dedupe-runtime";
|
|
29
29
|
import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
|
|
30
|
-
|
|
30
|
+
// extensions/slack/src/native-data-fallback.ts
|
|
31
31
|
const SLACK_SECTION_PLAIN_TEXT_MAX = 3e3;
|
|
32
32
|
const SLACK_EMPTY_BLOCK_FALLBACK = "Shared a Block Kit message";
|
|
33
33
|
function chunkSlackTextAtHardLimit(text, limit = SLACK_MESSAGE_TEXT_HARD_LIMIT) {
|
|
@@ -104,73 +104,17 @@ function buildSlackNativeDataDeliveryPlan(params) {
|
|
|
104
104
|
skipOriginalBlocks: accessibilityText.length > SLACK_MESSAGE_TEXT_HARD_LIMIT
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
//#region extensions/slack/src/post-message-identity.ts
|
|
107
|
+
// extensions/slack/src/post-message-identity.ts
|
|
109
108
|
function buildSlackMessageIdentityPayload(identity) {
|
|
110
109
|
return {
|
|
111
110
|
...identity?.username ? { username: identity.username } : {},
|
|
112
111
|
...identity?.iconUrl ? { icon_url: identity.iconUrl } : identity?.iconEmoji ? { icon_emoji: identity.iconEmoji } : {}
|
|
113
112
|
};
|
|
114
113
|
}
|
|
115
|
-
function classifySlackCustomIdentityError(err) {
|
|
116
|
-
const data = getSlackWebApiErrorData(err);
|
|
117
|
-
const code = normalizeLowercaseStringOrEmpty(data?.error);
|
|
118
|
-
if (code === "invalid_arguments" || code === "invalid_arg_name") return "argument";
|
|
119
|
-
if (code !== "missing_scope") return;
|
|
120
|
-
if (normalizeLowercaseStringOrEmpty(data?.needed).includes("chat:write.customize")) return "scope";
|
|
121
|
-
return [...normalizeTrimmedStringList(data?.response_metadata?.scopes), ...normalizeTrimmedStringList(data?.response_metadata?.acceptedScopes)].map((scope) => normalizeLowercaseStringOrEmpty(scope)).includes("chat:write.customize") ? "scope" : void 0;
|
|
122
|
-
}
|
|
123
114
|
function hasSlackMessageIdentity(identity) {
|
|
124
115
|
return Boolean(identity?.username || identity?.iconUrl || identity?.iconEmoji);
|
|
125
116
|
}
|
|
126
|
-
|
|
127
|
-
async function postSlackMessageWithIdentityFallback(params) {
|
|
128
|
-
const { basePayload, identity, post } = params;
|
|
129
|
-
try {
|
|
130
|
-
if (!identity) return await post(basePayload);
|
|
131
|
-
return await post({
|
|
132
|
-
...basePayload,
|
|
133
|
-
...buildSlackMessageIdentityPayload(identity)
|
|
134
|
-
}, identity);
|
|
135
|
-
} catch (err) {
|
|
136
|
-
if (!identity || !hasSlackMessageIdentity(identity)) throw err;
|
|
137
|
-
const rejection = classifySlackCustomIdentityError(err);
|
|
138
|
-
if (!rejection) throw err;
|
|
139
|
-
if (rejection === "argument" && identity.username && (identity.iconUrl || identity.iconEmoji)) {
|
|
140
|
-
logVerbose("slack send: custom icon rejected, retrying with username only");
|
|
141
|
-
try {
|
|
142
|
-
return await post({
|
|
143
|
-
...basePayload,
|
|
144
|
-
username: identity.username
|
|
145
|
-
}, { username: identity.username });
|
|
146
|
-
} catch (retryError) {
|
|
147
|
-
if (!classifySlackCustomIdentityError(retryError)) throw retryError;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
logVerbose("slack send: custom identity rejected, retrying without custom identity");
|
|
151
|
-
return post(basePayload);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
//#endregion
|
|
155
|
-
//#region extensions/slack/src/post-message-payload.ts
|
|
156
|
-
function buildSlackPostMessagePayload(params) {
|
|
157
|
-
const threadPayload = params.replyBroadcast && params.threadTs ? {
|
|
158
|
-
thread_ts: params.threadTs,
|
|
159
|
-
reply_broadcast: true
|
|
160
|
-
} : params.threadTs ? { thread_ts: params.threadTs } : {};
|
|
161
|
-
return {
|
|
162
|
-
channel: params.channelId,
|
|
163
|
-
text: params.text,
|
|
164
|
-
...params.blocks?.length ? { blocks: params.blocks } : {},
|
|
165
|
-
...params.metadata ? { metadata: params.metadata } : {},
|
|
166
|
-
...typeof params.mrkdwn === "boolean" ? { mrkdwn: params.mrkdwn } : {},
|
|
167
|
-
...threadPayload,
|
|
168
|
-
unfurl_links: params.unfurl?.unfurlLinks ?? false,
|
|
169
|
-
...typeof params.unfurl?.unfurlMedia === "boolean" ? { unfurl_media: params.unfurl.unfurlMedia } : {}
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
//#endregion
|
|
173
|
-
//#region extensions/slack/src/client-delivery.ts
|
|
117
|
+
// extensions/slack/src/client-delivery.ts
|
|
174
118
|
const SLACK_COMMERCIAL_API_HOSTNAME = "slack.com";
|
|
175
119
|
const SLACK_COMMERCIAL_UPLOAD_HOSTNAME = "files.slack.com";
|
|
176
120
|
const SLACK_GOV_API_HOSTNAME = "slack-gov.com";
|
|
@@ -291,18 +235,61 @@ function requireSlackPostMessageTimestamp(response) {
|
|
|
291
235
|
if (!timestamp) throw new Error("Slack chat.postMessage returned no message timestamp");
|
|
292
236
|
return timestamp;
|
|
293
237
|
}
|
|
238
|
+
function classifySlackCustomIdentityError(err) {
|
|
239
|
+
const data = getSlackWebApiErrorData(err);
|
|
240
|
+
const code = normalizeLowercaseStringOrEmpty(data?.error);
|
|
241
|
+
if (code === "invalid_arguments" || code === "invalid_arg_name") return "argument";
|
|
242
|
+
if (code !== "missing_scope") return;
|
|
243
|
+
if (normalizeLowercaseStringOrEmpty(data?.needed).includes("chat:write.customize")) return "scope";
|
|
244
|
+
return [...normalizeTrimmedStringList(data?.response_metadata?.scopes), ...normalizeTrimmedStringList(data?.response_metadata?.acceptedScopes)].map((scope) => normalizeLowercaseStringOrEmpty(scope)).includes("chat:write.customize") ? "scope" : void 0;
|
|
245
|
+
}
|
|
294
246
|
async function postSlackMessageBestEffort(params) {
|
|
295
|
-
const
|
|
247
|
+
const threadPayload = params.replyBroadcast && params.threadTs ? {
|
|
248
|
+
thread_ts: params.threadTs,
|
|
249
|
+
reply_broadcast: true
|
|
250
|
+
} : params.threadTs ? { thread_ts: params.threadTs } : {};
|
|
251
|
+
const basePayload = {
|
|
252
|
+
channel: params.channelId,
|
|
253
|
+
text: params.text,
|
|
254
|
+
...params.blocks?.length ? { blocks: params.blocks } : {},
|
|
255
|
+
...params.metadata ? { metadata: params.metadata } : {},
|
|
256
|
+
...params.mrkdwn !== void 0 ? { mrkdwn: params.mrkdwn } : {},
|
|
257
|
+
...threadPayload,
|
|
258
|
+
unfurl_links: params.unfurl?.unfurlLinks ?? false,
|
|
259
|
+
...params.unfurl?.unfurlMedia !== void 0 ? { unfurl_media: params.unfurl.unfurlMedia } : {}
|
|
260
|
+
};
|
|
296
261
|
const postChatMessage = params.client.chat.postMessage.bind(params.client.chat);
|
|
297
262
|
const post = async (payload, identity) => ({
|
|
298
263
|
response: await withSlackDnsRequestRetry("chat.postMessage", () => postChatMessage(payload)).catch(rethrowSlackPermanentOutboundApiRejection),
|
|
299
264
|
identity
|
|
300
265
|
});
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
266
|
+
const identity = params.identity;
|
|
267
|
+
const posted = await (async () => {
|
|
268
|
+
try {
|
|
269
|
+
if (!identity) return await post(basePayload);
|
|
270
|
+
return await post({
|
|
271
|
+
...basePayload,
|
|
272
|
+
...buildSlackMessageIdentityPayload(identity)
|
|
273
|
+
}, identity);
|
|
274
|
+
} catch (err) {
|
|
275
|
+
if (!identity || !hasSlackMessageIdentity(identity)) throw err;
|
|
276
|
+
const rejection = classifySlackCustomIdentityError(err);
|
|
277
|
+
if (!rejection) throw err;
|
|
278
|
+
if (rejection === "argument" && identity.username && (identity.iconUrl || identity.iconEmoji)) {
|
|
279
|
+
logVerbose("slack send: custom icon rejected, retrying with username only");
|
|
280
|
+
try {
|
|
281
|
+
return await post({
|
|
282
|
+
...basePayload,
|
|
283
|
+
username: identity.username
|
|
284
|
+
}, { username: identity.username });
|
|
285
|
+
} catch (retryError) {
|
|
286
|
+
if (!classifySlackCustomIdentityError(retryError)) throw retryError;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
logVerbose("slack send: custom identity rejected, retrying without custom identity");
|
|
290
|
+
return post(basePayload);
|
|
291
|
+
}
|
|
292
|
+
})();
|
|
306
293
|
const timestamp = requireSlackPostMessageTimestamp(posted.response);
|
|
307
294
|
return {
|
|
308
295
|
...posted,
|
|
@@ -379,8 +366,7 @@ async function uploadSlackFile(params) {
|
|
|
379
366
|
if (!completeResp.ok) throw new Error(`Failed to complete upload: ${completeResp.error ?? "unknown error"}`);
|
|
380
367
|
return uploadFileId;
|
|
381
368
|
}
|
|
382
|
-
|
|
383
|
-
//#region extensions/slack/src/sent-thread-cache.ts
|
|
369
|
+
// extensions/slack/src/sent-thread-cache.ts
|
|
384
370
|
/**
|
|
385
371
|
* Cache of Slack threads the bot has participated in.
|
|
386
372
|
* Used to auto-respond in threads without requiring @mention after the first reply.
|
|
@@ -456,30 +442,21 @@ function clearSlackThreadParticipationCache() {
|
|
|
456
442
|
threadParticipation.clearForTest();
|
|
457
443
|
threadFailureNotices.clear();
|
|
458
444
|
}
|
|
459
|
-
|
|
460
|
-
//#region extensions/slack/src/slack-dm-channel-cache.ts
|
|
445
|
+
// extensions/slack/src/slack-dm-channel-cache.ts
|
|
461
446
|
const SLACK_DM_CHANNEL_CACHE_MAX = 1024;
|
|
462
447
|
const slackDmChannelCaches = /* @__PURE__ */ new WeakMap();
|
|
463
448
|
function createSlackDmCacheKey(params) {
|
|
464
449
|
return `${params.accountId ?? "default"}:${createSlackTokenCacheKey(params.token)}:${params.recipientId}`;
|
|
465
450
|
}
|
|
466
|
-
function getSlackDmChannelCache(client) {
|
|
467
|
-
const existing = slackDmChannelCaches.get(client);
|
|
468
|
-
if (existing) return existing;
|
|
469
|
-
const cache = /* @__PURE__ */ new Map();
|
|
470
|
-
slackDmChannelCaches.set(client, cache);
|
|
471
|
-
return cache;
|
|
472
|
-
}
|
|
473
451
|
function readCachedSlackDmChannelId(params) {
|
|
474
|
-
return
|
|
452
|
+
return slackDmChannelCaches.get(params.cacheOwner)?.get(createSlackDmCacheKey(params));
|
|
475
453
|
}
|
|
476
454
|
function cacheSlackDmChannelId(params, channelId) {
|
|
477
|
-
const cache =
|
|
455
|
+
const cache = getOrCreateWeakOwnerMap(slackDmChannelCaches, params.cacheOwner);
|
|
478
456
|
const key = createSlackDmCacheKey(params);
|
|
479
457
|
writeLruMapEntry(cache, key, channelId, SLACK_DM_CHANNEL_CACHE_MAX);
|
|
480
458
|
}
|
|
481
|
-
|
|
482
|
-
//#region extensions/slack/src/send.ts
|
|
459
|
+
// extensions/slack/src/send.ts
|
|
483
460
|
var send_exports = /* @__PURE__ */ __exportAll({
|
|
484
461
|
reconcileSlackUnknownSend: () => reconcileSlackUnknownSend,
|
|
485
462
|
resolveSlackDmChannelId: () => resolveSlackDmChannelId,
|
|
@@ -542,17 +519,23 @@ function resolvePostedMessageThreadTs(response) {
|
|
|
542
519
|
}
|
|
543
520
|
async function updateMessageSlack(params) {
|
|
544
521
|
const cfg = requireRuntimeConfig(params.cfg, "Slack update");
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
522
|
+
const { client } = resolveSlackDelivery({
|
|
523
|
+
account: resolveSlackAccount({
|
|
524
|
+
cfg,
|
|
525
|
+
accountId: params.accountId
|
|
526
|
+
}),
|
|
527
|
+
eventScope: params.eventScope,
|
|
528
|
+
opts: {
|
|
529
|
+
cfg,
|
|
530
|
+
token: params.token
|
|
531
|
+
},
|
|
532
|
+
recipient: {
|
|
533
|
+
kind: "channel",
|
|
534
|
+
id: params.channelId,
|
|
535
|
+
teamId: params.teamId
|
|
536
|
+
}
|
|
554
537
|
});
|
|
555
|
-
await
|
|
538
|
+
await client.chat.update({
|
|
556
539
|
channel: params.channelId,
|
|
557
540
|
ts: params.messageTs,
|
|
558
541
|
text: truncateSlackTextByUtf8Bytes(params.text, SLACK_EDIT_TEXT_MAX_BYTES),
|
|
@@ -629,19 +612,20 @@ function parseEnterpriseEventRecipient(raw) {
|
|
|
629
612
|
function resolveSlackDelivery(params) {
|
|
630
613
|
if (params.eventScope) {
|
|
631
614
|
if (!params.eventScope.writeClient) throw new Error("missing_enterprise_slack_write_client");
|
|
632
|
-
return
|
|
615
|
+
return {
|
|
633
616
|
client: params.eventScope.writeClient,
|
|
634
617
|
credential: SLACK_ENTERPRISE_LISTENER_QUEUE_CREDENTIAL,
|
|
635
618
|
identity: normalizeSlackSendIdentity(params.opts.identity),
|
|
636
619
|
recipient: params.recipient,
|
|
637
620
|
teamId: params.eventScope.teamId,
|
|
638
621
|
unfurl: { unfurlMedia: params.account.config.unfurlMedia },
|
|
639
|
-
upload:
|
|
622
|
+
upload: {
|
|
640
623
|
client: params.eventScope.client,
|
|
641
624
|
auditContext: "slack-enterprise-immediate-upload"
|
|
642
|
-
}
|
|
643
|
-
}
|
|
625
|
+
}
|
|
626
|
+
};
|
|
644
627
|
}
|
|
628
|
+
assertSlackDetachedTargetAllowed(params.account.accountId, params.recipient.teamId);
|
|
645
629
|
const credential = resolveToken({
|
|
646
630
|
explicit: params.opts.token,
|
|
647
631
|
accountId: params.account.accountId,
|
|
@@ -650,7 +634,7 @@ function resolveSlackDelivery(params) {
|
|
|
650
634
|
});
|
|
651
635
|
const cachedClient = params.recipient.teamId ? getSlackWriteClient(credential, { teamId: params.recipient.teamId }) : params.opts.client ?? getSlackWriteClient(credential);
|
|
652
636
|
const client = params.opts.assertDirectAdapterHandoff ? createSlackWriteClient(credential, { teamId: params.recipient.teamId }, params.opts.assertDirectAdapterHandoff) : cachedClient;
|
|
653
|
-
return
|
|
637
|
+
return {
|
|
654
638
|
client,
|
|
655
639
|
...client !== cachedClient ? { dmCacheOwner: cachedClient } : {},
|
|
656
640
|
credential,
|
|
@@ -661,7 +645,7 @@ function resolveSlackDelivery(params) {
|
|
|
661
645
|
unfurlLinks: params.account.config.unfurlLinks,
|
|
662
646
|
unfurlMedia: params.account.config.unfurlMedia
|
|
663
647
|
}
|
|
664
|
-
}
|
|
648
|
+
};
|
|
665
649
|
}
|
|
666
650
|
async function resolveChannelId(client, recipient, params) {
|
|
667
651
|
if (recipient.kind !== "user") return recipient.id;
|
|
@@ -678,20 +662,6 @@ async function resolveChannelId(client, recipient, params) {
|
|
|
678
662
|
cacheSlackDmChannelId(cacheParams, channelId);
|
|
679
663
|
return channelId;
|
|
680
664
|
}
|
|
681
|
-
function resolveSlackTextChunks(params) {
|
|
682
|
-
const text = params.text;
|
|
683
|
-
const chunkLimit = params.chunkLimit;
|
|
684
|
-
if (params.preservePlainText) return text ? chunkTextForOutbound(text, chunkLimit, { preserveWhitespace: true }) : [];
|
|
685
|
-
if (params.textIsSlackMrkdwn) return resolveTextChunksWithFallback(text, chunkSlackMrkdwnText(text, chunkLimit));
|
|
686
|
-
const tableMode = resolveMarkdownTableMode({
|
|
687
|
-
cfg: params.cfg,
|
|
688
|
-
channel: "slack",
|
|
689
|
-
...params.accountId ? { accountId: params.accountId } : {}
|
|
690
|
-
});
|
|
691
|
-
const chunkMode = resolveChunkMode(params.cfg, "slack", params.accountId);
|
|
692
|
-
const chunks = (chunkMode === "newline" ? chunkMarkdownTextWithMode(text, chunkLimit, chunkMode) : [text]).flatMap((markdown) => markdownToSlackMrkdwnChunks(markdown, chunkLimit, { tableMode }));
|
|
693
|
-
return resolveTextChunksWithFallback(text, chunks);
|
|
694
|
-
}
|
|
695
665
|
async function resolveSlackDmChannelId(params) {
|
|
696
666
|
return await resolveChannelId(params.client, {
|
|
697
667
|
kind: "user",
|
|
@@ -762,37 +732,8 @@ const SLACK_RECONCILIATION_EVIDENCE_RANK = {
|
|
|
762
732
|
conflict: 2,
|
|
763
733
|
complete: 3
|
|
764
734
|
};
|
|
765
|
-
function findSlackConversationDeliveryParts(params) {
|
|
766
|
-
const matches = [];
|
|
767
|
-
for (const message of params.messages) {
|
|
768
|
-
const marker = asOptionalRecord(asOptionalRecord(message.metadata)?.event_payload);
|
|
769
|
-
if (!marker || marker[SLACK_DELIVERY_METADATA_KEY] !== params.deliveryId) continue;
|
|
770
|
-
const partIndex = marker[SLACK_DELIVERY_METADATA_PART_INDEX_KEY];
|
|
771
|
-
const partCount = marker[SLACK_DELIVERY_METADATA_PART_COUNT_KEY];
|
|
772
|
-
if (typeof partIndex !== "number" || !Number.isInteger(partIndex) || typeof partCount !== "number" || !Number.isInteger(partCount) || partIndex < 0 || partCount <= 0 || partIndex >= partCount) continue;
|
|
773
|
-
const expectedSignature = createSlackDeliveryMetadataSignature({
|
|
774
|
-
queueId: params.queueId,
|
|
775
|
-
channelId: params.channelId,
|
|
776
|
-
threadTs: params.threadTs,
|
|
777
|
-
partIndex,
|
|
778
|
-
partCount
|
|
779
|
-
});
|
|
780
|
-
const actualSignature = marker[SLACK_DELIVERY_METADATA_SIGNATURE_KEY];
|
|
781
|
-
if (typeof actualSignature !== "string" || !safeEqualSecret(actualSignature, expectedSignature)) continue;
|
|
782
|
-
const messageId = typeof message.ts === "string" ? normalizeSlackThreadTsCandidate(message.ts) : void 0;
|
|
783
|
-
if (!messageId) continue;
|
|
784
|
-
const threadTs = typeof message.thread_ts === "string" ? normalizeSlackThreadTsCandidate(message.thread_ts) : void 0;
|
|
785
|
-
matches.push({
|
|
786
|
-
messageId,
|
|
787
|
-
partIndex,
|
|
788
|
-
partCount,
|
|
789
|
-
...threadTs ? { threadTs } : {}
|
|
790
|
-
});
|
|
791
|
-
}
|
|
792
|
-
return matches;
|
|
793
|
-
}
|
|
794
735
|
async function scanSlackConversationForDelivery(params) {
|
|
795
|
-
const
|
|
736
|
+
const lookupThreadTs = params.threadTs;
|
|
796
737
|
let cursor;
|
|
797
738
|
let expectedPartCount;
|
|
798
739
|
const deliveryParts = /* @__PURE__ */ new Map();
|
|
@@ -805,17 +746,36 @@ async function scanSlackConversationForDelivery(params) {
|
|
|
805
746
|
limit: SLACK_RECONCILE_LIMIT,
|
|
806
747
|
...cursor ? { cursor } : {}
|
|
807
748
|
};
|
|
808
|
-
const response =
|
|
749
|
+
const response = lookupThreadTs ? await withSlackDnsRequestRetry("conversations.replies", () => params.client.conversations.replies({
|
|
809
750
|
...query,
|
|
810
|
-
ts:
|
|
751
|
+
ts: lookupThreadTs
|
|
811
752
|
})) : await withSlackDnsRequestRetry("conversations.history", () => params.client.conversations.history(query));
|
|
812
|
-
const matches =
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
753
|
+
const matches = [];
|
|
754
|
+
for (const message of asSlackConversationMessages(response)) {
|
|
755
|
+
const marker = asOptionalRecord(asOptionalRecord(message.metadata)?.event_payload);
|
|
756
|
+
if (!marker || marker[SLACK_DELIVERY_METADATA_KEY] !== params.deliveryId) continue;
|
|
757
|
+
const partIndex = marker[SLACK_DELIVERY_METADATA_PART_INDEX_KEY];
|
|
758
|
+
const partCount = marker[SLACK_DELIVERY_METADATA_PART_COUNT_KEY];
|
|
759
|
+
if (typeof partIndex !== "number" || !Number.isInteger(partIndex) || typeof partCount !== "number" || !Number.isInteger(partCount) || partIndex < 0 || partCount <= 0 || partIndex >= partCount) continue;
|
|
760
|
+
const expectedSignature = createSlackDeliveryMetadataSignature({
|
|
761
|
+
queueId: params.queueId,
|
|
762
|
+
channelId: params.channelId,
|
|
763
|
+
threadTs: lookupThreadTs,
|
|
764
|
+
partIndex,
|
|
765
|
+
partCount
|
|
766
|
+
});
|
|
767
|
+
const actualSignature = marker[SLACK_DELIVERY_METADATA_SIGNATURE_KEY];
|
|
768
|
+
if (typeof actualSignature !== "string" || !safeEqualSecret(actualSignature, expectedSignature)) continue;
|
|
769
|
+
const messageId = typeof message.ts === "string" ? normalizeSlackThreadTsCandidate(message.ts) : void 0;
|
|
770
|
+
if (!messageId) continue;
|
|
771
|
+
const threadTs = typeof message.thread_ts === "string" ? normalizeSlackThreadTsCandidate(message.thread_ts) : void 0;
|
|
772
|
+
matches.push({
|
|
773
|
+
messageId,
|
|
774
|
+
partIndex,
|
|
775
|
+
partCount,
|
|
776
|
+
...threadTs ? { threadTs } : {}
|
|
777
|
+
});
|
|
778
|
+
}
|
|
819
779
|
for (const match of matches) {
|
|
820
780
|
expectedPartCount ??= match.partCount;
|
|
821
781
|
const existing = deliveryParts.get(match.partIndex);
|
|
@@ -921,209 +881,206 @@ async function reconcileSlackUnknownSend(ctx) {
|
|
|
921
881
|
return unresolvedSlackDelivery(readSlackRequestErrorMessage(enrichSlackWebApiError(err)), ctx.retryCount < 3);
|
|
922
882
|
}
|
|
923
883
|
}
|
|
924
|
-
async function sendMessageSlack(to, message,
|
|
884
|
+
async function sendMessageSlack(to, message, options) {
|
|
925
885
|
const normalizedMessage = normalizeOptionalString(message) ?? "";
|
|
926
|
-
const trimmedMessage =
|
|
927
|
-
const cfg = requireRuntimeConfig(
|
|
886
|
+
const trimmedMessage = options.textIsSlackPlainText && normalizedMessage ? message : normalizedMessage;
|
|
887
|
+
const cfg = requireRuntimeConfig(options.cfg, "Slack send");
|
|
928
888
|
const account = resolveSlackAccount({
|
|
929
889
|
cfg,
|
|
930
|
-
accountId:
|
|
890
|
+
accountId: options.accountId
|
|
931
891
|
});
|
|
932
|
-
const eventScope =
|
|
892
|
+
const eventScope = options.eventScope;
|
|
933
893
|
if (eventScope && (!/^T[A-Z0-9]+$/i.test(eventScope.teamId) || !eventScope.client)) throw new Error("invalid_enterprise_slack_listener_scope");
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
const queuedOpts = Object.freeze({ ...opts });
|
|
894
|
+
const parsedRecipient = eventScope ? parseEnterpriseEventRecipient(to) : parseRecipient(to);
|
|
895
|
+
const blocks = options.blocks == null ? void 0 : validateSlackBlocksArray(options.blocks);
|
|
896
|
+
if (!normalizedMessage && !options.mediaUrl && !blocks) throw new Error("Slack send requires text, blocks, or media");
|
|
897
|
+
const opts = { ...options };
|
|
939
898
|
const delivery = resolveSlackDelivery({
|
|
940
899
|
account,
|
|
941
900
|
eventScope,
|
|
942
|
-
opts
|
|
943
|
-
recipient
|
|
901
|
+
opts,
|
|
902
|
+
recipient: parsedRecipient
|
|
944
903
|
});
|
|
945
904
|
const workspaceScope = delivery.teamId ? `:${delivery.teamId}` : "";
|
|
946
|
-
const queueKey = `${account.accountId}:${createSlackTokenCacheKey(delivery.credential)}${workspaceScope}:${delivery.recipient.kind}:${delivery.recipient.id}:${
|
|
947
|
-
const
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
}));
|
|
957
|
-
const threadTs = result.threadTs ?? normalizeSlackThreadTsCandidate(queuedOpts.threadTs);
|
|
958
|
-
if (threadTs && result.channelId && account.accountId) recordSlackThreadParticipation(account.accountId, result.channelId, threadTs, { teamId: delivery.teamId });
|
|
959
|
-
return result;
|
|
960
|
-
}
|
|
961
|
-
async function sendMessageSlackQueued(params) {
|
|
962
|
-
const { opts, cfg, account, blocks, trimmedMessage, delivery } = params;
|
|
963
|
-
const { client, identity, recipient, unfurl } = delivery;
|
|
964
|
-
if (opts.replyBroadcast && opts.mediaUrl) throw new Error("Slack replyBroadcast is only supported for text or block thread replies.");
|
|
965
|
-
const directUserPostChannelId = !opts.deliveryQueueId && recipient.kind === "user" && !opts.mediaUrl && !opts.threadTs ? recipient.id : void 0;
|
|
966
|
-
const channelId = directUserPostChannelId ? directUserPostChannelId : await resolveChannelId(client, recipient, {
|
|
967
|
-
accountId: account.accountId,
|
|
968
|
-
token: delivery.credential,
|
|
969
|
-
...delivery.dmCacheOwner ? { dmCacheOwner: delivery.dmCacheOwner } : {}
|
|
970
|
-
});
|
|
971
|
-
const deliveredResults = [];
|
|
972
|
-
const reportDelivery = async (result, deliveredBlocks) => {
|
|
973
|
-
const slackQuestionActionIds = resolveSlackQuestionActionIds(deliveredBlocks);
|
|
974
|
-
const deliveryResult = slackQuestionActionIds.length ? {
|
|
975
|
-
...result,
|
|
976
|
-
meta: {
|
|
977
|
-
...result.meta,
|
|
978
|
-
slackQuestionActionIds,
|
|
979
|
-
[SLACK_QUESTION_FINALIZATION_BLOCKS]: deliveredBlocks.filter((block) => block.type !== "actions")
|
|
980
|
-
}
|
|
981
|
-
} : result;
|
|
982
|
-
deliveredResults.push(deliveryResult);
|
|
983
|
-
await opts.onDeliveryResult?.(deliveryResult);
|
|
984
|
-
return deliveryResult;
|
|
985
|
-
};
|
|
986
|
-
let didDispatch = false;
|
|
987
|
-
const dispatchOnce = async () => {
|
|
988
|
-
if (didDispatch) return;
|
|
989
|
-
didDispatch = true;
|
|
990
|
-
await opts.onPlatformSendDispatch?.();
|
|
991
|
-
};
|
|
992
|
-
const explicitNativeDataFallbackBase = Object.hasOwn(opts, "nativeDataFallbackBaseText") ? opts.nativeDataFallbackBaseText?.trim() ?? "" : void 0;
|
|
993
|
-
const authoredTextPlacement = opts.authoredTextPlacement ?? "outside-blocks";
|
|
994
|
-
const nativeDataFallbackBase = blocks && authoredTextPlacement === "outside-blocks" ? explicitNativeDataFallbackBase ?? trimmedMessage : "";
|
|
995
|
-
const hasNativeData = Boolean(blocks && hasSlackNativeDataBlock(blocks));
|
|
996
|
-
const textChunkLimit = Math.min(opts.textLimit ?? resolveTextChunkLimit(cfg, "slack", account.accountId, { fallbackLimit: 8e3 }), SLACK_TEXT_LIMIT);
|
|
997
|
-
const usesOrderedBlockAccessibility = Boolean(blocks && (hasNativeData || opts.authoredTextPlacement !== void 0));
|
|
998
|
-
const orderedBlockDeliveryPlan = blocks && usesOrderedBlockAccessibility ? buildSlackNativeDataDeliveryPlan({
|
|
999
|
-
baseText: nativeDataFallbackBase,
|
|
1000
|
-
blocks,
|
|
1001
|
-
textLimit: textChunkLimit
|
|
1002
|
-
}) : void 0;
|
|
1003
|
-
const completeBlockFallbackText = blocks ? buildSlackCompleteBlocksFallbackText(blocks) : "";
|
|
1004
|
-
const rawBlockAccessibilityText = trimmedMessage ? [trimmedMessage, ...completeBlockFallbackText.includes(trimmedMessage) ? [] : [completeBlockFallbackText]].join("\n\n") : completeBlockFallbackText;
|
|
1005
|
-
const blockAccessibilityText = blocks ? orderedBlockDeliveryPlan?.accessibilityText ?? rawBlockAccessibilityText : void 0;
|
|
1006
|
-
let pendingBlockFallback = orderedBlockDeliveryPlan?.skipOriginalBlocks ? orderedBlockDeliveryPlan : void 0;
|
|
1007
|
-
let lastMessageId = "";
|
|
1008
|
-
let deliveredChannelId = channelId;
|
|
1009
|
-
let canonicalDeliveredThreadTs;
|
|
1010
|
-
let sendIdentity = identity;
|
|
1011
|
-
const postPart = async (part) => {
|
|
1012
|
-
const posted = await postSlackMessageBestEffort({
|
|
1013
|
-
client,
|
|
1014
|
-
channelId,
|
|
1015
|
-
threadTs: opts.threadTs,
|
|
1016
|
-
identity: sendIdentity,
|
|
1017
|
-
unfurl,
|
|
1018
|
-
...part
|
|
1019
|
-
});
|
|
1020
|
-
const { response } = posted;
|
|
1021
|
-
sendIdentity = posted.identity;
|
|
1022
|
-
lastMessageId = response.ts;
|
|
1023
|
-
deliveredChannelId = (typeof response.channel === "string" ? normalizeOptionalString(response.channel) : null) ?? deliveredChannelId;
|
|
1024
|
-
const responseThreadTs = resolvePostedMessageThreadTs(response);
|
|
1025
|
-
canonicalDeliveredThreadTs ??= responseThreadTs;
|
|
1026
|
-
return await reportDelivery(createSlackSendResult(response.ts, deliveredChannelId, part.blocks ? "card" : "text", responseThreadTs ?? normalizeSlackThreadTsCandidate(opts.threadTs)), part.blocks);
|
|
1027
|
-
};
|
|
1028
|
-
if (blocks && opts.mediaUrl) throw new Error("Slack send does not support blocks with mediaUrl");
|
|
1029
|
-
if (blocks) {
|
|
1030
|
-
if (pendingBlockFallback) logVerbose("slack send: native data accessibility exceeds hard limit, using text fallback");
|
|
1031
|
-
else {
|
|
1032
|
-
const accessibilityText = usesOrderedBlockAccessibility ? blockAccessibilityText ?? "Slack could not render this Block Kit message." : truncateSlackText(blockAccessibilityText ?? "", SLACK_TEXT_LIMIT);
|
|
1033
|
-
const initialBlockMetadata = withSlackDeliveryMetadata(opts.metadata, {
|
|
1034
|
-
queueId: opts.deliveryQueueId,
|
|
1035
|
-
channelId,
|
|
1036
|
-
threadTs: opts.threadTs,
|
|
1037
|
-
partIndex: 0,
|
|
1038
|
-
partCount: 1
|
|
905
|
+
const queueKey = `${account.accountId}:${createSlackTokenCacheKey(delivery.credential)}${workspaceScope}:${delivery.recipient.kind}:${delivery.recipient.id}:${options.threadTs ?? ""}`;
|
|
906
|
+
const sent = await slackSendQueue.enqueue(queueKey, async () => {
|
|
907
|
+
try {
|
|
908
|
+
const { client, identity, recipient, unfurl } = delivery;
|
|
909
|
+
if (opts.replyBroadcast && opts.mediaUrl) throw new Error("Slack replyBroadcast is only supported for text or block thread replies.");
|
|
910
|
+
const directUserPostChannelId = !opts.deliveryQueueId && recipient.kind === "user" && !opts.mediaUrl && !opts.threadTs ? recipient.id : void 0;
|
|
911
|
+
const channelId = directUserPostChannelId ? directUserPostChannelId : await resolveChannelId(client, recipient, {
|
|
912
|
+
accountId: account.accountId,
|
|
913
|
+
token: delivery.credential,
|
|
914
|
+
...delivery.dmCacheOwner ? { dmCacheOwner: delivery.dmCacheOwner } : {}
|
|
1039
915
|
});
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
916
|
+
const deliveredResults = [];
|
|
917
|
+
const reportDelivery = async (result, deliveredBlocks) => {
|
|
918
|
+
const slackQuestionActionIds = resolveSlackQuestionActionIds(deliveredBlocks);
|
|
919
|
+
const deliveryResult = slackQuestionActionIds.length ? {
|
|
920
|
+
...result,
|
|
921
|
+
meta: {
|
|
922
|
+
...result.meta,
|
|
923
|
+
slackQuestionActionIds,
|
|
924
|
+
[SLACK_QUESTION_FINALIZATION_BLOCKS]: deliveredBlocks
|
|
925
|
+
}
|
|
926
|
+
} : result;
|
|
927
|
+
deliveredResults.push(deliveryResult);
|
|
928
|
+
await opts.onDeliveryResult?.(deliveryResult);
|
|
929
|
+
return deliveryResult;
|
|
930
|
+
};
|
|
931
|
+
let didDispatch = false;
|
|
932
|
+
const dispatchOnce = async () => {
|
|
933
|
+
if (didDispatch) return;
|
|
934
|
+
didDispatch = true;
|
|
935
|
+
await opts.onPlatformSendDispatch?.();
|
|
936
|
+
};
|
|
937
|
+
const explicitNativeDataFallbackBase = Object.hasOwn(opts, "nativeDataFallbackBaseText") ? opts.nativeDataFallbackBaseText?.trim() ?? "" : void 0;
|
|
938
|
+
const authoredTextPlacement = opts.authoredTextPlacement ?? "outside-blocks";
|
|
939
|
+
const nativeDataFallbackBase = blocks && authoredTextPlacement === "outside-blocks" ? explicitNativeDataFallbackBase ?? trimmedMessage : "";
|
|
940
|
+
const hasNativeData = Boolean(blocks && hasSlackNativeDataBlock(blocks));
|
|
941
|
+
const textChunkLimit = Math.min(opts.textLimit ?? resolveTextChunkLimit(cfg, "slack", account.accountId, { fallbackLimit: 8e3 }), SLACK_TEXT_LIMIT);
|
|
942
|
+
const usesOrderedBlockAccessibility = Boolean(blocks && (hasNativeData || opts.authoredTextPlacement !== void 0));
|
|
943
|
+
const orderedBlockDeliveryPlan = blocks && usesOrderedBlockAccessibility ? buildSlackNativeDataDeliveryPlan({
|
|
944
|
+
baseText: nativeDataFallbackBase,
|
|
945
|
+
blocks,
|
|
946
|
+
textLimit: textChunkLimit
|
|
947
|
+
}) : void 0;
|
|
948
|
+
let pendingBlockFallback = orderedBlockDeliveryPlan?.skipOriginalBlocks ? orderedBlockDeliveryPlan : void 0;
|
|
949
|
+
let lastMessageId = "";
|
|
950
|
+
let deliveredChannelId = channelId;
|
|
951
|
+
let canonicalDeliveredThreadTs;
|
|
952
|
+
let sendIdentity = identity;
|
|
953
|
+
const postPart = async (part) => {
|
|
954
|
+
const posted = await postSlackMessageBestEffort({
|
|
955
|
+
client,
|
|
956
|
+
channelId,
|
|
957
|
+
threadTs: opts.threadTs,
|
|
958
|
+
identity: sendIdentity,
|
|
959
|
+
unfurl,
|
|
960
|
+
...part
|
|
961
|
+
});
|
|
962
|
+
const { response } = posted;
|
|
963
|
+
sendIdentity = posted.identity;
|
|
964
|
+
lastMessageId = response.ts;
|
|
965
|
+
deliveredChannelId = (typeof response.channel === "string" ? normalizeOptionalString(response.channel) : null) ?? deliveredChannelId;
|
|
966
|
+
const responseThreadTs = resolvePostedMessageThreadTs(response);
|
|
967
|
+
canonicalDeliveredThreadTs ??= responseThreadTs;
|
|
968
|
+
return await reportDelivery(createSlackSendResult(response.ts, deliveredChannelId, part.blocks ? "card" : "text", responseThreadTs ?? normalizeSlackThreadTsCandidate(opts.threadTs)), part.blocks);
|
|
969
|
+
};
|
|
970
|
+
if (blocks && opts.mediaUrl) throw new Error("Slack send does not support blocks with mediaUrl");
|
|
971
|
+
if (blocks) {
|
|
972
|
+
if (pendingBlockFallback) logVerbose("slack send: native data accessibility exceeds hard limit, using text fallback");
|
|
973
|
+
else {
|
|
974
|
+
let accessibilityText = orderedBlockDeliveryPlan?.accessibilityText;
|
|
975
|
+
if (accessibilityText === void 0) {
|
|
976
|
+
const fallback = buildSlackCompleteBlocksFallbackText(blocks);
|
|
977
|
+
accessibilityText = truncateSlackText(trimmedMessage ? [trimmedMessage, ...fallback.includes(trimmedMessage) ? [] : [fallback]].join("\n\n") : fallback, SLACK_TEXT_LIMIT);
|
|
978
|
+
}
|
|
979
|
+
const initialBlockMetadata = withSlackDeliveryMetadata(opts.metadata, {
|
|
980
|
+
queueId: opts.deliveryQueueId,
|
|
981
|
+
channelId,
|
|
982
|
+
threadTs: opts.threadTs,
|
|
983
|
+
partIndex: 0,
|
|
984
|
+
partCount: 1
|
|
985
|
+
});
|
|
986
|
+
await dispatchOnce();
|
|
987
|
+
try {
|
|
988
|
+
return await postPart({
|
|
989
|
+
text: accessibilityText,
|
|
990
|
+
replyBroadcast: opts.replyBroadcast,
|
|
991
|
+
blocks,
|
|
992
|
+
metadata: initialBlockMetadata,
|
|
993
|
+
...usesOrderedBlockAccessibility ? { mrkdwn: false } : {}
|
|
994
|
+
});
|
|
995
|
+
} catch (error) {
|
|
996
|
+
if (!hasNativeData || !isSlackInvalidBlocksError(error)) throw error;
|
|
997
|
+
logVerbose("slack send: native data rejected, delivering complete text fallback");
|
|
998
|
+
pendingBlockFallback = orderedBlockDeliveryPlan;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
let messages;
|
|
1003
|
+
if (pendingBlockFallback) messages = pendingBlockFallback.fallbackMessages;
|
|
1004
|
+
else {
|
|
1005
|
+
let resolvedChunks;
|
|
1006
|
+
if (opts.textIsSlackPlainText) resolvedChunks = trimmedMessage ? chunkTextForOutbound(trimmedMessage, textChunkLimit, { preserveWhitespace: true }) : [];
|
|
1007
|
+
else if (opts.textIsSlackMrkdwn) resolvedChunks = resolveTextChunksWithFallback(trimmedMessage, chunkSlackMrkdwnText(trimmedMessage, textChunkLimit));
|
|
1008
|
+
else {
|
|
1009
|
+
const tableMode = resolveMarkdownTableMode({
|
|
1010
|
+
cfg,
|
|
1011
|
+
channel: "slack",
|
|
1012
|
+
...account.accountId ? { accountId: account.accountId } : {}
|
|
1013
|
+
});
|
|
1014
|
+
const chunkMode = resolveChunkMode(cfg, "slack", account.accountId);
|
|
1015
|
+
const chunks = (chunkMode === "newline" ? chunkMarkdownTextWithMode(trimmedMessage, textChunkLimit, chunkMode) : [trimmedMessage]).flatMap((markdown) => markdownToSlackMrkdwnChunks(markdown, textChunkLimit, { tableMode }));
|
|
1016
|
+
resolvedChunks = resolveTextChunksWithFallback(trimmedMessage, chunks);
|
|
1017
|
+
}
|
|
1018
|
+
const mediaMaxBytes = opts.mediaMaxBytes ?? (typeof account.config.mediaMaxMb === "number" ? account.config.mediaMaxMb * 1024 * 1024 : void 0);
|
|
1019
|
+
let chunksToPost;
|
|
1020
|
+
if (opts.mediaUrl) {
|
|
1021
|
+
const [firstChunk, ...rest] = resolvedChunks;
|
|
1022
|
+
lastMessageId = await uploadSlackFile({
|
|
1023
|
+
client: delivery.upload?.client ?? client,
|
|
1024
|
+
completionClient: client,
|
|
1025
|
+
channelId,
|
|
1026
|
+
mediaUrl: opts.mediaUrl,
|
|
1027
|
+
mediaAccess: opts.mediaAccess,
|
|
1028
|
+
uploadFileName: opts.uploadFileName,
|
|
1029
|
+
uploadTitle: opts.uploadTitle,
|
|
1030
|
+
mediaLocalRoots: opts.mediaLocalRoots,
|
|
1031
|
+
mediaReadFile: opts.mediaReadFile,
|
|
1032
|
+
caption: firstChunk,
|
|
1033
|
+
threadTs: opts.threadTs,
|
|
1034
|
+
maxBytes: mediaMaxBytes,
|
|
1035
|
+
...opts.forceDocument ? { optimizeImages: false } : {},
|
|
1036
|
+
onPlatformSendDispatch: dispatchOnce,
|
|
1037
|
+
assertDirectAdapterHandoff: opts.assertDirectAdapterHandoff,
|
|
1038
|
+
...delivery.upload ? { auditContext: delivery.upload.auditContext } : {}
|
|
1039
|
+
});
|
|
1040
|
+
await reportDelivery(createSlackSendResult(lastMessageId, channelId, "media", normalizeSlackThreadTsCandidate(opts.threadTs)));
|
|
1041
|
+
chunksToPost = rest;
|
|
1042
|
+
} else chunksToPost = resolvedChunks.length ? resolvedChunks : [""];
|
|
1043
|
+
messages = chunksToPost.map((text) => opts.textIsSlackPlainText ? {
|
|
1044
|
+
text,
|
|
1045
|
+
mrkdwn: false
|
|
1046
|
+
} : { text });
|
|
1047
|
+
}
|
|
1048
|
+
let questionDelivery;
|
|
1049
|
+
for (const [partIndex, part] of messages.entries()) {
|
|
1050
|
+
const carriesPrimaryMessageOptions = partIndex === 0 && !opts.mediaUrl;
|
|
1051
|
+
const baseMetadata = carriesPrimaryMessageOptions ? opts.metadata : void 0;
|
|
1052
|
+
const metadata = opts.mediaUrl ? baseMetadata : withSlackDeliveryMetadata(baseMetadata, {
|
|
1053
|
+
queueId: opts.deliveryQueueId,
|
|
1054
|
+
channelId,
|
|
1055
|
+
threadTs: opts.threadTs,
|
|
1056
|
+
partIndex,
|
|
1057
|
+
partCount: messages.length
|
|
1048
1058
|
});
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1059
|
+
if (partIndex === 0 && !opts.mediaUrl) await dispatchOnce();
|
|
1060
|
+
const partDelivery = await postPart({
|
|
1061
|
+
...part,
|
|
1062
|
+
replyBroadcast: carriesPrimaryMessageOptions ? opts.replyBroadcast : void 0,
|
|
1063
|
+
metadata
|
|
1064
|
+
});
|
|
1065
|
+
if (pendingBlockFallback && partDelivery.meta?.slackQuestionActionIds.length) questionDelivery = partDelivery;
|
|
1053
1066
|
}
|
|
1067
|
+
const deliveredThreadTs = canonicalDeliveredThreadTs ?? normalizeSlackThreadTsCandidate(opts.threadTs);
|
|
1068
|
+
return {
|
|
1069
|
+
messageId: lastMessageId,
|
|
1070
|
+
channelId: deliveredChannelId,
|
|
1071
|
+
threadTs: deliveredThreadTs,
|
|
1072
|
+
...questionDelivery?.meta ? { meta: {
|
|
1073
|
+
...questionDelivery.meta,
|
|
1074
|
+
slackQuestionMessageId: questionDelivery.messageId
|
|
1075
|
+
} } : {},
|
|
1076
|
+
receipt: createSlackSendReceiptFromResults(deliveredResults, deliveredThreadTs)
|
|
1077
|
+
};
|
|
1078
|
+
} catch (err) {
|
|
1079
|
+
throw enrichSlackWebApiError(err);
|
|
1054
1080
|
}
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
if (
|
|
1058
|
-
|
|
1059
|
-
const resolvedChunks = resolveSlackTextChunks({
|
|
1060
|
-
cfg,
|
|
1061
|
-
accountId: account.accountId,
|
|
1062
|
-
text: trimmedMessage,
|
|
1063
|
-
chunkLimit: textChunkLimit,
|
|
1064
|
-
...opts.textIsSlackMrkdwn ? { textIsSlackMrkdwn: true } : {},
|
|
1065
|
-
...opts.textIsSlackPlainText ? { preservePlainText: true } : {}
|
|
1066
|
-
});
|
|
1067
|
-
const mediaMaxBytes = opts.mediaMaxBytes ?? (typeof account.config.mediaMaxMb === "number" ? account.config.mediaMaxMb * 1024 * 1024 : void 0);
|
|
1068
|
-
let chunksToPost;
|
|
1069
|
-
if (opts.mediaUrl) {
|
|
1070
|
-
const [firstChunk, ...rest] = resolvedChunks;
|
|
1071
|
-
lastMessageId = await uploadSlackFile({
|
|
1072
|
-
client: delivery.upload?.client ?? client,
|
|
1073
|
-
completionClient: client,
|
|
1074
|
-
channelId,
|
|
1075
|
-
mediaUrl: opts.mediaUrl,
|
|
1076
|
-
mediaAccess: opts.mediaAccess,
|
|
1077
|
-
uploadFileName: opts.uploadFileName,
|
|
1078
|
-
uploadTitle: opts.uploadTitle,
|
|
1079
|
-
mediaLocalRoots: opts.mediaLocalRoots,
|
|
1080
|
-
mediaReadFile: opts.mediaReadFile,
|
|
1081
|
-
caption: firstChunk,
|
|
1082
|
-
threadTs: opts.threadTs,
|
|
1083
|
-
maxBytes: mediaMaxBytes,
|
|
1084
|
-
...opts.forceDocument ? { optimizeImages: false } : {},
|
|
1085
|
-
onPlatformSendDispatch: dispatchOnce,
|
|
1086
|
-
assertDirectAdapterHandoff: opts.assertDirectAdapterHandoff,
|
|
1087
|
-
...delivery.upload ? { auditContext: delivery.upload.auditContext } : {}
|
|
1088
|
-
});
|
|
1089
|
-
await reportDelivery(createSlackSendResult(lastMessageId, channelId, "media", normalizeSlackThreadTsCandidate(opts.threadTs)));
|
|
1090
|
-
chunksToPost = rest;
|
|
1091
|
-
} else chunksToPost = resolvedChunks.length ? resolvedChunks : [""];
|
|
1092
|
-
messages = chunksToPost.map((text) => opts.textIsSlackPlainText ? {
|
|
1093
|
-
text,
|
|
1094
|
-
mrkdwn: false
|
|
1095
|
-
} : { text });
|
|
1096
|
-
}
|
|
1097
|
-
let questionDelivery;
|
|
1098
|
-
for (const [partIndex, part] of messages.entries()) {
|
|
1099
|
-
const carriesPrimaryMessageOptions = partIndex === 0 && !opts.mediaUrl;
|
|
1100
|
-
const baseMetadata = carriesPrimaryMessageOptions ? opts.metadata : void 0;
|
|
1101
|
-
const metadata = opts.mediaUrl ? baseMetadata : withSlackDeliveryMetadata(baseMetadata, {
|
|
1102
|
-
queueId: opts.deliveryQueueId,
|
|
1103
|
-
channelId,
|
|
1104
|
-
threadTs: opts.threadTs,
|
|
1105
|
-
partIndex,
|
|
1106
|
-
partCount: messages.length
|
|
1107
|
-
});
|
|
1108
|
-
if (partIndex === 0 && !opts.mediaUrl) await dispatchOnce();
|
|
1109
|
-
const partDelivery = await postPart({
|
|
1110
|
-
...part,
|
|
1111
|
-
replyBroadcast: carriesPrimaryMessageOptions ? opts.replyBroadcast : void 0,
|
|
1112
|
-
metadata
|
|
1113
|
-
});
|
|
1114
|
-
if (pendingBlockFallback && partDelivery.meta?.slackQuestionActionIds.length) questionDelivery = partDelivery;
|
|
1115
|
-
}
|
|
1116
|
-
const deliveredThreadTs = canonicalDeliveredThreadTs ?? normalizeSlackThreadTsCandidate(opts.threadTs);
|
|
1117
|
-
return {
|
|
1118
|
-
messageId: lastMessageId,
|
|
1119
|
-
channelId: deliveredChannelId,
|
|
1120
|
-
threadTs: deliveredThreadTs,
|
|
1121
|
-
...questionDelivery?.meta ? { meta: {
|
|
1122
|
-
...questionDelivery.meta,
|
|
1123
|
-
slackQuestionMessageId: questionDelivery.messageId
|
|
1124
|
-
} } : {},
|
|
1125
|
-
receipt: createSlackSendReceiptFromResults(deliveredResults, deliveredThreadTs)
|
|
1126
|
-
};
|
|
1081
|
+
});
|
|
1082
|
+
const threadTs = sent.threadTs ?? normalizeSlackThreadTsCandidate(opts.threadTs);
|
|
1083
|
+
if (threadTs && sent.channelId && account.accountId) recordSlackThreadParticipation(account.accountId, sent.channelId, threadTs, { teamId: delivery.teamId });
|
|
1084
|
+
return sent;
|
|
1127
1085
|
}
|
|
1128
|
-
|
|
1129
|
-
export { clearSlackThreadParticipationCache as a, hasSlackThreadParticipationWithPersistence as c, requireSlackPostMessageTimestamp as d, buildSlackMessageIdentityPayload as f, chunkSlackTextAtHardLimit as h, clearSlackThreadFailureNotice as i, recordSlackThreadFailureNotice as l, buildSlackNativeDataDeliveryPlan as m, send_exports as n, hasSlackThreadFailureNotice as o, hasSlackMessageIdentity as p, setSlackDefaultSendIdentity as r, hasSlackThreadParticipation as s, sendMessageSlack as t, recordSlackThreadParticipation as u };
|
|
1086
|
+
export { clearSlackThreadFailureNotice as a, hasSlackThreadParticipation as c, recordSlackThreadParticipation as d, requireSlackPostMessageTimestamp as f, chunkSlackTextAtHardLimit as g, buildSlackNativeDataDeliveryPlan as h, updateMessageSlack as i, hasSlackThreadParticipationWithPersistence as l, hasSlackMessageIdentity as m, send_exports as n, clearSlackThreadParticipationCache as o, buildSlackMessageIdentityPayload as p, setSlackDefaultSendIdentity as r, hasSlackThreadFailureNotice as s, sendMessageSlack as t, recordSlackThreadFailureNotice as u };
|