@lawpath-tech/openclaw 2026.2.21-31 → 2026.2.21-33
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/{agents-BP8GDc9z.js → agents-B1Ai7rsS.js} +4 -4
- package/dist/{agents.config-Bz7K-hIv.js → agents.config-CxHnl-lL.js} +1 -1
- package/dist/{agents.config-BelTNn6K.js → agents.config-DX3tDviB.js} +1 -1
- package/dist/{audio-preflight-DP74Yvkp.js → audio-preflight-Dp9KYMCX.js} +4 -4
- package/dist/{auth-choice-D1nW1tnt.js → auth-choice-CW81kzG9.js} +1 -1
- package/dist/{auth-choice-CBUsciQJ.js → auth-choice-DKrgElus.js} +1 -1
- package/dist/{banner-C18cJKYR.js → banner-B3qK6V55.js} +1 -1
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +8 -8
- package/dist/bundled/session-memory/handler.js +8 -8
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-options-DUJnpe5D.js → channel-options-CvSrxm2D.js} +1 -1
- package/dist/{channel-options-Dh4UX17R.js → channel-options-UCu5_Nv-.js} +1 -1
- package/dist/{channel-web-wLJAIBDS.js → channel-web-BUJggj7Y.js} +1 -1
- package/dist/{channels-cli-B3GeraPZ.js → channels-cli-B5TJMyaR.js} +6 -6
- package/dist/{channels-cli-7lL-U0bT.js → channels-cli-CGweC0NS.js} +6 -6
- package/dist/{chrome-BukFhWVN.js → chrome-DAmaIuXa.js} +7 -7
- package/dist/{cli-BdmFE8Ie.js → cli-B1suYn5Q.js} +3 -3
- package/dist/{cli-C9y6JSoj.js → cli-BFVjC6gz.js} +3 -3
- package/dist/{command-registry-D-PJPg1t.js → command-registry-C3Cb6_lT.js} +9 -9
- package/dist/{completion-cli-CA5pvA6W.js → completion-cli-CiR_bu8-.js} +1 -1
- package/dist/{completion-cli-zfVgI7-n.js → completion-cli-D-U8-xK-.js} +2 -2
- package/dist/{config-cli-BPrhK0hV.js → config-cli-BOhut0nG.js} +1 -1
- package/dist/{config-cli-CgMtqspq.js → config-cli-CsmTCdxD.js} +1 -1
- package/dist/{configure-yDD4TKIJ.js → configure-B7NUZjG2.js} +3 -3
- package/dist/{configure-P0T5xCKn.js → configure-BWfLMNPf.js} +3 -3
- package/dist/{deliver-BLmoUvp-.js → deliver-BP564y6d.js} +1 -1
- package/dist/{doctor-completion-wNJ24zG1.js → doctor-completion-CRCM30Gd.js} +1 -1
- package/dist/{doctor-completion-QnB3fOSm.js → doctor-completion-GAbf1D6s.js} +1 -1
- package/dist/entry.js +1 -1
- package/dist/extensionAPI.js +3 -3
- package/dist/{gateway-cli-jzI2iY9a.js → gateway-cli-DGPCB6rN.js} +10 -10
- package/dist/{gateway-cli-abohiHMm.js → gateway-cli-QMubBYii.js} +10 -10
- package/dist/{health-ChDsDryb.js → health-CwpYY0fN.js} +1 -1
- package/dist/{health-BJ6SHHDr.js → health-DR30gLMN.js} +1 -1
- package/dist/{hooks-cli-BmuxgZBH.js → hooks-cli-DNwlE26g.js} +4 -4
- package/dist/{hooks-cli-DuRDIltL.js → hooks-cli-DlkiBMJi.js} +4 -4
- package/dist/{image-hH4ugSJI.js → image-DL65NdIM.js} +1 -1
- package/dist/index.js +8 -8
- package/dist/llm-slug-generator.js +8 -8
- package/dist/{models-BpqbY6s6.js → models-DVkqCyTw.js} +2 -2
- package/dist/{models-cli-COanmcGm.js → models-cli-BEkmRLcC.js} +4 -4
- package/dist/{models-cli-DqWWTCao.js → models-cli-DVKgOKux.js} +5 -5
- package/dist/{onboard-wCY6TSre.js → onboard-BS7ZSQTR.js} +2 -2
- package/dist/{onboard-UEtBiCoJ.js → onboard-D9z9OO_A.js} +2 -2
- package/dist/{onboard-channels-BJ-tZka8.js → onboard-channels-CUuKFX-y.js} +1 -1
- package/dist/{onboard-channels-CPma01ab.js → onboard-channels-SRbD8DVG.js} +1 -1
- package/dist/{onboarding-Dp6k5p-a.js → onboarding-CQRQ7bCq.js} +3 -3
- package/dist/{onboarding-Di4SkJUj.js → onboarding-DVBEYCod.js} +3 -3
- package/dist/{onboarding.finalize-G-q87JA2.js → onboarding.finalize-BRewG-HX.js} +7 -7
- package/dist/{onboarding.finalize-DshqLGqp.js → onboarding.finalize-CTF-nyL8.js} +8 -8
- package/dist/{pi-embedded-C7TfFIPO.js → pi-embedded-BqyWOcTK.js} +200 -43
- package/dist/{pi-embedded-helpers-DR_3fJko.js → pi-embedded-helpers-HnqhrewN.js} +4 -4
- package/dist/{pi-embedded-BAqpVR_m.js → pi-embedded-rXq7jDOy.js} +214 -57
- package/dist/{plugin-registry-CFiYBSX2.js → plugin-registry-Bp0OjK16.js} +1 -1
- package/dist/{plugin-registry-BdQI8-bG.js → plugin-registry-Ca9kiZbZ.js} +1 -1
- package/dist/plugin-sdk/{agent-scope-BjU_kuyW.js → agent-scope-KjIvGpFh.js} +19 -19
- package/dist/plugin-sdk/{channel-web-DtyyUoWA.js → channel-web-i7Q0e2xL.js} +1 -1
- package/dist/plugin-sdk/index.js +4 -4
- package/dist/plugin-sdk/{manager-BBcNMx7F.js → manager-DeHKg0Ym.js} +28 -28
- package/dist/plugin-sdk/memory-host-search.js +4 -4
- package/dist/plugin-sdk/{qmd-manager-B5NFEjJd.js → qmd-manager-Ci6Ood2P.js} +2 -2
- package/dist/plugin-sdk/{replies-OoosoUz9.js → replies-CvKNemz4.js} +5 -4
- package/dist/plugin-sdk/{reply-C_4ajFUt.js → reply-CrBuiTf0.js} +200 -43
- package/dist/plugin-sdk/{send-C9Q83PfF.js → send-DzgvnkSq.js} +20 -1
- package/dist/plugin-sdk/slack/monitor/events/channels.d.ts +1 -0
- package/dist/plugin-sdk/slack/monitor/events/members.d.ts +1 -0
- package/dist/plugin-sdk/slack/monitor/events/pins.d.ts +1 -0
- package/dist/plugin-sdk/slack/monitor/events/reactions.d.ts +1 -0
- package/dist/plugin-sdk/slack/monitor/events.d.ts +2 -0
- package/dist/plugin-sdk/slack/monitor/message-handler.d.ts +2 -0
- package/dist/plugin-sdk/slack/monitor/provider.d.ts +6 -0
- package/dist/plugin-sdk/slack/monitor/replies.d.ts +2 -0
- package/dist/plugin-sdk/slack/monitor/types.d.ts +4 -0
- package/dist/plugin-sdk/slack/threading.d.ts +9 -0
- package/dist/plugin-sdk/{sqlite-CH_AglGD.js → sqlite-CcSeRdqy.js} +15 -15
- package/dist/plugin-sdk/{web-BlY2wNrk.js → web-DXbKqGiu.js} +4 -4
- package/dist/{plugins-cli-CmrER-zr.js → plugins-cli-B54I3YDp.js} +4 -4
- package/dist/{plugins-cli-B03aSLgf.js → plugins-cli-DQqPpkDg.js} +4 -4
- package/dist/{program-Djk08-l7.js → program-CiVPUyGe.js} +9 -9
- package/dist/{program-context-DlRS1tcr.js → program-context-B8jVIvqn.js} +17 -17
- package/dist/{prompt-select-styled-CMszn2hx.js → prompt-select-styled-DP6ORKEH.js} +4 -4
- package/dist/{prompt-select-styled-JkMJPt68.js → prompt-select-styled-XJNDuVI-.js} +4 -4
- package/dist/{provider-auth-helpers-36LOZ6SL.js → provider-auth-helpers-BvdnFgmZ.js} +1 -1
- package/dist/{provider-auth-helpers-ZV7-WRyR.js → provider-auth-helpers-GlPRMdgU.js} +1 -1
- package/dist/{push-apns-Cm-ZTdUp.js → push-apns-4PMWZHdd.js} +1 -1
- package/dist/{push-apns-TUUEPpx1.js → push-apns-BLl8QvkS.js} +1 -1
- package/dist/{pw-ai-Dp9c5KD_.js → pw-ai-BLLeU82T.js} +1 -1
- package/dist/{register.agent-DsFrb0R7.js → register.agent-DMDB7XFY.js} +8 -8
- package/dist/{register.agent-7Pku8mId.js → register.agent-O8MfanIY.js} +7 -7
- package/dist/{register.configure-BMfcA9Sh.js → register.configure-BnK5Jcux.js} +8 -8
- package/dist/{register.configure-CJ6IYgGS.js → register.configure-z-iZ8GQq.js} +8 -8
- package/dist/{register.maintenance-DfoSO5fo.js → register.maintenance-BnFA8dD9.js} +9 -9
- package/dist/{register.maintenance-BFSQHBgH.js → register.maintenance-DSLAHGdZ.js} +10 -10
- package/dist/{register.message-BTCpZ8RW.js → register.message-BEBbZm3E.js} +4 -4
- package/dist/{register.message-C-5P7V4g.js → register.message-Diwl2TLo.js} +4 -4
- package/dist/{register.onboard-CVXaGmEF.js → register.onboard-Bc4G3TMS.js} +6 -6
- package/dist/{register.onboard-CTO-qkWZ.js → register.onboard-gF_aeZ9o.js} +6 -6
- package/dist/{register.setup-Dg1Ud7ox.js → register.setup-B4r3oTHQ.js} +6 -6
- package/dist/{register.setup-BzaCK19n.js → register.setup-CdWPBfRb.js} +6 -6
- package/dist/{register.status-health-sessions-IymXWaoK.js → register.status-health-sessions-gEelqg9y.js} +5 -5
- package/dist/{register.status-health-sessions-DjwY1WQe.js → register.status-health-sessions-gHKOUBxw.js} +5 -5
- package/dist/{register.subclis-Bw1N3fIn.js → register.subclis-DflQa27k.js} +9 -9
- package/dist/{replies-MVPArv-r.js → replies-9ipbTXMP.js} +5 -4
- package/dist/{replies-DtFxhHfI.js → replies-BCd0AxfK.js} +5 -4
- package/dist/{replies-DKKNtkun.js → replies-BdkHHO5V.js} +5 -4
- package/dist/{replies-DhmTgroV.js → replies-CSjH2EQ6.js} +5 -4
- package/dist/{reply-pTxrsMtG.js → reply-CM9fxt2r.js} +200 -43
- package/dist/{run-main-DnYUey0K.js → run-main-3miuYYBs.js} +16 -16
- package/dist/{runner-CLY-9j7g.js → runner-CcRtHLpd.js} +1 -1
- package/dist/{send-CTGeWUSD.js → send-B3u53ZAu.js} +20 -1
- package/dist/{send-Cr8R-bMi.js → send-CAuzoyQe.js} +20 -1
- package/dist/{send-D_FU_HIa.js → send-D6r6s6Nf.js} +20 -1
- package/dist/{send-CKGUBMnM.js → send-DUc9Jw32.js} +20 -1
- package/dist/{server-node-events-Dhbdspn_.js → server-node-events-BcfA38Ht.js} +4 -4
- package/dist/{server-node-events-DQYNf8b_.js → server-node-events-DzAfZuLY.js} +4 -4
- package/dist/{session-dirs-CFHymbM9.js → session-dirs-BdEl6HTu.js} +1 -1
- package/dist/{session-dirs-DoK1aPxY.js → session-dirs-BeIjLerM.js} +1 -1
- package/dist/{status-D32_SxwC.js → status-B0MQkmRx.js} +2 -2
- package/dist/{status-CFnZ8E56.js → status-CgApQy5C.js} +1 -1
- package/dist/{status-C-PQHlxh.js → status-DpOLEQn-.js} +1 -1
- package/dist/{status-KRRAxPjg.js → status-dZ2UgRzN.js} +2 -2
- package/dist/{subagent-registry-DkjybHrK.js → subagent-registry-CEyaZMV5.js} +200 -43
- package/dist/{update-cli-DXd4fNuS.js → update-cli-COdYp-Y5.js} +10 -10
- package/dist/{update-cli-DMrRvy-m.js → update-cli-Y2wT8mXS.js} +9 -9
- package/dist/{web-Dsgry4ji.js → web-CQ4AF_Y7.js} +3 -3
- package/dist/{web-CCqlC0N_.js → web-Cp6O0VTJ.js} +4 -4
- package/dist/{web-IfDcZx01.js → web-D8FEwRAX.js} +3 -3
- package/dist/{web-DCNwbuhj.js → web-c0XVFCZq.js} +8 -8
- package/package.json +1 -1
|
@@ -30,7 +30,7 @@ import { t as convertMarkdownTables } from "./tables-DAJbUPhT.js";
|
|
|
30
30
|
import { a as formatIMessageChatTarget, c as parseIMessageTarget, i as DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS, o as isAllowedIMessageSender, r as createIMessageRpcClient, s as normalizeIMessageHandle, t as sendMessageIMessage } from "./send-CiTMY1uN.js";
|
|
31
31
|
import { i as resolveImageSanitizationLimits, n as sanitizeImageBlocks, r as sanitizeToolResultImages } from "./tool-images-D_St2NkT.js";
|
|
32
32
|
import { a as createActionGate, c as jsonResult, d as readReactionParams, f as readStringArrayParam, l as parseAvailableTags, m as readStringParam, n as missingTargetError, o as imageResult, p as readStringOrNumberParam, r as unknownTargetError, s as imageResultFromFile, t as ambiguousTargetError, u as readNumberParam } from "./target-errors-CeKndUCY.js";
|
|
33
|
-
import { a as
|
|
33
|
+
import { a as buildSlackBlocksFallbackText, c as parseSlackBlocksInput, l as validateSlackBlocksArray, o as createSlackWebClient, r as markdownToSlackMrkdwn, s as resolveSlackWebClientOptions, t as sendMessageSlack } from "./send-DzgvnkSq.js";
|
|
34
34
|
import { $ as parseTelegramTarget, A as hasBotMention, B as resolveSenderAllowMatch, C as buildTelegramGroupPeerId, D as describeReplyTarget, E as buildTypingThreadParams, F as resolveTelegramReplyId, G as readChannelAllowFromStore, H as isSenderIdAllowed, I as resolveTelegramStreamMode, J as upsertChannelPairingRequest, L as resolveTelegramThreadSpec, M as resolveTelegramForumThreadId, N as resolveTelegramGroupAllowFromContext, O as expandTextLinks, P as resolveTelegramMediaPlaceholder, Q as isVoiceCompatibleAudio, R as isSenderAllowed$1, S as buildTelegramGroupFrom, T as buildTelegramThreadParams, U as mergeAllowFromSources, V as firstDefined$1, W as addChannelAllowFromStoreEntry, X as listPairingChannels, Y as getPairingAdapter, Z as withTelegramApiErrorLogging, _ as resolveTelegramFetch, a as reactMessageTelegram, b as buildSenderLabel, c as sendStickerTelegram, d as wasSentByBot, et as resolveTelegramTargetChatType, f as isRecoverableTelegramNetworkError, g as wrapFileReferencesInHtml, h as renderTelegramHtmlText, i as editMessageTelegram, j as normalizeForwardedContext, k as extractTelegramLocation, m as markdownToTelegramHtml, n as createForumTopicTelegram, nt as toLocationContext, o as sendMessageTelegram, p as markdownToTelegramChunks, q as removeChannelAllowFromStoreEntry, r as deleteMessageTelegram, s as sendPollTelegram, t as buildInlineKeyboard, tt as formatLocationText, u as resolveTelegramVoiceSend, v as splitTelegramCaption, w as buildTelegramParentPeer, x as buildSenderName, y as buildGroupLabel, z as normalizeAllowFromWithStore$1 } from "./send-C40m59QO.js";
|
|
35
35
|
import { _ as CLI_OUTPUT_MAX_BUFFER, a as resolveMediaAttachmentLocalRoots, c as loadModelCatalog, d as resolveAttachmentKind, f as registerUnhandledRejectionHandler, g as resolveMediaUnderstandingScope, h as normalizeMediaUnderstandingChatType, i as resolveAutoImageModel, l as modelSupportsVision, m as resolveTimeoutMs$1, n as createMediaAttachmentCache, o as runCapability, p as resolveConcurrency, r as normalizeMediaAttachments, s as findModelInCatalog, t as buildProviderRegistry, v as applyTemplate, y as buildRandomTempFilePath } from "./runner-BkVA5r9t.js";
|
|
36
36
|
import { a as resolveAckReaction, c as resolveHumanDelayConfig, i as resolveResponsePrefixTemplate, n as createReplyPrefixOptions, o as resolveAgentIdentity, s as resolveEffectiveMessagesConfig } from "./reply-prefix-G9ruZ2EI.js";
|
|
@@ -58,7 +58,7 @@ import { _ as resolveNativeCommandsEnabled, a as listChatCommandsForConfig, c as
|
|
|
58
58
|
import { c as signalRpcRequest, l as streamSignalEvents, n as sendReadReceiptSignal, o as resolveSignalRpcContext, r as sendTypingSignal, s as signalCheck, t as sendMessageSignal } from "./send-b1mZbvoC.js";
|
|
59
59
|
import { t as makeProxyFetch } from "./proxy-MquBDehr.js";
|
|
60
60
|
import { n as resolveAgentRoute, t as buildAgentSessionKey } from "./resolve-route-yBLQIeuf.js";
|
|
61
|
-
import { a as createReplyReferencePlanner, i as resolveSlackThreadTs, n as deliverReplies$3, t as createSlackReplyDeliveryPlan } from "./replies-
|
|
61
|
+
import { a as createReplyReferencePlanner, i as resolveSlackThreadTs, n as deliverReplies$3, t as createSlackReplyDeliveryPlan } from "./replies-CvKNemz4.js";
|
|
62
62
|
import { t as getActiveWebListener } from "./active-listener-n6hyqnXA.js";
|
|
63
63
|
import { n as recordCommandPoll, r as resetCommandPollCount } from "./command-poll-backoff-CBq0jVRw.js";
|
|
64
64
|
import { createRequire } from "node:module";
|
|
@@ -26917,7 +26917,7 @@ async function runWithImageModelFallback(params) {
|
|
|
26917
26917
|
function createDefaultDeps() {
|
|
26918
26918
|
return {
|
|
26919
26919
|
sendMessageWhatsApp: async (...args) => {
|
|
26920
|
-
const { sendMessageWhatsApp } = await import("./web-
|
|
26920
|
+
const { sendMessageWhatsApp } = await import("./web-DXbKqGiu.js");
|
|
26921
26921
|
return await sendMessageWhatsApp(...args);
|
|
26922
26922
|
},
|
|
26923
26923
|
sendMessageTelegram: async (...args) => {
|
|
@@ -26929,7 +26929,7 @@ function createDefaultDeps() {
|
|
|
26929
26929
|
return await sendMessageDiscord(...args);
|
|
26930
26930
|
},
|
|
26931
26931
|
sendMessageSlack: async (...args) => {
|
|
26932
|
-
const { sendMessageSlack } = await import("./send-
|
|
26932
|
+
const { sendMessageSlack } = await import("./send-DzgvnkSq.js").then((n) => n.n);
|
|
26933
26933
|
return await sendMessageSlack(...args);
|
|
26934
26934
|
},
|
|
26935
26935
|
sendMessageSignal: async (...args) => {
|
|
@@ -34638,8 +34638,12 @@ function inferSlackChannelType(channelId) {
|
|
|
34638
34638
|
}
|
|
34639
34639
|
function normalizeSlackChannelType(channelType, channelId) {
|
|
34640
34640
|
const normalized = channelType?.trim().toLowerCase();
|
|
34641
|
-
|
|
34642
|
-
|
|
34641
|
+
const inferred = inferSlackChannelType(channelId);
|
|
34642
|
+
if (normalized === "im" || normalized === "mpim" || normalized === "channel" || normalized === "group") {
|
|
34643
|
+
if (inferred === "im" && normalized !== "im") return "im";
|
|
34644
|
+
return normalized;
|
|
34645
|
+
}
|
|
34646
|
+
return inferred ?? "channel";
|
|
34643
34647
|
}
|
|
34644
34648
|
function createSlackMonitorContext(params) {
|
|
34645
34649
|
const channelHistories = /* @__PURE__ */ new Map();
|
|
@@ -34923,7 +34927,7 @@ function migrateSlackChannelConfig(params) {
|
|
|
34923
34927
|
//#endregion
|
|
34924
34928
|
//#region src/slack/monitor/events/channels.ts
|
|
34925
34929
|
function registerSlackChannelEvents(params) {
|
|
34926
|
-
const { ctx } = params;
|
|
34930
|
+
const { ctx, trackEvent } = params;
|
|
34927
34931
|
const enqueueChannelSystemEvent = (params) => {
|
|
34928
34932
|
if (!ctx.isChannelAllowed({
|
|
34929
34933
|
channelId: params.channelId,
|
|
@@ -34946,6 +34950,7 @@ function registerSlackChannelEvents(params) {
|
|
|
34946
34950
|
ctx.app.event("channel_created", async ({ event, body }) => {
|
|
34947
34951
|
try {
|
|
34948
34952
|
if (ctx.shouldDropMismatchedSlackEvent(body)) return;
|
|
34953
|
+
trackEvent?.();
|
|
34949
34954
|
const payload = event;
|
|
34950
34955
|
const channelId = payload.channel?.id;
|
|
34951
34956
|
const channelName = payload.channel?.name;
|
|
@@ -34961,6 +34966,7 @@ function registerSlackChannelEvents(params) {
|
|
|
34961
34966
|
ctx.app.event("channel_rename", async ({ event, body }) => {
|
|
34962
34967
|
try {
|
|
34963
34968
|
if (ctx.shouldDropMismatchedSlackEvent(body)) return;
|
|
34969
|
+
trackEvent?.();
|
|
34964
34970
|
const payload = event;
|
|
34965
34971
|
const channelId = payload.channel?.id;
|
|
34966
34972
|
enqueueChannelSystemEvent({
|
|
@@ -34975,6 +34981,7 @@ function registerSlackChannelEvents(params) {
|
|
|
34975
34981
|
ctx.app.event("channel_id_changed", async ({ event, body }) => {
|
|
34976
34982
|
try {
|
|
34977
34983
|
if (ctx.shouldDropMismatchedSlackEvent(body)) return;
|
|
34984
|
+
trackEvent?.();
|
|
34978
34985
|
const payload = event;
|
|
34979
34986
|
const oldChannelId = payload.old_channel_id;
|
|
34980
34987
|
const newChannelId = payload.new_channel_id;
|
|
@@ -35380,10 +35387,11 @@ function registerSlackInteractionEvents(params) {
|
|
|
35380
35387
|
//#endregion
|
|
35381
35388
|
//#region src/slack/monitor/events/members.ts
|
|
35382
35389
|
function registerSlackMemberEvents(params) {
|
|
35383
|
-
const { ctx } = params;
|
|
35390
|
+
const { ctx, trackEvent } = params;
|
|
35384
35391
|
const handleMemberChannelEvent = async (params) => {
|
|
35385
35392
|
try {
|
|
35386
35393
|
if (ctx.shouldDropMismatchedSlackEvent(params.body)) return;
|
|
35394
|
+
trackEvent?.();
|
|
35387
35395
|
const payload = params.event;
|
|
35388
35396
|
const channelId = payload.channel;
|
|
35389
35397
|
const channelInfo = channelId ? await ctx.resolveChannelName(channelId) : {};
|
|
@@ -35519,9 +35527,10 @@ function registerSlackMessageEvents(params) {
|
|
|
35519
35527
|
//#endregion
|
|
35520
35528
|
//#region src/slack/monitor/events/pins.ts
|
|
35521
35529
|
async function handleSlackPinEvent(params) {
|
|
35522
|
-
const { ctx, body, event, action, contextKeySuffix, errorLabel } = params;
|
|
35530
|
+
const { ctx, trackEvent, body, event, action, contextKeySuffix, errorLabel } = params;
|
|
35523
35531
|
try {
|
|
35524
35532
|
if (ctx.shouldDropMismatchedSlackEvent(body)) return;
|
|
35533
|
+
trackEvent?.();
|
|
35525
35534
|
const payload = event;
|
|
35526
35535
|
const channelId = payload.channel_id;
|
|
35527
35536
|
const channelInfo = channelId ? await ctx.resolveChannelName(channelId) : {};
|
|
@@ -35550,10 +35559,11 @@ async function handleSlackPinEvent(params) {
|
|
|
35550
35559
|
}
|
|
35551
35560
|
}
|
|
35552
35561
|
function registerSlackPinEvents(params) {
|
|
35553
|
-
const { ctx } = params;
|
|
35562
|
+
const { ctx, trackEvent } = params;
|
|
35554
35563
|
ctx.app.event("pin_added", async ({ event, body }) => {
|
|
35555
35564
|
await handleSlackPinEvent({
|
|
35556
35565
|
ctx,
|
|
35566
|
+
trackEvent,
|
|
35557
35567
|
body,
|
|
35558
35568
|
event,
|
|
35559
35569
|
action: "pinned",
|
|
@@ -35564,6 +35574,7 @@ function registerSlackPinEvents(params) {
|
|
|
35564
35574
|
ctx.app.event("pin_removed", async ({ event, body }) => {
|
|
35565
35575
|
await handleSlackPinEvent({
|
|
35566
35576
|
ctx,
|
|
35577
|
+
trackEvent,
|
|
35567
35578
|
body,
|
|
35568
35579
|
event,
|
|
35569
35580
|
action: "unpinned",
|
|
@@ -35576,11 +35587,12 @@ function registerSlackPinEvents(params) {
|
|
|
35576
35587
|
//#endregion
|
|
35577
35588
|
//#region src/slack/monitor/events/reactions.ts
|
|
35578
35589
|
function registerSlackReactionEvents(params) {
|
|
35579
|
-
const { ctx } = params;
|
|
35590
|
+
const { ctx, trackEvent } = params;
|
|
35580
35591
|
const handleReactionEvent = async (event, action) => {
|
|
35581
35592
|
try {
|
|
35582
35593
|
const item = event.item;
|
|
35583
35594
|
if (!item || item.type !== "message") return;
|
|
35595
|
+
trackEvent?.();
|
|
35584
35596
|
const channelInfo = item.channel ? await ctx.resolveChannelName(item.channel) : {};
|
|
35585
35597
|
const channelType = channelInfo?.type;
|
|
35586
35598
|
if (!ctx.isChannelAllowed({
|
|
@@ -35624,10 +35636,22 @@ function registerSlackMonitorEvents(params) {
|
|
|
35624
35636
|
ctx: params.ctx,
|
|
35625
35637
|
handleSlackMessage: params.handleSlackMessage
|
|
35626
35638
|
});
|
|
35627
|
-
registerSlackReactionEvents({
|
|
35628
|
-
|
|
35629
|
-
|
|
35630
|
-
|
|
35639
|
+
registerSlackReactionEvents({
|
|
35640
|
+
ctx: params.ctx,
|
|
35641
|
+
trackEvent: params.trackEvent
|
|
35642
|
+
});
|
|
35643
|
+
registerSlackMemberEvents({
|
|
35644
|
+
ctx: params.ctx,
|
|
35645
|
+
trackEvent: params.trackEvent
|
|
35646
|
+
});
|
|
35647
|
+
registerSlackChannelEvents({
|
|
35648
|
+
ctx: params.ctx,
|
|
35649
|
+
trackEvent: params.trackEvent
|
|
35650
|
+
});
|
|
35651
|
+
registerSlackPinEvents({
|
|
35652
|
+
ctx: params.ctx,
|
|
35653
|
+
trackEvent: params.trackEvent
|
|
35654
|
+
});
|
|
35631
35655
|
registerSlackInteractionEvents({ ctx: params.ctx });
|
|
35632
35656
|
}
|
|
35633
35657
|
|
|
@@ -35800,7 +35824,7 @@ async function startSlackStream(params) {
|
|
|
35800
35824
|
stopped: false
|
|
35801
35825
|
};
|
|
35802
35826
|
if (text) {
|
|
35803
|
-
await streamer.append({ markdown_text: text });
|
|
35827
|
+
await streamer.append({ markdown_text: markdownToSlackMrkdwn(text) });
|
|
35804
35828
|
logVerbose(`slack-stream: appended initial text (${text.length} chars)`);
|
|
35805
35829
|
}
|
|
35806
35830
|
return session;
|
|
@@ -35815,7 +35839,7 @@ async function appendSlackStream(params) {
|
|
|
35815
35839
|
return;
|
|
35816
35840
|
}
|
|
35817
35841
|
if (!text) return;
|
|
35818
|
-
await session.streamer.append({ markdown_text: text });
|
|
35842
|
+
await session.streamer.append({ markdown_text: markdownToSlackMrkdwn(text) });
|
|
35819
35843
|
logVerbose(`slack-stream: appended ${text.length} chars`);
|
|
35820
35844
|
}
|
|
35821
35845
|
/**
|
|
@@ -35832,7 +35856,7 @@ async function stopSlackStream(params) {
|
|
|
35832
35856
|
}
|
|
35833
35857
|
session.stopped = true;
|
|
35834
35858
|
logVerbose(`slack-stream: stopping stream in ${session.channel} thread=${session.threadTs}${text ? ` (final text: ${text.length} chars)` : ""}`);
|
|
35835
|
-
await session.streamer.stop(text ? { markdown_text: text } : void 0);
|
|
35859
|
+
await session.streamer.stop(text ? { markdown_text: markdownToSlackMrkdwn(text) } : void 0);
|
|
35836
35860
|
logVerbose("slack-stream: stream stopped");
|
|
35837
35861
|
}
|
|
35838
35862
|
|
|
@@ -35851,12 +35875,21 @@ function resolveSlackThreadContext(params) {
|
|
|
35851
35875
|
messageThreadId: isThreadReply ? incomingThreadTs : params.replyToMode === "all" ? messageTs : void 0
|
|
35852
35876
|
};
|
|
35853
35877
|
}
|
|
35878
|
+
/**
|
|
35879
|
+
* Resolves Slack thread targeting for replies and status indicators.
|
|
35880
|
+
*
|
|
35881
|
+
* @returns replyThreadTs - Thread timestamp for reply messages
|
|
35882
|
+
* @returns statusThreadTs - Thread timestamp for status indicators (typing, etc.)
|
|
35883
|
+
* @returns isThreadReply - true if this is a genuine user reply in a thread,
|
|
35884
|
+
* false if thread_ts comes from a bot status message
|
|
35885
|
+
*/
|
|
35854
35886
|
function resolveSlackThreadTargets(params) {
|
|
35855
|
-
const { incomingThreadTs, messageTs } = resolveSlackThreadContext(params);
|
|
35856
|
-
const replyThreadTs = incomingThreadTs
|
|
35887
|
+
const { incomingThreadTs, messageTs, isThreadReply } = resolveSlackThreadContext(params);
|
|
35888
|
+
const replyThreadTs = isThreadReply ? incomingThreadTs : params.replyToMode === "all" ? messageTs : void 0;
|
|
35857
35889
|
return {
|
|
35858
35890
|
replyThreadTs,
|
|
35859
|
-
statusThreadTs: replyThreadTs ?? messageTs
|
|
35891
|
+
statusThreadTs: replyThreadTs ?? messageTs,
|
|
35892
|
+
isThreadReply
|
|
35860
35893
|
};
|
|
35861
35894
|
}
|
|
35862
35895
|
|
|
@@ -35896,12 +35929,13 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
35896
35929
|
deliveryContext: {
|
|
35897
35930
|
channel: "slack",
|
|
35898
35931
|
to: `user:${message.user}`,
|
|
35899
|
-
accountId: route.accountId
|
|
35932
|
+
accountId: route.accountId,
|
|
35933
|
+
threadId: prepared.ctxPayload.MessageThreadId
|
|
35900
35934
|
},
|
|
35901
35935
|
ctx: prepared.ctxPayload
|
|
35902
35936
|
});
|
|
35903
35937
|
}
|
|
35904
|
-
const { statusThreadTs } = resolveSlackThreadTargets({
|
|
35938
|
+
const { statusThreadTs, isThreadReply } = resolveSlackThreadTargets({
|
|
35905
35939
|
message,
|
|
35906
35940
|
replyToMode: ctx.replyToMode
|
|
35907
35941
|
});
|
|
@@ -35913,7 +35947,8 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
35913
35947
|
replyToMode: ctx.replyToMode,
|
|
35914
35948
|
incomingThreadTs,
|
|
35915
35949
|
messageTs,
|
|
35916
|
-
hasRepliedRef
|
|
35950
|
+
hasRepliedRef,
|
|
35951
|
+
isThreadReply
|
|
35917
35952
|
});
|
|
35918
35953
|
const typingTarget = statusThreadTs ? `${message.channel}/${statusThreadTs}` : message.channel;
|
|
35919
35954
|
const typingCallbacks = createTypingCallbacks({
|
|
@@ -35978,7 +36013,8 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
35978
36013
|
accountId: account.accountId,
|
|
35979
36014
|
runtime,
|
|
35980
36015
|
textLimit: ctx.textLimit,
|
|
35981
|
-
replyThreadTs
|
|
36016
|
+
replyThreadTs,
|
|
36017
|
+
replyToMode: ctx.replyToMode
|
|
35982
36018
|
});
|
|
35983
36019
|
replyPlan.markSent();
|
|
35984
36020
|
};
|
|
@@ -36039,7 +36075,7 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
36039
36075
|
token: ctx.botToken,
|
|
36040
36076
|
channel: draftChannelId,
|
|
36041
36077
|
ts: draftMessageId,
|
|
36042
|
-
text: finalText.trim()
|
|
36078
|
+
text: markdownToSlackMrkdwn(finalText.trim())
|
|
36043
36079
|
});
|
|
36044
36080
|
return;
|
|
36045
36081
|
} catch (err) {
|
|
@@ -36069,7 +36105,8 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
36069
36105
|
accountId: account.accountId,
|
|
36070
36106
|
runtime,
|
|
36071
36107
|
textLimit: ctx.textLimit,
|
|
36072
|
-
replyThreadTs
|
|
36108
|
+
replyThreadTs,
|
|
36109
|
+
replyToMode: ctx.replyToMode
|
|
36073
36110
|
});
|
|
36074
36111
|
replyPlan.markSent();
|
|
36075
36112
|
},
|
|
@@ -36078,7 +36115,8 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
36078
36115
|
typingCallbacks.onIdle?.();
|
|
36079
36116
|
},
|
|
36080
36117
|
onReplyStart: typingCallbacks.onReplyStart,
|
|
36081
|
-
onIdle: typingCallbacks.onIdle
|
|
36118
|
+
onIdle: typingCallbacks.onIdle,
|
|
36119
|
+
onCleanup: typingCallbacks.onCleanup
|
|
36082
36120
|
});
|
|
36083
36121
|
const draftStream = createSlackDraftStream({
|
|
36084
36122
|
target: prepared.replyTarget,
|
|
@@ -36719,10 +36757,13 @@ async function prepareSlackMessage(params) {
|
|
|
36719
36757
|
const mergedMedia = [...media ?? [], ...attachmentContent?.media ?? []];
|
|
36720
36758
|
const effectiveDirectMedia = mergedMedia.length > 0 ? mergedMedia : null;
|
|
36721
36759
|
const mediaPlaceholder = effectiveDirectMedia ? effectiveDirectMedia.map((m) => m.placeholder).join(" ") : void 0;
|
|
36760
|
+
const fileOnlyFallback = !mediaPlaceholder && (message.files?.length ?? 0) > 0 ? message.files.slice(0, 5).map((f) => f.name ?? "file").join(", ") : void 0;
|
|
36761
|
+
const fileOnlyPlaceholder = fileOnlyFallback ? `[Slack file: ${fileOnlyFallback}]` : void 0;
|
|
36722
36762
|
const rawBody = [
|
|
36723
36763
|
(message.text ?? "").trim(),
|
|
36724
36764
|
attachmentContent?.text,
|
|
36725
|
-
mediaPlaceholder
|
|
36765
|
+
mediaPlaceholder,
|
|
36766
|
+
fileOnlyPlaceholder
|
|
36726
36767
|
].filter(Boolean).join("\n") || "";
|
|
36727
36768
|
if (!rawBody) return null;
|
|
36728
36769
|
const ackReaction = resolveAckReaction(cfg, route.agentId, {
|
|
@@ -36897,7 +36938,7 @@ async function prepareSlackMessage(params) {
|
|
|
36897
36938
|
ReplyToId: threadContext.replyToId,
|
|
36898
36939
|
MessageThreadId: threadContext.messageThreadId,
|
|
36899
36940
|
ParentSessionKey: threadKeys.parentSessionKey,
|
|
36900
|
-
ThreadStarterBody: threadStarterBody,
|
|
36941
|
+
ThreadStarterBody: !threadSessionPreviousTimestamp ? threadStarterBody : void 0,
|
|
36901
36942
|
ThreadHistoryBody: threadHistoryBody,
|
|
36902
36943
|
IsFirstThreadTurn: isThreadReply && threadTs && !threadSessionPreviousTimestamp ? true : void 0,
|
|
36903
36944
|
ThreadLabel: threadLabel,
|
|
@@ -36921,7 +36962,8 @@ async function prepareSlackMessage(params) {
|
|
|
36921
36962
|
sessionKey: route.mainSessionKey,
|
|
36922
36963
|
channel: "slack",
|
|
36923
36964
|
to: `user:${message.user}`,
|
|
36924
|
-
accountId: route.accountId
|
|
36965
|
+
accountId: route.accountId,
|
|
36966
|
+
threadId: threadContext.messageThreadId
|
|
36925
36967
|
} : void 0,
|
|
36926
36968
|
onRecordError: (err) => {
|
|
36927
36969
|
ctx.logger.warn({
|
|
@@ -37048,7 +37090,7 @@ function buildSeenMessageKey(channelId, ts) {
|
|
|
37048
37090
|
return `${channelId}:${ts}`;
|
|
37049
37091
|
}
|
|
37050
37092
|
function createSlackMessageHandler(params) {
|
|
37051
|
-
const { ctx, account } = params;
|
|
37093
|
+
const { ctx, account, trackEvent } = params;
|
|
37052
37094
|
const debounceMs = resolveInboundDebounceMs({
|
|
37053
37095
|
cfg: ctx.cfg,
|
|
37054
37096
|
channel: "slack"
|
|
@@ -37138,6 +37180,7 @@ function createSlackMessageHandler(params) {
|
|
|
37138
37180
|
if (seenMessageKey && wasSeen) {
|
|
37139
37181
|
if (opts.source !== "app_mention" || !consumeAppMentionRetryKey(seenMessageKey)) return;
|
|
37140
37182
|
}
|
|
37183
|
+
trackEvent?.();
|
|
37141
37184
|
const resolvedMessage = await threadTsResolver.resolve({
|
|
37142
37185
|
message,
|
|
37143
37186
|
source: opts.source
|
|
@@ -37611,7 +37654,7 @@ async function registerSlackMonitorSlashCommands(params) {
|
|
|
37611
37654
|
});
|
|
37612
37655
|
const deliverSlashPayloads = async (replies) => {
|
|
37613
37656
|
const [{ deliverSlackSlashReplies }, { resolveChunkMode }, { resolveMarkdownTableMode }] = await Promise.all([
|
|
37614
|
-
import("./replies-
|
|
37657
|
+
import("./replies-CvKNemz4.js").then((n) => n.r),
|
|
37615
37658
|
import("./chunk-D4rztYS_.js").then((n) => n.s),
|
|
37616
37659
|
import("./markdown-tables-Bf31F9r6.js").then((n) => n.t)
|
|
37617
37660
|
]);
|
|
@@ -37791,6 +37834,73 @@ const slackBoltModule = SlackBolt;
|
|
|
37791
37834
|
const { App, HTTPReceiver } = (slackBoltModule.App ? slackBoltModule : slackBoltModule.default) ?? slackBoltModule;
|
|
37792
37835
|
const SLACK_WEBHOOK_MAX_BODY_BYTES = 1024 * 1024;
|
|
37793
37836
|
const SLACK_WEBHOOK_BODY_TIMEOUT_MS = 3e4;
|
|
37837
|
+
const SLACK_SOCKET_RECONNECT_POLICY = {
|
|
37838
|
+
initialMs: 2e3,
|
|
37839
|
+
maxMs: 3e4,
|
|
37840
|
+
factor: 1.8,
|
|
37841
|
+
jitter: .25,
|
|
37842
|
+
maxAttempts: 12
|
|
37843
|
+
};
|
|
37844
|
+
function getSocketEmitter(app) {
|
|
37845
|
+
const receiver = app.receiver;
|
|
37846
|
+
const client = receiver && typeof receiver === "object" ? receiver.client : void 0;
|
|
37847
|
+
if (!client || typeof client !== "object") return null;
|
|
37848
|
+
const on = client.on;
|
|
37849
|
+
const off = client.off;
|
|
37850
|
+
if (typeof on !== "function" || typeof off !== "function") return null;
|
|
37851
|
+
return {
|
|
37852
|
+
on: (event, listener) => on.call(client, event, listener),
|
|
37853
|
+
off: (event, listener) => off.call(client, event, listener)
|
|
37854
|
+
};
|
|
37855
|
+
}
|
|
37856
|
+
function waitForSlackSocketDisconnect(app, abortSignal) {
|
|
37857
|
+
return new Promise((resolve) => {
|
|
37858
|
+
const emitter = getSocketEmitter(app);
|
|
37859
|
+
if (!emitter) {
|
|
37860
|
+
abortSignal?.addEventListener("abort", () => resolve({ event: "disconnect" }), { once: true });
|
|
37861
|
+
return;
|
|
37862
|
+
}
|
|
37863
|
+
const disconnectListener = () => resolveOnce({ event: "disconnect" });
|
|
37864
|
+
const startFailListener = () => resolveOnce({ event: "unable_to_socket_mode_start" });
|
|
37865
|
+
const errorListener = (error) => resolveOnce({
|
|
37866
|
+
event: "error",
|
|
37867
|
+
error
|
|
37868
|
+
});
|
|
37869
|
+
const abortListener = () => resolveOnce({ event: "disconnect" });
|
|
37870
|
+
const cleanup = () => {
|
|
37871
|
+
emitter.off("disconnected", disconnectListener);
|
|
37872
|
+
emitter.off("unable_to_socket_mode_start", startFailListener);
|
|
37873
|
+
emitter.off("error", errorListener);
|
|
37874
|
+
abortSignal?.removeEventListener("abort", abortListener);
|
|
37875
|
+
};
|
|
37876
|
+
const resolveOnce = (value) => {
|
|
37877
|
+
cleanup();
|
|
37878
|
+
resolve(value);
|
|
37879
|
+
};
|
|
37880
|
+
emitter.on("disconnected", disconnectListener);
|
|
37881
|
+
emitter.on("unable_to_socket_mode_start", startFailListener);
|
|
37882
|
+
emitter.on("error", errorListener);
|
|
37883
|
+
abortSignal?.addEventListener("abort", abortListener, { once: true });
|
|
37884
|
+
});
|
|
37885
|
+
}
|
|
37886
|
+
/**
|
|
37887
|
+
* Detect non-recoverable Slack API / auth errors that should NOT be retried.
|
|
37888
|
+
* These indicate permanent credential problems (revoked bot, deactivated account, etc.)
|
|
37889
|
+
* and retrying will never succeed — continuing to retry blocks the entire gateway.
|
|
37890
|
+
*/
|
|
37891
|
+
function isNonRecoverableSlackAuthError(error) {
|
|
37892
|
+
const msg = error instanceof Error ? error.message : typeof error === "string" ? error : "";
|
|
37893
|
+
return /account_inactive|invalid_auth|token_revoked|token_expired|not_authed|org_login_required|team_access_not_granted|missing_scope|cannot_find_service|invalid_token/i.test(msg);
|
|
37894
|
+
}
|
|
37895
|
+
function formatUnknownError(error) {
|
|
37896
|
+
if (error instanceof Error) return error.message;
|
|
37897
|
+
if (typeof error === "string") return error;
|
|
37898
|
+
try {
|
|
37899
|
+
return JSON.stringify(error);
|
|
37900
|
+
} catch {
|
|
37901
|
+
return "unknown error";
|
|
37902
|
+
}
|
|
37903
|
+
}
|
|
37794
37904
|
function parseApiAppIdFromAppToken(raw) {
|
|
37795
37905
|
const token = raw?.trim();
|
|
37796
37906
|
if (!token) return;
|
|
@@ -37914,13 +38024,21 @@ async function monitorSlackProvider(opts = {}) {
|
|
|
37914
38024
|
mediaMaxBytes,
|
|
37915
38025
|
removeAckAfterReply
|
|
37916
38026
|
});
|
|
38027
|
+
const trackEvent = opts.setStatus ? () => {
|
|
38028
|
+
opts.setStatus({
|
|
38029
|
+
lastEventAt: Date.now(),
|
|
38030
|
+
lastInboundAt: Date.now()
|
|
38031
|
+
});
|
|
38032
|
+
} : void 0;
|
|
37917
38033
|
registerSlackMonitorEvents({
|
|
37918
38034
|
ctx,
|
|
37919
38035
|
account,
|
|
37920
38036
|
handleSlackMessage: createSlackMessageHandler({
|
|
37921
38037
|
ctx,
|
|
37922
|
-
account
|
|
37923
|
-
|
|
38038
|
+
account,
|
|
38039
|
+
trackEvent
|
|
38040
|
+
}),
|
|
38041
|
+
trackEvent
|
|
37924
38042
|
});
|
|
37925
38043
|
await registerSlackMonitorSlashCommands({
|
|
37926
38044
|
ctx,
|
|
@@ -38009,13 +38127,52 @@ async function monitorSlackProvider(opts = {}) {
|
|
|
38009
38127
|
opts.abortSignal?.addEventListener("abort", stopOnAbort, { once: true });
|
|
38010
38128
|
try {
|
|
38011
38129
|
if (slackMode === "socket") {
|
|
38012
|
-
|
|
38013
|
-
|
|
38014
|
-
|
|
38015
|
-
|
|
38016
|
-
|
|
38017
|
-
|
|
38018
|
-
|
|
38130
|
+
let reconnectAttempts = 0;
|
|
38131
|
+
while (!opts.abortSignal?.aborted) {
|
|
38132
|
+
try {
|
|
38133
|
+
await app.start();
|
|
38134
|
+
reconnectAttempts = 0;
|
|
38135
|
+
runtime.log?.("slack socket mode connected");
|
|
38136
|
+
} catch (err) {
|
|
38137
|
+
if (isNonRecoverableSlackAuthError(err)) {
|
|
38138
|
+
runtime.error?.(`slack socket mode failed to start due to non-recoverable auth error — skipping channel (${formatUnknownError(err)})`);
|
|
38139
|
+
throw err;
|
|
38140
|
+
}
|
|
38141
|
+
reconnectAttempts += 1;
|
|
38142
|
+
if (SLACK_SOCKET_RECONNECT_POLICY.maxAttempts > 0 && reconnectAttempts >= SLACK_SOCKET_RECONNECT_POLICY.maxAttempts) throw err;
|
|
38143
|
+
const delayMs = computeBackoff(SLACK_SOCKET_RECONNECT_POLICY, reconnectAttempts);
|
|
38144
|
+
runtime.error?.(`slack socket mode failed to start. retry ${reconnectAttempts}/${SLACK_SOCKET_RECONNECT_POLICY.maxAttempts || "∞"} in ${Math.round(delayMs / 1e3)}s (${formatUnknownError(err)})`);
|
|
38145
|
+
try {
|
|
38146
|
+
await sleepWithAbort(delayMs, opts.abortSignal);
|
|
38147
|
+
} catch {
|
|
38148
|
+
break;
|
|
38149
|
+
}
|
|
38150
|
+
continue;
|
|
38151
|
+
}
|
|
38152
|
+
if (opts.abortSignal?.aborted) break;
|
|
38153
|
+
const disconnect = await waitForSlackSocketDisconnect(app, opts.abortSignal);
|
|
38154
|
+
if (opts.abortSignal?.aborted) break;
|
|
38155
|
+
if (disconnect.error && isNonRecoverableSlackAuthError(disconnect.error)) {
|
|
38156
|
+
runtime.error?.(`slack socket mode disconnected due to non-recoverable auth error — skipping channel (${formatUnknownError(disconnect.error)})`);
|
|
38157
|
+
throw disconnect.error instanceof Error ? disconnect.error : new Error(formatUnknownError(disconnect.error));
|
|
38158
|
+
}
|
|
38159
|
+
reconnectAttempts += 1;
|
|
38160
|
+
if (SLACK_SOCKET_RECONNECT_POLICY.maxAttempts > 0 && reconnectAttempts >= SLACK_SOCKET_RECONNECT_POLICY.maxAttempts) throw new Error(`Slack socket mode reconnect max attempts reached (${reconnectAttempts}/${SLACK_SOCKET_RECONNECT_POLICY.maxAttempts}) after ${disconnect.event}`);
|
|
38161
|
+
const delayMs = computeBackoff(SLACK_SOCKET_RECONNECT_POLICY, reconnectAttempts);
|
|
38162
|
+
runtime.error?.(`slack socket disconnected (${disconnect.event}). retry ${reconnectAttempts}/${SLACK_SOCKET_RECONNECT_POLICY.maxAttempts || "∞"} in ${Math.round(delayMs / 1e3)}s${disconnect.error ? ` (${formatUnknownError(disconnect.error)})` : ""}`);
|
|
38163
|
+
await app.stop().catch(() => void 0);
|
|
38164
|
+
try {
|
|
38165
|
+
await sleepWithAbort(delayMs, opts.abortSignal);
|
|
38166
|
+
} catch {
|
|
38167
|
+
break;
|
|
38168
|
+
}
|
|
38169
|
+
}
|
|
38170
|
+
} else {
|
|
38171
|
+
runtime.log?.(`slack http mode listening at ${slackWebhookPath}`);
|
|
38172
|
+
if (!opts.abortSignal?.aborted) await new Promise((resolve) => {
|
|
38173
|
+
opts.abortSignal?.addEventListener("abort", () => resolve(), { once: true });
|
|
38174
|
+
});
|
|
38175
|
+
}
|
|
38019
38176
|
} finally {
|
|
38020
38177
|
opts.abortSignal?.removeEventListener("abort", stopOnAbort);
|
|
38021
38178
|
unregisterHttpHandler?.();
|
|
@@ -44604,7 +44761,7 @@ function loadWebLoginQr() {
|
|
|
44604
44761
|
return webLoginQrPromise;
|
|
44605
44762
|
}
|
|
44606
44763
|
function loadWebChannel() {
|
|
44607
|
-
webChannelPromise ??= import("./web-
|
|
44764
|
+
webChannelPromise ??= import("./web-DXbKqGiu.js");
|
|
44608
44765
|
return webChannelPromise;
|
|
44609
44766
|
}
|
|
44610
44767
|
function loadWhatsAppActions() {
|
|
@@ -6,6 +6,7 @@ import { a as loadWebMedia, n as markdownToIR, t as chunkMarkdownIR } from "./ir
|
|
|
6
6
|
import { c as resolveChunkMode, i as chunkMarkdownTextWithMode, l as resolveTextChunkLimit } from "./chunk-D4rztYS_.js";
|
|
7
7
|
import { n as resolveMarkdownTableMode } from "./markdown-tables-Bf31F9r6.js";
|
|
8
8
|
import { t as renderMarkdownWithMarkers } from "./render-BiJZ5W4Z.js";
|
|
9
|
+
import { i as isSilentReplyText } from "./tokens-Dag82kdi.js";
|
|
9
10
|
import { WebClient } from "@slack/web-api";
|
|
10
11
|
|
|
11
12
|
//#region src/slack/blocks-input.ts
|
|
@@ -127,6 +128,7 @@ function isAllowedSlackAngleToken(token) {
|
|
|
127
128
|
return inner.startsWith("@") || inner.startsWith("#") || inner.startsWith("!") || inner.startsWith("mailto:") || inner.startsWith("tel:") || inner.startsWith("http://") || inner.startsWith("https://") || inner.startsWith("slack://");
|
|
128
129
|
}
|
|
129
130
|
function escapeSlackMrkdwnContent(text) {
|
|
131
|
+
if (!text) return "";
|
|
130
132
|
if (!text.includes("&") && !text.includes("<") && !text.includes(">")) return text;
|
|
131
133
|
SLACK_ANGLE_TOKEN_RE.lastIndex = 0;
|
|
132
134
|
const out = [];
|
|
@@ -142,6 +144,7 @@ function escapeSlackMrkdwnContent(text) {
|
|
|
142
144
|
return out.join("");
|
|
143
145
|
}
|
|
144
146
|
function escapeSlackMrkdwnText(text) {
|
|
147
|
+
if (!text) return "";
|
|
145
148
|
if (!text.includes("&") && !text.includes("<") && !text.includes(">")) return text;
|
|
146
149
|
return text.split("\n").map((line) => {
|
|
147
150
|
if (line.startsWith("> ")) return `> ${escapeSlackMrkdwnContent(line.slice(2))}`;
|
|
@@ -190,6 +193,15 @@ function buildSlackRenderOptions() {
|
|
|
190
193
|
buildLink: buildSlackLink
|
|
191
194
|
};
|
|
192
195
|
}
|
|
196
|
+
function markdownToSlackMrkdwn(markdown, options = {}) {
|
|
197
|
+
return renderMarkdownWithMarkers(markdownToIR(markdown ?? "", {
|
|
198
|
+
linkify: false,
|
|
199
|
+
autolink: false,
|
|
200
|
+
headingStyle: "bold",
|
|
201
|
+
blockquotePrefix: "> ",
|
|
202
|
+
tableMode: options.tableMode
|
|
203
|
+
}), buildSlackRenderOptions());
|
|
204
|
+
}
|
|
193
205
|
function markdownToSlackMrkdwnChunks(markdown, limit, options = {}) {
|
|
194
206
|
const chunks = chunkMarkdownIR(markdownToIR(markdown ?? "", {
|
|
195
207
|
linkify: false,
|
|
@@ -291,6 +303,13 @@ async function uploadSlackFile(params) {
|
|
|
291
303
|
}
|
|
292
304
|
async function sendMessageSlack(to, message, opts = {}) {
|
|
293
305
|
const trimmedMessage = message?.trim() ?? "";
|
|
306
|
+
if (isSilentReplyText(trimmedMessage) && !opts.mediaUrl && !opts.blocks) {
|
|
307
|
+
logVerbose("slack send: suppressed NO_REPLY token before API call");
|
|
308
|
+
return {
|
|
309
|
+
messageId: "suppressed",
|
|
310
|
+
channelId: ""
|
|
311
|
+
};
|
|
312
|
+
}
|
|
294
313
|
const blocks = opts.blocks == null ? void 0 : validateSlackBlocksArray(opts.blocks);
|
|
295
314
|
if (!trimmedMessage && !opts.mediaUrl && !blocks) throw new Error("Slack send requires text, blocks, or media");
|
|
296
315
|
const cfg = loadConfig();
|
|
@@ -364,4 +383,4 @@ async function sendMessageSlack(to, message, opts = {}) {
|
|
|
364
383
|
}
|
|
365
384
|
|
|
366
385
|
//#endregion
|
|
367
|
-
export {
|
|
386
|
+
export { buildSlackBlocksFallbackText as a, parseSlackBlocksInput as c, markdownToSlackMrkdwnChunks as i, validateSlackBlocksArray as l, send_exports as n, createSlackWebClient as o, markdownToSlackMrkdwn as r, resolveSlackWebClientOptions as s, sendMessageSlack as t };
|
|
@@ -8,4 +8,6 @@ export type SlackMessageHandler = (message: SlackMessageEvent, opts: {
|
|
|
8
8
|
export declare function createSlackMessageHandler(params: {
|
|
9
9
|
ctx: SlackMonitorContext;
|
|
10
10
|
account: ResolvedSlackAccount;
|
|
11
|
+
/** Called on each inbound event to update liveness tracking. */
|
|
12
|
+
trackEvent?: () => void;
|
|
11
13
|
}): SlackMessageHandler;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import type { MonitorSlackOpts } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Detect non-recoverable Slack API / auth errors that should NOT be retried.
|
|
4
|
+
* These indicate permanent credential problems (revoked bot, deactivated account, etc.)
|
|
5
|
+
* and retrying will never succeed — continuing to retry blocks the entire gateway.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isNonRecoverableSlackAuthError(error: unknown): boolean;
|
|
2
8
|
export declare function monitorSlackProvider(opts?: MonitorSlackOpts): Promise<void>;
|
|
@@ -10,6 +10,7 @@ export declare function deliverReplies(params: {
|
|
|
10
10
|
runtime: RuntimeEnv;
|
|
11
11
|
textLimit: number;
|
|
12
12
|
replyThreadTs?: string;
|
|
13
|
+
replyToMode: "off" | "first" | "all";
|
|
13
14
|
}): Promise<void>;
|
|
14
15
|
export type SlackRespondFn = (payload: {
|
|
15
16
|
text: string;
|
|
@@ -38,6 +39,7 @@ export declare function createSlackReplyDeliveryPlan(params: {
|
|
|
38
39
|
hasRepliedRef: {
|
|
39
40
|
value: boolean;
|
|
40
41
|
};
|
|
42
|
+
isThreadReply?: boolean;
|
|
41
43
|
}): SlackReplyDeliveryPlan;
|
|
42
44
|
export declare function deliverSlackSlashReplies(params: {
|
|
43
45
|
replies: ReplyPayload[];
|
|
@@ -11,6 +11,10 @@ export type MonitorSlackOpts = {
|
|
|
11
11
|
abortSignal?: AbortSignal;
|
|
12
12
|
mediaMaxMb?: number;
|
|
13
13
|
slashCommand?: SlackSlashCommandConfig;
|
|
14
|
+
/** Callback to update the channel account status snapshot (e.g. lastEventAt). */
|
|
15
|
+
setStatus?: (next: Record<string, unknown>) => void;
|
|
16
|
+
/** Callback to read the current channel account status snapshot. */
|
|
17
|
+
getStatus?: () => Record<string, unknown>;
|
|
14
18
|
};
|
|
15
19
|
export type SlackReactionEvent = {
|
|
16
20
|
type: "reaction_added" | "reaction_removed";
|