@openclaw/slack 2026.8.1 → 2026.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-inspect-CN2hBsim.js → account-inspect-C3sePHWa.js} +3 -3
- package/dist/account-inspect-api.js +1 -1
- package/dist/{action-runtime-044ldvNL.js → action-runtime-B0kRJ69h.js} +50 -40
- package/dist/action-runtime.runtime-IuA14rev.js +2 -0
- package/dist/{actions-BI7JkfVm.js → actions-BOxiu2Vy.js} +18 -12
- package/dist/api.js +14 -14
- package/dist/{approval-handler.runtime-DYv0UIZS.js → approval-handler.runtime-l5_2JLqi.js} +7 -6
- package/dist/{channel-1vIJOzPx.js → channel-BguxhhNG.js} +39 -31
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-DlFSKeIZ.js → channel-type-ChkODKBW.js} +2 -2
- package/dist/{channel.setup-ofDi3_Pu.js → channel.setup-BJohRJha.js} +23 -22
- package/dist/{config-schema-BVIMyiDN.js → config-schema-B9GwoRlE.js} +5 -3
- package/dist/{conversation-binding-route-DFVLUdYF.js → conversation-binding-route-Vee8Dgbf.js} +2 -2
- package/dist/{directory-config-DqfQ42OV.js → directory-config-Bmw4ykSy.js} +4 -3
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-BPaNHjmP.js → directory-live-BOILcXPo.js} +1 -1
- package/dist/{doctor-contract-BAy7-EUQ.js → doctor-contract-BNjw9bxb.js} +5 -4
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{group-policy-BdwszjYn.js → group-policy-BYH74y50.js} +70 -39
- package/dist/{message-tool-api-CJ0kjcg5.js → message-tool-api-BsZbsulu.js} +1 -1
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-Dq5Cmrvp.js → monitor-B72wWXWg.js} +3 -3
- package/dist/{outbound-adapter-DYaI8ThX.js → outbound-adapter-CPgYQ-BM.js} +3 -3
- package/dist/{pipeline.runtime-Bd22U0ga.js → pipeline.runtime-CcdujV99.js} +238 -393
- package/dist/{policy-CtQVbde1.js → policy-CUpBeOt9.js} +7 -5
- package/dist/{probe-0usmAb0i.js → probe-gj5yQgN2.js} +113 -112
- package/dist/{provider-CN_8hFv2.js → provider-DW9YC_no.js} +69 -44
- package/dist/{relay-source-BNGpsdwV.js → relay-source-BLMdBrAw.js} +6 -4
- package/dist/{replies-BSiRQOJ1.js → replies-DLjQ8RYU.js} +13 -8
- package/dist/{resolve-channels-Czheznc8.js → resolve-channels-Bv6IiGZ4.js} +4 -3
- package/dist/{resolve-users-BAOlNimr.js → resolve-users-BXw2pA7y.js} +4 -3
- package/dist/runtime-api.js +10 -10
- package/dist/{scopes-COSlmhnH.js → scopes-B9HRguDe.js} +1 -1
- package/dist/{send-DS9ICrBI.js → send-GUz4_v2E.js} +21 -13
- package/dist/{send.runtime-D_Bb6IuH.js → send.runtime-rScD-UJi.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BGnd2pSe.js → setup-surface-Cc3P-z35.js} +5 -5
- package/dist/{shared-D5B-5hBg.js → shared-CQGVZ_8a.js} +5 -5
- package/dist/{slash-dispatch.runtime-CilDmI0c.js → slash-dispatch.runtime-C2015r6s.js} +1 -1
- package/dist/{target-parsing-BnMD2ZqZ.js → target-parsing-PbxGDbr9.js} +11 -6
- package/dist/{targets-Cx5W_n3W.js → targets-7FexXJ62.js} +1 -1
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/@slack/bolt/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/README.md +71 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/package.json +52 -0
- package/node_modules/@slack/bolt/node_modules/negotiator/package.json +16 -10
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/package.json +1 -1
- package/package.json +5 -5
- package/dist/action-runtime.runtime-BL3KzX13.js +0 -2
- package/node_modules/@slack/bolt/node_modules/negotiator/HISTORY.md +0 -114
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as buildSlackChannelPolicyScope, t as buildSlackChannelIdCandidates } from "./group-policy-
|
|
2
|
-
import {
|
|
1
|
+
import { n as buildSlackChannelPolicyScope, t as buildSlackChannelIdCandidates } from "./group-policy-BYH74y50.js";
|
|
2
|
+
import { D as resolveSlackUserAllowListForTeam, T as normalizeSlackSlug } from "./probe-gj5yQgN2.js";
|
|
3
3
|
import { applyChannelMatchMeta, buildChannelKeyCandidates } from "openclaw/plugin-sdk/channel-targets";
|
|
4
4
|
import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
|
|
5
5
|
//#region extensions/slack/src/monitor/channel-config.ts
|
|
@@ -18,9 +18,10 @@ function resolveSlackChannelConfig(params) {
|
|
|
18
18
|
const keys = channelKeys ?? Object.keys(entries);
|
|
19
19
|
const normalizedName = channelName ? normalizeSlackSlug(channelName) : "";
|
|
20
20
|
const directName = channelName ? channelName.trim() : "";
|
|
21
|
+
const candidates = buildChannelKeyCandidates(...buildSlackChannelIdCandidates(channelId, params.teamId, { allowUnscoped: params.allowUnscoped }), allowNameMatching ? channelName ? `#${directName}` : void 0 : void 0, allowNameMatching ? directName : void 0, allowNameMatching ? normalizedName : void 0);
|
|
21
22
|
const match = buildSlackChannelPolicyScope({
|
|
22
23
|
channels: entries,
|
|
23
|
-
candidates
|
|
24
|
+
candidates
|
|
24
25
|
});
|
|
25
26
|
const { entry: matched, wildcardEntry: fallback } = match;
|
|
26
27
|
const requireMentionDefault = defaultRequireMention ?? true;
|
|
@@ -47,7 +48,7 @@ function resolveSlackChannelConfig(params) {
|
|
|
47
48
|
const skills = firstDefined(resolved.skills, fallback?.skills);
|
|
48
49
|
const systemPrompt = firstDefined(resolved.systemPrompt, fallback?.systemPrompt);
|
|
49
50
|
const presenceEvents = firstDefined(resolved.presenceEvents, fallback?.presenceEvents);
|
|
50
|
-
|
|
51
|
+
const result = {
|
|
51
52
|
allowed,
|
|
52
53
|
requireMention,
|
|
53
54
|
ignoreOtherMentions,
|
|
@@ -58,7 +59,8 @@ function resolveSlackChannelConfig(params) {
|
|
|
58
59
|
skills,
|
|
59
60
|
systemPrompt,
|
|
60
61
|
presenceEvents
|
|
61
|
-
}
|
|
62
|
+
};
|
|
63
|
+
return applyChannelMatchMeta(result, match);
|
|
62
64
|
}
|
|
63
65
|
//#endregion
|
|
64
66
|
//#region extensions/slack/src/monitor/policy.ts
|
|
@@ -1,20 +1,128 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { u as formatSlackBotTokenIdentityWarning } from "./accounts-Dm_H77gH.js";
|
|
3
|
-
import { a as parseSlackTarget } from "./target-parsing-
|
|
3
|
+
import { a as parseSlackTarget } from "./target-parsing-PbxGDbr9.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { isRecord, normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
+
import { compileAllowlist, resolveCompiledAllowlistMatch } from "openclaw/plugin-sdk/allow-from";
|
|
7
|
+
import { normalizeHyphenSlug, normalizeStringEntries as normalizeStringEntries$1, normalizeStringEntriesLower } from "openclaw/plugin-sdk/string-normalization-runtime";
|
|
6
8
|
import { runChannelProbe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
7
9
|
import { createHash } from "node:crypto";
|
|
8
10
|
import { WebClient } from "@slack/web-api";
|
|
9
11
|
import { addActiveManagedProxyTlsOptions, resolveEnvHttpProxyAgentOptions, resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
10
12
|
import { isDebugProxyGlobalFetchPatchInstalled } from "openclaw/plugin-sdk/proxy-capture";
|
|
11
|
-
import { compileAllowlist, resolveCompiledAllowlistMatch } from "openclaw/plugin-sdk/allow-from";
|
|
12
|
-
import { normalizeHyphenSlug, normalizeStringEntries as normalizeStringEntries$1, normalizeStringEntriesLower } from "openclaw/plugin-sdk/string-normalization-runtime";
|
|
13
13
|
import { redactSensitiveText } from "openclaw/plugin-sdk/logging-core";
|
|
14
14
|
import { defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
15
|
+
//#region extensions/slack/src/monitor/allow-list.ts
|
|
16
|
+
const SLACK_SLUG_CACHE_MAX = 512;
|
|
17
|
+
const SLACK_STABLE_USER_ID_RE = /^[ubw][a-z0-9]+$/;
|
|
18
|
+
const slackSlugCache = /* @__PURE__ */ new Map();
|
|
19
|
+
function normalizeSlackSlug(raw) {
|
|
20
|
+
const key = raw ?? "";
|
|
21
|
+
const cached = slackSlugCache.get(key);
|
|
22
|
+
if (cached !== void 0) return cached;
|
|
23
|
+
const normalized = normalizeHyphenSlug(raw);
|
|
24
|
+
slackSlugCache.set(key, normalized);
|
|
25
|
+
if (slackSlugCache.size > SLACK_SLUG_CACHE_MAX) {
|
|
26
|
+
const oldest = slackSlugCache.keys().next();
|
|
27
|
+
if (!oldest.done) slackSlugCache.delete(oldest.value);
|
|
28
|
+
}
|
|
29
|
+
return normalized;
|
|
30
|
+
}
|
|
31
|
+
function normalizeAllowList(list) {
|
|
32
|
+
return normalizeStringEntries$1(list);
|
|
33
|
+
}
|
|
34
|
+
function normalizeAllowListLower(list) {
|
|
35
|
+
return normalizeStringEntriesLower(list);
|
|
36
|
+
}
|
|
37
|
+
function normalizeSlackAllowOwnerEntry(entry) {
|
|
38
|
+
const trimmed = normalizeOptionalLowercaseString(entry);
|
|
39
|
+
if (!trimmed || trimmed === "*") return;
|
|
40
|
+
try {
|
|
41
|
+
const target = parseSlackTarget(trimmed);
|
|
42
|
+
if (target?.kind === "user" && target.teamId) return target.id.toLowerCase();
|
|
43
|
+
} catch {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const withoutPrefix = trimmed.replace(/^(slack:|user:)/, "");
|
|
47
|
+
return SLACK_STABLE_USER_ID_RE.test(withoutPrefix) ? withoutPrefix : void 0;
|
|
48
|
+
}
|
|
49
|
+
function resolveSlackAllowListMatch(params) {
|
|
50
|
+
const compiledAllowList = compileAllowlist(params.allowList);
|
|
51
|
+
const teamId = normalizeOptionalLowercaseString(params.teamId);
|
|
52
|
+
const id = normalizeOptionalLowercaseString(params.id);
|
|
53
|
+
const name = normalizeOptionalLowercaseString(params.name);
|
|
54
|
+
const slug = normalizeSlackSlug(name);
|
|
55
|
+
const scopedCandidates = [{
|
|
56
|
+
value: teamId && id ? `team:${teamId}:user:${id}` : void 0,
|
|
57
|
+
source: "workspace-id"
|
|
58
|
+
}];
|
|
59
|
+
const unscopedCandidates = [
|
|
60
|
+
{
|
|
61
|
+
value: id,
|
|
62
|
+
source: "id"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
value: id ? `slack:${id}` : void 0,
|
|
66
|
+
source: "prefixed-id"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
value: id ? `user:${id}` : void 0,
|
|
70
|
+
source: "prefixed-user"
|
|
71
|
+
},
|
|
72
|
+
...params.allowNameMatching === true ? [
|
|
73
|
+
{
|
|
74
|
+
value: name,
|
|
75
|
+
source: "name"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
value: name ? `slack:${name}` : void 0,
|
|
79
|
+
source: "prefixed-name"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
value: slug,
|
|
83
|
+
source: "slug"
|
|
84
|
+
}
|
|
85
|
+
] : []
|
|
86
|
+
];
|
|
87
|
+
return resolveCompiledAllowlistMatch({
|
|
88
|
+
compiledAllowlist: compiledAllowList,
|
|
89
|
+
candidates: [...scopedCandidates, ...unscopedCandidates]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function allowListMatches(params) {
|
|
93
|
+
return resolveSlackAllowListMatch(params).allowed;
|
|
94
|
+
}
|
|
95
|
+
function resolveSlackUserAllowed(params) {
|
|
96
|
+
const allowList = normalizeAllowListLower(params.allowList);
|
|
97
|
+
if (allowList.length === 0) return true;
|
|
98
|
+
return allowListMatches({
|
|
99
|
+
allowList,
|
|
100
|
+
teamId: params.teamId,
|
|
101
|
+
id: params.userId,
|
|
102
|
+
name: params.userName,
|
|
103
|
+
allowNameMatching: params.allowNameMatching
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function resolveSlackUserAllowListForTeam(params) {
|
|
107
|
+
const allowList = normalizeAllowListLower(params.allowList);
|
|
108
|
+
const teamId = normalizeOptionalLowercaseString(params.teamId);
|
|
109
|
+
return allowList.flatMap((entry) => {
|
|
110
|
+
if (entry === "*") return [entry];
|
|
111
|
+
if (!entry.startsWith("team:")) return [entry];
|
|
112
|
+
try {
|
|
113
|
+
const target = parseSlackTarget(entry);
|
|
114
|
+
if (target?.kind === "user" && target.teamId?.toLowerCase() === teamId) return [entry];
|
|
115
|
+
return params.preserveUnmatchedScopedEntries ? [entry] : [];
|
|
116
|
+
} catch {
|
|
117
|
+
return params.preserveUnmatchedScopedEntries ? [entry] : [];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
15
122
|
//#region extensions/slack/src/client-options.ts
|
|
16
123
|
const requireFromSlackSocketMode = (() => {
|
|
17
|
-
|
|
124
|
+
const require = createRequire(import.meta.url);
|
|
125
|
+
return createRequire(require.resolve("@slack/socket-mode/package.json"));
|
|
18
126
|
})();
|
|
19
127
|
function loadSlackUndiciRuntime() {
|
|
20
128
|
return requireFromSlackSocketMode("undici");
|
|
@@ -179,113 +287,6 @@ function getSlackListenerUploadCompletionClient(params) {
|
|
|
179
287
|
return client;
|
|
180
288
|
}
|
|
181
289
|
//#endregion
|
|
182
|
-
//#region extensions/slack/src/monitor/allow-list.ts
|
|
183
|
-
const SLACK_SLUG_CACHE_MAX = 512;
|
|
184
|
-
const SLACK_STABLE_USER_ID_RE = /^[ubw][a-z0-9]+$/;
|
|
185
|
-
const slackSlugCache = /* @__PURE__ */ new Map();
|
|
186
|
-
function normalizeSlackSlug(raw) {
|
|
187
|
-
const key = raw ?? "";
|
|
188
|
-
const cached = slackSlugCache.get(key);
|
|
189
|
-
if (cached !== void 0) return cached;
|
|
190
|
-
const normalized = normalizeHyphenSlug(raw);
|
|
191
|
-
slackSlugCache.set(key, normalized);
|
|
192
|
-
if (slackSlugCache.size > SLACK_SLUG_CACHE_MAX) {
|
|
193
|
-
const oldest = slackSlugCache.keys().next();
|
|
194
|
-
if (!oldest.done) slackSlugCache.delete(oldest.value);
|
|
195
|
-
}
|
|
196
|
-
return normalized;
|
|
197
|
-
}
|
|
198
|
-
function normalizeAllowList(list) {
|
|
199
|
-
return normalizeStringEntries$1(list);
|
|
200
|
-
}
|
|
201
|
-
function normalizeAllowListLower(list) {
|
|
202
|
-
return normalizeStringEntriesLower(list);
|
|
203
|
-
}
|
|
204
|
-
function normalizeSlackAllowOwnerEntry(entry) {
|
|
205
|
-
const trimmed = normalizeOptionalLowercaseString(entry);
|
|
206
|
-
if (!trimmed || trimmed === "*") return;
|
|
207
|
-
try {
|
|
208
|
-
const target = parseSlackTarget(trimmed);
|
|
209
|
-
if (target?.kind === "user" && target.teamId) return target.id.toLowerCase();
|
|
210
|
-
} catch {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
const withoutPrefix = trimmed.replace(/^(slack:|user:)/, "");
|
|
214
|
-
return SLACK_STABLE_USER_ID_RE.test(withoutPrefix) ? withoutPrefix : void 0;
|
|
215
|
-
}
|
|
216
|
-
function resolveSlackAllowListMatch(params) {
|
|
217
|
-
const compiledAllowList = compileAllowlist(params.allowList);
|
|
218
|
-
const teamId = normalizeOptionalLowercaseString(params.teamId);
|
|
219
|
-
const id = normalizeOptionalLowercaseString(params.id);
|
|
220
|
-
const name = normalizeOptionalLowercaseString(params.name);
|
|
221
|
-
const slug = normalizeSlackSlug(name);
|
|
222
|
-
const scopedCandidates = [{
|
|
223
|
-
value: teamId && id ? `team:${teamId}:user:${id}` : void 0,
|
|
224
|
-
source: "workspace-id"
|
|
225
|
-
}];
|
|
226
|
-
const unscopedCandidates = [
|
|
227
|
-
{
|
|
228
|
-
value: id,
|
|
229
|
-
source: "id"
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
value: id ? `slack:${id}` : void 0,
|
|
233
|
-
source: "prefixed-id"
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
value: id ? `user:${id}` : void 0,
|
|
237
|
-
source: "prefixed-user"
|
|
238
|
-
},
|
|
239
|
-
...params.allowNameMatching === true ? [
|
|
240
|
-
{
|
|
241
|
-
value: name,
|
|
242
|
-
source: "name"
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
value: name ? `slack:${name}` : void 0,
|
|
246
|
-
source: "prefixed-name"
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
value: slug,
|
|
250
|
-
source: "slug"
|
|
251
|
-
}
|
|
252
|
-
] : []
|
|
253
|
-
];
|
|
254
|
-
return resolveCompiledAllowlistMatch({
|
|
255
|
-
compiledAllowlist: compiledAllowList,
|
|
256
|
-
candidates: [...scopedCandidates, ...unscopedCandidates]
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
function allowListMatches(params) {
|
|
260
|
-
return resolveSlackAllowListMatch(params).allowed;
|
|
261
|
-
}
|
|
262
|
-
function resolveSlackUserAllowed(params) {
|
|
263
|
-
const allowList = normalizeAllowListLower(params.allowList);
|
|
264
|
-
if (allowList.length === 0) return true;
|
|
265
|
-
return allowListMatches({
|
|
266
|
-
allowList,
|
|
267
|
-
teamId: params.teamId,
|
|
268
|
-
id: params.userId,
|
|
269
|
-
name: params.userName,
|
|
270
|
-
allowNameMatching: params.allowNameMatching
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
function resolveSlackUserAllowListForTeam(params) {
|
|
274
|
-
const allowList = normalizeAllowListLower(params.allowList);
|
|
275
|
-
const teamId = normalizeOptionalLowercaseString(params.teamId);
|
|
276
|
-
return allowList.flatMap((entry) => {
|
|
277
|
-
if (entry === "*") return [entry];
|
|
278
|
-
if (!entry.startsWith("team:")) return [entry];
|
|
279
|
-
try {
|
|
280
|
-
const target = parseSlackTarget(entry);
|
|
281
|
-
if (target?.kind === "user" && target.teamId?.toLowerCase() === teamId) return [entry];
|
|
282
|
-
return params.preserveUnmatchedScopedEntries ? [entry] : [];
|
|
283
|
-
} catch {
|
|
284
|
-
return params.preserveUnmatchedScopedEntries ? [entry] : [];
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
//#endregion
|
|
289
290
|
//#region extensions/slack/src/errors.ts
|
|
290
291
|
const NO_ERROR_DETAIL = "no error detail";
|
|
291
292
|
function redact(value) {
|
|
@@ -549,4 +550,4 @@ async function probeSlack(token, timeoutMs = 2500, opts) {
|
|
|
549
550
|
}));
|
|
550
551
|
}
|
|
551
552
|
//#endregion
|
|
552
|
-
export {
|
|
553
|
+
export { normalizeAllowListLower as C, resolveSlackUserAllowListForTeam as D, resolveSlackAllowListMatch as E, resolveSlackUserAllowed as O, normalizeAllowList as S, normalizeSlackSlug as T, resolveSlackLookupClientOptions as _, slackIngressIdentity as a, resolveSlackWriteClientOptions as b, createSlackReadClient as c, createSlackWebClient as d, createSlackWriteClient as f, SLACK_WRITE_RETRY_OPTIONS as g, SLACK_DEFAULT_RETRY_OPTIONS as h, createSlackIngressSubject as i, createSlackStartupAuthClient as l, getSlackWriteClient as m, probe_exports as n, formatSlackError as o, getSlackListenerUploadCompletionClient as p, SLACK_USER_NAME_KIND as r, createSlackLookupClient as s, probeSlack as t, createSlackTokenCacheKey as u, resolveSlackProxyDispatcher as v, normalizeSlackAllowOwnerEntry as w, allowListMatches as x, resolveSlackWebClientOptions as y };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { n as registerSlackHttpHandler, r as normalizeSlackWebhookPath } from "./registry-bbjH7IHX.js";
|
|
2
2
|
import { a as resolveSlackAccount, d as resolveSlackAppToken, f as resolveSlackBotToken, i as resolveDefaultSlackAccountId, o as resolveSlackAccountAllowFrom, s as resolveSlackAccountDmPolicy, u as formatSlackBotTokenIdentityWarning } from "./accounts-Dm_H77gH.js";
|
|
3
|
-
import { a as parseSlackTarget, n as formatSlackTarget } from "./target-parsing-
|
|
4
|
-
import { Ct as isSlackApprovalAuthorizedSender, G as isSlackCallbackActionId, J as decodeSlackQuestionAction, K as isSlackQuestionActionId, L as truncateSlackText, M as SLACK_TEXT_LIMIT, Tt as isSlackExecApprovalAuthorizedSender, W as isSlackApprovalActionId, Y as resolveSlackQuestionAction, a as qualifySlackConversationId, et as escapeSlackMrkdwn, lt as isSlackAnyNativeApprovalClientEnabled, nt as decodeSlackApprovalAction, o as qualifySlackRoutePeerId, s as resolveSlackEnterpriseMainDmSessionKey, t as buildSlackChannelIdCandidates, xt as registerSlackInstallationState } from "./group-policy-
|
|
5
|
-
import {
|
|
3
|
+
import { a as parseSlackTarget, n as formatSlackTarget } from "./target-parsing-PbxGDbr9.js";
|
|
4
|
+
import { Ct as isSlackApprovalAuthorizedSender, G as isSlackCallbackActionId, J as decodeSlackQuestionAction, K as isSlackQuestionActionId, L as truncateSlackText, M as SLACK_TEXT_LIMIT, Tt as isSlackExecApprovalAuthorizedSender, W as isSlackApprovalActionId, Y as resolveSlackQuestionAction, a as qualifySlackConversationId, et as escapeSlackMrkdwn, lt as isSlackAnyNativeApprovalClientEnabled, nt as decodeSlackApprovalAction, o as qualifySlackRoutePeerId, s as resolveSlackEnterpriseMainDmSessionKey, t as buildSlackChannelIdCandidates, xt as registerSlackInstallationState } from "./group-policy-BYH74y50.js";
|
|
5
|
+
import { C as normalizeAllowListLower, D as resolveSlackUserAllowListForTeam, E as resolveSlackAllowListMatch, S as normalizeAllowList, T as normalizeSlackSlug, _ as resolveSlackLookupClientOptions, a as slackIngressIdentity, d as createSlackWebClient, i as createSlackIngressSubject, l as createSlackStartupAuthClient, o as formatSlackError, p as getSlackListenerUploadCompletionClient, v as resolveSlackProxyDispatcher, w as normalizeSlackAllowOwnerEntry, x as allowListMatches, y as resolveSlackWebClientOptions } from "./probe-gj5yQgN2.js";
|
|
6
6
|
import { n as getSlackRuntime, t as getOptionalSlackRuntime } from "./runtime-JSVZSWAj.js";
|
|
7
|
-
import { C as hasSlackMessageTableBlock, b as saveRemoteMedia, f as readSlackMessages, y as isGovSlackClient } from "./actions-
|
|
8
|
-
import { i as setSlackDefaultSendIdentity, p as requireSlackPostMessageTimestamp } from "./send-
|
|
7
|
+
import { C as hasSlackMessageTableBlock, b as saveRemoteMedia, f as readSlackMessages, y as isGovSlackClient } from "./actions-BOxiu2Vy.js";
|
|
8
|
+
import { i as setSlackDefaultSendIdentity, p as requireSlackPostMessageTimestamp } from "./send-GUz4_v2E.js";
|
|
9
9
|
import { t as collectSlackCursorPages } from "./cursor-pages-eX7p8Wwt.js";
|
|
10
|
-
import { t as resolveSlackChannelAllowlist } from "./resolve-channels-
|
|
11
|
-
import { t as resolveSlackUserAllowlist } from "./resolve-users-
|
|
12
|
-
import { n as resolveSlackChannelConfig, r as resolveSlackChannelLabel, t as isSlackChannelAllowedByPolicy } from "./policy-
|
|
10
|
+
import { t as resolveSlackChannelAllowlist } from "./resolve-channels-Bv6IiGZ4.js";
|
|
11
|
+
import { t as resolveSlackUserAllowlist } from "./resolve-users-BXw2pA7y.js";
|
|
12
|
+
import { n as resolveSlackChannelConfig, r as resolveSlackChannelLabel, t as isSlackChannelAllowedByPolicy } from "./policy-CUpBeOt9.js";
|
|
13
13
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
14
14
|
import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
15
15
|
import { asNonArrayRecord, asOptionalRecord, isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries, normalizeUniqueTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -20,11 +20,11 @@ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
|
20
20
|
import { computeBackoff, createNonExitingRuntime, createSubsystemLogger, danger, getChildLogger, logVerbose, shouldLogVerbose, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
21
21
|
import { chunkItems } from "openclaw/plugin-sdk/text-chunking";
|
|
22
22
|
import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
23
|
+
import { addAllowlistUserEntriesFromConfigEntry, buildAllowlistResolutionSummary, formatAllowlistMatchMeta, mergeAllowlist, patchAllowlistUsersInConfigEntries, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
|
|
23
24
|
import { parseExecApprovalCommandText } from "openclaw/plugin-sdk/approval-reply-runtime";
|
|
24
25
|
import { withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
25
26
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
26
27
|
import { WebAPIHTTPError, WebAPIPlatformError, WebAPIRateLimitedError, WebAPIRequestError, WebClient } from "@slack/web-api";
|
|
27
|
-
import { addAllowlistUserEntriesFromConfigEntry, buildAllowlistResolutionSummary, formatAllowlistMatchMeta, mergeAllowlist, patchAllowlistUsersInConfigEntries, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
|
|
28
28
|
import { buildPluginBindingResolvedText, parsePluginBindingApprovalCustomId, resolveConversationLabel as resolveConversationLabel$1, resolvePluginConversationBindingApproval, resolveRuntimeConversationBindingRoute, upsertChannelPairingRequest } from "openclaw/plugin-sdk/conversation-runtime";
|
|
29
29
|
import { createChannelIngressResolver, readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
30
30
|
import { collectErrorGraphCandidates, extractErrorCode, formatErrorMessage, isApprovalNotFoundError, readErrorName, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -237,8 +237,8 @@ function createSlackAgentViewState(params) {
|
|
|
237
237
|
//#endregion
|
|
238
238
|
//#region extensions/slack/src/monitor/assistant-thread-context.ts
|
|
239
239
|
const SLACK_ASSISTANT_THREAD_CONTEXT_METADATA_EVENT = "assistant_thread_context";
|
|
240
|
-
const SLACK_ASSISTANT_CONTEXT_TTL_MS =
|
|
241
|
-
const SLACK_ASSISTANT_CONTEXT_CLEANUP_INTERVAL_MS =
|
|
240
|
+
const SLACK_ASSISTANT_CONTEXT_TTL_MS = 864e5;
|
|
241
|
+
const SLACK_ASSISTANT_CONTEXT_CLEANUP_INTERVAL_MS = 6e5;
|
|
242
242
|
function buildSlackAssistantThreadMetadata(context) {
|
|
243
243
|
const eventPayload = {};
|
|
244
244
|
if (context.channelId) eventPayload.channel_id = context.channelId;
|
|
@@ -477,12 +477,12 @@ function resolveSlackSystemEventRoute(params) {
|
|
|
477
477
|
const SLACK_CHANNEL_CACHE_MAX_ENTRIES = 1024;
|
|
478
478
|
const SLACK_USER_CACHE_MAX_ENTRIES = 2048;
|
|
479
479
|
const SLACK_AVATAR_CACHE_MAX_ENTRIES = 128;
|
|
480
|
-
const SLACK_AVATAR_MAX_BYTES =
|
|
480
|
+
const SLACK_AVATAR_MAX_BYTES = 262144;
|
|
481
481
|
const SLACK_AVATAR_SSRF_POLICY = {
|
|
482
482
|
allowedHostnames: ["avatars.slack-edge.com", "*.slack-edge.com"],
|
|
483
483
|
hostnameAllowlist: ["avatars.slack-edge.com", "*.slack-edge.com"]
|
|
484
484
|
};
|
|
485
|
-
const SLACK_CHANNEL_DENIAL_WARNING_TTL_MS =
|
|
485
|
+
const SLACK_CHANNEL_DENIAL_WARNING_TTL_MS = 3e5;
|
|
486
486
|
const SLACK_CHANNEL_DENIAL_WARNING_MAX_ENTRIES = 1024;
|
|
487
487
|
function createSlackMonitorContext(params) {
|
|
488
488
|
const channelHistories = /* @__PURE__ */ new Map();
|
|
@@ -587,7 +587,8 @@ function createSlackMonitorContext(params) {
|
|
|
587
587
|
}
|
|
588
588
|
};
|
|
589
589
|
const resolveUserAvatar = (userId, eventScope) => {
|
|
590
|
-
|
|
590
|
+
const client = eventScope?.client ?? params.app.client;
|
|
591
|
+
if (isGovSlackClient(client)) return;
|
|
591
592
|
const imageUrl = readLruMapEntry(userCache, scopedKey(userId, eventScope))?.imageUrl;
|
|
592
593
|
if (!imageUrl) return;
|
|
593
594
|
const cacheKey = scopedKey(`${userId}\0${imageUrl}`, eventScope);
|
|
@@ -1389,7 +1390,8 @@ function createSlackDurableIngress(options) {
|
|
|
1389
1390
|
}
|
|
1390
1391
|
};
|
|
1391
1392
|
try {
|
|
1392
|
-
|
|
1393
|
+
const event = raw.kind === "events-api" ? asOptionalRecord(raw.body)?.event : void 0;
|
|
1394
|
+
if (asOptionalRecord(event)?.type === "channel_id_changed") {
|
|
1393
1395
|
const channelTurns = activeChannelTurns.get(laneKey);
|
|
1394
1396
|
if (channelTurns && channelTurns.size > 0) {
|
|
1395
1397
|
adoptOnCompletion = true;
|
|
@@ -1501,7 +1503,8 @@ async function resolveThreadTsFromHistory(params) {
|
|
|
1501
1503
|
inclusive: true,
|
|
1502
1504
|
limit: 1
|
|
1503
1505
|
});
|
|
1504
|
-
|
|
1506
|
+
const message = response.messages?.find((entry) => entry.ts === params.messageTs) ?? response.messages?.[0];
|
|
1507
|
+
return normalizeOptionalString(message?.thread_ts);
|
|
1505
1508
|
}
|
|
1506
1509
|
function createSlackThreadTsResolver(params) {
|
|
1507
1510
|
const ttlMs = Math.max(0, parseFiniteNumber(params.cacheTtlMs) ?? DEFAULT_THREAD_TS_CACHE_TTL_MS);
|
|
@@ -1957,7 +1960,8 @@ function resolveSlackEventScope(params) {
|
|
|
1957
1960
|
ok: false,
|
|
1958
1961
|
reason: "enterprise_event_for_workspace_account"
|
|
1959
1962
|
} : { ok: true };
|
|
1960
|
-
const
|
|
1963
|
+
const body = params.body && typeof params.body === "object" ? params.body : {};
|
|
1964
|
+
const apiAppId = normalizeOptionalString(body.api_app_id);
|
|
1961
1965
|
if (apiAppId && params.identity.apiAppId && apiAppId !== params.identity.apiAppId) return {
|
|
1962
1966
|
ok: false,
|
|
1963
1967
|
reason: "wrong_app"
|
|
@@ -2120,9 +2124,10 @@ function registerSlackChannelIdChangedEvent(params) {
|
|
|
2120
2124
|
const oldChannelId = payload.old_channel_id;
|
|
2121
2125
|
const newChannelId = payload.new_channel_id;
|
|
2122
2126
|
if (!oldChannelId || !newChannelId) return;
|
|
2127
|
+
const channelInfo = await ctx.resolveChannelName(newChannelId);
|
|
2123
2128
|
const label = resolveSlackChannelLabel({
|
|
2124
2129
|
channelId: newChannelId,
|
|
2125
|
-
channelName:
|
|
2130
|
+
channelName: channelInfo?.name
|
|
2126
2131
|
});
|
|
2127
2132
|
ctx.runtime.log?.(warn(`[slack] Channel ID changed: ${oldChannelId} → ${newChannelId} (${label})`));
|
|
2128
2133
|
if (!resolveChannelConfigWrites({
|
|
@@ -2375,7 +2380,8 @@ function isSlackReplyActionId(actionId) {
|
|
|
2375
2380
|
return actionId === "openclaw:reply_button" || actionId === "openclaw:reply_select" || actionId.startsWith(`openclaw:reply_button:`) || actionId.startsWith(`openclaw:reply_select:`);
|
|
2376
2381
|
}
|
|
2377
2382
|
function readSlackApprovalAction(parsed) {
|
|
2378
|
-
|
|
2383
|
+
const value = normalizeOptionalString(parsed.actionSummary.value) ?? parsed.actionSummary.selectedValues?.map((entry) => normalizeOptionalString(entry)).find((entry) => Boolean(entry));
|
|
2384
|
+
return decodeSlackApprovalAction(value);
|
|
2379
2385
|
}
|
|
2380
2386
|
function isSlackReplyLinkAction(parsed) {
|
|
2381
2387
|
if (parsed.actionId === "openclaw:session_link") return true;
|
|
@@ -2500,11 +2506,19 @@ async function handleSlackPluginBindingApproval(params) {
|
|
|
2500
2506
|
await respondEphemeral(params.respond, buildPluginBindingResolvedText(resolved));
|
|
2501
2507
|
return true;
|
|
2502
2508
|
}
|
|
2509
|
+
function formatSlackPluginApprovalSenderId(userId, eventScope) {
|
|
2510
|
+
return formatSlackTarget({
|
|
2511
|
+
kind: "user",
|
|
2512
|
+
id: userId,
|
|
2513
|
+
teamId: eventScope?.teamId
|
|
2514
|
+
});
|
|
2515
|
+
}
|
|
2503
2516
|
async function handleSlackApprovalInteraction(params) {
|
|
2517
|
+
const pluginSenderId = formatSlackPluginApprovalSenderId(params.parsed.userId, params.eventScope);
|
|
2504
2518
|
const pluginApprovalAuthorizedSender = isSlackApprovalAuthorizedSender({
|
|
2505
2519
|
cfg: params.ctx.cfg,
|
|
2506
2520
|
accountId: params.ctx.accountId,
|
|
2507
|
-
senderId:
|
|
2521
|
+
senderId: pluginSenderId
|
|
2508
2522
|
});
|
|
2509
2523
|
const execApprovalAuthorizedSender = isSlackExecApprovalAuthorizedSender({
|
|
2510
2524
|
cfg: params.ctx.cfg,
|
|
@@ -2524,7 +2538,7 @@ async function handleSlackApprovalInteraction(params) {
|
|
|
2524
2538
|
decision: params.approval.decision,
|
|
2525
2539
|
channel: "slack",
|
|
2526
2540
|
accountId: params.ctx.accountId,
|
|
2527
|
-
senderId: params.parsed.userId
|
|
2541
|
+
senderId: params.approval.approvalKind === "plugin" ? pluginSenderId : params.parsed.userId
|
|
2528
2542
|
});
|
|
2529
2543
|
const terminalLabel = resolveSlackApprovalTerminalLabel(result.approval);
|
|
2530
2544
|
const prefix = result.applied ? "Resolved" : "Already resolved";
|
|
@@ -2560,10 +2574,11 @@ async function handleSlackApprovalInteraction(params) {
|
|
|
2560
2574
|
async function handleSlackLegacyApprovalInteraction(params) {
|
|
2561
2575
|
const parsedApproval = parseExecApprovalCommandText(params.pluginInteractionData);
|
|
2562
2576
|
if (!parsedApproval) return false;
|
|
2577
|
+
const pluginSenderId = formatSlackPluginApprovalSenderId(params.parsed.userId, params.eventScope);
|
|
2563
2578
|
const pluginAuthorized = isSlackApprovalAuthorizedSender({
|
|
2564
2579
|
cfg: params.ctx.cfg,
|
|
2565
2580
|
accountId: params.ctx.accountId,
|
|
2566
|
-
senderId:
|
|
2581
|
+
senderId: pluginSenderId
|
|
2567
2582
|
});
|
|
2568
2583
|
const execAuthorized = isSlackExecApprovalAuthorizedSender({
|
|
2569
2584
|
cfg: params.ctx.cfg,
|
|
@@ -2585,7 +2600,7 @@ async function handleSlackLegacyApprovalInteraction(params) {
|
|
|
2585
2600
|
decision: parsedApproval.decision,
|
|
2586
2601
|
channel: "slack",
|
|
2587
2602
|
accountId: params.ctx.accountId,
|
|
2588
|
-
senderId: params.parsed.userId,
|
|
2603
|
+
senderId: resolveMethod === "plugin" ? pluginSenderId : params.parsed.userId,
|
|
2589
2604
|
resolveMethod
|
|
2590
2605
|
});
|
|
2591
2606
|
try {
|
|
@@ -3629,7 +3644,8 @@ function registerSlackMemberEvents(params) {
|
|
|
3629
3644
|
eventScope
|
|
3630
3645
|
});
|
|
3631
3646
|
if (!ingressContext) return;
|
|
3632
|
-
|
|
3647
|
+
const userLabel = (payload.user ? await ctx.resolveUserName(payload.user, eventScope) : {})?.name ?? payload.user ?? "someone";
|
|
3648
|
+
enqueueRoutedSystemEvent(`Slack: ${userLabel} ${paramsLocal.verb} ${ingressContext.channelLabel}.`, ingressContext.route, { contextKey: `slack:member:${eventScope ? `${eventScope.teamId}:` : ""}${paramsLocal.verb}:${channelId ?? "unknown"}:${payload.user ?? "unknown"}:${paramsLocal.eventId}` });
|
|
3633
3649
|
} catch (err) {
|
|
3634
3650
|
ctx.runtime.error?.(danger(`slack ${paramsLocal.verb} handler failed: ${formatErrorMessage(err)}`));
|
|
3635
3651
|
if (err instanceof SlackSystemEventAuthRetryError) throw err;
|
|
@@ -3819,7 +3835,8 @@ function addUserCandidate(candidates, value, botUserId) {
|
|
|
3819
3835
|
candidates.add(id);
|
|
3820
3836
|
}
|
|
3821
3837
|
function collectMetadataUserCandidates(candidates, value, botUserId) {
|
|
3822
|
-
const
|
|
3838
|
+
const metadata = asOptionalRecord(value);
|
|
3839
|
+
const payload = asOptionalRecord(metadata?.event_payload);
|
|
3823
3840
|
if (!payload) return;
|
|
3824
3841
|
for (const key of [
|
|
3825
3842
|
"user",
|
|
@@ -4119,7 +4136,8 @@ function registerSlackReactionEvents(params) {
|
|
|
4119
4136
|
const emojiLabel = event.reaction ?? "emoji";
|
|
4120
4137
|
const authorLabel = authorInfo?.name ?? event.item_user;
|
|
4121
4138
|
const baseText = `Slack reaction ${action}: :${emojiLabel}: by ${actorLabel} in ${ingressContext.channelLabel} msg ${item.ts}`;
|
|
4122
|
-
|
|
4139
|
+
const text = authorLabel ? `${baseText} from ${authorLabel}` : baseText;
|
|
4140
|
+
enqueueRoutedSystemEvent(text, ingressContext.route, { contextKey: `slack:reaction:${eventScope ? `${eventScope.teamId}:` : ""}${action}:${item.channel}:${item.ts}:${event.user}:${emojiLabel}:${eventId}` });
|
|
4123
4141
|
} catch (err) {
|
|
4124
4142
|
ctx.runtime.error?.(danger(`slack reaction handler failed: ${formatErrorMessage(err)}`));
|
|
4125
4143
|
}
|
|
@@ -4198,7 +4216,7 @@ function registerSlackWorkspaceEvents(params) {
|
|
|
4198
4216
|
}
|
|
4199
4217
|
//#endregion
|
|
4200
4218
|
//#region extensions/slack/src/monitor/message-dispatch-dedupe.ts
|
|
4201
|
-
const SLACK_MESSAGE_DISPATCH_DEDUPE_TTL_MS =
|
|
4219
|
+
const SLACK_MESSAGE_DISPATCH_DEDUPE_TTL_MS = 864e5;
|
|
4202
4220
|
const SLACK_MESSAGE_DISPATCH_DEDUPE_MEMORY_MAX_ENTRIES = 2e4;
|
|
4203
4221
|
const SLACK_MESSAGE_DISPATCH_DEDUPE_STATE_MAX_ENTRIES = 2e4;
|
|
4204
4222
|
const SLACK_MESSAGE_DISPATCH_DEDUPE_NAMESPACE = "global";
|
|
@@ -4265,7 +4283,7 @@ function buildSlackDebounceKey(message, accountId, teamId) {
|
|
|
4265
4283
|
}
|
|
4266
4284
|
//#endregion
|
|
4267
4285
|
//#region extensions/slack/src/monitor/message-handler.ts
|
|
4268
|
-
const loadSlackMessagePipeline = createLazyRuntimeModule(() => import("./pipeline.runtime-
|
|
4286
|
+
const loadSlackMessagePipeline = createLazyRuntimeModule(() => import("./pipeline.runtime-CcdujV99.js"));
|
|
4269
4287
|
const RETRYABLE_FLUSH_MAX_ATTEMPTS = 3;
|
|
4270
4288
|
const RETRYABLE_FLUSH_RETRY_DELAY_MS = 1e3;
|
|
4271
4289
|
const REPLY_SESSION_INIT_CONFLICT_MESSAGE_RE = /reply session initialization conflicted for \S+/u;
|
|
@@ -4273,8 +4291,9 @@ function isRetryableSlackInboundError(error) {
|
|
|
4273
4291
|
return collectErrorGraphCandidates(error, (current) => [current.cause, current.error]).some((candidate) => REPLY_SESSION_INIT_CONFLICT_MESSAGE_RE.test(formatErrorMessage(candidate)));
|
|
4274
4292
|
}
|
|
4275
4293
|
function shouldDebounceSlackMessage(message, cfg) {
|
|
4294
|
+
const textForCommandDetection = stripSlackMentionsForCommandDetection(message.text ?? "");
|
|
4276
4295
|
return shouldDebounceTextInbound({
|
|
4277
|
-
text:
|
|
4296
|
+
text: textForCommandDetection,
|
|
4278
4297
|
cfg,
|
|
4279
4298
|
hasMedia: Boolean(message.files && message.files.length > 0) || hasSlackMessageTableBlock(message)
|
|
4280
4299
|
});
|
|
@@ -4532,11 +4551,11 @@ function createSlackMessageHandler(params) {
|
|
|
4532
4551
|
}
|
|
4533
4552
|
//#endregion
|
|
4534
4553
|
//#region extensions/slack/src/monitor/presence-monitor.ts
|
|
4535
|
-
const SLACK_PRESENCE_GREETING_COOLDOWN_MS =
|
|
4554
|
+
const SLACK_PRESENCE_GREETING_COOLDOWN_MS = 288e5;
|
|
4536
4555
|
const SLACK_PRESENCE_REQUEST_TIMEOUT_MS = 3e4;
|
|
4537
4556
|
const SLACK_PRESENCE_POLL_INTERVAL_MS = 6e4;
|
|
4538
4557
|
const SLACK_PRESENCE_AUTO_MAX_PARTICIPANTS = 8;
|
|
4539
|
-
const SLACK_PRESENCE_TARGET_TTL_MS =
|
|
4558
|
+
const SLACK_PRESENCE_TARGET_TTL_MS = 864e5;
|
|
4540
4559
|
const SLACK_PRESENCE_MAX_POLLS_PER_INTERVAL = 45;
|
|
4541
4560
|
const SLACK_PRESENCE_MAX_TARGETS = 2e3;
|
|
4542
4561
|
const DEFAULT_SLACK_PRESENCE_EVENT_PROMPT = ["Before greeting, retrieve relevant memory and wiki context for this immutable user_id, including a known timezone when available. Use their local time; if their timezone is unknown, do not guess.", "Send at most one short, natural greeting in this Slack conversation. Do not reveal private memory. If no greeting is appropriate, stay silent."];
|
|
@@ -5144,8 +5163,8 @@ async function authorizeSlackDirectMessage(params) {
|
|
|
5144
5163
|
//#endregion
|
|
5145
5164
|
//#region extensions/slack/src/monitor/external-arg-menu-store.ts
|
|
5146
5165
|
const SLACK_EXTERNAL_ARG_MENU_TOKEN_BYTES = 18;
|
|
5147
|
-
const SLACK_EXTERNAL_ARG_MENU_TOKEN_PATTERN = new RegExp(`^[A-Za-z0-9_-]{${Math.ceil(
|
|
5148
|
-
const SLACK_EXTERNAL_ARG_MENU_TTL_MS =
|
|
5166
|
+
const SLACK_EXTERNAL_ARG_MENU_TOKEN_PATTERN = new RegExp(`^[A-Za-z0-9_-]{${Math.ceil(24)}}$`);
|
|
5167
|
+
const SLACK_EXTERNAL_ARG_MENU_TTL_MS = 6e5;
|
|
5149
5168
|
const SLACK_EXTERNAL_ARG_MENU_PREFIX = "openclaw_cmdarg_ext:";
|
|
5150
5169
|
function pruneSlackExternalArgMenuStore(store, rawNow) {
|
|
5151
5170
|
const now = asDateTimestampMs(rawNow);
|
|
@@ -5237,7 +5256,7 @@ const SLACK_COMMAND_ARG_CONFIRM_TEXT_MAX = 300;
|
|
|
5237
5256
|
const SLACK_HEADER_TEXT_MAX = 150;
|
|
5238
5257
|
const SLACK_COMMAND_ARG_ACTION_BLOCKS_MAX = 47;
|
|
5239
5258
|
const loadSlashCommandsRuntime = createLazyRuntimeModule(() => import("./slash-commands.runtime-BTTMlmwy.js"));
|
|
5240
|
-
const loadSlashDispatchRuntime = createLazyRuntimeModule(() => import("./slash-dispatch.runtime-
|
|
5259
|
+
const loadSlashDispatchRuntime = createLazyRuntimeModule(() => import("./slash-dispatch.runtime-C2015r6s.js"));
|
|
5241
5260
|
const loadSlashSkillCommandsRuntime = createLazyRuntimeModule(() => import("./slash-skill-commands.runtime-CD1J2ODY.js"));
|
|
5242
5261
|
const loadPluginCommandRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/plugin-command-runtime"));
|
|
5243
5262
|
function resolveSlackCommandMenuModelContext(params) {
|
|
@@ -5288,6 +5307,8 @@ function resolveSlackCommandMenuModelContext(params) {
|
|
|
5288
5307
|
}
|
|
5289
5308
|
const slackExternalArgMenuStore = createSlackExternalArgMenuStore();
|
|
5290
5309
|
function buildSlackArgMenuConfirm(params) {
|
|
5310
|
+
const command = escapeSlackMrkdwn(params.command);
|
|
5311
|
+
const arg = escapeSlackMrkdwn(params.arg);
|
|
5291
5312
|
return {
|
|
5292
5313
|
title: {
|
|
5293
5314
|
type: "plain_text",
|
|
@@ -5295,7 +5316,7 @@ function buildSlackArgMenuConfirm(params) {
|
|
|
5295
5316
|
},
|
|
5296
5317
|
text: {
|
|
5297
5318
|
type: "mrkdwn",
|
|
5298
|
-
text: truncateSlackText(`Run */${
|
|
5319
|
+
text: truncateSlackText(`Run */${command}* with *${arg}* set to this value?`, SLACK_COMMAND_ARG_CONFIRM_TEXT_MAX)
|
|
5299
5320
|
},
|
|
5300
5321
|
confirm: {
|
|
5301
5322
|
type: "plain_text",
|
|
@@ -6096,12 +6117,13 @@ async function deliverSlackSlashResponseWithWebApi(params) {
|
|
|
6096
6117
|
const mrkdwn = "mrkdwn" in payload && typeof payload.mrkdwn === "boolean" ? payload.mrkdwn : void 0;
|
|
6097
6118
|
if (payload.response_type === "in_channel") {
|
|
6098
6119
|
const postSlackMessage = params.client.chat.postMessage;
|
|
6099
|
-
|
|
6120
|
+
const response = await postSlackMessage({
|
|
6100
6121
|
channel: params.command.channel_id,
|
|
6101
6122
|
text,
|
|
6102
6123
|
...blocks ? { blocks } : {},
|
|
6103
6124
|
...mrkdwn !== void 0 ? { mrkdwn } : {}
|
|
6104
|
-
})
|
|
6125
|
+
});
|
|
6126
|
+
requireSlackPostMessageTimestamp(response);
|
|
6105
6127
|
} else await params.client.chat.postEphemeral({
|
|
6106
6128
|
channel: params.command.channel_id,
|
|
6107
6129
|
user: params.command.user_id,
|
|
@@ -6133,8 +6155,8 @@ async function getSlackBoltInterop() {
|
|
|
6133
6155
|
}
|
|
6134
6156
|
return slackBoltInterop;
|
|
6135
6157
|
}
|
|
6136
|
-
const loadSlackRelaySource = createLazyRuntimeModule(() => import("./relay-source-
|
|
6137
|
-
const SLACK_WEBHOOK_MAX_BODY_BYTES =
|
|
6158
|
+
const loadSlackRelaySource = createLazyRuntimeModule(() => import("./relay-source-BLMdBrAw.js"));
|
|
6159
|
+
const SLACK_WEBHOOK_MAX_BODY_BYTES = 1048576;
|
|
6138
6160
|
const SLACK_WEBHOOK_BODY_TIMEOUT_MS = 3e4;
|
|
6139
6161
|
function resolveSlackRuntimeIdentity(params) {
|
|
6140
6162
|
const botUserId = normalizeOptionalString(params.botUserId);
|
|
@@ -6275,8 +6297,9 @@ async function monitorSlackProvider(opts = {}) {
|
|
|
6275
6297
|
const groupDmChannels = dmConfig?.groupChannels;
|
|
6276
6298
|
let channelsConfig = slackCfg.channels;
|
|
6277
6299
|
const defaultGroupPolicy = resolveDefaultGroupPolicy(cfg);
|
|
6300
|
+
const providerConfigPresent = cfg.channels?.slack !== void 0;
|
|
6278
6301
|
const { groupPolicy, providerMissingFallbackApplied } = resolveOpenProviderRuntimeGroupPolicy$1({
|
|
6279
|
-
providerConfigPresent
|
|
6302
|
+
providerConfigPresent,
|
|
6280
6303
|
groupPolicy: slackCfg.groupPolicy,
|
|
6281
6304
|
defaultGroupPolicy
|
|
6282
6305
|
});
|
|
@@ -6577,10 +6600,11 @@ async function monitorSlackProvider(opts = {}) {
|
|
|
6577
6600
|
summarizeMapping("slack users", mapping, [], runtime);
|
|
6578
6601
|
}
|
|
6579
6602
|
if (allowNameMatching) try {
|
|
6580
|
-
const
|
|
6603
|
+
const resolvedUsers = await resolveSlackUserAllowlist({
|
|
6581
6604
|
token: resolveToken,
|
|
6582
6605
|
entries: allowEntries
|
|
6583
|
-
})
|
|
6606
|
+
});
|
|
6607
|
+
const { mapping, unresolved, additions } = buildAllowlistResolutionSummary(resolvedUsers, { formatResolved: formatSlackUserResolved });
|
|
6584
6608
|
allowFrom = mergeAllowlist({
|
|
6585
6609
|
existing: allowFrom,
|
|
6586
6610
|
additions
|
|
@@ -6607,10 +6631,11 @@ async function monitorSlackProvider(opts = {}) {
|
|
|
6607
6631
|
summarizeMapping("slack channel users", mapping, [], runtime);
|
|
6608
6632
|
}
|
|
6609
6633
|
if (allowNameMatching) try {
|
|
6610
|
-
const
|
|
6634
|
+
const resolvedUsers = await resolveSlackUserAllowlist({
|
|
6611
6635
|
token: resolveToken,
|
|
6612
6636
|
entries: Array.from(userEntries)
|
|
6613
|
-
})
|
|
6637
|
+
});
|
|
6638
|
+
const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(resolvedUsers, { formatResolved: formatSlackUserResolved });
|
|
6614
6639
|
const nextChannels = patchAllowlistUsersInConfigEntries({
|
|
6615
6640
|
entries: channelsConfig,
|
|
6616
6641
|
resolvedMap
|