@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,11 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { f as resolveSlackOperationToken, s as resolveSlackAccount } from "./accounts-EaPP0fFY.mjs";
|
|
3
|
+
import { S as assertSlackDetachedTargetAllowed } from "./probe-B_Ax1vS1.mjs";
|
|
4
|
+
import { i as createSlackReadClient, o as createSlackTokenCacheKey, p as readLruMapEntry, s as createSlackWebClient } from "./cursor-pages-jVn3Vkfi.mjs";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { normalizeStringEntriesLower } from "openclaw/plugin-sdk/string-normalization-runtime";
|
|
7
7
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
8
|
-
import { createHash } from "node:crypto";
|
|
9
8
|
// extensions/slack/src/channel-type.ts
|
|
10
9
|
var channel_type_exports = /* @__PURE__ */ __exportAll({
|
|
11
10
|
resolveSlackChannelType: () => resolveSlackChannelType,
|
|
@@ -18,9 +17,6 @@ function setCachedSlackConversationInfo(cacheKey, conversationInfo) {
|
|
|
18
17
|
SLACK_CONVERSATION_INFO_CACHE.set(cacheKey, conversationInfo);
|
|
19
18
|
pruneMapToMaxSize(SLACK_CONVERSATION_INFO_CACHE, SLACK_CONVERSATION_INFO_CACHE_MAX_ENTRIES);
|
|
20
19
|
}
|
|
21
|
-
function fingerprintSlackCredential(token) {
|
|
22
|
-
return createHash("sha256").update(token).digest("hex");
|
|
23
|
-
}
|
|
24
20
|
function resolveConfiguredSlackConversationInfo(params) {
|
|
25
21
|
if (/^D/i.test(params.channelId)) return { type: "dm" };
|
|
26
22
|
const channelIdLower = normalizeLowercaseStringOrEmpty(params.channelId);
|
|
@@ -43,7 +39,7 @@ async function resolveSlackConversationInfo(params) {
|
|
|
43
39
|
const token = resolveSlackOperationToken(account, operation);
|
|
44
40
|
const userToken = normalizeOptionalString(account.userToken);
|
|
45
41
|
const credentialRole = token ? token === userToken ? "user" : "bot" : "none";
|
|
46
|
-
const credentialFingerprint = token ?
|
|
42
|
+
const credentialFingerprint = token ? createSlackTokenCacheKey(token) : "none";
|
|
47
43
|
const teamId = normalizeLowercaseStringOrEmpty(params.teamId) || "no-team-id";
|
|
48
44
|
const cacheKey = `${account.accountId}:${teamId}:${operation}:${credentialRole}:${credentialFingerprint}:${channelId}`;
|
|
49
45
|
if (!params.requireFreshName) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as isSlackSetupAccountConfigured } from "./account-configured-35y0-Hso.mjs";
|
|
2
|
-
import { i as listSlackAccountIds, o as resolveDefaultSlackAccountId, s as resolveSlackAccount, u as resolveSlackConfigAccessorAccount } from "./accounts-
|
|
3
|
-
import { t as inspectSlackAccount } from "./account-inspect-
|
|
2
|
+
import { i as listSlackAccountIds, o as resolveDefaultSlackAccountId, s as resolveSlackAccount, u as resolveSlackConfigAccessorAccount } from "./accounts-EaPP0fFY.mjs";
|
|
3
|
+
import { t as inspectSlackAccount } from "./account-inspect-DgQgj0wk.mjs";
|
|
4
4
|
import { t as DEFAULT_SLACK_SUGGESTED_PROMPTS } from "./channel-meta-C5vsCo3a.mjs";
|
|
5
|
-
import { t as SlackChannelConfigSchema } from "./config-schema-
|
|
5
|
+
import { t as SlackChannelConfigSchema } from "./config-schema-Bx1tCZB0.mjs";
|
|
6
6
|
import { normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
7
7
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
@@ -39,16 +39,15 @@ function buildSlackAllowFromPrompt() {
|
|
|
39
39
|
})
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function buildSlackManifest(
|
|
43
|
-
|
|
44
|
-
const manifest = {
|
|
42
|
+
function buildSlackManifest() {
|
|
43
|
+
return JSON.stringify({
|
|
45
44
|
display_information: {
|
|
46
|
-
name:
|
|
47
|
-
description:
|
|
45
|
+
name: "OpenClaw",
|
|
46
|
+
description: "OpenClaw app for OpenClaw"
|
|
48
47
|
},
|
|
49
48
|
features: {
|
|
50
49
|
bot_user: {
|
|
51
|
-
display_name:
|
|
50
|
+
display_name: "OpenClaw",
|
|
52
51
|
always_online: true
|
|
53
52
|
},
|
|
54
53
|
app_home: {
|
|
@@ -57,7 +56,7 @@ function buildSlackManifest(botName = "OpenClaw") {
|
|
|
57
56
|
messages_tab_read_only_enabled: false
|
|
58
57
|
},
|
|
59
58
|
agent_view: {
|
|
60
|
-
agent_description:
|
|
59
|
+
agent_description: "OpenClaw connects Slack Agent View conversations to OpenClaw agents.",
|
|
61
60
|
suggested_prompts: DEFAULT_SLACK_SUGGESTED_PROMPTS
|
|
62
61
|
},
|
|
63
62
|
slash_commands: [{
|
|
@@ -70,7 +69,9 @@ function buildSlackManifest(botName = "OpenClaw") {
|
|
|
70
69
|
"app_mentions:read",
|
|
71
70
|
"assistant:write",
|
|
72
71
|
"channels:history",
|
|
72
|
+
"channels:manage",
|
|
73
73
|
"channels:read",
|
|
74
|
+
"channels:write.invites",
|
|
74
75
|
"chat:write",
|
|
75
76
|
"commands",
|
|
76
77
|
"emoji:read",
|
|
@@ -112,8 +113,7 @@ function buildSlackManifest(botName = "OpenClaw") {
|
|
|
112
113
|
"reaction_removed"
|
|
113
114
|
] }
|
|
114
115
|
}
|
|
115
|
-
};
|
|
116
|
-
return JSON.stringify(manifest, null, 2);
|
|
116
|
+
}, null, 2);
|
|
117
117
|
}
|
|
118
118
|
function buildSlackSetupLines() {
|
|
119
119
|
return [
|
|
@@ -547,7 +547,7 @@ const slackSetupPlugin = {
|
|
|
547
547
|
markdownCapable: true,
|
|
548
548
|
preferSessionLookupForAnnounceTarget: true
|
|
549
549
|
},
|
|
550
|
-
setupWizard: createSlackSetupWizardProxy(() => import("./setup-surface-
|
|
550
|
+
setupWizard: createSlackSetupWizardProxy(() => import("./setup-surface-uIqP2B0Y.mjs")),
|
|
551
551
|
capabilities: {
|
|
552
552
|
chatTypes: [
|
|
553
553
|
"direct",
|
|
@@ -185,11 +185,6 @@ const SlackStreamingConfigSchema = ChannelPreviewStreamingConfigSchema.extend({
|
|
|
185
185
|
nativeTransport: z.boolean().optional(),
|
|
186
186
|
progress: SlackStreamingProgressSchema.optional()
|
|
187
187
|
}).strict();
|
|
188
|
-
const SlackDmSchema = z.object({
|
|
189
|
-
enabled: z.boolean().optional(),
|
|
190
|
-
groupEnabled: z.boolean().optional(),
|
|
191
|
-
groupChannels: z.array(z.union([z.string(), z.number()])).optional()
|
|
192
|
-
}).strict();
|
|
193
188
|
const SlackPresenceEventsSchema = z.object({
|
|
194
189
|
mode: z.enum([
|
|
195
190
|
"off",
|
|
@@ -223,7 +218,7 @@ const SlackRelaySchema = z.object({
|
|
|
223
218
|
gatewayId: z.string().optional()
|
|
224
219
|
}).strict();
|
|
225
220
|
const SlackIdentitySchema = z.enum(["bot", "user"]);
|
|
226
|
-
const { accountShape, rootPolicyShape } = buildChannelAccountSchemaParts({
|
|
221
|
+
const { accountShape, rootPolicyShape, groupDmShape } = buildChannelAccountSchemaParts({
|
|
227
222
|
omit: ["groupAllowFrom"],
|
|
228
223
|
streaming: SlackStreamingConfigSchema.optional()
|
|
229
224
|
});
|
|
@@ -269,6 +264,7 @@ const SlackAccountSchema = z.object({
|
|
|
269
264
|
actions: z.object({
|
|
270
265
|
reactions: z.boolean().optional(),
|
|
271
266
|
messages: z.boolean().optional(),
|
|
267
|
+
channels: z.boolean().optional(),
|
|
272
268
|
pins: z.boolean().optional(),
|
|
273
269
|
search: z.boolean().optional(),
|
|
274
270
|
permissions: z.boolean().optional(),
|
|
@@ -282,7 +278,7 @@ const SlackAccountSchema = z.object({
|
|
|
282
278
|
sessionPrefix: z.string().optional(),
|
|
283
279
|
ephemeral: z.boolean().optional()
|
|
284
280
|
}).strict().optional(),
|
|
285
|
-
dm:
|
|
281
|
+
dm: z.strictObject(groupDmShape).optional(),
|
|
286
282
|
channels: z.record(z.string(), SlackChannelSchema.optional()).optional(),
|
|
287
283
|
typingReaction: z.string().optional()
|
|
288
284
|
}).strict();
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
3
|
+
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
4
|
+
import { hash } from "node:crypto";
|
|
5
|
+
import { WebAPIRateLimitedError, WebClient } from "@slack/web-api";
|
|
6
|
+
import { addActiveManagedProxyTlsOptions, captureChannelReadAuthority, createHttp1EnvHttpProxyAgent, resolveEnvHttpProxyAgentOptions, resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
7
|
+
import { isDebugProxyGlobalFetchPatchInstalled } from "openclaw/plugin-sdk/proxy-capture";
|
|
8
|
+
import { parseRetryAfterHeaderSeconds, retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
9
|
+
import { fetchWithRuntimeDispatcher } from "openclaw/plugin-sdk/runtime-fetch";
|
|
10
|
+
// extensions/slack/src/client-options.ts
|
|
11
|
+
const SLACK_DEFAULT_RETRY_OPTIONS = {
|
|
12
|
+
retries: 2,
|
|
13
|
+
factor: 2,
|
|
14
|
+
minTimeout: 500,
|
|
15
|
+
maxTimeout: 3e3,
|
|
16
|
+
randomize: true
|
|
17
|
+
};
|
|
18
|
+
const SLACK_WRITE_RETRY_OPTIONS = { retries: 0 };
|
|
19
|
+
const SLACK_READ_TIMEOUT_MS = 3e4;
|
|
20
|
+
const SLACK_LOOKUP_RETRY_OPTIONS = { retries: 0 };
|
|
21
|
+
function normalizeSlackFetchInit(init) {
|
|
22
|
+
if (init?.body !== "") return init;
|
|
23
|
+
const { body: _body, ...rest } = init;
|
|
24
|
+
return rest;
|
|
25
|
+
}
|
|
26
|
+
function resolveSlackProxyDispatcher() {
|
|
27
|
+
const options = resolveEnvHttpProxyAgentOptions();
|
|
28
|
+
if (!options) return;
|
|
29
|
+
try {
|
|
30
|
+
return createHttp1EnvHttpProxyAgent(options, void 0, process.env);
|
|
31
|
+
} catch {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
let slackSocketModeUndici;
|
|
36
|
+
/**
|
|
37
|
+
* Load the undici copy that @slack/socket-mode opens its WebSocket with.
|
|
38
|
+
*
|
|
39
|
+
* Socket Mode 3 calls `new undici.WebSocket(url, { dispatcher })` with its own
|
|
40
|
+
* undici. A dispatcher from another undici copy fails the handshake, so we must
|
|
41
|
+
* identify whether Socket Mode can share the runtime dispatcher. The explicit
|
|
42
|
+
* `undici/index.js` subpath keeps Bun's bare-`undici` placeholder out of the
|
|
43
|
+
* dispatcher (the same reason the runtime loads undici this way); under Bun,
|
|
44
|
+
* Socket Mode's bare import gets Bun's WebSocket, which does not consult a
|
|
45
|
+
* dispatcher at all.
|
|
46
|
+
*/
|
|
47
|
+
function loadSlackSocketModeUndici() {
|
|
48
|
+
if (slackSocketModeUndici) return slackSocketModeUndici;
|
|
49
|
+
const requireFromPlugin = createRequire(import.meta.url);
|
|
50
|
+
const requireFromBolt = createRequire(requireFromPlugin.resolve("@slack/bolt/package.json"));
|
|
51
|
+
slackSocketModeUndici = createRequire(requireFromBolt.resolve("@slack/socket-mode/package.json"))("undici/index.js");
|
|
52
|
+
return slackSocketModeUndici;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Build the env-proxy dispatcher for Socket Mode's WebSocket.
|
|
56
|
+
*
|
|
57
|
+
* Reuse the Web API dispatcher when both transports load the same undici copy;
|
|
58
|
+
* its custom proxy routing supports Socket Mode's CONNECT handshake. Otherwise
|
|
59
|
+
* build one from Socket Mode's copy. Without a proxy env, preserve the default
|
|
60
|
+
* direct connection.
|
|
61
|
+
*/
|
|
62
|
+
function resolveSlackSocketModeDispatcher(webApi) {
|
|
63
|
+
const options = resolveEnvHttpProxyAgentOptions();
|
|
64
|
+
if (!options) return;
|
|
65
|
+
const { EnvHttpProxyAgent } = loadSlackSocketModeUndici();
|
|
66
|
+
if (webApi instanceof EnvHttpProxyAgent) return webApi;
|
|
67
|
+
const agentOptions = addActiveManagedProxyTlsOptions(options);
|
|
68
|
+
try {
|
|
69
|
+
return new EnvHttpProxyAgent(agentOptions);
|
|
70
|
+
} catch {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** Pair each Slack monitor transport with the dispatcher from the undici copy it uses. */
|
|
75
|
+
function resolveSlackMonitorDispatchers(mode) {
|
|
76
|
+
const webApi = resolveSlackProxyDispatcher();
|
|
77
|
+
const socketMode = mode === "socket" ? resolveSlackSocketModeDispatcher(webApi) : void 0;
|
|
78
|
+
return {
|
|
79
|
+
webApi,
|
|
80
|
+
socketMode,
|
|
81
|
+
close: async () => {
|
|
82
|
+
await webApi?.close();
|
|
83
|
+
if (socketMode !== webApi) await socketMode?.close();
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const DIRECT_SLACK_DISPATCHER_OPTIONS = {
|
|
88
|
+
httpProxy: "",
|
|
89
|
+
httpsProxy: "",
|
|
90
|
+
noProxy: "*"
|
|
91
|
+
};
|
|
92
|
+
/** Create a probe-owned dispatcher so timeout cleanup can retire every socket. */
|
|
93
|
+
function createSlackProbeDispatcher(timeoutMs) {
|
|
94
|
+
const options = resolveEnvHttpProxyAgentOptions() ?? DIRECT_SLACK_DISPATCHER_OPTIONS;
|
|
95
|
+
try {
|
|
96
|
+
return createHttp1EnvHttpProxyAgent(options, timeoutMs, process.env);
|
|
97
|
+
} catch {
|
|
98
|
+
return createHttp1EnvHttpProxyAgent(DIRECT_SLACK_DISPATCHER_OPTIONS, timeoutMs, {});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function buildSlackFetch(dispatcher) {
|
|
102
|
+
if (!dispatcher || isDebugProxyGlobalFetchPatchInstalled()) {
|
|
103
|
+
const slackFetch = resolveFetch();
|
|
104
|
+
if (!slackFetch) return;
|
|
105
|
+
return ((input, init) => slackFetch(input, normalizeSlackFetchInit(init)));
|
|
106
|
+
}
|
|
107
|
+
return ((input, init) => {
|
|
108
|
+
return fetchWithRuntimeDispatcher(input, {
|
|
109
|
+
...normalizeSlackFetchInit(init),
|
|
110
|
+
dispatcher
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function fenceSlackReadFetch(slackFetch, assertDirectAdapterHandoff) {
|
|
115
|
+
const assertReadAuthority = captureChannelReadAuthority();
|
|
116
|
+
return async (input, init) => {
|
|
117
|
+
assertReadAuthority?.();
|
|
118
|
+
captureChannelReadAuthority()?.();
|
|
119
|
+
assertDirectAdapterHandoff?.();
|
|
120
|
+
return slackFetch(input, init);
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function resolveSlackClientOptions(input, dispatcher, assertDirectAdapterHandoff) {
|
|
124
|
+
const options = Object.assign({}, input);
|
|
125
|
+
const slackApiUrl = options.slackApiUrl ?? (process.env.SLACK_API_URL?.trim() || void 0);
|
|
126
|
+
const fetch = options.fetch ?? buildSlackFetch(dispatcher);
|
|
127
|
+
if (slackApiUrl !== void 0) options.slackApiUrl = slackApiUrl;
|
|
128
|
+
else delete options.slackApiUrl;
|
|
129
|
+
if (!fetch) {
|
|
130
|
+
if (assertDirectAdapterHandoff) throw new Error("Slack request fetch is unavailable for live authority.");
|
|
131
|
+
} else options.fetch = fenceSlackReadFetch(fetch, assertDirectAdapterHandoff);
|
|
132
|
+
return options;
|
|
133
|
+
}
|
|
134
|
+
function resolveSlackWebClientOptions(options = {}, dispatcher = resolveSlackProxyDispatcher(), assertDirectAdapterHandoff) {
|
|
135
|
+
const resolved = resolveSlackClientOptions(options, dispatcher, assertDirectAdapterHandoff);
|
|
136
|
+
resolved.retryConfig ??= SLACK_DEFAULT_RETRY_OPTIONS;
|
|
137
|
+
return resolved;
|
|
138
|
+
}
|
|
139
|
+
function resolveSlackReadClientOptions(options = {}, dispatcher = resolveSlackProxyDispatcher(), assertDirectAdapterHandoff) {
|
|
140
|
+
const resolved = resolveSlackWebClientOptions(options, dispatcher, assertDirectAdapterHandoff);
|
|
141
|
+
resolved.timeout ??= SLACK_READ_TIMEOUT_MS;
|
|
142
|
+
return resolved;
|
|
143
|
+
}
|
|
144
|
+
function resolveSlackWriteClientOptions(options = {}, dispatcher = resolveSlackProxyDispatcher(), assertDirectAdapterHandoff) {
|
|
145
|
+
const resolved = resolveSlackClientOptions(options, dispatcher, assertDirectAdapterHandoff);
|
|
146
|
+
resolved.retryConfig ??= SLACK_WRITE_RETRY_OPTIONS;
|
|
147
|
+
if (resolved.rejectRateLimitedCalls !== true && resolved.retryConfig.retries === 0) {
|
|
148
|
+
const slackFetch = resolved.fetch ?? buildSlackFetch(dispatcher);
|
|
149
|
+
if (slackFetch) resolved.fetch = (input, init) => retryAsync(async () => {
|
|
150
|
+
init?.signal?.throwIfAborted();
|
|
151
|
+
const response = await slackFetch(input, init);
|
|
152
|
+
if (response.status !== 429) return response;
|
|
153
|
+
const retryAfter = parseRetryAfterHeaderSeconds(response.headers.get("retry-after"));
|
|
154
|
+
response.body?.cancel().catch(() => void 0);
|
|
155
|
+
init?.signal?.throwIfAborted();
|
|
156
|
+
if (retryAfter === void 0 || retryAfter * 1e3 > 2147e6) return response;
|
|
157
|
+
throw new WebAPIRateLimitedError(retryAfter);
|
|
158
|
+
}, {
|
|
159
|
+
attempts: 3,
|
|
160
|
+
minDelayMs: 0,
|
|
161
|
+
maxDelayMs: 0,
|
|
162
|
+
shouldRetry: (error) => error instanceof WebAPIRateLimitedError,
|
|
163
|
+
retryAfterMs: (error) => error instanceof WebAPIRateLimitedError ? error.retryAfter * 1e3 : void 0,
|
|
164
|
+
sleep: (delayMs) => sleepWithAbort(delayMs, init?.signal)
|
|
165
|
+
});
|
|
166
|
+
resolved.rejectRateLimitedCalls = true;
|
|
167
|
+
}
|
|
168
|
+
return resolved;
|
|
169
|
+
}
|
|
170
|
+
function resolveSlackLookupClientOptions(options = {}, dispatcher = resolveSlackProxyDispatcher(), assertDirectAdapterHandoff) {
|
|
171
|
+
const resolved = resolveSlackClientOptions(options, dispatcher, assertDirectAdapterHandoff);
|
|
172
|
+
resolved.rejectRateLimitedCalls = true;
|
|
173
|
+
resolved.retryConfig = SLACK_LOOKUP_RETRY_OPTIONS;
|
|
174
|
+
resolved.timeout ??= SLACK_READ_TIMEOUT_MS;
|
|
175
|
+
return resolved;
|
|
176
|
+
}
|
|
177
|
+
// extensions/slack/src/monitor/lru-map-cache.ts
|
|
178
|
+
function getOrCreateWeakOwnerMap(owners, owner) {
|
|
179
|
+
let values = owners.get(owner);
|
|
180
|
+
if (!values) {
|
|
181
|
+
values = /* @__PURE__ */ new Map();
|
|
182
|
+
owners.set(owner, values);
|
|
183
|
+
}
|
|
184
|
+
return values;
|
|
185
|
+
}
|
|
186
|
+
/** LRU-touch read: move hit to newest so pruneMapToMaxSize keeps active keys. */
|
|
187
|
+
function readLruMapEntry(cache, cacheKey) {
|
|
188
|
+
const cached = cache.get(cacheKey);
|
|
189
|
+
if (cached) {
|
|
190
|
+
cache.delete(cacheKey);
|
|
191
|
+
cache.set(cacheKey, cached);
|
|
192
|
+
}
|
|
193
|
+
return cached;
|
|
194
|
+
}
|
|
195
|
+
function writeLruMapEntry(cache, cacheKey, entry, maxEntries) {
|
|
196
|
+
cache.delete(cacheKey);
|
|
197
|
+
cache.set(cacheKey, entry);
|
|
198
|
+
pruneMapToMaxSize(cache, maxEntries);
|
|
199
|
+
}
|
|
200
|
+
function pruneExpiredMapEntries(cache, now) {
|
|
201
|
+
for (const [key, entry] of cache) if (entry.expiresAt <= now) cache.delete(key);
|
|
202
|
+
}
|
|
203
|
+
// extensions/slack/src/client.ts
|
|
204
|
+
const SLACK_WRITE_CLIENT_CACHE_MAX = 32;
|
|
205
|
+
const SLACK_STARTUP_AUTH_TIMEOUT_MS = 1e4;
|
|
206
|
+
const SLACK_STARTUP_AUTH_RETRY_BUDGET_MS = 35e3;
|
|
207
|
+
const slackWriteClientCache = /* @__PURE__ */ new Map();
|
|
208
|
+
const slackListenerWriteClientCache = /* @__PURE__ */ new WeakMap();
|
|
209
|
+
function createSlackClientFactory(resolveOptions) {
|
|
210
|
+
return (token, options, assertDirectAdapterHandoff) => new WebClient(token, resolveOptions(options, void 0, assertDirectAdapterHandoff));
|
|
211
|
+
}
|
|
212
|
+
const createSlackWebClient = createSlackClientFactory(resolveSlackWebClientOptions);
|
|
213
|
+
const createSlackLookupClient = createSlackClientFactory(resolveSlackLookupClientOptions);
|
|
214
|
+
const createSlackWriteClient = createSlackClientFactory(resolveSlackWriteClientOptions);
|
|
215
|
+
function createSlackReadClient(token, options = {}, dispatcher, assertDirectAdapterHandoff) {
|
|
216
|
+
return new WebClient(token, resolveSlackReadClientOptions(options, dispatcher, assertDirectAdapterHandoff));
|
|
217
|
+
}
|
|
218
|
+
function createSlackStartupAuthFetch(baseFetch) {
|
|
219
|
+
const deadline = performance.now() + SLACK_STARTUP_AUTH_RETRY_BUDGET_MS;
|
|
220
|
+
return async (input, init) => {
|
|
221
|
+
const response = await baseFetch(input, init);
|
|
222
|
+
if (response.status !== 429) return response;
|
|
223
|
+
const retryAfter = Number.parseInt(response.headers.get("retry-after") ?? "", 10);
|
|
224
|
+
const remainingMs = Math.max(0, deadline - performance.now());
|
|
225
|
+
if (!Number.isFinite(retryAfter) || retryAfter * 1e3 <= remainingMs) return response;
|
|
226
|
+
await new Promise((resolve) => {
|
|
227
|
+
setTimeout(resolve, remainingMs);
|
|
228
|
+
});
|
|
229
|
+
throw new Error("Slack startup auth retry budget exhausted after rate limit");
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
function createSlackStartupAuthClient(token, options = {}) {
|
|
233
|
+
const resolvedOptions = resolveSlackWebClientOptions(options);
|
|
234
|
+
const baseFetch = resolvedOptions.fetch;
|
|
235
|
+
if (!baseFetch) throw new Error("Slack startup auth fetch is unavailable");
|
|
236
|
+
return new WebClient(token, {
|
|
237
|
+
...resolvedOptions,
|
|
238
|
+
fetch: createSlackStartupAuthFetch(baseFetch),
|
|
239
|
+
retryConfig: {
|
|
240
|
+
...SLACK_DEFAULT_RETRY_OPTIONS,
|
|
241
|
+
maxRetryTime: SLACK_STARTUP_AUTH_RETRY_BUDGET_MS
|
|
242
|
+
},
|
|
243
|
+
timeout: SLACK_STARTUP_AUTH_TIMEOUT_MS
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function createSlackTokenCacheKey(token) {
|
|
247
|
+
return `sha256:${hash("sha256", token, "base64url")}`;
|
|
248
|
+
}
|
|
249
|
+
function slackWriteClientCacheKey(token, options) {
|
|
250
|
+
return `${createSlackTokenCacheKey(token)}${options.slackApiUrl ? `:api:${options.slackApiUrl}` : ""}${options.teamId ? `:team:${options.teamId.trim().toLowerCase()}` : ""}`;
|
|
251
|
+
}
|
|
252
|
+
function getSlackWriteClient(token, options = {}) {
|
|
253
|
+
const resolvedOptions = resolveSlackWriteClientOptions(options);
|
|
254
|
+
const tokenKey = slackWriteClientCacheKey(token, resolvedOptions);
|
|
255
|
+
const cached = readLruMapEntry(slackWriteClientCache, tokenKey);
|
|
256
|
+
if (cached) return cached;
|
|
257
|
+
const client = new WebClient(token, resolvedOptions);
|
|
258
|
+
slackWriteClientCache.set(tokenKey, client);
|
|
259
|
+
pruneMapToMaxSize(slackWriteClientCache, SLACK_WRITE_CLIENT_CACHE_MAX);
|
|
260
|
+
return client;
|
|
261
|
+
}
|
|
262
|
+
function getSlackListenerWriteClient(params) {
|
|
263
|
+
const token = params.listenerClient.token?.trim();
|
|
264
|
+
const teamId = params.teamId?.trim().toUpperCase();
|
|
265
|
+
if (!token) return;
|
|
266
|
+
const cached = slackListenerWriteClientCache.get(params.listenerClient);
|
|
267
|
+
if (cached) {
|
|
268
|
+
if (cached.teamId !== teamId) return;
|
|
269
|
+
return cached.client;
|
|
270
|
+
}
|
|
271
|
+
const headers = Object.fromEntries(Object.entries(params.clientOptions?.headers ?? {}).filter(([name]) => name.toLowerCase() !== "authorization"));
|
|
272
|
+
const client = new WebClient(token, resolveSlackWriteClientOptions({
|
|
273
|
+
...params.clientOptions,
|
|
274
|
+
headers,
|
|
275
|
+
slackApiUrl: params.listenerClient.slackApiUrl,
|
|
276
|
+
teamId,
|
|
277
|
+
retryConfig: SLACK_WRITE_RETRY_OPTIONS,
|
|
278
|
+
timeout: 0
|
|
279
|
+
}));
|
|
280
|
+
slackListenerWriteClientCache.set(params.listenerClient, {
|
|
281
|
+
teamId,
|
|
282
|
+
client
|
|
283
|
+
});
|
|
284
|
+
return client;
|
|
285
|
+
}
|
|
286
|
+
// extensions/slack/src/cursor-pages.ts
|
|
287
|
+
const SLACK_CURSOR_PAGE_LIMIT = 1e4;
|
|
288
|
+
const fetchSlackChannelListPage = (client, cursor) => client.conversations.list({
|
|
289
|
+
types: "public_channel,private_channel",
|
|
290
|
+
exclude_archived: false,
|
|
291
|
+
limit: 1e3,
|
|
292
|
+
cursor
|
|
293
|
+
});
|
|
294
|
+
async function collectSlackCursorPages(params) {
|
|
295
|
+
const items = [];
|
|
296
|
+
let cursor;
|
|
297
|
+
const seenCursors = /* @__PURE__ */ new Set();
|
|
298
|
+
for (let pageCount = 1; pageCount <= SLACK_CURSOR_PAGE_LIMIT; pageCount += 1) {
|
|
299
|
+
const response = await params.fetchPage(cursor);
|
|
300
|
+
items.push(...params.collectPageItems(response));
|
|
301
|
+
const nextCursor = response.response_metadata?.next_cursor?.trim() || void 0;
|
|
302
|
+
if (!nextCursor) return items;
|
|
303
|
+
if (seenCursors.has(nextCursor)) throw new Error(`Slack cursor pagination repeated a cursor after ${pageCount} pages`);
|
|
304
|
+
seenCursors.add(nextCursor);
|
|
305
|
+
cursor = nextCursor;
|
|
306
|
+
}
|
|
307
|
+
throw new Error(`Slack cursor pagination exceeded ${SLACK_CURSOR_PAGE_LIMIT} pages`);
|
|
308
|
+
}
|
|
309
|
+
export { createSlackProbeDispatcher as _, createSlackStartupAuthClient as a, resolveSlackWebClientOptions as b, createSlackWriteClient as c, getOrCreateWeakOwnerMap as d, pruneExpiredMapEntries as f, SLACK_WRITE_RETRY_OPTIONS as g, SLACK_DEFAULT_RETRY_OPTIONS as h, createSlackReadClient as i, getSlackListenerWriteClient as l, writeLruMapEntry as m, fetchSlackChannelListPage as n, createSlackTokenCacheKey as o, readLruMapEntry as p, createSlackLookupClient as r, createSlackWebClient as s, collectSlackCursorPages as t, getSlackWriteClient as u, resolveSlackLookupClientOptions as v, resolveSlackWriteClientOptions as x, resolveSlackMonitorDispatchers as y };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
|
|
2
|
-
import { a as mergeSlackAccountConfig, c as resolveSlackAccountAllowFrom, o as resolveDefaultSlackAccountId } from "./accounts-
|
|
3
|
-
import { a as parseSlackTarget } from "./target-parsing-
|
|
4
|
-
import "./targets-
|
|
2
|
+
import { a as mergeSlackAccountConfig, c as resolveSlackAccountAllowFrom, o as resolveDefaultSlackAccountId } from "./accounts-EaPP0fFY.mjs";
|
|
3
|
+
import { a as parseSlackTarget } from "./target-parsing-DwYAP3ts.mjs";
|
|
4
|
+
import "./targets-eeOxA_b_.mjs";
|
|
5
5
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
6
6
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { createResolvedDirectoryEntriesLister } from "openclaw/plugin-sdk/directory-config-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
|
|
2
|
-
import { s as resolveSlackAccount } from "./accounts-
|
|
3
|
-
import {
|
|
2
|
+
import { s as resolveSlackAccount } from "./accounts-EaPP0fFY.mjs";
|
|
3
|
+
import { n as fetchSlackChannelListPage, r as createSlackLookupClient, t as collectSlackCursorPages } from "./cursor-pages-jVn3Vkfi.mjs";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
// extensions/slack/src/directory-live.ts
|
|
6
6
|
var directory_live_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -55,9 +55,9 @@ function createSlackDirectoryLister(options) {
|
|
|
55
55
|
return async (params) => {
|
|
56
56
|
const client = createSlackDirectoryClient(params);
|
|
57
57
|
if (!client) return [];
|
|
58
|
-
const query = normalizeLowercaseStringOrEmpty(params.query);
|
|
58
|
+
const query = normalizeLowercaseStringOrEmpty(params.query).normalize("NFC");
|
|
59
59
|
const rows = (await options.fetchRows(client)).filter((row) => {
|
|
60
|
-
const candidates = options.searchValues(row).map(normalizeOptionalLowercaseString)
|
|
60
|
+
const candidates = options.searchValues(row).map((value) => normalizeOptionalLowercaseString(value)?.normalize("NFC"));
|
|
61
61
|
return !query || candidates.some((candidate) => candidate?.includes(query));
|
|
62
62
|
}).map(options.toEntry).filter((entry) => entry !== null);
|
|
63
63
|
return typeof params.limit === "number" && params.limit > 0 ? rows.slice(0, params.limit) : rows;
|
|
@@ -207,35 +207,6 @@ function hasInteractiveRepliesCapability(value) {
|
|
|
207
207
|
function hasEnterpriseOrgInstall(value) {
|
|
208
208
|
return Object.hasOwn((0, runtime_doctor_migrations_exports.asObjectRecord)(value) ?? {}, "enterpriseOrgInstall");
|
|
209
209
|
}
|
|
210
|
-
function removeInteractiveRepliesCapability(params) {
|
|
211
|
-
const capabilities = params.entry.capabilities;
|
|
212
|
-
let nextCapabilities;
|
|
213
|
-
let removedEmptyObject = false;
|
|
214
|
-
if (Array.isArray(capabilities)) {
|
|
215
|
-
nextCapabilities = capabilities.filter((entry) => !(typeof entry === "string" && entry.trim().toLowerCase() === "interactivereplies"));
|
|
216
|
-
if (nextCapabilities.length === capabilities.length) return {
|
|
217
|
-
entry: params.entry,
|
|
218
|
-
changed: false
|
|
219
|
-
};
|
|
220
|
-
} else {
|
|
221
|
-
const capabilitiesRecord = (0, runtime_doctor_migrations_exports.asObjectRecord)(capabilities);
|
|
222
|
-
if (!capabilitiesRecord || Object.keys(capabilitiesRecord).length > 0 && !Object.hasOwn(capabilitiesRecord, "interactiveReplies")) return {
|
|
223
|
-
entry: params.entry,
|
|
224
|
-
changed: false
|
|
225
|
-
};
|
|
226
|
-
removedEmptyObject = Object.keys(capabilitiesRecord).length === 0;
|
|
227
|
-
const { interactiveReplies: _retired, ...rest } = capabilitiesRecord;
|
|
228
|
-
nextCapabilities = rest;
|
|
229
|
-
}
|
|
230
|
-
const entry = { ...params.entry };
|
|
231
|
-
if (Array.isArray(nextCapabilities) ? nextCapabilities.length === 0 : Object.keys(nextCapabilities).length === 0) delete entry.capabilities;
|
|
232
|
-
else entry.capabilities = nextCapabilities;
|
|
233
|
-
params.changes.push(removedEmptyObject ? `Removed retired empty ${params.pathPrefix}.capabilities object; use typed presentation actions instead.` : `Removed retired ${params.pathPrefix}.capabilities.interactiveReplies; use typed presentation actions instead.`);
|
|
234
|
-
return {
|
|
235
|
-
entry,
|
|
236
|
-
changed: true
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
210
|
const legacyConfigRules = [
|
|
240
211
|
...streamingAliasMigration.legacyConfigRules,
|
|
241
212
|
{
|
|
@@ -298,21 +269,6 @@ const legacyConfigRules = [
|
|
|
298
269
|
match: (value) => (0, runtime_doctor_migrations_exports.hasLegacyAccountStreamingAliases)(value, threadMentionPolicyMigration.hasLegacy)
|
|
299
270
|
}
|
|
300
271
|
];
|
|
301
|
-
function normalizeSlackEntry(params) {
|
|
302
|
-
const retiredInteractiveReplies = removeInteractiveRepliesCapability(params);
|
|
303
|
-
const dm = dmReplyModeMigration.normalize({
|
|
304
|
-
...params,
|
|
305
|
-
entry: retiredInteractiveReplies.entry
|
|
306
|
-
});
|
|
307
|
-
const thread = threadMentionPolicyMigration.normalize({
|
|
308
|
-
...params,
|
|
309
|
-
entry: dm.entry
|
|
310
|
-
});
|
|
311
|
-
return {
|
|
312
|
-
entry: thread.entry,
|
|
313
|
-
changed: retiredInteractiveReplies.changed || dm.changed || thread.changed
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
272
|
function normalizeCompatibilityConfig({ cfg }) {
|
|
317
273
|
const changes = [];
|
|
318
274
|
const retired = (0, runtime_doctor_migrations_exports.stripRetiredChannelKeys)({
|
|
@@ -330,7 +286,43 @@ function normalizeCompatibilityConfig({ cfg }) {
|
|
|
330
286
|
cfg: aliases.config,
|
|
331
287
|
channelId: "slack",
|
|
332
288
|
changes,
|
|
333
|
-
normalizeEntry:
|
|
289
|
+
normalizeEntry: (params) => {
|
|
290
|
+
let { entry } = params;
|
|
291
|
+
let changed = false;
|
|
292
|
+
const capabilities = entry.capabilities;
|
|
293
|
+
let nextCapabilities;
|
|
294
|
+
let removedEmptyObject = false;
|
|
295
|
+
if (Array.isArray(capabilities)) {
|
|
296
|
+
const filtered = capabilities.filter((capability) => !(typeof capability === "string" && capability.trim().toLowerCase() === "interactivereplies"));
|
|
297
|
+
if (filtered.length !== capabilities.length) nextCapabilities = filtered;
|
|
298
|
+
} else {
|
|
299
|
+
const capabilitiesRecord = (0, runtime_doctor_migrations_exports.asObjectRecord)(capabilities);
|
|
300
|
+
if (capabilitiesRecord && (Object.keys(capabilitiesRecord).length === 0 || Object.hasOwn(capabilitiesRecord, "interactiveReplies"))) {
|
|
301
|
+
removedEmptyObject = Object.keys(capabilitiesRecord).length === 0;
|
|
302
|
+
const { interactiveReplies: _retired, ...rest } = capabilitiesRecord;
|
|
303
|
+
nextCapabilities = rest;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
if (nextCapabilities !== void 0) {
|
|
307
|
+
entry = { ...entry };
|
|
308
|
+
if (Array.isArray(nextCapabilities) ? nextCapabilities.length === 0 : Object.keys(nextCapabilities).length === 0) delete entry.capabilities;
|
|
309
|
+
else entry.capabilities = nextCapabilities;
|
|
310
|
+
params.changes.push(removedEmptyObject ? `Removed retired empty ${params.pathPrefix}.capabilities object; use typed presentation actions instead.` : `Removed retired ${params.pathPrefix}.capabilities.interactiveReplies; use typed presentation actions instead.`);
|
|
311
|
+
changed = true;
|
|
312
|
+
}
|
|
313
|
+
const dm = dmReplyModeMigration.normalize({
|
|
314
|
+
...params,
|
|
315
|
+
entry
|
|
316
|
+
});
|
|
317
|
+
const thread = threadMentionPolicyMigration.normalize({
|
|
318
|
+
...params,
|
|
319
|
+
entry: dm.entry
|
|
320
|
+
});
|
|
321
|
+
return {
|
|
322
|
+
entry: thread.entry,
|
|
323
|
+
changed: changed || dm.changed || thread.changed
|
|
324
|
+
};
|
|
325
|
+
}
|
|
334
326
|
});
|
|
335
327
|
}
|
|
336
328
|
export { normalizeCompatibilityConfig as n, runtime_doctor_migrations_exports as r, legacyConfigRules as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as listSlackAccountIds } from "./accounts-
|
|
2
|
-
import { t as inspectSlackAccount } from "./account-inspect-
|
|
1
|
+
import { i as listSlackAccountIds } from "./accounts-EaPP0fFY.mjs";
|
|
2
|
+
import { t as inspectSlackAccount } from "./account-inspect-DgQgj0wk.mjs";
|
|
3
3
|
import { r as resolveSlackThreadTsValue, t as normalizeSlackThreadTsCandidate } from "./thread-ts-47Au2-Yn.mjs";
|
|
4
4
|
import { createActionGate } from "openclaw/plugin-sdk/channel-actions";
|
|
5
5
|
import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
|
|
@@ -18,6 +18,7 @@ function listSlackMessageActions(cfg, accountId) {
|
|
|
18
18
|
const actions = ["send"];
|
|
19
19
|
for (const [gate, enabledActions] of [
|
|
20
20
|
["reactions", ["react", "reactions"]],
|
|
21
|
+
["channels", ["channel-create"]],
|
|
21
22
|
["messages", [
|
|
22
23
|
"conversation-open",
|
|
23
24
|
"read",
|
|
@@ -33,7 +34,7 @@ function listSlackMessageActions(cfg, accountId) {
|
|
|
33
34
|
]],
|
|
34
35
|
["memberInfo", ["member-info"]],
|
|
35
36
|
["emojiList", ["emoji-list"]]
|
|
36
|
-
]) if (gates.some((isEnabled) => isEnabled(gate))) actions.push(...enabledActions);
|
|
37
|
+
]) if (gates.some((isEnabled) => isEnabled(gate, gate === "channels" ? false : void 0))) actions.push(...enabledActions);
|
|
37
38
|
return actions;
|
|
38
39
|
}
|
|
39
40
|
function extractSlackToolSend(args) {
|