@openclaw/slack 2026.8.1-beta.2 → 2026.9.1-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/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-BoSeX09X.js} +76 -83
- package/dist/action-runtime.runtime-Dpa16J87.js +2 -0
- package/dist/{actions-BTDXwwE3.js → actions-XdQyjG_p.js} +134 -262
- package/dist/api.js +14 -14
- package/dist/{approval-handler.runtime-CJaNzAq2.js → approval-handler.runtime-DxXfGX_Z.js} +53 -174
- package/dist/{channel-D_tovcUL.js → channel-C_vnTgxo.js} +117 -72
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-B9MSdoGN.js → channel-type-j-2lalcC.js} +3 -7
- package/dist/{channel.setup-Bch9dYmA.js → channel.setup-aal8tokM.js} +34 -49
- package/dist/{config-schema-xto5jFIx.js → config-schema-CN3XZRX5.js} +23 -7
- 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-lC6X_Ru-.js} +2 -2
- package/dist/{group-policy-c4RP9bjc.js → group-policy-CU1tEGpS.js} +583 -642
- package/dist/{message-tool-api-BykQB4AU.js → message-tool-api-CWosHSi5.js} +6 -5
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-1nF1NtqT.js → monitor-DrNCGneD.js} +3 -3
- package/dist/{outbound-adapter-S81tsswN.js → outbound-adapter-DkT2vUE9.js} +50 -19
- package/dist/{pipeline.runtime-BvYsM5JO.js → pipeline.runtime-CRRng_Nw.js} +440 -451
- package/dist/{policy-TapwbeaT.js → policy-BoP6t88v.js} +1 -1
- package/dist/{probe-HoEg_WxB.js → probe-4_aHtVT3.js} +2 -21
- package/dist/{provider-CDNvBXUi.js → provider-D4nDgxCh.js} +240 -95
- package/dist/{relay-source-C9leF11u.js → relay-source-CEmze11m.js} +1 -1
- package/dist/{replies-CeOfv82I.js → replies-D9XMM_S0.js} +47 -26
- package/dist/{resolve-channels-CNPrxaXY.js → resolve-channels-DSamDgVs.js} +1 -1
- package/dist/{resolve-users-Dzomuwnr.js → resolve-users-CIzwbaJR.js} +1 -1
- package/dist/runtime-api.js +11 -11
- package/dist/{scopes-cYXKkrRD.js → scopes-BBrUzpBH.js} +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-Nor0iBwY.js → send-DtjEnlLh.js} +86 -98
- package/dist/{send.runtime-BmgNe6S9.js → send.runtime-DQeNKa2J.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-CbX1-Knh.js → setup-surface-CsBCM4rP.js} +6 -6
- package/dist/{shared-zdT5AMp-.js → shared-D9GeeR9K.js} +33 -9
- package/dist/{block-text-YtiNkqmx.js → slack-client-kind-hSfjXyUM.js} +17 -2
- package/dist/{slash-dispatch.runtime-Bnr9GR1S.js → slash-dispatch.runtime-Chr3YHnT.js} +3 -3
- 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 +43 -1
- 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/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,23 +1,19 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { a as resolveSlackAccount, f as resolveSlackBotToken } from "./accounts-
|
|
3
|
-
import {
|
|
4
|
-
import { d as getSlackWriteClient, i as createSlackLookupClient } from "./probe-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { a as resolveSlackAccount, f as resolveSlackBotToken } from "./accounts-Dm_H77gH.js";
|
|
3
|
+
import { K as truncateSlackTextByUtf8Bytes, L as SLACK_EDIT_TEXT_MAX_BYTES, M as stripSlackNativeDataBlocks, N as buildSlackBlocksFallbackText, O as hasSlackNativeDataBlock, P as buildSlackCompleteBlocksFallbackText, Rt as SLACK_PRIVATE_ACTION_DELIVERY_RESULT, T as appendSlackNativeDataPlainTextFallback, W as countSlackTextUtf8Bytes, ct as escapeSlackMrkdwn, g as assertSlackDetachedTargetAllowed, ht as validateSlackBlocksArray, k as isSlackInvalidBlocksError, ot as normalizeSlackOutboundText, w as appendSlackNativeDataFallbackText } from "./group-policy-CU1tEGpS.js";
|
|
4
|
+
import { d as getSlackWriteClient, i as createSlackLookupClient } from "./probe-4_aHtVT3.js";
|
|
5
|
+
import { c as resolveSlackMessageText, i as hasSlackMessageTableBlock, n as fetchWithRuntimeDispatcher, r as saveRemoteMedia, t as isGovSlackClient } from "./slack-client-kind-hSfjXyUM.js";
|
|
6
|
+
import { m as buildSlackNativeDataDeliveryPlan, r as sendMessageSlack } from "./send-DtjEnlLh.js";
|
|
7
7
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
8
8
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { logVerbose, logVerbose as logVerbose$1 } from "openclaw/plugin-sdk/runtime-env";
|
|
10
|
-
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
11
10
|
import { z } from "zod";
|
|
12
11
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
13
12
|
import fs from "node:fs/promises";
|
|
13
|
+
import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
|
|
14
14
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
15
15
|
import { normalizeHostname } from "openclaw/plugin-sdk/host-runtime";
|
|
16
16
|
import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
|
|
17
|
-
import pMap, { pMapSkip } from "p-map";
|
|
18
|
-
import { fetchWithRuntimeDispatcher } from "openclaw/plugin-sdk/runtime-fetch";
|
|
19
|
-
import { saveRemoteMedia } from "openclaw/plugin-sdk/media-runtime";
|
|
20
|
-
import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
21
17
|
//#region extensions/slack/src/edit-text.ts
|
|
22
18
|
function buildSlackEditTextPayload(content, blocks) {
|
|
23
19
|
const trimmedContent = content.trim();
|
|
@@ -49,173 +45,12 @@ function formatSlackFileReferenceList(files) {
|
|
|
49
45
|
return files.map((file) => formatSlackFileReference(file)).join(", ");
|
|
50
46
|
}
|
|
51
47
|
//#endregion
|
|
52
|
-
//#region extensions/slack/src/monitor/thread.ts
|
|
53
|
-
const THREAD_STARTER_CACHE = /* @__PURE__ */ new Map();
|
|
54
|
-
const THREAD_STARTER_CACHE_TTL_MS = 360 * 6e4;
|
|
55
|
-
const THREAD_STARTER_CACHE_MAX = 2e3;
|
|
56
|
-
function evictThreadStarterCache() {
|
|
57
|
-
const now = asDateTimestampMs(Date.now());
|
|
58
|
-
if (now === void 0) {
|
|
59
|
-
THREAD_STARTER_CACHE.clear();
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
for (const [cacheKey, entry] of THREAD_STARTER_CACHE.entries()) if (asDateTimestampMs(entry.expiresAt) === void 0 || entry.expiresAt <= now) THREAD_STARTER_CACHE.delete(cacheKey);
|
|
63
|
-
pruneMapToMaxSize(THREAD_STARTER_CACHE, THREAD_STARTER_CACHE_MAX);
|
|
64
|
-
}
|
|
65
|
-
function formatSlackFilePlaceholder(files) {
|
|
66
|
-
return `[attached: ${formatSlackFileReferenceList(files)}]`;
|
|
67
|
-
}
|
|
68
|
-
function pushUniqueText(parts, value, options = {}) {
|
|
69
|
-
const text = options.preserveWhitespace ? typeof value === "string" && value.trim().length > 0 ? value : void 0 : normalizeOptionalString(value);
|
|
70
|
-
if (text && !parts.includes(text)) parts.push(text);
|
|
71
|
-
}
|
|
72
|
-
function resolveSlackBlocksFallbackText(blocks) {
|
|
73
|
-
return resolveSlackBlocksText(blocks)?.text;
|
|
74
|
-
}
|
|
75
|
-
function resolveSlackAttachmentFallbackText(attachments) {
|
|
76
|
-
if (!Array.isArray(attachments) || attachments.length === 0) return;
|
|
77
|
-
const parts = [];
|
|
78
|
-
for (const attachment of attachments) {
|
|
79
|
-
const excludeTableBlocks = isSlackUnfurlAttachment(attachment);
|
|
80
|
-
const fallbackBlocks = (blocks) => excludeTableBlocks ? blocks?.filter((block) => !hasSlackTableBlock([block])) : blocks;
|
|
81
|
-
pushUniqueText(parts, attachment.pretext);
|
|
82
|
-
pushUniqueText(parts, attachment.title);
|
|
83
|
-
pushUniqueText(parts, attachment.text);
|
|
84
|
-
if (!(hasSlackTableBlock(attachment.blocks) && normalizeOptionalString(attachment.fallback) === "[no preview available]")) pushUniqueText(parts, attachment.fallback);
|
|
85
|
-
for (const field of attachment.fields ?? []) {
|
|
86
|
-
pushUniqueText(parts, field.title);
|
|
87
|
-
pushUniqueText(parts, field.value);
|
|
88
|
-
}
|
|
89
|
-
pushUniqueText(parts, resolveSlackBlocksFallbackText(fallbackBlocks(attachment.blocks)), { preserveWhitespace: true });
|
|
90
|
-
pushUniqueText(parts, resolveSlackBlocksFallbackText(fallbackBlocks(attachment.message_blocks)), { preserveWhitespace: true });
|
|
91
|
-
}
|
|
92
|
-
return parts.length > 0 ? parts.join("\n") : void 0;
|
|
93
|
-
}
|
|
94
|
-
function resolveSlackMessageText(message) {
|
|
95
|
-
const messageText = normalizeOptionalString(message.text) ?? resolveSlackAttachmentFallbackText(message.attachments);
|
|
96
|
-
return resolveSlackMessageText$1({
|
|
97
|
-
...message,
|
|
98
|
-
text: messageText
|
|
99
|
-
}, { preserveMessageTextWhitespace: true });
|
|
100
|
-
}
|
|
101
|
-
async function resolveSlackThreadStarter(params) {
|
|
102
|
-
evictThreadStarterCache();
|
|
103
|
-
const cacheKey = JSON.stringify([
|
|
104
|
-
params.workspaceScope.accountId,
|
|
105
|
-
params.workspaceScope.teamId,
|
|
106
|
-
params.channelId,
|
|
107
|
-
params.threadTs
|
|
108
|
-
]);
|
|
109
|
-
const cached = THREAD_STARTER_CACHE.get(cacheKey);
|
|
110
|
-
if (cached) {
|
|
111
|
-
const now = asDateTimestampMs(Date.now());
|
|
112
|
-
if (now !== void 0 && cached.expiresAt > now) return cached.value;
|
|
113
|
-
THREAD_STARTER_CACHE.delete(cacheKey);
|
|
114
|
-
}
|
|
115
|
-
try {
|
|
116
|
-
const message = (await params.client.conversations.replies({
|
|
117
|
-
channel: params.channelId,
|
|
118
|
-
ts: params.threadTs,
|
|
119
|
-
limit: 1,
|
|
120
|
-
inclusive: true
|
|
121
|
-
}))?.messages?.[0];
|
|
122
|
-
const text = message ? resolveSlackMessageText(message) : void 0;
|
|
123
|
-
const files = message?.files?.length ? message.files : void 0;
|
|
124
|
-
if (!message || !text && !files) return null;
|
|
125
|
-
const starter = {
|
|
126
|
-
text: text || formatSlackFilePlaceholder(files),
|
|
127
|
-
userId: message.user,
|
|
128
|
-
botId: message.bot_id,
|
|
129
|
-
ts: message.ts,
|
|
130
|
-
files
|
|
131
|
-
};
|
|
132
|
-
const expiresAt = resolveExpiresAtMsFromDurationMs(THREAD_STARTER_CACHE_TTL_MS);
|
|
133
|
-
if (expiresAt !== void 0) {
|
|
134
|
-
if (THREAD_STARTER_CACHE.has(cacheKey)) THREAD_STARTER_CACHE.delete(cacheKey);
|
|
135
|
-
THREAD_STARTER_CACHE.set(cacheKey, {
|
|
136
|
-
value: starter,
|
|
137
|
-
expiresAt
|
|
138
|
-
});
|
|
139
|
-
evictThreadStarterCache();
|
|
140
|
-
}
|
|
141
|
-
return starter;
|
|
142
|
-
} catch (err) {
|
|
143
|
-
logVerbose$1(`slack thread starter fetch failed channel=${params.channelId} ts=${params.threadTs}: ${formatErrorMessage(err)}`);
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
function resetSlackThreadStarterCacheForTest() {
|
|
148
|
-
THREAD_STARTER_CACHE.clear();
|
|
149
|
-
}
|
|
150
|
-
const SLACK_THREAD_HISTORY_MAX_PAGES = 3;
|
|
151
|
-
/**
|
|
152
|
-
* Fetches the most recent messages in a Slack thread (excluding the current message).
|
|
153
|
-
* Used to populate thread context when a new thread session starts.
|
|
154
|
-
*
|
|
155
|
-
* Uses cursor pagination and keeps only the latest N retained messages when the full
|
|
156
|
-
* thread fits in the bounded fetch window.
|
|
157
|
-
*/
|
|
158
|
-
async function resolveSlackThreadHistory(params) {
|
|
159
|
-
const maxMessages = params.limit ?? 20;
|
|
160
|
-
if (!Number.isFinite(maxMessages) || maxMessages <= 0) return [];
|
|
161
|
-
const fetchLimit = 200;
|
|
162
|
-
const retained = [];
|
|
163
|
-
let cursor;
|
|
164
|
-
let pagesFetched = 0;
|
|
165
|
-
try {
|
|
166
|
-
do {
|
|
167
|
-
pagesFetched += 1;
|
|
168
|
-
const response = await params.client.conversations.replies({
|
|
169
|
-
channel: params.channelId,
|
|
170
|
-
ts: params.threadTs,
|
|
171
|
-
limit: fetchLimit,
|
|
172
|
-
inclusive: true,
|
|
173
|
-
...cursor ? { cursor } : {}
|
|
174
|
-
});
|
|
175
|
-
for (const msg of response.messages ?? []) {
|
|
176
|
-
if (!resolveSlackMessageText(msg) && !msg.files?.length) continue;
|
|
177
|
-
if (params.currentMessageTs && msg.ts === params.currentMessageTs) continue;
|
|
178
|
-
retained.push(msg);
|
|
179
|
-
}
|
|
180
|
-
if (retained.length > maxMessages) retained.splice(0, retained.length - maxMessages);
|
|
181
|
-
const next = response.response_metadata?.next_cursor;
|
|
182
|
-
cursor = typeof next === "string" && next.trim().length > 0 ? next.trim() : void 0;
|
|
183
|
-
} while (cursor && pagesFetched < SLACK_THREAD_HISTORY_MAX_PAGES);
|
|
184
|
-
if (cursor) {
|
|
185
|
-
logVerbose$1(`slack thread history capped channel=${params.channelId} ts=${params.threadTs} pages=${SLACK_THREAD_HISTORY_MAX_PAGES}`);
|
|
186
|
-
return [];
|
|
187
|
-
}
|
|
188
|
-
return retained.map((msg) => ({
|
|
189
|
-
text: resolveSlackMessageText(msg) ?? formatSlackFilePlaceholder(msg.files),
|
|
190
|
-
userId: msg.user,
|
|
191
|
-
botId: msg.bot_id,
|
|
192
|
-
ts: msg.ts,
|
|
193
|
-
files: msg.files
|
|
194
|
-
}));
|
|
195
|
-
} catch (err) {
|
|
196
|
-
logVerbose$1(`slack thread history fetch failed channel=${params.channelId} ts=${params.threadTs}: ${formatErrorMessage(err)}`);
|
|
197
|
-
return [];
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
//#endregion
|
|
201
48
|
//#region extensions/slack/src/monitor/media.ts
|
|
202
49
|
var media_exports = /* @__PURE__ */ __exportAll({
|
|
203
50
|
SLACK_MEDIA_READ_IDLE_TIMEOUT_MS: () => SLACK_MEDIA_READ_IDLE_TIMEOUT_MS,
|
|
204
|
-
resetSlackThreadStarterCacheForTest: () => resetSlackThreadStarterCacheForTest,
|
|
205
51
|
resolveSlackAttachmentContent: () => resolveSlackAttachmentContent,
|
|
206
|
-
resolveSlackMedia: () => resolveSlackMedia
|
|
207
|
-
resolveSlackThreadHistory: () => resolveSlackThreadHistory,
|
|
208
|
-
resolveSlackThreadStarter: () => resolveSlackThreadStarter
|
|
52
|
+
resolveSlackMedia: () => resolveSlackMedia
|
|
209
53
|
});
|
|
210
|
-
function isGovSlackClient(client) {
|
|
211
|
-
if (!client?.slackApiUrl) return false;
|
|
212
|
-
try {
|
|
213
|
-
const apiUrl = new URL(client.slackApiUrl);
|
|
214
|
-
return apiUrl.protocol === "https:" && !apiUrl.port && normalizeHostname(apiUrl.hostname) === "slack-gov.com";
|
|
215
|
-
} catch {
|
|
216
|
-
return false;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
54
|
function isSlackHostname(hostname, govSlack) {
|
|
220
55
|
const normalized = normalizeHostname(hostname);
|
|
221
56
|
if (!normalized) return false;
|
|
@@ -349,6 +184,10 @@ async function fetchFreshSlackFileUrl(params) {
|
|
|
349
184
|
if (!params.file.id || !params.client) return null;
|
|
350
185
|
try {
|
|
351
186
|
const freshFile = (await params.client.files.info({ file: params.file.id })).file;
|
|
187
|
+
if (freshFile && params.isRefreshedFileAllowed?.(freshFile) === false) {
|
|
188
|
+
logVerbose$1(`slack: refreshed file metadata rejected for file id=${params.file.id}`);
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
352
191
|
const freshUrl = freshFile?.url_private_download ?? freshFile?.url_private;
|
|
353
192
|
if (freshUrl) {
|
|
354
193
|
logVerbose$1(`slack: refreshed file URL via files.info for file id=${params.file.id}`);
|
|
@@ -391,6 +230,7 @@ async function downloadSlackMediaFile(params) {
|
|
|
391
230
|
return {
|
|
392
231
|
path: saved.path,
|
|
393
232
|
...contentType ? { contentType } : {},
|
|
233
|
+
...label ? { fileName: label } : {},
|
|
394
234
|
placeholder: `[Slack file: ${formatSlackFileReference({
|
|
395
235
|
...params.file,
|
|
396
236
|
name: label
|
|
@@ -418,56 +258,88 @@ function resolveForwardedAttachmentImageUrl(attachment, govSlack) {
|
|
|
418
258
|
async function resolveSlackMedia(params) {
|
|
419
259
|
const govSlack = isGovSlackClient(params.client);
|
|
420
260
|
const files = params.files ?? [];
|
|
421
|
-
const
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
file
|
|
432
|
-
url
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
261
|
+
const limitedFiles = files.length > 8 ? files.slice(0, 8) : files;
|
|
262
|
+
const refreshFileUrl = (file) => fetchFreshSlackFileUrl({
|
|
263
|
+
file,
|
|
264
|
+
client: params.client,
|
|
265
|
+
isRefreshedFileAllowed: params.isRefreshedFileAllowed
|
|
266
|
+
});
|
|
267
|
+
const { results } = await runTasksWithConcurrency({
|
|
268
|
+
tasks: limitedFiles.map((file) => async () => {
|
|
269
|
+
const preloaded = params.preloadedMedia?.get(file);
|
|
270
|
+
if (preloaded) return preloaded;
|
|
271
|
+
const eventUrl = file.url_private_download ?? file.url_private;
|
|
272
|
+
const url = eventUrl ?? await refreshFileUrl(file);
|
|
273
|
+
if (!url) return null;
|
|
274
|
+
const result = await downloadSlackMediaFile({
|
|
275
|
+
file,
|
|
276
|
+
url,
|
|
277
|
+
token: params.token,
|
|
278
|
+
maxBytes: params.maxBytes,
|
|
279
|
+
readIdleTimeoutMs: params.readIdleTimeoutMs,
|
|
280
|
+
totalTimeoutMs: params.totalTimeoutMs,
|
|
281
|
+
abortSignal: params.abortSignal,
|
|
282
|
+
govSlack
|
|
283
|
+
}).catch(() => null);
|
|
284
|
+
if (result || !eventUrl) return result;
|
|
285
|
+
const freshUrl = await refreshFileUrl(file);
|
|
286
|
+
if (!freshUrl) return null;
|
|
287
|
+
return await downloadSlackMediaFile({
|
|
288
|
+
file,
|
|
289
|
+
url: freshUrl,
|
|
290
|
+
token: params.token,
|
|
291
|
+
maxBytes: params.maxBytes,
|
|
292
|
+
readIdleTimeoutMs: params.readIdleTimeoutMs,
|
|
293
|
+
totalTimeoutMs: params.totalTimeoutMs,
|
|
294
|
+
abortSignal: params.abortSignal,
|
|
295
|
+
govSlack
|
|
296
|
+
}).catch(() => null);
|
|
297
|
+
}),
|
|
298
|
+
limit: MAX_SLACK_MEDIA_CONCURRENCY,
|
|
299
|
+
errorMode: "stop",
|
|
300
|
+
throwOnError: true
|
|
301
|
+
});
|
|
302
|
+
const resolved = results.filter((result, index) => {
|
|
303
|
+
if (result) params.resolvedFiles?.add(limitedFiles[index]);
|
|
304
|
+
return result !== null;
|
|
459
305
|
});
|
|
460
306
|
return resolved.length > 0 ? resolved : null;
|
|
461
307
|
}
|
|
462
308
|
/** Extracts text and media from forwarded-message attachments. Returns null when empty. */
|
|
463
309
|
async function resolveSlackAttachmentContent(params) {
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
310
|
+
const forwardedAttachments = (params.attachments ?? []).filter((attachment) => isForwardedSlackAttachment(attachment)).slice(0, MAX_SLACK_FORWARDED_ATTACHMENTS);
|
|
311
|
+
const candidates = [...params.files ?? [], ...forwardedAttachments.flatMap((attachment) => attachment.files ?? [])];
|
|
312
|
+
if (forwardedAttachments.length === 0 && candidates.length === 0) return null;
|
|
313
|
+
const fileIds = /* @__PURE__ */ new Set();
|
|
314
|
+
const allFiles = candidates.filter((file) => {
|
|
315
|
+
const fileId = normalizeOptionalString(file.id);
|
|
316
|
+
if (!fileId) return true;
|
|
317
|
+
if (fileIds.has(fileId)) return false;
|
|
318
|
+
fileIds.add(fileId);
|
|
319
|
+
return true;
|
|
320
|
+
}).slice(0, 8).map((file) => {
|
|
321
|
+
const fileId = normalizeOptionalString(file.id);
|
|
322
|
+
const preloaded = fileId && candidates.find((candidate) => normalizeOptionalString(candidate.id) === fileId && params.preloadedMedia?.has(candidate));
|
|
323
|
+
if (preloaded) return preloaded;
|
|
324
|
+
if (!fileId || file.url_private_download || file.url_private) return file;
|
|
325
|
+
const downloadable = candidates.find((candidate) => normalizeOptionalString(candidate.id) === fileId && (candidate.url_private_download || candidate.url_private));
|
|
326
|
+
return downloadable ? Object.assign({}, file, downloadable) : file;
|
|
327
|
+
});
|
|
328
|
+
const pendingFiles = new Map(allFiles.map((file) => [normalizeOptionalString(file.id) ?? file, file]));
|
|
329
|
+
const resolvedFiles = /* @__PURE__ */ new Set();
|
|
330
|
+
const resolveFiles = (files) => resolveSlackMedia({
|
|
331
|
+
...params,
|
|
332
|
+
resolvedFiles,
|
|
333
|
+
files: files?.flatMap((file) => {
|
|
334
|
+
const key = normalizeOptionalString(file.id) ?? file;
|
|
335
|
+
const selected = pendingFiles.get(key);
|
|
336
|
+
pendingFiles.delete(key);
|
|
337
|
+
return selected ? [selected] : [];
|
|
338
|
+
})
|
|
339
|
+
});
|
|
340
|
+
const directMediaPromise = resolveFiles(params.files);
|
|
468
341
|
const textBlocks = [];
|
|
469
|
-
const
|
|
470
|
-
const allFiles = forwardedAttachments.flatMap((attachment) => attachment.files ?? []);
|
|
342
|
+
const attachmentMedia = [];
|
|
471
343
|
let unavailableImageCount = 0;
|
|
472
344
|
const govSlack = isGovSlackClient(params.client);
|
|
473
345
|
for (const att of forwardedAttachments) {
|
|
@@ -493,41 +365,51 @@ async function resolveSlackAttachmentContent(params) {
|
|
|
493
365
|
abortSignal: params.abortSignal
|
|
494
366
|
});
|
|
495
367
|
const label = saved.fileName ?? "forwarded image";
|
|
496
|
-
|
|
368
|
+
attachmentMedia.push({
|
|
497
369
|
path: saved.path,
|
|
498
370
|
contentType: saved.contentType,
|
|
371
|
+
...saved.fileName ? { fileName: saved.fileName } : {},
|
|
499
372
|
placeholder: `[Forwarded image: ${label}]`
|
|
500
373
|
});
|
|
501
374
|
} catch {
|
|
502
375
|
unavailableImageCount += 1;
|
|
503
376
|
}
|
|
504
|
-
|
|
505
|
-
const fileMedia = await resolveSlackMedia({
|
|
506
|
-
files: att.files,
|
|
507
|
-
client: params.client,
|
|
508
|
-
token: params.token,
|
|
509
|
-
maxBytes: params.maxBytes,
|
|
510
|
-
readIdleTimeoutMs: params.readIdleTimeoutMs,
|
|
511
|
-
totalTimeoutMs: params.totalTimeoutMs,
|
|
512
|
-
abortSignal: params.abortSignal
|
|
513
|
-
});
|
|
514
|
-
if (fileMedia) allMedia.push(...fileMedia);
|
|
515
|
-
}
|
|
377
|
+
attachmentMedia.push(...await resolveFiles(att.files) ?? []);
|
|
516
378
|
}
|
|
379
|
+
const allMedia = [...await directMediaPromise ?? [], ...attachmentMedia];
|
|
380
|
+
const unavailableFiles = allFiles.filter((file) => !resolvedFiles.has(file));
|
|
517
381
|
const combinedText = textBlocks.join("\n\n");
|
|
518
382
|
if (!combinedText && allMedia.length === 0 && allFiles.length === 0 && unavailableImageCount === 0) return null;
|
|
519
383
|
return {
|
|
520
384
|
text: combinedText,
|
|
521
385
|
media: allMedia,
|
|
522
386
|
unavailableImageCount,
|
|
523
|
-
...
|
|
387
|
+
...unavailableFiles.length > 0 ? { files: unavailableFiles } : {}
|
|
524
388
|
};
|
|
525
389
|
}
|
|
526
390
|
//#endregion
|
|
527
391
|
//#region extensions/slack/src/actions.ts
|
|
392
|
+
var actions_exports = /* @__PURE__ */ __exportAll({
|
|
393
|
+
deleteSlackMessage: () => deleteSlackMessage,
|
|
394
|
+
downloadSlackFile: () => downloadSlackFile,
|
|
395
|
+
editSlackMessage: () => editSlackMessage,
|
|
396
|
+
editSlackRenderedMessage: () => editSlackRenderedMessage,
|
|
397
|
+
getSlackMemberInfo: () => getSlackMemberInfo,
|
|
398
|
+
listSlackEmojis: () => listSlackEmojis,
|
|
399
|
+
listSlackPins: () => listSlackPins,
|
|
400
|
+
listSlackReactions: () => listSlackReactions,
|
|
401
|
+
pinSlackMessage: () => pinSlackMessage,
|
|
402
|
+
reactSlackMessage: () => reactSlackMessage,
|
|
403
|
+
readSlackMessages: () => readSlackMessages,
|
|
404
|
+
removeOwnSlackReactions: () => removeOwnSlackReactions,
|
|
405
|
+
removeSlackReaction: () => removeSlackReaction,
|
|
406
|
+
resolveSlackConversationName: () => resolveSlackConversationName,
|
|
407
|
+
sendSlackMessage: () => sendSlackMessage,
|
|
408
|
+
unpinSlackMessage: () => unpinSlackMessage
|
|
409
|
+
});
|
|
528
410
|
function renderSlackReadMessageText(message) {
|
|
529
411
|
if (!hasSlackMessageTableBlock(message)) return message;
|
|
530
|
-
const text = resolveSlackMessageText
|
|
412
|
+
const text = resolveSlackMessageText(message, { preserveMessageTextWhitespace: true });
|
|
531
413
|
return text && text !== message.text ? {
|
|
532
414
|
...message,
|
|
533
415
|
text
|
|
@@ -691,6 +573,7 @@ async function listSlackReactions(channelId, messageId, opts = {}) {
|
|
|
691
573
|
})).message?.reactions ?? [];
|
|
692
574
|
}
|
|
693
575
|
async function sendSlackMessage(to, content, opts) {
|
|
576
|
+
const onDeliveryResult = Object.getOwnPropertyDescriptor(opts, SLACK_PRIVATE_ACTION_DELIVERY_RESULT)?.value;
|
|
694
577
|
return await sendMessageSlack(to, content, {
|
|
695
578
|
accountId: opts.accountId,
|
|
696
579
|
cfg: opts.cfg,
|
|
@@ -709,6 +592,7 @@ async function sendSlackMessage(to, content, opts) {
|
|
|
709
592
|
...Object.hasOwn(opts, "nativeDataFallbackBaseText") ? { nativeDataFallbackBaseText: opts.nativeDataFallbackBaseText } : {},
|
|
710
593
|
...opts.uploadFileName ? { uploadFileName: opts.uploadFileName } : {},
|
|
711
594
|
...opts.uploadTitle ? { uploadTitle: opts.uploadTitle } : {},
|
|
595
|
+
...typeof onDeliveryResult === "function" ? { onDeliveryResult } : {},
|
|
712
596
|
blocks: opts.blocks
|
|
713
597
|
});
|
|
714
598
|
}
|
|
@@ -842,48 +726,34 @@ function collectSlackShareMaps(file) {
|
|
|
842
726
|
const shares = file.shares;
|
|
843
727
|
return [shares.public, shares.private].filter((value) => Boolean(value) && typeof value === "object" && !Array.isArray(value));
|
|
844
728
|
}
|
|
845
|
-
function
|
|
846
|
-
const
|
|
847
|
-
for (const shareMap of collectSlackShareMaps(file)) for (const
|
|
848
|
-
const
|
|
849
|
-
if (
|
|
850
|
-
}
|
|
851
|
-
return ids;
|
|
852
|
-
}
|
|
853
|
-
function collectSlackThreadShares(file, channelId) {
|
|
854
|
-
const matches = [];
|
|
855
|
-
for (const shareMap of collectSlackShareMaps(file)) {
|
|
856
|
-
const rawEntries = shareMap[channelId];
|
|
857
|
-
if (!Array.isArray(rawEntries)) continue;
|
|
729
|
+
function collectSlackShares(file) {
|
|
730
|
+
const shares = [];
|
|
731
|
+
for (const shareMap of collectSlackShareMaps(file)) for (const [rawChannelId, rawEntries] of Object.entries(shareMap)) {
|
|
732
|
+
const channelId = normalizeOptionalString(rawChannelId);
|
|
733
|
+
if (!channelId || !Array.isArray(rawEntries)) continue;
|
|
858
734
|
for (const rawEntry of rawEntries) {
|
|
859
735
|
if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) continue;
|
|
860
736
|
const entry = rawEntry;
|
|
861
737
|
const ts = typeof entry.ts === "string" ? normalizeOptionalString(entry.ts) : void 0;
|
|
862
738
|
const threadTs = typeof entry.thread_ts === "string" ? normalizeOptionalString(entry.thread_ts) : void 0;
|
|
863
|
-
|
|
739
|
+
if (ts || threadTs) shares.push({
|
|
864
740
|
channelId,
|
|
865
741
|
ts,
|
|
866
742
|
threadTs
|
|
867
743
|
});
|
|
868
744
|
}
|
|
869
745
|
}
|
|
870
|
-
return
|
|
746
|
+
return shares;
|
|
871
747
|
}
|
|
872
|
-
function
|
|
748
|
+
function lacksSlackScopeProof(params) {
|
|
873
749
|
const channelId = normalizeOptionalString(params.channelId);
|
|
874
|
-
if (!channelId) return
|
|
750
|
+
if (!channelId) return true;
|
|
875
751
|
const threadId = normalizeOptionalString(params.threadId);
|
|
876
752
|
const directIds = collectSlackDirectShareChannelIds(params.file);
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
const inChannel = directIds.has(channelId) || sharedIds.has(channelId);
|
|
880
|
-
if (hasChannelEvidence && !inChannel) return true;
|
|
753
|
+
const shares = collectSlackShares(params.file);
|
|
754
|
+
if (!(directIds.has(channelId) || shares.some((entry) => entry.channelId === channelId))) return true;
|
|
881
755
|
if (!threadId) return false;
|
|
882
|
-
|
|
883
|
-
if (threadShares.length === 0) return false;
|
|
884
|
-
const threadEvidence = threadShares.filter((entry) => entry.threadTs || entry.ts);
|
|
885
|
-
if (threadEvidence.length === 0) return false;
|
|
886
|
-
return !threadEvidence.some((entry) => entry.threadTs === threadId || entry.ts === threadId);
|
|
756
|
+
return !shares.some((entry) => entry.channelId === channelId && (entry.threadTs === threadId || entry.ts === threadId));
|
|
887
757
|
}
|
|
888
758
|
/**
|
|
889
759
|
* Downloads a Slack file by ID and saves it to the local media store.
|
|
@@ -893,13 +763,14 @@ function hasSlackScopeMismatch(params) {
|
|
|
893
763
|
async function downloadSlackFile(fileId, opts) {
|
|
894
764
|
const token = resolveToken(opts.token, opts.accountId, opts.cfg);
|
|
895
765
|
const client = await getClient(opts);
|
|
896
|
-
const
|
|
897
|
-
if (!file?.url_private_download && !file?.url_private) return null;
|
|
898
|
-
if (hasSlackScopeMismatch({
|
|
766
|
+
const isFileAllowed = (file) => !lacksSlackScopeProof({
|
|
899
767
|
file,
|
|
900
768
|
channelId: opts.channelId,
|
|
901
769
|
threadId: opts.threadId
|
|
902
|
-
})
|
|
770
|
+
});
|
|
771
|
+
const file = (await client.files.info({ file: fileId })).file;
|
|
772
|
+
if (!file?.url_private_download && !file?.url_private) return null;
|
|
773
|
+
if (!isFileAllowed(file)) return null;
|
|
903
774
|
return (await resolveSlackMedia({
|
|
904
775
|
files: [{
|
|
905
776
|
id: file.id,
|
|
@@ -909,9 +780,10 @@ async function downloadSlackFile(fileId, opts) {
|
|
|
909
780
|
url_private_download: file.url_private_download
|
|
910
781
|
}],
|
|
911
782
|
client,
|
|
783
|
+
isRefreshedFileAllowed: isFileAllowed,
|
|
912
784
|
token,
|
|
913
785
|
maxBytes: opts.maxBytes
|
|
914
786
|
}))?.[0] ?? null;
|
|
915
787
|
}
|
|
916
788
|
//#endregion
|
|
917
|
-
export { media_exports as _,
|
|
789
|
+
export { media_exports as _, editSlackRenderedMessage as a, formatSlackFileReferenceList as b, listSlackPins as c, reactSlackMessage as d, readSlackMessages as f, unpinSlackMessage as g, sendSlackMessage as h, editSlackMessage as i, listSlackReactions as l, removeSlackReaction as m, deleteSlackMessage as n, getSlackMemberInfo as o, removeOwnSlackReactions as p, downloadSlackFile as r, listSlackEmojis as s, actions_exports as t, pinSlackMessage as u, logVerbose$1 as v, buildSlackEditTextPayload as x, formatSlackFileReference as y };
|
package/dist/api.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { n as registerSlackHttpHandler, r as normalizeSlackWebhookPath, t as handleSlackHttpRequest } from "./registry-bbjH7IHX.js";
|
|
2
|
-
import { a as resolveSlackAccount, i as resolveDefaultSlackAccountId, n as listSlackAccountIds, r as mergeSlackAccountConfig, t as listEnabledSlackAccounts } from "./accounts-
|
|
3
|
-
import {
|
|
4
|
-
import { t as inspectSlackAccount } from "./account-inspect-
|
|
2
|
+
import { a as resolveSlackAccount, i as resolveDefaultSlackAccountId, n as listSlackAccountIds, r as mergeSlackAccountConfig, t as listEnabledSlackAccounts } from "./accounts-Dm_H77gH.js";
|
|
3
|
+
import { r as resolveSlackReplyToMode } from "./conversation-binding-route-DFVLUdYF.js";
|
|
4
|
+
import { t as inspectSlackAccount } from "./account-inspect-CN2hBsim.js";
|
|
5
5
|
import { a as parseSlackTarget, i as normalizeSlackMessagingTarget, o as resolveSlackChannelId, r as looksLikeSlackTargetId } from "./target-parsing-BnMD2ZqZ.js";
|
|
6
6
|
import "./targets-Cx5W_n3W.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { n as extractSlackToolSend, r as listSlackMessageActions } from "./message-tool-api-
|
|
10
|
-
import { _ as resolveSlackWriteClientOptions, c as createSlackWebClient, d as getSlackWriteClient, f as SLACK_DEFAULT_RETRY_OPTIONS, g as resolveSlackWebClientOptions, l as createSlackWriteClient, p as SLACK_WRITE_RETRY_OPTIONS, s as createSlackTokenCacheKey, t as probeSlack } from "./probe-
|
|
11
|
-
import { n as resolveSlackChannelType } from "./channel-type-
|
|
12
|
-
import { t as slackSetupPlugin } from "./channel.setup-
|
|
13
|
-
import {
|
|
14
|
-
import { f as recordSlackThreadParticipation, l as hasSlackThreadParticipation, s as clearSlackThreadParticipationCache } from "./send-
|
|
15
|
-
import { n as listSlackDirectoryGroupsFromConfig, r as listSlackDirectoryPeersFromConfig } from "./directory-config-
|
|
16
|
-
import { t as collectSlackSecurityAuditFindings } from "./security-audit-
|
|
17
|
-
import { n as resolveSlackRuntimeGroupPolicy } from "./provider-
|
|
7
|
+
import { H as buildSlackPresentationBlocks, V as buildSlackInteractiveBlocks, c as allowListMatches, d as normalizeSlackAllowOwnerEntry, f as normalizeSlackSlug, h as resolveSlackUserAllowed, ht as validateSlackBlocksArray, i as resolveSlackGroupToolPolicy, l as normalizeAllowList, mt as parseSlackBlocksInput, p as resolveSlackAllowListMatch, pt as SLACK_MAX_BLOCKS, r as resolveSlackGroupRequireMention, u as normalizeAllowListLower, zt as resolveSlackAutoThreadId } from "./group-policy-CU1tEGpS.js";
|
|
8
|
+
import { n as buildSlackThreadingToolContext, t as slackPlugin } from "./channel-C_vnTgxo.js";
|
|
9
|
+
import { n as extractSlackToolSend, r as listSlackMessageActions } from "./message-tool-api-CWosHSi5.js";
|
|
10
|
+
import { _ as resolveSlackWriteClientOptions, c as createSlackWebClient, d as getSlackWriteClient, f as SLACK_DEFAULT_RETRY_OPTIONS, g as resolveSlackWebClientOptions, l as createSlackWriteClient, p as SLACK_WRITE_RETRY_OPTIONS, s as createSlackTokenCacheKey, t as probeSlack } from "./probe-4_aHtVT3.js";
|
|
11
|
+
import { n as resolveSlackChannelType } from "./channel-type-j-2lalcC.js";
|
|
12
|
+
import { t as slackSetupPlugin } from "./channel.setup-aal8tokM.js";
|
|
13
|
+
import { c as listSlackPins, d as reactSlackMessage, f as readSlackMessages, g as unpinSlackMessage, h as sendSlackMessage, i as editSlackMessage, l as listSlackReactions, m as removeSlackReaction, n as deleteSlackMessage, o as getSlackMemberInfo, p as removeOwnSlackReactions, r as downloadSlackFile, s as listSlackEmojis, u as pinSlackMessage } from "./actions-XdQyjG_p.js";
|
|
14
|
+
import { f as recordSlackThreadParticipation, l as hasSlackThreadParticipation, s as clearSlackThreadParticipationCache } from "./send-DtjEnlLh.js";
|
|
15
|
+
import { n as listSlackDirectoryGroupsFromConfig, r as listSlackDirectoryPeersFromConfig } from "./directory-config-DqfQ42OV.js";
|
|
16
|
+
import { t as collectSlackSecurityAuditFindings } from "./security-audit-B_yKr7MW.js";
|
|
17
|
+
import { n as resolveSlackRuntimeGroupPolicy } from "./provider-D4nDgxCh.js";
|
|
18
18
|
export { SLACK_DEFAULT_RETRY_OPTIONS, SLACK_MAX_BLOCKS, SLACK_WRITE_RETRY_OPTIONS, allowListMatches, buildSlackInteractiveBlocks, buildSlackPresentationBlocks, buildSlackThreadingToolContext, clearSlackThreadParticipationCache, collectSlackSecurityAuditFindings, createSlackTokenCacheKey, createSlackWebClient, createSlackWriteClient, deleteSlackMessage, downloadSlackFile, editSlackMessage, extractSlackToolSend, getSlackMemberInfo, getSlackWriteClient, handleSlackHttpRequest, hasSlackThreadParticipation, inspectSlackAccount, listEnabledSlackAccounts, listSlackAccountIds, listSlackDirectoryGroupsFromConfig, listSlackDirectoryPeersFromConfig, listSlackEmojis, listSlackMessageActions, listSlackPins, listSlackReactions, looksLikeSlackTargetId, mergeSlackAccountConfig, normalizeAllowList, normalizeAllowListLower, normalizeSlackAllowOwnerEntry, normalizeSlackMessagingTarget, normalizeSlackSlug, normalizeSlackWebhookPath, parseSlackBlocksInput, parseSlackTarget, pinSlackMessage, probeSlack, reactSlackMessage, readSlackMessages, recordSlackThreadParticipation, registerSlackHttpHandler, removeOwnSlackReactions, removeSlackReaction, resolveDefaultSlackAccountId, resolveSlackAccount, resolveSlackAllowListMatch, resolveSlackAutoThreadId, resolveSlackChannelId, resolveSlackChannelType, resolveSlackGroupRequireMention, resolveSlackGroupToolPolicy, resolveSlackReplyToMode, resolveSlackRuntimeGroupPolicy, resolveSlackUserAllowed, resolveSlackWebClientOptions, resolveSlackWriteClientOptions, sendSlackMessage, slackPlugin, slackSetupPlugin, unpinSlackMessage, validateSlackBlocksArray };
|