@openclaw/slack 2026.11.7 → 2026.11.10-beta.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/README.md +16 -0
- package/dist/.setup/{account-configured-zcR9TJJN.mjs → account-configured-35y0-Hso.mjs} +1 -2
- package/dist/.setup/{account-inspect-BLVha-ov.mjs → account-inspect-DgQgj0wk.mjs} +3 -4
- package/dist/.setup/{accounts-CGJScKtk.mjs → accounts-EaPP0fFY.mjs} +6 -10
- package/dist/.setup/{action-runtime-D01wBhx5.mjs → action-runtime-Cs2IxOLc.mjs} +13 -12
- package/dist/.setup/action-runtime.runtime-me4Yd3j7.mjs +1 -0
- package/dist/.setup/{actions-D5S6D_BU.mjs → actions-BNOabmV6.mjs} +16 -24
- package/dist/.setup/{approval-handler.runtime-Buw5jh2Y.mjs → approval-handler.runtime-C2C-jNxi.mjs} +7 -8
- package/dist/.setup/{approval-message-updates-pmXcve5E.mjs → approval-message-updates-Bx2u_5-z.mjs} +2 -3
- package/dist/.setup/{channel-DSi3yBu5.mjs → channel-CSbCHg-I.mjs} +66 -53
- package/dist/.setup/{channel-meta-C443t-lI.mjs → channel-meta-C5vsCo3a.mjs} +1 -2
- package/dist/.setup/{channel-type-B5P3w9eA.mjs → channel-type-ZG0ErPTI.mjs} +5 -6
- package/dist/.setup/{channel.setup-Lq2OxKkF.mjs → channel.setup-DNnvYUKL.mjs} +10 -14
- package/dist/.setup/{config-schema-BWAaa5au.mjs → config-schema-DO2u-jsa.mjs} +5 -7
- package/dist/.setup/{cursor-pages-CATAzbTT.mjs → cursor-pages-jVn3Vkfi.mjs} +4 -8
- package/dist/.setup/{directory-config-D-hf9KGQ.mjs → directory-config-CGvKYg9F.mjs} +5 -6
- package/dist/.setup/{directory-live-onKAFI1E.mjs → directory-live-DNdw97LA.mjs} +4 -5
- package/dist/.setup/{doctor-contract-9-QJRCXk.mjs → doctor-contract-BB2KJ9Ni.mjs} +7 -13
- package/dist/.setup/fork-DTKBA8Fm.mjs +155 -0
- package/dist/.setup/literal-text-DdCRYzYh.mjs +24 -0
- package/dist/.setup/{message-tool-api-LGIgVXJf.mjs → message-tool-api-B38BpEaE.mjs} +5 -7
- package/dist/.setup/{monitor-CZGrHb5a.mjs → monitor-C4cpeg1H.mjs} +105 -148
- package/dist/.setup/{outbound-adapter-C-95EWl2.mjs → outbound-adapter-1JpFMcJD.mjs} +14 -11
- package/dist/.setup/{paths-B1u59oLK.mjs → paths-CQZI_5WY.mjs} +1 -2
- package/dist/.setup/{pipeline.runtime-B-EtO-8F.mjs → pipeline.runtime-ozrJpZ8k.mjs} +100 -102
- package/dist/.setup/{policy-DxhGRvc2.mjs → policy-klXrk5vE.mjs} +3 -5
- package/dist/.setup/{probe-DANukR3O.mjs → probe-BHqvMbno.mjs} +72 -75
- package/dist/.setup/{question-delivery-CWC7sRhH.mjs → question-delivery-BGwm5Zmr.mjs} +2 -3
- package/dist/.setup/{relay-source-BH-NPqBP.mjs → relay-source-DEZ7qM1i.mjs} +3 -4
- package/dist/.setup/{replies-B5e7p3dD.mjs → replies-BK3Ht8o-.mjs} +8 -10
- package/dist/.setup/{reply-blocks-BzsXUUUL.mjs → reply-blocks-CFy-O-2B.mjs} +4 -7
- package/dist/.setup/{resolve-channels-XDPgnesf.mjs → resolve-channels-CF2JME9q.mjs} +4 -5
- package/dist/.setup/{resolve-users-aDAv24U2.mjs → resolve-users-DDcCAjH1.mjs} +4 -5
- package/dist/.setup/{rolldown-runtime-B4FMCO8f.mjs → rolldown-runtime-nwUcYXjP.mjs} +1 -2
- package/dist/.setup/{runtime-JSVZSWAj.mjs → runtime-C6HKn7Av.mjs} +1 -2
- package/dist/.setup/runtime-setter-api-DrXr965r.mjs +2 -0
- package/dist/.setup/{scopes-BocHwImV.mjs → scopes-DKl6yqIv.mjs} +3 -4
- package/dist/.setup/{secret-contract-uiQtoNlu.mjs → secret-contract-CqVqR7MP.mjs} +2 -3
- package/dist/.setup/{secret-contract-api-BlLz88mj.mjs → secret-contract-api-DaCXZ47j.mjs} +1 -1
- package/dist/.setup/{security-audit-DFGiFLqd.mjs → security-audit-C3hXCfDt.mjs} +2 -3
- package/dist/.setup/{send-yK6_-px6.mjs → send-kGJWQtLk.mjs} +20 -38
- package/dist/.setup/{send-results-BGxlroJ-.mjs → send-results-Bm6V1ekL.mjs} +1 -2
- package/dist/.setup/setup-plugin-api-UWUSCOAK.mjs +2 -0
- package/dist/.setup/{setup-surface-C0KRtyqa.mjs → setup-surface-CPFVFPFM.mjs} +6 -7
- package/dist/.setup/{slash-dispatch.runtime-CZuMRdRx.mjs → slash-dispatch.runtime-B2oWiis5.mjs} +1 -1
- package/dist/.setup/{target-parsing-Bx2UZniD.mjs → target-parsing-DwYAP3ts.mjs} +1 -2
- package/dist/.setup/{targets-D-ASeWHy.mjs → targets-eeOxA_b_.mjs} +2 -3
- package/dist/.setup/{thread-ts-Cvt7WD6B.mjs → thread-ts-47Au2-Yn.mjs} +1 -2
- package/dist/.source-module-urls/c5ffd0957b234c7c12090e7de4eca2482ef339b8561e078da55b734211b0ba58.json +1 -1
- package/dist/account-inspect-api.js +2 -3
- package/dist/api.js +16 -16
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-entry.js +1 -2
- package/dist/channel-plugin-api.js +1 -1
- package/dist/configured-state.js +2 -3
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/index.js +1 -2
- package/dist/message-tool-api.js +1 -1
- package/dist/runtime-api.js +10 -10
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/setup-entry.js +4 -5
- package/dist/setup-plugin-api.js +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/zlib.d.ts +752 -0
- package/node_modules/@slack/bolt/node_modules/qs/.editorconfig +1 -1
- package/node_modules/@slack/bolt/node_modules/qs/CHANGELOG.md +87 -22
- package/node_modules/@slack/bolt/node_modules/qs/README.md +63 -10
- package/node_modules/@slack/bolt/node_modules/qs/dist/qs.js +17 -17
- package/node_modules/@slack/bolt/node_modules/qs/eslint.config.mjs +61 -50
- package/node_modules/@slack/bolt/node_modules/qs/lib/formats.js +7 -2
- package/node_modules/@slack/bolt/node_modules/qs/lib/parse.js +29 -10
- package/node_modules/@slack/bolt/node_modules/qs/lib/stringify.js +5 -3
- package/node_modules/@slack/bolt/node_modules/qs/lib/utils.js +28 -9
- package/node_modules/@slack/bolt/node_modules/qs/package.json +6 -6
- package/node_modules/@slack/bolt/node_modules/qs/test/parse.js +335 -2
- package/node_modules/@slack/bolt/node_modules/qs/test/stringify.js +222 -0
- package/node_modules/@slack/bolt/node_modules/qs/test/utils.js +61 -3
- package/node_modules/@slack/types/dist/block-kit/block-elements.d.ts +14 -0
- package/node_modules/@slack/types/dist/block-kit/block-elements.d.ts.map +1 -1
- package/node_modules/@slack/types/dist/block-kit/blocks.d.ts +65 -1
- package/node_modules/@slack/types/dist/block-kit/blocks.d.ts.map +1 -1
- package/node_modules/@slack/types/dist/events/index.d.ts +2 -2
- package/node_modules/@slack/types/dist/events/index.d.ts.map +1 -1
- package/node_modules/@slack/types/dist/events/index.js.map +1 -1
- package/node_modules/@slack/types/dist/events/message.d.ts +4 -0
- package/node_modules/@slack/types/dist/events/message.d.ts.map +1 -1
- package/node_modules/@slack/types/dist/events/user.d.ts +20 -0
- package/node_modules/@slack/types/dist/events/user.d.ts.map +1 -1
- package/node_modules/@slack/types/package.json +1 -1
- package/node_modules/@slack/web-api/dist/WebClient.js +1 -1
- package/node_modules/@slack/web-api/dist/WebClient.js.map +1 -1
- package/node_modules/@slack/web-api/dist/file-upload.js +1 -1
- package/node_modules/@slack/web-api/dist/file-upload.js.map +1 -1
- package/node_modules/@slack/web-api/dist/methods.d.ts +18 -3
- package/node_modules/@slack/web-api/dist/methods.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/methods.js +16 -1
- package/node_modules/@slack/web-api/dist/methods.js.map +1 -1
- package/node_modules/@slack/web-api/dist/types/request/apps.d.ts +62 -0
- package/node_modules/@slack/web-api/dist/types/request/apps.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/types/request/canvas.d.ts +4 -0
- package/node_modules/@slack/web-api/dist/types/request/canvas.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/types/request/files.d.ts +5 -1
- package/node_modules/@slack/web-api/dist/types/request/files.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/types/request/index.d.ts +2 -2
- package/node_modules/@slack/web-api/dist/types/request/index.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/types/request/manifest.d.ts +35 -3
- package/node_modules/@slack/web-api/dist/types/request/manifest.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/types/request/team.d.ts +6 -0
- package/node_modules/@slack/web-api/dist/types/request/team.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionBulkUpdateResponse.d.ts +19 -0
- package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionBulkUpdateResponse.d.ts.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionBulkUpdateResponse.js +11 -0
- package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionBulkUpdateResponse.js.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionRequestAuthResponse.d.ts +14 -0
- package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionRequestAuthResponse.d.ts.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionRequestAuthResponse.js +11 -0
- package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionRequestAuthResponse.js.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/CanvasesGetContentResponse.d.ts +10 -0
- package/node_modules/@slack/web-api/dist/types/response/CanvasesGetContentResponse.d.ts.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/CanvasesGetContentResponse.js +11 -0
- package/node_modules/@slack/web-api/dist/types/response/CanvasesGetContentResponse.js.map +1 -0
- package/node_modules/@slack/web-api/dist/types/response/TeamInfoResponse.d.ts +1 -0
- package/node_modules/@slack/web-api/dist/types/response/TeamInfoResponse.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/types/response/index.d.ts +3 -0
- package/node_modules/@slack/web-api/dist/types/response/index.d.ts.map +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/zlib.d.ts +752 -0
- package/node_modules/@slack/web-api/package.json +3 -3
- package/node_modules/typebox/build/format/date_time.d.mts +2 -1
- package/node_modules/typebox/build/format/date_time.mjs +12 -3
- package/node_modules/typebox/package.json +1 -1
- package/openclaw.plugin.json +13 -8
- package/package.json +7 -7
- package/dist/.setup/action-runtime.runtime-VQGaR6g8.mjs +0 -1
- package/dist/.setup/runtime-setter-api-Cx_PV-xu.mjs +0 -2
- package/dist/.setup/setup-plugin-api-Cfz58xoh.mjs +0 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { d as resolveSlackMarkdownOptions, f as resolveSlackOperationToken, s as resolveSlackAccount } from "./accounts-
|
|
2
|
-
import { a as parseSlackTarget } from "./target-parsing-
|
|
3
|
-
import {
|
|
4
|
-
import { r as resolveSlackThreadTsValue } from "./thread-ts-
|
|
5
|
-
import { a as resolveSlackReplyBlockResolution, d as resolveSlackAuthoredTextPlacement, r as normalizeSlackReplyPayload, s as resolveSlackReplyDeliveryMessages } from "./reply-blocks-
|
|
6
|
-
import { t as mergeSlackSendResults } from "./send-results-
|
|
7
|
-
import { t as registerSlackQuestionDelivery } from "./question-delivery-
|
|
1
|
+
import { d as resolveSlackMarkdownOptions, f as resolveSlackOperationToken, s as resolveSlackAccount } from "./accounts-EaPP0fFY.mjs";
|
|
2
|
+
import { a as parseSlackTarget } from "./target-parsing-DwYAP3ts.mjs";
|
|
3
|
+
import { T as assertSlackDetachedTargetAllowed, Z as resolveSlackQuestionActionIds, _t as SLACK_PRESENTATION_CAPABILITIES, wt as SLACK_TEXT_LIMIT } from "./probe-BHqvMbno.mjs";
|
|
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-CFy-O-2B.mjs";
|
|
6
|
+
import { t as mergeSlackSendResults } from "./send-results-Bm6V1ekL.mjs";
|
|
7
|
+
import { t as registerSlackQuestionDelivery } from "./question-delivery-BGwm5Zmr.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";
|
|
@@ -14,7 +14,7 @@ import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-run
|
|
|
14
14
|
import { createHmac, randomBytes } from "node:crypto";
|
|
15
15
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
16
16
|
import { attachChannelToResult } from "openclaw/plugin-sdk/channel-send-result";
|
|
17
|
-
|
|
17
|
+
// extensions/slack/src/outbound-adapter.ts
|
|
18
18
|
function toSlackOutboundResult(result) {
|
|
19
19
|
const { channelId, ...delivery } = result;
|
|
20
20
|
return attachChannelToResult("slack", channelId === void 0 ? delivery : {
|
|
@@ -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-kGJWQtLk.mjs").then((n) => n.n));
|
|
49
49
|
function resolveSlackSendIdentity(identity) {
|
|
50
50
|
if (!identity) return;
|
|
51
51
|
const username = normalizeOptionalString(identity.name);
|
|
@@ -116,6 +116,7 @@ async function prepareSlackOutboundSend(ctx) {
|
|
|
116
116
|
...params.authoredTextPlacement ? { authoredTextPlacement: params.authoredTextPlacement } : {},
|
|
117
117
|
...Object.hasOwn(params, "nativeDataFallbackBaseText") ? { nativeDataFallbackBaseText: params.nativeDataFallbackBaseText } : {},
|
|
118
118
|
...params.textIsSlackPlainText ? { textIsSlackPlainText: true } : {},
|
|
119
|
+
...params.literalText ? { literalText: true } : {},
|
|
119
120
|
...slackIdentity ? { identity: slackIdentity } : {},
|
|
120
121
|
...params.deliveryQueueId ? { deliveryQueueId: params.deliveryQueueId } : {},
|
|
121
122
|
...params.onPlatformSendDispatch ? { onPlatformSendDispatch: params.onPlatformSendDispatch } : {},
|
|
@@ -161,7 +162,10 @@ const slackOutbound = {
|
|
|
161
162
|
const slackData = payload.channelData?.slack;
|
|
162
163
|
const resolution = readSlackRenderedPresentation(slackData) ?? resolveSlackOutboundBlockResolution(payload, resolveSlackMarkdownOptions(ctx));
|
|
163
164
|
if (resolution.segments.length === 0) {
|
|
164
|
-
const sendPart = async (part) => toSlackOutboundResult(await send(
|
|
165
|
+
const sendPart = async (part) => toSlackOutboundResult(await send({
|
|
166
|
+
...part,
|
|
167
|
+
literalText: slackData?.literalText === true
|
|
168
|
+
}));
|
|
165
169
|
return await sendTextMediaPayload({
|
|
166
170
|
channel: "slack",
|
|
167
171
|
ctx: {
|
|
@@ -248,5 +252,4 @@ const slackOutbound = {
|
|
|
248
252
|
}));
|
|
249
253
|
}
|
|
250
254
|
};
|
|
251
|
-
//#endregion
|
|
252
255
|
export { slackOutbound };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// extensions/slack/src/http/paths.ts
|
|
2
2
|
function normalizeSlackWebhookPath(path) {
|
|
3
3
|
const trimmed = path?.trim();
|
|
4
4
|
if (!trimmed) return "/slack/events";
|
|
5
5
|
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { normalizeSlackWebhookPath as t };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { n as __reExport, t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { d as resolveSlackMarkdownOptions, o as resolveDefaultSlackAccountId, p as resolveSlackReplyToMode } from "./accounts-
|
|
3
|
-
import { n as formatSlackTarget } from "./target-parsing-
|
|
4
|
-
import {
|
|
5
|
-
import { n as resolveSlackReplyThreadTs } from "./thread-ts-
|
|
6
|
-
import { c as resolveSlackReplyRenderPlan, i as prepareSlackReply, o as resolveSlackReplyBlocks } from "./reply-blocks-
|
|
7
|
-
import { d as getOrCreateWeakOwnerMap, m as writeLruMapEntry, p as readLruMapEntry } from "./cursor-pages-
|
|
8
|
-
import { C as hasSlackTableBlock, D as buildSlackEditTextPayload, E as resolveSlackMessageText$1, T as resolveSlackBlocksText, a as editSlackRenderedMessage, b as formatSlackFileReference, d as reactSlackMessage, i as editSlackMessage, m as removeSlackReaction, n as deleteSlackMessage, w as isSlackUnfurlAttachment, x as formatSlackFileReferenceList } from "./actions-
|
|
9
|
-
import { a as clearSlackThreadFailureNotice, c as hasSlackThreadParticipation, d as recordSlackThreadParticipation, h as buildSlackNativeDataDeliveryPlan, l as hasSlackThreadParticipationWithPersistence, m as hasSlackMessageIdentity, s as hasSlackThreadFailureNotice, t as sendMessageSlack, u as recordSlackThreadFailureNotice } from "./send-
|
|
10
|
-
import { n as resolveSlackChannelConfig } from "./policy-
|
|
11
|
-
import { C as normalizeSlackChannelType, D as stripSlackMentionsForCommandDetection, E as readSlackAssistantThreadContext, T as buildSlackAssistantThreadMetadata, _ as SlackStreamNotDeliveredError, b as startSlackStream, c as registerSlackSessionRun, g as SlackStreamMessageTooLongError, h as resolveSlackEffectiveAllowFrom, l as resolveSlackThreadContext, m as resolveSlackCommandIngress, o as authorizeSlackDirectMessage, p as authorizeSlackBotRoomMessage, r as resolveSlackRoomContextHints, s as resolveSlackRoutingContext, u as trackSlackDraftMessage, v as appendSlackStream, w as resolveSlackChatType, x as stopSlackStream, y as markSlackStreamFallbackDelivered } from "./monitor-
|
|
12
|
-
import { a as emitSlackMessageSentHooks, i as sanitizeSlackMonitorReplyPayload, n as deliverReplies, t as createSlackReplyDeliveryPlan } from "./replies-
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
|
|
2
|
+
import { d as resolveSlackMarkdownOptions, o as resolveDefaultSlackAccountId, p as resolveSlackReplyToMode } from "./accounts-EaPP0fFY.mjs";
|
|
3
|
+
import { n as formatSlackTarget } from "./target-parsing-DwYAP3ts.mjs";
|
|
4
|
+
import { Dt as normalizeSlackOutboundText, Jt as resolveSlackUserAllowed, K as SLACK_SESSION_LINK_ACTION_ID, L as countSlackTextUtf8Bytes, Ot as escapeSlackMrkdwn, R as truncateSlackText, Wt as normalizeSlackAllowOwnerEntry, ct as buildSlackCompleteBlocksFallbackText, g as formatSlackError, j as hasSlackNativeDataBlock, st as buildSlackBlocksFallbackText, wt as SLACK_TEXT_LIMIT, xt as SLACK_EDIT_TEXT_MAX_BYTES, y as qualifySlackRoutePeerId, z as truncateSlackTextByUtf8Bytes } from "./probe-BHqvMbno.mjs";
|
|
5
|
+
import { n as resolveSlackReplyThreadTs } from "./thread-ts-47Au2-Yn.mjs";
|
|
6
|
+
import { c as resolveSlackReplyRenderPlan, i as prepareSlackReply, o as resolveSlackReplyBlocks } from "./reply-blocks-CFy-O-2B.mjs";
|
|
7
|
+
import { d as getOrCreateWeakOwnerMap, m as writeLruMapEntry, p as readLruMapEntry } from "./cursor-pages-jVn3Vkfi.mjs";
|
|
8
|
+
import { C as hasSlackTableBlock, D as buildSlackEditTextPayload, E as resolveSlackMessageText$1, T as resolveSlackBlocksText, a as editSlackRenderedMessage, b as formatSlackFileReference, d as reactSlackMessage, i as editSlackMessage, m as removeSlackReaction, n as deleteSlackMessage, w as isSlackUnfurlAttachment, x as formatSlackFileReferenceList } from "./actions-BNOabmV6.mjs";
|
|
9
|
+
import { a as clearSlackThreadFailureNotice, c as hasSlackThreadParticipation, d as recordSlackThreadParticipation, h as buildSlackNativeDataDeliveryPlan, l as hasSlackThreadParticipationWithPersistence, m as hasSlackMessageIdentity, s as hasSlackThreadFailureNotice, t as sendMessageSlack, u as recordSlackThreadFailureNotice } from "./send-kGJWQtLk.mjs";
|
|
10
|
+
import { n as resolveSlackChannelConfig } from "./policy-klXrk5vE.mjs";
|
|
11
|
+
import { C as normalizeSlackChannelType, D as stripSlackMentionsForCommandDetection, E as readSlackAssistantThreadContext, T as buildSlackAssistantThreadMetadata, _ as SlackStreamNotDeliveredError, b as startSlackStream, c as registerSlackSessionRun, g as SlackStreamMessageTooLongError, h as resolveSlackEffectiveAllowFrom, l as resolveSlackThreadContext, m as resolveSlackCommandIngress, o as authorizeSlackDirectMessage, p as authorizeSlackBotRoomMessage, r as resolveSlackRoomContextHints, s as resolveSlackRoutingContext, u as trackSlackDraftMessage, v as appendSlackStream, w as resolveSlackChatType, x as stopSlackStream, y as markSlackStreamFallbackDelivered } from "./monitor-C4cpeg1H.mjs";
|
|
12
|
+
import { a as emitSlackMessageSentHooks, i as sanitizeSlackMonitorReplyPayload, n as deliverReplies, t as createSlackReplyDeliveryPlan } from "./replies-BK3Ht8o-.mjs";
|
|
13
13
|
import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
14
14
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
15
15
|
import { resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
|
|
@@ -17,11 +17,11 @@ import { buildChannelProgressDraftLine, compactChannelProgressDraftLine, createC
|
|
|
17
17
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
18
18
|
import { danger, logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
19
19
|
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
20
|
-
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
21
20
|
import { normalizeStringEntriesLower } from "openclaw/plugin-sdk/string-normalization-runtime";
|
|
22
21
|
import { createStaleWhileRevalidateCache } from "openclaw/plugin-sdk/collection-runtime";
|
|
23
22
|
import { asFiniteNumberInRange, parseStrictFiniteNumber, resolvePromptHistoryLimit } from "openclaw/plugin-sdk/number-runtime";
|
|
24
23
|
import { buildTtsSupplementMediaPayload, getReplyPayloadTtsSupplement, isReplyPayloadNonTerminalToolErrorWarning, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
24
|
+
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
25
25
|
import { hash } from "node:crypto";
|
|
26
26
|
import { resolveChannelImplicitMentions } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
27
27
|
import fs from "node:fs/promises";
|
|
@@ -34,6 +34,7 @@ import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-ru
|
|
|
34
34
|
import { getSessionEntryAsync, readSessionUpdatedAtAsync, resolveChannelResetConfig, resolveStorePath, updateLastRoute } from "openclaw/plugin-sdk/session-store-runtime";
|
|
35
35
|
import { enqueueRoutedSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
|
|
36
36
|
import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
|
|
37
|
+
import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
|
|
37
38
|
import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
38
39
|
import { buildChannelInboundEventContext, buildMentionRegexes, classifyChannelInboundEvent, dispatchChannelInboundTurn, formatInboundEnvelope, formatInboundMediaUnavailableText, hasVisibleInboundReplyDispatch, isGroupThreadRouteExclusive, matchesMentionWithExplicit, readAgentRunTerminalOutcome, resolveEnvelopeFormatOptions, resolveGroupThreadConfig, resolveGroupThreadMentionFacts, resolveInboundMentionDecision, resolveUnmentionedGroupInboundPolicy, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
39
40
|
import { resolveGatewayPublicOrigin } from "openclaw/plugin-sdk/config-contracts";
|
|
@@ -41,11 +42,10 @@ import { buildControlUiSessionPath } from "openclaw/plugin-sdk/session-discussio
|
|
|
41
42
|
import { createStatusReactionController, logAckFailure, logTypingFailure, resolveAckReaction, shouldAckReaction } from "openclaw/plugin-sdk/channel-feedback";
|
|
42
43
|
import { hasControlCommand } from "openclaw/plugin-sdk/command-detection";
|
|
43
44
|
import { isAbortRequestText } from "openclaw/plugin-sdk/command-primitives-runtime";
|
|
44
|
-
import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
|
|
45
45
|
import { resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
|
|
46
46
|
import { DEFAULT_GROUP_HISTORY_LIMIT, buildHistoryContextFromEntries, buildInboundHistoryFromEntries } from "openclaw/plugin-sdk/reply-history";
|
|
47
47
|
import { createChannelPreflightAudio, formatAudioTranscriptForAgent } from "openclaw/plugin-sdk/media-understanding-runtime";
|
|
48
|
-
|
|
48
|
+
// extensions/slack/src/monitor/message-handler/timestamp.ts
|
|
49
49
|
const SLACK_TIMESTAMP_RE = /^\d+(?:\.\d+)?$/;
|
|
50
50
|
const MAX_SAFE_SLACK_TIMESTAMP_SECONDS = Number.MAX_SAFE_INTEGER / 1e3;
|
|
51
51
|
function resolveSlackTimestampMs(ts) {
|
|
@@ -57,8 +57,7 @@ function resolveSlackTimestampMs(ts) {
|
|
|
57
57
|
});
|
|
58
58
|
return seconds === void 0 ? void 0 : Math.round(seconds * 1e3);
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
//#region extensions/slack/src/monitor/message-handler/dispatch-helpers.ts
|
|
60
|
+
// extensions/slack/src/monitor/message-handler/dispatch-helpers.ts
|
|
62
61
|
function resolveSlackBotLoopProtection(prepared) {
|
|
63
62
|
const senderBotId = prepared.message.bot_id;
|
|
64
63
|
if (!senderBotId) return;
|
|
@@ -133,8 +132,7 @@ async function resolveSlackStreamRecipientTeamId(params) {
|
|
|
133
132
|
}
|
|
134
133
|
return params.fallbackTeamId;
|
|
135
134
|
}
|
|
136
|
-
|
|
137
|
-
//#region extensions/slack/src/draft-stream.ts
|
|
135
|
+
// extensions/slack/src/draft-stream.ts
|
|
138
136
|
const DEFAULT_THROTTLE_MS = 1e3;
|
|
139
137
|
function createSlackDraftStream(params) {
|
|
140
138
|
const maxChars = Math.min(params.maxChars ?? 8e3, SLACK_TEXT_LIMIT);
|
|
@@ -305,8 +303,7 @@ function createSlackDraftStream(params) {
|
|
|
305
303
|
channelId: () => streamMessage?.channelId
|
|
306
304
|
};
|
|
307
305
|
}
|
|
308
|
-
|
|
309
|
-
//#region extensions/slack/src/stream-mode.ts
|
|
306
|
+
// extensions/slack/src/stream-mode.ts
|
|
310
307
|
function resolveSlackStreamingConfig(params) {
|
|
311
308
|
return {
|
|
312
309
|
mode: params.streaming?.mode ?? "progress",
|
|
@@ -355,8 +352,7 @@ function applyAppendOnlyStreamUpdate(params) {
|
|
|
355
352
|
changed: true
|
|
356
353
|
};
|
|
357
354
|
}
|
|
358
|
-
|
|
359
|
-
//#region extensions/slack/src/progress-blocks.ts
|
|
355
|
+
// extensions/slack/src/progress-blocks.ts
|
|
360
356
|
const SLACK_PROGRESS_FIELD_MAX = 1800;
|
|
361
357
|
const DEFAULT_SLACK_PROGRESS_DETAIL_MAX_CHARS = 120;
|
|
362
358
|
const DEFAULT_SLACK_PROGRESS_TASK_DETAIL_MAX_CHARS = 48;
|
|
@@ -729,8 +725,7 @@ function reconcileSlackNativeTaskChunks(params) {
|
|
|
729
725
|
}
|
|
730
726
|
};
|
|
731
727
|
}
|
|
732
|
-
|
|
733
|
-
//#region extensions/slack/src/monitor/message-handler/dispatch-progress-render.ts
|
|
728
|
+
// extensions/slack/src/monitor/message-handler/dispatch-progress-render.ts
|
|
734
729
|
function resolveStructuredProgressLines(lines) {
|
|
735
730
|
return lines.map((line) => {
|
|
736
731
|
if (typeof line !== "string") return line;
|
|
@@ -771,8 +766,7 @@ function isSlackProgressTitleText(text, snapshot, explicitTitle) {
|
|
|
771
766
|
const title = normalizeProgressText(combineProgressHeadlineAndExplanation(explicitTitle ?? (snapshot.statusHeadlineFormat === "plain" ? void 0 : snapshot.statusHeadline), snapshot.planExplanationFormat === "plain" ? void 0 : snapshot.planExplanation));
|
|
772
767
|
return title.length > 0 && title.includes(candidate);
|
|
773
768
|
}
|
|
774
|
-
|
|
775
|
-
//#region extensions/slack/src/monitor/message-handler/preview-finalize.ts
|
|
769
|
+
// extensions/slack/src/monitor/message-handler/preview-finalize.ts
|
|
776
770
|
function blocksMatch(expected, actual) {
|
|
777
771
|
if (!expected?.length) return !actual?.length;
|
|
778
772
|
if (!actual?.length) {
|
|
@@ -843,8 +837,7 @@ async function finalizeSlackPreviewEdit(params) {
|
|
|
843
837
|
throw err;
|
|
844
838
|
}
|
|
845
839
|
}
|
|
846
|
-
|
|
847
|
-
//#region extensions/slack/src/monitor/message-handler/dispatch-progress-card.ts
|
|
840
|
+
// extensions/slack/src/monitor/message-handler/dispatch-progress-card.ts
|
|
848
841
|
const MAX_VISIBLE_WORK_LINKS = 5;
|
|
849
842
|
function createSlackDraftProgressCardRuntime(params) {
|
|
850
843
|
const { cfg, prepared, slackClient } = params.setup;
|
|
@@ -972,8 +965,7 @@ function formatSlackProgressDraftLine(line) {
|
|
|
972
965
|
enclosingStyle: "italic"
|
|
973
966
|
})}_`;
|
|
974
967
|
}
|
|
975
|
-
|
|
976
|
-
//#region extensions/slack/src/monitor/message-handler/dispatch-progress-native.ts
|
|
968
|
+
// extensions/slack/src/monitor/message-handler/dispatch-progress-native.ts
|
|
977
969
|
function createSlackNativeProgressTransport(params) {
|
|
978
970
|
const { replyPlan } = params.setup;
|
|
979
971
|
const { delivery } = params;
|
|
@@ -1034,13 +1026,14 @@ function createSlackNativeProgressTransport(params) {
|
|
|
1034
1026
|
waitForStart
|
|
1035
1027
|
};
|
|
1036
1028
|
}
|
|
1037
|
-
|
|
1038
|
-
//#region extensions/slack/src/monitor/message-handler/dispatch-progress.ts
|
|
1029
|
+
// extensions/slack/src/monitor/message-handler/dispatch-progress.ts
|
|
1039
1030
|
function createSlackProgressRuntime(runtimeParams) {
|
|
1040
1031
|
const { setup, delivery } = runtimeParams;
|
|
1041
1032
|
const { cfg, hasSlackCustomIdentity, prepared, replyPlan, runtime, slackIdentity, slackStreaming, slackProgressStyle, quietProgress, shouldUseDraftStream, useStreaming, previewStreamingEnabled } = setup;
|
|
1042
1033
|
const { account, ctx, message, slackMessageMetadata } = prepared;
|
|
1043
|
-
const
|
|
1034
|
+
const isProgressMode = slackStreaming.mode === "progress";
|
|
1035
|
+
const useNativeProgressStreaming = useStreaming && isProgressMode;
|
|
1036
|
+
const draftStream = shouldUseDraftStream || useNativeProgressStreaming ? createSlackDraftStream({
|
|
1044
1037
|
target: prepared.replyTarget,
|
|
1045
1038
|
cfg,
|
|
1046
1039
|
token: ctx.botToken,
|
|
@@ -1056,12 +1049,10 @@ function createSlackProgressRuntime(runtimeParams) {
|
|
|
1056
1049
|
},
|
|
1057
1050
|
warn: logVerbose
|
|
1058
1051
|
}) : void 0;
|
|
1059
|
-
const
|
|
1060
|
-
const useNativeProgressStreaming = useStreaming && slackStreaming.mode === "progress";
|
|
1061
|
-
const progressDraftActive = Boolean(draftStream) || useNativeProgressStreaming;
|
|
1052
|
+
const progressDraftActive = Boolean(draftStream);
|
|
1062
1053
|
const previewToolProgressEnabled = progressDraftActive && resolveChannelStreamingPreviewToolProgress(account.config, slackStreaming.mode !== "progress", slackStreaming.mode);
|
|
1063
1054
|
const suppressDefaultToolProgressMessages = quietProgress || resolveChannelStreamingSuppressDefaultToolProgressMessages(account.config, {
|
|
1064
|
-
draftStreamActive:
|
|
1055
|
+
draftStreamActive: progressDraftActive,
|
|
1065
1056
|
mode: slackStreaming.mode,
|
|
1066
1057
|
previewToolProgressEnabled,
|
|
1067
1058
|
previewStreamingEnabled
|
|
@@ -1088,7 +1079,7 @@ function createSlackProgressRuntime(runtimeParams) {
|
|
|
1088
1079
|
const progressWorkCounter = createChannelProgressWorkCounter();
|
|
1089
1080
|
const progressSeed = `${account.accountId}:${message.channel}`;
|
|
1090
1081
|
const preambleOnlyProgress = isProgressMode && slackProgressStyle === "compact" && !previewToolProgressEnabled;
|
|
1091
|
-
const useDraftProgressCard =
|
|
1082
|
+
const useDraftProgressCard = shouldUseDraftStream && isProgressMode && slackProgressStyle === "card";
|
|
1092
1083
|
const explicitProgressTitle = resolveExplicitSlackProgressTitle(account.config);
|
|
1093
1084
|
const progressDraftMaxLineChars = resolveChannelProgressDraftMaxLineChars(account.config);
|
|
1094
1085
|
const progressCard = createSlackDraftProgressCardRuntime({
|
|
@@ -1113,7 +1104,7 @@ function createSlackProgressRuntime(runtimeParams) {
|
|
|
1113
1104
|
const appendNativeProgressCompletion = async (isError) => {
|
|
1114
1105
|
const session = delivery.streamSession;
|
|
1115
1106
|
if (isError) nativeProgressTerminalStatus = "error";
|
|
1116
|
-
if (!session || nativeProgressCompletionSent) return;
|
|
1107
|
+
if (!session || delivery.streamFailed || nativeProgressCompletionSent) return;
|
|
1117
1108
|
const chunks = buildNativeProgressCompletionChunks(isError ? "error" : "complete");
|
|
1118
1109
|
const narrationUpdate = resolveNarrationUpdate(resolveNativeProgressNarration(progressDraft.getSnapshot()));
|
|
1119
1110
|
if (!chunks?.length && !narrationUpdate.delta) return;
|
|
@@ -1167,6 +1158,7 @@ function createSlackProgressRuntime(runtimeParams) {
|
|
|
1167
1158
|
...narrationUpdate.delta ? { text: narrationUpdate.delta } : {},
|
|
1168
1159
|
...chunks?.length ? { chunks } : {}
|
|
1169
1160
|
};
|
|
1161
|
+
if (narrationUpdate.delta) delivery.pendingTextIsProgress = true;
|
|
1170
1162
|
const accepted = hadSession ? await nativeTransport.append(streamUpdate) : await nativeTransport.start(streamUpdate, retainedThreadTs);
|
|
1171
1163
|
if (accepted === "rotated") return await updateNativeProgressStreamNow();
|
|
1172
1164
|
if (!accepted) return false;
|
|
@@ -1229,19 +1221,19 @@ function createSlackProgressRuntime(runtimeParams) {
|
|
|
1229
1221
|
reasoningGate: !preambleOnlyProgress,
|
|
1230
1222
|
updateOnLineChange: useNativeProgressStreaming || useDraftProgressCard || preambleOnlyProgress,
|
|
1231
1223
|
update: async (previewText, options) => {
|
|
1232
|
-
if (useNativeProgressStreaming) {
|
|
1224
|
+
if (useNativeProgressStreaming && !delivery.streamFailed) {
|
|
1233
1225
|
const priorSnapshot = nativeStreamSnapshot;
|
|
1234
1226
|
const priorNarration = nativeNarration.rendered;
|
|
1235
1227
|
nativeUpdates.update(true);
|
|
1236
1228
|
if (options?.flush) await nativeUpdates.flush();
|
|
1237
1229
|
else await nativeUpdates.waitForInFlight();
|
|
1238
|
-
return priorSnapshot !== nativeStreamSnapshot || priorNarration !== nativeNarration.rendered;
|
|
1230
|
+
if (!delivery.streamFailed) return priorSnapshot !== nativeStreamSnapshot || priorNarration !== nativeNarration.rendered;
|
|
1239
1231
|
}
|
|
1240
|
-
if (!draftStream) return false;
|
|
1232
|
+
if (!draftStream || delivery.streamSession?.stoppedBySlack) return false;
|
|
1241
1233
|
const snapshot = options.snapshot;
|
|
1242
1234
|
const latestLine = snapshot.lines.at(-1);
|
|
1243
1235
|
if (preambleOnlyProgress && typeof latestLine === "object" && latestLine.complete === false) return false;
|
|
1244
|
-
const cardBlocks = useDraftProgressCard ? progressCard.resolvePresentation(snapshot, "working") : void 0;
|
|
1236
|
+
const cardBlocks = useDraftProgressCard || useNativeProgressStreaming ? progressCard.resolvePresentation(snapshot, "working") : void 0;
|
|
1245
1237
|
if (cardBlocks?.length === 0) {
|
|
1246
1238
|
if (cardPostRequested || draftStream.messageId()) {
|
|
1247
1239
|
cardPostRequested = false;
|
|
@@ -1268,7 +1260,7 @@ function createSlackProgressRuntime(runtimeParams) {
|
|
|
1268
1260
|
return Boolean(draftStream.messageId() && draftStream.channelId());
|
|
1269
1261
|
},
|
|
1270
1262
|
deleteCurrent: async () => {
|
|
1271
|
-
if (useNativeProgressStreaming) {
|
|
1263
|
+
if (useNativeProgressStreaming && !delivery.streamFailed) {
|
|
1272
1264
|
nativeUpdates.update(true);
|
|
1273
1265
|
await nativeUpdates.flush();
|
|
1274
1266
|
} else {
|
|
@@ -1356,6 +1348,8 @@ function createSlackProgressRuntime(runtimeParams) {
|
|
|
1356
1348
|
if (delivery.nativeProgressStreamStartPromise) await delivery.nativeProgressStreamStartPromise.catch(() => null);
|
|
1357
1349
|
if (completionChunks?.length) nativeProgressCompletionSent = true;
|
|
1358
1350
|
await delivery.finishStream(completionChunks);
|
|
1351
|
+
await previewLifecycle.cleanup();
|
|
1352
|
+
draftStream?.forceNewMessage();
|
|
1359
1353
|
delivery.streamSession = null;
|
|
1360
1354
|
delivery.nativeProgressStreamStartPromise = null;
|
|
1361
1355
|
delivery.nativeProgressStreamThreadTs = void 0;
|
|
@@ -1511,8 +1505,7 @@ function createSlackProgressRuntime(runtimeParams) {
|
|
|
1511
1505
|
updateDraftFromPartial
|
|
1512
1506
|
};
|
|
1513
1507
|
}
|
|
1514
|
-
|
|
1515
|
-
//#region extensions/slack/src/monitor/message-handler/dispatch-setup.ts
|
|
1508
|
+
// extensions/slack/src/monitor/message-handler/dispatch-setup.ts
|
|
1516
1509
|
async function createSlackDispatchSetup(prepared) {
|
|
1517
1510
|
const { ctx, account, message, route } = prepared;
|
|
1518
1511
|
const slackClient = prepared.eventScope?.client ?? ctx.app.client;
|
|
@@ -1728,8 +1721,7 @@ async function createSlackDispatchSetup(prepared) {
|
|
|
1728
1721
|
useStreaming
|
|
1729
1722
|
};
|
|
1730
1723
|
}
|
|
1731
|
-
|
|
1732
|
-
//#region extensions/slack/src/monitor/message-handler/dispatch-streaming.ts
|
|
1724
|
+
// extensions/slack/src/monitor/message-handler/dispatch-streaming.ts
|
|
1733
1725
|
function createSlackStreamingDeliveryRuntime(setup) {
|
|
1734
1726
|
const { isThreadReply, messageSentHookContext, messageSentHookTarget, prepared, replyDeliveryMode, replyPlan, runtime, slackClient, slackClientOptions, slackIdentity, slackStreamFallbackTeamId } = setup;
|
|
1735
1727
|
const { account, ctx, forcedReplyThreadTs, message, slackMessageMetadata } = prepared;
|
|
@@ -1745,6 +1737,7 @@ function createSlackStreamingDeliveryRuntime(setup) {
|
|
|
1745
1737
|
nativeProgressStreamStartPromise: null,
|
|
1746
1738
|
nativeProgressStreamThreadTs: void 0,
|
|
1747
1739
|
streamFailed: false,
|
|
1740
|
+
pendingTextIsProgress: false,
|
|
1748
1741
|
usedReplyThreadTs: void 0,
|
|
1749
1742
|
usedBlockReplyThreadTs: void 0,
|
|
1750
1743
|
observedReplyDelivery: false
|
|
@@ -1928,8 +1921,11 @@ function createSlackStreamingDeliveryRuntime(setup) {
|
|
|
1928
1921
|
threadTs: deliveryReplyThreadTs
|
|
1929
1922
|
}, preparedReply);
|
|
1930
1923
|
if (deliveryKey && deliveredKeys.has(deliveryKey)) return { visibleReplySent: false };
|
|
1924
|
+
const session = state.streamSession;
|
|
1925
|
+
const discardProgress = params.kind === "final" && state.pendingTextIsProgress;
|
|
1931
1926
|
const sent = await deliverPreparedReply(preparedReply, deliveryReplyThreadTs);
|
|
1932
1927
|
if (!sent?.receipt.platformMessageIds.length) return { visibleReplySent: false };
|
|
1928
|
+
if (discardProgress && session?.pendingText && !session.stopped) markSlackStreamFallbackDelivered(session);
|
|
1933
1929
|
state.observedReplyDelivery = true;
|
|
1934
1930
|
const deliveredThreadTs = resolveSlackReplyThreadTs({
|
|
1935
1931
|
replyToMode: replyDeliveryMode,
|
|
@@ -1995,6 +1991,7 @@ function createSlackStreamingDeliveryRuntime(setup) {
|
|
|
1995
1991
|
if (deliveryKey && deliveredKeys.has(deliveryKey)) return { visibleReplySent: false };
|
|
1996
1992
|
let messageId;
|
|
1997
1993
|
let fallbackDelivery;
|
|
1994
|
+
state.pendingTextIsProgress = false;
|
|
1998
1995
|
try {
|
|
1999
1996
|
if (session) await appendSlackStream({
|
|
2000
1997
|
session,
|
|
@@ -2073,8 +2070,7 @@ function createSlackStreamingDeliveryRuntime(setup) {
|
|
|
2073
2070
|
resetDeliveryTracker: () => deliveredKeys.clear()
|
|
2074
2071
|
});
|
|
2075
2072
|
}
|
|
2076
|
-
|
|
2077
|
-
//#region extensions/slack/src/monitor/message-handler/failure-notice.ts
|
|
2073
|
+
// extensions/slack/src/monitor/message-handler/failure-notice.ts
|
|
2078
2074
|
/** One outage policy for immediate replies and later origin-routed queue drains. */
|
|
2079
2075
|
function createSlackFailureNoticePolicy(params, hasVisibleReply) {
|
|
2080
2076
|
const { context, accountId, channelId, failureNoticeThreadTs, failureNoticeTeamId, statusThreadTs } = params;
|
|
@@ -2142,8 +2138,7 @@ function createSlackQueuedFailureNoticePolicy(params, beginSessionRun) {
|
|
|
2142
2138
|
}
|
|
2143
2139
|
};
|
|
2144
2140
|
}
|
|
2145
|
-
|
|
2146
|
-
//#region extensions/slack/src/monitor/message-handler/dispatch.ts
|
|
2141
|
+
// extensions/slack/src/monitor/message-handler/dispatch.ts
|
|
2147
2142
|
function formatSlackGroupThreadReply(text, participant) {
|
|
2148
2143
|
return `**${participant.name.replace(/[\\`*_{}[\]()<>#!|]/g, "\\$&").replace(/\s+/g, " ")}**\n${text}`;
|
|
2149
2144
|
}
|
|
@@ -2456,6 +2451,7 @@ async function dispatchSlackMessageWithSetup(setup, beginSessionRun, turnAdoptio
|
|
|
2456
2451
|
const anyReplyDelivered = hasVisibleInboundReplyDispatch(settledDispatchResult, { observedReplyDelivery: delivery.observedReplyDelivery || previewLifecycle.finalDelivered });
|
|
2457
2452
|
if (anyReplyDelivered && !previewLifecycle.finalStarted && !dispatchError && !agentRunFailed) {
|
|
2458
2453
|
if (hasVisibleInboundReplyDispatch(settledDispatchResult)) await previewLifecycle.observeDelivery({ visibleReplySent: true });
|
|
2454
|
+
if (progress.useDraftProgressCard) await progress.finalizeDraftProgressCard("success");
|
|
2459
2455
|
}
|
|
2460
2456
|
await previewLifecycle.cleanup({ failed: Boolean(dispatchError || agentRunFailed) });
|
|
2461
2457
|
if (anyReplyDelivered) failurePolicy.recordDelivered();
|
|
@@ -2480,8 +2476,7 @@ async function dispatchSlackMessageWithSetup(setup, beginSessionRun, turnAdoptio
|
|
|
2480
2476
|
if (progress.useDraftProgressCard) await draftStream?.clear();
|
|
2481
2477
|
}
|
|
2482
2478
|
}
|
|
2483
|
-
|
|
2484
|
-
//#region extensions/slack/src/agent-context.ts
|
|
2479
|
+
// extensions/slack/src/agent-context.ts
|
|
2485
2480
|
function normalizeEntity(value) {
|
|
2486
2481
|
const entity = asOptionalRecord(value);
|
|
2487
2482
|
const type = normalizeOptionalString(entity?.type);
|
|
@@ -2519,8 +2514,7 @@ function normalizeSlackAppContextEntities(value) {
|
|
|
2519
2514
|
return normalized ? [normalized] : [];
|
|
2520
2515
|
});
|
|
2521
2516
|
}
|
|
2522
|
-
|
|
2523
|
-
//#region extensions/slack/src/monitor/thread.ts
|
|
2517
|
+
// extensions/slack/src/monitor/thread.ts
|
|
2524
2518
|
const threadStarterCache = createStaleWhileRevalidateCache({
|
|
2525
2519
|
maxEntries: 2e3,
|
|
2526
2520
|
maxPending: Number.POSITIVE_INFINITY,
|
|
@@ -2694,8 +2688,7 @@ async function resolveSlackChannelHistory(params) {
|
|
|
2694
2688
|
}
|
|
2695
2689
|
return messages.slice(0, params.limit).reverse();
|
|
2696
2690
|
}
|
|
2697
|
-
|
|
2698
|
-
//#region extensions/slack/src/monitor/message-handler/preflight-audio.ts
|
|
2691
|
+
// extensions/slack/src/monitor/message-handler/preflight-audio.ts
|
|
2699
2692
|
function isSlackAudioFile(file) {
|
|
2700
2693
|
if (file.subtype === "slack_audio") return true;
|
|
2701
2694
|
if ((file.mimetype?.split(";")[0]?.trim().toLowerCase())?.startsWith("audio/")) return true;
|
|
@@ -2738,13 +2731,12 @@ const sendSlackPreflightAudioTranscriptEcho = slackPreflightAudio.send.bind(slac
|
|
|
2738
2731
|
async function discardSlackPreflightMedia(media) {
|
|
2739
2732
|
await Promise.allSettled((media ?? []).map((entry) => fs.rm(entry.path, { force: true })));
|
|
2740
2733
|
}
|
|
2741
|
-
|
|
2742
|
-
//#region extensions/slack/src/monitor/message-handler/prepare-content.ts
|
|
2734
|
+
// extensions/slack/src/monitor/message-handler/prepare-content.ts
|
|
2743
2735
|
const SLACK_MENTION_RESOLUTION_CONCURRENCY = 4;
|
|
2744
2736
|
const SLACK_MENTION_RESOLUTION_MAX_LOOKUPS_PER_MESSAGE = 20;
|
|
2745
2737
|
const SLACK_USER_MENTION_RE$1 = /<@([A-Z0-9]+)(?:\|[^>]+)?>/gi;
|
|
2746
2738
|
const MAX_SLACK_UNAVAILABLE_FILE_TEXT_CHARS = 2e3;
|
|
2747
|
-
const loadSlackMediaModule$2 = createLazyRuntimeModule(() => import("./actions-
|
|
2739
|
+
const loadSlackMediaModule$2 = createLazyRuntimeModule(() => import("./actions-BNOabmV6.mjs").then((n) => n._));
|
|
2748
2740
|
function formatSlackUnavailableMedia(params) {
|
|
2749
2741
|
let fileReferences = params.files?.map((file) => `${formatSlackFileReference(file)} unavailable (${file.reason})`).join(", ");
|
|
2750
2742
|
if (fileReferences && fileReferences.length > MAX_SLACK_UNAVAILABLE_FILE_TEXT_CHARS) fileReferences = `${truncateUtf16Safe(fileReferences, MAX_SLACK_UNAVAILABLE_FILE_TEXT_CHARS)}; … (file references truncated)`;
|
|
@@ -2840,8 +2832,7 @@ async function resolveSlackMessageContent(params) {
|
|
|
2840
2832
|
mentionStripPatterns
|
|
2841
2833
|
} : null;
|
|
2842
2834
|
}
|
|
2843
|
-
|
|
2844
|
-
//#region extensions/slack/src/monitor/message-handler/prepare-dm-history.ts
|
|
2835
|
+
// extensions/slack/src/monitor/message-handler/prepare-dm-history.ts
|
|
2845
2836
|
function resolveSlackDmHistoryLimit(params) {
|
|
2846
2837
|
const override = params.userId ? params.account.config.dms?.[params.userId]?.historyLimit : void 0;
|
|
2847
2838
|
return resolvePromptHistoryLimit(override ?? params.defaultLimit, 0);
|
|
@@ -2873,20 +2864,24 @@ async function resolveSlackDmHistoryContext(params) {
|
|
|
2873
2864
|
body: void 0,
|
|
2874
2865
|
inboundHistory: void 0
|
|
2875
2866
|
};
|
|
2876
|
-
const
|
|
2877
|
-
const
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2867
|
+
const isCurrentBot = (message) => params.ctx.botUserId && message.user === params.ctx.botUserId || params.ctx.botId && message.bot_id === params.ctx.botId;
|
|
2868
|
+
const userIds = [...new Set(messages.flatMap(({ message }) => !isCurrentBot(message) && message.user ? [message.user] : []))];
|
|
2869
|
+
const users = await runTasksWithConcurrency({
|
|
2870
|
+
tasks: userIds.map((userId) => async () => {
|
|
2871
|
+
const user = await params.ctx.resolveUserName(userId, params.eventScope);
|
|
2872
|
+
return [userId, normalizeOptionalString(user.name) ?? userId];
|
|
2873
|
+
}),
|
|
2874
|
+
limit: 4,
|
|
2875
|
+
errorMode: "stop"
|
|
2876
|
+
});
|
|
2877
|
+
if (users.hasError) throw users.firstError;
|
|
2878
|
+
const userNames = new Map(users.results);
|
|
2884
2879
|
const entries = [];
|
|
2885
2880
|
const formatted = [];
|
|
2886
2881
|
for (const { message, body } of messages) {
|
|
2887
|
-
const
|
|
2888
|
-
const role =
|
|
2889
|
-
const sender = `${
|
|
2882
|
+
const currentBot = isCurrentBot(message);
|
|
2883
|
+
const role = currentBot || message.bot_id ? "assistant" : "user";
|
|
2884
|
+
const sender = `${currentBot ? "Assistant" : message.user ? userNames.get(message.user) : normalizeOptionalString(message.username) ?? (message.bot_id ? "Bot" : "Unknown")} (${role})`;
|
|
2890
2885
|
const timestamp = resolveSlackTimestampMs(message.ts);
|
|
2891
2886
|
entries.push({
|
|
2892
2887
|
sender,
|
|
@@ -2914,21 +2909,19 @@ async function resolveSlackDmHistoryContext(params) {
|
|
|
2914
2909
|
};
|
|
2915
2910
|
}
|
|
2916
2911
|
}
|
|
2917
|
-
|
|
2918
|
-
//#region extensions/slack/src/monitor/message-handler/prepare-thread-context-root.ts
|
|
2912
|
+
// extensions/slack/src/monitor/message-handler/prepare-thread-context-root.ts
|
|
2919
2913
|
function isSlackThreadAuthorCurrentBot(params) {
|
|
2920
2914
|
const { identity, author } = params;
|
|
2921
2915
|
if (identity.botUserId && author.userId && author.userId === identity.botUserId) return true;
|
|
2922
2916
|
if (identity.botId && author.botId && author.botId === identity.botId) return true;
|
|
2923
2917
|
return false;
|
|
2924
2918
|
}
|
|
2925
|
-
|
|
2926
|
-
//#region extensions/slack/src/monitor/message-handler/prepare-room-history.ts
|
|
2919
|
+
// extensions/slack/src/monitor/message-handler/prepare-room-history.ts
|
|
2927
2920
|
const SLACK_HISTORY_MEDIA_MAX_ATTACHMENTS = 4;
|
|
2928
2921
|
const SLACK_HISTORY_MEDIA_MAX_BYTES = 10485760;
|
|
2929
2922
|
const SLACK_HISTORY_MEDIA_IDLE_TIMEOUT_MS = 1e3;
|
|
2930
2923
|
const SLACK_HISTORY_MEDIA_TOTAL_TIMEOUT_MS = 3e3;
|
|
2931
|
-
const loadSlackMediaModule$1 = createLazyRuntimeModule(() => import("./actions-
|
|
2924
|
+
const loadSlackMediaModule$1 = createLazyRuntimeModule(() => import("./actions-BNOabmV6.mjs").then((n) => n._));
|
|
2932
2925
|
async function resolveSlackRoomHistory(params) {
|
|
2933
2926
|
if (params.ctx.historyLimit <= 0 || !params.message.ts) return [];
|
|
2934
2927
|
const warnOmission = (reason) => {
|
|
@@ -2957,13 +2950,26 @@ async function resolveSlackRoomHistory(params) {
|
|
|
2957
2950
|
onOmission: warnOmission
|
|
2958
2951
|
}) : await resolveSlackChannelHistory(request);
|
|
2959
2952
|
params.assertCurrent();
|
|
2953
|
+
const history = messages.filter((message) => !isSlackThreadAuthorCurrentBot({
|
|
2954
|
+
identity: params.ctx,
|
|
2955
|
+
author: message
|
|
2956
|
+
}));
|
|
2957
|
+
const userIds = [...new Set(history.flatMap((message) => message.userId ? [message.userId] : []))];
|
|
2958
|
+
const users = await runTasksWithConcurrency({
|
|
2959
|
+
tasks: userIds.map((userId) => async () => {
|
|
2960
|
+
params.assertCurrent();
|
|
2961
|
+
const user = await params.ctx.resolveUserName(userId, params.eventScope);
|
|
2962
|
+
params.assertCurrent();
|
|
2963
|
+
return [userId, user];
|
|
2964
|
+
}),
|
|
2965
|
+
limit: 4,
|
|
2966
|
+
errorMode: "stop"
|
|
2967
|
+
});
|
|
2968
|
+
if (users.hasError) throw users.firstError;
|
|
2969
|
+
const userNames = new Map(users.results);
|
|
2960
2970
|
const permitted = [];
|
|
2961
|
-
for (const message of
|
|
2962
|
-
|
|
2963
|
-
identity: params.ctx,
|
|
2964
|
-
author: message
|
|
2965
|
-
})) continue;
|
|
2966
|
-
const user = message.userId ? await params.ctx.resolveUserName(message.userId, params.eventScope) : void 0;
|
|
2971
|
+
for (const message of history) {
|
|
2972
|
+
const user = message.userId ? userNames.get(message.userId) : void 0;
|
|
2967
2973
|
params.assertCurrent();
|
|
2968
2974
|
const senderAllowed = resolveSlackUserAllowed({
|
|
2969
2975
|
allowList: params.allowFromLower,
|
|
@@ -3053,17 +3059,15 @@ function sliceSlackImageFileCandidates(files, limit) {
|
|
|
3053
3059
|
if (limit <= 0 || !files?.length) return [];
|
|
3054
3060
|
return files.filter(isSlackImageFileCandidate).slice(0, limit);
|
|
3055
3061
|
}
|
|
3056
|
-
|
|
3057
|
-
//#region extensions/slack/src/monitor/message-handler/prepare-session-presentation.ts
|
|
3062
|
+
// extensions/slack/src/monitor/message-handler/prepare-session-presentation.ts
|
|
3058
3063
|
function resolveSlackGroupSessionSubject(params) {
|
|
3059
3064
|
const channelName = normalizeOptionalString(params.channelName);
|
|
3060
3065
|
const workspaceName = normalizeOptionalString(params.installationIdentity?.kind === "workspace" && params.installationIdentity.teamId === params.workspaceId ? params.installationIdentity.teamName : void 0);
|
|
3061
3066
|
if (channelName && workspaceName) return `${workspaceName} #${channelName}`;
|
|
3062
3067
|
return `Slack Channel (Workspace ID: ${params.workspaceId}, Channel ID: ${params.channelId})`;
|
|
3063
3068
|
}
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
const loadSlackMediaModule = createLazyRuntimeModule(() => import("./actions-D5S6D_BU.mjs").then((n) => n._));
|
|
3069
|
+
// extensions/slack/src/monitor/message-handler/prepare-thread-context.ts
|
|
3070
|
+
const loadSlackMediaModule = createLazyRuntimeModule(() => import("./actions-BNOabmV6.mjs").then((n) => n._));
|
|
3067
3071
|
const SLACK_THREAD_CONTEXT_USER_LOOKUP_CONCURRENCY = 4;
|
|
3068
3072
|
function formatSlackThreadLabelSnippet(text) {
|
|
3069
3073
|
return truncateUtf16Safe(text.replace(/\s+/g, " "), 80);
|
|
@@ -3251,8 +3255,7 @@ async function resolveSlackThreadContextData(params) {
|
|
|
3251
3255
|
}
|
|
3252
3256
|
return readThreadContextData();
|
|
3253
3257
|
}
|
|
3254
|
-
|
|
3255
|
-
//#region src/channels/mention-gating.ts
|
|
3258
|
+
// src/channels/mention-gating.ts
|
|
3256
3259
|
function resolveBotThreadMentionPolicy(params) {
|
|
3257
3260
|
if (!params.isBotOwnedThread || params.requireMentionInBotThreads === void 0) return {
|
|
3258
3261
|
requireMention: params.requireMention,
|
|
@@ -3263,13 +3266,11 @@ function resolveBotThreadMentionPolicy(params) {
|
|
|
3263
3266
|
implicitMentionKinds: params.requireMentionInBotThreads ? params.implicitMentionKinds?.filter((kind) => kind === "native") : params.implicitMentionKinds
|
|
3264
3267
|
};
|
|
3265
3268
|
}
|
|
3266
|
-
|
|
3267
|
-
//#region \0openclaw:bundled-sdk:openclaw/plugin-sdk/channel-mention-gating
|
|
3269
|
+
// \0openclaw:bundled-sdk:openclaw/plugin-sdk/channel-mention-gating
|
|
3268
3270
|
var channel_mention_gating_exports = /* @__PURE__ */ __exportAll({ resolveBotThreadMentionPolicy: () => resolveBotThreadMentionPolicy });
|
|
3269
3271
|
import * as import_openclaw_plugin_sdk_channel_mention_gating from "openclaw/plugin-sdk/channel-mention-gating";
|
|
3270
3272
|
__reExport(channel_mention_gating_exports, import_openclaw_plugin_sdk_channel_mention_gating);
|
|
3271
|
-
|
|
3272
|
-
//#region extensions/slack/src/monitor/message-handler/prepare-thread-mentions.ts
|
|
3273
|
+
// extensions/slack/src/monitor/message-handler/prepare-thread-mentions.ts
|
|
3273
3274
|
async function resolveSlackThreadMentionPolicy(params) {
|
|
3274
3275
|
const { ctx, account, message, conversation, thread } = params;
|
|
3275
3276
|
const { isRoom, isDirectMessage, channelConfig } = conversation;
|
|
@@ -3303,8 +3304,7 @@ async function resolveSlackThreadMentionPolicy(params) {
|
|
|
3303
3304
|
implicitMentionKinds
|
|
3304
3305
|
});
|
|
3305
3306
|
}
|
|
3306
|
-
|
|
3307
|
-
//#region extensions/slack/src/monitor/message-handler/subteam-mentions.ts
|
|
3307
|
+
// extensions/slack/src/monitor/message-handler/subteam-mentions.ts
|
|
3308
3308
|
const SUBTEAM_MENTION_RE = /<!subteam\^([A-Z0-9]+)(?:\|[^>]*)?>/gi;
|
|
3309
3309
|
const SUBTEAM_MEMBER_CACHE_TTL_MS = 3e5;
|
|
3310
3310
|
const subteamMemberCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -3362,8 +3362,7 @@ async function isSlackSubteamMentionForBot(params) {
|
|
|
3362
3362
|
}
|
|
3363
3363
|
return false;
|
|
3364
3364
|
}
|
|
3365
|
-
|
|
3366
|
-
//#region extensions/slack/src/monitor/message-handler/prepare.ts
|
|
3365
|
+
// extensions/slack/src/monitor/message-handler/prepare.ts
|
|
3367
3366
|
const mentionRegexCache = /* @__PURE__ */ new WeakMap();
|
|
3368
3367
|
const SLACK_ANY_MENTION_RE = /<@[^>]+>|<!subteam\^[^>]+>/;
|
|
3369
3368
|
const SLACK_USER_MENTION_RE = /<@([^>|]+)(?:\|[^>]+)?>/g;
|
|
@@ -4241,5 +4240,4 @@ async function prepareSlackMessage(params) {
|
|
|
4241
4240
|
ackReactionPromise
|
|
4242
4241
|
};
|
|
4243
4242
|
}
|
|
4244
|
-
//#endregion
|
|
4245
4243
|
export { dispatchPreparedSlackMessage, prepareSlackMessage };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Gt as normalizeSlackSlug, l as buildSlackChannelIdCandidates, qt as resolveSlackUserAllowListForTeam, u as buildSlackChannelPolicyScope } from "./probe-BHqvMbno.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";
|
|
5
|
-
|
|
5
|
+
// extensions/slack/src/monitor/channel-config.ts
|
|
6
6
|
function resolveSlackChannelLabel(params) {
|
|
7
7
|
const channelName = params.channelName?.trim();
|
|
8
8
|
if (channelName) return `#${normalizeSlackSlug(channelName) || channelName}`;
|
|
@@ -51,11 +51,9 @@ function resolveSlackChannelConfig(params) {
|
|
|
51
51
|
};
|
|
52
52
|
return applyChannelMatchMeta(result, match);
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
//#region extensions/slack/src/monitor/policy.ts
|
|
54
|
+
// extensions/slack/src/monitor/policy.ts
|
|
56
55
|
function isSlackChannelAllowedByPolicy(params) {
|
|
57
56
|
if (params.groupPolicy === "disabled") return false;
|
|
58
57
|
return params.groupPolicy !== "allowlist" || params.channelAllowlistConfigured && params.channelAllowed;
|
|
59
58
|
}
|
|
60
|
-
//#endregion
|
|
61
59
|
export { resolveSlackChannelConfig as n, resolveSlackChannelLabel as r, isSlackChannelAllowedByPolicy as t };
|