@openclaw/slack 2026.8.1-beta.3 → 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-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-BoSeX09X.js} +18 -21
- package/dist/action-runtime.runtime-Dpa16J87.js +2 -0
- package/dist/{actions-DFk0ANVB.js → actions-XdQyjG_p.js} +98 -66
- package/dist/api.js +12 -12
- package/dist/{approval-handler.runtime-BNvAoKdK.js → approval-handler.runtime-DxXfGX_Z.js} +53 -176
- package/dist/{channel-CA5w7qDF.js → channel-C_vnTgxo.js} +60 -54
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-CZWv55Wu.js → channel-type-j-2lalcC.js} +3 -3
- package/dist/{channel.setup-CpyYsEXH.js → channel.setup-aal8tokM.js} +33 -48
- package/dist/configured-state.js +34 -0
- package/dist/{directory-config-BGYyuzWh.js → directory-config-DqfQ42OV.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DjUJQLbq.js → directory-live-lC6X_Ru-.js} +2 -2
- package/dist/{group-policy-DyfB_ZIE.js → group-policy-CU1tEGpS.js} +536 -609
- package/dist/{message-tool-api-CqMr5Rmc.js → message-tool-api-CWosHSi5.js} +6 -5
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-Chrecrb9.js → monitor-DrNCGneD.js} +3 -3
- package/dist/{outbound-adapter-DuRqAQXK.js → outbound-adapter-DkT2vUE9.js} +34 -13
- package/dist/{pipeline.runtime-Bbfd5VFW.js → pipeline.runtime-CRRng_Nw.js} +74 -137
- package/dist/{policy-BKXSxrIS.js → policy-BoP6t88v.js} +1 -1
- package/dist/{probe-BVA65leh.js → probe-4_aHtVT3.js} +2 -21
- package/dist/{provider-CUUiwsg2.js → provider-D4nDgxCh.js} +187 -63
- package/dist/{relay-source-mhpMMRG-.js → relay-source-CEmze11m.js} +1 -1
- package/dist/{replies-SnWyXcsL.js → replies-D9XMM_S0.js} +14 -4
- package/dist/{resolve-channels-BSpqC8jU.js → resolve-channels-DSamDgVs.js} +1 -1
- package/dist/{resolve-users-Dvz9pDe0.js → resolve-users-CIzwbaJR.js} +1 -1
- package/dist/runtime-api.js +11 -11
- package/dist/{scopes-BSk4GZvZ.js → scopes-BBrUzpBH.js} +1 -1
- package/dist/{send-CtnOxKCc.js → send-DtjEnlLh.js} +37 -29
- package/dist/{send.runtime-kYctMHSd.js → send.runtime-DQeNKa2J.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BPFfp6So.js → setup-surface-CsBCM4rP.js} +6 -6
- package/dist/{shared-DJBaslN7.js → shared-D9GeeR9K.js} +24 -6
- package/dist/{slack-client-kind-BXyOOICI.js → slack-client-kind-hSfjXyUM.js} +1 -1
- package/dist/{slash-dispatch.runtime-Cf2FTrnf.js → slash-dispatch.runtime-Chr3YHnT.js} +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/bolt/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/bolt/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/bolt/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/bolt/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/bolt/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/bolt/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/README.md +2 -0
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/package.json +1 -1
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/README.md +2 -0
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/package.json +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/socket-mode/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/socket-mode/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/socket-mode/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/socket-mode/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/socket-mode/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/socket-mode/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/socket-mode/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/socket-mode/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/socket-mode/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/web-api/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/web-api/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/web-api/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/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/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 isRelayMode = mode === "relay";
|
|
39
|
+
const configBot = inspectSlackToken(merged.botToken);
|
|
40
|
+
const configApp = inspectSlackToken(merged.appToken);
|
|
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 && !isRelayMode ? 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-CN2hBsim.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,13 +1,13 @@
|
|
|
1
1
|
import { a as parseSlackTarget, n as formatSlackTarget, o as resolveSlackChannelId } from "./target-parsing-BnMD2ZqZ.js";
|
|
2
2
|
import { t as slackContextTargetsMatch } from "./targets-Cx5W_n3W.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as resolveSlackChannelConfig, t as isSlackChannelAllowedByPolicy } from "./policy-BKXSxrIS.js";
|
|
3
|
+
import { Dt as getSlackInstallationKind, O as hasSlackNativeDataBlock, Rt as SLACK_PRIVATE_ACTION_DELIVERY_RESULT, g as assertSlackDetachedTargetAllowed, mt as parseSlackBlocksInput, t as buildSlackChannelIdCandidates, zt as resolveSlackAutoThreadId } from "./group-policy-CU1tEGpS.js";
|
|
4
|
+
import { n as resolveSlackChannelConfig, t as isSlackChannelAllowedByPolicy } from "./policy-BoP6t88v.js";
|
|
6
5
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
7
6
|
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
7
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
9
8
|
import { isSingleUseReplyToMode } from "openclaw/plugin-sdk/reply-reference";
|
|
10
9
|
import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
|
|
10
|
+
import { createActionGate, imageResultFromFile, jsonResult, readPositiveIntegerParam, readReactionParams, readStringParam, withNormalizedTimestamp } from "openclaw/plugin-sdk/channel-actions";
|
|
11
11
|
import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
12
12
|
//#region extensions/slack/src/action-runtime.ts
|
|
13
13
|
const messagingActions = /* @__PURE__ */ new Set([
|
|
@@ -24,10 +24,10 @@ const pinActions = /* @__PURE__ */ new Set([
|
|
|
24
24
|
"unpinMessage",
|
|
25
25
|
"listPins"
|
|
26
26
|
]);
|
|
27
|
-
const
|
|
28
|
-
const loadSlackActionsRuntime = createLazyRuntimeModule(() => import("./actions
|
|
29
|
-
const loadSlackAccountsRuntime = createLazyRuntimeModule(() => import("./accounts.runtime-
|
|
30
|
-
const loadSlackChannelTypeRuntime = createLazyRuntimeModule(() => import("./channel-type-
|
|
27
|
+
const SLACK_REACTION_RESULT_LIMIT = 100;
|
|
28
|
+
const loadSlackActionsRuntime = createLazyRuntimeModule(() => import("./actions-XdQyjG_p.js").then((n) => n.t));
|
|
29
|
+
const loadSlackAccountsRuntime = createLazyRuntimeModule(() => import("./accounts.runtime-DRuEK6mL.js"));
|
|
30
|
+
const loadSlackChannelTypeRuntime = createLazyRuntimeModule(() => import("./channel-type-j-2lalcC.js").then((n) => n.t));
|
|
31
31
|
function createLazySlackAction(key) {
|
|
32
32
|
return (async (...args) => {
|
|
33
33
|
const action = (await loadSlackActionsRuntime())[key];
|
|
@@ -329,7 +329,7 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
331
|
await assertReadTargetAllowed(target);
|
|
332
|
-
const limit = Math.min(readPositiveIntegerParam(params, "limit", { message: "limit must be a positive integer." }) ??
|
|
332
|
+
const limit = Math.min(readPositiveIntegerParam(params, "limit", { message: "limit must be a positive integer." }) ?? SLACK_REACTION_RESULT_LIMIT, SLACK_REACTION_RESULT_LIMIT);
|
|
333
333
|
return jsonResult({
|
|
334
334
|
ok: true,
|
|
335
335
|
reactions: (await slackActionRuntime.listSlackReactions(channelId, messageId, readOpts))?.map((reaction) => reaction.users ? Object.assign({}, reaction, { users: reaction.users.slice(0, limit) }) : reaction)
|
|
@@ -525,7 +525,7 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
525
525
|
});
|
|
526
526
|
if (!downloaded) return jsonResult({
|
|
527
527
|
ok: false,
|
|
528
|
-
error: "File could not be downloaded
|
|
528
|
+
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
529
|
});
|
|
530
530
|
if (!isImageContentType(downloaded.contentType)) return jsonResult({
|
|
531
531
|
ok: true,
|
|
@@ -601,26 +601,23 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
601
601
|
}
|
|
602
602
|
if (action === "emojiList") {
|
|
603
603
|
if (!isActionEnabled("emojiList")) throw new Error("Slack emoji list is disabled.");
|
|
604
|
-
const limit = readPositiveIntegerParam(params, "limit", { message: "limit must be a positive integer." });
|
|
604
|
+
const limit = Math.min(readPositiveIntegerParam(params, "limit", { message: "limit must be a positive integer." }) ?? SLACK_REACTION_RESULT_LIMIT, SLACK_REACTION_RESULT_LIMIT);
|
|
605
605
|
const teamId = resolveTrustedCurrentSlackTeamId({
|
|
606
606
|
account,
|
|
607
607
|
context
|
|
608
608
|
});
|
|
609
609
|
assertSlackDetachedTargetAllowed(account.accountId, teamId);
|
|
610
610
|
const result = await slackActionRuntime.listSlackEmojis(buildActionOpts("read", teamId));
|
|
611
|
-
if (limit != null && limit > 0 && result.emoji != null) {
|
|
612
|
-
const entries = Object.entries(result.emoji).toSorted(([a], [b]) => a.localeCompare(b));
|
|
613
|
-
if (entries.length > limit) return jsonResult({
|
|
614
|
-
ok: true,
|
|
615
|
-
emojis: {
|
|
616
|
-
...result,
|
|
617
|
-
emoji: Object.fromEntries(entries.slice(0, limit))
|
|
618
|
-
}
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
611
|
return jsonResult({
|
|
622
612
|
ok: true,
|
|
623
|
-
emojis: result
|
|
613
|
+
emojis: Object.entries(result.emoji ?? {}).toSorted(([left], [right]) => left.localeCompare(right)).slice(0, limit).map(([name, value]) => value.startsWith("alias:") ? {
|
|
614
|
+
name,
|
|
615
|
+
identifier: name,
|
|
616
|
+
aliasOf: value.slice(6)
|
|
617
|
+
} : {
|
|
618
|
+
name,
|
|
619
|
+
identifier: name
|
|
620
|
+
})
|
|
624
621
|
});
|
|
625
622
|
}
|
|
626
623
|
throw new Error(`Unknown action: ${action}`);
|
|
@@ -1,9 +1,9 @@
|
|
|
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 { c as resolveSlackMessageText, i as hasSlackMessageTableBlock, n as fetchWithRuntimeDispatcher, r as saveRemoteMedia, t as isGovSlackClient } from "./slack-client-kind-
|
|
6
|
-
import { m as buildSlackNativeDataDeliveryPlan, r as sendMessageSlack } from "./send-
|
|
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";
|
|
@@ -184,6 +184,10 @@ async function fetchFreshSlackFileUrl(params) {
|
|
|
184
184
|
if (!params.file.id || !params.client) return null;
|
|
185
185
|
try {
|
|
186
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
|
+
}
|
|
187
191
|
const freshUrl = freshFile?.url_private_download ?? freshFile?.url_private;
|
|
188
192
|
if (freshUrl) {
|
|
189
193
|
logVerbose$1(`slack: refreshed file URL via files.info for file id=${params.file.id}`);
|
|
@@ -226,6 +230,7 @@ async function downloadSlackMediaFile(params) {
|
|
|
226
230
|
return {
|
|
227
231
|
path: saved.path,
|
|
228
232
|
...contentType ? { contentType } : {},
|
|
233
|
+
...label ? { fileName: label } : {},
|
|
229
234
|
placeholder: `[Slack file: ${formatSlackFileReference({
|
|
230
235
|
...params.file,
|
|
231
236
|
name: label
|
|
@@ -253,15 +258,18 @@ function resolveForwardedAttachmentImageUrl(attachment, govSlack) {
|
|
|
253
258
|
async function resolveSlackMedia(params) {
|
|
254
259
|
const govSlack = isGovSlackClient(params.client);
|
|
255
260
|
const files = params.files ?? [];
|
|
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
|
+
});
|
|
256
267
|
const { results } = await runTasksWithConcurrency({
|
|
257
|
-
tasks:
|
|
268
|
+
tasks: limitedFiles.map((file) => async () => {
|
|
258
269
|
const preloaded = params.preloadedMedia?.get(file);
|
|
259
270
|
if (preloaded) return preloaded;
|
|
260
271
|
const eventUrl = file.url_private_download ?? file.url_private;
|
|
261
|
-
const url = eventUrl ?? await
|
|
262
|
-
file,
|
|
263
|
-
client: params.client
|
|
264
|
-
});
|
|
272
|
+
const url = eventUrl ?? await refreshFileUrl(file);
|
|
265
273
|
if (!url) return null;
|
|
266
274
|
const result = await downloadSlackMediaFile({
|
|
267
275
|
file,
|
|
@@ -274,10 +282,7 @@ async function resolveSlackMedia(params) {
|
|
|
274
282
|
govSlack
|
|
275
283
|
}).catch(() => null);
|
|
276
284
|
if (result || !eventUrl) return result;
|
|
277
|
-
const freshUrl = await
|
|
278
|
-
file,
|
|
279
|
-
client: params.client
|
|
280
|
-
});
|
|
285
|
+
const freshUrl = await refreshFileUrl(file);
|
|
281
286
|
if (!freshUrl) return null;
|
|
282
287
|
return await downloadSlackMediaFile({
|
|
283
288
|
file,
|
|
@@ -294,18 +299,47 @@ async function resolveSlackMedia(params) {
|
|
|
294
299
|
errorMode: "stop",
|
|
295
300
|
throwOnError: true
|
|
296
301
|
});
|
|
297
|
-
const resolved = results.filter((result) =>
|
|
302
|
+
const resolved = results.filter((result, index) => {
|
|
303
|
+
if (result) params.resolvedFiles?.add(limitedFiles[index]);
|
|
304
|
+
return result !== null;
|
|
305
|
+
});
|
|
298
306
|
return resolved.length > 0 ? resolved : null;
|
|
299
307
|
}
|
|
300
308
|
/** Extracts text and media from forwarded-message attachments. Returns null when empty. */
|
|
301
309
|
async function resolveSlackAttachmentContent(params) {
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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);
|
|
306
341
|
const textBlocks = [];
|
|
307
|
-
const
|
|
308
|
-
const allFiles = forwardedAttachments.flatMap((attachment) => attachment.files ?? []);
|
|
342
|
+
const attachmentMedia = [];
|
|
309
343
|
let unavailableImageCount = 0;
|
|
310
344
|
const govSlack = isGovSlackClient(params.client);
|
|
311
345
|
for (const att of forwardedAttachments) {
|
|
@@ -331,38 +365,48 @@ async function resolveSlackAttachmentContent(params) {
|
|
|
331
365
|
abortSignal: params.abortSignal
|
|
332
366
|
});
|
|
333
367
|
const label = saved.fileName ?? "forwarded image";
|
|
334
|
-
|
|
368
|
+
attachmentMedia.push({
|
|
335
369
|
path: saved.path,
|
|
336
370
|
contentType: saved.contentType,
|
|
371
|
+
...saved.fileName ? { fileName: saved.fileName } : {},
|
|
337
372
|
placeholder: `[Forwarded image: ${label}]`
|
|
338
373
|
});
|
|
339
374
|
} catch {
|
|
340
375
|
unavailableImageCount += 1;
|
|
341
376
|
}
|
|
342
|
-
|
|
343
|
-
const fileMedia = await resolveSlackMedia({
|
|
344
|
-
files: att.files,
|
|
345
|
-
client: params.client,
|
|
346
|
-
token: params.token,
|
|
347
|
-
maxBytes: params.maxBytes,
|
|
348
|
-
readIdleTimeoutMs: params.readIdleTimeoutMs,
|
|
349
|
-
totalTimeoutMs: params.totalTimeoutMs,
|
|
350
|
-
abortSignal: params.abortSignal
|
|
351
|
-
});
|
|
352
|
-
if (fileMedia) allMedia.push(...fileMedia);
|
|
353
|
-
}
|
|
377
|
+
attachmentMedia.push(...await resolveFiles(att.files) ?? []);
|
|
354
378
|
}
|
|
379
|
+
const allMedia = [...await directMediaPromise ?? [], ...attachmentMedia];
|
|
380
|
+
const unavailableFiles = allFiles.filter((file) => !resolvedFiles.has(file));
|
|
355
381
|
const combinedText = textBlocks.join("\n\n");
|
|
356
382
|
if (!combinedText && allMedia.length === 0 && allFiles.length === 0 && unavailableImageCount === 0) return null;
|
|
357
383
|
return {
|
|
358
384
|
text: combinedText,
|
|
359
385
|
media: allMedia,
|
|
360
386
|
unavailableImageCount,
|
|
361
|
-
...
|
|
387
|
+
...unavailableFiles.length > 0 ? { files: unavailableFiles } : {}
|
|
362
388
|
};
|
|
363
389
|
}
|
|
364
390
|
//#endregion
|
|
365
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
|
+
});
|
|
366
410
|
function renderSlackReadMessageText(message) {
|
|
367
411
|
if (!hasSlackMessageTableBlock(message)) return message;
|
|
368
412
|
const text = resolveSlackMessageText(message, { preserveMessageTextWhitespace: true });
|
|
@@ -682,48 +726,34 @@ function collectSlackShareMaps(file) {
|
|
|
682
726
|
const shares = file.shares;
|
|
683
727
|
return [shares.public, shares.private].filter((value) => Boolean(value) && typeof value === "object" && !Array.isArray(value));
|
|
684
728
|
}
|
|
685
|
-
function
|
|
686
|
-
const
|
|
687
|
-
for (const shareMap of collectSlackShareMaps(file)) for (const
|
|
688
|
-
const
|
|
689
|
-
if (
|
|
690
|
-
}
|
|
691
|
-
return ids;
|
|
692
|
-
}
|
|
693
|
-
function collectSlackThreadShares(file, channelId) {
|
|
694
|
-
const matches = [];
|
|
695
|
-
for (const shareMap of collectSlackShareMaps(file)) {
|
|
696
|
-
const rawEntries = shareMap[channelId];
|
|
697
|
-
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;
|
|
698
734
|
for (const rawEntry of rawEntries) {
|
|
699
735
|
if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) continue;
|
|
700
736
|
const entry = rawEntry;
|
|
701
737
|
const ts = typeof entry.ts === "string" ? normalizeOptionalString(entry.ts) : void 0;
|
|
702
738
|
const threadTs = typeof entry.thread_ts === "string" ? normalizeOptionalString(entry.thread_ts) : void 0;
|
|
703
|
-
|
|
739
|
+
if (ts || threadTs) shares.push({
|
|
704
740
|
channelId,
|
|
705
741
|
ts,
|
|
706
742
|
threadTs
|
|
707
743
|
});
|
|
708
744
|
}
|
|
709
745
|
}
|
|
710
|
-
return
|
|
746
|
+
return shares;
|
|
711
747
|
}
|
|
712
|
-
function
|
|
748
|
+
function lacksSlackScopeProof(params) {
|
|
713
749
|
const channelId = normalizeOptionalString(params.channelId);
|
|
714
|
-
if (!channelId) return
|
|
750
|
+
if (!channelId) return true;
|
|
715
751
|
const threadId = normalizeOptionalString(params.threadId);
|
|
716
752
|
const directIds = collectSlackDirectShareChannelIds(params.file);
|
|
717
|
-
const
|
|
718
|
-
|
|
719
|
-
const inChannel = directIds.has(channelId) || sharedIds.has(channelId);
|
|
720
|
-
if (hasChannelEvidence && !inChannel) return true;
|
|
753
|
+
const shares = collectSlackShares(params.file);
|
|
754
|
+
if (!(directIds.has(channelId) || shares.some((entry) => entry.channelId === channelId))) return true;
|
|
721
755
|
if (!threadId) return false;
|
|
722
|
-
|
|
723
|
-
if (threadShares.length === 0) return false;
|
|
724
|
-
const threadEvidence = threadShares.filter((entry) => entry.threadTs || entry.ts);
|
|
725
|
-
if (threadEvidence.length === 0) return false;
|
|
726
|
-
return !threadEvidence.some((entry) => entry.threadTs === threadId || entry.ts === threadId);
|
|
756
|
+
return !shares.some((entry) => entry.channelId === channelId && (entry.threadTs === threadId || entry.ts === threadId));
|
|
727
757
|
}
|
|
728
758
|
/**
|
|
729
759
|
* Downloads a Slack file by ID and saves it to the local media store.
|
|
@@ -733,13 +763,14 @@ function hasSlackScopeMismatch(params) {
|
|
|
733
763
|
async function downloadSlackFile(fileId, opts) {
|
|
734
764
|
const token = resolveToken(opts.token, opts.accountId, opts.cfg);
|
|
735
765
|
const client = await getClient(opts);
|
|
736
|
-
const
|
|
737
|
-
if (!file?.url_private_download && !file?.url_private) return null;
|
|
738
|
-
if (hasSlackScopeMismatch({
|
|
766
|
+
const isFileAllowed = (file) => !lacksSlackScopeProof({
|
|
739
767
|
file,
|
|
740
768
|
channelId: opts.channelId,
|
|
741
769
|
threadId: opts.threadId
|
|
742
|
-
})
|
|
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;
|
|
743
774
|
return (await resolveSlackMedia({
|
|
744
775
|
files: [{
|
|
745
776
|
id: file.id,
|
|
@@ -749,9 +780,10 @@ async function downloadSlackFile(fileId, opts) {
|
|
|
749
780
|
url_private_download: file.url_private_download
|
|
750
781
|
}],
|
|
751
782
|
client,
|
|
783
|
+
isRefreshedFileAllowed: isFileAllowed,
|
|
752
784
|
token,
|
|
753
785
|
maxBytes: opts.maxBytes
|
|
754
786
|
}))?.[0] ?? null;
|
|
755
787
|
}
|
|
756
788
|
//#endregion
|
|
757
|
-
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-
|
|
2
|
+
import { a as resolveSlackAccount, i as resolveDefaultSlackAccountId, n as listSlackAccountIds, r as mergeSlackAccountConfig, t as listEnabledSlackAccounts } from "./accounts-Dm_H77gH.js";
|
|
3
3
|
import { r as resolveSlackReplyToMode } from "./conversation-binding-route-DFVLUdYF.js";
|
|
4
|
-
import { t as inspectSlackAccount } from "./account-inspect-
|
|
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 { n as buildSlackThreadingToolContext, t as slackPlugin } from "./channel-
|
|
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-
|
|
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
16
|
import { t as collectSlackSecurityAuditFindings } from "./security-audit-B_yKr7MW.js";
|
|
17
|
-
import { n as resolveSlackRuntimeGroupPolicy } from "./provider-
|
|
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 };
|