@openclaw/slack 2026.10.10 → 2026.11.5-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/.setup/{account-inspect-Bc7TVU8F.mjs → account-inspect-DgQgj0wk.mjs} +11 -8
- package/dist/.setup/{accounts-CEgdyqoW.mjs → accounts-EaPP0fFY.mjs} +10 -1
- package/dist/.setup/{action-runtime-DPoxYao5.mjs → action-runtime-CK9QZgQl.mjs} +38 -45
- package/dist/.setup/action-runtime.runtime-CpZktret.mjs +1 -0
- package/dist/.setup/{actions-PF2cP6to.mjs → actions-s3CcFO45.mjs} +89 -76
- package/dist/.setup/{approval-handler.runtime-BtRklemy.mjs → approval-handler.runtime-Ch7BecYK.mjs} +26 -30
- package/dist/.setup/{approval-message-updates-CpwbsEj6.mjs → approval-message-updates-CqcRoa28.mjs} +1 -1
- package/dist/.setup/{channel-B6bRmYmX.mjs → channel-CAvo_WNZ.mjs} +566 -338
- package/dist/.setup/{channel-type-Dh4vwh1Y.mjs → channel-type-9Lw6yLf2.mjs} +4 -8
- package/dist/.setup/{channel.setup-BBzT6uKA.mjs → channel.setup-BlgXNuCJ.mjs} +13 -13
- package/dist/.setup/{config-schema-Cz3uId-c.mjs → config-schema-Bx1tCZB0.mjs} +3 -7
- package/dist/.setup/cursor-pages-jVn3Vkfi.mjs +309 -0
- package/dist/.setup/{directory-config-BEPra1E2.mjs → directory-config-CGvKYg9F.mjs} +3 -3
- package/dist/.setup/{directory-live-BkUwPrS0.mjs → directory-live-DNdw97LA.mjs} +4 -4
- package/dist/.setup/{doctor-contract-HK8aedwU.mjs → doctor-contract-BB2KJ9Ni.mjs} +37 -45
- package/dist/.setup/{message-tool-api-DeiQJoRV.mjs → message-tool-api-B38BpEaE.mjs} +4 -3
- package/dist/.setup/{monitor-DsZUQtTM.mjs → monitor-BD86SotB.mjs} +3397 -3672
- package/dist/.setup/{outbound-adapter-C0R5jz6S.mjs → outbound-adapter-BH6iPWBj.mjs} +30 -36
- package/dist/.setup/paths-CQZI_5WY.mjs +7 -0
- package/dist/.setup/{pipeline.runtime-CIFVL0kf.mjs → pipeline.runtime-C4ELxaRU.mjs} +415 -534
- package/dist/.setup/{policy-Bp1FvE6m.mjs → policy-C6_DdlSf.mjs} +1 -2
- package/dist/.setup/{session-status-CHkEn3HM.mjs → probe-B_Ax1vS1.mjs} +985 -622
- package/dist/.setup/question-delivery-D3qAIwuv.mjs +38 -0
- package/dist/.setup/{relay-source-DFBDTA5Z.mjs → relay-source-a8jodKuO.mjs} +11 -4
- package/dist/.setup/{replies-7DRN46EL.mjs → replies-Bq7n0gfM.mjs} +34 -19
- package/dist/.setup/{reply-blocks-DOjiDr44.mjs → reply-blocks-DyYYRrP_.mjs} +200 -205
- package/dist/.setup/{resolve-channels-BNQ1KZXh.mjs → resolve-channels-CF2JME9q.mjs} +4 -7
- package/dist/.setup/{resolve-users-C4dC8Z7D.mjs → resolve-users-DDcCAjH1.mjs} +8 -16
- package/dist/.setup/{scopes-C1aeCBa6.mjs → scopes-CzHC_dwV.mjs} +2 -1
- package/dist/.setup/{secret-contract-D0UY2JWF.mjs → secret-contract-CqVqR7MP.mjs} +4 -2
- package/dist/.setup/{secret-contract-api-BhzGpUb0.mjs → secret-contract-api-DaCXZ47j.mjs} +1 -1
- package/dist/.setup/{send-C5uXkmZV.mjs → send-WJZ73VSf.mjs} +297 -333
- package/dist/.setup/{send-results-D-o6PgtS.mjs → send-results-Bm6V1ekL.mjs} +3 -4
- package/dist/.setup/setup-plugin-api-DJXIB8CF.mjs +2 -0
- package/dist/.setup/{setup-surface-CtM1pm-9.mjs → setup-surface-uIqP2B0Y.mjs} +5 -6
- package/dist/.setup/{slash-dispatch.runtime-Bnn9a5qB.mjs → slash-dispatch.runtime-Cwuwv7FL.mjs} +2 -2
- package/dist/.setup/{target-parsing-0pRZtahO.mjs → target-parsing-DwYAP3ts.mjs} +1 -2
- package/dist/.setup/{targets-BqXz7CpG.mjs → targets-eeOxA_b_.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 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/index.js +0 -6
- package/dist/message-tool-api.js +1 -1
- package/dist/runtime-api.js +10 -12
- package/dist/secret-contract-api.js +1 -1
- package/dist/setup-entry.js +2 -2
- package/dist/setup-plugin-api.js +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/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/body-parser/README.md +13 -17
- package/node_modules/@slack/bolt/node_modules/body-parser/lib/read.js +57 -74
- package/node_modules/@slack/bolt/node_modules/body-parser/lib/types/json.js +11 -11
- package/node_modules/@slack/bolt/node_modules/body-parser/lib/types/urlencoded.js +5 -5
- package/node_modules/@slack/bolt/node_modules/body-parser/lib/utils.js +15 -0
- package/node_modules/@slack/bolt/node_modules/body-parser/package.json +12 -7
- 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-DWKWaKgC.mjs +0 -1
- package/dist/.setup/http-GpAVKwSX.mjs +0 -2
- package/dist/.setup/plugin-routes-lXsy_bNV.mjs +0 -21
- package/dist/.setup/probe-C5VWf3sz.mjs +0 -686
- package/dist/.setup/registry-1G0f1zuZ.mjs +0 -34
- package/dist/.setup/setup-plugin-api-D7DoueEh.mjs +0 -2
- package/dist/.setup/shared-CohTHxM1.mjs +0 -255
- package/dist/.source-module-urls/562d694877afe9d9dcbb3b32a8883c16974738f2aa892c48d45572cdc9a62529.json +0 -1
- package/dist/http-routes-api.js +0 -1
- 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-35y0-Hso.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { _ as buildSlackAccountSurfaceFields, a as mergeSlackAccountConfig, o as resolveDefaultSlackAccountId } from "./accounts-EaPP0fFY.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
|
// 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
|
// extensions/slack/src/account-surface-fields.ts
|
|
@@ -56,6 +57,7 @@ var accounts_exports = /* @__PURE__ */ __exportAll({
|
|
|
56
57
|
resolveSlackAccountAllowFrom: () => resolveSlackAccountAllowFrom,
|
|
57
58
|
resolveSlackAccountDmPolicy: () => resolveSlackAccountDmPolicy,
|
|
58
59
|
resolveSlackConfigAccessorAccount: () => resolveSlackConfigAccessorAccount,
|
|
60
|
+
resolveSlackMarkdownOptions: () => resolveSlackMarkdownOptions,
|
|
59
61
|
resolveSlackOperationToken: () => resolveSlackOperationToken,
|
|
60
62
|
resolveSlackReplyToMode: () => resolveSlackReplyToMode
|
|
61
63
|
});
|
|
@@ -79,6 +81,13 @@ const { listAccountIds, resolveDefaultAccountId, resolveAccountConfig: resolveMe
|
|
|
79
81
|
});
|
|
80
82
|
const listSlackAccountIds = listAccountIds;
|
|
81
83
|
const resolveDefaultSlackAccountId = resolveDefaultAccountId;
|
|
84
|
+
function resolveSlackMarkdownOptions(params) {
|
|
85
|
+
return { tableMode: resolveMarkdownTableMode({
|
|
86
|
+
cfg: params.cfg,
|
|
87
|
+
channel: "slack",
|
|
88
|
+
accountId: params.accountId ?? resolveDefaultSlackAccountId(params.cfg)
|
|
89
|
+
}) };
|
|
90
|
+
}
|
|
82
91
|
function resolveSlackAccountConfig(cfg, accountId) {
|
|
83
92
|
return resolveAccountEntry(cfg.channels?.slack?.accounts, accountId);
|
|
84
93
|
}
|
|
@@ -182,4 +191,4 @@ function listEnabledSlackAccounts(cfg) {
|
|
|
182
191
|
accountId
|
|
183
192
|
})).filter((account) => account.enabled);
|
|
184
193
|
}
|
|
185
|
-
export { mergeSlackAccountConfig as a, resolveSlackAccountAllowFrom as c,
|
|
194
|
+
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-DwYAP3ts.mjs";
|
|
2
|
+
import { t as slackContextTargetsMatch } from "./targets-eeOxA_b_.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-B_Ax1vS1.mjs";
|
|
4
|
+
import { n as resolveSlackChannelConfig, t as isSlackChannelAllowedByPolicy } from "./policy-C6_DdlSf.mjs";
|
|
5
|
+
import { t as mergeSlackSendResults } from "./send-results-Bm6V1ekL.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-s3CcFO45.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-EaPP0fFY.mjs").then((n) => n.t));
|
|
35
|
+
const loadSlackChannelTypeRuntime = createLazyRuntimeModule(() => import("./channel-type-9Lw6yLf2.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-CK9QZgQl.mjs";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.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-EaPP0fFY.mjs";
|
|
3
|
+
import { n as formatSlackTarget } from "./target-parsing-DwYAP3ts.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-B_Ax1vS1.mjs";
|
|
5
|
+
import { c as createSlackWriteClient, r as createSlackLookupClient, u as getSlackWriteClient } from "./cursor-pages-jVn3Vkfi.mjs";
|
|
6
|
+
import { h as buildSlackNativeDataDeliveryPlan, t as sendMessageSlack } from "./send-WJZ73VSf.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
|
// 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) {
|
|
@@ -226,7 +227,6 @@ async function saveSlackMedia(params) {
|
|
|
226
227
|
const timeoutAbortController = totalTimeoutMs ? new AbortController() : void 0;
|
|
227
228
|
const abortSignals = [params.abortSignal, timeoutAbortController?.signal].filter((signal) => Boolean(signal));
|
|
228
229
|
const signal = abortSignals.length > 1 ? AbortSignal.any(abortSignals) : abortSignals[0];
|
|
229
|
-
let timedOut = false;
|
|
230
230
|
const savePromise = saveRemoteMedia({
|
|
231
231
|
url,
|
|
232
232
|
fetchImpl: createSlackMediaFetch(params.govSlack, params.assertReadAuthority),
|
|
@@ -243,13 +243,9 @@ async function saveSlackMedia(params) {
|
|
|
243
243
|
maxBytes: params.maxBytes,
|
|
244
244
|
ssrfPolicy: params.govSlack ? SLACK_GOV_MEDIA_SSRF_POLICY : SLACK_MEDIA_SSRF_POLICY,
|
|
245
245
|
readIdleTimeoutMs: params.readIdleTimeoutMs ?? 6e4
|
|
246
|
-
}).catch((error) => {
|
|
247
|
-
if (timedOut) return new Promise(() => {});
|
|
248
|
-
throw error;
|
|
249
246
|
});
|
|
250
247
|
if (!totalTimeoutMs) return await savePromise;
|
|
251
248
|
return await raceWithTimeout(savePromise, totalTimeoutMs, () => {
|
|
252
|
-
timedOut = true;
|
|
253
249
|
timeoutAbortController?.abort();
|
|
254
250
|
throw new Error(`slack media download timed out after ${totalTimeoutMs}ms`);
|
|
255
251
|
}, { ref: false });
|
|
@@ -283,34 +279,6 @@ async function looksLikeHtmlFile(filePath) {
|
|
|
283
279
|
const MAX_SLACK_MEDIA_CONCURRENCY = 3;
|
|
284
280
|
const MAX_SLACK_FORWARDED_ATTACHMENTS = 8;
|
|
285
281
|
const SLACK_MEDIA_LIMIT_REASON = `omitted: 8-file limit`;
|
|
286
|
-
function formatSlackMediaFailure(error) {
|
|
287
|
-
return redactToolPayloadText(formatErrorMessage(error)).replace(/\s+/g, " ").slice(0, 200);
|
|
288
|
-
}
|
|
289
|
-
async function fetchFreshSlackFileUrl(params) {
|
|
290
|
-
if (!params.file.id || !params.client) return null;
|
|
291
|
-
const assertCurrent = captureSlackMediaReadGuard(params);
|
|
292
|
-
try {
|
|
293
|
-
assertCurrent?.();
|
|
294
|
-
const info = await params.client.files.info({ file: params.file.id });
|
|
295
|
-
assertCurrent?.();
|
|
296
|
-
const freshFile = info.file;
|
|
297
|
-
if (freshFile && params.isRefreshedFileAllowed?.(freshFile) === false) {
|
|
298
|
-
logVerbose(`slack: refreshed file metadata rejected for file id=${params.file.id}`);
|
|
299
|
-
return null;
|
|
300
|
-
}
|
|
301
|
-
const freshUrl = freshFile?.url_private_download ?? freshFile?.url_private;
|
|
302
|
-
if (freshUrl) {
|
|
303
|
-
logVerbose(`slack: refreshed file URL via files.info for file id=${params.file.id}`);
|
|
304
|
-
return freshUrl;
|
|
305
|
-
}
|
|
306
|
-
logVerbose(`slack: files.info returned no private URL for file id=${params.file.id}`);
|
|
307
|
-
return null;
|
|
308
|
-
} catch (error) {
|
|
309
|
-
assertCurrent?.();
|
|
310
|
-
logVerbose(`slack: files.info failed for file id=${params.file.id}: ${formatErrorMessage(error)}`);
|
|
311
|
-
return null;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
282
|
async function downloadSlackMediaFile(params) {
|
|
315
283
|
const assertReadAuthority = captureSlackMediaReadGuard(params);
|
|
316
284
|
assertReadAuthority?.();
|
|
@@ -353,13 +321,29 @@ async function resolveSlackMedia(params) {
|
|
|
353
321
|
const files = params.files ?? [];
|
|
354
322
|
const limitedFiles = files.length > 8 ? files.slice(0, 8) : files;
|
|
355
323
|
for (const file of files.slice(8)) params.unavailableFiles?.set(file, SLACK_MEDIA_LIMIT_REASON);
|
|
356
|
-
const refreshFileUrl = (file) =>
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
324
|
+
const refreshFileUrl = async (file) => {
|
|
325
|
+
const { client, isRefreshedFileAllowed } = params;
|
|
326
|
+
if (!file.id || !client) return null;
|
|
327
|
+
const assertRefreshCurrent = captureSlackMediaReadGuard(params);
|
|
328
|
+
try {
|
|
329
|
+
assertRefreshCurrent?.();
|
|
330
|
+
const info = await client.files.info({ file: file.id });
|
|
331
|
+
assertRefreshCurrent?.();
|
|
332
|
+
const freshFile = info.file;
|
|
333
|
+
if (freshFile && isRefreshedFileAllowed?.(freshFile) === false) {
|
|
334
|
+
logVerbose(`slack: refreshed file metadata rejected for file id=${file.id}`);
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
const freshUrl = freshFile?.url_private_download ?? freshFile?.url_private;
|
|
338
|
+
if (freshUrl) return freshUrl;
|
|
339
|
+
logVerbose(`slack: files.info returned no private URL for file id=${file.id}`);
|
|
340
|
+
return null;
|
|
341
|
+
} catch {
|
|
342
|
+
assertRefreshCurrent?.();
|
|
343
|
+
logVerbose(`slack: files.info failed for file id=${file.id}`);
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
};
|
|
363
347
|
const { results, hasError, firstError } = await runTasksWithConcurrency({
|
|
364
348
|
tasks: limitedFiles.map((file) => async () => {
|
|
365
349
|
assertCurrent?.();
|
|
@@ -377,13 +361,16 @@ async function resolveSlackMedia(params) {
|
|
|
377
361
|
govSlack
|
|
378
362
|
});
|
|
379
363
|
} catch (error) {
|
|
380
|
-
reason =
|
|
364
|
+
reason = redactToolPayloadText(formatErrorMessage(error)).replace(/\s+/g, " ").slice(0, 200);
|
|
381
365
|
}
|
|
382
366
|
assertCurrent?.();
|
|
383
367
|
url = attempt === 0 && eventUrl ? await refreshFileUrl(file) : null;
|
|
384
368
|
}
|
|
385
369
|
params.unavailableFiles?.set(file, reason);
|
|
386
|
-
slackMediaLog.warn(
|
|
370
|
+
slackMediaLog.warn("slack: file unavailable", {
|
|
371
|
+
fileId: file.id,
|
|
372
|
+
reason: reason === "no private download URL" ? "missing-url" : "download-failed"
|
|
373
|
+
});
|
|
387
374
|
return null;
|
|
388
375
|
}),
|
|
389
376
|
limit: MAX_SLACK_MEDIA_CONCURRENCY,
|
|
@@ -458,9 +445,9 @@ async function resolveSlackAttachmentContent(params) {
|
|
|
458
445
|
...saved.fileName ? { fileName: saved.fileName } : {},
|
|
459
446
|
placeholder: `[Forwarded image: ${label}]`
|
|
460
447
|
});
|
|
461
|
-
} catch
|
|
448
|
+
} catch {
|
|
462
449
|
unavailableMediaCount += 1;
|
|
463
|
-
slackMediaLog.warn(
|
|
450
|
+
slackMediaLog.warn("slack: forwarded image unavailable");
|
|
464
451
|
}
|
|
465
452
|
attachmentMedia.push(...await resolveFiles(att.files) ?? []);
|
|
466
453
|
}
|
|
@@ -490,6 +477,7 @@ async function resolveSlackAttachmentContent(params) {
|
|
|
490
477
|
}
|
|
491
478
|
// extensions/slack/src/actions.ts
|
|
492
479
|
var actions_exports = /* @__PURE__ */ __exportAll({
|
|
480
|
+
createSlackChannel: () => createSlackChannel,
|
|
493
481
|
deleteSlackMessage: () => deleteSlackMessage,
|
|
494
482
|
downloadSlackFile: () => downloadSlackFile,
|
|
495
483
|
editSlackMessage: () => editSlackMessage,
|
|
@@ -499,6 +487,7 @@ var actions_exports = /* @__PURE__ */ __exportAll({
|
|
|
499
487
|
listSlackPins: () => listSlackPins,
|
|
500
488
|
listSlackReactions: () => listSlackReactions,
|
|
501
489
|
openSlackConversation: () => openSlackConversation,
|
|
490
|
+
parseSlackChannelCreateInput: () => parseSlackChannelCreateInput,
|
|
502
491
|
pinSlackMessage: () => pinSlackMessage,
|
|
503
492
|
reactSlackMessage: () => reactSlackMessage,
|
|
504
493
|
readSlackMessages: () => readSlackMessages,
|
|
@@ -609,17 +598,58 @@ async function getClient(opts = {}, mode = "read") {
|
|
|
609
598
|
}).accountId : normalizeAccountId(opts.accountId);
|
|
610
599
|
assertSlackDetachedTargetAllowed(accountId, opts.teamId);
|
|
611
600
|
const token = resolveToken(opts.token, opts.accountId, opts.cfg);
|
|
601
|
+
const clientTeamId = opts.omitTeamId ? void 0 : opts.teamId;
|
|
612
602
|
if (mode === "write") {
|
|
613
|
-
if (opts.assertDirectAdapterHandoff) return createSlackWriteClient(token, { teamId:
|
|
614
|
-
return getSlackWriteClient(token, { teamId:
|
|
603
|
+
if (opts.assertDirectAdapterHandoff) return createSlackWriteClient(token, { teamId: clientTeamId }, opts.assertDirectAdapterHandoff);
|
|
604
|
+
return getSlackWriteClient(token, { teamId: clientTeamId });
|
|
615
605
|
}
|
|
616
|
-
return createSlackLookupClient(token, { teamId:
|
|
606
|
+
return createSlackLookupClient(token, { teamId: clientTeamId }, opts.assertDirectAdapterHandoff);
|
|
617
607
|
}
|
|
618
608
|
async function resolveBotUserId(client) {
|
|
619
609
|
const auth = await client.auth.test();
|
|
620
610
|
if (!auth?.user_id) throw new Error("Failed to resolve Slack bot user id");
|
|
621
611
|
return auth.user_id;
|
|
622
612
|
}
|
|
613
|
+
function parseSlackChannelCreateInput(name, teamId, inviteUserId) {
|
|
614
|
+
return {
|
|
615
|
+
name: z.string().trim().regex(/^[a-z0-9][a-z0-9_-]{0,79}$/).parse(name),
|
|
616
|
+
teamId: slackTeamIdSchema.parse(teamId),
|
|
617
|
+
inviteUserId: inviteUserId === void 0 ? void 0 : z.string().trim().regex(/^[UW][A-Z0-9]+$/i).parse(inviteUserId)
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
async function createSlackChannel(name, opts = {}) {
|
|
621
|
+
const input = parseSlackChannelCreateInput(name, opts.teamId, opts.inviteUserId);
|
|
622
|
+
const result = await (await getClient(opts, "write")).conversations.create({
|
|
623
|
+
name: input.name,
|
|
624
|
+
team_id: input.teamId
|
|
625
|
+
});
|
|
626
|
+
const channelId = result.channel?.id?.trim();
|
|
627
|
+
if (!channelId || !/^C[A-Z0-9]+$/i.test(channelId)) throw new Error("Slack conversations.create did not return a valid public channel ID.");
|
|
628
|
+
let inviteWarning;
|
|
629
|
+
if (input.inviteUserId) try {
|
|
630
|
+
await (await getClient({
|
|
631
|
+
...opts,
|
|
632
|
+
omitTeamId: true
|
|
633
|
+
}, "write")).conversations.invite({
|
|
634
|
+
channel: channelId,
|
|
635
|
+
users: input.inviteUserId
|
|
636
|
+
});
|
|
637
|
+
} catch (error) {
|
|
638
|
+
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.`;
|
|
639
|
+
}
|
|
640
|
+
return {
|
|
641
|
+
channelId,
|
|
642
|
+
name: result.channel?.name?.trim() || input.name,
|
|
643
|
+
target: formatSlackTarget({
|
|
644
|
+
teamId: input.teamId,
|
|
645
|
+
kind: "channel",
|
|
646
|
+
id: channelId,
|
|
647
|
+
explicitKind: true
|
|
648
|
+
}),
|
|
649
|
+
...input.inviteUserId && !inviteWarning ? { invitedUserId: input.inviteUserId } : {},
|
|
650
|
+
...inviteWarning ? { inviteWarning } : {}
|
|
651
|
+
};
|
|
652
|
+
}
|
|
623
653
|
function createSlackReactionUpdater(method, unchangedError) {
|
|
624
654
|
return async (channelId, messageId, emoji, opts = {}) => {
|
|
625
655
|
const client = await getClient(opts, "write");
|
|
@@ -646,7 +676,6 @@ async function removeOwnSlackReactions(channelId, messageId, opts = {}) {
|
|
|
646
676
|
if (!name) continue;
|
|
647
677
|
if ((reaction?.users ?? []).includes(userId)) toRemove.add(name);
|
|
648
678
|
}
|
|
649
|
-
if (toRemove.size === 0) return [];
|
|
650
679
|
await Promise.all(Array.from(toRemove, (name) => removeSlackReaction(channelId, messageId, name, { client })));
|
|
651
680
|
return Array.from(toRemove);
|
|
652
681
|
}
|
|
@@ -660,26 +689,10 @@ async function listSlackReactions(channelId, messageId, opts = {}) {
|
|
|
660
689
|
async function sendSlackMessage(to, content, opts) {
|
|
661
690
|
const onDeliveryResult = Object.getOwnPropertyDescriptor(opts, SLACK_PRIVATE_ACTION_DELIVERY_RESULT)?.value;
|
|
662
691
|
return await sendMessageSlack(to, content, {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
...opts.forceDocument ? { forceDocument: true } : {},
|
|
668
|
-
mediaAccess: opts.mediaAccess,
|
|
669
|
-
mediaLocalRoots: opts.mediaLocalRoots,
|
|
670
|
-
mediaReadFile: opts.mediaReadFile,
|
|
671
|
-
client: opts.client,
|
|
672
|
-
assertDirectAdapterHandoff: opts.assertDirectAdapterHandoff,
|
|
673
|
-
threadTs: opts.threadTs,
|
|
674
|
-
replyBroadcast: opts.replyBroadcast,
|
|
675
|
-
...opts.textIsSlackMrkdwn ? { textIsSlackMrkdwn: true } : {},
|
|
676
|
-
...opts.textIsSlackPlainText ? { textIsSlackPlainText: true } : {},
|
|
677
|
-
...opts.authoredTextPlacement ? { authoredTextPlacement: opts.authoredTextPlacement } : {},
|
|
678
|
-
...Object.hasOwn(opts, "nativeDataFallbackBaseText") ? { nativeDataFallbackBaseText: opts.nativeDataFallbackBaseText } : {},
|
|
679
|
-
...opts.uploadFileName ? { uploadFileName: opts.uploadFileName } : {},
|
|
680
|
-
...opts.uploadTitle ? { uploadTitle: opts.uploadTitle } : {},
|
|
681
|
-
...typeof onDeliveryResult === "function" ? { onDeliveryResult } : {},
|
|
682
|
-
blocks: opts.blocks
|
|
692
|
+
...opts,
|
|
693
|
+
uploadFileName: opts.uploadFileName || void 0,
|
|
694
|
+
uploadTitle: opts.uploadTitle || void 0,
|
|
695
|
+
onDeliveryResult: typeof onDeliveryResult === "function" ? onDeliveryResult : void 0
|
|
683
696
|
});
|
|
684
697
|
}
|
|
685
698
|
async function editSlackMessage(channelId, messageId, content, opts = {}) {
|
|
@@ -713,7 +726,7 @@ async function editSlackRenderedMessage(channelId, messageId, content, opts = {}
|
|
|
713
726
|
if (!hasNativeData || !isSlackInvalidBlocksError(error)) throw error;
|
|
714
727
|
logVerbose("slack edit: native data block rejected, retrying with text fallback");
|
|
715
728
|
const survivorBlocks = stripSlackNativeDataBlocks(blocks);
|
|
716
|
-
const survivorText = buildSlackBlocksFallbackText(survivorBlocks)
|
|
729
|
+
const survivorText = buildSlackBlocksFallbackText(survivorBlocks);
|
|
717
730
|
const authoredEditText = content.trim();
|
|
718
731
|
const baseText = authoredEditText && !survivorText.includes(authoredEditText) ? authoredEditText : "";
|
|
719
732
|
const fallbackPlan = buildSlackNativeDataDeliveryPlan({
|
package/dist/.setup/{approval-handler.runtime-BtRklemy.mjs → approval-handler.runtime-Ch7BecYK.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-DwYAP3ts.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-B_Ax1vS1.mjs";
|
|
3
|
+
import { o as resolveSlackReplyBlocks } from "./reply-blocks-DyYYRrP_.mjs";
|
|
4
|
+
import { l as getSlackListenerWriteClient } from "./cursor-pages-jVn3Vkfi.mjs";
|
|
5
|
+
import { t as sendMessageSlack } from "./send-WJZ73VSf.mjs";
|
|
6
|
+
import { n as runSlackApprovalMessageUpdate } from "./approval-message-updates-CqcRoa28.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
|
// 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-CpwbsEj6.mjs → approval-message-updates-CqcRoa28.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as decodeSlackApprovalAction, W as isSlackApprovalActionId } from "./probe-B_Ax1vS1.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
|
// extensions/slack/src/approval-message-updates.ts
|