@openclaw/slack 2026.8.1-beta.3 → 2026.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-configured-sUohAxZr.js +33 -0
- package/dist/account-inspect-C3sePHWa.js +87 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-BlzxuYle.js → accounts-Dm_H77gH.js} +7 -10
- package/dist/{accounts.runtime-CbabBL8x.js → accounts.runtime-DRuEK6mL.js} +1 -1
- package/dist/{action-runtime-D6jg2CQd.js → action-runtime-B0kRJ69h.js} +90 -75
- package/dist/action-runtime.runtime-IuA14rev.js +2 -0
- package/dist/{actions-DFk0ANVB.js → actions-BOxiu2Vy.js} +278 -102
- package/dist/api.js +15 -15
- package/dist/{approval-handler.runtime-BNvAoKdK.js → approval-handler.runtime-l5_2JLqi.js} +58 -180
- package/dist/{channel-CA5w7qDF.js → channel-BguxhhNG.js} +97 -154
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-CZWv55Wu.js → channel-type-ChkODKBW.js} +3 -3
- package/dist/{channel.setup-CpyYsEXH.js → channel.setup-BJohRJha.js} +54 -68
- package/dist/{config-schema-CN3XZRX5.js → config-schema-B9GwoRlE.js} +24 -15
- package/dist/configured-state.js +34 -0
- package/dist/{conversation-binding-route-DFVLUdYF.js → conversation-binding-route-Vee8Dgbf.js} +2 -2
- package/dist/{directory-config-BGYyuzWh.js → directory-config-Bmw4ykSy.js} +5 -4
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DjUJQLbq.js → directory-live-BOILcXPo.js} +2 -2
- package/dist/{doctor-contract-BAy7-EUQ.js → doctor-contract-BNjw9bxb.js} +5 -4
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{group-policy-DyfB_ZIE.js → group-policy-BYH74y50.js} +643 -774
- package/dist/{message-tool-api-CqMr5Rmc.js → message-tool-api-BsZbsulu.js} +23 -5
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-Chrecrb9.js → monitor-B72wWXWg.js} +3 -3
- package/dist/{outbound-adapter-DuRqAQXK.js → outbound-adapter-CPgYQ-BM.js} +94 -69
- package/dist/{pipeline.runtime-Bbfd5VFW.js → pipeline.runtime-CcdujV99.js} +357 -544
- package/dist/{policy-BKXSxrIS.js → policy-CUpBeOt9.js} +7 -4
- package/dist/{probe-BVA65leh.js → probe-gj5yQgN2.js} +209 -21
- package/dist/{provider-CUUiwsg2.js → provider-DW9YC_no.js} +301 -179
- package/dist/{relay-source-mhpMMRG-.js → relay-source-BLMdBrAw.js} +6 -4
- package/dist/{replies-SnWyXcsL.js → replies-DLjQ8RYU.js} +25 -10
- package/dist/{resolve-channels-BSpqC8jU.js → resolve-channels-Bv6IiGZ4.js} +4 -3
- package/dist/{resolve-users-Dvz9pDe0.js → resolve-users-BXw2pA7y.js} +4 -3
- package/dist/runtime-api.js +11 -11
- package/dist/{scopes-BSk4GZvZ.js → scopes-B9HRguDe.js} +1 -1
- package/dist/{send-CtnOxKCc.js → send-GUz4_v2E.js} +58 -42
- package/dist/send-results-eeOu_HYm.js +23 -0
- package/dist/{send.runtime-kYctMHSd.js → send.runtime-rScD-UJi.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BPFfp6So.js → setup-surface-Cc3P-z35.js} +6 -6
- package/dist/{shared-DJBaslN7.js → shared-CQGVZ_8a.js} +28 -8
- package/dist/{slash-dispatch.runtime-Cf2FTrnf.js → slash-dispatch.runtime-C2015r6s.js} +3 -3
- package/dist/{target-parsing-BnMD2ZqZ.js → target-parsing-PbxGDbr9.js} +11 -6
- package/dist/{targets-Cx5W_n3W.js → targets-7FexXJ62.js} +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/bolt/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/bolt/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/bolt/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/bolt/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/bolt/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/bolt/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/README.md +2 -0
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/package.json +1 -1
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/README.md +71 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/package.json +52 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/package.json +16 -10
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/README.md +2 -0
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/package.json +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/socket-mode/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/socket-mode/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/socket-mode/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/socket-mode/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/socket-mode/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/socket-mode/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/socket-mode/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/socket-mode/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/socket-mode/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/web-api/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/web-api/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/web-api/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +41 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +14 -6
- package/package.json +9 -7
- package/dist/account-configured-BwfXBo_F.js +0 -14
- package/dist/account-inspect-YJvFBbCR.js +0 -89
- package/dist/action-runtime.runtime-JtoOK9l5.js +0 -2
- package/dist/actions.runtime-CYLsYRai.js +0 -2
- package/dist/runtime-api-DBi7xc_g.js +0 -10
- package/dist/slack-client-kind-BXyOOICI.js +0 -94
- package/node_modules/@slack/bolt/node_modules/negotiator/HISTORY.md +0 -114
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { hasConfiguredAccountValue } from "openclaw/plugin-sdk/account-resolution";
|
|
2
|
+
import { hasConfiguredSecretInput } from "openclaw/plugin-sdk/secret-input";
|
|
3
|
+
//#region extensions/slack/src/account-configured.ts
|
|
4
|
+
function hasSlackAccountCredentials(params) {
|
|
5
|
+
if (!params.identityTokenConfigured) return false;
|
|
6
|
+
const mode = params.config.mode ?? "socket";
|
|
7
|
+
if (mode === "http") return hasConfiguredAccountValue(params.config.signingSecret);
|
|
8
|
+
if (mode === "relay") {
|
|
9
|
+
const relay = params.config.relay;
|
|
10
|
+
return hasConfiguredAccountValue(relay?.url) && hasConfiguredAccountValue(relay?.authToken) && hasConfiguredAccountValue(relay?.gatewayId);
|
|
11
|
+
}
|
|
12
|
+
return params.appTokenConfigured;
|
|
13
|
+
}
|
|
14
|
+
function isSlackPluginAccountConfigured(account) {
|
|
15
|
+
const identityToken = account.identity === "user" ? account.userToken : account.botToken;
|
|
16
|
+
return hasSlackAccountCredentials({
|
|
17
|
+
config: account.config,
|
|
18
|
+
identityTokenConfigured: Boolean(identityToken?.trim()),
|
|
19
|
+
appTokenConfigured: Boolean(account.appToken?.trim())
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function isSlackSetupAccountConfigured(account) {
|
|
23
|
+
if (account.config.mode === "relay") return isSlackPluginAccountConfigured(account);
|
|
24
|
+
const identityToken = account.identity === "user" ? account.userToken : account.botToken;
|
|
25
|
+
const configuredIdentityToken = account.identity === "user" ? account.config.userToken : account.config.botToken;
|
|
26
|
+
return hasSlackAccountCredentials({
|
|
27
|
+
config: account.config,
|
|
28
|
+
identityTokenConfigured: Boolean(identityToken?.trim()) || hasConfiguredSecretInput(configuredIdentityToken),
|
|
29
|
+
appTokenConfigured: Boolean(account.appToken?.trim()) || hasConfiguredSecretInput(account.config.appToken)
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { isSlackPluginAccountConfigured as n, isSlackSetupAccountConfigured as r, hasSlackAccountCredentials as t };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { t as hasSlackAccountCredentials } from "./account-configured-sUohAxZr.js";
|
|
2
|
+
import { i as resolveDefaultSlackAccountId, r as mergeSlackAccountConfig } from "./accounts-Dm_H77gH.js";
|
|
3
|
+
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
4
|
+
import { hasConfiguredSecretInput, normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
5
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
+
//#region extensions/slack/src/account-inspect.ts
|
|
7
|
+
function inspectSlackToken(value) {
|
|
8
|
+
const token = normalizeSecretInputString(value);
|
|
9
|
+
if (token) return {
|
|
10
|
+
token,
|
|
11
|
+
source: "config",
|
|
12
|
+
status: "available"
|
|
13
|
+
};
|
|
14
|
+
if (hasConfiguredSecretInput(value)) return {
|
|
15
|
+
source: "config",
|
|
16
|
+
status: "configured_unavailable"
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
source: "none",
|
|
20
|
+
status: "missing"
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function resolveInspectedSlackToken(configured, envToken) {
|
|
24
|
+
return configured.status === "missing" && envToken ? {
|
|
25
|
+
token: envToken,
|
|
26
|
+
source: "env",
|
|
27
|
+
status: "available"
|
|
28
|
+
} : configured;
|
|
29
|
+
}
|
|
30
|
+
function inspectSlackAccount(params) {
|
|
31
|
+
const accountId = normalizeAccountId(params.accountId ?? resolveDefaultSlackAccountId(params.cfg));
|
|
32
|
+
const merged = mergeSlackAccountConfig(params.cfg, accountId);
|
|
33
|
+
const enabled = params.cfg.channels?.slack?.enabled !== false && merged.enabled !== false;
|
|
34
|
+
const allowEnv = accountId === DEFAULT_ACCOUNT_ID;
|
|
35
|
+
const mode = merged.mode ?? "socket";
|
|
36
|
+
const identity = merged.postAs ?? "bot";
|
|
37
|
+
const isHttpMode = mode === "http";
|
|
38
|
+
const isSocketMode = mode === "socket";
|
|
39
|
+
const configBot = inspectSlackToken(merged.botToken);
|
|
40
|
+
const configApp = inspectSlackToken(isSocketMode ? merged.appToken : void 0);
|
|
41
|
+
const configSigningSecret = inspectSlackToken(merged.signingSecret);
|
|
42
|
+
const configUser = inspectSlackToken(merged.userToken);
|
|
43
|
+
const envBot = allowEnv ? normalizeSecretInputString(params.envBotToken ?? process.env.SLACK_BOT_TOKEN) : void 0;
|
|
44
|
+
const envApp = allowEnv && isSocketMode ? normalizeSecretInputString(params.envAppToken ?? process.env.SLACK_APP_TOKEN) : void 0;
|
|
45
|
+
const envUser = allowEnv ? normalizeSecretInputString(params.envUserToken ?? process.env.SLACK_USER_TOKEN) : void 0;
|
|
46
|
+
const botCredential = resolveInspectedSlackToken(configBot, envBot);
|
|
47
|
+
const appCredential = resolveInspectedSlackToken(configApp, envApp);
|
|
48
|
+
const userCredential = resolveInspectedSlackToken(configUser, envUser);
|
|
49
|
+
return {
|
|
50
|
+
accountId,
|
|
51
|
+
enabled,
|
|
52
|
+
...identity === "user" ? { identity } : {},
|
|
53
|
+
name: normalizeOptionalString(merged.name),
|
|
54
|
+
mode,
|
|
55
|
+
botToken: botCredential.token,
|
|
56
|
+
appToken: appCredential.token,
|
|
57
|
+
...isHttpMode ? { signingSecret: configSigningSecret.token } : {},
|
|
58
|
+
userToken: userCredential.token,
|
|
59
|
+
botTokenSource: botCredential.source,
|
|
60
|
+
appTokenSource: appCredential.source,
|
|
61
|
+
...isHttpMode ? { signingSecretSource: configSigningSecret.source } : {},
|
|
62
|
+
userTokenSource: userCredential.source,
|
|
63
|
+
botTokenStatus: botCredential.status,
|
|
64
|
+
appTokenStatus: appCredential.status,
|
|
65
|
+
...isHttpMode ? { signingSecretStatus: configSigningSecret.status } : {},
|
|
66
|
+
userTokenStatus: userCredential.status,
|
|
67
|
+
configured: hasSlackAccountCredentials({
|
|
68
|
+
config: merged,
|
|
69
|
+
identityTokenConfigured: (identity === "user" ? userCredential : botCredential).status !== "missing",
|
|
70
|
+
appTokenConfigured: appCredential.status !== "missing"
|
|
71
|
+
}),
|
|
72
|
+
config: merged,
|
|
73
|
+
groupPolicy: merged.groupPolicy,
|
|
74
|
+
textChunkLimit: merged.textChunkLimit,
|
|
75
|
+
mediaMaxMb: merged.mediaMaxMb,
|
|
76
|
+
reactionNotifications: merged.reactionNotifications,
|
|
77
|
+
reactionAllowlist: merged.reactionAllowlist,
|
|
78
|
+
replyToMode: merged.replyToMode,
|
|
79
|
+
replyToModeByChatType: merged.replyToModeByChatType,
|
|
80
|
+
actions: merged.actions,
|
|
81
|
+
slashCommand: merged.slashCommand,
|
|
82
|
+
dm: merged.dm,
|
|
83
|
+
channels: merged.channels
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { inspectSlackAccount as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as inspectSlackAccount } from "./account-inspect-
|
|
1
|
+
import { t as inspectSlackAccount } from "./account-inspect-C3sePHWa.js";
|
|
2
2
|
//#region extensions/slack/account-inspect-api.ts
|
|
3
3
|
function inspectSlackReadOnlyAccount(cfg, accountId) {
|
|
4
4
|
return inspectSlackAccount({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as hasSlackAccountCredentials } from "./account-configured-sUohAxZr.js";
|
|
1
2
|
import { DEFAULT_ACCOUNT_ID, createAccountListHelpers, hasConfiguredAccountValue, normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
2
3
|
import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
3
4
|
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -46,16 +47,12 @@ const { listAccountIds, resolveDefaultAccountId, resolveAccountConfig: resolveMe
|
|
|
46
47
|
],
|
|
47
48
|
hasImplicitDefaultAccount: (cfg) => {
|
|
48
49
|
const slack = cfg.channels?.slack;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
if (!(hasConfiguredAccountValue(slack?.botToken) || hasConfiguredAccountValue(process.env.SLACK_BOT_TOKEN))) return false;
|
|
56
|
-
if (slack?.mode === "http") return hasConfiguredAccountValue(slack.signingSecret);
|
|
57
|
-
if (slack?.mode === "relay") return hasConfiguredAccountValue(slack.relay?.url) && hasConfiguredAccountValue(slack.relay?.authToken) && hasConfiguredAccountValue(slack.relay?.gatewayId);
|
|
58
|
-
return hasConfiguredAccountValue(slack?.appToken) || hasConfiguredAccountValue(process.env.SLACK_APP_TOKEN);
|
|
50
|
+
const userIdentity = slack?.postAs === "user";
|
|
51
|
+
return hasSlackAccountCredentials({
|
|
52
|
+
config: slack ?? {},
|
|
53
|
+
identityTokenConfigured: hasConfiguredAccountValue(userIdentity ? slack?.userToken : slack?.botToken) || hasConfiguredAccountValue(userIdentity ? process.env.SLACK_USER_TOKEN : process.env.SLACK_BOT_TOKEN),
|
|
54
|
+
appTokenConfigured: hasConfiguredAccountValue(slack?.appToken) || hasConfiguredAccountValue(process.env.SLACK_APP_TOKEN)
|
|
55
|
+
});
|
|
59
56
|
}
|
|
60
57
|
});
|
|
61
58
|
const listSlackAccountIds = listAccountIds;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as resolveSlackAccount, l as resolveSlackOperationToken, o as resolveSlackAccountAllowFrom } from "./accounts-
|
|
1
|
+
import { a as resolveSlackAccount, l as resolveSlackOperationToken, o as resolveSlackAccountAllowFrom } from "./accounts-Dm_H77gH.js";
|
|
2
2
|
export { resolveSlackAccount, resolveSlackAccountAllowFrom, resolveSlackOperationToken };
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { a as parseSlackTarget, n as formatSlackTarget, o as resolveSlackChannelId } from "./target-parsing-
|
|
2
|
-
import { t as slackContextTargetsMatch } from "./targets-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { a as parseSlackTarget, n as formatSlackTarget, o as resolveSlackChannelId } from "./target-parsing-PbxGDbr9.js";
|
|
2
|
+
import { t as slackContextTargetsMatch } from "./targets-7FexXJ62.js";
|
|
3
|
+
import { At as SLACK_PRIVATE_ACTION_DELIVERY_RESULT, b as hasSlackNativeDataBlock, c as assertSlackDetachedTargetAllowed, jt as resolveSlackAutoThreadId, ot as parseSlackBlocksInput, t as buildSlackChannelIdCandidates, yt as getSlackInstallationKind } from "./group-policy-BYH74y50.js";
|
|
4
|
+
import { n as resolveSlackChannelConfig, t as isSlackChannelAllowedByPolicy } from "./policy-CUpBeOt9.js";
|
|
5
|
+
import { t as mergeSlackSendResults } from "./send-results-eeOu_HYm.js";
|
|
6
6
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
7
7
|
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
9
9
|
import { isSingleUseReplyToMode } from "openclaw/plugin-sdk/reply-reference";
|
|
10
10
|
import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
|
|
11
|
+
import { createActionGate, imageResultFromFile, jsonResult, readPositiveIntegerParam, readReactionParams, readStringParam, withNormalizedTimestamp } from "openclaw/plugin-sdk/channel-actions";
|
|
11
12
|
import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
12
13
|
//#region extensions/slack/src/action-runtime.ts
|
|
13
14
|
const messagingActions = /* @__PURE__ */ new Set([
|
|
15
|
+
"openConversation",
|
|
14
16
|
"sendMessage",
|
|
15
17
|
"uploadFile",
|
|
16
18
|
"editMessage",
|
|
@@ -24,10 +26,10 @@ const pinActions = /* @__PURE__ */ new Set([
|
|
|
24
26
|
"unpinMessage",
|
|
25
27
|
"listPins"
|
|
26
28
|
]);
|
|
27
|
-
const
|
|
28
|
-
const loadSlackActionsRuntime = createLazyRuntimeModule(() => import("./actions
|
|
29
|
-
const loadSlackAccountsRuntime = createLazyRuntimeModule(() => import("./accounts.runtime-
|
|
30
|
-
const loadSlackChannelTypeRuntime = createLazyRuntimeModule(() => import("./channel-type-
|
|
29
|
+
const SLACK_REACTION_RESULT_LIMIT = 100;
|
|
30
|
+
const loadSlackActionsRuntime = createLazyRuntimeModule(() => import("./actions-BOxiu2Vy.js").then((n) => n.t));
|
|
31
|
+
const loadSlackAccountsRuntime = createLazyRuntimeModule(() => import("./accounts.runtime-DRuEK6mL.js"));
|
|
32
|
+
const loadSlackChannelTypeRuntime = createLazyRuntimeModule(() => import("./channel-type-ChkODKBW.js").then((n) => n.t));
|
|
31
33
|
function createLazySlackAction(key) {
|
|
32
34
|
return (async (...args) => {
|
|
33
35
|
const action = (await loadSlackActionsRuntime())[key];
|
|
@@ -42,6 +44,7 @@ const slackActionRuntime = {
|
|
|
42
44
|
listSlackEmojis: createLazySlackAction("listSlackEmojis"),
|
|
43
45
|
listSlackPins: createLazySlackAction("listSlackPins"),
|
|
44
46
|
listSlackReactions: createLazySlackAction("listSlackReactions"),
|
|
47
|
+
openSlackConversation: createLazySlackAction("openSlackConversation"),
|
|
45
48
|
parseSlackBlocksInput,
|
|
46
49
|
pinSlackMessage: createLazySlackAction("pinSlackMessage"),
|
|
47
50
|
reactSlackMessage: createLazySlackAction("reactSlackMessage"),
|
|
@@ -278,7 +281,8 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
278
281
|
accountId
|
|
279
282
|
});
|
|
280
283
|
const resolveChannelTarget = () => resolveSlackActionChannelTarget(account, readStringParam(params, "channelId", { required: true }), context);
|
|
281
|
-
const
|
|
284
|
+
const actionConfig = account.actions ?? cfg.channels?.slack?.actions;
|
|
285
|
+
const isActionEnabled = createActionGate(actionConfig);
|
|
282
286
|
const botToken = account.botToken?.trim();
|
|
283
287
|
const buildActionOpts = (operation, teamId) => {
|
|
284
288
|
const token = resolveSlackOperationToken(account, operation);
|
|
@@ -318,10 +322,13 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
318
322
|
removed: emoji
|
|
319
323
|
});
|
|
320
324
|
}
|
|
321
|
-
if (isEmpty)
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
+
if (isEmpty) {
|
|
326
|
+
const removed = await slackActionRuntime.removeOwnSlackReactions(channelId, messageId, writeOpts);
|
|
327
|
+
return jsonResult({
|
|
328
|
+
ok: true,
|
|
329
|
+
removed
|
|
330
|
+
});
|
|
331
|
+
}
|
|
325
332
|
await slackActionRuntime.reactSlackMessage(channelId, messageId, emoji, writeOpts);
|
|
326
333
|
return jsonResult({
|
|
327
334
|
ok: true,
|
|
@@ -329,14 +336,16 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
329
336
|
});
|
|
330
337
|
}
|
|
331
338
|
await assertReadTargetAllowed(target);
|
|
332
|
-
const limit = Math.min(readPositiveIntegerParam(params, "limit", { message: "limit must be a positive integer." }) ??
|
|
339
|
+
const limit = Math.min(readPositiveIntegerParam(params, "limit", { message: "limit must be a positive integer." }) ?? SLACK_REACTION_RESULT_LIMIT, SLACK_REACTION_RESULT_LIMIT);
|
|
340
|
+
const reactions = await slackActionRuntime.listSlackReactions(channelId, messageId, readOpts);
|
|
333
341
|
return jsonResult({
|
|
334
342
|
ok: true,
|
|
335
|
-
reactions:
|
|
343
|
+
reactions: reactions?.map((reaction) => reaction.users ? Object.assign({}, reaction, { users: reaction.users.slice(0, limit) }) : reaction)
|
|
336
344
|
});
|
|
337
345
|
}
|
|
338
346
|
if (messagingActions.has(action)) {
|
|
339
347
|
if (!isActionEnabled("messages")) throw new Error("Slack messages are disabled.");
|
|
348
|
+
const sentResults = [];
|
|
340
349
|
const sendSlackMessage = async (target, content, options) => {
|
|
341
350
|
const replyReference = context?.hasRepliedRef && slackContextTargetsMatch(target, context) ? context.hasRepliedRef : void 0;
|
|
342
351
|
const result = await slackActionRuntime.sendSlackMessage(target, content, {
|
|
@@ -346,9 +355,22 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
346
355
|
} } : {}
|
|
347
356
|
});
|
|
348
357
|
if (replyReference) replyReference.value = true;
|
|
358
|
+
sentResults.push(result);
|
|
349
359
|
return result;
|
|
350
360
|
};
|
|
351
361
|
switch (action) {
|
|
362
|
+
case "openConversation": {
|
|
363
|
+
const teamId = readStringParam(params, "teamId") ?? resolveTrustedCurrentSlackTeamId({
|
|
364
|
+
account,
|
|
365
|
+
context
|
|
366
|
+
});
|
|
367
|
+
assertSlackDetachedTargetAllowed(account.accountId, teamId);
|
|
368
|
+
const result = await slackActionRuntime.openSlackConversation(params.userIds, buildActionOpts("write", teamId));
|
|
369
|
+
return jsonResult({
|
|
370
|
+
ok: true,
|
|
371
|
+
...result
|
|
372
|
+
});
|
|
373
|
+
}
|
|
352
374
|
case "sendMessage": {
|
|
353
375
|
const destination = resolveSlackActionTarget(account, readStringParam(params, "to", { required: true }), context).routingTarget;
|
|
354
376
|
const content = readStringParam(params, "content", { allowEmpty: true });
|
|
@@ -396,35 +418,27 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
396
418
|
blocks
|
|
397
419
|
});
|
|
398
420
|
};
|
|
421
|
+
if (mediaUrl && (preparedMessages?.length || blocks)) await sendSlackMessage(destination, "", {
|
|
422
|
+
...preparedMessages?.length ? baseSendOpts : sendOpts,
|
|
423
|
+
mediaUrl
|
|
424
|
+
});
|
|
425
|
+
if (preparedMessages?.length) for (const [index, message] of preparedMessages.entries()) await sendSlackMessage(destination, message.text, {
|
|
426
|
+
...baseSendOpts,
|
|
427
|
+
...index === 0 && replyBroadcast ? { replyBroadcast: true } : {},
|
|
428
|
+
...message.blocks ? { blocks: message.blocks } : {},
|
|
429
|
+
...message.authoredTextPlacement ? { authoredTextPlacement: message.authoredTextPlacement } : {},
|
|
430
|
+
...Object.hasOwn(message, "nativeDataFallbackBaseText") ? { nativeDataFallbackBaseText: message.nativeDataFallbackBaseText } : {},
|
|
431
|
+
...message.textIsSlackPlainText ? { textIsSlackPlainText: true } : {}
|
|
432
|
+
});
|
|
433
|
+
else if (blocks) await sendContentAndBlocks();
|
|
434
|
+
else await sendSlackMessage(destination, content ?? "", {
|
|
435
|
+
...sendOpts,
|
|
436
|
+
mediaUrl: mediaUrl ?? void 0,
|
|
437
|
+
blocks
|
|
438
|
+
});
|
|
399
439
|
return jsonResult({
|
|
400
440
|
ok: true,
|
|
401
|
-
result:
|
|
402
|
-
let lastResult;
|
|
403
|
-
if (mediaUrl) lastResult = await sendSlackMessage(destination, "", {
|
|
404
|
-
...baseSendOpts,
|
|
405
|
-
mediaUrl
|
|
406
|
-
});
|
|
407
|
-
for (const [index, message] of preparedMessages.entries()) lastResult = await sendSlackMessage(destination, message.text, {
|
|
408
|
-
...baseSendOpts,
|
|
409
|
-
...index === 0 && replyBroadcast ? { replyBroadcast: true } : {},
|
|
410
|
-
...message.blocks ? { blocks: message.blocks } : {},
|
|
411
|
-
...message.authoredTextPlacement ? { authoredTextPlacement: message.authoredTextPlacement } : {},
|
|
412
|
-
...Object.hasOwn(message, "nativeDataFallbackBaseText") ? { nativeDataFallbackBaseText: message.nativeDataFallbackBaseText } : {},
|
|
413
|
-
...message.textIsSlackPlainText ? { textIsSlackPlainText: true } : {}
|
|
414
|
-
});
|
|
415
|
-
if (!lastResult) throw new Error("Slack prepared message plan produced no delivery.");
|
|
416
|
-
return lastResult;
|
|
417
|
-
})() : blocks ? await (async () => {
|
|
418
|
-
if (mediaUrl) await sendSlackMessage(destination, "", {
|
|
419
|
-
...sendOpts,
|
|
420
|
-
mediaUrl
|
|
421
|
-
});
|
|
422
|
-
return await sendContentAndBlocks();
|
|
423
|
-
})() : await sendSlackMessage(destination, content ?? "", {
|
|
424
|
-
...sendOpts,
|
|
425
|
-
mediaUrl: mediaUrl ?? void 0,
|
|
426
|
-
blocks
|
|
427
|
-
})
|
|
441
|
+
result: mergeSlackSendResults(sentResults)
|
|
428
442
|
});
|
|
429
443
|
}
|
|
430
444
|
case "uploadFile": {
|
|
@@ -439,19 +453,20 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
439
453
|
const forceDocument = readBooleanParam(params, "forceDocument") === true;
|
|
440
454
|
if (readBooleanParam(params, "replyBroadcast")) throw new Error("Slack replyBroadcast is only supported for text or block thread replies.");
|
|
441
455
|
const threadTs = resolveThreadTsFromContext(readStringParam(params, "threadTs"), destination, context, { suppressImplicitThread: params.topLevel === true || params.threadTs === null });
|
|
456
|
+
const result = await sendSlackMessage(destination, initialComment ?? "", {
|
|
457
|
+
...buildActionOpts("write"),
|
|
458
|
+
mediaUrl: filePath,
|
|
459
|
+
mediaAccess: context?.mediaAccess,
|
|
460
|
+
mediaLocalRoots: context?.mediaLocalRoots,
|
|
461
|
+
mediaReadFile: context?.mediaReadFile,
|
|
462
|
+
threadTs: threadTs ?? void 0,
|
|
463
|
+
...forceDocument ? { forceDocument: true } : {},
|
|
464
|
+
...filename ? { uploadFileName: filename } : {},
|
|
465
|
+
...title ? { uploadTitle: title } : {}
|
|
466
|
+
});
|
|
442
467
|
return jsonResult({
|
|
443
468
|
ok: true,
|
|
444
|
-
result
|
|
445
|
-
...buildActionOpts("write"),
|
|
446
|
-
mediaUrl: filePath,
|
|
447
|
-
mediaAccess: context?.mediaAccess,
|
|
448
|
-
mediaLocalRoots: context?.mediaLocalRoots,
|
|
449
|
-
mediaReadFile: context?.mediaReadFile,
|
|
450
|
-
threadTs: threadTs ?? void 0,
|
|
451
|
-
...forceDocument ? { forceDocument: true } : {},
|
|
452
|
-
...filename ? { uploadFileName: filename } : {},
|
|
453
|
-
...title ? { uploadTitle: title } : {}
|
|
454
|
-
})
|
|
469
|
+
result
|
|
455
470
|
});
|
|
456
471
|
}
|
|
457
472
|
case "editMessage": {
|
|
@@ -513,7 +528,7 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
513
528
|
const { channelId } = target;
|
|
514
529
|
await assertReadTargetAllowed(target);
|
|
515
530
|
const threadId = readStringParam(params, "threadId") ?? readStringParam(params, "replyTo");
|
|
516
|
-
const maxBytes = account.config?.mediaMaxMb ? account.config.mediaMaxMb * 1024 * 1024 :
|
|
531
|
+
const maxBytes = account.config?.mediaMaxMb ? account.config.mediaMaxMb * 1024 * 1024 : 20971520;
|
|
517
532
|
const readToken = resolveSlackOperationToken(account, "read");
|
|
518
533
|
const readOpts = buildActionOpts("read", target.teamId);
|
|
519
534
|
const downloaded = await slackActionRuntime.downloadSlackFile(fileId, {
|
|
@@ -525,7 +540,7 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
525
540
|
});
|
|
526
541
|
if (!downloaded) return jsonResult({
|
|
527
542
|
ok: false,
|
|
528
|
-
error: "File could not be downloaded
|
|
543
|
+
error: "File could not be downloaded. Confirm the fileId came from the requested Slack channel or explicit thread and that the file is accessible and within the size limit."
|
|
529
544
|
});
|
|
530
545
|
if (!isImageContentType(downloaded.contentType)) return jsonResult({
|
|
531
546
|
ok: true,
|
|
@@ -548,10 +563,10 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
548
563
|
path: downloaded.path,
|
|
549
564
|
...downloaded.contentType ? { contentType: downloaded.contentType } : {},
|
|
550
565
|
media: { outbound: false }
|
|
551
|
-
}
|
|
566
|
+
},
|
|
567
|
+
imageSanitization: { maxDimensionPx: cfg.agents?.defaults?.imageMaxDimensionPx }
|
|
552
568
|
});
|
|
553
569
|
}
|
|
554
|
-
default: break;
|
|
555
570
|
}
|
|
556
571
|
}
|
|
557
572
|
if (pinActions.has(action)) {
|
|
@@ -573,12 +588,13 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
573
588
|
return jsonResult({ ok: true });
|
|
574
589
|
}
|
|
575
590
|
await assertReadTargetAllowed(target);
|
|
591
|
+
const normalizedPins = (await slackActionRuntime.listSlackPins(channelId, readOpts)).map((pin) => {
|
|
592
|
+
const message = pin.message ? withNormalizedTimestamp(pin.message, pin.message.ts) : pin.message;
|
|
593
|
+
return message ? Object.assign({}, pin, { message }) : pin;
|
|
594
|
+
});
|
|
576
595
|
return jsonResult({
|
|
577
596
|
ok: true,
|
|
578
|
-
pins:
|
|
579
|
-
const message = pin.message ? withNormalizedTimestamp(pin.message, pin.message.ts) : pin.message;
|
|
580
|
-
return message ? Object.assign({}, pin, { message }) : pin;
|
|
581
|
-
})
|
|
597
|
+
pins: normalizedPins
|
|
582
598
|
});
|
|
583
599
|
}
|
|
584
600
|
if (action === "memberInfo") {
|
|
@@ -594,33 +610,32 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
594
610
|
context
|
|
595
611
|
});
|
|
596
612
|
assertSlackDetachedTargetAllowed(account.accountId, teamId);
|
|
613
|
+
const info = await slackActionRuntime.getSlackMemberInfo(userId, buildActionOpts("read", teamId));
|
|
597
614
|
return jsonResult({
|
|
598
615
|
ok: true,
|
|
599
|
-
info
|
|
616
|
+
info
|
|
600
617
|
});
|
|
601
618
|
}
|
|
602
619
|
if (action === "emojiList") {
|
|
603
620
|
if (!isActionEnabled("emojiList")) throw new Error("Slack emoji list is disabled.");
|
|
604
|
-
const limit = readPositiveIntegerParam(params, "limit", { message: "limit must be a positive integer." });
|
|
621
|
+
const limit = Math.min(readPositiveIntegerParam(params, "limit", { message: "limit must be a positive integer." }) ?? SLACK_REACTION_RESULT_LIMIT, SLACK_REACTION_RESULT_LIMIT);
|
|
605
622
|
const teamId = resolveTrustedCurrentSlackTeamId({
|
|
606
623
|
account,
|
|
607
624
|
context
|
|
608
625
|
});
|
|
609
626
|
assertSlackDetachedTargetAllowed(account.accountId, teamId);
|
|
610
627
|
const result = await slackActionRuntime.listSlackEmojis(buildActionOpts("read", teamId));
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
});
|
|
620
|
-
}
|
|
628
|
+
const emojis = Object.entries(result.emoji ?? {}).toSorted(([left], [right]) => left.localeCompare(right)).slice(0, limit).map(([name, value]) => value.startsWith("alias:") ? {
|
|
629
|
+
name,
|
|
630
|
+
identifier: name,
|
|
631
|
+
aliasOf: value.slice(6)
|
|
632
|
+
} : {
|
|
633
|
+
name,
|
|
634
|
+
identifier: name
|
|
635
|
+
});
|
|
621
636
|
return jsonResult({
|
|
622
637
|
ok: true,
|
|
623
|
-
emojis
|
|
638
|
+
emojis
|
|
624
639
|
});
|
|
625
640
|
}
|
|
626
641
|
throw new Error(`Unknown action: ${action}`);
|