@openclaw/slack 2026.8.1-beta.2 → 2026.8.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/account-configured-sUohAxZr.js +33 -0
- package/dist/account-inspect-CN2hBsim.js +87 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-CK4AVI2_.js → accounts-Dm_H77gH.js} +12 -11
- package/dist/{accounts.runtime-Cb7QwWBz.js → accounts.runtime-DRuEK6mL.js} +1 -1
- package/dist/{action-runtime-BkGe7ny_.js → action-runtime-044ldvNL.js} +80 -79
- package/dist/action-runtime.runtime-BL3KzX13.js +2 -0
- package/dist/{actions-BTDXwwE3.js → actions-BI7JkfVm.js} +273 -263
- package/dist/api.js +14 -14
- package/dist/{approval-handler.runtime-CJaNzAq2.js → approval-handler.runtime-DYv0UIZS.js} +53 -174
- package/dist/{channel-D_tovcUL.js → channel-1vIJOzPx.js} +134 -160
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-B9MSdoGN.js → channel-type-DlFSKeIZ.js} +3 -7
- package/dist/{channel.setup-Bch9dYmA.js → channel.setup-ofDi3_Pu.js} +34 -49
- package/dist/{config-schema-xto5jFIx.js → config-schema-BVIMyiDN.js} +42 -19
- package/dist/configured-state.js +34 -0
- package/dist/conversation-binding-route-DFVLUdYF.js +115 -0
- package/dist/{directory-config-CNBz8lJa.js → directory-config-DqfQ42OV.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-CFKUtW9E.js → directory-live-BPaNHjmP.js} +2 -2
- package/dist/{group-policy-c4RP9bjc.js → group-policy-BdwszjYn.js} +625 -773
- package/dist/{message-tool-api-BykQB4AU.js → message-tool-api-CJ0kjcg5.js} +23 -5
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-1nF1NtqT.js → monitor-Dq5Cmrvp.js} +3 -3
- package/dist/{outbound-adapter-S81tsswN.js → outbound-adapter-DYaI8ThX.js} +101 -66
- package/dist/{pipeline.runtime-BvYsM5JO.js → pipeline.runtime-Bd22U0ga.js} +494 -474
- package/dist/{policy-TapwbeaT.js → policy-CtQVbde1.js} +2 -1
- package/dist/{probe-HoEg_WxB.js → probe-0usmAb0i.js} +209 -22
- package/dist/{provider-CDNvBXUi.js → provider-CN_8hFv2.js} +296 -178
- package/dist/{relay-source-C9leF11u.js → relay-source-BNGpsdwV.js} +1 -1
- package/dist/{replies-CeOfv82I.js → replies-BSiRQOJ1.js} +48 -27
- package/dist/{resolve-channels-CNPrxaXY.js → resolve-channels-Czheznc8.js} +1 -1
- package/dist/{resolve-users-Dzomuwnr.js → resolve-users-BAOlNimr.js} +1 -1
- package/dist/runtime-api.js +11 -11
- package/dist/{scopes-cYXKkrRD.js → scopes-COSlmhnH.js} +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-Nor0iBwY.js → send-DS9ICrBI.js} +88 -100
- package/dist/send-results-eeOu_HYm.js +23 -0
- package/dist/{send.runtime-BmgNe6S9.js → send.runtime-D_Bb6IuH.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-CbX1-Knh.js → setup-surface-BGnd2pSe.js} +6 -6
- package/dist/{shared-zdT5AMp-.js → shared-D5B-5hBg.js} +35 -9
- package/dist/{slash-dispatch.runtime-Bnr9GR1S.js → slash-dispatch.runtime-CilDmI0c.js} +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/bolt/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/bolt/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/bolt/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/bolt/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/bolt/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/bolt/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/README.md +2 -0
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/package.json +1 -1
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/README.md +2 -0
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/package.json +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/socket-mode/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/socket-mode/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/socket-mode/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/socket-mode/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/socket-mode/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/socket-mode/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/socket-mode/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/socket-mode/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/socket-mode/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/web-api/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/web-api/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/web-api/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +57 -7
- package/package.json +9 -9
- package/dist/account-configured-BwfXBo_F.js +0 -14
- package/dist/account-inspect-Drw2gAiN.js +0 -89
- package/dist/account-reply-mode-DrUXogvO.js +0 -14
- package/dist/action-runtime.runtime-D9I6uc0Q.js +0 -2
- package/dist/actions.runtime-DLFyUkvg.js +0 -2
- package/dist/block-text-YtiNkqmx.js +0 -79
- package/dist/runtime-api-Cj9nxBNv.js +0 -10
- package/node_modules/p-map/index.d.ts +0 -155
- package/node_modules/p-map/index.js +0 -285
- package/node_modules/p-map/license +0 -9
- package/node_modules/p-map/package.json +0 -57
- package/node_modules/p-map/readme.md +0 -190
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
- package/dist/{security-audit-DR097212.js → security-audit-B_yKr7MW.js} +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as formatUnknownError, m as SLACK_SOCKET_RECONNECT_POLICY } from "./provider-CN_8hFv2.js";
|
|
2
2
|
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { computeBackoff, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
4
4
|
import { isIP } from "node:net";
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as createSlackResponseUrlBudget, i as SlackResponseAlreadyReportedError } from "./provider-
|
|
1
|
+
import { C as isSlackNativeResponseUrlRejection, M as SLACK_TEXT_LIMIT, S as isSlackInvalidBlocksResponse, T as buildSlackBlocksFallbackText, Z as markdownToSlackMrkdwnChunks, b as hasSlackNativeDataBlock, d as resolveSlackReplyBlockResolution, f as resolveSlackReplyBlocks, l as hasSlackReplyStructuredContent, v as buildSlackNativeDataAccessibilityText } from "./group-policy-BdwszjYn.js";
|
|
2
|
+
import { h as chunkSlackTextAtHardLimit, m as buildSlackNativeDataDeliveryPlan, r as sendMessageSlack } from "./send-DS9ICrBI.js";
|
|
3
|
+
import { a as createSlackResponseUrlBudget, i as SlackResponseAlreadyReportedError } from "./provider-CN_8hFv2.js";
|
|
4
|
+
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
5
|
+
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
4
6
|
import { createReplyReferencePlanner } from "openclaw/plugin-sdk/reply-reference";
|
|
7
|
+
import { deliverTextOrMediaReply, getReplyPayloadTtsSupplement, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
5
8
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
6
9
|
import { SILENT_REPLY_TOKEN, chunkMarkdownTextWithMode, isSilentReplyText } from "openclaw/plugin-sdk/reply-chunking";
|
|
7
|
-
import { deliverTextOrMediaReply, getReplyPayloadTtsSupplement, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
8
10
|
import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
|
|
9
11
|
import { createChannelPartialDeliveryError } from "openclaw/plugin-sdk/channel-inbound";
|
|
10
12
|
import { buildCanonicalSentMessageHookContext, createInternalHookEvent, fireAndForgetHook, toInternalMessageSentContext, toPluginMessageContext, toPluginMessageSentEvent, triggerInternalHook } from "openclaw/plugin-sdk/hook-runtime";
|
|
@@ -113,6 +115,15 @@ function compactSlackResponseUrlFallback(messages) {
|
|
|
113
115
|
function readSlackReplyBlocks(payload) {
|
|
114
116
|
return resolveSlackReplyBlocks(payload);
|
|
115
117
|
}
|
|
118
|
+
function sanitizeSlackMonitorReplyPayload(payload) {
|
|
119
|
+
if (payload.isReasoning === true || typeof payload.text !== "string") return payload.isReasoning === true ? null : payload;
|
|
120
|
+
const text = sanitizeAssistantVisibleText(payload.text);
|
|
121
|
+
if (text === payload.text) return payload;
|
|
122
|
+
return text || resolveSendableOutboundReplyParts(payload).hasMedia || hasSlackReplyStructuredContent(payload) ? {
|
|
123
|
+
...payload,
|
|
124
|
+
text: text || void 0
|
|
125
|
+
} : null;
|
|
126
|
+
}
|
|
116
127
|
function resolveSlackMediaHookSpokenText(payload) {
|
|
117
128
|
return (getReplyPayloadTtsSupplement(payload)?.spokenText ?? payload.spokenText)?.trim() || void 0;
|
|
118
129
|
}
|
|
@@ -121,27 +132,6 @@ function resolveDeliveredSlackReplyThreadTs(params) {
|
|
|
121
132
|
}
|
|
122
133
|
async function deliverReplies(params) {
|
|
123
134
|
let latestResult;
|
|
124
|
-
const sendReply = async (input) => {
|
|
125
|
-
return await sendMessageSlack(params.target, input.text, {
|
|
126
|
-
cfg: params.cfg,
|
|
127
|
-
token: params.token,
|
|
128
|
-
threadTs: input.threadTs,
|
|
129
|
-
accountId: params.accountId,
|
|
130
|
-
...input.mediaUrl ? { mediaUrl: input.mediaUrl } : {},
|
|
131
|
-
...input.blocks ? { blocks: input.blocks } : {},
|
|
132
|
-
...input.authoredTextPlacement ? { authoredTextPlacement: input.authoredTextPlacement } : {},
|
|
133
|
-
...Object.hasOwn(input, "nativeDataFallbackBaseText") ? { nativeDataFallbackBaseText: input.nativeDataFallbackBaseText } : {},
|
|
134
|
-
...input.textIsSlackMrkdwn ? { textIsSlackMrkdwn: true } : {},
|
|
135
|
-
...input.textIsSlackPlainText ? { textIsSlackPlainText: true } : {},
|
|
136
|
-
...params.eventScope ? {
|
|
137
|
-
eventScope: params.eventScope,
|
|
138
|
-
textLimit: params.textLimit,
|
|
139
|
-
...params.mediaMaxBytes !== void 0 ? { mediaMaxBytes: params.mediaMaxBytes } : {}
|
|
140
|
-
} : {},
|
|
141
|
-
...params.identity ? { identity: params.identity } : {},
|
|
142
|
-
...params.metadata ? { metadata: params.metadata } : {}
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
135
|
for (const payload of params.replies) {
|
|
146
136
|
if (payload.isReasoning === true) continue;
|
|
147
137
|
const threadTs = resolveDeliveredSlackReplyThreadTs({
|
|
@@ -153,6 +143,31 @@ async function deliverReplies(params) {
|
|
|
153
143
|
const textRaw = reply.hasText && !isSilentReplyText(reply.trimmedText, SILENT_REPLY_TOKEN) ? reply.trimmedText : void 0;
|
|
154
144
|
const { authoredTextPlacement, segments } = resolveSlackReplyBlockResolution(payload, { materializeAuthoredText: !reply.hasMedia && hasSlackReplyStructuredContent(payload) });
|
|
155
145
|
if (!textRaw && !reply.hasMedia && segments.length === 0) continue;
|
|
146
|
+
const acceptedResults = [];
|
|
147
|
+
const sendReply = async (input) => {
|
|
148
|
+
return await sendMessageSlack(params.target, input.text, {
|
|
149
|
+
cfg: params.cfg,
|
|
150
|
+
token: params.token,
|
|
151
|
+
threadTs: input.threadTs,
|
|
152
|
+
accountId: params.accountId,
|
|
153
|
+
onDeliveryResult: (result) => {
|
|
154
|
+
acceptedResults.push(result);
|
|
155
|
+
},
|
|
156
|
+
...input.mediaUrl ? { mediaUrl: input.mediaUrl } : {},
|
|
157
|
+
...input.blocks ? { blocks: input.blocks } : {},
|
|
158
|
+
...input.authoredTextPlacement ? { authoredTextPlacement: input.authoredTextPlacement } : {},
|
|
159
|
+
...Object.hasOwn(input, "nativeDataFallbackBaseText") ? { nativeDataFallbackBaseText: input.nativeDataFallbackBaseText } : {},
|
|
160
|
+
...input.textIsSlackMrkdwn ? { textIsSlackMrkdwn: true } : {},
|
|
161
|
+
...input.textIsSlackPlainText ? { textIsSlackPlainText: true } : {},
|
|
162
|
+
...params.eventScope ? {
|
|
163
|
+
eventScope: params.eventScope,
|
|
164
|
+
textLimit: params.textLimit,
|
|
165
|
+
...params.mediaMaxBytes !== void 0 ? { mediaMaxBytes: params.mediaMaxBytes } : {}
|
|
166
|
+
} : {},
|
|
167
|
+
...params.identity ? { identity: params.identity } : {},
|
|
168
|
+
...params.metadata ? { metadata: params.metadata } : {}
|
|
169
|
+
});
|
|
170
|
+
};
|
|
156
171
|
const emitSent = (content, result) => {
|
|
157
172
|
if (params.deferMessageSentHooks) return;
|
|
158
173
|
emitSlackMessageSentHooks({
|
|
@@ -250,7 +265,13 @@ async function deliverReplies(params) {
|
|
|
250
265
|
}
|
|
251
266
|
} catch (error) {
|
|
252
267
|
emitFailed(hookParts.join("\n\n") || textRaw || spokenText || "", error);
|
|
253
|
-
throw error;
|
|
268
|
+
if (acceptedResults.length === 0) throw error;
|
|
269
|
+
const receipt = createMessageReceiptFromOutboundResults({ results: acceptedResults });
|
|
270
|
+
throw createChannelPartialDeliveryError(error, {
|
|
271
|
+
messageIds: receipt.platformMessageIds,
|
|
272
|
+
receipt,
|
|
273
|
+
visibleReplySent: true
|
|
274
|
+
});
|
|
254
275
|
}
|
|
255
276
|
if (delivered) {
|
|
256
277
|
emitSent(hookParts.join("\n\n") || textRaw || spokenText || "", reply.hasMedia ? void 0 : lastResult);
|
|
@@ -500,4 +521,4 @@ async function deliverSlackSlashReplies(params) {
|
|
|
500
521
|
}
|
|
501
522
|
}
|
|
502
523
|
//#endregion
|
|
503
|
-
export { resolveDeliveredSlackReplyThreadTs as a, readSlackReplyBlocks as i, deliverReplies as n, resolveSlackThreadTs as o, deliverSlackSlashReplies as r,
|
|
524
|
+
export { resolveDeliveredSlackReplyThreadTs as a, emitSlackMessageSentHooks as c, readSlackReplyBlocks as i, deliverReplies as n, resolveSlackThreadTs as o, deliverSlackSlashReplies as r, sanitizeSlackMonitorReplyPayload as s, createSlackReplyDeliveryPlan as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { a as parseSlackTarget, n as formatSlackTarget } from "./target-parsing-BnMD2ZqZ.js";
|
|
3
|
-
import {
|
|
3
|
+
import { h as createSlackLookupClient } from "./probe-0usmAb0i.js";
|
|
4
4
|
import { t as collectSlackCursorPages } from "./cursor-pages-eX7p8Wwt.js";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { resolveDirectoryAllowlistEntries } from "openclaw/plugin-sdk/directory-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { a as parseSlackTarget, n as formatSlackTarget } from "./target-parsing-BnMD2ZqZ.js";
|
|
3
|
-
import {
|
|
3
|
+
import { h as createSlackLookupClient } from "./probe-0usmAb0i.js";
|
|
4
4
|
import { t as collectSlackCursorPages } from "./cursor-pages-eX7p8Wwt.js";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { resolveDirectoryAllowlistEntries } from "openclaw/plugin-sdk/directory-runtime";
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as registerSlackPluginHttpRoutes } from "./plugin-routes-CLp4obpN.js";
|
|
2
|
-
import { a as resolveSlackAccount, d as resolveSlackAppToken, f as resolveSlackBotToken, i as resolveDefaultSlackAccountId, n as listSlackAccountIds, t as listEnabledSlackAccounts } from "./accounts-
|
|
3
|
-
import { i as resolveSlackGroupToolPolicy, r as resolveSlackGroupRequireMention } from "./group-policy-
|
|
4
|
-
import { t as probeSlack } from "./probe-
|
|
2
|
+
import { a as resolveSlackAccount, d as resolveSlackAppToken, f as resolveSlackBotToken, i as resolveDefaultSlackAccountId, n as listSlackAccountIds, t as listEnabledSlackAccounts } from "./accounts-Dm_H77gH.js";
|
|
3
|
+
import { i as resolveSlackGroupToolPolicy, r as resolveSlackGroupRequireMention } from "./group-policy-BdwszjYn.js";
|
|
4
|
+
import { t as probeSlack } from "./probe-0usmAb0i.js";
|
|
5
5
|
import { r as setSlackRuntime } from "./runtime-JSVZSWAj.js";
|
|
6
|
-
import {
|
|
7
|
-
import { r as sendMessageSlack } from "./send-
|
|
8
|
-
import { t as resolveSlackChannelAllowlist } from "./resolve-channels-
|
|
9
|
-
import { t as resolveSlackUserAllowlist } from "./resolve-users-
|
|
10
|
-
import { t as monitorSlackProvider } from "./provider-
|
|
11
|
-
import { n as slackActionRuntime, t as handleSlackAction } from "./action-runtime-
|
|
12
|
-
import { n as listSlackDirectoryGroupsLive, r as listSlackDirectoryPeersLive } from "./directory-live-
|
|
13
|
-
import "./monitor-
|
|
6
|
+
import { c as listSlackPins, d as reactSlackMessage, f as readSlackMessages, g as unpinSlackMessage, h as sendSlackMessage, i as editSlackMessage, l as listSlackReactions, m as removeSlackReaction, n as deleteSlackMessage, o as getSlackMemberInfo, p as removeOwnSlackReactions, s as listSlackEmojis, u as pinSlackMessage } from "./actions-BI7JkfVm.js";
|
|
7
|
+
import { r as sendMessageSlack } from "./send-DS9ICrBI.js";
|
|
8
|
+
import { t as resolveSlackChannelAllowlist } from "./resolve-channels-Czheznc8.js";
|
|
9
|
+
import { t as resolveSlackUserAllowlist } from "./resolve-users-BAOlNimr.js";
|
|
10
|
+
import { t as monitorSlackProvider } from "./provider-CN_8hFv2.js";
|
|
11
|
+
import { n as slackActionRuntime, t as handleSlackAction } from "./action-runtime-044ldvNL.js";
|
|
12
|
+
import { n as listSlackDirectoryGroupsLive, r as listSlackDirectoryPeersLive } from "./directory-live-BPaNHjmP.js";
|
|
13
|
+
import "./monitor-Dq5Cmrvp.js";
|
|
14
14
|
export { deleteSlackMessage, editSlackMessage, getSlackMemberInfo, handleSlackAction, listEnabledSlackAccounts, listSlackAccountIds, listSlackDirectoryGroupsLive, listSlackDirectoryPeersLive, listSlackEmojis, listSlackPins, listSlackReactions, monitorSlackProvider, pinSlackMessage, probeSlack, reactSlackMessage, readSlackMessages, registerSlackPluginHttpRoutes, removeOwnSlackReactions, removeSlackReaction, resolveDefaultSlackAccountId, resolveSlackAccount, resolveSlackAppToken, resolveSlackBotToken, resolveSlackChannelAllowlist, resolveSlackGroupRequireMention, resolveSlackGroupToolPolicy, resolveSlackUserAllowlist, sendMessageSlack, sendSlackMessage, setSlackRuntime, slackActionRuntime, unpinSlackMessage };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as createSlackReadClient, o as formatSlackError } from "./probe-0usmAb0i.js";
|
|
2
2
|
import { isRecord, normalizeOptionalString, normalizeStringEntries, sortUniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
//#region extensions/slack/src/scopes.ts
|
|
4
4
|
function collectScopes(value, into) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as collectSlackSecurityAuditFindings } from "./security-audit-
|
|
1
|
+
import { t as collectSlackSecurityAuditFindings } from "./security-audit-B_yKr7MW.js";
|
|
2
2
|
export { collectSlackSecurityAuditFindings };
|
|
@@ -1,50 +1,41 @@
|
|
|
1
|
-
import { a as resolveSlackAccount, l as resolveSlackOperationToken } from "./accounts-
|
|
1
|
+
import { a as resolveSlackAccount, l as resolveSlackOperationToken } from "./accounts-Dm_H77gH.js";
|
|
2
2
|
import { a as parseSlackTarget, t as canonicalizeSlackApiTargetId } from "./target-parsing-BnMD2ZqZ.js";
|
|
3
|
-
import { A as
|
|
3
|
+
import { A as SLACK_MESSAGE_TEXT_HARD_LIMIT, D as renderSlackBlockFallbackText, E as buildSlackCompleteBlocksFallbackText, L as truncateSlackText, M as SLACK_TEXT_LIMIT, R as truncateSlackTextByUtf8Bytes, X as chunkSlackMrkdwnText, Z as markdownToSlackMrkdwnChunks, _ as appendSlackNativeDataPlainTextFallback, b as hasSlackNativeDataBlock, c as assertSlackDetachedTargetAllowed, j as SLACK_MESSAGE_TEXT_RECOMMENDED_LIMIT, k as SLACK_EDIT_TEXT_MAX_BYTES, q as resolveSlackQuestionActionIds, st as validateSlackBlocksArray, v as buildSlackNativeDataAccessibilityText, w as stripSlackNativeDataBlocks, x as isSlackInvalidBlocksError, y as createSlackNativeDataBaseTextConsumer, z as SLACK_QUESTION_FINALIZATION_BLOCKS } from "./group-policy-BdwszjYn.js";
|
|
4
4
|
import { n as resolveSlackThreadTsValue, t as normalizeSlackThreadTsCandidate } from "./thread-ts-DUGhaYKq.js";
|
|
5
|
-
import {
|
|
5
|
+
import { S as getSlackWriteClient, g as createSlackReadClient, o as formatSlackError, v as createSlackTokenCacheKey } from "./probe-0usmAb0i.js";
|
|
6
6
|
import { t as getOptionalSlackRuntime } from "./runtime-JSVZSWAj.js";
|
|
7
|
-
import {
|
|
8
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
+
import { isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
8
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
|
-
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
9
|
+
import { logVerbose, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
10
|
+
import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
|
|
11
11
|
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
12
|
-
import {
|
|
12
|
+
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
13
|
+
import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
14
|
+
import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
13
15
|
import { createHash, createHmac } from "node:crypto";
|
|
14
16
|
import { withTrustedEnvProxyGuardedFetchMode } from "openclaw/plugin-sdk/fetch-runtime";
|
|
15
17
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
16
18
|
import { PlatformMessageNotDispatchedError, extractErrorCode, readErrorName } from "openclaw/plugin-sdk/error-runtime";
|
|
17
19
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
18
|
-
import {
|
|
19
|
-
import { chunkMarkdownTextWithMode, isSilentReplyText, resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
|
|
20
|
-
import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
20
|
+
import { chunkMarkdownTextWithMode, resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
|
|
21
21
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
22
22
|
import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
|
|
23
23
|
import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
|
|
24
|
+
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
|
|
25
|
+
import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
24
26
|
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
25
27
|
import { createPersistentDedupeCache } from "openclaw/plugin-sdk/dedupe-runtime";
|
|
26
28
|
import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
|
|
27
29
|
//#region extensions/slack/src/native-data-fallback.ts
|
|
28
30
|
const SLACK_SECTION_PLAIN_TEXT_MAX = 3e3;
|
|
29
31
|
const SLACK_EMPTY_BLOCK_FALLBACK = "Shared a Block Kit message";
|
|
30
|
-
function sliceSlackTextChunk(text, start, limit) {
|
|
31
|
-
return sliceUtf16Safe(text, start, Math.min(text.length, start + limit)) || Array.from(text.slice(start))[0] || "";
|
|
32
|
-
}
|
|
33
32
|
function chunkSlackTextAtHardLimit(text, limit = SLACK_MESSAGE_TEXT_HARD_LIMIT) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
let offset = 0;
|
|
37
|
-
while (offset < text.length) {
|
|
38
|
-
const chunk = sliceSlackTextChunk(text, offset, effectiveLimit);
|
|
39
|
-
if (!chunk) throw new Error("Slack plain-text fallback chunking made no progress.");
|
|
40
|
-
chunks.push(chunk);
|
|
41
|
-
offset += chunk.length;
|
|
42
|
-
}
|
|
43
|
-
return chunks;
|
|
33
|
+
if (!text) return [];
|
|
34
|
+
return chunkTextForOutbound(text, Math.max(1, Math.floor(limit)), { preserveWhitespace: true });
|
|
44
35
|
}
|
|
45
36
|
function fitsSlackTextLimit(text, limit) {
|
|
46
37
|
if (text.length <= limit) return true;
|
|
47
|
-
return
|
|
38
|
+
return truncateUtf16Safe(text, limit).length === text.length;
|
|
48
39
|
}
|
|
49
40
|
function buildPlainTextBlocks(text, textLimit) {
|
|
50
41
|
return chunkSlackTextAtHardLimit(text, Math.min(textLimit, SLACK_SECTION_PLAIN_TEXT_MAX)).map((chunk, index) => {
|
|
@@ -154,6 +145,7 @@ function hasCustomIdentity$1(identity) {
|
|
|
154
145
|
async function postSlackMessageWithIdentityFallback(params) {
|
|
155
146
|
const { basePayload, identity, post } = params;
|
|
156
147
|
try {
|
|
148
|
+
if (!identity) return await post(basePayload);
|
|
157
149
|
if (identity?.iconUrl) return await post({
|
|
158
150
|
...basePayload,
|
|
159
151
|
...identity.username ? { username: identity.username } : {},
|
|
@@ -239,6 +231,16 @@ const SLACK_DNS_RETRY_CODES = /* @__PURE__ */ new Set([
|
|
|
239
231
|
]);
|
|
240
232
|
const SLACK_DNS_RETRY_ATTEMPTS = 2;
|
|
241
233
|
const SLACK_DNS_RETRY_BASE_DELAY_MS = 250;
|
|
234
|
+
function rethrowSlackPermanentOutboundApiRejection(err) {
|
|
235
|
+
const rawData = isRecord(err) && err.code === "slack_webapi_platform_error" ? err.data : void 0;
|
|
236
|
+
const data = isRecord(rawData) ? rawData : void 0;
|
|
237
|
+
const code = data?.error;
|
|
238
|
+
if (data?.ok === false && (code === "messages_tab_disabled" || code === "account_inactive")) throw new PlatformMessageNotDispatchedError(`Slack outbound delivery rejected: ${code}`, {
|
|
239
|
+
cause: err,
|
|
240
|
+
retryable: false
|
|
241
|
+
});
|
|
242
|
+
throw err;
|
|
243
|
+
}
|
|
242
244
|
function readSlackRequestErrorCode(value) {
|
|
243
245
|
if (!value || typeof value !== "object") return;
|
|
244
246
|
const code = value.code;
|
|
@@ -262,11 +264,6 @@ function hasSlackDnsRequestSignal(err) {
|
|
|
262
264
|
}
|
|
263
265
|
return false;
|
|
264
266
|
}
|
|
265
|
-
function delaySlackDnsRetry(attempt) {
|
|
266
|
-
return new Promise((resolve) => {
|
|
267
|
-
setTimeout(resolve, SLACK_DNS_RETRY_BASE_DELAY_MS * Math.max(1, attempt));
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
267
|
function resolveSlackUploadTimeoutLogUrl(url) {
|
|
271
268
|
try {
|
|
272
269
|
return new URL(url).origin;
|
|
@@ -340,27 +337,43 @@ function resolveSlackUploadTransportPolicy(params) {
|
|
|
340
337
|
};
|
|
341
338
|
}
|
|
342
339
|
async function withSlackDnsRequestRetry(operation, fn) {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
340
|
+
return await retryAsync(fn, {
|
|
341
|
+
attempts: 3,
|
|
342
|
+
minDelayMs: 0,
|
|
343
|
+
shouldRetry: hasSlackDnsRequestSignal,
|
|
344
|
+
delayMs: ({ attempt }) => SLACK_DNS_RETRY_BASE_DELAY_MS * Math.max(1, attempt),
|
|
345
|
+
onRetry: ({ attempt }) => {
|
|
346
|
+
logVerbose(`slack send: retrying ${operation} after transient DNS request error (${attempt}/${SLACK_DNS_RETRY_ATTEMPTS})`);
|
|
347
|
+
},
|
|
348
|
+
sleep: (delayMs) => sleepWithAbort(delayMs)
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
function requireSlackPostMessageTimestamp(response) {
|
|
352
|
+
if (response.ok === false) throw new Error(`Slack chat.postMessage failed: ${formatSlackError(response.error, "unknown error")}`);
|
|
353
|
+
const timestamp = response.ts?.trim();
|
|
354
|
+
if (!timestamp) throw new Error("Slack chat.postMessage returned no message timestamp");
|
|
355
|
+
return timestamp;
|
|
351
356
|
}
|
|
352
357
|
async function postSlackMessageBestEffort(params) {
|
|
353
358
|
const basePayload = buildSlackPostMessagePayload(params);
|
|
354
359
|
const postChatMessage = params.client.chat.postMessage.bind(params.client.chat);
|
|
355
360
|
const post = async (payload, identity) => ({
|
|
356
|
-
response: await withSlackDnsRequestRetry("chat.postMessage", () => postChatMessage(payload)),
|
|
361
|
+
response: await withSlackDnsRequestRetry("chat.postMessage", () => postChatMessage(payload)).catch(rethrowSlackPermanentOutboundApiRejection),
|
|
357
362
|
identity
|
|
358
363
|
});
|
|
359
|
-
|
|
364
|
+
const posted = await postSlackMessageWithIdentityFallback({
|
|
360
365
|
basePayload,
|
|
361
366
|
identity: params.identity,
|
|
362
367
|
post
|
|
363
368
|
});
|
|
369
|
+
const timestamp = requireSlackPostMessageTimestamp(posted.response);
|
|
370
|
+
return {
|
|
371
|
+
...posted,
|
|
372
|
+
response: {
|
|
373
|
+
...posted.response,
|
|
374
|
+
ts: timestamp
|
|
375
|
+
}
|
|
376
|
+
};
|
|
364
377
|
}
|
|
365
378
|
async function uploadSlackFile(params) {
|
|
366
379
|
const { buffer, contentType, fileName } = await loadOutboundMediaFromUrl(params.mediaUrl, {
|
|
@@ -375,7 +388,7 @@ async function uploadSlackFile(params) {
|
|
|
375
388
|
const uploadUrlResp = await withSlackDnsRequestRetry("files.getUploadURLExternal", () => params.client.files.getUploadURLExternal({
|
|
376
389
|
filename: uploadFileName,
|
|
377
390
|
length: buffer.length
|
|
378
|
-
}));
|
|
391
|
+
})).catch(rethrowSlackPermanentOutboundApiRejection);
|
|
379
392
|
if (!uploadUrlResp.ok || !uploadUrlResp.upload_url || !uploadUrlResp.file_id) throw new Error(`Failed to get upload URL: ${uploadUrlResp.error ?? "unknown error"}`);
|
|
380
393
|
const uploadFileId = uploadUrlResp.file_id;
|
|
381
394
|
const uploadTransport = resolveSlackUploadTransportPolicy({
|
|
@@ -605,7 +618,7 @@ async function updateMessageSlack(params) {
|
|
|
605
618
|
}
|
|
606
619
|
function createSlackSendReceipt(params) {
|
|
607
620
|
return createMessageReceiptFromOutboundResults({
|
|
608
|
-
results: params.platformMessageIds.map((messageId) => messageId.trim()).filter((messageId) => messageId && messageId !== "unknown"
|
|
621
|
+
results: params.platformMessageIds.map((messageId) => messageId.trim()).filter((messageId) => messageId && messageId !== "unknown").map((messageId) => {
|
|
609
622
|
const result = {
|
|
610
623
|
channel: "slack",
|
|
611
624
|
messageId
|
|
@@ -617,6 +630,18 @@ function createSlackSendReceipt(params) {
|
|
|
617
630
|
threadId: params.threadTs
|
|
618
631
|
});
|
|
619
632
|
}
|
|
633
|
+
function createSlackSendReceiptFromResults(results, threadTs) {
|
|
634
|
+
const receipt = createMessageReceiptFromOutboundResults({
|
|
635
|
+
results,
|
|
636
|
+
threadId: threadTs
|
|
637
|
+
});
|
|
638
|
+
const thread = threadTs ? { threadId: threadTs } : {};
|
|
639
|
+
for (const [index, part] of receipt.parts.entries()) Object.assign(part, {
|
|
640
|
+
index,
|
|
641
|
+
...thread
|
|
642
|
+
});
|
|
643
|
+
return Object.assign(receipt, thread);
|
|
644
|
+
}
|
|
620
645
|
function resolveToken(params) {
|
|
621
646
|
const explicit = normalizeOptionalString(params.explicit);
|
|
622
647
|
if (explicit) return explicit;
|
|
@@ -658,7 +683,6 @@ function resolveSlackDelivery(params) {
|
|
|
658
683
|
credential: SLACK_ENTERPRISE_LISTENER_QUEUE_CREDENTIAL,
|
|
659
684
|
identity: normalizeSlackSendIdentity(params.opts.identity),
|
|
660
685
|
recipient: params.recipient,
|
|
661
|
-
requireMessageTimestamp: true,
|
|
662
686
|
teamId: params.eventScope.teamId,
|
|
663
687
|
unfurl: { unfurlMedia: params.account.config.unfurlMedia },
|
|
664
688
|
...params.eventScope.uploadCompletionClient ? { upload: Object.freeze({
|
|
@@ -681,7 +705,6 @@ function resolveSlackDelivery(params) {
|
|
|
681
705
|
explicit: params.opts.identity
|
|
682
706
|
}),
|
|
683
707
|
recipient: params.recipient,
|
|
684
|
-
requireMessageTimestamp: false,
|
|
685
708
|
teamId: params.recipient.teamId,
|
|
686
709
|
unfurl: params.recipient.teamId ? { unfurlMedia: params.account.config.unfurlMedia } : {
|
|
687
710
|
unfurlLinks: params.account.config.unfurlLinks,
|
|
@@ -689,10 +712,6 @@ function resolveSlackDelivery(params) {
|
|
|
689
712
|
}
|
|
690
713
|
});
|
|
691
714
|
}
|
|
692
|
-
function assertSlackPostMessageResponse(response, required) {
|
|
693
|
-
if (!required || response.ok && response.ts) return;
|
|
694
|
-
throw new Error(response.ok ? "Slack chat.postMessage returned no message timestamp" : `Slack chat.postMessage failed: ${formatSlackError(response.error, "unknown error")}`);
|
|
695
|
-
}
|
|
696
715
|
function resolveSlackTextChunkLimit(params) {
|
|
697
716
|
const configuredLimit = params.textLimit ?? resolveTextChunkLimit(params.cfg, "slack", params.accountId, { fallbackLimit: 8e3 });
|
|
698
717
|
return Math.min(configuredLimit, SLACK_TEXT_LIMIT);
|
|
@@ -769,7 +788,7 @@ async function resolveChannelId(client, recipient, params) {
|
|
|
769
788
|
isDm: true,
|
|
770
789
|
cacheHit: true
|
|
771
790
|
};
|
|
772
|
-
const channelId = (await withSlackDnsRequestRetry("conversations.open", () => client.conversations.open({ users: recipient.id }))).channel?.id;
|
|
791
|
+
const channelId = (await withSlackDnsRequestRetry("conversations.open", () => client.conversations.open({ users: recipient.id })).catch(rethrowSlackPermanentOutboundApiRejection)).channel?.id;
|
|
773
792
|
if (!channelId) throw new Error("Failed to open Slack DM channel");
|
|
774
793
|
setSlackDmChannelCache(cache, cacheKey, channelId);
|
|
775
794
|
return {
|
|
@@ -1057,17 +1076,6 @@ async function sendMessageSlack(to, message, opts) {
|
|
|
1057
1076
|
const eventScope = resolveSlackSendEventScope({ opts });
|
|
1058
1077
|
const recipient = eventScope ? parseEnterpriseEventRecipient(to) : parseRecipient(to);
|
|
1059
1078
|
if (!eventScope) assertSlackDetachedTargetAllowed(account.accountId, recipient.teamId);
|
|
1060
|
-
if (isSilentReplyText(normalizedMessage) && !opts.mediaUrl && !opts.blocks) {
|
|
1061
|
-
logVerbose("slack send: suppressed NO_REPLY token before API call");
|
|
1062
|
-
return {
|
|
1063
|
-
messageId: "suppressed",
|
|
1064
|
-
channelId: "",
|
|
1065
|
-
receipt: createSlackSendReceipt({
|
|
1066
|
-
platformMessageIds: [],
|
|
1067
|
-
kind: "unknown"
|
|
1068
|
-
})
|
|
1069
|
-
};
|
|
1070
|
-
}
|
|
1071
1079
|
const blocks = opts.blocks == null ? void 0 : validateSlackBlocksArray(opts.blocks);
|
|
1072
1080
|
if (!normalizedMessage && !opts.mediaUrl && !blocks) throw new Error("Slack send requires text, blocks, or media");
|
|
1073
1081
|
const queuedOpts = Object.freeze({ ...opts });
|
|
@@ -1115,6 +1123,7 @@ async function sendMessageSlackQueuedInner(params) {
|
|
|
1115
1123
|
accountId: account.accountId,
|
|
1116
1124
|
token: delivery.credential
|
|
1117
1125
|
});
|
|
1126
|
+
const deliveredResults = [];
|
|
1118
1127
|
const reportDelivery = async (result, deliveredBlocks) => {
|
|
1119
1128
|
const slackQuestionActionIds = resolveSlackQuestionActionIds(deliveredBlocks);
|
|
1120
1129
|
const deliveryResult = slackQuestionActionIds.length ? {
|
|
@@ -1125,6 +1134,7 @@ async function sendMessageSlackQueuedInner(params) {
|
|
|
1125
1134
|
[SLACK_QUESTION_FINALIZATION_BLOCKS]: deliveredBlocks.filter((block) => block.type !== "actions")
|
|
1126
1135
|
}
|
|
1127
1136
|
} : result;
|
|
1137
|
+
deliveredResults.push(deliveryResult);
|
|
1128
1138
|
await opts.onDeliveryResult?.(deliveryResult);
|
|
1129
1139
|
return deliveryResult;
|
|
1130
1140
|
};
|
|
@@ -1154,7 +1164,6 @@ async function sendMessageSlackQueuedInner(params) {
|
|
|
1154
1164
|
const rawBlockAccessibilityText = trimmedMessage ? [trimmedMessage, ...completeBlockFallbackText.includes(trimmedMessage) ? [] : [completeBlockFallbackText]].join("\n\n") : completeBlockFallbackText;
|
|
1155
1165
|
const blockAccessibilityText = blocks ? orderedBlockAccessibilityText ?? rawBlockAccessibilityText : void 0;
|
|
1156
1166
|
let pendingBlockFallback = (hasNativeData || opts.authoredTextPlacement !== void 0) && orderedBlockDeliveryPlan?.skipOriginalBlocks ? orderedBlockDeliveryPlan : void 0;
|
|
1157
|
-
const sentMessageIds = [];
|
|
1158
1167
|
let lastMessageId = "";
|
|
1159
1168
|
let deliveredChannelId = channelId;
|
|
1160
1169
|
let canonicalDeliveredThreadTs;
|
|
@@ -1185,8 +1194,7 @@ async function sendMessageSlackQueuedInner(params) {
|
|
|
1185
1194
|
...usesOrderedBlockAccessibility ? { mrkdwn: false } : {},
|
|
1186
1195
|
unfurl
|
|
1187
1196
|
});
|
|
1188
|
-
|
|
1189
|
-
const messageId = response.ts ?? "unknown";
|
|
1197
|
+
const messageId = response.ts;
|
|
1190
1198
|
deliveredChannelId = resolvePostedMessageChannelId(response, channelId);
|
|
1191
1199
|
const deliveredThreadTs = resolvePostedMessageThreadTs(response) ?? normalizeSlackThreadTsCandidate(opts.threadTs);
|
|
1192
1200
|
return await reportDelivery({
|
|
@@ -1231,13 +1239,10 @@ async function sendMessageSlackQueuedInner(params) {
|
|
|
1231
1239
|
unfurl
|
|
1232
1240
|
});
|
|
1233
1241
|
const response = posted.response;
|
|
1234
|
-
assertSlackPostMessageResponse(response, delivery.requireMessageTimestamp);
|
|
1235
1242
|
sendIdentity = posted.identity;
|
|
1236
|
-
lastMessageId = response.ts
|
|
1243
|
+
lastMessageId = response.ts;
|
|
1237
1244
|
deliveredChannelId = resolvePostedMessageChannelId(response, deliveredChannelId);
|
|
1238
1245
|
canonicalDeliveredThreadTs ??= resolvePostedMessageThreadTs(response);
|
|
1239
|
-
if (!response.ts) continue;
|
|
1240
|
-
sentMessageIds.push(response.ts);
|
|
1241
1246
|
const deliveredThreadTs = resolvePostedMessageThreadTs(response) ?? normalizeSlackThreadTsCandidate(opts.threadTs);
|
|
1242
1247
|
const fallbackDelivery = await reportDelivery({
|
|
1243
1248
|
messageId: response.ts,
|
|
@@ -1252,22 +1257,16 @@ async function sendMessageSlackQueuedInner(params) {
|
|
|
1252
1257
|
}, fallback.blocks);
|
|
1253
1258
|
if (fallbackDelivery.meta?.slackQuestionActionIds.length) questionDelivery = fallbackDelivery;
|
|
1254
1259
|
}
|
|
1255
|
-
const messageId = lastMessageId || "unknown";
|
|
1256
1260
|
const deliveredThreadTs = canonicalDeliveredThreadTs ?? normalizeSlackThreadTsCandidate(opts.threadTs);
|
|
1257
1261
|
return {
|
|
1258
|
-
messageId,
|
|
1262
|
+
messageId: lastMessageId,
|
|
1259
1263
|
channelId: deliveredChannelId,
|
|
1260
1264
|
threadTs: deliveredThreadTs,
|
|
1261
1265
|
...questionDelivery?.meta ? { meta: {
|
|
1262
1266
|
...questionDelivery.meta,
|
|
1263
1267
|
slackQuestionMessageId: questionDelivery.messageId
|
|
1264
1268
|
} } : {},
|
|
1265
|
-
receipt:
|
|
1266
|
-
platformMessageIds: sentMessageIds.length ? sentMessageIds : [messageId],
|
|
1267
|
-
channelId: deliveredChannelId,
|
|
1268
|
-
kind: fallbackMessages.some((message) => message.blocks) ? "card" : "text",
|
|
1269
|
-
threadTs: deliveredThreadTs
|
|
1270
|
-
})
|
|
1269
|
+
receipt: createSlackSendReceiptFromResults(deliveredResults, deliveredThreadTs)
|
|
1271
1270
|
};
|
|
1272
1271
|
}
|
|
1273
1272
|
}
|
|
@@ -1300,7 +1299,6 @@ async function sendMessageSlackQueuedInner(params) {
|
|
|
1300
1299
|
onPlatformSendDispatch: dispatchOnce,
|
|
1301
1300
|
...delivery.upload ? { auditContext: delivery.upload.auditContext } : {}
|
|
1302
1301
|
});
|
|
1303
|
-
sentMessageIds.push(lastMessageId);
|
|
1304
1302
|
await reportDelivery({
|
|
1305
1303
|
messageId: lastMessageId,
|
|
1306
1304
|
channelId,
|
|
@@ -1315,7 +1313,7 @@ async function sendMessageSlackQueuedInner(params) {
|
|
|
1315
1313
|
chunksToPost = rest;
|
|
1316
1314
|
} else chunksToPost = resolvedChunks.length ? resolvedChunks : [""];
|
|
1317
1315
|
for (const [partIndex, chunk] of chunksToPost.entries()) {
|
|
1318
|
-
const carriesPrimaryMessageOptions = partIndex === 0 && !opts.mediaUrl
|
|
1316
|
+
const carriesPrimaryMessageOptions = partIndex === 0 && !opts.mediaUrl;
|
|
1319
1317
|
const baseMetadata = carriesPrimaryMessageOptions ? opts.metadata : void 0;
|
|
1320
1318
|
const metadata = opts.mediaUrl ? baseMetadata : withSlackDeliveryMetadata(baseMetadata, {
|
|
1321
1319
|
queueId: opts.deliveryQueueId,
|
|
@@ -1337,39 +1335,29 @@ async function sendMessageSlackQueuedInner(params) {
|
|
|
1337
1335
|
unfurl
|
|
1338
1336
|
});
|
|
1339
1337
|
const response = posted.response;
|
|
1340
|
-
assertSlackPostMessageResponse(response, delivery.requireMessageTimestamp);
|
|
1341
1338
|
sendIdentity = posted.identity;
|
|
1342
|
-
lastMessageId = response.ts
|
|
1339
|
+
lastMessageId = response.ts;
|
|
1343
1340
|
deliveredChannelId = resolvePostedMessageChannelId(response, deliveredChannelId);
|
|
1344
1341
|
canonicalDeliveredThreadTs ??= resolvePostedMessageThreadTs(response);
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1342
|
+
await reportDelivery({
|
|
1343
|
+
messageId: response.ts,
|
|
1344
|
+
channelId: deliveredChannelId,
|
|
1345
|
+
threadTs: resolvePostedMessageThreadTs(response) ?? normalizeSlackThreadTsCandidate(opts.threadTs),
|
|
1346
|
+
receipt: createSlackSendReceipt({
|
|
1347
|
+
platformMessageIds: [response.ts],
|
|
1349
1348
|
channelId: deliveredChannelId,
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
kind: "text",
|
|
1355
|
-
threadTs: resolvePostedMessageThreadTs(response) ?? normalizeSlackThreadTsCandidate(opts.threadTs)
|
|
1356
|
-
})
|
|
1357
|
-
});
|
|
1358
|
-
}
|
|
1349
|
+
kind: "text",
|
|
1350
|
+
threadTs: resolvePostedMessageThreadTs(response) ?? normalizeSlackThreadTsCandidate(opts.threadTs)
|
|
1351
|
+
})
|
|
1352
|
+
});
|
|
1359
1353
|
}
|
|
1360
|
-
const messageId = lastMessageId || "unknown";
|
|
1361
1354
|
const deliveredThreadTs = canonicalDeliveredThreadTs ?? normalizeSlackThreadTsCandidate(opts.threadTs);
|
|
1362
1355
|
return {
|
|
1363
|
-
messageId,
|
|
1356
|
+
messageId: lastMessageId,
|
|
1364
1357
|
channelId: deliveredChannelId,
|
|
1365
1358
|
threadTs: deliveredThreadTs,
|
|
1366
|
-
receipt:
|
|
1367
|
-
platformMessageIds: sentMessageIds.length ? sentMessageIds : [messageId],
|
|
1368
|
-
channelId: deliveredChannelId,
|
|
1369
|
-
kind: opts.mediaUrl ? "media" : "text",
|
|
1370
|
-
threadTs: deliveredThreadTs
|
|
1371
|
-
})
|
|
1359
|
+
receipt: createSlackSendReceiptFromResults(deliveredResults, deliveredThreadTs)
|
|
1372
1360
|
};
|
|
1373
1361
|
}
|
|
1374
1362
|
//#endregion
|
|
1375
|
-
export { updateMessageSlack as a, hasSlackThreadFailureNotice as c, recordSlackThreadFailureNotice as d, recordSlackThreadParticipation as f, setSlackDefaultSendIdentity as i, hasSlackThreadParticipation as l,
|
|
1363
|
+
export { updateMessageSlack as a, hasSlackThreadFailureNotice as c, recordSlackThreadFailureNotice as d, recordSlackThreadParticipation as f, chunkSlackTextAtHardLimit as h, setSlackDefaultSendIdentity as i, hasSlackThreadParticipation as l, buildSlackNativeDataDeliveryPlan as m, resolveSlackDmChannelId as n, clearSlackThreadFailureNotice as o, requireSlackPostMessageTimestamp as p, sendMessageSlack as r, clearSlackThreadParticipationCache as s, reconcileSlackUnknownSend as t, hasSlackThreadParticipationWithPersistence as u };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
2
|
+
//#region extensions/slack/src/send-results.ts
|
|
3
|
+
function mergeSlackSendResults(results) {
|
|
4
|
+
const lastResult = results.at(-1);
|
|
5
|
+
if (!lastResult) throw new Error("Slack send plan produced no delivery.");
|
|
6
|
+
if (results.length === 1) return lastResult;
|
|
7
|
+
const receipt = createMessageReceiptFromOutboundResults({ results });
|
|
8
|
+
receipt.parts = receipt.parts.map((part, index) => ({
|
|
9
|
+
...part,
|
|
10
|
+
index
|
|
11
|
+
}));
|
|
12
|
+
const questionResult = results.find((result) => result.meta?.slackQuestionActionIds.length);
|
|
13
|
+
return {
|
|
14
|
+
...lastResult,
|
|
15
|
+
receipt,
|
|
16
|
+
...questionResult?.meta ? { meta: {
|
|
17
|
+
...questionResult.meta,
|
|
18
|
+
slackQuestionMessageId: questionResult.meta.slackQuestionMessageId ?? questionResult.messageId
|
|
19
|
+
} } : {}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { mergeSlackSendResults as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as updateMessageSlack, n as resolveSlackDmChannelId, r as sendMessageSlack, t as reconcileSlackUnknownSend } from "./send-
|
|
1
|
+
import { a as updateMessageSlack, n as resolveSlackDmChannelId, r as sendMessageSlack, t as reconcileSlackUnknownSend } from "./send-DS9ICrBI.js";
|
|
2
2
|
export { reconcileSlackUnknownSend, resolveSlackDmChannelId, sendMessageSlack, updateMessageSlack };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as slackSetupPlugin } from "./channel.setup-
|
|
1
|
+
import { t as slackSetupPlugin } from "./channel.setup-ofDi3_Pu.js";
|
|
2
2
|
export { slackSetupPlugin };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as resolveDefaultSlackAccountId, o as resolveSlackAccountAllowFrom } from "./accounts-
|
|
2
|
-
import { t as inspectSlackAccount } from "./account-inspect-
|
|
3
|
-
import "./shared-
|
|
4
|
-
import { o as SLACK_CHANNEL, r as createSlackSetupWizardBase } from "./channel.setup-
|
|
5
|
-
import { t as resolveSlackChannelAllowlist } from "./resolve-channels-
|
|
6
|
-
import { t as resolveSlackUserAllowlist } from "./resolve-users-
|
|
1
|
+
import { i as resolveDefaultSlackAccountId, o as resolveSlackAccountAllowFrom } from "./accounts-Dm_H77gH.js";
|
|
2
|
+
import { t as inspectSlackAccount } from "./account-inspect-CN2hBsim.js";
|
|
3
|
+
import "./shared-D5B-5hBg.js";
|
|
4
|
+
import { o as SLACK_CHANNEL, r as createSlackSetupWizardBase } from "./channel.setup-ofDi3_Pu.js";
|
|
5
|
+
import { t as resolveSlackChannelAllowlist } from "./resolve-channels-Czheznc8.js";
|
|
6
|
+
import { t as resolveSlackUserAllowlist } from "./resolve-users-BAOlNimr.js";
|
|
7
7
|
import { normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { resolveBasicAllowFromEntries } from "openclaw/plugin-sdk/allow-from";
|
|
9
9
|
import { createSetupTranslator, noteChannelLookupFailure, noteChannelLookupSummary, parseMentionOrPrefixedId, patchChannelConfigForAccount, promptResolvedAllowFrom, resolveEntriesWithOptionalToken, resolveSetupAccountId, splitSetupEntries } from "openclaw/plugin-sdk/setup-runtime";
|