@openclaw/slack 2026.11.5 → 2026.11.10-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/README.md +16 -0
  2. package/dist/.setup/{account-configured-zcR9TJJN.mjs → account-configured-35y0-Hso.mjs} +1 -2
  3. package/dist/.setup/{account-inspect-BLVha-ov.mjs → account-inspect-DgQgj0wk.mjs} +3 -4
  4. package/dist/.setup/{accounts-CGJScKtk.mjs → accounts-EaPP0fFY.mjs} +6 -10
  5. package/dist/.setup/{action-runtime-D01wBhx5.mjs → action-runtime-Cs2IxOLc.mjs} +13 -12
  6. package/dist/.setup/action-runtime.runtime-me4Yd3j7.mjs +1 -0
  7. package/dist/.setup/{actions-D5S6D_BU.mjs → actions-BNOabmV6.mjs} +16 -24
  8. package/dist/.setup/{approval-handler.runtime-Buw5jh2Y.mjs → approval-handler.runtime-C2C-jNxi.mjs} +7 -8
  9. package/dist/.setup/{approval-message-updates-pmXcve5E.mjs → approval-message-updates-Bx2u_5-z.mjs} +2 -3
  10. package/dist/.setup/{channel-lxmLyPDr.mjs → channel-CyxJGWYr.mjs} +66 -53
  11. package/dist/.setup/{channel-meta-C443t-lI.mjs → channel-meta-C5vsCo3a.mjs} +1 -2
  12. package/dist/.setup/{channel-type-B5P3w9eA.mjs → channel-type-ZG0ErPTI.mjs} +5 -6
  13. package/dist/.setup/{channel.setup-Lq2OxKkF.mjs → channel.setup-DNnvYUKL.mjs} +10 -14
  14. package/dist/.setup/{config-schema-BWAaa5au.mjs → config-schema-DO2u-jsa.mjs} +5 -7
  15. package/dist/.setup/{cursor-pages-CATAzbTT.mjs → cursor-pages-jVn3Vkfi.mjs} +4 -8
  16. package/dist/.setup/{directory-config-D-hf9KGQ.mjs → directory-config-CGvKYg9F.mjs} +5 -6
  17. package/dist/.setup/{directory-live-onKAFI1E.mjs → directory-live-DNdw97LA.mjs} +4 -5
  18. package/dist/.setup/{doctor-contract-9-QJRCXk.mjs → doctor-contract-BB2KJ9Ni.mjs} +7 -13
  19. package/dist/.setup/fork-DTKBA8Fm.mjs +155 -0
  20. package/dist/.setup/literal-text-DdCRYzYh.mjs +24 -0
  21. package/dist/.setup/{message-tool-api-LGIgVXJf.mjs → message-tool-api-B38BpEaE.mjs} +5 -7
  22. package/dist/.setup/{monitor-C1oM6vom.mjs → monitor-DEKC3W7P.mjs} +147 -159
  23. package/dist/.setup/{outbound-adapter-C-95EWl2.mjs → outbound-adapter-1JpFMcJD.mjs} +14 -11
  24. package/dist/.setup/{paths-B1u59oLK.mjs → paths-CQZI_5WY.mjs} +1 -2
  25. package/dist/.setup/{pipeline.runtime-D398MsEc.mjs → pipeline.runtime-CJ9dBvJp.mjs} +113 -107
  26. package/dist/.setup/{policy-DxhGRvc2.mjs → policy-klXrk5vE.mjs} +3 -5
  27. package/dist/.setup/{probe-DANukR3O.mjs → probe-BHqvMbno.mjs} +72 -75
  28. package/dist/.setup/{question-delivery-CWC7sRhH.mjs → question-delivery-BGwm5Zmr.mjs} +2 -3
  29. package/dist/.setup/{relay-source-DNdK-_wn.mjs → relay-source-BPCzwy4s.mjs} +3 -4
  30. package/dist/.setup/{replies-BGZkt6tB.mjs → replies-DSFvZ-sZ.mjs} +11 -10
  31. package/dist/.setup/{reply-blocks-BzsXUUUL.mjs → reply-blocks-CFy-O-2B.mjs} +4 -7
  32. package/dist/.setup/{resolve-channels-XDPgnesf.mjs → resolve-channels-CF2JME9q.mjs} +4 -5
  33. package/dist/.setup/{resolve-users-aDAv24U2.mjs → resolve-users-DDcCAjH1.mjs} +4 -5
  34. package/dist/.setup/{rolldown-runtime-B4FMCO8f.mjs → rolldown-runtime-nwUcYXjP.mjs} +1 -2
  35. package/dist/.setup/{runtime-JSVZSWAj.mjs → runtime-C6HKn7Av.mjs} +1 -2
  36. package/dist/.setup/runtime-setter-api-DrXr965r.mjs +2 -0
  37. package/dist/.setup/{scopes-BocHwImV.mjs → scopes-DKl6yqIv.mjs} +3 -4
  38. package/dist/.setup/{secret-contract-uiQtoNlu.mjs → secret-contract-CqVqR7MP.mjs} +2 -3
  39. package/dist/.setup/{secret-contract-api-BlLz88mj.mjs → secret-contract-api-DaCXZ47j.mjs} +1 -1
  40. package/dist/.setup/{security-audit-DFGiFLqd.mjs → security-audit-C3hXCfDt.mjs} +2 -3
  41. package/dist/.setup/{send-yK6_-px6.mjs → send-kGJWQtLk.mjs} +20 -38
  42. package/dist/.setup/{send-results-BGxlroJ-.mjs → send-results-Bm6V1ekL.mjs} +1 -2
  43. package/dist/.setup/setup-plugin-api-UWUSCOAK.mjs +2 -0
  44. package/dist/.setup/{setup-surface-C0KRtyqa.mjs → setup-surface-CPFVFPFM.mjs} +6 -7
  45. package/dist/.setup/{slash-dispatch.runtime-B9IcPnHV.mjs → slash-dispatch.runtime-BddQT-3Z.mjs} +1 -1
  46. package/dist/.setup/{target-parsing-Bx2UZniD.mjs → target-parsing-DwYAP3ts.mjs} +1 -2
  47. package/dist/.setup/{targets-D-ASeWHy.mjs → targets-eeOxA_b_.mjs} +2 -3
  48. package/dist/.setup/{thread-ts-Cvt7WD6B.mjs → thread-ts-47Au2-Yn.mjs} +1 -2
  49. package/dist/.source-module-urls/c5ffd0957b234c7c12090e7de4eca2482ef339b8561e078da55b734211b0ba58.json +1 -1
  50. package/dist/account-inspect-api.js +2 -3
  51. package/dist/api.js +16 -16
  52. package/dist/channel-config-api.js +1 -1
  53. package/dist/channel-entry.js +1 -2
  54. package/dist/channel-plugin-api.js +1 -1
  55. package/dist/configured-state.js +2 -3
  56. package/dist/directory-contract-api.js +1 -1
  57. package/dist/doctor-contract-api.js +1 -1
  58. package/dist/index.js +1 -2
  59. package/dist/message-tool-api.js +1 -1
  60. package/dist/runtime-api.js +10 -10
  61. package/dist/runtime-setter-api.js +1 -1
  62. package/dist/secret-contract-api.js +1 -1
  63. package/dist/security-contract-api.js +1 -1
  64. package/dist/setup-entry.js +4 -5
  65. package/dist/setup-plugin-api.js +1 -1
  66. package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
  67. package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
  68. package/node_modules/@slack/bolt/node_modules/@types/node/zlib.d.ts +752 -0
  69. package/node_modules/@slack/bolt/node_modules/qs/.editorconfig +1 -1
  70. package/node_modules/@slack/bolt/node_modules/qs/CHANGELOG.md +87 -22
  71. package/node_modules/@slack/bolt/node_modules/qs/README.md +63 -10
  72. package/node_modules/@slack/bolt/node_modules/qs/dist/qs.js +17 -17
  73. package/node_modules/@slack/bolt/node_modules/qs/eslint.config.mjs +61 -50
  74. package/node_modules/@slack/bolt/node_modules/qs/lib/formats.js +7 -2
  75. package/node_modules/@slack/bolt/node_modules/qs/lib/parse.js +29 -10
  76. package/node_modules/@slack/bolt/node_modules/qs/lib/stringify.js +5 -3
  77. package/node_modules/@slack/bolt/node_modules/qs/lib/utils.js +28 -9
  78. package/node_modules/@slack/bolt/node_modules/qs/package.json +6 -6
  79. package/node_modules/@slack/bolt/node_modules/qs/test/parse.js +335 -2
  80. package/node_modules/@slack/bolt/node_modules/qs/test/stringify.js +222 -0
  81. package/node_modules/@slack/bolt/node_modules/qs/test/utils.js +61 -3
  82. package/node_modules/@slack/types/dist/block-kit/block-elements.d.ts +14 -0
  83. package/node_modules/@slack/types/dist/block-kit/block-elements.d.ts.map +1 -1
  84. package/node_modules/@slack/types/dist/block-kit/blocks.d.ts +65 -1
  85. package/node_modules/@slack/types/dist/block-kit/blocks.d.ts.map +1 -1
  86. package/node_modules/@slack/types/dist/events/index.d.ts +2 -2
  87. package/node_modules/@slack/types/dist/events/index.d.ts.map +1 -1
  88. package/node_modules/@slack/types/dist/events/index.js.map +1 -1
  89. package/node_modules/@slack/types/dist/events/message.d.ts +4 -0
  90. package/node_modules/@slack/types/dist/events/message.d.ts.map +1 -1
  91. package/node_modules/@slack/types/dist/events/user.d.ts +20 -0
  92. package/node_modules/@slack/types/dist/events/user.d.ts.map +1 -1
  93. package/node_modules/@slack/types/package.json +1 -1
  94. package/node_modules/@slack/web-api/dist/WebClient.js +1 -1
  95. package/node_modules/@slack/web-api/dist/WebClient.js.map +1 -1
  96. package/node_modules/@slack/web-api/dist/file-upload.js +1 -1
  97. package/node_modules/@slack/web-api/dist/file-upload.js.map +1 -1
  98. package/node_modules/@slack/web-api/dist/methods.d.ts +18 -3
  99. package/node_modules/@slack/web-api/dist/methods.d.ts.map +1 -1
  100. package/node_modules/@slack/web-api/dist/methods.js +16 -1
  101. package/node_modules/@slack/web-api/dist/methods.js.map +1 -1
  102. package/node_modules/@slack/web-api/dist/types/request/apps.d.ts +62 -0
  103. package/node_modules/@slack/web-api/dist/types/request/apps.d.ts.map +1 -1
  104. package/node_modules/@slack/web-api/dist/types/request/canvas.d.ts +4 -0
  105. package/node_modules/@slack/web-api/dist/types/request/canvas.d.ts.map +1 -1
  106. package/node_modules/@slack/web-api/dist/types/request/files.d.ts +5 -1
  107. package/node_modules/@slack/web-api/dist/types/request/files.d.ts.map +1 -1
  108. package/node_modules/@slack/web-api/dist/types/request/index.d.ts +2 -2
  109. package/node_modules/@slack/web-api/dist/types/request/index.d.ts.map +1 -1
  110. package/node_modules/@slack/web-api/dist/types/request/manifest.d.ts +35 -3
  111. package/node_modules/@slack/web-api/dist/types/request/manifest.d.ts.map +1 -1
  112. package/node_modules/@slack/web-api/dist/types/request/team.d.ts +6 -0
  113. package/node_modules/@slack/web-api/dist/types/request/team.d.ts.map +1 -1
  114. package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionBulkUpdateResponse.d.ts +19 -0
  115. package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionBulkUpdateResponse.d.ts.map +1 -0
  116. package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionBulkUpdateResponse.js +11 -0
  117. package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionBulkUpdateResponse.js.map +1 -0
  118. package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionRequestAuthResponse.d.ts +14 -0
  119. package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionRequestAuthResponse.d.ts.map +1 -0
  120. package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionRequestAuthResponse.js +11 -0
  121. package/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionRequestAuthResponse.js.map +1 -0
  122. package/node_modules/@slack/web-api/dist/types/response/CanvasesGetContentResponse.d.ts +10 -0
  123. package/node_modules/@slack/web-api/dist/types/response/CanvasesGetContentResponse.d.ts.map +1 -0
  124. package/node_modules/@slack/web-api/dist/types/response/CanvasesGetContentResponse.js +11 -0
  125. package/node_modules/@slack/web-api/dist/types/response/CanvasesGetContentResponse.js.map +1 -0
  126. package/node_modules/@slack/web-api/dist/types/response/TeamInfoResponse.d.ts +1 -0
  127. package/node_modules/@slack/web-api/dist/types/response/TeamInfoResponse.d.ts.map +1 -1
  128. package/node_modules/@slack/web-api/dist/types/response/index.d.ts +3 -0
  129. package/node_modules/@slack/web-api/dist/types/response/index.d.ts.map +1 -1
  130. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
  131. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
  132. package/node_modules/@slack/web-api/node_modules/@types/node/zlib.d.ts +752 -0
  133. package/node_modules/@slack/web-api/package.json +3 -3
  134. package/node_modules/typebox/build/format/date_time.d.mts +2 -1
  135. package/node_modules/typebox/build/format/date_time.mjs +12 -3
  136. package/node_modules/typebox/package.json +1 -1
  137. package/openclaw.plugin.json +13 -8
  138. package/package.json +7 -7
  139. package/dist/.setup/action-runtime.runtime-VQGaR6g8.mjs +0 -1
  140. package/dist/.setup/runtime-setter-api-Cx_PV-xu.mjs +0 -2
  141. package/dist/.setup/setup-plugin-api-Cfz58xoh.mjs +0 -2
@@ -1,15 +1,15 @@
1
- import { n as __reExport, t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { d as resolveSlackMarkdownOptions, o as resolveDefaultSlackAccountId, p as resolveSlackReplyToMode } from "./accounts-CGJScKtk.mjs";
3
- import { n as formatSlackTarget } from "./target-parsing-Bx2UZniD.mjs";
4
- import { F as truncateSlackText, Gt as resolveSlackUserAllowed, I as truncateSlackTextByUtf8Bytes, O as hasSlackNativeDataBlock, P as countSlackTextUtf8Bytes, Tt as escapeSlackMrkdwn, U as SLACK_SESSION_LINK_ACTION_ID, Vt as normalizeSlackAllowOwnerEntry, _ as qualifySlackRoutePeerId, at as buildSlackCompleteBlocksFallbackText, it as buildSlackBlocksFallbackText, m as formatSlackError, vt as SLACK_EDIT_TEXT_MAX_BYTES, wt as normalizeSlackOutboundText, xt as SLACK_TEXT_LIMIT } from "./probe-DANukR3O.mjs";
5
- import { n as resolveSlackReplyThreadTs } from "./thread-ts-Cvt7WD6B.mjs";
6
- import { c as resolveSlackReplyRenderPlan, i as prepareSlackReply, o as resolveSlackReplyBlocks } from "./reply-blocks-BzsXUUUL.mjs";
7
- import { d as getOrCreateWeakOwnerMap, m as writeLruMapEntry, p as readLruMapEntry } from "./cursor-pages-CATAzbTT.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-D5S6D_BU.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-yK6_-px6.mjs";
10
- import { n as resolveSlackChannelConfig } from "./policy-DxhGRvc2.mjs";
11
- import { C as resolveSlackChatType, E as stripSlackMentionsForCommandDetection, S as normalizeSlackChannelType, T as readSlackAssistantThreadContext, _ as appendSlackStream, b as stopSlackStream, c as registerSlackSessionRun, g as SlackStreamNotDeliveredError, 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 markSlackStreamFallbackDelivered, w as buildSlackAssistantThreadMetadata, y as startSlackStream } from "./monitor-C1oM6vom.mjs";
12
- import { a as emitSlackMessageSentHooks, i as sanitizeSlackMonitorReplyPayload, n as deliverReplies, t as createSlackReplyDeliveryPlan } from "./replies-BGZkt6tB.mjs";
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-DEKC3W7P.mjs";
12
+ import { a as emitSlackMessageSentHooks, i as sanitizeSlackMonitorReplyPayload, n as deliverReplies, t as createSlackReplyDeliveryPlan } from "./replies-DSFvZ-sZ.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";
@@ -45,7 +45,7 @@ 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
- //#region extensions/slack/src/monitor/message-handler/timestamp.ts
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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 draftStream = shouldUseDraftStream ? createSlackDraftStream({
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 isProgressMode = slackStreaming.mode === "progress";
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: Boolean(draftStream) || useNativeProgressStreaming,
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 = Boolean(draftStream) && isProgressMode && slackProgressStyle === "card";
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 {
@@ -1301,9 +1293,11 @@ function createSlackProgressRuntime(runtimeParams) {
1301
1293
  onCleanupFailure: (error) => logVerbose(`slack: progress preview cleanup failed (${formatSlackError(error)})`)
1302
1294
  });
1303
1295
  const commentaryProgressEnabled = progressDraft.commentaryProgressEnabled;
1296
+ let nativeFinalDelivery;
1304
1297
  const deliverNativeFinal = async (payload, kind) => {
1305
- await cancelNativeUpdates();
1306
- return await withNativeStreamOrder(() => deliverNativeFinalNow(payload, kind));
1298
+ const run = cancelNativeUpdates().then(() => withNativeStreamOrder(() => deliverNativeFinalNow(payload, kind)));
1299
+ nativeFinalDelivery = run.catch(() => void 0);
1300
+ return await run;
1307
1301
  };
1308
1302
  const deliverNativeFinalNow = async (payload, kind) => {
1309
1303
  const streamReady = await nativeTransport.waitForStart();
@@ -1354,6 +1348,8 @@ function createSlackProgressRuntime(runtimeParams) {
1354
1348
  if (delivery.nativeProgressStreamStartPromise) await delivery.nativeProgressStreamStartPromise.catch(() => null);
1355
1349
  if (completionChunks?.length) nativeProgressCompletionSent = true;
1356
1350
  await delivery.finishStream(completionChunks);
1351
+ await previewLifecycle.cleanup();
1352
+ draftStream?.forceNewMessage();
1357
1353
  delivery.streamSession = null;
1358
1354
  delivery.nativeProgressStreamStartPromise = null;
1359
1355
  delivery.nativeProgressStreamThreadTs = void 0;
@@ -1411,6 +1407,7 @@ function createSlackProgressRuntime(runtimeParams) {
1411
1407
  const beginNewProgressTurn = async (options) => {
1412
1408
  if (useNativeProgressStreaming) {
1413
1409
  if (!nativeUpdatesStopped && options?.force !== true) return false;
1410
+ if (options?.force !== true) await nativeFinalDelivery;
1414
1411
  await cancelNativeUpdates();
1415
1412
  }
1416
1413
  const priorSnapshot = progressDraft.getSnapshot();
@@ -1508,8 +1505,7 @@ function createSlackProgressRuntime(runtimeParams) {
1508
1505
  updateDraftFromPartial
1509
1506
  };
1510
1507
  }
1511
- //#endregion
1512
- //#region extensions/slack/src/monitor/message-handler/dispatch-setup.ts
1508
+ // extensions/slack/src/monitor/message-handler/dispatch-setup.ts
1513
1509
  async function createSlackDispatchSetup(prepared) {
1514
1510
  const { ctx, account, message, route } = prepared;
1515
1511
  const slackClient = prepared.eventScope?.client ?? ctx.app.client;
@@ -1725,8 +1721,7 @@ async function createSlackDispatchSetup(prepared) {
1725
1721
  useStreaming
1726
1722
  };
1727
1723
  }
1728
- //#endregion
1729
- //#region extensions/slack/src/monitor/message-handler/dispatch-streaming.ts
1724
+ // extensions/slack/src/monitor/message-handler/dispatch-streaming.ts
1730
1725
  function createSlackStreamingDeliveryRuntime(setup) {
1731
1726
  const { isThreadReply, messageSentHookContext, messageSentHookTarget, prepared, replyDeliveryMode, replyPlan, runtime, slackClient, slackClientOptions, slackIdentity, slackStreamFallbackTeamId } = setup;
1732
1727
  const { account, ctx, forcedReplyThreadTs, message, slackMessageMetadata } = prepared;
@@ -1742,6 +1737,7 @@ function createSlackStreamingDeliveryRuntime(setup) {
1742
1737
  nativeProgressStreamStartPromise: null,
1743
1738
  nativeProgressStreamThreadTs: void 0,
1744
1739
  streamFailed: false,
1740
+ pendingTextIsProgress: false,
1745
1741
  usedReplyThreadTs: void 0,
1746
1742
  usedBlockReplyThreadTs: void 0,
1747
1743
  observedReplyDelivery: false
@@ -1839,7 +1835,7 @@ function createSlackStreamingDeliveryRuntime(setup) {
1839
1835
  const deliverPendingStreamFallback = async (session, err) => {
1840
1836
  if (session.stoppedBySlack) return;
1841
1837
  let fallbackError = err;
1842
- if (!session.stopped) try {
1838
+ if (!session.stopped && !(err instanceof SlackStreamMessageTooLongError)) try {
1843
1839
  const stopResult = await stopStream(session);
1844
1840
  if (session.stoppedBySlack) return;
1845
1841
  state.observedReplyDelivery = true;
@@ -1882,8 +1878,13 @@ function createSlackStreamingDeliveryRuntime(setup) {
1882
1878
  await stopStream(session, chunks);
1883
1879
  state.observedReplyDelivery ||= session.delivered;
1884
1880
  } catch (error) {
1885
- if (!(error instanceof SlackStreamNotDeliveredError)) throw error;
1886
- await deliverPendingStreamFallback(session, error);
1881
+ if (error instanceof SlackStreamMessageTooLongError && chunks?.length) {
1882
+ runtime.error?.(danger("slack-stream: Slack rejected the closeout with msg_too_long; stopping without it"));
1883
+ markSlackStreamFallbackDelivered(session);
1884
+ await stopStream(session);
1885
+ state.observedReplyDelivery ||= session.delivered;
1886
+ } else if (error instanceof SlackStreamNotDeliveredError) await deliverPendingStreamFallback(session, error);
1887
+ else throw error;
1887
1888
  }
1888
1889
  } catch (error) {
1889
1890
  state.streamFailed = true;
@@ -1920,8 +1921,11 @@ function createSlackStreamingDeliveryRuntime(setup) {
1920
1921
  threadTs: deliveryReplyThreadTs
1921
1922
  }, preparedReply);
1922
1923
  if (deliveryKey && deliveredKeys.has(deliveryKey)) return { visibleReplySent: false };
1924
+ const session = state.streamSession;
1925
+ const discardProgress = params.kind === "final" && state.pendingTextIsProgress;
1923
1926
  const sent = await deliverPreparedReply(preparedReply, deliveryReplyThreadTs);
1924
1927
  if (!sent?.receipt.platformMessageIds.length) return { visibleReplySent: false };
1928
+ if (discardProgress && session?.pendingText && !session.stopped) markSlackStreamFallbackDelivered(session);
1925
1929
  state.observedReplyDelivery = true;
1926
1930
  const deliveredThreadTs = resolveSlackReplyThreadTs({
1927
1931
  replyToMode: replyDeliveryMode,
@@ -1987,6 +1991,7 @@ function createSlackStreamingDeliveryRuntime(setup) {
1987
1991
  if (deliveryKey && deliveredKeys.has(deliveryKey)) return { visibleReplySent: false };
1988
1992
  let messageId;
1989
1993
  let fallbackDelivery;
1994
+ state.pendingTextIsProgress = false;
1990
1995
  try {
1991
1996
  if (session) await appendSlackStream({
1992
1997
  session,
@@ -2065,8 +2070,7 @@ function createSlackStreamingDeliveryRuntime(setup) {
2065
2070
  resetDeliveryTracker: () => deliveredKeys.clear()
2066
2071
  });
2067
2072
  }
2068
- //#endregion
2069
- //#region extensions/slack/src/monitor/message-handler/failure-notice.ts
2073
+ // extensions/slack/src/monitor/message-handler/failure-notice.ts
2070
2074
  /** One outage policy for immediate replies and later origin-routed queue drains. */
2071
2075
  function createSlackFailureNoticePolicy(params, hasVisibleReply) {
2072
2076
  const { context, accountId, channelId, failureNoticeThreadTs, failureNoticeTeamId, statusThreadTs } = params;
@@ -2134,8 +2138,7 @@ function createSlackQueuedFailureNoticePolicy(params, beginSessionRun) {
2134
2138
  }
2135
2139
  };
2136
2140
  }
2137
- //#endregion
2138
- //#region extensions/slack/src/monitor/message-handler/dispatch.ts
2141
+ // extensions/slack/src/monitor/message-handler/dispatch.ts
2139
2142
  function formatSlackGroupThreadReply(text, participant) {
2140
2143
  return `**${participant.name.replace(/[\\`*_{}[\]()<>#!|]/g, "\\$&").replace(/\s+/g, " ")}**\n${text}`;
2141
2144
  }
@@ -2448,6 +2451,7 @@ async function dispatchSlackMessageWithSetup(setup, beginSessionRun, turnAdoptio
2448
2451
  const anyReplyDelivered = hasVisibleInboundReplyDispatch(settledDispatchResult, { observedReplyDelivery: delivery.observedReplyDelivery || previewLifecycle.finalDelivered });
2449
2452
  if (anyReplyDelivered && !previewLifecycle.finalStarted && !dispatchError && !agentRunFailed) {
2450
2453
  if (hasVisibleInboundReplyDispatch(settledDispatchResult)) await previewLifecycle.observeDelivery({ visibleReplySent: true });
2454
+ if (progress.useDraftProgressCard) await progress.finalizeDraftProgressCard("success");
2451
2455
  }
2452
2456
  await previewLifecycle.cleanup({ failed: Boolean(dispatchError || agentRunFailed) });
2453
2457
  if (anyReplyDelivered) failurePolicy.recordDelivered();
@@ -2472,8 +2476,7 @@ async function dispatchSlackMessageWithSetup(setup, beginSessionRun, turnAdoptio
2472
2476
  if (progress.useDraftProgressCard) await draftStream?.clear();
2473
2477
  }
2474
2478
  }
2475
- //#endregion
2476
- //#region extensions/slack/src/agent-context.ts
2479
+ // extensions/slack/src/agent-context.ts
2477
2480
  function normalizeEntity(value) {
2478
2481
  const entity = asOptionalRecord(value);
2479
2482
  const type = normalizeOptionalString(entity?.type);
@@ -2511,8 +2514,7 @@ function normalizeSlackAppContextEntities(value) {
2511
2514
  return normalized ? [normalized] : [];
2512
2515
  });
2513
2516
  }
2514
- //#endregion
2515
- //#region extensions/slack/src/monitor/thread.ts
2517
+ // extensions/slack/src/monitor/thread.ts
2516
2518
  const threadStarterCache = createStaleWhileRevalidateCache({
2517
2519
  maxEntries: 2e3,
2518
2520
  maxPending: Number.POSITIVE_INFINITY,
@@ -2686,8 +2688,7 @@ async function resolveSlackChannelHistory(params) {
2686
2688
  }
2687
2689
  return messages.slice(0, params.limit).reverse();
2688
2690
  }
2689
- //#endregion
2690
- //#region extensions/slack/src/monitor/message-handler/preflight-audio.ts
2691
+ // extensions/slack/src/monitor/message-handler/preflight-audio.ts
2691
2692
  function isSlackAudioFile(file) {
2692
2693
  if (file.subtype === "slack_audio") return true;
2693
2694
  if ((file.mimetype?.split(";")[0]?.trim().toLowerCase())?.startsWith("audio/")) return true;
@@ -2730,13 +2731,12 @@ const sendSlackPreflightAudioTranscriptEcho = slackPreflightAudio.send.bind(slac
2730
2731
  async function discardSlackPreflightMedia(media) {
2731
2732
  await Promise.allSettled((media ?? []).map((entry) => fs.rm(entry.path, { force: true })));
2732
2733
  }
2733
- //#endregion
2734
- //#region extensions/slack/src/monitor/message-handler/prepare-content.ts
2734
+ // extensions/slack/src/monitor/message-handler/prepare-content.ts
2735
2735
  const SLACK_MENTION_RESOLUTION_CONCURRENCY = 4;
2736
2736
  const SLACK_MENTION_RESOLUTION_MAX_LOOKUPS_PER_MESSAGE = 20;
2737
2737
  const SLACK_USER_MENTION_RE$1 = /<@([A-Z0-9]+)(?:\|[^>]+)?>/gi;
2738
2738
  const MAX_SLACK_UNAVAILABLE_FILE_TEXT_CHARS = 2e3;
2739
- const loadSlackMediaModule$2 = createLazyRuntimeModule(() => import("./actions-D5S6D_BU.mjs").then((n) => n._));
2739
+ const loadSlackMediaModule$2 = createLazyRuntimeModule(() => import("./actions-BNOabmV6.mjs").then((n) => n._));
2740
2740
  function formatSlackUnavailableMedia(params) {
2741
2741
  let fileReferences = params.files?.map((file) => `${formatSlackFileReference(file)} unavailable (${file.reason})`).join(", ");
2742
2742
  if (fileReferences && fileReferences.length > MAX_SLACK_UNAVAILABLE_FILE_TEXT_CHARS) fileReferences = `${truncateUtf16Safe(fileReferences, MAX_SLACK_UNAVAILABLE_FILE_TEXT_CHARS)}; … (file references truncated)`;
@@ -2832,8 +2832,7 @@ async function resolveSlackMessageContent(params) {
2832
2832
  mentionStripPatterns
2833
2833
  } : null;
2834
2834
  }
2835
- //#endregion
2836
- //#region extensions/slack/src/monitor/message-handler/prepare-dm-history.ts
2835
+ // extensions/slack/src/monitor/message-handler/prepare-dm-history.ts
2837
2836
  function resolveSlackDmHistoryLimit(params) {
2838
2837
  const override = params.userId ? params.account.config.dms?.[params.userId]?.historyLimit : void 0;
2839
2838
  return resolvePromptHistoryLimit(override ?? params.defaultLimit, 0);
@@ -2865,20 +2864,24 @@ async function resolveSlackDmHistoryContext(params) {
2865
2864
  body: void 0,
2866
2865
  inboundHistory: void 0
2867
2866
  };
2868
- const userNames = /* @__PURE__ */ new Map();
2869
- const resolveUserLabel = async (userId) => {
2870
- const cached = userNames.get(userId);
2871
- if (cached) return cached;
2872
- const label = normalizeOptionalString((await params.ctx.resolveUserName(userId, params.eventScope)).name) ?? userId;
2873
- userNames.set(userId, label);
2874
- return label;
2875
- };
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);
2876
2879
  const entries = [];
2877
2880
  const formatted = [];
2878
2881
  for (const { message, body } of messages) {
2879
- const isCurrentBot = params.ctx.botUserId && message.user === params.ctx.botUserId || params.ctx.botId && message.bot_id === params.ctx.botId;
2880
- const role = isCurrentBot || message.bot_id ? "assistant" : "user";
2881
- const sender = `${isCurrentBot ? "Assistant" : message.user ? await resolveUserLabel(message.user) : normalizeOptionalString(message.username) ?? (message.bot_id ? "Bot" : "Unknown")} (${role})`;
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})`;
2882
2885
  const timestamp = resolveSlackTimestampMs(message.ts);
2883
2886
  entries.push({
2884
2887
  sender,
@@ -2906,21 +2909,19 @@ async function resolveSlackDmHistoryContext(params) {
2906
2909
  };
2907
2910
  }
2908
2911
  }
2909
- //#endregion
2910
- //#region extensions/slack/src/monitor/message-handler/prepare-thread-context-root.ts
2912
+ // extensions/slack/src/monitor/message-handler/prepare-thread-context-root.ts
2911
2913
  function isSlackThreadAuthorCurrentBot(params) {
2912
2914
  const { identity, author } = params;
2913
2915
  if (identity.botUserId && author.userId && author.userId === identity.botUserId) return true;
2914
2916
  if (identity.botId && author.botId && author.botId === identity.botId) return true;
2915
2917
  return false;
2916
2918
  }
2917
- //#endregion
2918
- //#region extensions/slack/src/monitor/message-handler/prepare-room-history.ts
2919
+ // extensions/slack/src/monitor/message-handler/prepare-room-history.ts
2919
2920
  const SLACK_HISTORY_MEDIA_MAX_ATTACHMENTS = 4;
2920
2921
  const SLACK_HISTORY_MEDIA_MAX_BYTES = 10485760;
2921
2922
  const SLACK_HISTORY_MEDIA_IDLE_TIMEOUT_MS = 1e3;
2922
2923
  const SLACK_HISTORY_MEDIA_TOTAL_TIMEOUT_MS = 3e3;
2923
- const loadSlackMediaModule$1 = createLazyRuntimeModule(() => import("./actions-D5S6D_BU.mjs").then((n) => n._));
2924
+ const loadSlackMediaModule$1 = createLazyRuntimeModule(() => import("./actions-BNOabmV6.mjs").then((n) => n._));
2924
2925
  async function resolveSlackRoomHistory(params) {
2925
2926
  if (params.ctx.historyLimit <= 0 || !params.message.ts) return [];
2926
2927
  const warnOmission = (reason) => {
@@ -2949,13 +2950,26 @@ async function resolveSlackRoomHistory(params) {
2949
2950
  onOmission: warnOmission
2950
2951
  }) : await resolveSlackChannelHistory(request);
2951
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);
2952
2970
  const permitted = [];
2953
- for (const message of messages) {
2954
- if (isSlackThreadAuthorCurrentBot({
2955
- identity: params.ctx,
2956
- author: message
2957
- })) continue;
2958
- 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;
2959
2973
  params.assertCurrent();
2960
2974
  const senderAllowed = resolveSlackUserAllowed({
2961
2975
  allowList: params.allowFromLower,
@@ -3045,17 +3059,15 @@ function sliceSlackImageFileCandidates(files, limit) {
3045
3059
  if (limit <= 0 || !files?.length) return [];
3046
3060
  return files.filter(isSlackImageFileCandidate).slice(0, limit);
3047
3061
  }
3048
- //#endregion
3049
- //#region extensions/slack/src/monitor/message-handler/prepare-session-presentation.ts
3062
+ // extensions/slack/src/monitor/message-handler/prepare-session-presentation.ts
3050
3063
  function resolveSlackGroupSessionSubject(params) {
3051
3064
  const channelName = normalizeOptionalString(params.channelName);
3052
3065
  const workspaceName = normalizeOptionalString(params.installationIdentity?.kind === "workspace" && params.installationIdentity.teamId === params.workspaceId ? params.installationIdentity.teamName : void 0);
3053
3066
  if (channelName && workspaceName) return `${workspaceName} #${channelName}`;
3054
3067
  return `Slack Channel (Workspace ID: ${params.workspaceId}, Channel ID: ${params.channelId})`;
3055
3068
  }
3056
- //#endregion
3057
- //#region extensions/slack/src/monitor/message-handler/prepare-thread-context.ts
3058
- 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._));
3059
3071
  const SLACK_THREAD_CONTEXT_USER_LOOKUP_CONCURRENCY = 4;
3060
3072
  function formatSlackThreadLabelSnippet(text) {
3061
3073
  return truncateUtf16Safe(text.replace(/\s+/g, " "), 80);
@@ -3243,8 +3255,7 @@ async function resolveSlackThreadContextData(params) {
3243
3255
  }
3244
3256
  return readThreadContextData();
3245
3257
  }
3246
- //#endregion
3247
- //#region src/channels/mention-gating.ts
3258
+ // src/channels/mention-gating.ts
3248
3259
  function resolveBotThreadMentionPolicy(params) {
3249
3260
  if (!params.isBotOwnedThread || params.requireMentionInBotThreads === void 0) return {
3250
3261
  requireMention: params.requireMention,
@@ -3255,13 +3266,11 @@ function resolveBotThreadMentionPolicy(params) {
3255
3266
  implicitMentionKinds: params.requireMentionInBotThreads ? params.implicitMentionKinds?.filter((kind) => kind === "native") : params.implicitMentionKinds
3256
3267
  };
3257
3268
  }
3258
- //#endregion
3259
- //#region \0openclaw:bundled-sdk:openclaw/plugin-sdk/channel-mention-gating
3269
+ // \0openclaw:bundled-sdk:openclaw/plugin-sdk/channel-mention-gating
3260
3270
  var channel_mention_gating_exports = /* @__PURE__ */ __exportAll({ resolveBotThreadMentionPolicy: () => resolveBotThreadMentionPolicy });
3261
3271
  import * as import_openclaw_plugin_sdk_channel_mention_gating from "openclaw/plugin-sdk/channel-mention-gating";
3262
3272
  __reExport(channel_mention_gating_exports, import_openclaw_plugin_sdk_channel_mention_gating);
3263
- //#endregion
3264
- //#region extensions/slack/src/monitor/message-handler/prepare-thread-mentions.ts
3273
+ // extensions/slack/src/monitor/message-handler/prepare-thread-mentions.ts
3265
3274
  async function resolveSlackThreadMentionPolicy(params) {
3266
3275
  const { ctx, account, message, conversation, thread } = params;
3267
3276
  const { isRoom, isDirectMessage, channelConfig } = conversation;
@@ -3295,8 +3304,7 @@ async function resolveSlackThreadMentionPolicy(params) {
3295
3304
  implicitMentionKinds
3296
3305
  });
3297
3306
  }
3298
- //#endregion
3299
- //#region extensions/slack/src/monitor/message-handler/subteam-mentions.ts
3307
+ // extensions/slack/src/monitor/message-handler/subteam-mentions.ts
3300
3308
  const SUBTEAM_MENTION_RE = /<!subteam\^([A-Z0-9]+)(?:\|[^>]*)?>/gi;
3301
3309
  const SUBTEAM_MEMBER_CACHE_TTL_MS = 3e5;
3302
3310
  const subteamMemberCache = /* @__PURE__ */ new WeakMap();
@@ -3354,8 +3362,7 @@ async function isSlackSubteamMentionForBot(params) {
3354
3362
  }
3355
3363
  return false;
3356
3364
  }
3357
- //#endregion
3358
- //#region extensions/slack/src/monitor/message-handler/prepare.ts
3365
+ // extensions/slack/src/monitor/message-handler/prepare.ts
3359
3366
  const mentionRegexCache = /* @__PURE__ */ new WeakMap();
3360
3367
  const SLACK_ANY_MENTION_RE = /<@[^>]+>|<!subteam\^[^>]+>/;
3361
3368
  const SLACK_USER_MENTION_RE = /<@([^>|]+)(?:\|[^>]+)?>/g;
@@ -4132,7 +4139,7 @@ async function prepareSlackMessage(params) {
4132
4139
  media: inboundMedia,
4133
4140
  supplemental: {
4134
4141
  thread: {
4135
- starterBody: !directThreadRoutedToDmSession && shouldSeedInitialThreadContext ? threadStarterBody : void 0,
4142
+ starterBody: !directThreadRoutedToDmSession && (isRoomish || shouldSeedInitialThreadContext) ? threadStarterBody : void 0,
4136
4143
  historyBody: supplementalThreadHistoryBody,
4137
4144
  label: directThreadRoutedToDmSession ? void 0 : threadLabel
4138
4145
  },
@@ -4233,5 +4240,4 @@ async function prepareSlackMessage(params) {
4233
4240
  ackReactionPromise
4234
4241
  };
4235
4242
  }
4236
- //#endregion
4237
4243
  export { dispatchPreparedSlackMessage, prepareSlackMessage };
@@ -1,8 +1,8 @@
1
- import { Ht as normalizeSlackSlug, Wt as resolveSlackUserAllowListForTeam, c as buildSlackChannelIdCandidates, l as buildSlackChannelPolicyScope } from "./probe-DANukR3O.mjs";
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
- //#region extensions/slack/src/monitor/channel-config.ts
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
- //#endregion
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 };