@openclaw/slack 2026.9.8 → 2026.10.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{account-inspect-DWBXpER6.mjs → account-inspect-Cs-7DXXW.mjs} +1 -1
- package/dist/.setup/{accounts-D_N9IqNA.mjs → accounts-CDgkV7Cm.mjs} +4 -16
- package/dist/.setup/{action-runtime-DfWvuiZd.mjs → action-runtime-DJ1daRAZ.mjs} +5 -7
- package/dist/.setup/action-runtime.runtime-CdWL2mLC.mjs +2 -0
- package/dist/.setup/{actions-Df0CzcDl.mjs → actions-DDoAJnrH.mjs} +16 -35
- package/dist/.setup/{approval-handler.runtime-Ed6Sw5VK.mjs → approval-handler.runtime-BcE_shWc.mjs} +5 -5
- package/dist/.setup/{approval-message-updates-BadvtA7R.mjs → approval-message-updates-EgKGmFXx.mjs} +1 -1
- package/dist/.setup/{channel-C7bgPSTE.mjs → channel-DgKSu8Iv.mjs} +46 -48
- package/dist/.setup/{channel-type-ClOttrZ5.mjs → channel-type-B9zYYzBU.mjs} +4 -4
- package/dist/.setup/{channel.setup-Dh2jzAjN.mjs → channel.setup-BYIlwbQ7.mjs} +27 -27
- package/dist/.setup/{config-schema-BZCxmHKG.mjs → config-schema-BH0K9-Um.mjs} +4 -0
- package/dist/.setup/{directory-config-BOUWH3hR.mjs → directory-config-B_by7zrc.mjs} +2 -2
- package/dist/.setup/{directory-live-B2O4B_Ho.mjs → directory-live-C48wazJt.mjs} +3 -3
- package/dist/.setup/{doctor-contract-CRN1Z_c7.mjs → doctor-contract-Cd4-VzIM.mjs} +28 -28
- package/dist/.setup/{message-tool-api-Cu4lwlGy.mjs → message-tool-api-CcjLPN3v.mjs} +2 -2
- package/dist/.setup/{monitor-BPVfkumU.mjs → monitor-BuYBDmm7.mjs} +190 -315
- package/dist/.setup/{outbound-adapter-Bv48XUjq.mjs → outbound-adapter-BZFkK-mw.mjs} +6 -17
- package/dist/.setup/{pipeline.runtime-B1H63Frf.mjs → pipeline.runtime-CIepKmZt.mjs} +241 -247
- package/dist/.setup/{policy-D-jfM174.mjs → policy-KKTqEiDv.mjs} +12 -22
- package/dist/.setup/{probe-B2Y9qc_z.mjs → probe-BVlJ3dp0.mjs} +4 -7
- package/dist/.setup/{relay-source-BpKdjsll.mjs → relay-source-CC3h6M7y.mjs} +2 -2
- package/dist/.setup/{replies-BAnUtr2f.mjs → replies-DHbuthIR.mjs} +12 -26
- package/dist/.setup/{reply-blocks-SE1kTE3I.mjs → reply-blocks-CKnO4BSG.mjs} +4 -29
- package/dist/.setup/{resolve-channels-XXBn8UU_.mjs → resolve-channels-HR0TgArR.mjs} +2 -2
- package/dist/.setup/{resolve-users-DW0ngD03.mjs → resolve-users-BNYBhF0q.mjs} +4 -4
- package/dist/.setup/rolldown-runtime-B4FMCO8f.mjs +28 -0
- package/dist/.setup/{scopes-CasuDvaa.mjs → scopes-DrDbyUH2.mjs} +1 -1
- package/dist/.setup/secret-contract-B-Qm6aQQ.mjs +65 -0
- package/dist/.setup/{secret-contract-api-Dp6290Vg.mjs → secret-contract-api-DmUVxIRs.mjs} +1 -1
- package/dist/.setup/{security-audit-BqDc-6VL.mjs → security-audit-C1nOGzJa.mjs} +1 -1
- package/dist/.setup/{send-BOVLQi3n.mjs → send-CgPI3Zj8.mjs} +22 -53
- package/dist/.setup/{session-status-DscajIsd.mjs → session-status-D46GHwOV.mjs} +39 -49
- package/dist/.setup/{setup-plugin-api-DTtbTKNk.mjs → setup-plugin-api-ZrHs0N4U.mjs} +1 -1
- package/dist/.setup/{setup-surface-Dn7QgWRE.mjs → setup-surface-83lxvE2y.mjs} +10 -13
- package/dist/.setup/{shared-qau-uDGl.mjs → shared-VtmYNj-v.mjs} +53 -57
- package/dist/.setup/{slash-dispatch.runtime--AEzLVBF.mjs → slash-dispatch.runtime-gBj_uaLM.mjs} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/api.js +13 -13
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/control-ui/2f4b1e827be6b68ced2ea0d8b7da8529a4eafbe72be27ee37e1064bdd530ec10/index.js +1 -0
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/message-tool-api.js +1 -1
- package/dist/runtime-api.js +10 -10
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/setup-entry.js +2 -2
- package/dist/setup-plugin-api.js +1 -1
- package/node_modules/undici/README.md +10 -1
- package/node_modules/undici/docs/docs/api/Agent.md +8 -8
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
- package/node_modules/undici/docs/docs/api/Dispatcher.md +9 -0
- package/node_modules/undici/docs/docs/api/Errors.md +25 -0
- package/node_modules/undici/docs/docs/api/Fetch.md +10 -0
- package/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
- package/node_modules/undici/docs/docs/api/Pool.md +5 -6
- package/node_modules/undici/docs/docs/index.md +10 -1
- package/node_modules/undici/lib/api/readable.js +1 -2
- package/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/undici/lib/core/util.js +0 -39
- package/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
- package/node_modules/undici/lib/dispatcher/client.js +6 -1
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
- package/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
- package/node_modules/undici/lib/dispatcher/pool.js +90 -7
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
- package/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
- package/node_modules/undici/lib/handler/redirect-handler.js +5 -0
- package/node_modules/undici/lib/handler/retry-handler.js +72 -13
- package/node_modules/undici/lib/interceptor/cache.js +4 -1
- package/node_modules/undici/lib/interceptor/decompress.js +236 -69
- package/node_modules/undici/lib/web/cache/cache.js +17 -8
- package/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
- package/node_modules/undici/lib/web/cookies/index.js +19 -7
- package/node_modules/undici/lib/web/cookies/util.js +3 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
- package/node_modules/undici/lib/web/fetch/body.js +22 -15
- package/node_modules/undici/lib/web/fetch/data-url.js +6 -6
- package/node_modules/undici/lib/web/fetch/formdata.js +30 -36
- package/node_modules/undici/lib/web/fetch/headers.js +34 -31
- package/node_modules/undici/lib/web/fetch/index.js +46 -25
- package/node_modules/undici/lib/web/fetch/request.js +74 -79
- package/node_modules/undici/lib/web/fetch/response.js +43 -44
- package/node_modules/undici/lib/web/fetch/util.js +7 -7
- package/node_modules/undici/lib/web/infra/index.js +16 -1
- package/node_modules/undici/lib/web/webidl/index.js +2 -14
- package/node_modules/undici/lib/web/websocket/connection.js +33 -12
- package/node_modules/undici/lib/web/websocket/events.js +43 -26
- package/node_modules/undici/lib/web/websocket/receiver.js +2 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +19 -4
- package/node_modules/undici/lib/web/websocket/websocket.js +44 -41
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/diagnostics-channel.d.ts +2 -1
- package/node_modules/undici/types/interceptors.d.ts +1 -1
- package/node_modules/undici/types/webidl.d.ts +13 -7
- package/openclaw.plugin.json +4 -1
- package/package.json +14 -6
- package/dist/.setup/action-runtime.runtime-Ck4bAWOX.mjs +0 -2
- package/dist/.setup/secret-contract-BaZcu6P_.mjs +0 -82
- package/dist/.setup/streaming-compat-C5Wut626.mjs +0 -62
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as buildSlackChannelPolicyScope, r as buildSlackChannelIdCandidates } from "./session-status-
|
|
2
|
-
import { A as resolveSlackUserAllowListForTeam, O as normalizeSlackSlug } from "./probe-
|
|
1
|
+
import { i as buildSlackChannelPolicyScope, r as buildSlackChannelIdCandidates } from "./session-status-D46GHwOV.mjs";
|
|
2
|
+
import { A as resolveSlackUserAllowListForTeam, O as normalizeSlackSlug } from "./probe-BVlJ3dp0.mjs";
|
|
3
3
|
import { applyChannelMatchMeta, buildChannelKeyCandidates } from "openclaw/plugin-sdk/channel-targets";
|
|
4
4
|
import { firstDefined } from "openclaw/plugin-sdk/allow-from";
|
|
5
5
|
import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
|
|
@@ -32,33 +32,23 @@ function resolveSlackChannelConfig(params) {
|
|
|
32
32
|
requireMention: requireMentionDefault
|
|
33
33
|
};
|
|
34
34
|
const resolved = matched ?? fallback ?? {};
|
|
35
|
-
const allowed = firstDefined(resolved.enabled, fallback?.enabled, true) ?? true;
|
|
36
|
-
const requireMention = firstDefined(resolved.requireMention, fallback?.requireMention, requireMentionDefault) ?? requireMentionDefault;
|
|
37
|
-
const requireMentionInBotThreads = firstDefined(resolved.requireMentionInBotThreads, fallback?.requireMentionInBotThreads);
|
|
38
|
-
const ignoreOtherMentions = firstDefined(resolved.ignoreOtherMentions, fallback?.ignoreOtherMentions);
|
|
39
|
-
const allowBots = firstDefined(resolved.allowBots, fallback?.allowBots);
|
|
40
|
-
const replyToMode = firstDefined(resolved.replyToMode, fallback?.replyToMode);
|
|
41
|
-
const botLoopProtection = mergePairLoopGuardConfig(fallback?.botLoopProtection, matched?.botLoopProtection);
|
|
42
35
|
const users = resolveSlackUserAllowListForTeam({
|
|
43
36
|
allowList: firstDefined(resolved.users, fallback?.users),
|
|
44
37
|
teamId: params.teamId,
|
|
45
38
|
preserveUnmatchedScopedEntries: true
|
|
46
39
|
});
|
|
47
|
-
const skills = firstDefined(resolved.skills, fallback?.skills);
|
|
48
|
-
const systemPrompt = firstDefined(resolved.systemPrompt, fallback?.systemPrompt);
|
|
49
|
-
const presenceEvents = firstDefined(resolved.presenceEvents, fallback?.presenceEvents);
|
|
50
40
|
const result = {
|
|
51
|
-
allowed,
|
|
52
|
-
requireMention,
|
|
53
|
-
requireMentionInBotThreads,
|
|
54
|
-
ignoreOtherMentions,
|
|
55
|
-
replyToMode,
|
|
56
|
-
allowBots,
|
|
57
|
-
botLoopProtection,
|
|
41
|
+
allowed: firstDefined(resolved.enabled, fallback?.enabled, true) ?? true,
|
|
42
|
+
requireMention: firstDefined(resolved.requireMention, fallback?.requireMention, requireMentionDefault) ?? requireMentionDefault,
|
|
43
|
+
requireMentionInBotThreads: firstDefined(resolved.requireMentionInBotThreads, fallback?.requireMentionInBotThreads),
|
|
44
|
+
ignoreOtherMentions: firstDefined(resolved.ignoreOtherMentions, fallback?.ignoreOtherMentions),
|
|
45
|
+
replyToMode: firstDefined(resolved.replyToMode, fallback?.replyToMode),
|
|
46
|
+
allowBots: firstDefined(resolved.allowBots, fallback?.allowBots),
|
|
47
|
+
botLoopProtection: mergePairLoopGuardConfig(fallback?.botLoopProtection, matched?.botLoopProtection),
|
|
58
48
|
users: users.length > 0 ? users : void 0,
|
|
59
|
-
skills,
|
|
60
|
-
systemPrompt,
|
|
61
|
-
presenceEvents
|
|
49
|
+
skills: firstDefined(resolved.skills, fallback?.skills),
|
|
50
|
+
systemPrompt: firstDefined(resolved.systemPrompt, fallback?.systemPrompt),
|
|
51
|
+
presenceEvents: firstDefined(resolved.presenceEvents, fallback?.presenceEvents)
|
|
62
52
|
};
|
|
63
53
|
return applyChannelMatchMeta(result, match);
|
|
64
54
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { p as formatSlackBotTokenIdentityWarning } from "./accounts-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
+
import { p as formatSlackBotTokenIdentityWarning } from "./accounts-CDgkV7Cm.mjs";
|
|
3
3
|
import { a as parseSlackTarget } from "./target-parsing-FFE26kOV.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { isRecord, normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -443,11 +443,8 @@ function addScalarDetail(details, label, value) {
|
|
|
443
443
|
}
|
|
444
444
|
function addStringListDetail(details, label, value) {
|
|
445
445
|
if (!Array.isArray(value)) return;
|
|
446
|
-
const entries =
|
|
447
|
-
|
|
448
|
-
const trimmed = redactSensitiveText(entry.trim());
|
|
449
|
-
return trimmed ? [trimmed] : [];
|
|
450
|
-
});
|
|
446
|
+
const entries = [];
|
|
447
|
+
for (const entry of value) addStringDetail(entries, "", entry);
|
|
451
448
|
if (entries.length) details.push(`${label}: ${entries.join(", ")}`);
|
|
452
449
|
}
|
|
453
450
|
function safeStringify(value) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as formatSlackError } from "./probe-
|
|
2
|
-
import { d as parseSlackMessageEvent, f as requireSlackMessageEvent, x as SLACK_SOCKET_RECONNECT_POLICY } from "./monitor-
|
|
1
|
+
import { o as formatSlackError } from "./probe-BVlJ3dp0.mjs";
|
|
2
|
+
import { d as parseSlackMessageEvent, f as requireSlackMessageEvent, x as SLACK_SOCKET_RECONNECT_POLICY } from "./monitor-BuYBDmm7.mjs";
|
|
3
3
|
import { asOptionalRecord, normalizeOptionalString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { computeBackoff, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
5
5
|
import { createNodeProxyAgent } from "openclaw/plugin-sdk/fetch-runtime";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { C as buildSlackBlocksFallbackText,
|
|
2
|
-
import { n as iterateSlackReplyDeliveryMessages, o as resolveSlackReplyBlockResolution, t as hasSlackReplyStructuredContent } from "./reply-blocks-
|
|
1
|
+
import { C as buildSlackBlocksFallbackText, J as markdownToSlackMrkdwnChunks, b as isSlackInvalidBlocksResponse, g as buildSlackNativeDataAccessibilityText, k as SLACK_TEXT_LIMIT, v as hasSlackNativeDataBlock, x as isSlackNativeResponseUrlRejection } from "./session-status-D46GHwOV.mjs";
|
|
2
|
+
import { n as iterateSlackReplyDeliveryMessages, o as resolveSlackReplyBlockResolution, t as hasSlackReplyStructuredContent } from "./reply-blocks-CKnO4BSG.mjs";
|
|
3
3
|
import { n as resolveSlackReplyThreadTs } from "./thread-ts-Cvt7WD6B.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { a as SlackResponseAlreadyReportedError, o as createSlackResponseUrlBudget } from "./monitor-
|
|
6
|
-
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
4
|
+
import { h as chunkSlackTextAtHardLimit, m as buildSlackNativeDataDeliveryPlan, t as sendMessageSlack } from "./send-CgPI3Zj8.mjs";
|
|
5
|
+
import { a as SlackResponseAlreadyReportedError, o as createSlackResponseUrlBudget } from "./monitor-BuYBDmm7.mjs";
|
|
7
6
|
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
8
7
|
import { createReplyReferencePlanner } from "openclaw/plugin-sdk/reply-reference";
|
|
9
8
|
import { deliverTextOrMediaReply, getReplyPayloadTtsSupplement, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
@@ -11,7 +10,7 @@ import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
|
11
10
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
12
11
|
import { SILENT_REPLY_TOKEN, chunkMarkdownTextWithMode, isSilentReplyText } from "openclaw/plugin-sdk/reply-chunking";
|
|
13
12
|
import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
|
|
14
|
-
import { createChannelPartialDeliveryError, getGroupThreadDeliverySession } from "openclaw/plugin-sdk/channel-inbound";
|
|
13
|
+
import { createAcceptedChannelDeliveryResult, createChannelPartialDeliveryError, getGroupThreadDeliverySession } from "openclaw/plugin-sdk/channel-inbound";
|
|
15
14
|
import { buildCanonicalSentMessageHookContext, createInternalHookEvent, fireAndForgetHook, toInternalMessageSentContext, toPluginMessageContext, toPluginMessageSentEvent, triggerInternalHook } from "openclaw/plugin-sdk/hook-runtime";
|
|
16
15
|
//#region extensions/slack/src/message-sent-hook.ts
|
|
17
16
|
function emitSlackMessageSentHooks(params) {
|
|
@@ -213,12 +212,7 @@ async function deliverReplies(params) {
|
|
|
213
212
|
error: formatErrorMessage(error)
|
|
214
213
|
});
|
|
215
214
|
if (acceptedResults.length === 0) throw error;
|
|
216
|
-
|
|
217
|
-
throw createChannelPartialDeliveryError(error, {
|
|
218
|
-
messageIds: receipt.platformMessageIds,
|
|
219
|
-
receipt,
|
|
220
|
-
visibleReplySent: true
|
|
221
|
-
});
|
|
215
|
+
throw createChannelPartialDeliveryError(error, createAcceptedChannelDeliveryResult({ results: acceptedResults }));
|
|
222
216
|
}
|
|
223
217
|
if (delivered) {
|
|
224
218
|
emitDelivery(hookParts.join("\n\n") || textRaw || spokenText || "", {
|
|
@@ -338,15 +332,15 @@ async function deliverSlackSlashReplies(params) {
|
|
|
338
332
|
...message.blocks ? { blocks: message.blocks } : {},
|
|
339
333
|
...message.mrkdwn === false ? { mrkdwn: false } : {}
|
|
340
334
|
});
|
|
341
|
-
const
|
|
335
|
+
const emitDelivery = (delivery, success, error) => {
|
|
342
336
|
if (!params.messageSentHookTarget) return;
|
|
343
337
|
emitSlackMessageSentHooks({
|
|
344
338
|
sessionKeyForInternalHooks: params.sessionKeyForInternalHooks,
|
|
345
339
|
to: params.messageSentHookTarget,
|
|
346
340
|
accountId: params.accountId,
|
|
347
341
|
content: delivery.hookContent,
|
|
348
|
-
success
|
|
349
|
-
error: formatErrorMessage(error),
|
|
342
|
+
success,
|
|
343
|
+
...success ? {} : { error: formatErrorMessage(error) },
|
|
350
344
|
isGroup: params.isGroup,
|
|
351
345
|
groupId: params.groupId
|
|
352
346
|
});
|
|
@@ -367,7 +361,7 @@ async function deliverSlackSlashReplies(params) {
|
|
|
367
361
|
failure = error;
|
|
368
362
|
}
|
|
369
363
|
for (const delivery of deliveries) {
|
|
370
|
-
|
|
364
|
+
emitDelivery(delivery, false, failure);
|
|
371
365
|
params.onReplySettled?.({
|
|
372
366
|
replyIndex: delivery.replyIndex,
|
|
373
367
|
visibleReplySent: false,
|
|
@@ -423,7 +417,7 @@ async function deliverSlackSlashReplies(params) {
|
|
|
423
417
|
content: delivery.hookContent,
|
|
424
418
|
visibleReplySent: true
|
|
425
419
|
}) : error;
|
|
426
|
-
|
|
420
|
+
emitDelivery(delivery, false, deliveryError);
|
|
427
421
|
params.onReplySettled?.({
|
|
428
422
|
replyIndex: delivery.replyIndex,
|
|
429
423
|
visibleReplySent,
|
|
@@ -431,15 +425,7 @@ async function deliverSlackSlashReplies(params) {
|
|
|
431
425
|
});
|
|
432
426
|
throw deliveryError;
|
|
433
427
|
}
|
|
434
|
-
|
|
435
|
-
sessionKeyForInternalHooks: params.sessionKeyForInternalHooks,
|
|
436
|
-
to: params.messageSentHookTarget,
|
|
437
|
-
accountId: params.accountId,
|
|
438
|
-
content: delivery.hookContent,
|
|
439
|
-
success: true,
|
|
440
|
-
isGroup: params.isGroup,
|
|
441
|
-
groupId: params.groupId
|
|
442
|
-
});
|
|
428
|
+
emitDelivery(delivery, true);
|
|
443
429
|
params.onReplySettled?.({
|
|
444
430
|
replyIndex: delivery.replyIndex,
|
|
445
431
|
visibleReplySent: true
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as buildSlackBlocksFallbackText, G as encodeSlackQuestionAction, J as markdownToSlackMrkdwnChunks, N as SLACK_BUTTON_ACTION_IDS, Q as hasSlackDataVisualizationBlock, R as SLACK_SELECT_ACTION_IDS, T as renderSlackBlockFallbackText, X as buildSlackDataVisualizationBlock, Z as canRenderSlackDataVisualization, et as buildSlackDataTableBlock, ft as SLACK_SECTION_TEXT_MAX, g as buildSlackNativeDataAccessibilityText, it as renderSlackMessagePresentationChartFallbackText, j as truncateSlackText, lt as encodeSlackApprovalAction, m as appendSlackNativeDataFallbackText, mt as parseSlackBlocksInput, nt as countSlackDataTableCellCharacters, q as chunkSlackMrkdwnText, rt as resolveSlackDataTableCellCharacterCount, tt as countSlackDataTableBlocksCellCharacters, v as hasSlackNativeDataBlock, w as buildSlackCompleteBlocksFallbackText } from "./session-status-D46GHwOV.mjs";
|
|
2
2
|
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
|
|
4
4
|
import { legacyInteractiveReplyToPresentation, normalizeMessagePresentation, renderMessagePresentationFallbackText, resolveMessagePresentationButtonAction, resolveMessagePresentationOptionAction } from "openclaw/plugin-sdk/interactive-runtime";
|
|
@@ -6,18 +6,6 @@ import { parseExecApprovalCommandText } from "openclaw/plugin-sdk/approval-reply
|
|
|
6
6
|
import { resolveAskUserQuestionOptionIndex, resolveAskUserQuestionOptionIndices, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
7
7
|
//#region extensions/slack/src/blocks-render.ts
|
|
8
8
|
const SLACK_BUTTON_URL_MAX = 3e3;
|
|
9
|
-
const SLACK_BUTTON_ACTION_IDS = {
|
|
10
|
-
approval: SLACK_APPROVAL_BUTTON_ACTION_ID,
|
|
11
|
-
callback: SLACK_CALLBACK_BUTTON_ACTION_ID,
|
|
12
|
-
link: SLACK_REPLY_LINK_ACTION_ID,
|
|
13
|
-
question: SLACK_QUESTION_BUTTON_ACTION_ID,
|
|
14
|
-
reply: SLACK_REPLY_BUTTON_ACTION_ID
|
|
15
|
-
};
|
|
16
|
-
const SLACK_SELECT_ACTION_IDS = {
|
|
17
|
-
approval: SLACK_APPROVAL_SELECT_ACTION_ID,
|
|
18
|
-
callback: SLACK_CALLBACK_SELECT_ACTION_ID,
|
|
19
|
-
reply: SLACK_REPLY_SELECT_ACTION_ID
|
|
20
|
-
};
|
|
21
9
|
function resolveSlackButtonStyle(style) {
|
|
22
10
|
if (style === "primary" || style === "danger") return style;
|
|
23
11
|
if (style === "success") return "primary";
|
|
@@ -326,9 +314,6 @@ function buildSlackPresentationSelectBlock(block, selectIndex) {
|
|
|
326
314
|
function normalizeComparableSlackText(text) {
|
|
327
315
|
return text.trim().replace(/\s+/g, " ");
|
|
328
316
|
}
|
|
329
|
-
function isSlackAuthoredTextRepresentedInInteractive(text, interactive) {
|
|
330
|
-
return isSlackAuthoredTextRepresentedInFragments(text, interactive?.blocks.flatMap((block) => block.type === "text" ? [block.text] : []) ?? []);
|
|
331
|
-
}
|
|
332
317
|
function isSlackAuthoredTextRepresentedInFragments(text, rawFragments) {
|
|
333
318
|
const target = normalizeComparableSlackText(text);
|
|
334
319
|
const fragments = rawFragments.map(normalizeComparableSlackText).filter(Boolean);
|
|
@@ -352,7 +337,7 @@ function isSlackAuthoredTextRepresentedInFragments(text, rawFragments) {
|
|
|
352
337
|
function resolveSlackAuthoredTextPlacement(params) {
|
|
353
338
|
const text = normalizeOptionalString(params.text);
|
|
354
339
|
if (!text) return "none";
|
|
355
|
-
return params.renderedInBlocks || isSlackAuthoredTextRepresentedInFragments(text, params.renderedTextFragments ?? []) ||
|
|
340
|
+
return params.renderedInBlocks || isSlackAuthoredTextRepresentedInFragments(text, params.renderedTextFragments ?? []) || isSlackAuthoredTextRepresentedInFragments(text, params.interactive?.blocks.flatMap((block) => block.type === "text" ? [block.text] : []) ?? []) ? "blocks" : "outside-blocks";
|
|
356
341
|
}
|
|
357
342
|
//#endregion
|
|
358
343
|
//#region extensions/slack/src/reply-blocks.ts
|
|
@@ -606,18 +591,8 @@ function appendPresentationPart(segments, presentation, questionOptionIndices) {
|
|
|
606
591
|
}
|
|
607
592
|
appendTextSegment(segments, renderMessagePresentationFallbackText({ presentation }));
|
|
608
593
|
}
|
|
609
|
-
const SLACK_BUTTON_CONTROL_ACTION_IDS =
|
|
610
|
-
|
|
611
|
-
SLACK_CALLBACK_BUTTON_ACTION_ID,
|
|
612
|
-
SLACK_QUESTION_BUTTON_ACTION_ID,
|
|
613
|
-
SLACK_REPLY_BUTTON_ACTION_ID,
|
|
614
|
-
SLACK_REPLY_LINK_ACTION_ID
|
|
615
|
-
];
|
|
616
|
-
const SLACK_SELECT_CONTROL_ACTION_IDS = [
|
|
617
|
-
SLACK_APPROVAL_SELECT_ACTION_ID,
|
|
618
|
-
SLACK_CALLBACK_SELECT_ACTION_ID,
|
|
619
|
-
SLACK_REPLY_SELECT_ACTION_ID
|
|
620
|
-
];
|
|
594
|
+
const SLACK_BUTTON_CONTROL_ACTION_IDS = Object.values(SLACK_BUTTON_ACTION_IDS);
|
|
595
|
+
const SLACK_SELECT_CONTROL_ACTION_IDS = Object.values(SLACK_SELECT_ACTION_IDS);
|
|
621
596
|
function readGeneratedSlackControlRowKey(block) {
|
|
622
597
|
const record = block;
|
|
623
598
|
if (record.type !== "actions" || typeof record.block_id !== "string") return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
2
|
import { s as resolveWorkspaceQualifiedSlackTarget } from "./target-parsing-FFE26kOV.mjs";
|
|
3
|
-
import { c as collectSlackCursorPages, l as fetchSlackChannelListPage, u as createSlackLookupClient } from "./probe-
|
|
3
|
+
import { c as collectSlackCursorPages, l as fetchSlackChannelListPage, u as createSlackLookupClient } from "./probe-BVlJ3dp0.mjs";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { resolveDirectoryAllowlistEntries } from "openclaw/plugin-sdk/directory-runtime";
|
|
6
6
|
//#region extensions/slack/src/resolve-channels.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
2
|
import { s as resolveWorkspaceQualifiedSlackTarget } from "./target-parsing-FFE26kOV.mjs";
|
|
3
|
-
import { c as collectSlackCursorPages, u as createSlackLookupClient } from "./probe-
|
|
4
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
import { c as collectSlackCursorPages, u as createSlackLookupClient } from "./probe-BVlJ3dp0.mjs";
|
|
4
|
+
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { resolveDirectoryAllowlistEntries } from "openclaw/plugin-sdk/directory-runtime";
|
|
6
6
|
//#region extensions/slack/src/resolve-users.ts
|
|
7
7
|
var resolve_users_exports = /* @__PURE__ */ __exportAll({ resolveSlackUserAllowlist: () => resolveSlackUserAllowlist });
|
|
@@ -32,7 +32,7 @@ async function listSlackUsers(client) {
|
|
|
32
32
|
name,
|
|
33
33
|
displayName: normalizeOptionalString(profile.display_name),
|
|
34
34
|
realName: normalizeOptionalString(profile.real_name) ?? normalizeOptionalString(member.real_name),
|
|
35
|
-
email:
|
|
35
|
+
email: normalizeOptionalLowercaseString(profile.email),
|
|
36
36
|
deleted: Boolean(member.deleted),
|
|
37
37
|
isBot: Boolean(member.is_bot),
|
|
38
38
|
isAppUser: Boolean(member.is_app_user)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __exportAll = (all, no_symbols) => {
|
|
8
|
+
let target = {};
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
18
|
+
key = keys[i];
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
20
|
+
get: ((k) => from[k]).bind(null, key),
|
|
21
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
27
|
+
//#endregion
|
|
28
|
+
export { __reExport as n, __exportAll as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as createSlackReadClient, o as formatSlackError } from "./probe-
|
|
1
|
+
import { d as createSlackReadClient, o as formatSlackError } from "./probe-BVlJ3dp0.mjs";
|
|
2
2
|
import { isRecord, normalizeOptionalString, normalizeTrimmedStringList, sortUniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
//#region extensions/slack/src/scopes.ts
|
|
4
4
|
function collectScopes(value, into) {
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { collectConditionalChannelFieldAssignments, collectNestedChannelFieldAssignments, collectSimpleChannelFieldAssignments, createChannelSecretContract, hasOwnProperty } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
2
|
+
//#region extensions/slack/src/secret-contract.ts
|
|
3
|
+
const channelSecrets = createChannelSecretContract({
|
|
4
|
+
channelKey: "slack",
|
|
5
|
+
account: [
|
|
6
|
+
"appToken",
|
|
7
|
+
"relay.authToken",
|
|
8
|
+
"botToken",
|
|
9
|
+
"signingSecret",
|
|
10
|
+
"userToken"
|
|
11
|
+
],
|
|
12
|
+
channel: [
|
|
13
|
+
"appToken",
|
|
14
|
+
"botToken",
|
|
15
|
+
"relay.authToken",
|
|
16
|
+
"signingSecret",
|
|
17
|
+
"userToken"
|
|
18
|
+
],
|
|
19
|
+
collect(params) {
|
|
20
|
+
const { channel: slack, surface } = params;
|
|
21
|
+
const resolveMode = (value) => value === "http" || value === "socket" || value === "relay" ? value : void 0;
|
|
22
|
+
const baseMode = resolveMode(slack.mode) ?? "socket";
|
|
23
|
+
for (const field of ["botToken", "userToken"]) collectSimpleChannelFieldAssignments({
|
|
24
|
+
...params,
|
|
25
|
+
field,
|
|
26
|
+
topInactiveReason: `no enabled account inherits this top-level Slack ${field}.`,
|
|
27
|
+
accountInactiveReason: "Slack account is disabled."
|
|
28
|
+
});
|
|
29
|
+
const resolveAccountMode = (account) => resolveMode(account.mode) ?? baseMode;
|
|
30
|
+
const hasNestedAuthTokenOverride = (account) => {
|
|
31
|
+
const relay = account.relay;
|
|
32
|
+
return relay !== null && typeof relay === "object" && !Array.isArray(relay) && hasOwnProperty(relay, "authToken");
|
|
33
|
+
};
|
|
34
|
+
for (const [field, mode, label] of [[
|
|
35
|
+
"appToken",
|
|
36
|
+
"socket",
|
|
37
|
+
"socket"
|
|
38
|
+
], [
|
|
39
|
+
"signingSecret",
|
|
40
|
+
"http",
|
|
41
|
+
"HTTP"
|
|
42
|
+
]]) collectConditionalChannelFieldAssignments({
|
|
43
|
+
...params,
|
|
44
|
+
field,
|
|
45
|
+
topLevelActiveWithoutAccounts: baseMode === mode,
|
|
46
|
+
topLevelInheritedAccountActive: ({ account, enabled }) => enabled && !hasOwnProperty(account, field) && resolveAccountMode(account) === mode,
|
|
47
|
+
accountActive: ({ account, enabled }) => enabled && resolveAccountMode(account) === mode,
|
|
48
|
+
topInactiveReason: `no enabled Slack ${label}-mode surface inherits this top-level ${field}.`,
|
|
49
|
+
accountInactiveReason: `Slack account is disabled or not running in ${label} mode.`
|
|
50
|
+
});
|
|
51
|
+
collectNestedChannelFieldAssignments({
|
|
52
|
+
...params,
|
|
53
|
+
nestedKey: "relay",
|
|
54
|
+
field: "authToken",
|
|
55
|
+
topLevelActive: surface.channelEnabled && (!surface.hasExplicitAccounts && baseMode === "relay" || surface.accounts.some(({ account, enabled }) => enabled && resolveAccountMode(account) === "relay" && !hasNestedAuthTokenOverride(account))),
|
|
56
|
+
topLevelInheritedAccountActive: ({ account, enabled }) => enabled && resolveAccountMode(account) === "relay" && !hasNestedAuthTokenOverride(account),
|
|
57
|
+
topInactiveReason: "no enabled Slack relay-mode surface inherits this top-level relay authToken.",
|
|
58
|
+
accountActive: ({ account, enabled }) => enabled && resolveAccountMode(account) === "relay",
|
|
59
|
+
accountInactiveReason: "Slack account is disabled or not running in relay mode."
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const { secretTargetRegistryEntries, collectRuntimeConfigAssignments } = channelSecrets;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { collectRuntimeConfigAssignments as n, secretTargetRegistryEntries as r, channelSecrets as t };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-
|
|
1
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-B-Qm6aQQ.mjs";
|
|
2
2
|
import "../secret-contract-api.js";
|
|
3
3
|
export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
2
|
import { readChannelAllowFromStore } from "openclaw/plugin-sdk/conversation-runtime";
|
|
3
3
|
import { coerceNativeSetting, normalizeAllowFromList } from "openclaw/plugin-sdk/channel-policy";
|
|
4
4
|
import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled } from "openclaw/plugin-sdk/native-command-config-runtime";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as resolveSlackOperationToken, s as resolveSlackAccount } from "./accounts-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
+
import { d as resolveSlackOperationToken, s as resolveSlackAccount } from "./accounts-CDgkV7Cm.mjs";
|
|
3
3
|
import { a as parseSlackTarget, t as canonicalizeSlackApiTargetId } from "./target-parsing-FFE26kOV.mjs";
|
|
4
|
-
import { D as SLACK_MESSAGE_TEXT_HARD_LIMIT, E as SLACK_EDIT_TEXT_MAX_BYTES,
|
|
5
|
-
import { _ as getSlackWriteClient, d as createSlackReadClient, h as createSlackWriteClient, o as formatSlackError, p as createSlackTokenCacheKey, s as getSlackWebApiErrorData } from "./probe-
|
|
4
|
+
import { D as SLACK_MESSAGE_TEXT_HARD_LIMIT, E as SLACK_EDIT_TEXT_MAX_BYTES, J as markdownToSlackMrkdwnChunks, M as truncateSlackTextByUtf8Bytes, O as SLACK_MESSAGE_TEXT_RECOMMENDED_LIMIT, P as SLACK_QUESTION_FINALIZATION_BLOCKS, S as stripSlackNativeDataBlocks, T as renderSlackBlockFallbackText, U as resolveSlackQuestionActionIds, _ as createSlackNativeDataBaseTextConsumer, f as assertSlackDetachedTargetAllowed, g as buildSlackNativeDataAccessibilityText, h as appendSlackNativeDataPlainTextFallback, ht as validateSlackBlocksArray, j as truncateSlackText, k as SLACK_TEXT_LIMIT, q as chunkSlackMrkdwnText, v as hasSlackNativeDataBlock, w as buildSlackCompleteBlocksFallbackText, y as isSlackInvalidBlocksError } from "./session-status-D46GHwOV.mjs";
|
|
5
|
+
import { _ as getSlackWriteClient, d as createSlackReadClient, h as createSlackWriteClient, o as formatSlackError, p as createSlackTokenCacheKey, s as getSlackWebApiErrorData } from "./probe-BVlJ3dp0.mjs";
|
|
6
6
|
import { r as resolveSlackThreadTsValue, t as normalizeSlackThreadTsCandidate } from "./thread-ts-Cvt7WD6B.mjs";
|
|
7
7
|
import { t as getOptionalSlackRuntime } from "./runtime-JSVZSWAj.mjs";
|
|
8
8
|
import { isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -129,19 +129,15 @@ function buildSlackMessageIdentityPayload(identity) {
|
|
|
129
129
|
...identity?.iconUrl ? { icon_url: identity.iconUrl } : identity?.iconEmoji ? { icon_emoji: identity.iconEmoji } : {}
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
const data = getSlackWebApiErrorData(err);
|
|
134
|
-
if (normalizeLowercaseStringOrEmpty(normalizeOptionalString(data?.error)) !== "missing_scope") return false;
|
|
135
|
-
if (normalizeLowercaseStringOrEmpty(normalizeOptionalString(data?.needed)).includes("chat:write.customize")) return true;
|
|
136
|
-
return [...normalizeTrimmedStringList(data?.response_metadata?.scopes), ...normalizeTrimmedStringList(data?.response_metadata?.acceptedScopes)].map((scope) => normalizeLowercaseStringOrEmpty(scope)).includes("chat:write.customize");
|
|
137
|
-
}
|
|
138
|
-
function isSlackCustomIdentityRejectedError(err) {
|
|
139
|
-
if (isSlackCustomizeScopeError(err)) return true;
|
|
132
|
+
function classifySlackCustomIdentityError(err) {
|
|
140
133
|
const data = getSlackWebApiErrorData(err);
|
|
141
134
|
const code = normalizeLowercaseStringOrEmpty(normalizeOptionalString(data?.error));
|
|
142
|
-
|
|
135
|
+
if (code === "invalid_arguments" || code === "invalid_arg_name") return "argument";
|
|
136
|
+
if (code !== "missing_scope") return;
|
|
137
|
+
if (normalizeLowercaseStringOrEmpty(normalizeOptionalString(data?.needed)).includes("chat:write.customize")) return "scope";
|
|
138
|
+
return [...normalizeTrimmedStringList(data?.response_metadata?.scopes), ...normalizeTrimmedStringList(data?.response_metadata?.acceptedScopes)].map((scope) => normalizeLowercaseStringOrEmpty(scope)).includes("chat:write.customize") ? "scope" : void 0;
|
|
143
139
|
}
|
|
144
|
-
function
|
|
140
|
+
function hasSlackMessageIdentity(identity) {
|
|
145
141
|
return Boolean(identity?.username || identity?.iconUrl || identity?.iconEmoji);
|
|
146
142
|
}
|
|
147
143
|
/** Post with the requested identity, degrading only on Slack identity-specific errors. */
|
|
@@ -154,8 +150,10 @@ async function postSlackMessageWithIdentityFallback(params) {
|
|
|
154
150
|
...buildSlackMessageIdentityPayload(identity)
|
|
155
151
|
}, identity);
|
|
156
152
|
} catch (err) {
|
|
157
|
-
if (!identity || !
|
|
158
|
-
|
|
153
|
+
if (!identity || !hasSlackMessageIdentity(identity)) throw err;
|
|
154
|
+
const rejection = classifySlackCustomIdentityError(err);
|
|
155
|
+
if (!rejection) throw err;
|
|
156
|
+
if (rejection === "argument" && identity.username && (identity.iconUrl || identity.iconEmoji)) {
|
|
159
157
|
logVerbose("slack send: custom icon rejected, retrying with username only");
|
|
160
158
|
try {
|
|
161
159
|
return await post({
|
|
@@ -163,7 +161,7 @@ async function postSlackMessageWithIdentityFallback(params) {
|
|
|
163
161
|
username: identity.username
|
|
164
162
|
}, { username: identity.username });
|
|
165
163
|
} catch (retryError) {
|
|
166
|
-
if (!
|
|
164
|
+
if (!classifySlackCustomIdentityError(retryError)) throw retryError;
|
|
167
165
|
}
|
|
168
166
|
}
|
|
169
167
|
logVerbose("slack send: custom identity rejected, retrying without custom identity");
|
|
@@ -231,10 +229,6 @@ function readSlackRequestErrorCode(value) {
|
|
|
231
229
|
const code = value.code;
|
|
232
230
|
return typeof code === "string" ? code.toUpperCase() : void 0;
|
|
233
231
|
}
|
|
234
|
-
function readSlackRequestErrorMessage$1(value) {
|
|
235
|
-
if (value instanceof Error) return value.message;
|
|
236
|
-
return typeof value === "string" ? value : "";
|
|
237
|
-
}
|
|
238
232
|
function hasSlackDnsRequestSignal(err) {
|
|
239
233
|
let current = err;
|
|
240
234
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -243,7 +237,7 @@ function hasSlackDnsRequestSignal(err) {
|
|
|
243
237
|
seen.add(current);
|
|
244
238
|
const code = readSlackRequestErrorCode(current);
|
|
245
239
|
if (code && SLACK_DNS_RETRY_CODES.has(code)) return true;
|
|
246
|
-
const message =
|
|
240
|
+
const message = current instanceof Error ? current.message : "";
|
|
247
241
|
if (/\b(EAI_AGAIN|ENOTFOUND|UND_ERR_DNS_RESOLVE_FAILED)\b/i.test(message)) return true;
|
|
248
242
|
current = current.original ?? current.cause;
|
|
249
243
|
}
|
|
@@ -551,9 +545,6 @@ const SLACK_RECONCILE_MAX_PAGES = 10;
|
|
|
551
545
|
const SLACK_ENTERPRISE_LISTENER_QUEUE_CREDENTIAL = "listener-scoped-enterprise";
|
|
552
546
|
const slackSendQueue = new KeyedAsyncQueue();
|
|
553
547
|
const slackDefaultSendIdentities = /* @__PURE__ */ new Map();
|
|
554
|
-
function hasCustomIdentity(identity) {
|
|
555
|
-
return Boolean(identity?.username || identity?.iconUrl || identity?.iconEmoji);
|
|
556
|
-
}
|
|
557
548
|
function normalizeSlackSendIdentity(identity) {
|
|
558
549
|
const username = normalizeOptionalString(identity?.username);
|
|
559
550
|
const iconUrl = normalizeOptionalString(identity?.iconUrl);
|
|
@@ -563,7 +554,7 @@ function normalizeSlackSendIdentity(identity) {
|
|
|
563
554
|
...iconUrl ? { iconUrl } : {},
|
|
564
555
|
...iconEmoji ? { iconEmoji } : {}
|
|
565
556
|
};
|
|
566
|
-
return
|
|
557
|
+
return hasSlackMessageIdentity(normalized) ? normalized : void 0;
|
|
567
558
|
}
|
|
568
559
|
function setSlackDefaultSendIdentity(accountId, identity) {
|
|
569
560
|
const normalizedAccountId = normalizeOptionalString(accountId);
|
|
@@ -576,9 +567,6 @@ function getSlackDefaultSendIdentity(accountId) {
|
|
|
576
567
|
const normalizedAccountId = normalizeOptionalString(accountId);
|
|
577
568
|
return normalizedAccountId ? slackDefaultSendIdentities.get(normalizedAccountId) : void 0;
|
|
578
569
|
}
|
|
579
|
-
function resolveSlackSendIdentity(params) {
|
|
580
|
-
return normalizeSlackSendIdentity(params.explicit) ?? getSlackDefaultSendIdentity(params.accountId);
|
|
581
|
-
}
|
|
582
570
|
function formatSlackWebApiErrorMessage(err) {
|
|
583
571
|
if (!(err instanceof Error)) return;
|
|
584
572
|
const data = getSlackWebApiErrorData(err);
|
|
@@ -725,10 +713,7 @@ function resolveSlackDelivery(params) {
|
|
|
725
713
|
client,
|
|
726
714
|
...client !== cachedClient ? { dmCacheOwner: cachedClient } : {},
|
|
727
715
|
credential,
|
|
728
|
-
identity:
|
|
729
|
-
accountId: params.account.accountId,
|
|
730
|
-
explicit: params.opts.identity
|
|
731
|
-
}),
|
|
716
|
+
identity: normalizeSlackSendIdentity(params.opts.identity) ?? getSlackDefaultSendIdentity(params.account.accountId),
|
|
732
717
|
recipient: params.recipient,
|
|
733
718
|
teamId: params.recipient.teamId,
|
|
734
719
|
unfurl: params.recipient.teamId ? { unfurlMedia: params.account.config.unfurlMedia } : {
|
|
@@ -742,10 +727,6 @@ function createSlackSendQueueKey(params) {
|
|
|
742
727
|
const workspaceScope = params.teamId ? `:${params.teamId}` : "";
|
|
743
728
|
return `${params.accountId}:${createSlackTokenCacheKey(params.token)}${workspaceScope}:${recipientKey}:${params.threadTs ?? ""}`;
|
|
744
729
|
}
|
|
745
|
-
function resolveDirectUserPostChannelId(params) {
|
|
746
|
-
if (params.recipient.kind !== "user" || params.hasMedia || params.threadTs) return;
|
|
747
|
-
return params.recipient.id;
|
|
748
|
-
}
|
|
749
730
|
function resolvePostedMessageChannelId(response, fallback) {
|
|
750
731
|
return (typeof response.channel === "string" ? normalizeOptionalString(response.channel) : null) ?? fallback;
|
|
751
732
|
}
|
|
@@ -758,19 +739,11 @@ async function resolveChannelId(client, recipient, params) {
|
|
|
758
739
|
recipientId: recipient.id
|
|
759
740
|
};
|
|
760
741
|
const cachedChannelId = readCachedSlackDmChannelId(cacheParams);
|
|
761
|
-
if (cachedChannelId) return {
|
|
762
|
-
channelId: cachedChannelId,
|
|
763
|
-
isDm: true,
|
|
764
|
-
cacheHit: true
|
|
765
|
-
};
|
|
742
|
+
if (cachedChannelId) return { channelId: cachedChannelId };
|
|
766
743
|
const channelId = (await withSlackDnsRequestRetry("conversations.open", () => client.conversations.open({ users: recipient.id })).catch(rethrowSlackPermanentOutboundApiRejection)).channel?.id;
|
|
767
744
|
if (!channelId) throw new Error("Failed to open Slack DM channel");
|
|
768
745
|
cacheSlackDmChannelId(cacheParams, channelId);
|
|
769
|
-
return {
|
|
770
|
-
channelId,
|
|
771
|
-
isDm: true,
|
|
772
|
-
cacheHit: false
|
|
773
|
-
};
|
|
746
|
+
return { channelId };
|
|
774
747
|
}
|
|
775
748
|
function resolveSlackTextChunkLimit(params) {
|
|
776
749
|
const configuredLimit = params.textLimit ?? resolveTextChunkLimit(params.cfg, "slack", params.accountId, { fallbackLimit: 8e3 });
|
|
@@ -1092,11 +1065,7 @@ async function sendMessageSlackQueued(params) {
|
|
|
1092
1065
|
const { opts, cfg, account, blocks, trimmedMessage, delivery } = params;
|
|
1093
1066
|
const { client, identity, recipient, unfurl } = delivery;
|
|
1094
1067
|
if (opts.replyBroadcast && opts.mediaUrl) throw new Error("Slack replyBroadcast is only supported for text or block thread replies.");
|
|
1095
|
-
const directUserPostChannelId = opts.deliveryQueueId ? void 0
|
|
1096
|
-
recipient,
|
|
1097
|
-
hasMedia: Boolean(opts.mediaUrl),
|
|
1098
|
-
...opts.threadTs ? { threadTs: opts.threadTs } : {}
|
|
1099
|
-
});
|
|
1068
|
+
const directUserPostChannelId = !opts.deliveryQueueId && recipient.kind === "user" && !opts.mediaUrl && !opts.threadTs ? recipient.id : void 0;
|
|
1100
1069
|
const { channelId } = directUserPostChannelId ? { channelId: directUserPostChannelId } : await resolveChannelId(client, recipient, {
|
|
1101
1070
|
accountId: account.accountId,
|
|
1102
1071
|
token: delivery.credential,
|
|
@@ -1284,4 +1253,4 @@ async function sendMessageSlackQueued(params) {
|
|
|
1284
1253
|
};
|
|
1285
1254
|
}
|
|
1286
1255
|
//#endregion
|
|
1287
|
-
export { clearSlackThreadParticipationCache as a, hasSlackThreadParticipationWithPersistence as c, requireSlackPostMessageTimestamp as d, buildSlackMessageIdentityPayload as f, clearSlackThreadFailureNotice as i, recordSlackThreadFailureNotice as l,
|
|
1256
|
+
export { clearSlackThreadParticipationCache as a, hasSlackThreadParticipationWithPersistence as c, requireSlackPostMessageTimestamp as d, buildSlackMessageIdentityPayload as f, chunkSlackTextAtHardLimit as h, clearSlackThreadFailureNotice as i, recordSlackThreadFailureNotice as l, buildSlackNativeDataDeliveryPlan as m, send_exports as n, hasSlackThreadFailureNotice as o, hasSlackMessageIdentity as p, setSlackDefaultSendIdentity as r, hasSlackThreadParticipation as s, sendMessageSlack as t, recordSlackThreadParticipation as u };
|