@openclaw/slack 2026.11.3 → 2026.11.5-beta.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/.setup/{account-inspect-CmkKiSb9.mjs → account-inspect-BLVha-ov.mjs} +11 -8
- package/dist/.setup/{accounts-msihSF3-.mjs → accounts-CGJScKtk.mjs} +10 -1
- package/dist/.setup/{action-runtime-ChRfnnBu.mjs → action-runtime-D01wBhx5.mjs} +38 -45
- package/dist/.setup/action-runtime.runtime-VQGaR6g8.mjs +1 -0
- package/dist/.setup/{actions-By7tvpvv.mjs → actions-D5S6D_BU.mjs} +89 -76
- package/dist/.setup/{approval-handler.runtime-D8ArtDQt.mjs → approval-handler.runtime-Buw5jh2Y.mjs} +26 -30
- package/dist/.setup/{approval-message-updates-DT7XBPbV.mjs → approval-message-updates-pmXcve5E.mjs} +1 -1
- package/dist/.setup/{channel-DLFiMJm2.mjs → channel-C_R98Nbv.mjs} +569 -339
- package/dist/.setup/{channel-type-BEFP2ORi.mjs → channel-type-B5P3w9eA.mjs} +4 -8
- package/dist/.setup/{channel.setup-CzFw73mU.mjs → channel.setup-Lq2OxKkF.mjs} +13 -13
- package/dist/.setup/{config-schema-DNnh6bWU.mjs → config-schema-BWAaa5au.mjs} +3 -7
- package/dist/.setup/cursor-pages-CATAzbTT.mjs +313 -0
- package/dist/.setup/{directory-config-Cjj0N8R0.mjs → directory-config-D-hf9KGQ.mjs} +3 -3
- package/dist/.setup/{directory-live-BIKD-5B_.mjs → directory-live-onKAFI1E.mjs} +4 -4
- package/dist/.setup/{doctor-contract-Cd4-VzIM.mjs → doctor-contract-9-QJRCXk.mjs} +37 -45
- package/dist/.setup/{message-tool-api-BS5ekEA_.mjs → message-tool-api-LGIgVXJf.mjs} +4 -3
- package/dist/.setup/{monitor-CV6Z6FKP.mjs → monitor-Cm1TuqxN.mjs} +3424 -3703
- package/dist/.setup/{outbound-adapter-9dbnYtL1.mjs → outbound-adapter-C-95EWl2.mjs} +30 -36
- package/dist/.setup/paths-B1u59oLK.mjs +8 -0
- package/dist/.setup/{pipeline.runtime-DLIQf1Bo.mjs → pipeline.runtime-DGnV6akc.mjs} +416 -534
- package/dist/.setup/{policy-yhn48xf5.mjs → policy-DxhGRvc2.mjs} +1 -2
- package/dist/.setup/{session-status-Dv8wNBEt.mjs → probe-DANukR3O.mjs} +1206 -839
- package/dist/.setup/question-delivery-CWC7sRhH.mjs +39 -0
- package/dist/.setup/{relay-source-CxDcrn16.mjs → relay-source-DoyOlTbK.mjs} +5 -3
- package/dist/.setup/{replies-MRkrg3rC.mjs → replies-BcmUKord.mjs} +34 -19
- package/dist/.setup/{reply-blocks-Ca-raz2z.mjs → reply-blocks-BzsXUUUL.mjs} +201 -206
- package/dist/.setup/{resolve-channels-DRRhElwz.mjs → resolve-channels-XDPgnesf.mjs} +4 -7
- package/dist/.setup/{resolve-users-Cz8e17ky.mjs → resolve-users-aDAv24U2.mjs} +8 -16
- package/dist/.setup/runtime-setter-api-Cx_PV-xu.mjs +2 -0
- package/dist/.setup/{scopes-DfQVi8Jw.mjs → scopes-BocHwImV.mjs} +2 -1
- package/dist/.setup/secret-contract-api-BlLz88mj.mjs +2 -0
- package/dist/.setup/{secret-contract-vVRMoE1D.mjs → secret-contract-uiQtoNlu.mjs} +2 -2
- package/dist/.setup/{send-results-eeOu_HYm.mjs → send-results-BGxlroJ-.mjs} +3 -4
- package/dist/.setup/{send-C-8wY0lK.mjs → send-yK6_-px6.mjs} +297 -334
- package/dist/.setup/setup-plugin-api-Cfz58xoh.mjs +2 -0
- package/dist/.setup/{setup-surface--n8VsDvV.mjs → setup-surface-C0KRtyqa.mjs} +5 -6
- package/dist/.setup/{slash-dispatch.runtime-D3Wq45ER.mjs → slash-dispatch.runtime-CyVC3bYx.mjs} +2 -2
- package/dist/.setup/{target-parsing-FFE26kOV.mjs → target-parsing-Bx2UZniD.mjs} +1 -2
- package/dist/.setup/{targets-C6LZQL1Q.mjs → targets-D-ASeWHy.mjs} +1 -1
- package/dist/.source-module-urls/c5ffd0957b234c7c12090e7de4eca2482ef339b8561e078da55b734211b0ba58.json +1 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/api.js +16 -17
- package/dist/channel-config-api.js +1 -2
- package/dist/channel-plugin-api.js +1 -2
- package/dist/directory-contract-api.js +1 -2
- package/dist/doctor-contract-api.js +1 -2
- package/dist/index.js +0 -6
- package/dist/message-tool-api.js +1 -2
- package/dist/runtime-api.js +10 -12
- package/dist/runtime-setter-api.js +1 -2
- package/dist/secret-contract-api.js +1 -2
- package/dist/security-contract-api.js +1 -2
- package/dist/setup-entry.js +3 -3
- package/dist/setup-plugin-api.js +1 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/util.d.ts +6 -3
- package/node_modules/@slack/bolt/node_modules/content-disposition/README.md +105 -35
- package/node_modules/@slack/bolt/node_modules/content-disposition/dist/index.d.ts +72 -0
- package/node_modules/@slack/bolt/node_modules/content-disposition/dist/index.js +388 -0
- package/node_modules/@slack/bolt/node_modules/content-disposition/dist/index.js.map +1 -0
- package/node_modules/@slack/bolt/node_modules/content-disposition/package.json +31 -19
- package/node_modules/@slack/bolt/node_modules/content-type/README.md +34 -57
- package/node_modules/@slack/bolt/node_modules/content-type/package.json +35 -25
- package/node_modules/@slack/bolt/node_modules/express/Readme.md +15 -9
- package/node_modules/@slack/bolt/node_modules/express/lib/application.js +2 -2
- package/node_modules/@slack/bolt/node_modules/express/lib/request.js +32 -19
- package/node_modules/@slack/bolt/node_modules/express/lib/response.js +27 -30
- package/node_modules/@slack/bolt/node_modules/express/package.json +10 -10
- package/node_modules/@slack/bolt/node_modules/qs/.github/THREAT_MODEL.md +4 -2
- package/node_modules/@slack/bolt/node_modules/qs/CHANGELOG.md +38 -14
- package/node_modules/@slack/bolt/node_modules/qs/README.md +31 -3
- package/node_modules/@slack/bolt/node_modules/qs/dist/qs.js +20 -20
- package/node_modules/@slack/bolt/node_modules/qs/lib/parse.js +94 -4
- package/node_modules/@slack/bolt/node_modules/qs/lib/stringify.js +4 -4
- package/node_modules/@slack/bolt/node_modules/qs/lib/utils.js +130 -6
- package/node_modules/@slack/bolt/node_modules/qs/package.json +4 -4
- package/node_modules/@slack/bolt/node_modules/qs/test/parse.js +174 -0
- package/node_modules/@slack/bolt/node_modules/qs/test/stringify.js +263 -33
- package/node_modules/@slack/bolt/node_modules/qs/test/utils.js +184 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/util.d.ts +6 -3
- package/node_modules/typebox/build/format/duration.d.mts +2 -2
- package/node_modules/typebox/build/format/duration.mjs +2 -2
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_email.mjs +1 -0
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
- package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
- package/node_modules/typebox/build/format/ipv4.mjs +2 -2
- package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
- package/node_modules/typebox/build/format/ipv6.mjs +1 -1
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/schema/build.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
- package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
- package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
- package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
- package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
- package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
- package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
- package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
- package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
- package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
- package/node_modules/typebox/build/system/memory/create.mjs +18 -13
- package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
- package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
- package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
- package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
- package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
- package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
- package/node_modules/typebox/build/system/memory/update.mjs +43 -16
- package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
- package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
- package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
- package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
- package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
- package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
- package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +1 -1
- package/node_modules/undici/docs/docs/api/Interceptors.md +15 -2
- package/node_modules/undici/lib/dispatcher/client-h2.js +78 -3
- package/node_modules/undici/lib/dispatcher/pool-base.js +20 -3
- package/node_modules/undici/package.json +3 -3
- package/node_modules/undici/types/api.d.ts +1 -1
- package/node_modules/undici/types/utility.d.ts +4 -4
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
- package/node_modules/zod/src/v4/core/compile.ts +9 -0
- package/node_modules/zod/src/v4/core/schemas.ts +35 -1
- package/node_modules/zod/src/v4/core/util.ts +13 -0
- package/node_modules/zod/src/v4/core/versions.ts +1 -1
- package/node_modules/zod/v4/core/compile.cjs +8 -0
- package/node_modules/zod/v4/core/compile.js +8 -0
- package/node_modules/zod/v4/core/schemas.cjs +30 -0
- package/node_modules/zod/v4/core/schemas.d.cts +3 -1
- package/node_modules/zod/v4/core/schemas.d.ts +3 -1
- package/node_modules/zod/v4/core/schemas.js +30 -0
- package/node_modules/zod/v4/core/util.cjs +15 -0
- package/node_modules/zod/v4/core/util.d.cts +2 -0
- package/node_modules/zod/v4/core/util.d.ts +2 -0
- package/node_modules/zod/v4/core/util.js +14 -0
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/openclaw.plugin.json +6 -30
- package/package.json +7 -7
- package/dist/.setup/action-runtime.runtime-vLxx_7s2.mjs +0 -2
- package/dist/.setup/http-C9sM-FXe.mjs +0 -2
- package/dist/.setup/plugin-routes-D4qozHVn.mjs +0 -22
- package/dist/.setup/probe-IiHogLQN.mjs +0 -694
- package/dist/.setup/registry-DizWcnNp.mjs +0 -36
- package/dist/.setup/runtime-setter-api-CMFvhrAr.mjs +0 -3
- package/dist/.setup/secret-contract-api-DK9gZldc.mjs +0 -3
- package/dist/.setup/setup-plugin-api-BGD1TYnK.mjs +0 -3
- package/dist/.setup/shared-BhJHIZs1.mjs +0 -259
- package/dist/http-routes-api.js +0 -2
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/LICENSE +0 -22
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/README.md +0 -71
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/package.json +0 -52
- package/node_modules/@slack/bolt/node_modules/content-disposition/index.js +0 -536
- package/node_modules/@slack/bolt/node_modules/content-type/HISTORY.md +0 -29
- package/node_modules/@slack/bolt/node_modules/content-type/index.js +0 -225
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/LICENSE +0 -22
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/README.md +0 -71
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +0 -46
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js +0 -176
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js.map +0 -1
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/package.json +0 -52
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/LICENSE +0 -22
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/README.md +0 -71
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.d.ts +0 -46
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js +0 -176
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js.map +0 -1
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/package.json +0 -52
- package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
- package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
- /package/node_modules/@slack/bolt/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.d.ts +0 -0
- /package/node_modules/@slack/bolt/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.js +0 -0
- /package/node_modules/@slack/bolt/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.js.map +0 -0
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { t as hasSlackAccountCredentials } from "./account-configured-zcR9TJJN.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { _ as buildSlackAccountSurfaceFields, a as mergeSlackAccountConfig, o as resolveDefaultSlackAccountId } from "./accounts-CGJScKtk.mjs";
|
|
3
3
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
4
|
-
import {
|
|
4
|
+
import { normalizeSecretInputString, resolveSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
5
5
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
//#region extensions/slack/src/account-inspect.ts
|
|
7
7
|
function inspectSlackToken(value, envToken) {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
token,
|
|
8
|
+
const credential = resolveSecretInputString({
|
|
9
|
+
value,
|
|
10
|
+
path: "Slack token",
|
|
11
|
+
mode: "inspect"
|
|
12
|
+
});
|
|
13
|
+
return credential.status !== "missing" ? {
|
|
14
|
+
token: credential.value,
|
|
11
15
|
source: "config",
|
|
12
|
-
status:
|
|
13
|
-
}
|
|
14
|
-
return envToken ? {
|
|
16
|
+
status: credential.status
|
|
17
|
+
} : envToken ? {
|
|
15
18
|
token: envToken,
|
|
16
19
|
source: "env",
|
|
17
20
|
status: "available"
|
|
@@ -4,6 +4,7 @@ import { DEFAULT_ACCOUNT_ID, createAccountListHelpers, normalizeAccountId } from
|
|
|
4
4
|
import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
5
5
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { mapAllowFromEntries, normalizeChannelDmPolicy } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
7
|
+
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
7
8
|
import { resolveAccountEntry } from "openclaw/plugin-sdk/routing";
|
|
8
9
|
import { normalizeChatType } from "openclaw/plugin-sdk/account-core";
|
|
9
10
|
//#region extensions/slack/src/account-surface-fields.ts
|
|
@@ -59,6 +60,7 @@ var accounts_exports = /* @__PURE__ */ __exportAll({
|
|
|
59
60
|
resolveSlackAccountAllowFrom: () => resolveSlackAccountAllowFrom,
|
|
60
61
|
resolveSlackAccountDmPolicy: () => resolveSlackAccountDmPolicy,
|
|
61
62
|
resolveSlackConfigAccessorAccount: () => resolveSlackConfigAccessorAccount,
|
|
63
|
+
resolveSlackMarkdownOptions: () => resolveSlackMarkdownOptions,
|
|
62
64
|
resolveSlackOperationToken: () => resolveSlackOperationToken,
|
|
63
65
|
resolveSlackReplyToMode: () => resolveSlackReplyToMode
|
|
64
66
|
});
|
|
@@ -82,6 +84,13 @@ const { listAccountIds, resolveDefaultAccountId, resolveAccountConfig: resolveMe
|
|
|
82
84
|
});
|
|
83
85
|
const listSlackAccountIds = listAccountIds;
|
|
84
86
|
const resolveDefaultSlackAccountId = resolveDefaultAccountId;
|
|
87
|
+
function resolveSlackMarkdownOptions(params) {
|
|
88
|
+
return { tableMode: resolveMarkdownTableMode({
|
|
89
|
+
cfg: params.cfg,
|
|
90
|
+
channel: "slack",
|
|
91
|
+
accountId: params.accountId ?? resolveDefaultSlackAccountId(params.cfg)
|
|
92
|
+
}) };
|
|
93
|
+
}
|
|
85
94
|
function resolveSlackAccountConfig(cfg, accountId) {
|
|
86
95
|
return resolveAccountEntry(cfg.channels?.slack?.accounts, accountId);
|
|
87
96
|
}
|
|
@@ -186,4 +195,4 @@ function listEnabledSlackAccounts(cfg) {
|
|
|
186
195
|
})).filter((account) => account.enabled);
|
|
187
196
|
}
|
|
188
197
|
//#endregion
|
|
189
|
-
export { mergeSlackAccountConfig as a, resolveSlackAccountAllowFrom as c,
|
|
198
|
+
export { buildSlackAccountSurfaceFields as _, mergeSlackAccountConfig as a, resolveSlackAccountAllowFrom as c, resolveSlackMarkdownOptions as d, resolveSlackOperationToken as f, resolveSlackBotToken as g, resolveSlackAppToken as h, listSlackAccountIds as i, resolveSlackAccountDmPolicy as l, formatSlackBotTokenIdentityWarning as m, hasImplicitDefaultSlackAccount as n, resolveDefaultSlackAccountId as o, resolveSlackReplyToMode as p, listEnabledSlackAccounts as r, resolveSlackAccount as s, accounts_exports as t, resolveSlackConfigAccessorAccount as u };
|
|
@@ -1,12 +1,11 @@
|
|
|
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 { n as resolveSlackChannelConfig, t as isSlackChannelAllowedByPolicy } from "./policy-
|
|
5
|
-
import { t as mergeSlackSendResults } from "./send-results-
|
|
1
|
+
import { a as parseSlackTarget, n as formatSlackTarget, o as resolveSlackChannelId } from "./target-parsing-Bx2UZniD.mjs";
|
|
2
|
+
import { t as slackContextTargetsMatch } from "./targets-D-ASeWHy.mjs";
|
|
3
|
+
import { Kt as getSlackInstallationKind, O as hasSlackNativeDataBlock, S as assertSlackDetachedTargetAllowed, c as buildSlackChannelIdCandidates, in as resolveSlackThreadTsFromContext, nn as SLACK_PRIVATE_ACTION_DELIVERY_RESULT, nt as parseSlackBlocksInput, u as hasPotentialSlackNamedPolicy } from "./probe-DANukR3O.mjs";
|
|
4
|
+
import { n as resolveSlackChannelConfig, t as isSlackChannelAllowedByPolicy } from "./policy-DxhGRvc2.mjs";
|
|
5
|
+
import { t as mergeSlackSendResults } from "./send-results-BGxlroJ-.mjs";
|
|
6
6
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
7
7
|
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { createLazyRuntimeMethodBinder, createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
9
|
-
import { isSingleUseReplyToMode } from "openclaw/plugin-sdk/reply-reference";
|
|
10
9
|
import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
|
|
11
10
|
import { createActionGate, imageResultFromFile, jsonResult, readPositiveIntegerParam, readReactionParams, readStringParam, withNormalizedTimestamp } from "openclaw/plugin-sdk/channel-actions";
|
|
12
11
|
import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
@@ -30,15 +29,17 @@ const SLACK_REACTION_RESULT_LIMIT = 100;
|
|
|
30
29
|
function readSlackResultLimit(params) {
|
|
31
30
|
return Math.min(readPositiveIntegerParam(params, "limit", { message: "limit must be a positive integer." }) ?? SLACK_REACTION_RESULT_LIMIT, SLACK_REACTION_RESULT_LIMIT);
|
|
32
31
|
}
|
|
33
|
-
const loadSlackActionsRuntime = createLazyRuntimeModule(() => import("./actions-
|
|
32
|
+
const loadSlackActionsRuntime = createLazyRuntimeModule(() => import("./actions-D5S6D_BU.mjs").then((n) => n.t));
|
|
34
33
|
const bindSlackAction = createLazyRuntimeMethodBinder(loadSlackActionsRuntime);
|
|
35
|
-
const loadSlackAccountsRuntime = createLazyRuntimeModule(() => import("./accounts-
|
|
36
|
-
const loadSlackChannelTypeRuntime = createLazyRuntimeModule(() => import("./channel-type-
|
|
34
|
+
const loadSlackAccountsRuntime = createLazyRuntimeModule(() => import("./accounts-CGJScKtk.mjs").then((n) => n.t));
|
|
35
|
+
const loadSlackChannelTypeRuntime = createLazyRuntimeModule(() => import("./channel-type-B5P3w9eA.mjs").then((n) => n.t));
|
|
37
36
|
const bindSlackChannelType = createLazyRuntimeMethodBinder(loadSlackChannelTypeRuntime);
|
|
38
37
|
const slackActionRuntime = {
|
|
38
|
+
createSlackChannel: bindSlackAction((runtime) => runtime.createSlackChannel),
|
|
39
39
|
deleteSlackMessage: bindSlackAction((runtime) => runtime.deleteSlackMessage),
|
|
40
40
|
downloadSlackFile: bindSlackAction((runtime) => runtime.downloadSlackFile),
|
|
41
41
|
editSlackMessage: bindSlackAction((runtime) => runtime.editSlackMessage),
|
|
42
|
+
editSlackRenderedMessage: bindSlackAction((runtime) => runtime.editSlackRenderedMessage),
|
|
42
43
|
getSlackMemberInfo: bindSlackAction((runtime) => runtime.getSlackMemberInfo),
|
|
43
44
|
listSlackEmojis: bindSlackAction((runtime) => runtime.listSlackEmojis),
|
|
44
45
|
listSlackPins: bindSlackAction((runtime) => runtime.listSlackPins),
|
|
@@ -54,25 +55,6 @@ const slackActionRuntime = {
|
|
|
54
55
|
sendSlackMessage: bindSlackAction((runtime) => runtime.sendSlackMessage),
|
|
55
56
|
unpinSlackMessage: bindSlackAction((runtime) => runtime.unpinSlackMessage)
|
|
56
57
|
};
|
|
57
|
-
function resolveThreadTsFromContext(explicitThreadTs, targetChannel, context, opts) {
|
|
58
|
-
if (explicitThreadTs) return explicitThreadTs;
|
|
59
|
-
if (opts?.suppressImplicitThread) return;
|
|
60
|
-
const threadTs = resolveSlackAutoThreadId({
|
|
61
|
-
to: targetChannel,
|
|
62
|
-
toolContext: context
|
|
63
|
-
});
|
|
64
|
-
if (isSingleUseReplyToMode(context?.replyToMode ?? "off") && !context?.hasRepliedRef) return;
|
|
65
|
-
return threadTs;
|
|
66
|
-
}
|
|
67
|
-
function hasPotentialSlackNamedPolicy(params) {
|
|
68
|
-
if (params.allowNameMatching !== true) return false;
|
|
69
|
-
return Object.entries(params.channels ?? {}).some(([key, entry]) => {
|
|
70
|
-
if (entry == null || key === "*") return false;
|
|
71
|
-
const named = !/^(?:channel:)?[CDG][A-Z0-9]+$/i.test(key);
|
|
72
|
-
const entryAllows = entry.enabled !== false;
|
|
73
|
-
return named && (params.decision === "allow" ? entryAllows : !entryAllows);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
58
|
function resolveSlackDmReadAllowed(account) {
|
|
77
59
|
const dmPolicy = account.config.dmPolicy ?? "pairing";
|
|
78
60
|
return account.config.dm?.enabled !== false && dmPolicy !== "disabled";
|
|
@@ -272,6 +254,7 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
272
254
|
const actionConfig = account.actions ?? cfg.channels?.slack?.actions;
|
|
273
255
|
const isActionEnabled = createActionGate(actionConfig);
|
|
274
256
|
const botToken = account.botToken?.trim();
|
|
257
|
+
if (action === "createChannel" && !isActionEnabled("channels", false)) throw new Error("Slack channel creation is disabled.");
|
|
275
258
|
const buildActionOpts = (operation, teamId) => {
|
|
276
259
|
const token = resolveSlackOperationToken(account, operation);
|
|
277
260
|
if (!token && account.identity === "user") throw new Error(`Slack operation token missing for account "${account.accountId}".`);
|
|
@@ -294,6 +277,22 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
294
277
|
context
|
|
295
278
|
});
|
|
296
279
|
};
|
|
280
|
+
if (action === "createChannel") {
|
|
281
|
+
const teamId = readStringParam(params, "teamId") ?? resolveTrustedCurrentSlackTeamId({
|
|
282
|
+
account,
|
|
283
|
+
context
|
|
284
|
+
});
|
|
285
|
+
const inviteUserId = normalizeOptionalLowercaseString(context?.currentChannelProvider) === "slack" && context?.requesterAccountId && normalizeAccountId(context.requesterAccountId) === normalizeAccountId(account.accountId) ? context?.requesterSenderId : void 0;
|
|
286
|
+
assertSlackDetachedTargetAllowed(account.accountId, teamId);
|
|
287
|
+
const result = await slackActionRuntime.createSlackChannel(readStringParam(params, "name", { required: true }), {
|
|
288
|
+
...buildActionOpts("write", teamId),
|
|
289
|
+
inviteUserId
|
|
290
|
+
});
|
|
291
|
+
return jsonResult({
|
|
292
|
+
ok: true,
|
|
293
|
+
...result
|
|
294
|
+
});
|
|
295
|
+
}
|
|
297
296
|
if (reactionsActions.has(action)) {
|
|
298
297
|
if (!isActionEnabled("reactions")) throw new Error("Slack reactions are disabled.");
|
|
299
298
|
const target = resolveChannelTarget();
|
|
@@ -336,7 +335,7 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
336
335
|
if (!isActionEnabled("messages")) throw new Error("Slack messages are disabled.");
|
|
337
336
|
const sentResults = [];
|
|
338
337
|
const buildSendOpts = (destination, forceDocument) => {
|
|
339
|
-
const threadTs =
|
|
338
|
+
const threadTs = resolveSlackThreadTsFromContext(readStringParam(params, "threadTs"), destination, context, { suppressImplicitThread: params.topLevel === true || params.threadTs === null });
|
|
340
339
|
return {
|
|
341
340
|
...buildActionOpts("write"),
|
|
342
341
|
mediaAccess: context?.mediaAccess,
|
|
@@ -396,8 +395,7 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
396
395
|
...nativeDataFallbackBaseText !== void 0 ? { nativeDataFallbackBaseText } : {}
|
|
397
396
|
};
|
|
398
397
|
const sendContentAndBlocks = async () => {
|
|
399
|
-
|
|
400
|
-
if (content && shouldSplitLongContent) {
|
|
398
|
+
if (content && content.length > 8e3 && !hasSlackNativeDataBlock(blocks)) {
|
|
401
399
|
const { replyBroadcast: _replyBroadcast, ...blockSendOpts } = sendOpts;
|
|
402
400
|
await sendSlackMessage(destination, "", {
|
|
403
401
|
...blockSendOpts,
|
|
@@ -416,16 +414,13 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
416
414
|
});
|
|
417
415
|
if (preparedMessages?.length) for (const [index, message] of preparedMessages.entries()) await sendSlackMessage(destination, message.text, {
|
|
418
416
|
...baseSendOpts,
|
|
419
|
-
...
|
|
420
|
-
...
|
|
421
|
-
...message.authoredTextPlacement ? { authoredTextPlacement: message.authoredTextPlacement } : {},
|
|
422
|
-
...Object.hasOwn(message, "nativeDataFallbackBaseText") ? { nativeDataFallbackBaseText: message.nativeDataFallbackBaseText } : {},
|
|
423
|
-
...message.textIsSlackPlainText ? { textIsSlackPlainText: true } : {}
|
|
417
|
+
...message,
|
|
418
|
+
...index === 0 && replyBroadcast ? { replyBroadcast: true } : {}
|
|
424
419
|
});
|
|
425
420
|
else if (blocks) await sendContentAndBlocks();
|
|
426
421
|
else await sendSlackMessage(destination, content ?? "", {
|
|
427
422
|
...sendOpts,
|
|
428
|
-
mediaUrl
|
|
423
|
+
mediaUrl,
|
|
429
424
|
blocks
|
|
430
425
|
});
|
|
431
426
|
return jsonResult({
|
|
@@ -464,7 +459,7 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
464
459
|
if (!content && !blocks) throw new Error("Slack editMessage requires content or blocks.");
|
|
465
460
|
await assertReadTargetAllowed(target);
|
|
466
461
|
const writeOpts = buildActionOpts("write", target.teamId);
|
|
467
|
-
await slackActionRuntime.editSlackMessage(channelId, messageId, content ?? "", {
|
|
462
|
+
await (context?.preparedEditText === void 0 ? slackActionRuntime.editSlackMessage : slackActionRuntime.editSlackRenderedMessage)(channelId, messageId, context?.preparedEditText ?? content ?? "", {
|
|
468
463
|
...writeOpts,
|
|
469
464
|
blocks
|
|
470
465
|
});
|
|
@@ -492,10 +487,10 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
492
487
|
const result = await slackActionRuntime.readSlackMessages(channelId, {
|
|
493
488
|
...readOpts,
|
|
494
489
|
limit,
|
|
495
|
-
before
|
|
496
|
-
after
|
|
497
|
-
threadId
|
|
498
|
-
messageId
|
|
490
|
+
before,
|
|
491
|
+
after,
|
|
492
|
+
threadId,
|
|
493
|
+
messageId
|
|
499
494
|
});
|
|
500
495
|
const messages = result.messages.map((message) => withNormalizedTimestamp(message, message.ts));
|
|
501
496
|
return jsonResult({
|
|
@@ -515,14 +510,12 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
515
510
|
await assertReadTargetAllowed(target);
|
|
516
511
|
const threadId = readStringParam(params, "threadId") ?? readStringParam(params, "replyTo");
|
|
517
512
|
const maxBytes = account.config?.mediaMaxMb ? account.config.mediaMaxMb * 1024 * 1024 : 20971520;
|
|
518
|
-
const readToken = resolveSlackOperationToken(account, "read");
|
|
519
513
|
const readOpts = buildActionOpts("read", target.teamId);
|
|
520
514
|
const downloaded = await slackActionRuntime.downloadSlackFile(fileId, {
|
|
521
515
|
...readOpts,
|
|
522
|
-
...readToken && !readOpts.token ? { token: readToken } : {},
|
|
523
516
|
maxBytes,
|
|
524
517
|
channelId,
|
|
525
|
-
threadId
|
|
518
|
+
threadId
|
|
526
519
|
});
|
|
527
520
|
if (!downloaded) return jsonResult({
|
|
528
521
|
ok: false,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as handleSlackAction } from "./action-runtime-D01wBhx5.mjs";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { n as formatSlackTarget } from "./target-parsing-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { g as resolveSlackBotToken, o as resolveDefaultSlackAccountId, s as resolveSlackAccount } from "./accounts-CGJScKtk.mjs";
|
|
3
|
+
import { n as formatSlackTarget } from "./target-parsing-Bx2UZniD.mjs";
|
|
4
|
+
import { I as truncateSlackTextByUtf8Bytes, N as stripSlackNativeDataBlocks, O as hasSlackNativeDataBlock, P as countSlackTextUtf8Bytes, S as assertSlackDetachedTargetAllowed, T as appendSlackNativeDataPlainTextFallback, Tt as escapeSlackMrkdwn, at as buildSlackCompleteBlocksFallbackText, it as buildSlackBlocksFallbackText, k as isSlackInvalidBlocksError, nn as SLACK_PRIVATE_ACTION_DELIVERY_RESULT, ot as renderSlackBlockFallbackText, rt as validateSlackBlocksArray, vt as SLACK_EDIT_TEXT_MAX_BYTES, w as appendSlackNativeDataFallbackText, wt as normalizeSlackOutboundText } from "./probe-DANukR3O.mjs";
|
|
5
|
+
import { c as createSlackWriteClient, r as createSlackLookupClient, u as getSlackWriteClient } from "./cursor-pages-CATAzbTT.mjs";
|
|
6
|
+
import { h as buildSlackNativeDataDeliveryPlan, t as sendMessageSlack } from "./send-yK6_-px6.mjs";
|
|
7
7
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
8
8
|
import { asOptionalObjectRecord, asOptionalRecord, isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
-
import { createSubsystemLogger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
10
9
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
10
|
+
import { createSubsystemLogger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
11
11
|
import { captureChannelReadAuthority as captureChannelReadAuthority$1 } from "openclaw/plugin-sdk/fetch-runtime";
|
|
12
12
|
import { fetchWithRuntimeDispatcher as fetchWithRuntimeDispatcher$1 } from "openclaw/plugin-sdk/runtime-fetch";
|
|
13
13
|
import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
@@ -21,12 +21,13 @@ import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
|
|
|
21
21
|
import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
22
22
|
import { saveRemoteMedia, unlinkIfExists } from "openclaw/plugin-sdk/media-runtime";
|
|
23
23
|
//#region extensions/slack/src/conversation-open.ts
|
|
24
|
+
const slackTeamIdSchema = z.string().trim().regex(/^T[A-Z0-9]+$/i).optional();
|
|
24
25
|
function parseSlackConversationOpenInput(userIds, teamId) {
|
|
25
26
|
const users = z.array(z.string().trim().regex(/^[UW][A-Z0-9]+$/)).min(1).max(8).parse(userIds);
|
|
26
27
|
if (new Set(users).size !== users.length) throw new Error("Slack conversation-open requires distinct userIds.");
|
|
27
28
|
return {
|
|
28
29
|
users,
|
|
29
|
-
teamId:
|
|
30
|
+
teamId: slackTeamIdSchema.parse(teamId)
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
async function openSlackConversationWithClient(client, input) {
|
|
@@ -232,7 +233,6 @@ async function saveSlackMedia(params) {
|
|
|
232
233
|
const timeoutAbortController = totalTimeoutMs ? new AbortController() : void 0;
|
|
233
234
|
const abortSignals = [params.abortSignal, timeoutAbortController?.signal].filter((signal) => Boolean(signal));
|
|
234
235
|
const signal = abortSignals.length > 1 ? AbortSignal.any(abortSignals) : abortSignals[0];
|
|
235
|
-
let timedOut = false;
|
|
236
236
|
const savePromise = saveRemoteMedia({
|
|
237
237
|
url,
|
|
238
238
|
fetchImpl: createSlackMediaFetch(params.govSlack, params.assertReadAuthority),
|
|
@@ -249,13 +249,9 @@ async function saveSlackMedia(params) {
|
|
|
249
249
|
maxBytes: params.maxBytes,
|
|
250
250
|
ssrfPolicy: params.govSlack ? SLACK_GOV_MEDIA_SSRF_POLICY : SLACK_MEDIA_SSRF_POLICY,
|
|
251
251
|
readIdleTimeoutMs: params.readIdleTimeoutMs ?? 6e4
|
|
252
|
-
}).catch((error) => {
|
|
253
|
-
if (timedOut) return new Promise(() => {});
|
|
254
|
-
throw error;
|
|
255
252
|
});
|
|
256
253
|
if (!totalTimeoutMs) return await savePromise;
|
|
257
254
|
return await raceWithTimeout(savePromise, totalTimeoutMs, () => {
|
|
258
|
-
timedOut = true;
|
|
259
255
|
timeoutAbortController?.abort();
|
|
260
256
|
throw new Error(`slack media download timed out after ${totalTimeoutMs}ms`);
|
|
261
257
|
}, { ref: false });
|
|
@@ -289,34 +285,6 @@ async function looksLikeHtmlFile(filePath) {
|
|
|
289
285
|
const MAX_SLACK_MEDIA_CONCURRENCY = 3;
|
|
290
286
|
const MAX_SLACK_FORWARDED_ATTACHMENTS = 8;
|
|
291
287
|
const SLACK_MEDIA_LIMIT_REASON = `omitted: 8-file limit`;
|
|
292
|
-
function formatSlackMediaFailure(error) {
|
|
293
|
-
return redactToolPayloadText(formatErrorMessage(error)).replace(/\s+/g, " ").slice(0, 200);
|
|
294
|
-
}
|
|
295
|
-
async function fetchFreshSlackFileUrl(params) {
|
|
296
|
-
if (!params.file.id || !params.client) return null;
|
|
297
|
-
const assertCurrent = captureSlackMediaReadGuard(params);
|
|
298
|
-
try {
|
|
299
|
-
assertCurrent?.();
|
|
300
|
-
const info = await params.client.files.info({ file: params.file.id });
|
|
301
|
-
assertCurrent?.();
|
|
302
|
-
const freshFile = info.file;
|
|
303
|
-
if (freshFile && params.isRefreshedFileAllowed?.(freshFile) === false) {
|
|
304
|
-
logVerbose(`slack: refreshed file metadata rejected for file id=${params.file.id}`);
|
|
305
|
-
return null;
|
|
306
|
-
}
|
|
307
|
-
const freshUrl = freshFile?.url_private_download ?? freshFile?.url_private;
|
|
308
|
-
if (freshUrl) {
|
|
309
|
-
logVerbose(`slack: refreshed file URL via files.info for file id=${params.file.id}`);
|
|
310
|
-
return freshUrl;
|
|
311
|
-
}
|
|
312
|
-
logVerbose(`slack: files.info returned no private URL for file id=${params.file.id}`);
|
|
313
|
-
return null;
|
|
314
|
-
} catch (error) {
|
|
315
|
-
assertCurrent?.();
|
|
316
|
-
logVerbose(`slack: files.info failed for file id=${params.file.id}: ${formatErrorMessage(error)}`);
|
|
317
|
-
return null;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
288
|
async function downloadSlackMediaFile(params) {
|
|
321
289
|
const assertReadAuthority = captureSlackMediaReadGuard(params);
|
|
322
290
|
assertReadAuthority?.();
|
|
@@ -359,13 +327,29 @@ async function resolveSlackMedia(params) {
|
|
|
359
327
|
const files = params.files ?? [];
|
|
360
328
|
const limitedFiles = files.length > 8 ? files.slice(0, 8) : files;
|
|
361
329
|
for (const file of files.slice(8)) params.unavailableFiles?.set(file, SLACK_MEDIA_LIMIT_REASON);
|
|
362
|
-
const refreshFileUrl = (file) =>
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
330
|
+
const refreshFileUrl = async (file) => {
|
|
331
|
+
const { client, isRefreshedFileAllowed } = params;
|
|
332
|
+
if (!file.id || !client) return null;
|
|
333
|
+
const assertRefreshCurrent = captureSlackMediaReadGuard(params);
|
|
334
|
+
try {
|
|
335
|
+
assertRefreshCurrent?.();
|
|
336
|
+
const info = await client.files.info({ file: file.id });
|
|
337
|
+
assertRefreshCurrent?.();
|
|
338
|
+
const freshFile = info.file;
|
|
339
|
+
if (freshFile && isRefreshedFileAllowed?.(freshFile) === false) {
|
|
340
|
+
logVerbose(`slack: refreshed file metadata rejected for file id=${file.id}`);
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
const freshUrl = freshFile?.url_private_download ?? freshFile?.url_private;
|
|
344
|
+
if (freshUrl) return freshUrl;
|
|
345
|
+
logVerbose(`slack: files.info returned no private URL for file id=${file.id}`);
|
|
346
|
+
return null;
|
|
347
|
+
} catch {
|
|
348
|
+
assertRefreshCurrent?.();
|
|
349
|
+
logVerbose(`slack: files.info failed for file id=${file.id}`);
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
};
|
|
369
353
|
const { results, hasError, firstError } = await runTasksWithConcurrency({
|
|
370
354
|
tasks: limitedFiles.map((file) => async () => {
|
|
371
355
|
assertCurrent?.();
|
|
@@ -383,13 +367,16 @@ async function resolveSlackMedia(params) {
|
|
|
383
367
|
govSlack
|
|
384
368
|
});
|
|
385
369
|
} catch (error) {
|
|
386
|
-
reason =
|
|
370
|
+
reason = redactToolPayloadText(formatErrorMessage(error)).replace(/\s+/g, " ").slice(0, 200);
|
|
387
371
|
}
|
|
388
372
|
assertCurrent?.();
|
|
389
373
|
url = attempt === 0 && eventUrl ? await refreshFileUrl(file) : null;
|
|
390
374
|
}
|
|
391
375
|
params.unavailableFiles?.set(file, reason);
|
|
392
|
-
slackMediaLog.warn(
|
|
376
|
+
slackMediaLog.warn("slack: file unavailable", {
|
|
377
|
+
fileId: file.id,
|
|
378
|
+
reason: reason === "no private download URL" ? "missing-url" : "download-failed"
|
|
379
|
+
});
|
|
393
380
|
return null;
|
|
394
381
|
}),
|
|
395
382
|
limit: MAX_SLACK_MEDIA_CONCURRENCY,
|
|
@@ -464,9 +451,9 @@ async function resolveSlackAttachmentContent(params) {
|
|
|
464
451
|
...saved.fileName ? { fileName: saved.fileName } : {},
|
|
465
452
|
placeholder: `[Forwarded image: ${label}]`
|
|
466
453
|
});
|
|
467
|
-
} catch
|
|
454
|
+
} catch {
|
|
468
455
|
unavailableMediaCount += 1;
|
|
469
|
-
slackMediaLog.warn(
|
|
456
|
+
slackMediaLog.warn("slack: forwarded image unavailable");
|
|
470
457
|
}
|
|
471
458
|
attachmentMedia.push(...await resolveFiles(att.files) ?? []);
|
|
472
459
|
}
|
|
@@ -497,6 +484,7 @@ async function resolveSlackAttachmentContent(params) {
|
|
|
497
484
|
//#endregion
|
|
498
485
|
//#region extensions/slack/src/actions.ts
|
|
499
486
|
var actions_exports = /* @__PURE__ */ __exportAll({
|
|
487
|
+
createSlackChannel: () => createSlackChannel,
|
|
500
488
|
deleteSlackMessage: () => deleteSlackMessage,
|
|
501
489
|
downloadSlackFile: () => downloadSlackFile,
|
|
502
490
|
editSlackMessage: () => editSlackMessage,
|
|
@@ -506,6 +494,7 @@ var actions_exports = /* @__PURE__ */ __exportAll({
|
|
|
506
494
|
listSlackPins: () => listSlackPins,
|
|
507
495
|
listSlackReactions: () => listSlackReactions,
|
|
508
496
|
openSlackConversation: () => openSlackConversation,
|
|
497
|
+
parseSlackChannelCreateInput: () => parseSlackChannelCreateInput,
|
|
509
498
|
pinSlackMessage: () => pinSlackMessage,
|
|
510
499
|
reactSlackMessage: () => reactSlackMessage,
|
|
511
500
|
readSlackMessages: () => readSlackMessages,
|
|
@@ -616,17 +605,58 @@ async function getClient(opts = {}, mode = "read") {
|
|
|
616
605
|
}).accountId : normalizeAccountId(opts.accountId);
|
|
617
606
|
assertSlackDetachedTargetAllowed(accountId, opts.teamId);
|
|
618
607
|
const token = resolveToken(opts.token, opts.accountId, opts.cfg);
|
|
608
|
+
const clientTeamId = opts.omitTeamId ? void 0 : opts.teamId;
|
|
619
609
|
if (mode === "write") {
|
|
620
|
-
if (opts.assertDirectAdapterHandoff) return createSlackWriteClient(token, { teamId:
|
|
621
|
-
return getSlackWriteClient(token, { teamId:
|
|
610
|
+
if (opts.assertDirectAdapterHandoff) return createSlackWriteClient(token, { teamId: clientTeamId }, opts.assertDirectAdapterHandoff);
|
|
611
|
+
return getSlackWriteClient(token, { teamId: clientTeamId });
|
|
622
612
|
}
|
|
623
|
-
return createSlackLookupClient(token, { teamId:
|
|
613
|
+
return createSlackLookupClient(token, { teamId: clientTeamId }, opts.assertDirectAdapterHandoff);
|
|
624
614
|
}
|
|
625
615
|
async function resolveBotUserId(client) {
|
|
626
616
|
const auth = await client.auth.test();
|
|
627
617
|
if (!auth?.user_id) throw new Error("Failed to resolve Slack bot user id");
|
|
628
618
|
return auth.user_id;
|
|
629
619
|
}
|
|
620
|
+
function parseSlackChannelCreateInput(name, teamId, inviteUserId) {
|
|
621
|
+
return {
|
|
622
|
+
name: z.string().trim().regex(/^[a-z0-9][a-z0-9_-]{0,79}$/).parse(name),
|
|
623
|
+
teamId: slackTeamIdSchema.parse(teamId),
|
|
624
|
+
inviteUserId: inviteUserId === void 0 ? void 0 : z.string().trim().regex(/^[UW][A-Z0-9]+$/i).parse(inviteUserId)
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
async function createSlackChannel(name, opts = {}) {
|
|
628
|
+
const input = parseSlackChannelCreateInput(name, opts.teamId, opts.inviteUserId);
|
|
629
|
+
const result = await (await getClient(opts, "write")).conversations.create({
|
|
630
|
+
name: input.name,
|
|
631
|
+
team_id: input.teamId
|
|
632
|
+
});
|
|
633
|
+
const channelId = result.channel?.id?.trim();
|
|
634
|
+
if (!channelId || !/^C[A-Z0-9]+$/i.test(channelId)) throw new Error("Slack conversations.create did not return a valid public channel ID.");
|
|
635
|
+
let inviteWarning;
|
|
636
|
+
if (input.inviteUserId) try {
|
|
637
|
+
await (await getClient({
|
|
638
|
+
...opts,
|
|
639
|
+
omitTeamId: true
|
|
640
|
+
}, "write")).conversations.invite({
|
|
641
|
+
channel: channelId,
|
|
642
|
+
users: input.inviteUserId
|
|
643
|
+
});
|
|
644
|
+
} catch (error) {
|
|
645
|
+
inviteWarning = `${error instanceof Error && /missing_scope/i.test(error.message) ? "Slack is missing the invitation permission" : "Slack rejected the invitation"}; the requesting user can join the returned public channel, or an operator can reauthorize the Slack app and retry.`;
|
|
646
|
+
}
|
|
647
|
+
return {
|
|
648
|
+
channelId,
|
|
649
|
+
name: result.channel?.name?.trim() || input.name,
|
|
650
|
+
target: formatSlackTarget({
|
|
651
|
+
teamId: input.teamId,
|
|
652
|
+
kind: "channel",
|
|
653
|
+
id: channelId,
|
|
654
|
+
explicitKind: true
|
|
655
|
+
}),
|
|
656
|
+
...input.inviteUserId && !inviteWarning ? { invitedUserId: input.inviteUserId } : {},
|
|
657
|
+
...inviteWarning ? { inviteWarning } : {}
|
|
658
|
+
};
|
|
659
|
+
}
|
|
630
660
|
function createSlackReactionUpdater(method, unchangedError) {
|
|
631
661
|
return async (channelId, messageId, emoji, opts = {}) => {
|
|
632
662
|
const client = await getClient(opts, "write");
|
|
@@ -653,7 +683,6 @@ async function removeOwnSlackReactions(channelId, messageId, opts = {}) {
|
|
|
653
683
|
if (!name) continue;
|
|
654
684
|
if ((reaction?.users ?? []).includes(userId)) toRemove.add(name);
|
|
655
685
|
}
|
|
656
|
-
if (toRemove.size === 0) return [];
|
|
657
686
|
await Promise.all(Array.from(toRemove, (name) => removeSlackReaction(channelId, messageId, name, { client })));
|
|
658
687
|
return Array.from(toRemove);
|
|
659
688
|
}
|
|
@@ -667,26 +696,10 @@ async function listSlackReactions(channelId, messageId, opts = {}) {
|
|
|
667
696
|
async function sendSlackMessage(to, content, opts) {
|
|
668
697
|
const onDeliveryResult = Object.getOwnPropertyDescriptor(opts, SLACK_PRIVATE_ACTION_DELIVERY_RESULT)?.value;
|
|
669
698
|
return await sendMessageSlack(to, content, {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
...opts.forceDocument ? { forceDocument: true } : {},
|
|
675
|
-
mediaAccess: opts.mediaAccess,
|
|
676
|
-
mediaLocalRoots: opts.mediaLocalRoots,
|
|
677
|
-
mediaReadFile: opts.mediaReadFile,
|
|
678
|
-
client: opts.client,
|
|
679
|
-
assertDirectAdapterHandoff: opts.assertDirectAdapterHandoff,
|
|
680
|
-
threadTs: opts.threadTs,
|
|
681
|
-
replyBroadcast: opts.replyBroadcast,
|
|
682
|
-
...opts.textIsSlackMrkdwn ? { textIsSlackMrkdwn: true } : {},
|
|
683
|
-
...opts.textIsSlackPlainText ? { textIsSlackPlainText: true } : {},
|
|
684
|
-
...opts.authoredTextPlacement ? { authoredTextPlacement: opts.authoredTextPlacement } : {},
|
|
685
|
-
...Object.hasOwn(opts, "nativeDataFallbackBaseText") ? { nativeDataFallbackBaseText: opts.nativeDataFallbackBaseText } : {},
|
|
686
|
-
...opts.uploadFileName ? { uploadFileName: opts.uploadFileName } : {},
|
|
687
|
-
...opts.uploadTitle ? { uploadTitle: opts.uploadTitle } : {},
|
|
688
|
-
...typeof onDeliveryResult === "function" ? { onDeliveryResult } : {},
|
|
689
|
-
blocks: opts.blocks
|
|
699
|
+
...opts,
|
|
700
|
+
uploadFileName: opts.uploadFileName || void 0,
|
|
701
|
+
uploadTitle: opts.uploadTitle || void 0,
|
|
702
|
+
onDeliveryResult: typeof onDeliveryResult === "function" ? onDeliveryResult : void 0
|
|
690
703
|
});
|
|
691
704
|
}
|
|
692
705
|
async function editSlackMessage(channelId, messageId, content, opts = {}) {
|
|
@@ -720,7 +733,7 @@ async function editSlackRenderedMessage(channelId, messageId, content, opts = {}
|
|
|
720
733
|
if (!hasNativeData || !isSlackInvalidBlocksError(error)) throw error;
|
|
721
734
|
logVerbose("slack edit: native data block rejected, retrying with text fallback");
|
|
722
735
|
const survivorBlocks = stripSlackNativeDataBlocks(blocks);
|
|
723
|
-
const survivorText = buildSlackBlocksFallbackText(survivorBlocks)
|
|
736
|
+
const survivorText = buildSlackBlocksFallbackText(survivorBlocks);
|
|
724
737
|
const authoredEditText = content.trim();
|
|
725
738
|
const baseText = authoredEditText && !survivorText.includes(authoredEditText) ? authoredEditText : "";
|
|
726
739
|
const fallbackPlan = buildSlackNativeDataDeliveryPlan({
|
package/dist/.setup/{approval-handler.runtime-D8ArtDQt.mjs → approval-handler.runtime-Buw5jh2Y.mjs}
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as parseSlackTarget } from "./target-parsing-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as sendMessageSlack } from "./send-
|
|
6
|
-
import { n as runSlackApprovalMessageUpdate } from "./approval-message-updates-
|
|
1
|
+
import { a as parseSlackTarget } from "./target-parsing-Bx2UZniD.mjs";
|
|
2
|
+
import { Et as isSlackAnyNativeApprovalClientEnabled, F as truncateSlackText, I as truncateSlackTextByUtf8Bytes, Pt as shouldHandleSlackNativeApprovalRequest, Q as SLACK_APPROVAL_HEADER_BLOCK_ID, Qt as normalizeSlackApproverId, i as setSlackSessionStatus, vt as SLACK_EDIT_TEXT_MAX_BYTES } from "./probe-DANukR3O.mjs";
|
|
3
|
+
import { o as resolveSlackReplyBlocks } from "./reply-blocks-BzsXUUUL.mjs";
|
|
4
|
+
import { l as getSlackListenerWriteClient } from "./cursor-pages-CATAzbTT.mjs";
|
|
5
|
+
import { t as sendMessageSlack } from "./send-yK6_-px6.mjs";
|
|
6
|
+
import { n as runSlackApprovalMessageUpdate } from "./approval-message-updates-pmXcve5E.mjs";
|
|
7
7
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
9
9
|
import { buildApprovalPresentationFromActionDescriptors } from "openclaw/plugin-sdk/approval-reply-runtime";
|
|
10
10
|
import { logError } from "openclaw/plugin-sdk/logging-core";
|
|
11
|
-
import { createChannelApprovalNativeRuntimeAdapterAsync } from "openclaw/plugin-sdk/approval-handler-runtime";
|
|
12
11
|
import { formatChannelApprovalResolvedLabel } from "openclaw/plugin-sdk/approval-runtime";
|
|
12
|
+
import { createChannelApprovalNativeRuntimeAdapterAsync } from "openclaw/plugin-sdk/approval-handler-runtime";
|
|
13
13
|
//#region extensions/slack/src/approval-handler.runtime.ts
|
|
14
14
|
const SLACK_CONTEXT_ELEMENTS_MAX = 10;
|
|
15
15
|
const SLACK_TEXT_OBJECT_MAX = 3e3;
|
|
@@ -22,9 +22,6 @@ function resolveHandlerContext(params) {
|
|
|
22
22
|
context
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function truncateSlackMrkdwn(text, maxChars) {
|
|
26
|
-
return truncateSlackText(text, Math.max(0, Math.floor(maxChars)), "preserve");
|
|
27
|
-
}
|
|
28
25
|
function buildSlackCodeBlock(text) {
|
|
29
26
|
let fence = "```";
|
|
30
27
|
while (text.includes(fence)) fence += "`";
|
|
@@ -40,7 +37,7 @@ function buildSlackMetadataContextBlock(lines) {
|
|
|
40
37
|
const visibleLineCount = lines.length > SLACK_CONTEXT_ELEMENTS_MAX ? 9 : lines.length;
|
|
41
38
|
const elements = lines.slice(0, visibleLineCount).map((line) => ({
|
|
42
39
|
type: "mrkdwn",
|
|
43
|
-
text:
|
|
40
|
+
text: truncateSlackText(line, SLACK_TEXT_OBJECT_MAX, "preserve")
|
|
44
41
|
}));
|
|
45
42
|
if (lines.length > SLACK_CONTEXT_ELEMENTS_MAX) elements.push({
|
|
46
43
|
type: "mrkdwn",
|
|
@@ -95,8 +92,8 @@ function buildSlackApprovalPayload(input) {
|
|
|
95
92
|
renderBody(bodyText),
|
|
96
93
|
...metadataLines
|
|
97
94
|
].join("\n");
|
|
98
|
-
const headerDescription = isPlugin && phase === "pending" ?
|
|
99
|
-
const blocks = [buildSlackApprovalSection(`${heading}\n${headerDescription}`, phase === "pending" ? SLACK_APPROVAL_HEADER_BLOCK_ID : void 0), buildSlackApprovalSection(`${bodyLabel}\n${renderBody(
|
|
95
|
+
const headerDescription = isPlugin && phase === "pending" ? truncateSlackText(description, 2600, "preserve") : description;
|
|
96
|
+
const blocks = [buildSlackApprovalSection(`${heading}\n${headerDescription}`, phase === "pending" ? SLACK_APPROVAL_HEADER_BLOCK_ID : void 0), buildSlackApprovalSection(`${bodyLabel}\n${renderBody(truncateSlackText(bodyText, 2600, "preserve"))}`)];
|
|
100
97
|
const metadataBlock = buildSlackMetadataContextBlock(metadataLines);
|
|
101
98
|
if (metadataBlock) blocks.push(metadataBlock);
|
|
102
99
|
if (phase === "pending") blocks.push(...resolveSlackReplyBlocks({
|
|
@@ -108,22 +105,6 @@ function buildSlackApprovalPayload(input) {
|
|
|
108
105
|
blocks
|
|
109
106
|
};
|
|
110
107
|
}
|
|
111
|
-
async function updateMessage(client, accountId, { channelId, messageTs }, { text, blocks }) {
|
|
112
|
-
try {
|
|
113
|
-
await runSlackApprovalMessageUpdate({
|
|
114
|
-
accountId,
|
|
115
|
-
channelId,
|
|
116
|
-
messageTs
|
|
117
|
-
}, () => client.chat.update({
|
|
118
|
-
channel: channelId,
|
|
119
|
-
ts: messageTs,
|
|
120
|
-
text: truncateSlackTextByUtf8Bytes(text, SLACK_EDIT_TEXT_MAX_BYTES),
|
|
121
|
-
blocks
|
|
122
|
-
}));
|
|
123
|
-
} catch (err) {
|
|
124
|
-
logError(`slack approvals: failed to update message: ${String(err)}`);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
108
|
const slackApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapterAsync({
|
|
128
109
|
eventKinds: [
|
|
129
110
|
"exec",
|
|
@@ -229,7 +210,22 @@ const slackApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapterAsyn
|
|
|
229
210
|
});
|
|
230
211
|
if (!resolved) return;
|
|
231
212
|
const client = resolveApprovalClient(resolved.context, entry.teamId);
|
|
232
|
-
|
|
213
|
+
const { channelId, messageTs } = entry;
|
|
214
|
+
const { text, blocks } = payload;
|
|
215
|
+
try {
|
|
216
|
+
await runSlackApprovalMessageUpdate({
|
|
217
|
+
accountId: resolved.accountId,
|
|
218
|
+
channelId,
|
|
219
|
+
messageTs
|
|
220
|
+
}, () => client.chat.update({
|
|
221
|
+
channel: channelId,
|
|
222
|
+
ts: messageTs,
|
|
223
|
+
text: truncateSlackTextByUtf8Bytes(text, SLACK_EDIT_TEXT_MAX_BYTES),
|
|
224
|
+
blocks
|
|
225
|
+
}));
|
|
226
|
+
} catch (err) {
|
|
227
|
+
logError(`slack approvals: failed to update message: ${String(err)}`);
|
|
228
|
+
}
|
|
233
229
|
await setSlackSessionStatus({
|
|
234
230
|
client,
|
|
235
231
|
channelId: entry.channelId,
|
package/dist/.setup/{approval-message-updates-DT7XBPbV.mjs → approval-message-updates-pmXcve5E.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as decodeSlackApprovalAction, W as isSlackApprovalActionId } from "./probe-DANukR3O.mjs";
|
|
2
2
|
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
4
4
|
//#region extensions/slack/src/approval-message-updates.ts
|