@openclaw/slack 2026.12.1 → 2026.12.6-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/{action-runtime-zVonj7Ub.mjs → action-runtime-B2JYA0KK.mjs} +30 -39
- package/dist/.setup/action-runtime.runtime-DhTK_A6l.mjs +1 -0
- package/dist/.setup/{actions-0x2TsQH6.mjs → actions-cVgdS6sU.mjs} +147 -22
- package/dist/.setup/{approval-handler.runtime-BBYoz7El.mjs → approval-handler.runtime-DDn3L7Gd.mjs} +5 -5
- package/dist/.setup/{approval-message-updates-BrGg-eis.mjs → approval-message-updates-CnjKG4If.mjs} +1 -1
- package/dist/.setup/{channel-C6-Cp-Fz.mjs → channel-BWLl8hAf.mjs} +24 -28
- package/dist/.setup/{channel-type-BQCZqcgg.mjs → channel-type-CNYPuhN7.mjs} +1 -1
- package/dist/.setup/{channel.setup-Dzt1s8XR.mjs → channel.setup-C0NEy9hG.mjs} +1 -1
- package/dist/.setup/{directory-config-CWeEzb_Y.mjs → directory-config-CFrpmf6d.mjs} +2 -2
- package/dist/.setup/{fork-CiiHD26T.mjs → fork-CyGNd27b.mjs} +3 -3
- package/dist/.setup/{literal-text-DXy7nGRR.mjs → literal-text-D5exd3B9.mjs} +1 -1
- package/dist/.setup/{monitor-D5erEc0i.mjs → monitor-dVQQ8XII.mjs} +264 -150
- package/dist/.setup/{outbound-adapter-BmJCT3Qj.mjs → outbound-adapter-CIJgw3fk.mjs} +6 -6
- package/dist/.setup/{pipeline.runtime-C51V3mhq.mjs → pipeline.runtime-Bet_aK1D.mjs} +53 -37
- package/dist/.setup/{policy-l2IjJV43.mjs → policy-Bo-JJQ2c.mjs} +1 -1
- package/dist/.setup/{probe-DKu67cjh.mjs → probe-DhQ6LeKX.mjs} +70 -12
- package/dist/.setup/{question-delivery-BRQza6lN.mjs → question-delivery-D-WigwxO.mjs} +1 -1
- package/dist/.setup/{relay-source-D2WA09C-.mjs → relay-source-BWKpwdJT.mjs} +2 -2
- package/dist/.setup/{replies-kwdtXt3e.mjs → replies-BFqakO6L.mjs} +6 -6
- package/dist/.setup/{reply-blocks-Cf8e9Sau.mjs → reply-blocks-BsJPukUN.mjs} +28 -6
- package/dist/.setup/{resolve-channels-BoQiIEny.mjs → resolve-channels-Cl7l3BLf.mjs} +1 -1
- package/dist/.setup/{resolve-users-PpJHZiBC.mjs → resolve-users-mep8kUHy.mjs} +1 -1
- package/dist/.setup/{scopes-bvZxH5i3.mjs → scopes-CnMdp9Pj.mjs} +1 -1
- package/dist/.setup/{send-DJpeS70B.mjs → send-kbYZlK6B.mjs} +133 -145
- package/dist/.setup/send-results-DVKN1Zix.mjs +77 -0
- package/dist/.setup/setup-plugin-api-TYFn_irv.mjs +2 -0
- package/dist/.setup/{setup-surface-BqdskNYS.mjs → setup-surface-D8hoExQs.mjs} +3 -3
- package/dist/.setup/slash-dispatch.runtime--T5PbqoB.mjs +7 -0
- package/dist/.setup/{target-parsing-DwYAP3ts.mjs → target-parsing-DaLcdOoQ.mjs} +10 -1
- package/dist/.setup/{targets-eeOxA_b_.mjs → targets-DaKqo4kn.mjs} +1 -1
- package/dist/.source-module-urls/c5ffd0957b234c7c12090e7de4eca2482ef339b8561e078da55b734211b0ba58.json +1 -1
- package/dist/api.js +10 -10
- package/dist/channel-plugin-api.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/runtime-api.js +7 -7
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/package.json +4 -4
- package/dist/.setup/action-runtime.runtime-YBV3dNF-.mjs +0 -1
- package/dist/.setup/send-results-Bm6V1ekL.mjs +0 -21
- package/dist/.setup/setup-plugin-api-DPOqeRW0.mjs +0 -2
- package/dist/.setup/slash-dispatch.runtime-CMQgSmJc.mjs +0 -8
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { d as resolveSlackMarkdownOptions, f as resolveSlackOperationToken, s as resolveSlackAccount } from "./accounts-Dsl3wabY.mjs";
|
|
2
|
-
import { a as parseSlackTarget } from "./target-parsing-
|
|
3
|
-
import {
|
|
2
|
+
import { a as parseSlackTarget } from "./target-parsing-DaLcdOoQ.mjs";
|
|
3
|
+
import { Ct as SLACK_TEXT_LIMIT, D as assertSlackDetachedTargetAllowed, H as resolveSlackQuestionActionIds, gt as SLACK_PRESENTATION_CAPABILITIES } from "./probe-DhQ6LeKX.mjs";
|
|
4
4
|
import { r as resolveSlackThreadTsValue } from "./thread-ts-47Au2-Yn.mjs";
|
|
5
|
-
import { a as resolveSlackReplyBlockResolution, d as resolveSlackAuthoredTextPlacement, r as normalizeSlackReplyPayload, s as resolveSlackReplyDeliveryMessages } from "./reply-blocks-
|
|
6
|
-
import {
|
|
7
|
-
import { t as registerSlackQuestionDelivery } from "./question-delivery-
|
|
5
|
+
import { a as resolveSlackReplyBlockResolution, d as resolveSlackAuthoredTextPlacement, r as normalizeSlackReplyPayload, s as resolveSlackReplyDeliveryMessages } from "./reply-blocks-BsJPukUN.mjs";
|
|
6
|
+
import { r as mergeSlackSendResults } from "./send-results-DVKN1Zix.mjs";
|
|
7
|
+
import { t as registerSlackQuestionDelivery } from "./question-delivery-D-WigwxO.mjs";
|
|
8
8
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
10
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
@@ -45,7 +45,7 @@ function readSlackRenderedPresentation(slackData) {
|
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
const loadSlackSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
48
|
+
const loadSlackSendRuntime = createLazyRuntimeModule(() => import("./send-kbYZlK6B.mjs").then((n) => n.n));
|
|
49
49
|
function resolveSlackSendIdentity(identity) {
|
|
50
50
|
if (!identity) return;
|
|
51
51
|
const username = normalizeOptionalString(identity.name);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { d as resolveSlackMarkdownOptions, o as resolveDefaultSlackAccountId, p as resolveSlackReplyToMode } from "./accounts-Dsl3wabY.mjs";
|
|
2
|
-
import { n as formatSlackTarget } from "./target-parsing-
|
|
3
|
-
import {
|
|
2
|
+
import { n as formatSlackTarget } from "./target-parsing-DaLcdOoQ.mjs";
|
|
3
|
+
import { A as truncateSlackTextByUtf8Bytes, Ct as SLACK_TEXT_LIMIT, Dt as escapeSlackMrkdwn, Et as normalizeSlackOutboundText, Jt as resolveSlackUserAllowed, L as SLACK_SESSION_LINK_ACTION_ID, O as countSlackTextUtf8Bytes, Wt as normalizeSlackAllowOwnerEntry, at as hasSlackNativeDataBlock, bt as SLACK_EDIT_TEXT_MAX_BYTES, k as truncateSlackText, nt as buildSlackCompleteBlocksFallbackText, tt as buildSlackBlocksFallbackText, v as formatSlackError, x as qualifySlackRoutePeerId } from "./probe-DhQ6LeKX.mjs";
|
|
4
4
|
import { n as resolveSlackReplyThreadTs } from "./thread-ts-47Au2-Yn.mjs";
|
|
5
|
-
import { c as resolveSlackReplyRenderPlan, i as prepareSlackReply, o as resolveSlackReplyBlocks } from "./reply-blocks-
|
|
5
|
+
import { c as resolveSlackReplyRenderPlan, i as prepareSlackReply, o as resolveSlackReplyBlocks } from "./reply-blocks-BsJPukUN.mjs";
|
|
6
6
|
import { d as readLruMapEntry, f as writeLruMapEntry, l as getOrCreateWeakOwnerMap } from "./client-DQqLIemQ.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { n as resolveSlackChannelConfig } from "./policy-
|
|
10
|
-
import { A as
|
|
11
|
-
import { a as emitSlackMessageSentHooks, i as sanitizeSlackMonitorReplyPayload, n as deliverReplies, t as createSlackReplyDeliveryPlan } from "./replies-
|
|
7
|
+
import { a as clearSlackThreadFailureNotice, b as hasSlackMessageIdentity, c as hasSlackThreadParticipation, d as recordSlackThreadParticipation, f as buildSlackNativeDataDeliveryPlan, l as hasSlackThreadParticipationWithPersistence, s as hasSlackThreadFailureNotice, t as sendMessageSlack, u as recordSlackThreadFailureNotice } from "./send-kbYZlK6B.mjs";
|
|
8
|
+
import { A as buildSlackEditTextPayload, C as formatSlackFileReference, a as editSlackRenderedMessage, d as reactSlackMessage, i as editSlackMessage, k as resolveSlackMessageText, m as removeSlackReaction, n as deleteSlackMessage } from "./actions-cVgdS6sU.mjs";
|
|
9
|
+
import { n as resolveSlackChannelConfig } from "./policy-Bo-JJQ2c.mjs";
|
|
10
|
+
import { A as resolveSlackChatType, C as appendSlackStream, D as stopSlackStream, E as startSlackStream, M as readSlackAssistantThreadContext, N as stripSlackMentionsForCommandDetection, S as SlackStreamNotDeliveredError, T as markSlackStreamFallbackDelivered, b as resolveSlackEffectiveAllowFrom, c as hasAddressedSlackSessionRun, d as resolveSlackChannelHistory, f as resolveSlackThreadHistory, h as trackSlackDraftMessage, j as buildSlackAssistantThreadMetadata, k as normalizeSlackChannelType, l as registerSlackSessionRun, m as resolveSlackTimestampMs, o as authorizeSlackDirectMessage, p as resolveSlackThreadStarter, r as resolveSlackRoomContextHints, s as resolveSlackRoutingContext, u as resolveSlackThreadContext, v as authorizeSlackBotRoomMessage, w as discardSlackStreamPendingText, x as SlackStreamMessageTooLongError, y as resolveSlackCommandIngress } from "./monitor-dVQQ8XII.mjs";
|
|
11
|
+
import { a as emitSlackMessageSentHooks, i as sanitizeSlackMonitorReplyPayload, n as deliverReplies, t as createSlackReplyDeliveryPlan } from "./replies-BFqakO6L.mjs";
|
|
12
12
|
import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
13
13
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
14
14
|
import { resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
|
|
@@ -22,11 +22,11 @@ import { buildTtsSupplementMediaPayload, getReplyPayloadTtsSupplement, isReplyPa
|
|
|
22
22
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
23
23
|
import { hash } from "node:crypto";
|
|
24
24
|
import { resolveChannelImplicitMentions } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
25
|
+
import { formatErrorMessage, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
26
|
+
import { mimeTypeFromFilePath, normalizeMimeType } from "openclaw/plugin-sdk/media-mime";
|
|
25
27
|
import fs from "node:fs/promises";
|
|
26
28
|
import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
|
|
27
|
-
import { formatErrorMessage, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
28
29
|
import { filterSupplementalContextItems, resolvePinnedMainDmOwnerFromAllowlist, shouldIncludeSupplementalContext } from "openclaw/plugin-sdk/security-runtime";
|
|
29
|
-
import { mimeTypeFromFilePath, normalizeMimeType } from "openclaw/plugin-sdk/media-mime";
|
|
30
30
|
import { ensureConfiguredBindingRouteReady, resolveConversationLabel } from "openclaw/plugin-sdk/conversation-runtime";
|
|
31
31
|
import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
|
|
32
32
|
import { getSessionEntryAsync, readSessionUpdatedAtAsync, resolveChannelResetConfig, resolveStorePath, updateLastRoute } from "openclaw/plugin-sdk/session-store-runtime";
|
|
@@ -3095,6 +3095,7 @@ function createSlackStreamingDeliveryRuntime(setup) {
|
|
|
3095
3095
|
teamId: prepared.eventScope?.teamId,
|
|
3096
3096
|
channelId: message.channel,
|
|
3097
3097
|
threadTs: message.thread_ts,
|
|
3098
|
+
deliveryThreadTs: params.threadTs,
|
|
3098
3099
|
onInterveningMessage: () => {
|
|
3099
3100
|
state.streamInterrupted = true;
|
|
3100
3101
|
}
|
|
@@ -3454,6 +3455,10 @@ function createSlackStreamingDeliveryRuntime(setup) {
|
|
|
3454
3455
|
});
|
|
3455
3456
|
}
|
|
3456
3457
|
// extensions/slack/src/monitor/message-handler/failure-notice.ts
|
|
3458
|
+
/** Whether the sender addressed this bot directly (mention, mention pattern or command). */
|
|
3459
|
+
function isSlackTurnExplicitlyAddressed(context) {
|
|
3460
|
+
return context.ExplicitlyMentionedBot === true || context.MentionSource === "explicit_bot" || context.MentionSource === "subteam" || context.MentionSource === "mention_pattern" || context.MentionSource === "command_bypass" || context.CommandTurn?.kind !== void 0 && context.CommandTurn.kind !== "normal" && context.CommandTurn.authorized;
|
|
3461
|
+
}
|
|
3457
3462
|
/** One outage policy for immediate replies and later origin-routed queue drains. */
|
|
3458
3463
|
function createSlackFailureNoticePolicy(params, hasVisibleReply) {
|
|
3459
3464
|
const { context, accountId, channelId, failureNoticeThreadTs, failureNoticeTeamId, statusThreadTs } = params;
|
|
@@ -3463,7 +3468,7 @@ function createSlackFailureNoticePolicy(params, hasVisibleReply) {
|
|
|
3463
3468
|
if (payload.isError !== true || context.ChatType !== "channel" || isReplyPayloadNonTerminalToolErrorWarning(payload)) return payload;
|
|
3464
3469
|
sawTerminalFailurePayload = true;
|
|
3465
3470
|
if (hasVisibleReply()) return payload;
|
|
3466
|
-
const explicitlyAddressed = context
|
|
3471
|
+
const explicitlyAddressed = isSlackTurnExplicitlyAddressed(context);
|
|
3467
3472
|
const noticeThreadTs = failureNoticeThreadTs ?? (explicitlyAddressed ? statusThreadTs : void 0);
|
|
3468
3473
|
const notice = {
|
|
3469
3474
|
accountId,
|
|
@@ -3527,21 +3532,22 @@ function formatSlackGroupThreadReply(text, participant) {
|
|
|
3527
3532
|
}
|
|
3528
3533
|
async function dispatchPreparedSlackMessage(prepared) {
|
|
3529
3534
|
const setup = await createSlackDispatchSetup(prepared);
|
|
3530
|
-
const
|
|
3535
|
+
const explicitlyAddressed = prepared.ctxPayload.ChatType === "channel" && isSlackTurnExplicitlyAddressed(prepared.ctxPayload);
|
|
3536
|
+
const beginSessionRun = (activeMention = explicitlyAddressed) => registerSlackSessionRun(prepared.ctx, {
|
|
3531
3537
|
channelId: prepared.message.channel,
|
|
3532
3538
|
threadTs: setup.streamThreadHint,
|
|
3533
3539
|
eventScope: prepared.eventScope
|
|
3534
3540
|
}, {
|
|
3535
3541
|
...prepared.route,
|
|
3536
3542
|
sessionKey: prepared.ctxPayload.SessionKey ?? prepared.route.sessionKey
|
|
3537
|
-
});
|
|
3543
|
+
}, activeMention);
|
|
3538
3544
|
const upstreamLifecycle = prepared.turnAdoptionLifecycle;
|
|
3539
3545
|
let releaseDeferred;
|
|
3540
3546
|
const turnAdoptionLifecycle = upstreamLifecycle && {
|
|
3541
3547
|
...upstreamLifecycle,
|
|
3542
3548
|
onDeferred: () => {
|
|
3543
3549
|
const accepted = upstreamLifecycle.onDeferred?.();
|
|
3544
|
-
if (accepted !== false) releaseDeferred ??= beginSessionRun();
|
|
3550
|
+
if (accepted !== false) releaseDeferred ??= beginSessionRun(false);
|
|
3545
3551
|
return accepted;
|
|
3546
3552
|
},
|
|
3547
3553
|
onSettled: () => {
|
|
@@ -3948,7 +3954,7 @@ const SLACK_MENTION_RESOLUTION_CONCURRENCY = 4;
|
|
|
3948
3954
|
const SLACK_MENTION_RESOLUTION_MAX_LOOKUPS_PER_MESSAGE = 20;
|
|
3949
3955
|
const SLACK_USER_MENTION_RE$1 = /<@([A-Z0-9]+)(?:\|[^>]+)?>/gi;
|
|
3950
3956
|
const MAX_SLACK_UNAVAILABLE_FILE_TEXT_CHARS = 2e3;
|
|
3951
|
-
const loadSlackMediaModule$2 = createLazyRuntimeModule(() => import("./actions-
|
|
3957
|
+
const loadSlackMediaModule$2 = createLazyRuntimeModule(() => import("./actions-cVgdS6sU.mjs").then((n) => n.b));
|
|
3952
3958
|
function formatSlackUnavailableMedia(params) {
|
|
3953
3959
|
let fileReferences = params.files?.map((file) => `${formatSlackFileReference(file)} unavailable (${file.reason})`).join(", ");
|
|
3954
3960
|
if (fileReferences && fileReferences.length > MAX_SLACK_UNAVAILABLE_FILE_TEXT_CHARS) fileReferences = `${truncateUtf16Safe(fileReferences, MAX_SLACK_UNAVAILABLE_FILE_TEXT_CHARS)}; … (file references truncated)`;
|
|
@@ -4133,7 +4139,7 @@ const SLACK_HISTORY_MEDIA_MAX_ATTACHMENTS = 4;
|
|
|
4133
4139
|
const SLACK_HISTORY_MEDIA_MAX_BYTES = 10485760;
|
|
4134
4140
|
const SLACK_HISTORY_MEDIA_IDLE_TIMEOUT_MS = 1e3;
|
|
4135
4141
|
const SLACK_HISTORY_MEDIA_TOTAL_TIMEOUT_MS = 3e3;
|
|
4136
|
-
const loadSlackMediaModule$1 = createLazyRuntimeModule(() => import("./actions-
|
|
4142
|
+
const loadSlackMediaModule$1 = createLazyRuntimeModule(() => import("./actions-cVgdS6sU.mjs").then((n) => n.b));
|
|
4137
4143
|
async function resolveSlackRoomHistory(params) {
|
|
4138
4144
|
if (params.ctx.historyLimit <= 0 || !params.message.ts) return [];
|
|
4139
4145
|
const warnOmission = (reason) => {
|
|
@@ -4279,7 +4285,7 @@ function resolveSlackGroupSessionSubject(params) {
|
|
|
4279
4285
|
return `Slack Channel (Workspace ID: ${params.workspaceId}, Channel ID: ${params.channelId})`;
|
|
4280
4286
|
}
|
|
4281
4287
|
// extensions/slack/src/monitor/message-handler/prepare-thread-context.ts
|
|
4282
|
-
const loadSlackMediaModule = createLazyRuntimeModule(() => import("./actions-
|
|
4288
|
+
const loadSlackMediaModule = createLazyRuntimeModule(() => import("./actions-cVgdS6sU.mjs").then((n) => n.b));
|
|
4283
4289
|
const SLACK_THREAD_CONTEXT_USER_LOOKUP_CONCURRENCY = 4;
|
|
4284
4290
|
function formatSlackThreadLabelSnippet(text) {
|
|
4285
4291
|
return truncateUtf16Safe(text.replace(/\s+/g, " "), 80);
|
|
@@ -4294,9 +4300,10 @@ async function resolveSlackThreadContextData(params) {
|
|
|
4294
4300
|
author
|
|
4295
4301
|
});
|
|
4296
4302
|
const resolveThreadUserMap = async (messages) => {
|
|
4297
|
-
const uniqueUserIds =
|
|
4303
|
+
const uniqueUserIds = /* @__PURE__ */ new Set();
|
|
4304
|
+
for (const message of messages) if (message.userId && !isCurrentBotAuthor(message)) uniqueUserIds.add(message.userId);
|
|
4298
4305
|
const { results } = await runTasksWithConcurrency({
|
|
4299
|
-
tasks:
|
|
4306
|
+
tasks: Array.from(uniqueUserIds, (id) => async () => {
|
|
4300
4307
|
const user = await params.ctx.resolveUserName(id, params.eventScope);
|
|
4301
4308
|
return user ? [id, user] : null;
|
|
4302
4309
|
}),
|
|
@@ -4385,7 +4392,8 @@ async function resolveSlackThreadContextData(params) {
|
|
|
4385
4392
|
threadLabel = `Slack thread ${params.roomLabel}${snippet ? ` (assistant root): ${snippet}` : ""}`;
|
|
4386
4393
|
}
|
|
4387
4394
|
const threadInitialHistoryLimit = Math.min(params.account.config?.thread?.initialHistoryLimit ?? 20, params.historyLimit ?? Number.POSITIVE_INFINITY);
|
|
4388
|
-
|
|
4395
|
+
const includeRoomBotRoot = params.historyLimit !== void 0 && includeBotStarterAsRootContext;
|
|
4396
|
+
if (shouldLoadInitialThreadHistory && (threadInitialHistoryLimit > 0 || includeRoomBotRoot)) {
|
|
4389
4397
|
const currentBotRootTs = starter?.ts ?? params.threadTs;
|
|
4390
4398
|
let historyOmitted = false;
|
|
4391
4399
|
const threadHistory = await resolveSlackThreadHistory({
|
|
@@ -4407,7 +4415,7 @@ async function resolveSlackThreadContextData(params) {
|
|
|
4407
4415
|
}, "Slack automatic thread history omitted");
|
|
4408
4416
|
}
|
|
4409
4417
|
});
|
|
4410
|
-
if (historyOmitted) return readThreadContextData();
|
|
4418
|
+
if (historyOmitted && !includeRoomBotRoot) return readThreadContextData();
|
|
4411
4419
|
const enrichedStarter = starter && threadStarterBody && threadStarterBody !== starter.text ? {
|
|
4412
4420
|
...starter,
|
|
4413
4421
|
text: threadStarterBody,
|
|
@@ -4488,11 +4496,12 @@ async function resolveSlackThreadMentionPolicy(params) {
|
|
|
4488
4496
|
accountId: account.accountId
|
|
4489
4497
|
});
|
|
4490
4498
|
const requireMentionInBotThreads = channelConfig?.requireMentionInBotThreads ?? account.config.requireMentionInBotThreads;
|
|
4491
|
-
const
|
|
4492
|
-
const
|
|
4499
|
+
const broadcastRoot = message.subtype === "thread_broadcast" ? message.root : void 0;
|
|
4500
|
+
const parentUserId = normalizeOptionalString(message.parent_user_id) ?? normalizeOptionalString(broadcastRoot?.user);
|
|
4501
|
+
const repliesToBot = parentUserId ? parentUserId === ctx.botUserId : Boolean(ctx.botId && broadcastRoot?.bot_id === ctx.botId);
|
|
4493
4502
|
let isBotOwnedThread = false;
|
|
4494
4503
|
if (isRoom && thread.isThreadReply && requireMentionInBotThreads !== void 0) {
|
|
4495
|
-
if (parentUserId) isBotOwnedThread = repliesToBot;
|
|
4504
|
+
if (parentUserId || repliesToBot) isBotOwnedThread = repliesToBot;
|
|
4496
4505
|
else {
|
|
4497
4506
|
const starter = await params.getThreadStarter();
|
|
4498
4507
|
isBotOwnedThread = Boolean(starter && starter.ts === thread.threadTs && isSlackThreadAuthorCurrentBot({
|
|
@@ -4504,12 +4513,16 @@ async function resolveSlackThreadMentionPolicy(params) {
|
|
|
4504
4513
|
const implicitMentionKinds = [];
|
|
4505
4514
|
if (!isDirectMessage && message.thread_ts && !params.wasMentioned && !(isBotOwnedThread && requireMentionInBotThreads)) {
|
|
4506
4515
|
if (repliesToBot) implicitMentionKinds.push("reply_to_bot");
|
|
4507
|
-
if (implicitMentions.threadParticipation && !(repliesToBot && implicitMentions.replyToBot) &&
|
|
4516
|
+
if (implicitMentions.threadParticipation && !(repliesToBot && implicitMentions.replyToBot) && (hasAddressedSlackSessionRun(ctx, {
|
|
4517
|
+
channelId: message.channel,
|
|
4518
|
+
threadTs: message.thread_ts,
|
|
4519
|
+
eventScope: params.teamId ? { teamId: params.teamId } : void 0
|
|
4520
|
+
}) || await hasSlackThreadParticipationWithPersistence({
|
|
4508
4521
|
accountId: account.accountId,
|
|
4509
4522
|
channelId: message.channel,
|
|
4510
4523
|
threadTs: message.thread_ts,
|
|
4511
4524
|
teamId: params.teamId
|
|
4512
|
-
})) implicitMentionKinds.push("bot_thread_participant");
|
|
4525
|
+
}))) implicitMentionKinds.push("bot_thread_participant");
|
|
4513
4526
|
}
|
|
4514
4527
|
return {
|
|
4515
4528
|
implicitMentions,
|
|
@@ -4976,18 +4989,20 @@ async function prepareSlackMessage(params) {
|
|
|
4976
4989
|
channel: "slack",
|
|
4977
4990
|
accountId: account.accountId
|
|
4978
4991
|
});
|
|
4979
|
-
const
|
|
4992
|
+
const replyTargetScope = {
|
|
4980
4993
|
teamId: opts.eventScope?.teamId,
|
|
4981
|
-
kind: "channel",
|
|
4982
|
-
id: message.channel,
|
|
4983
|
-
explicitKind: true
|
|
4984
|
-
});
|
|
4985
|
-
const replyRouteTarget = formatSlackTarget({
|
|
4986
|
-
teamId: opts.eventScope?.teamId,
|
|
4987
|
-
kind: isDirectMessage ? "user" : "channel",
|
|
4988
|
-
id: isDirectMessage ? senderId : message.channel,
|
|
4989
4994
|
explicitKind: true
|
|
4995
|
+
};
|
|
4996
|
+
const sourceChannelTarget = formatSlackTarget({
|
|
4997
|
+
...replyTargetScope,
|
|
4998
|
+
kind: "channel",
|
|
4999
|
+
id: message.channel
|
|
4990
5000
|
});
|
|
5001
|
+
const replyRouteTarget = isDirectMessage ? formatSlackTarget({
|
|
5002
|
+
...replyTargetScope,
|
|
5003
|
+
kind: "user",
|
|
5004
|
+
id: senderId
|
|
5005
|
+
}) : sourceChannelTarget;
|
|
4991
5006
|
const commandAuthorized = messageIngress.commandAccess.authorized;
|
|
4992
5007
|
if (isRoomish && messageIngress.commandAccess.shouldBlockControlCommand) return drop("control-command-unauthorized");
|
|
4993
5008
|
const canSeedMentionedRoomThread = !seedTopLevelRoomThreadBySource && isRoom && !routing.isThreadReply && !hasBoundSession;
|
|
@@ -5013,7 +5028,7 @@ async function prepareSlackMessage(params) {
|
|
|
5013
5028
|
media: preflightMedia,
|
|
5014
5029
|
cfg,
|
|
5015
5030
|
accountId: account.accountId,
|
|
5016
|
-
originatingTo:
|
|
5031
|
+
originatingTo: sourceChannelTarget,
|
|
5017
5032
|
sessionKey: preflightRouting.sessionKey,
|
|
5018
5033
|
messageThreadId: preflightRouting.threadContext.messageThreadId
|
|
5019
5034
|
}) : null;
|
|
@@ -5322,6 +5337,7 @@ async function prepareSlackMessage(params) {
|
|
|
5322
5337
|
},
|
|
5323
5338
|
reply: {
|
|
5324
5339
|
to: replyRouteTarget,
|
|
5340
|
+
deliveryTarget: isDirectMessage ? sourceChannelTarget : void 0,
|
|
5325
5341
|
replyToId: threadContext.replyToId,
|
|
5326
5342
|
messageThreadId: boundMessageThreadId,
|
|
5327
5343
|
nativeChannelId: message.channel
|
|
@@ -5402,7 +5418,7 @@ async function prepareSlackMessage(params) {
|
|
|
5402
5418
|
transcript: preflightAudioTranscript,
|
|
5403
5419
|
cfg,
|
|
5404
5420
|
accountId: account.accountId,
|
|
5405
|
-
originatingTo:
|
|
5421
|
+
originatingTo: sourceChannelTarget,
|
|
5406
5422
|
messageThreadId: threadContext.messageThreadId
|
|
5407
5423
|
});
|
|
5408
5424
|
const updateLastRouteSessionKey = resolveInboundLastRouteSessionKey({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Gt as normalizeSlackSlug, l as buildSlackChannelIdCandidates, qt as resolveSlackUserAllowListForTeam, u as buildSlackChannelPolicyScope } from "./probe-DhQ6LeKX.mjs";
|
|
2
2
|
import { applyChannelMatchMeta, buildChannelKeyCandidates } from "openclaw/plugin-sdk/channel-targets";
|
|
3
3
|
import { firstDefined } from "openclaw/plugin-sdk/allow-from";
|
|
4
4
|
import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as __exportAll } from "./doctor-contract-CcNdculn.mjs";
|
|
2
2
|
import { r as isSlackPluginAccountConfigured } from "./account-configured-35y0-Hso.mjs";
|
|
3
3
|
import { a as mergeSlackAccountConfig, c as resolveSlackAccountAllowFrom, i as listSlackAccountIds, m as formatSlackBotTokenIdentityWarning, o as resolveDefaultSlackAccountId, s as resolveSlackAccount } from "./accounts-Dsl3wabY.mjs";
|
|
4
|
-
import { a as parseSlackTarget, n as formatSlackTarget, t as canonicalizeSlackApiTargetId } from "./target-parsing-
|
|
5
|
-
import { t as slackContextTargetsMatch } from "./targets-
|
|
4
|
+
import { a as parseSlackTarget, n as formatSlackTarget, t as canonicalizeSlackApiTargetId } from "./target-parsing-DaLcdOoQ.mjs";
|
|
5
|
+
import { t as slackContextTargetsMatch } from "./targets-DaKqo4kn.mjs";
|
|
6
6
|
import { h as createSlackProbeDispatcher, n as createSlackReadClient } from "./client-DQqLIemQ.mjs";
|
|
7
7
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
8
8
|
import { asOptionalRecord, isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringifiedOptionalString, normalizeTrimmedStringList, readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -326,6 +326,38 @@ function getSlackApprovalApproversForTeam(params) {
|
|
|
326
326
|
function resolveSlackApprovalTeamId(params) {
|
|
327
327
|
return getSlackInstallationTeamId(resolveSlackAccount(params).accountId) ?? resolveSlackApprovalOriginTeamId(params.request);
|
|
328
328
|
}
|
|
329
|
+
// extensions/slack/src/direct-target.ts
|
|
330
|
+
/**
|
|
331
|
+
* Slack sends to `user:<id>` open the user's DM conversation. `teamId`
|
|
332
|
+
* qualifies the target when the id does not already name a workspace.
|
|
333
|
+
*/
|
|
334
|
+
function resolveSlackDirectTarget(params) {
|
|
335
|
+
const target = parseSlackTarget(params.senderId, { defaultKind: "user" });
|
|
336
|
+
if (target?.kind !== "user") return;
|
|
337
|
+
return {
|
|
338
|
+
kind: "direct",
|
|
339
|
+
to: formatSlackTarget({
|
|
340
|
+
kind: "user",
|
|
341
|
+
id: target.id,
|
|
342
|
+
teamId: target.teamId ?? params.teamId,
|
|
343
|
+
explicitKind: true
|
|
344
|
+
})
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
/** Direct target in the account's connected workspace; malformed ids map to nothing. */
|
|
348
|
+
const resolveSlackAccountDirectTarget = ({ cfg, accountId, senderId }) => {
|
|
349
|
+
try {
|
|
350
|
+
return resolveSlackDirectTarget({
|
|
351
|
+
senderId,
|
|
352
|
+
teamId: getSlackInstallationTeamId(resolveSlackAccount({
|
|
353
|
+
cfg,
|
|
354
|
+
accountId
|
|
355
|
+
}).accountId)
|
|
356
|
+
});
|
|
357
|
+
} catch {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
};
|
|
329
361
|
// extensions/slack/src/approval-native-gates.ts
|
|
330
362
|
function isSlackPluginApprovalRequest(request) {
|
|
331
363
|
return resolveApprovalKind(request) === "plugin";
|
|
@@ -338,14 +370,12 @@ async function resolveSlackApproverDmTargets(params) {
|
|
|
338
370
|
teamId,
|
|
339
371
|
request: params.request
|
|
340
372
|
}) : [] : getSlackExecApprovalApprovers(params)).map((approver) => {
|
|
341
|
-
const target =
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
explicitKind: true
|
|
348
|
-
}) };
|
|
373
|
+
const target = resolveSlackDirectTarget({
|
|
374
|
+
senderId: approver,
|
|
375
|
+
teamId
|
|
376
|
+
});
|
|
377
|
+
if (target?.kind !== "direct") throw new Error("Slack approval approver target must be a user");
|
|
378
|
+
return { to: target.to };
|
|
349
379
|
});
|
|
350
380
|
}
|
|
351
381
|
const SLACK_DM_CHANNEL_ID_RE = /^D[A-Z0-9]{8,}$/i;
|
|
@@ -941,6 +971,7 @@ const SLACK_PRESENTATION_CAPABILITIES = {
|
|
|
941
971
|
divider: true,
|
|
942
972
|
charts: true,
|
|
943
973
|
tables: true,
|
|
974
|
+
titleLinks: true,
|
|
944
975
|
limits: {
|
|
945
976
|
actions: {
|
|
946
977
|
maxActionsPerRow: 25,
|
|
@@ -1558,7 +1589,7 @@ function assertSlackDetachedTargetAllowed(accountId, teamId) {
|
|
|
1558
1589
|
}
|
|
1559
1590
|
// extensions/slack/src/conversation-binding-route.ts
|
|
1560
1591
|
const slackConversationBindings = {
|
|
1561
|
-
prepareFork: async (params) => (await import("./fork-
|
|
1592
|
+
prepareFork: async (params) => (await import("./fork-CyGNd27b.mjs")).prepareSlackFork(params),
|
|
1562
1593
|
isCurrentConversationBindingSupported: ({ accountId }) => isSlackWorkspaceInstallation(accountId)
|
|
1563
1594
|
};
|
|
1564
1595
|
const slackRouteBindingConfigCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -1863,6 +1894,33 @@ function getSlackChannelPolicyKeys(accountId, channelId) {
|
|
|
1863
1894
|
if (!id) return [];
|
|
1864
1895
|
return [...slackChannelPolicyBindings.get(normalizeAccountId(accountId)) ?? []].filter(([, resolvedId]) => resolvedId === id).map(([key]) => key);
|
|
1865
1896
|
}
|
|
1897
|
+
/**
|
|
1898
|
+
* Effective channel entries: each resolved key is merged under its channel ID.
|
|
1899
|
+
* Keys spelling the ID itself (any case, `channel:`/`slack:` prefix) win field by field over
|
|
1900
|
+
* name keys, whatever the config order; name keys then apply in config order.
|
|
1901
|
+
*/
|
|
1902
|
+
function mergeSlackBoundChannelEntries(channels, bindings) {
|
|
1903
|
+
if (!channels) return channels;
|
|
1904
|
+
const ordered = [...bindings ?? []].map(([key, id]) => {
|
|
1905
|
+
const channelId = id.toUpperCase();
|
|
1906
|
+
return {
|
|
1907
|
+
key,
|
|
1908
|
+
channelId,
|
|
1909
|
+
idKey: key.replace(/^(slack:|channel:)/i, "").toUpperCase() === channelId
|
|
1910
|
+
};
|
|
1911
|
+
}).toSorted((a, b) => Number(b.idKey) - Number(a.idKey));
|
|
1912
|
+
let merged = channels;
|
|
1913
|
+
for (const { key, channelId } of ordered) {
|
|
1914
|
+
if (!Object.hasOwn(channels, key)) continue;
|
|
1915
|
+
merged = merged === channels ? { ...channels } : merged;
|
|
1916
|
+
merged[channelId] = Object.assign({}, channels[key], merged[channelId]);
|
|
1917
|
+
}
|
|
1918
|
+
return merged;
|
|
1919
|
+
}
|
|
1920
|
+
/** Channel entries as the account's monitor resolved them; inbound and actions share this view. */
|
|
1921
|
+
function resolveSlackBoundChannelEntries(accountId, channels) {
|
|
1922
|
+
return mergeSlackBoundChannelEntries(channels, slackChannelPolicyBindings.get(normalizeAccountId(accountId)));
|
|
1923
|
+
}
|
|
1866
1924
|
// extensions/slack/src/group-policy.ts
|
|
1867
1925
|
function hasPotentialSlackNamedPolicy(params) {
|
|
1868
1926
|
if (params.allowNameMatching !== true) return false;
|
|
@@ -2122,4 +2180,4 @@ async function probeSlack(token, timeoutMs = 2500, opts) {
|
|
|
2122
2180
|
await dispatcher.destroy().catch(() => void 0);
|
|
2123
2181
|
}
|
|
2124
2182
|
}
|
|
2125
|
-
export {
|
|
2183
|
+
export { appendSlackNativeDataFallbackText as $, getSlackExecApprovalApprovers as $t, truncateSlackTextByUtf8Bytes as A, normalizeSlackForwardTarget as At, isSlackQuestionActionForQuestion as B, getSlackApprovalApproversForTeam as Bt, normalizeSlackRouteBindingConfig as C, SLACK_TEXT_LIMIT as Ct, assertSlackDetachedTargetAllowed as D, escapeSlackMrkdwn as Dt, slackConversationBindings as E, normalizeSlackOutboundText as Et, SLACK_REPLY_SELECT_ACTION_ID as F, resolveTurnSourceSlackOriginTarget as Ft, resolveSlackQuestionAction as G, normalizeSlackSlug as Gt, resolveSlackQuestionActionIds as H, resolveSlackApprovalTeamId as Ht, SLACK_SELECT_ACTION_IDS as I, shouldHandleSlackNativeApprovalRequest as It, encodeSlackApprovalAction as J, resolveSlackUserAllowed as Jt, SLACK_APPROVAL_HEADER_BLOCK_ID as K, resolveSlackAllowListMatch as Kt, SLACK_SESSION_LINK_ACTION_ID as L, shouldHandleSlackPluginViaForwardingSession as Lt, SLACK_QUESTION_FINALIZATION_BLOCKS as M, resolveSessionSlackOriginTarget as Mt, SLACK_REPLY_BUTTON_ACTION_ID as N, resolveSlackApproverDmTargets as Nt, countSlackTextUtf8Bytes as O, isSlackAnyNativeApprovalClientEnabled as Ot, SLACK_REPLY_LINK_ACTION_ID as P, resolveSlackFallbackOriginTarget as Pt, SLACK_MALFORMED_NATIVE_DATA_FALLBACK as Q, registerSlackInstallationState as Qt, isSlackApprovalActionId as R, slackTargetsMatch as Rt, resolveSlackAgentRoute as S, SLACK_MESSAGE_TEXT_RECOMMENDED_LIMIT as St, resolveSlackConversationBindingRouteAsync as T, markdownToSlackMrkdwnChunks as Tt, decodeSlackQuestionAction as U, allowListMatches as Ut, isSlackQuestionActionId as V, isSlackPluginApprovalAuthorizedSender as Vt, encodeSlackQuestionAction as W, normalizeSlackAllowOwnerEntry as Wt, parseSlackBlocksInput as X, getSlackInstallationKind as Xt, SLACK_MAX_BLOCKS as Y, captureSlackWorkspaceInstallation as Yt, validateSlackBlocksArray as Z, getSlackInstallationTeamId as Zt, enrichSlackWebApiError as _, SLACK_SECTION_TEXT_MAX as _t, SLACK_USER_NAME_KIND as a, resolvePluginApprovalSlackApprovers as an, hasSlackNativeDataBlock as at, qualifySlackConversationId as b, SLACK_EDIT_TEXT_MAX_BYTES as bt, slackIngressIdentity as c, resolveSlackThreadTsFromContext as cn, stripSlackNativeDataBlocks as ct, hasPotentialSlackNamedPolicy as d, SLACK_DATA_TABLE_AGGREGATE_CELL_CHARACTERS_MAX as dt, isSlackExecApprovalAuthorizedSender as en, appendSlackNativeDataPlainTextFallback as et, resolveSlackGroupRequireMention as f, buildSlackDataTableBlock as ft, setSlackChannelPolicyBindings as g, SLACK_PRESENTATION_CAPABILITIES as gt, resolveSlackBoundChannelEntries as h, SLACK_BUTTON_VALUE_MAX as ht, setSlackSessionStatus as i, shouldSuppressLocalSlackExecApprovalPrompt as in, createSlackNativeDataBaseTextConsumer as it, SLACK_BUTTON_ACTION_IDS as j, normalizeSlackOriginTarget as jt, truncateSlackText as k, isSlackPluginApprovalRequest as kt, buildSlackChannelIdCandidates as l, buildSlackDataVisualizationBlock as lt, mergeSlackBoundChannelEntries as m, countSlackDataTableCellCharacters as mt, probe_exports as n, normalizeSlackApproverId as nn, buildSlackCompleteBlocksFallbackText as nt, createSlackIngressSubject as o, SLACK_PRIVATE_ACTION_DELIVERY_RESULT as on, renderSlackBlockFallbackText as ot, resolveSlackGroupToolPolicy as p, countSlackDataTableBlocksCellCharacters as pt, decodeSlackApprovalAction as q, resolveSlackUserAllowListForTeam as qt, renameSlackSession as r, resolveSlackExecApprovalTarget as rn, buildSlackNativeDataAccessibilityText as rt, normalizeSlackStableEntry as s, resolveSlackAutoThreadId as sn, renderSlackNativeDataPlainTextBlock as st, probeSlack as t, isSlackExecApprovalClientEnabled as tn, buildSlackBlocksFallbackText as tt, buildSlackChannelPolicyScope as u, hasSlackDataVisualizationBlock as ut, formatSlackError as v, renderSlackMessagePresentationChartFallbackText as vt, resolveSlackConversationBindingRoute as w, chunkSlackMrkdwnText as wt, qualifySlackRoutePeerId as x, SLACK_MESSAGE_TEXT_HARD_LIMIT as xt, getSlackWebApiErrorData as y, renderSlackMessagePresentationFallbackText as yt, isSlackCallbackActionId as z, resolveSlackAccountDirectTarget as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as isSlackQuestionActionForQuestion, Dt as escapeSlackMrkdwn, H as resolveSlackQuestionActionIds, M as SLACK_QUESTION_FINALIZATION_BLOCKS, nt as buildSlackCompleteBlocksFallbackText } from "./probe-DhQ6LeKX.mjs";
|
|
2
2
|
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
3
3
|
// extensions/slack/src/question-delivery.ts
|
|
4
4
|
function registerSlackQuestionDelivery(params) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { v as formatSlackError } from "./probe-DhQ6LeKX.mjs";
|
|
2
|
+
import { O as SLACK_SOCKET_RECONNECT_POLICY, _ as requireSlackMessageEvent, g as parseSlackMessageEvent } from "./monitor-dVQQ8XII.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,17 +1,17 @@
|
|
|
1
|
-
import { Ct as
|
|
1
|
+
import { Ct as SLACK_TEXT_LIMIT, Tt as markdownToSlackMrkdwnChunks, at as hasSlackNativeDataBlock } from "./probe-DhQ6LeKX.mjs";
|
|
2
2
|
import { n as resolveSlackReplyThreadTs } from "./thread-ts-47Au2-Yn.mjs";
|
|
3
|
-
import { a as resolveSlackReplyBlockResolution, n as iterateSlackReplyDeliveryMessages, t as hasSlackReplyStructuredContent } from "./reply-blocks-
|
|
4
|
-
import {
|
|
5
|
-
import { a as createSlackResponseUrlBudget, i as SlackResponseAlreadyReportedError } from "./monitor-
|
|
6
|
-
import { t as registerSlackQuestionDelivery } from "./question-delivery-
|
|
3
|
+
import { a as resolveSlackReplyBlockResolution, n as iterateSlackReplyDeliveryMessages, t as hasSlackReplyStructuredContent } from "./reply-blocks-BsJPukUN.mjs";
|
|
4
|
+
import { f as buildSlackNativeDataDeliveryPlan, g as isSlackNativeResponseUrlRejection, h as isSlackInvalidBlocksResponse, i as updateMessageSlack, p as chunkSlackTextAtHardLimit, t as sendMessageSlack } from "./send-kbYZlK6B.mjs";
|
|
5
|
+
import { a as createSlackResponseUrlBudget, i as SlackResponseAlreadyReportedError } from "./monitor-dVQQ8XII.mjs";
|
|
6
|
+
import { t as registerSlackQuestionDelivery } from "./question-delivery-D-WigwxO.mjs";
|
|
7
7
|
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
8
8
|
import { createReplyReferencePlanner } from "openclaw/plugin-sdk/reply-reference";
|
|
9
9
|
import { deliverTextOrMediaReply, getReplyPayloadTtsSupplement, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
10
10
|
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
11
11
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
12
|
+
import { resolveOutboundMediaAccessForConfig } from "openclaw/plugin-sdk/outbound-media";
|
|
12
13
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
13
14
|
import { chunkMarkdownTextWithMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
14
|
-
import { resolveOutboundMediaAccessForConfig } from "openclaw/plugin-sdk/outbound-media";
|
|
15
15
|
import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
|
|
16
16
|
import { createAcceptedChannelDeliveryResult, createChannelPartialDeliveryError, getGroupThreadDeliverySession } from "openclaw/plugin-sdk/channel-inbound";
|
|
17
17
|
import { buildCanonicalSentMessageHookContext, createInternalHookEvent, fireAndForgetHook, toInternalMessageSentContext, toPluginMessageContext, toPluginMessageSentEvent, triggerInternalHook } from "openclaw/plugin-sdk/hook-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as appendSlackNativeDataFallbackText, Dt as escapeSlackMrkdwn, I as SLACK_SELECT_ACTION_IDS, J as encodeSlackApprovalAction, Tt as markdownToSlackMrkdwnChunks, W as encodeSlackQuestionAction, X as parseSlackBlocksInput, _t as SLACK_SECTION_TEXT_MAX, at as hasSlackNativeDataBlock, ft as buildSlackDataTableBlock, j as SLACK_BUTTON_ACTION_IDS, k as truncateSlackText, lt as buildSlackDataVisualizationBlock, mt as countSlackDataTableCellCharacters, nt as buildSlackCompleteBlocksFallbackText, ot as renderSlackBlockFallbackText, pt as countSlackDataTableBlocksCellCharacters, rt as buildSlackNativeDataAccessibilityText, tt as buildSlackBlocksFallbackText, ut as hasSlackDataVisualizationBlock, vt as renderSlackMessagePresentationChartFallbackText, wt as chunkSlackMrkdwnText } from "./probe-DhQ6LeKX.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";
|
|
@@ -123,9 +123,14 @@ function buildSlackPresentationBlocks(presentation, options = {}) {
|
|
|
123
123
|
function buildSlackPresentationBlocksIfComplete(presentation, options = {}) {
|
|
124
124
|
return compileSlackPresentationBlocks(presentation, options, true);
|
|
125
125
|
}
|
|
126
|
+
/** Percent-encodes the characters that end or split a Slack `<url|label>` link. */
|
|
127
|
+
function encodeSlackLinkUrl(url) {
|
|
128
|
+
return url.replace(/[<>|]/g, (character) => encodeURIComponent(character));
|
|
129
|
+
}
|
|
126
130
|
function compileSlackPresentationBlocks(presentation, options, requireComplete) {
|
|
127
131
|
if (!presentation) return [];
|
|
128
|
-
|
|
132
|
+
const linkedTitle = presentation.title && presentation.titleUrl ? `*<${encodeSlackLinkUrl(presentation.titleUrl)}|${escapeSlackMrkdwn(presentation.title.trim())}>*` : void 0;
|
|
133
|
+
if (requireComplete && presentation.title && (linkedTitle === void 0 ? presentation.title.trim().length > 150 : linkedTitle.length > 3e3)) return;
|
|
129
134
|
let tables = [];
|
|
130
135
|
let cellCharacterCount = options.dataTableCellCharacterCountOffset ?? 0;
|
|
131
136
|
for (const block of presentation.blocks) {
|
|
@@ -140,10 +145,26 @@ function compileSlackPresentationBlocks(presentation, options, requireComplete)
|
|
|
140
145
|
}
|
|
141
146
|
if (requireComplete && !tables) return;
|
|
142
147
|
const blocks = [];
|
|
143
|
-
if (
|
|
144
|
-
type: "
|
|
145
|
-
text:
|
|
148
|
+
if (linkedTitle !== void 0 && linkedTitle.length <= 3e3) blocks.push({
|
|
149
|
+
type: "section",
|
|
150
|
+
text: {
|
|
151
|
+
type: "mrkdwn",
|
|
152
|
+
text: linkedTitle
|
|
153
|
+
}
|
|
146
154
|
});
|
|
155
|
+
else if (presentation.title) {
|
|
156
|
+
blocks.push({
|
|
157
|
+
type: "header",
|
|
158
|
+
text: buildSlackPlainText(presentation.title, 150)
|
|
159
|
+
});
|
|
160
|
+
for (const chunk of presentation.titleUrl ? chunkSlackMrkdwnText(escapeSlackMrkdwn(presentation.titleUrl), SLACK_SECTION_TEXT_MAX) : []) blocks.push({
|
|
161
|
+
type: "section",
|
|
162
|
+
text: {
|
|
163
|
+
type: "mrkdwn",
|
|
164
|
+
text: chunk
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
147
168
|
const controlIndices = {
|
|
148
169
|
buttons: options.buttonIndexOffset ?? 0,
|
|
149
170
|
select: options.selectIndexOffset ?? 0
|
|
@@ -582,6 +603,7 @@ function compileSlackReplyBlockSegments(payload, channelBlocks, presentation) {
|
|
|
582
603
|
const presentationBlockOffset = readAllNativeBlocks(segments).length;
|
|
583
604
|
if (presentation?.title) appendPresentationPart(segments, {
|
|
584
605
|
title: presentation.title,
|
|
606
|
+
...presentation.titleUrl ? { titleUrl: presentation.titleUrl } : {},
|
|
585
607
|
blocks: []
|
|
586
608
|
}, questionOptionIndices);
|
|
587
609
|
for (const block of presentation?.blocks ?? []) appendPresentationPart(segments, { blocks: [block] }, questionOptionIndices);
|
|
@@ -590,7 +612,7 @@ function compileSlackReplyBlockSegments(payload, channelBlocks, presentation) {
|
|
|
590
612
|
...resolveSlackBlockOffsets(readAllNativeBlocks(segments)),
|
|
591
613
|
questionOptionIndices
|
|
592
614
|
}) : [];
|
|
593
|
-
if (textIsFallback && payload.text?.trim() && renderedPresentationBlocks.every((block) => [
|
|
615
|
+
if (textIsFallback && payload.text?.trim() && !presentation?.titleUrl && renderedPresentationBlocks.every((block) => [
|
|
594
616
|
"header",
|
|
595
617
|
"section",
|
|
596
618
|
"context",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as __exportAll } from "./doctor-contract-CcNdculn.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { c as resolveWorkspaceQualifiedSlackTarget } from "./target-parsing-DaLcdOoQ.mjs";
|
|
3
3
|
import { n as collectSlackCursorPages, r as fetchSlackChannelListPage } from "./cursor-pages-DiOrzZtc.mjs";
|
|
4
4
|
import { t as createSlackLookupClient } from "./client-DQqLIemQ.mjs";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as __exportAll } from "./doctor-contract-CcNdculn.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { c as resolveWorkspaceQualifiedSlackTarget } from "./target-parsing-DaLcdOoQ.mjs";
|
|
3
3
|
import { n as collectSlackCursorPages } from "./cursor-pages-DiOrzZtc.mjs";
|
|
4
4
|
import { t as createSlackLookupClient } from "./client-DQqLIemQ.mjs";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v as formatSlackError } from "./probe-DhQ6LeKX.mjs";
|
|
2
2
|
import { n as createSlackReadClient } from "./client-DQqLIemQ.mjs";
|
|
3
3
|
import { isRecord, normalizeOptionalString, normalizeTrimmedStringList, sortUniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
// extensions/slack/src/scopes.ts
|