@openclaw/slack 2026.8.1-beta.2 → 2026.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-configured-sUohAxZr.js +33 -0
- package/dist/account-inspect-CN2hBsim.js +87 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-CK4AVI2_.js → accounts-Dm_H77gH.js} +12 -11
- package/dist/{accounts.runtime-Cb7QwWBz.js → accounts.runtime-DRuEK6mL.js} +1 -1
- package/dist/{action-runtime-BkGe7ny_.js → action-runtime-044ldvNL.js} +80 -79
- package/dist/action-runtime.runtime-BL3KzX13.js +2 -0
- package/dist/{actions-BTDXwwE3.js → actions-BI7JkfVm.js} +273 -263
- package/dist/api.js +14 -14
- package/dist/{approval-handler.runtime-CJaNzAq2.js → approval-handler.runtime-DYv0UIZS.js} +53 -174
- package/dist/{channel-D_tovcUL.js → channel-1vIJOzPx.js} +134 -160
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-B9MSdoGN.js → channel-type-DlFSKeIZ.js} +3 -7
- package/dist/{channel.setup-Bch9dYmA.js → channel.setup-ofDi3_Pu.js} +34 -49
- package/dist/{config-schema-xto5jFIx.js → config-schema-BVIMyiDN.js} +42 -19
- package/dist/configured-state.js +34 -0
- package/dist/conversation-binding-route-DFVLUdYF.js +115 -0
- package/dist/{directory-config-CNBz8lJa.js → directory-config-DqfQ42OV.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-CFKUtW9E.js → directory-live-BPaNHjmP.js} +2 -2
- package/dist/{group-policy-c4RP9bjc.js → group-policy-BdwszjYn.js} +625 -773
- package/dist/{message-tool-api-BykQB4AU.js → message-tool-api-CJ0kjcg5.js} +23 -5
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-1nF1NtqT.js → monitor-Dq5Cmrvp.js} +3 -3
- package/dist/{outbound-adapter-S81tsswN.js → outbound-adapter-DYaI8ThX.js} +101 -66
- package/dist/{pipeline.runtime-BvYsM5JO.js → pipeline.runtime-Bd22U0ga.js} +494 -474
- package/dist/{policy-TapwbeaT.js → policy-CtQVbde1.js} +2 -1
- package/dist/{probe-HoEg_WxB.js → probe-0usmAb0i.js} +209 -22
- package/dist/{provider-CDNvBXUi.js → provider-CN_8hFv2.js} +296 -178
- package/dist/{relay-source-C9leF11u.js → relay-source-BNGpsdwV.js} +1 -1
- package/dist/{replies-CeOfv82I.js → replies-BSiRQOJ1.js} +48 -27
- package/dist/{resolve-channels-CNPrxaXY.js → resolve-channels-Czheznc8.js} +1 -1
- package/dist/{resolve-users-Dzomuwnr.js → resolve-users-BAOlNimr.js} +1 -1
- package/dist/runtime-api.js +11 -11
- package/dist/{scopes-cYXKkrRD.js → scopes-COSlmhnH.js} +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-Nor0iBwY.js → send-DS9ICrBI.js} +88 -100
- package/dist/send-results-eeOu_HYm.js +23 -0
- package/dist/{send.runtime-BmgNe6S9.js → send.runtime-D_Bb6IuH.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-CbX1-Knh.js → setup-surface-BGnd2pSe.js} +6 -6
- package/dist/{shared-zdT5AMp-.js → shared-D5B-5hBg.js} +35 -9
- package/dist/{slash-dispatch.runtime-Bnr9GR1S.js → slash-dispatch.runtime-CilDmI0c.js} +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/bolt/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/bolt/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/bolt/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/bolt/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/bolt/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/bolt/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/README.md +2 -0
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/package.json +1 -1
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/README.md +2 -0
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/package.json +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/socket-mode/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/socket-mode/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/socket-mode/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/socket-mode/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/socket-mode/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/socket-mode/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/socket-mode/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/socket-mode/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/socket-mode/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/web-api/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/web-api/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/web-api/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +57 -7
- package/package.json +9 -9
- package/dist/account-configured-BwfXBo_F.js +0 -14
- package/dist/account-inspect-Drw2gAiN.js +0 -89
- package/dist/account-reply-mode-DrUXogvO.js +0 -14
- package/dist/action-runtime.runtime-D9I6uc0Q.js +0 -2
- package/dist/actions.runtime-DLFyUkvg.js +0 -2
- package/dist/block-text-YtiNkqmx.js +0 -79
- package/dist/runtime-api-Cj9nxBNv.js +0 -10
- package/node_modules/p-map/index.d.ts +0 -155
- package/node_modules/p-map/index.js +0 -285
- package/node_modules/p-map/license +0 -9
- package/node_modules/p-map/package.json +0 -57
- package/node_modules/p-map/readme.md +0 -190
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
- package/dist/{security-audit-DR097212.js → security-audit-B_yKr7MW.js} +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { n as registerSlackHttpHandler, r as normalizeSlackWebhookPath } from "./registry-bbjH7IHX.js";
|
|
2
|
-
import { a as resolveSlackAccount, d as resolveSlackAppToken, f as resolveSlackBotToken, i as resolveDefaultSlackAccountId, o as resolveSlackAccountAllowFrom, s as resolveSlackAccountDmPolicy, u as formatSlackBotTokenIdentityWarning } from "./accounts-
|
|
2
|
+
import { a as resolveSlackAccount, d as resolveSlackAppToken, f as resolveSlackBotToken, i as resolveDefaultSlackAccountId, o as resolveSlackAccountAllowFrom, s as resolveSlackAccountDmPolicy, u as formatSlackBotTokenIdentityWarning } from "./accounts-Dm_H77gH.js";
|
|
3
3
|
import { a as parseSlackTarget, n as formatSlackTarget } from "./target-parsing-BnMD2ZqZ.js";
|
|
4
|
-
import {
|
|
5
|
-
import { c as
|
|
4
|
+
import { Ct as isSlackApprovalAuthorizedSender, G as isSlackCallbackActionId, J as decodeSlackQuestionAction, K as isSlackQuestionActionId, L as truncateSlackText, M as SLACK_TEXT_LIMIT, Tt as isSlackExecApprovalAuthorizedSender, W as isSlackApprovalActionId, Y as resolveSlackQuestionAction, a as qualifySlackConversationId, et as escapeSlackMrkdwn, lt as isSlackAnyNativeApprovalClientEnabled, nt as decodeSlackApprovalAction, o as qualifySlackRoutePeerId, s as resolveSlackEnterpriseMainDmSessionKey, t as buildSlackChannelIdCandidates, xt as registerSlackInstallationState } from "./group-policy-BdwszjYn.js";
|
|
5
|
+
import { D as resolveSlackWebClientOptions, E as resolveSlackProxyDispatcher, T as resolveSlackLookupClientOptions, _ as createSlackStartupAuthClient, a as slackIngressIdentity, c as normalizeAllowList, d as normalizeSlackSlug, f as resolveSlackAllowListMatch, i as createSlackIngressSubject, l as normalizeAllowListLower, o as formatSlackError, p as resolveSlackUserAllowListForTeam, s as allowListMatches, u as normalizeSlackAllowOwnerEntry, x as getSlackListenerUploadCompletionClient, y as createSlackWebClient } from "./probe-0usmAb0i.js";
|
|
6
6
|
import { n as getSlackRuntime, t as getOptionalSlackRuntime } from "./runtime-JSVZSWAj.js";
|
|
7
|
-
import {
|
|
8
|
-
import { i as setSlackDefaultSendIdentity } from "./send-
|
|
7
|
+
import { C as hasSlackMessageTableBlock, b as saveRemoteMedia, f as readSlackMessages, y as isGovSlackClient } from "./actions-BI7JkfVm.js";
|
|
8
|
+
import { i as setSlackDefaultSendIdentity, p as requireSlackPostMessageTimestamp } from "./send-DS9ICrBI.js";
|
|
9
9
|
import { t as collectSlackCursorPages } from "./cursor-pages-eX7p8Wwt.js";
|
|
10
|
-
import { t as resolveSlackChannelAllowlist } from "./resolve-channels-
|
|
11
|
-
import { t as resolveSlackUserAllowlist } from "./resolve-users-
|
|
12
|
-
import { n as resolveSlackChannelConfig, r as resolveSlackChannelLabel, t as isSlackChannelAllowedByPolicy } from "./policy-
|
|
10
|
+
import { t as resolveSlackChannelAllowlist } from "./resolve-channels-Czheznc8.js";
|
|
11
|
+
import { t as resolveSlackUserAllowlist } from "./resolve-users-BAOlNimr.js";
|
|
12
|
+
import { n as resolveSlackChannelConfig, r as resolveSlackChannelLabel, t as isSlackChannelAllowedByPolicy } from "./policy-CtQVbde1.js";
|
|
13
13
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
14
14
|
import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
15
15
|
import { asNonArrayRecord, asOptionalRecord, isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries, normalizeUniqueTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -25,13 +25,14 @@ import { withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
|
25
25
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
26
26
|
import { WebAPIHTTPError, WebAPIPlatformError, WebAPIRateLimitedError, WebAPIRequestError, WebClient } from "@slack/web-api";
|
|
27
27
|
import { addAllowlistUserEntriesFromConfigEntry, buildAllowlistResolutionSummary, formatAllowlistMatchMeta, mergeAllowlist, patchAllowlistUsersInConfigEntries, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
|
|
28
|
+
import { buildPluginBindingResolvedText, parsePluginBindingApprovalCustomId, resolveConversationLabel as resolveConversationLabel$1, resolvePluginConversationBindingApproval, resolveRuntimeConversationBindingRoute, upsertChannelPairingRequest } from "openclaw/plugin-sdk/conversation-runtime";
|
|
29
|
+
import { createChannelIngressResolver, readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
28
30
|
import { collectErrorGraphCandidates, extractErrorCode, formatErrorMessage, isApprovalNotFoundError, readErrorName, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
29
|
-
import { asDateTimestampMs, parseFiniteNumber, parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
30
31
|
import { resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
|
|
31
32
|
import { buildChannelMetadata } from "openclaw/plugin-sdk/security-runtime";
|
|
32
33
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
34
|
+
import { classifyTransientNetworkErrorCode } from "openclaw/plugin-sdk/retry-runtime";
|
|
33
35
|
import { createDedupeCache } from "openclaw/plugin-sdk/dedupe-runtime";
|
|
34
|
-
import { buildPluginBindingResolvedText, parsePluginBindingApprovalCustomId, resolveConversationLabel as resolveConversationLabel$1, resolvePluginConversationBindingApproval, resolveRuntimeConversationBindingRoute, upsertChannelPairingRequest } from "openclaw/plugin-sdk/conversation-runtime";
|
|
35
36
|
import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled } from "openclaw/plugin-sdk/native-command-config-runtime";
|
|
36
37
|
import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
|
|
37
38
|
import { DEFAULT_GROUP_HISTORY_LIMIT } from "openclaw/plugin-sdk/reply-history";
|
|
@@ -44,12 +45,12 @@ import { resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy as res
|
|
|
44
45
|
import { resolveChannelConfigWrites } from "openclaw/plugin-sdk/channel-config-writes";
|
|
45
46
|
import { mutateConfigFile, readConfigFileSnapshotForWrite } from "openclaw/plugin-sdk/config-mutation";
|
|
46
47
|
import { enqueueRoutedSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
|
|
47
|
-
import {
|
|
48
|
-
import { classifyTransientNetworkErrorCode } from "openclaw/plugin-sdk/retry-runtime";
|
|
48
|
+
import { asDateTimestampMs, parseFiniteNumber, parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
49
49
|
import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
|
|
50
50
|
import { formatCommandArgMenuTitle, resolveCommandAuthorization, resolveEffectiveAgentRuntime, resolveNativeCommandSessionTargets, resolveStoredModelOverride } from "openclaw/plugin-sdk/command-auth-native";
|
|
51
51
|
import { requestHeartbeat } from "openclaw/plugin-sdk/heartbeat-runtime";
|
|
52
52
|
import { createChannelInteractiveDispatcher } from "openclaw/plugin-sdk/plugin-runtime";
|
|
53
|
+
import { reportChannelRoomJoin } from "openclaw/plugin-sdk/channel-join-intro-runtime";
|
|
53
54
|
import { createChannelInboundDebouncer, shouldDebounceTextInbound } from "openclaw/plugin-sdk/channel-inbound";
|
|
54
55
|
import { createChannelReplayGuard, runClaimableDedupeClaimLoop } from "openclaw/plugin-sdk/persistent-dedupe";
|
|
55
56
|
import { channelBlockedPatch, channelReadyPatch } from "openclaw/plugin-sdk/gateway-runtime";
|
|
@@ -376,20 +377,6 @@ async function updateSlackSuggestedPrompts(params) {
|
|
|
376
377
|
}
|
|
377
378
|
}
|
|
378
379
|
//#endregion
|
|
379
|
-
//#region extensions/slack/src/monitor/workspace-routing.ts
|
|
380
|
-
function resolveSlackEnterpriseMainDmSessionKey(params) {
|
|
381
|
-
const accountId = encodeURIComponent(params.accountId).toLowerCase();
|
|
382
|
-
const teamId = encodeURIComponent(params.eventScope.teamId).toLowerCase();
|
|
383
|
-
return `${params.baseSessionKey}:account:${accountId}:team:${teamId}`;
|
|
384
|
-
}
|
|
385
|
-
function qualifySlackRoutePeerId(params) {
|
|
386
|
-
if (!params.eventScope) return params.id;
|
|
387
|
-
return `team:${encodeURIComponent(params.eventScope.teamId)}:${params.kind}:${encodeURIComponent(params.id)}`;
|
|
388
|
-
}
|
|
389
|
-
function qualifySlackConversationId(conversationId, eventScope) {
|
|
390
|
-
return eventScope ? `team:${encodeURIComponent(eventScope.teamId)}:${conversationId}` : conversationId;
|
|
391
|
-
}
|
|
392
|
-
//#endregion
|
|
393
380
|
//#region extensions/slack/src/monitor/system-event-session.ts
|
|
394
381
|
function createSlackSystemEventRouteResolver(params) {
|
|
395
382
|
return (event) => {
|
|
@@ -489,6 +476,12 @@ function resolveSlackSystemEventRoute(params) {
|
|
|
489
476
|
//#region extensions/slack/src/monitor/context.ts
|
|
490
477
|
const SLACK_CHANNEL_CACHE_MAX_ENTRIES = 1024;
|
|
491
478
|
const SLACK_USER_CACHE_MAX_ENTRIES = 2048;
|
|
479
|
+
const SLACK_AVATAR_CACHE_MAX_ENTRIES = 128;
|
|
480
|
+
const SLACK_AVATAR_MAX_BYTES = 256 * 1024;
|
|
481
|
+
const SLACK_AVATAR_SSRF_POLICY = {
|
|
482
|
+
allowedHostnames: ["avatars.slack-edge.com", "*.slack-edge.com"],
|
|
483
|
+
hostnameAllowlist: ["avatars.slack-edge.com", "*.slack-edge.com"]
|
|
484
|
+
};
|
|
492
485
|
const SLACK_CHANNEL_DENIAL_WARNING_TTL_MS = 5 * 6e4;
|
|
493
486
|
const SLACK_CHANNEL_DENIAL_WARNING_MAX_ENTRIES = 1024;
|
|
494
487
|
function createSlackMonitorContext(params) {
|
|
@@ -496,6 +489,8 @@ function createSlackMonitorContext(params) {
|
|
|
496
489
|
const logger = getChildLogger({ module: "slack-auto-reply" });
|
|
497
490
|
const channelCache = /* @__PURE__ */ new Map();
|
|
498
491
|
const userCache = /* @__PURE__ */ new Map();
|
|
492
|
+
const avatarCache = /* @__PURE__ */ new Map();
|
|
493
|
+
const pendingAvatars = /* @__PURE__ */ new Set();
|
|
499
494
|
const channelDenialWarnings = createDedupeCache({
|
|
500
495
|
ttlMs: SLACK_CHANNEL_DENIAL_WARNING_TTL_MS,
|
|
501
496
|
maxSize: SLACK_CHANNEL_DENIAL_WARNING_MAX_ENTRIES
|
|
@@ -581,13 +576,41 @@ function createSlackMonitorContext(params) {
|
|
|
581
576
|
user: userId
|
|
582
577
|
});
|
|
583
578
|
const profile = info.user?.profile;
|
|
584
|
-
const entry = {
|
|
579
|
+
const entry = {
|
|
580
|
+
name: profile?.display_name || profile?.real_name || info.user?.name || void 0,
|
|
581
|
+
imageUrl: normalizeOptionalString(profile?.image_192) ?? normalizeOptionalString(profile?.image_512) ?? normalizeOptionalString(profile?.image_72)
|
|
582
|
+
};
|
|
585
583
|
writeLruMapEntry(userCache, cacheKey, entry, SLACK_USER_CACHE_MAX_ENTRIES);
|
|
586
584
|
return entry;
|
|
587
585
|
} catch (error) {
|
|
588
586
|
return { error };
|
|
589
587
|
}
|
|
590
588
|
};
|
|
589
|
+
const resolveUserAvatar = (userId, eventScope) => {
|
|
590
|
+
if (isGovSlackClient(eventScope?.client ?? params.app.client)) return;
|
|
591
|
+
const imageUrl = readLruMapEntry(userCache, scopedKey(userId, eventScope))?.imageUrl;
|
|
592
|
+
if (!imageUrl) return;
|
|
593
|
+
const cacheKey = scopedKey(`${userId}\0${imageUrl}`, eventScope);
|
|
594
|
+
const cached = readLruMapEntry(avatarCache, cacheKey);
|
|
595
|
+
if (cached) return cached;
|
|
596
|
+
if (pendingAvatars.has(cacheKey) || pendingAvatars.size >= SLACK_AVATAR_CACHE_MAX_ENTRIES) return;
|
|
597
|
+
pendingAvatars.add(cacheKey);
|
|
598
|
+
saveRemoteMedia({
|
|
599
|
+
url: imageUrl,
|
|
600
|
+
filePathHint: "conversation-avatar.png",
|
|
601
|
+
maxBytes: SLACK_AVATAR_MAX_BYTES,
|
|
602
|
+
ssrfPolicy: SLACK_AVATAR_SSRF_POLICY
|
|
603
|
+
}).then((media) => {
|
|
604
|
+
writeLruMapEntry(avatarCache, cacheKey, media.path, SLACK_AVATAR_CACHE_MAX_ENTRIES);
|
|
605
|
+
}).catch((error) => {
|
|
606
|
+
logger.debug({
|
|
607
|
+
error: formatSlackError(error),
|
|
608
|
+
userId
|
|
609
|
+
}, "Slack conversation avatar download failed");
|
|
610
|
+
}).finally(() => {
|
|
611
|
+
pendingAvatars.delete(cacheKey);
|
|
612
|
+
});
|
|
613
|
+
};
|
|
591
614
|
const setSlackThreadStatus = async (p) => {
|
|
592
615
|
if (!p.threadTs) return;
|
|
593
616
|
try {
|
|
@@ -683,6 +706,7 @@ function createSlackMonitorContext(params) {
|
|
|
683
706
|
}
|
|
684
707
|
return false;
|
|
685
708
|
};
|
|
709
|
+
const channelRuntime = params.channelRuntime;
|
|
686
710
|
const ctx = {
|
|
687
711
|
cfg: params.cfg,
|
|
688
712
|
accountId: params.accountId,
|
|
@@ -690,7 +714,8 @@ function createSlackMonitorContext(params) {
|
|
|
690
714
|
app: params.app,
|
|
691
715
|
runtime: params.runtime,
|
|
692
716
|
channelRuntime: params.channelRuntime,
|
|
693
|
-
buildContext:
|
|
717
|
+
buildContext: channelRuntime?.inbound.buildContext,
|
|
718
|
+
dispatchReplyFromConfig: channelRuntime?.reply?.dispatchReplyFromConfig,
|
|
694
719
|
botUserId: params.botUserId,
|
|
695
720
|
botId: params.botId,
|
|
696
721
|
identityHealth: params.identityHealth,
|
|
@@ -734,6 +759,7 @@ function createSlackMonitorContext(params) {
|
|
|
734
759
|
rememberSlackChannelType,
|
|
735
760
|
recallSlackChannelType,
|
|
736
761
|
resolveUserName,
|
|
762
|
+
resolveUserAvatar,
|
|
737
763
|
setSlackThreadStatus,
|
|
738
764
|
getSlackAssistantThreadContext: assistantThreadContextStore.get,
|
|
739
765
|
saveSlackAssistantThreadContext: assistantThreadContextStore.save,
|
|
@@ -1255,6 +1281,8 @@ function resolveSlackIngressTurnLifecycle(context) {
|
|
|
1255
1281
|
function createSlackDurableIngress(options) {
|
|
1256
1282
|
let app;
|
|
1257
1283
|
let relayDispatch;
|
|
1284
|
+
const activeSessionTurns = /* @__PURE__ */ new Map();
|
|
1285
|
+
const activeChannelTurns = /* @__PURE__ */ new Map();
|
|
1258
1286
|
const monitor = createChannelIngressMonitor({
|
|
1259
1287
|
queue: options.queue ?? (() => getSlackRuntime().state.openChannelIngressQueue({ accountId: options.accountId })),
|
|
1260
1288
|
inspect: inspectSlackIngress,
|
|
@@ -1291,26 +1319,110 @@ function createSlackDurableIngress(options) {
|
|
|
1291
1319
|
onDurableAdmission: async (raw) => {
|
|
1292
1320
|
if (raw.kind === "events-api") await raw.afterDurableAdmission?.();
|
|
1293
1321
|
},
|
|
1294
|
-
deliver: async (raw, lifecycle) => {
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1322
|
+
deliver: async (raw, lifecycle, claim) => {
|
|
1323
|
+
const laneKey = claim.laneKey ?? inspectSlackIngress(raw).laneKey;
|
|
1324
|
+
let releaseSession;
|
|
1325
|
+
let releaseChannel;
|
|
1326
|
+
let routedSession;
|
|
1327
|
+
let adoptOnCompletion = false;
|
|
1328
|
+
const settleSession = () => {
|
|
1329
|
+
adoptOnCompletion = false;
|
|
1330
|
+
releaseSession?.();
|
|
1331
|
+
};
|
|
1332
|
+
const settleTurn = () => {
|
|
1333
|
+
settleSession();
|
|
1334
|
+
releaseChannel?.();
|
|
1335
|
+
lifecycle.abortSignal.removeEventListener("abort", settleTurn);
|
|
1336
|
+
};
|
|
1337
|
+
const routedLifecycle = {
|
|
1338
|
+
...lifecycle,
|
|
1339
|
+
onSessionRouted: async (sessionKey) => {
|
|
1340
|
+
if (routedSession !== void 0) {
|
|
1341
|
+
if (routedSession !== sessionKey) throw new Error("Slack ingress session ownership changed after routing.");
|
|
1342
|
+
return;
|
|
1343
|
+
}
|
|
1344
|
+
lifecycle.abortSignal.throwIfAborted();
|
|
1345
|
+
routedSession = sessionKey;
|
|
1346
|
+
adoptOnCompletion = true;
|
|
1347
|
+
const previousTurn = activeSessionTurns.get(sessionKey);
|
|
1348
|
+
const releasedCurrentTurn = createDeferred();
|
|
1349
|
+
const currentTurn = previousTurn ? previousTurn.then(() => releasedCurrentTurn.promise) : releasedCurrentTurn.promise;
|
|
1350
|
+
activeSessionTurns.set(sessionKey, currentTurn);
|
|
1351
|
+
const channelTurn = createDeferred();
|
|
1352
|
+
const channelTurns = activeChannelTurns.get(laneKey) ?? /* @__PURE__ */ new Set();
|
|
1353
|
+
channelTurns.add(channelTurn.promise);
|
|
1354
|
+
activeChannelTurns.set(laneKey, channelTurns);
|
|
1355
|
+
currentTurn.then(() => {
|
|
1356
|
+
if (activeSessionTurns.get(sessionKey) === currentTurn) activeSessionTurns.delete(sessionKey);
|
|
1357
|
+
});
|
|
1358
|
+
channelTurn.promise.then(() => {
|
|
1359
|
+
channelTurns.delete(channelTurn.promise);
|
|
1360
|
+
if (channelTurns.size === 0 && activeChannelTurns.get(laneKey) === channelTurns) activeChannelTurns.delete(laneKey);
|
|
1361
|
+
});
|
|
1362
|
+
releaseSession = () => releasedCurrentTurn.resolve();
|
|
1363
|
+
releaseChannel = () => channelTurn.resolve();
|
|
1364
|
+
lifecycle.abortSignal.addEventListener("abort", settleTurn, { once: true });
|
|
1365
|
+
lifecycle.onDeferred();
|
|
1366
|
+
if (previousTurn) lifecycle.onAdoptionFinalizing();
|
|
1367
|
+
monitor.requestDrain();
|
|
1368
|
+
await previousTurn;
|
|
1369
|
+
lifecycle.abortSignal.throwIfAborted();
|
|
1370
|
+
},
|
|
1371
|
+
onAdopted: async () => {
|
|
1372
|
+
try {
|
|
1373
|
+
await lifecycle.onAdopted();
|
|
1374
|
+
} finally {
|
|
1375
|
+
settleTurn();
|
|
1376
|
+
}
|
|
1377
|
+
},
|
|
1378
|
+
onDeferred: () => {
|
|
1379
|
+
lifecycle.onDeferred();
|
|
1380
|
+
settleSession();
|
|
1381
|
+
monitor.requestDrain();
|
|
1382
|
+
},
|
|
1383
|
+
onAbandoned: async () => {
|
|
1384
|
+
try {
|
|
1385
|
+
await lifecycle.onAbandoned();
|
|
1386
|
+
} finally {
|
|
1387
|
+
settleTurn();
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
};
|
|
1391
|
+
try {
|
|
1392
|
+
if (asOptionalRecord(raw.kind === "events-api" ? asOptionalRecord(raw.body)?.event : void 0)?.type === "channel_id_changed") {
|
|
1393
|
+
const channelTurns = activeChannelTurns.get(laneKey);
|
|
1394
|
+
if (channelTurns && channelTurns.size > 0) {
|
|
1395
|
+
adoptOnCompletion = true;
|
|
1396
|
+
lifecycle.onAdoptionFinalizing();
|
|
1397
|
+
await Promise.all(channelTurns);
|
|
1398
|
+
lifecycle.abortSignal.throwIfAborted();
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
if (raw.kind === "relay") {
|
|
1402
|
+
if (!relayDispatch) throw new Error("Slack relay ingress dispatcher is not attached.");
|
|
1403
|
+
await relayDispatch(raw.message, routedLifecycle);
|
|
1404
|
+
} else {
|
|
1405
|
+
if (!app) throw new Error("Slack ingress receiver is not attached to a Bolt app.");
|
|
1406
|
+
await app.processEvent({
|
|
1407
|
+
body: raw.body,
|
|
1408
|
+
ack: async () => {},
|
|
1409
|
+
...raw.retryNum === void 0 ? {} : { retryNum: raw.retryNum },
|
|
1410
|
+
...raw.retryReason === void 0 ? {} : { retryReason: raw.retryReason },
|
|
1411
|
+
customProperties: { [SLACK_INGRESS_LIFECYCLE_CONTEXT_KEY]: routedLifecycle }
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
if (adoptOnCompletion) await routedLifecycle.onAdopted();
|
|
1415
|
+
} catch (error) {
|
|
1416
|
+
settleTurn();
|
|
1417
|
+
throw error;
|
|
1299
1418
|
}
|
|
1300
|
-
if (!app) throw new Error("Slack ingress receiver is not attached to a Bolt app.");
|
|
1301
|
-
await app.processEvent({
|
|
1302
|
-
body: raw.body,
|
|
1303
|
-
ack: async () => {},
|
|
1304
|
-
...raw.retryNum === void 0 ? {} : { retryNum: raw.retryNum },
|
|
1305
|
-
...raw.retryReason === void 0 ? {} : { retryReason: raw.retryReason },
|
|
1306
|
-
customProperties: { [SLACK_INGRESS_LIFECYCLE_CONTEXT_KEY]: lifecycle }
|
|
1307
|
-
});
|
|
1308
1419
|
},
|
|
1309
1420
|
pollIntervalMs: options.pollIntervalMs ?? SLACK_INGRESS_POLL_INTERVAL_MS,
|
|
1310
1421
|
retention: "standard",
|
|
1311
1422
|
appendRetryDelaysMs: [0],
|
|
1312
1423
|
drain: {
|
|
1313
1424
|
resolveNonRetryableFailure: resolveSlackIngressNonRetryableFailure,
|
|
1425
|
+
deferredLaneOccupancy: "release",
|
|
1314
1426
|
deriveLaneKey: (record) => record.payload.kind === "relay" ? resolveSlackIngressLane({ event: record.payload.message }, record.id) : resolveSlackIngressLane(record.payload.body, record.id),
|
|
1315
1427
|
...options.adoptionStallTimeoutMs === void 0 ? {} : { adoptionStallTimeoutMs: options.adoptionStallTimeoutMs },
|
|
1316
1428
|
...options.onLog ? { onLog: options.onLog } : {}
|
|
@@ -1475,88 +1587,7 @@ const slackChannelMembersCache = /* @__PURE__ */ new WeakMap();
|
|
|
1475
1587
|
const DEFAULT_CHANNEL_MEMBERS_CACHE_TTL_MS = 6e4;
|
|
1476
1588
|
const CHANNEL_MEMBERS_CACHE_MAX = 512;
|
|
1477
1589
|
const SLACK_CHANNEL_ID = "slack";
|
|
1478
|
-
const SLACK_USER_NAME_KIND = "plugin:slack-user-name";
|
|
1479
|
-
const SLACK_WORKSPACE_USER_ID_KIND = "plugin:slack-workspace-user-id";
|
|
1480
1590
|
var SlackSystemEventAuthRetryError = class extends Error {};
|
|
1481
|
-
function normalizeSlackUserId(raw) {
|
|
1482
|
-
const value = (raw ?? "").trim().toLowerCase();
|
|
1483
|
-
if (!value) return "";
|
|
1484
|
-
const mention = value.match(/^<@([a-z0-9_]+)>$/i);
|
|
1485
|
-
if (mention?.[1]) return mention[1];
|
|
1486
|
-
return value.replace(/^(slack:|user:)/, "");
|
|
1487
|
-
}
|
|
1488
|
-
function isSlackStableUserId(value) {
|
|
1489
|
-
return /^[ubw][a-z0-9_]+$/i.test(value);
|
|
1490
|
-
}
|
|
1491
|
-
function normalizeSlackWorkspaceUserEntry(entry) {
|
|
1492
|
-
const normalized = entry.trim().toLowerCase();
|
|
1493
|
-
if (!normalized) return null;
|
|
1494
|
-
try {
|
|
1495
|
-
const target = parseSlackTarget(normalized);
|
|
1496
|
-
if (target?.kind === "user" && target.teamId) return target.normalized;
|
|
1497
|
-
} catch {
|
|
1498
|
-
return null;
|
|
1499
|
-
}
|
|
1500
|
-
return null;
|
|
1501
|
-
}
|
|
1502
|
-
function normalizeSlackBareUserEntry(entry) {
|
|
1503
|
-
const normalized = entry.trim().toLowerCase();
|
|
1504
|
-
if (!normalized || normalizeSlackWorkspaceUserEntry(normalized)) return null;
|
|
1505
|
-
const userId = normalizeSlackUserId(normalized);
|
|
1506
|
-
return isSlackStableUserId(userId) ? userId : null;
|
|
1507
|
-
}
|
|
1508
|
-
function normalizeSlackStableEntry(entry) {
|
|
1509
|
-
return normalizeSlackBareUserEntry(entry) ?? normalizeSlackWorkspaceUserEntry(entry);
|
|
1510
|
-
}
|
|
1511
|
-
function normalizeSlackNameEntry(entry) {
|
|
1512
|
-
const normalized = entry.trim().toLowerCase();
|
|
1513
|
-
if (!normalized || normalizeSlackStableEntry(normalized)) return null;
|
|
1514
|
-
return normalized.replace(/^slack:/, "") || null;
|
|
1515
|
-
}
|
|
1516
|
-
function normalizeSlackNameSubject(value) {
|
|
1517
|
-
return value.trim().toLowerCase() || null;
|
|
1518
|
-
}
|
|
1519
|
-
function normalizeSlackNameSlugEntry(entry) {
|
|
1520
|
-
const name = normalizeSlackNameEntry(entry);
|
|
1521
|
-
if (!name) return null;
|
|
1522
|
-
const slug = normalizeSlackSlug(name);
|
|
1523
|
-
return slug && slug !== name ? slug : null;
|
|
1524
|
-
}
|
|
1525
|
-
const slackIngressIdentity = defineStableChannelIngressIdentity({
|
|
1526
|
-
key: "senderId",
|
|
1527
|
-
kind: "stable-id",
|
|
1528
|
-
normalizeEntry: normalizeSlackBareUserEntry,
|
|
1529
|
-
normalizeSubject: normalizeSlackUserId,
|
|
1530
|
-
sensitivity: "pii",
|
|
1531
|
-
aliases: [{
|
|
1532
|
-
key: "workspaceSenderId",
|
|
1533
|
-
kind: SLACK_WORKSPACE_USER_ID_KIND,
|
|
1534
|
-
normalizeEntry: normalizeSlackWorkspaceUserEntry,
|
|
1535
|
-
normalizeSubject: normalizeSlackWorkspaceUserEntry,
|
|
1536
|
-
sensitivity: "pii"
|
|
1537
|
-
}, ...[["senderName", normalizeSlackNameEntry], ["senderNameSlug", normalizeSlackNameSlugEntry]].map(([key, normalizeEntry]) => ({
|
|
1538
|
-
key,
|
|
1539
|
-
kind: SLACK_USER_NAME_KIND,
|
|
1540
|
-
normalizeEntry,
|
|
1541
|
-
normalizeSubject: normalizeSlackNameSubject,
|
|
1542
|
-
dangerous: true,
|
|
1543
|
-
sensitivity: "pii"
|
|
1544
|
-
}))]
|
|
1545
|
-
});
|
|
1546
|
-
function createSlackIngressSubject(params) {
|
|
1547
|
-
const senderId = normalizeSlackUserId(params.senderId);
|
|
1548
|
-
const teamId = normalizeOptionalLowercaseString(params.teamId);
|
|
1549
|
-
const senderName = params.senderName?.trim().toLowerCase();
|
|
1550
|
-
const senderNameSlug = senderName ? normalizeSlackSlug(senderName) : void 0;
|
|
1551
|
-
return {
|
|
1552
|
-
stableId: senderId,
|
|
1553
|
-
aliases: {
|
|
1554
|
-
workspaceSenderId: teamId && senderId ? `team:${teamId}:user:${senderId}` : void 0,
|
|
1555
|
-
senderName,
|
|
1556
|
-
senderNameSlug
|
|
1557
|
-
}
|
|
1558
|
-
};
|
|
1559
|
-
}
|
|
1560
1591
|
function createSlackIngressResolver(ctx) {
|
|
1561
1592
|
return createChannelIngressResolver({
|
|
1562
1593
|
channelId: SLACK_CHANNEL_ID,
|
|
@@ -1798,7 +1829,7 @@ async function decideSlackSystemIngress(params) {
|
|
|
1798
1829
|
} : void 0
|
|
1799
1830
|
};
|
|
1800
1831
|
const result = await resolver.message(input);
|
|
1801
|
-
if (result.ingress.decision !== "allow" && params.retryNameLookup && result.state.allowlists[isDirectMessage ? "dm" : "group"].normalizedEntries.some((entry) => entry.kind ===
|
|
1832
|
+
if (result.ingress.decision !== "allow" && params.retryNameLookup && result.state.allowlists[isDirectMessage ? "dm" : "group"].normalizedEntries.some((entry) => entry.kind === "plugin:slack-user-name")) {
|
|
1802
1833
|
const lookup = await params.ctx.resolveUserName(params.senderId, params.eventScope);
|
|
1803
1834
|
if (lookup.error && isTransientSlackThreadLookupError(lookup.error)) throw new SlackSystemEventAuthRetryError(formatErrorMessage(lookup.error));
|
|
1804
1835
|
if (lookup.name) return (await resolver.message({
|
|
@@ -1992,6 +2023,7 @@ async function authorizeAndResolveSlackSystemEventContext(params) {
|
|
|
1992
2023
|
channelId,
|
|
1993
2024
|
channelType: auth.channelType,
|
|
1994
2025
|
senderId,
|
|
2026
|
+
threadTs: auth.channelType === "im" ? void 0 : params.threadTs,
|
|
1995
2027
|
eventScope: params.eventScope
|
|
1996
2028
|
})
|
|
1997
2029
|
};
|
|
@@ -2421,8 +2453,8 @@ function removeSlackApprovalControls(blocks) {
|
|
|
2421
2453
|
}
|
|
2422
2454
|
function buildSlackApprovalTerminalBlocks(params) {
|
|
2423
2455
|
const blocks = removeSlackApprovalControls(params.blocks ?? []).filter((block) => {
|
|
2424
|
-
const
|
|
2425
|
-
return !(block.type === "section" &&
|
|
2456
|
+
const blockId = block.block_id;
|
|
2457
|
+
return !(block.type === "section" && blockId === "openclaw_approval_header");
|
|
2426
2458
|
});
|
|
2427
2459
|
return [{
|
|
2428
2460
|
type: "section",
|
|
@@ -3539,6 +3571,55 @@ function registerSlackMemberEvents(params) {
|
|
|
3539
3571
|
const channelId = payload.channel;
|
|
3540
3572
|
const channelInfo = channelId ? await ctx.resolveChannelName(channelId, eventScope) : {};
|
|
3541
3573
|
const channelType = payload.channel_type ?? channelInfo?.type;
|
|
3574
|
+
if (paramsLocal.verb === "joined" && payload.user === ctx.botUserId && channelId) {
|
|
3575
|
+
const roomType = normalizeSlackChannelType(channelType, channelId);
|
|
3576
|
+
if (roomType === "channel" || roomType === "group") {
|
|
3577
|
+
const roomAllowed = ctx.isChannelAllowed({
|
|
3578
|
+
teamId: eventScope?.teamId ?? ctx.teamId,
|
|
3579
|
+
channelId,
|
|
3580
|
+
channelName: channelInfo.name,
|
|
3581
|
+
channelType: roomType
|
|
3582
|
+
});
|
|
3583
|
+
const inviterLabel = roomAllowed && payload.inviter ? (await ctx.resolveUserName(payload.inviter, eventScope)).name ?? payload.inviter : void 0;
|
|
3584
|
+
await reportChannelRoomJoin({
|
|
3585
|
+
cfg: ctx.cfg,
|
|
3586
|
+
channel: "slack",
|
|
3587
|
+
accountId: ctx.accountId,
|
|
3588
|
+
conversationId: channelId,
|
|
3589
|
+
deliverTo: `channel:${channelId}`,
|
|
3590
|
+
route: ctx.resolveSlackSystemEventRoute({
|
|
3591
|
+
channelId,
|
|
3592
|
+
channelType: roomType,
|
|
3593
|
+
eventScope
|
|
3594
|
+
}),
|
|
3595
|
+
inviterLabel,
|
|
3596
|
+
roomAllowed,
|
|
3597
|
+
resolveRoomContext: async ({ messageLimit }) => {
|
|
3598
|
+
const purpose = [channelInfo.purpose, channelInfo.topic].filter((value) => Boolean(value?.trim())).join("\n");
|
|
3599
|
+
const roomContext = {
|
|
3600
|
+
title: channelInfo.name ? `#${channelInfo.name}` : void 0,
|
|
3601
|
+
purpose: purpose || void 0
|
|
3602
|
+
};
|
|
3603
|
+
try {
|
|
3604
|
+
const { messages } = await readSlackMessages(channelId, {
|
|
3605
|
+
limit: messageLimit,
|
|
3606
|
+
client: eventScope?.client ?? ctx.app.client
|
|
3607
|
+
});
|
|
3608
|
+
return {
|
|
3609
|
+
...roomContext,
|
|
3610
|
+
recentMessages: messages.toReversed().flatMap(({ user, text }) => text?.trim() ? [{
|
|
3611
|
+
sender: user,
|
|
3612
|
+
text
|
|
3613
|
+
}] : [])
|
|
3614
|
+
};
|
|
3615
|
+
} catch {
|
|
3616
|
+
return roomContext;
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3619
|
+
});
|
|
3620
|
+
return;
|
|
3621
|
+
}
|
|
3622
|
+
}
|
|
3542
3623
|
const ingressContext = await authorizeAndResolveSlackSystemEventContext({
|
|
3543
3624
|
ctx,
|
|
3544
3625
|
senderId: payload.user,
|
|
@@ -3630,10 +3711,57 @@ function noteSlackDraftConversationMessage(conversation) {
|
|
|
3630
3711
|
}
|
|
3631
3712
|
}
|
|
3632
3713
|
//#endregion
|
|
3714
|
+
//#region extensions/slack/src/threading.ts
|
|
3715
|
+
function resolveSlackThreadContext(params) {
|
|
3716
|
+
const incomingThreadTs = params.message.thread_ts;
|
|
3717
|
+
const eventTs = params.message.event_ts;
|
|
3718
|
+
const messageTs = params.message.ts ?? eventTs;
|
|
3719
|
+
const hasThreadTs = typeof incomingThreadTs === "string" && incomingThreadTs.length > 0;
|
|
3720
|
+
const isThreadReply = hasThreadTs && (incomingThreadTs !== messageTs || Boolean(params.message.parent_user_id));
|
|
3721
|
+
const replyToId = isThreadReply ? incomingThreadTs : void 0;
|
|
3722
|
+
const isAssistantDmThreadRoot = hasThreadTs && !isThreadReply && params.isDirectMessage === true;
|
|
3723
|
+
return {
|
|
3724
|
+
incomingThreadTs,
|
|
3725
|
+
messageTs,
|
|
3726
|
+
isThreadReply,
|
|
3727
|
+
replyToId,
|
|
3728
|
+
messageThreadId: isThreadReply || isAssistantDmThreadRoot ? incomingThreadTs : params.replyToMode === "all" ? messageTs : void 0
|
|
3729
|
+
};
|
|
3730
|
+
}
|
|
3731
|
+
/**
|
|
3732
|
+
* Resolves Slack thread targeting for replies and status indicators.
|
|
3733
|
+
*
|
|
3734
|
+
* @returns replyThreadTs - Thread timestamp for reply messages
|
|
3735
|
+
* @returns statusThreadTs - Thread timestamp for status indicators (typing, etc.)
|
|
3736
|
+
* @returns isThreadReply - true if this is a genuine user reply in a thread,
|
|
3737
|
+
* false if thread_ts comes from a bot status message (e.g. typing indicator)
|
|
3738
|
+
*/
|
|
3739
|
+
function resolveSlackThreadTargets(params) {
|
|
3740
|
+
const { incomingThreadTs, messageTs, isThreadReply } = resolveSlackThreadContext(params);
|
|
3741
|
+
const replyThreadTs = isThreadReply ? incomingThreadTs : params.replyToMode === "all" ? messageTs : void 0;
|
|
3742
|
+
return {
|
|
3743
|
+
replyThreadTs,
|
|
3744
|
+
statusThreadTs: replyThreadTs,
|
|
3745
|
+
isThreadReply
|
|
3746
|
+
};
|
|
3747
|
+
}
|
|
3748
|
+
//#endregion
|
|
3633
3749
|
//#region extensions/slack/src/monitor/events/message-subtype-handlers.ts
|
|
3750
|
+
function resolveNestedThreadTs(event) {
|
|
3751
|
+
const changed = event;
|
|
3752
|
+
const message = changed.message?.thread_ts ? changed.message : changed.previous_message;
|
|
3753
|
+
if (!message) return;
|
|
3754
|
+
return resolveSlackThreadContext({
|
|
3755
|
+
message: {
|
|
3756
|
+
type: "message",
|
|
3757
|
+
channel: event.channel,
|
|
3758
|
+
...message
|
|
3759
|
+
},
|
|
3760
|
+
replyToMode: "off"
|
|
3761
|
+
}).replyToId;
|
|
3762
|
+
}
|
|
3634
3763
|
const SUBTYPE_HANDLER_REGISTRY = {
|
|
3635
3764
|
message_changed: {
|
|
3636
|
-
subtype: "message_changed",
|
|
3637
3765
|
eventKind: "message_changed",
|
|
3638
3766
|
describe: (channelLabel) => `Slack message edited in ${channelLabel}.`,
|
|
3639
3767
|
contextKey: (event) => {
|
|
@@ -3644,11 +3772,9 @@ const SUBTYPE_HANDLER_REGISTRY = {
|
|
|
3644
3772
|
const changed = event;
|
|
3645
3773
|
return changed.message?.user ?? changed.previous_message?.user ?? changed.message?.bot_id ?? changed.previous_message?.bot_id;
|
|
3646
3774
|
},
|
|
3647
|
-
|
|
3648
|
-
resolveChannelType: () => void 0
|
|
3775
|
+
resolveThreadTs: resolveNestedThreadTs
|
|
3649
3776
|
},
|
|
3650
3777
|
message_deleted: {
|
|
3651
|
-
subtype: "message_deleted",
|
|
3652
3778
|
eventKind: "message_deleted",
|
|
3653
3779
|
describe: (channelLabel) => `Slack message deleted in ${channelLabel}.`,
|
|
3654
3780
|
contextKey: (event) => {
|
|
@@ -3659,8 +3785,7 @@ const SUBTYPE_HANDLER_REGISTRY = {
|
|
|
3659
3785
|
const deleted = event;
|
|
3660
3786
|
return deleted.previous_message?.user ?? deleted.previous_message?.bot_id;
|
|
3661
3787
|
},
|
|
3662
|
-
|
|
3663
|
-
resolveChannelType: () => void 0
|
|
3788
|
+
resolveThreadTs: resolveNestedThreadTs
|
|
3664
3789
|
}
|
|
3665
3790
|
};
|
|
3666
3791
|
function resolveSlackMessageSubtypeHandler(event) {
|
|
@@ -3783,14 +3908,6 @@ function registerSlackMessageEvents(params) {
|
|
|
3783
3908
|
if (ctx.shouldDropMismatchedSlackEvent(body)) return;
|
|
3784
3909
|
const message = event;
|
|
3785
3910
|
ctx.rememberSlackChannelType(message.channel, message.channel_type, eventScope);
|
|
3786
|
-
if (eventScope && isBotAuthoredEnterpriseEvent(message)) {
|
|
3787
|
-
logVerbose("slack: drop enterprise bot-authored message");
|
|
3788
|
-
return;
|
|
3789
|
-
}
|
|
3790
|
-
if (eventScope && message.subtype && message.subtype !== "file_share") {
|
|
3791
|
-
logVerbose(`slack: drop enterprise message subtype=${message.subtype}`);
|
|
3792
|
-
return;
|
|
3793
|
-
}
|
|
3794
3911
|
const assistantChangedInbound = resolveAssistantMessageChangedInbound({
|
|
3795
3912
|
event: message,
|
|
3796
3913
|
ctx
|
|
@@ -3812,12 +3929,11 @@ function registerSlackMessageEvents(params) {
|
|
|
3812
3929
|
})) return;
|
|
3813
3930
|
const subtypeHandler = resolveSlackMessageSubtypeHandler(message);
|
|
3814
3931
|
if (subtypeHandler) {
|
|
3815
|
-
const channelId = subtypeHandler.resolveChannelId(message);
|
|
3816
3932
|
const ingressContext = await authorizeAndResolveSlackSystemEventContext({
|
|
3817
3933
|
ctx,
|
|
3818
3934
|
senderId: subtypeHandler.resolveSenderId(message),
|
|
3819
|
-
channelId,
|
|
3820
|
-
|
|
3935
|
+
channelId: message.channel,
|
|
3936
|
+
threadTs: subtypeHandler.resolveThreadTs(message),
|
|
3821
3937
|
eventKind: subtypeHandler.eventKind,
|
|
3822
3938
|
eventScope
|
|
3823
3939
|
});
|
|
@@ -4149,19 +4265,7 @@ function buildSlackDebounceKey(message, accountId, teamId) {
|
|
|
4149
4265
|
}
|
|
4150
4266
|
//#endregion
|
|
4151
4267
|
//#region extensions/slack/src/monitor/message-handler.ts
|
|
4152
|
-
const loadSlackMessagePipeline = createLazyRuntimeModule(() => import("./pipeline.runtime-
|
|
4153
|
-
function createSlackDispatchCompletion() {
|
|
4154
|
-
let resolve;
|
|
4155
|
-
let reject;
|
|
4156
|
-
return {
|
|
4157
|
-
promise: new Promise((nextResolve, nextReject) => {
|
|
4158
|
-
resolve = nextResolve;
|
|
4159
|
-
reject = nextReject;
|
|
4160
|
-
}),
|
|
4161
|
-
resolve,
|
|
4162
|
-
reject
|
|
4163
|
-
};
|
|
4164
|
-
}
|
|
4268
|
+
const loadSlackMessagePipeline = createLazyRuntimeModule(() => import("./pipeline.runtime-Bd22U0ga.js"));
|
|
4165
4269
|
const RETRYABLE_FLUSH_MAX_ATTEMPTS = 3;
|
|
4166
4270
|
const RETRYABLE_FLUSH_RETRY_DELAY_MS = 1e3;
|
|
4167
4271
|
const REPLY_SESSION_INIT_CONFLICT_MESSAGE_RE = /reply session initialization conflicted for \S+/u;
|
|
@@ -4228,6 +4332,19 @@ function createSlackMessageHandler(params) {
|
|
|
4228
4332
|
const completions = entries.map((entry) => entry.opts.dispatchCompletion).filter((completion) => completion !== void 0);
|
|
4229
4333
|
try {
|
|
4230
4334
|
await (async () => {
|
|
4335
|
+
const flushedEntry = entries.at(-1);
|
|
4336
|
+
if (flushedEntry) {
|
|
4337
|
+
const teamId = flushedEntry.opts.eventScope?.teamId;
|
|
4338
|
+
const flushedKey = buildSlackDebounceKey(flushedEntry.message, ctx.accountId, teamId);
|
|
4339
|
+
const topLevelConversationKey = buildTopLevelSlackConversationKey(flushedEntry.message, ctx.accountId, teamId);
|
|
4340
|
+
if (flushedKey && topLevelConversationKey) {
|
|
4341
|
+
const pendingKeys = pendingTopLevelDebounceKeys.get(topLevelConversationKey);
|
|
4342
|
+
if (pendingKeys) {
|
|
4343
|
+
pendingKeys.delete(flushedKey);
|
|
4344
|
+
if (pendingKeys.size === 0) pendingTopLevelDebounceKeys.delete(topLevelConversationKey);
|
|
4345
|
+
}
|
|
4346
|
+
}
|
|
4347
|
+
}
|
|
4231
4348
|
const claims = [];
|
|
4232
4349
|
const claimedKeys = /* @__PURE__ */ new Map();
|
|
4233
4350
|
const surviving = [];
|
|
@@ -4281,16 +4398,6 @@ function createSlackMessageHandler(params) {
|
|
|
4281
4398
|
releaseClaims();
|
|
4282
4399
|
return;
|
|
4283
4400
|
}
|
|
4284
|
-
const teamId = last.opts.eventScope?.teamId;
|
|
4285
|
-
const flushedKey = buildSlackDebounceKey(last.message, ctx.accountId, teamId);
|
|
4286
|
-
const topLevelConversationKey = buildTopLevelSlackConversationKey(last.message, ctx.accountId, teamId);
|
|
4287
|
-
if (flushedKey && topLevelConversationKey) {
|
|
4288
|
-
const pendingKeys = pendingTopLevelDebounceKeys.get(topLevelConversationKey);
|
|
4289
|
-
if (pendingKeys) {
|
|
4290
|
-
pendingKeys.delete(flushedKey);
|
|
4291
|
-
if (pendingKeys.size === 0) pendingTopLevelDebounceKeys.delete(topLevelConversationKey);
|
|
4292
|
-
}
|
|
4293
|
-
}
|
|
4294
4401
|
const combinedText = surviving.length === 1 ? last.message.text ?? "" : surviving.map((entry) => entry.message.text ?? "").filter(Boolean).join("\n");
|
|
4295
4402
|
const combinedMentioned = surviving.some((entry) => Boolean(entry.opts.wasMentioned));
|
|
4296
4403
|
const syntheticMessage = {
|
|
@@ -4323,6 +4430,7 @@ function createSlackMessageHandler(params) {
|
|
|
4323
4430
|
releaseClaims();
|
|
4324
4431
|
return;
|
|
4325
4432
|
}
|
|
4433
|
+
await turnAdoptionLifecycle?.onSessionRouted?.(prepared.route.sessionKey);
|
|
4326
4434
|
prepared.turnAdoptionLifecycle = {
|
|
4327
4435
|
...turnAdoptionLifecycle,
|
|
4328
4436
|
admission: turnAdoptionLifecycle?.admission ?? "exclusive",
|
|
@@ -4338,6 +4446,10 @@ function createSlackMessageHandler(params) {
|
|
|
4338
4446
|
if (admissionLifecycle.onDeferred() === false) return false;
|
|
4339
4447
|
settlementHandedOff = true;
|
|
4340
4448
|
},
|
|
4449
|
+
onDeferredHeartbeat: () => {
|
|
4450
|
+
turnAdoptionLifecycle?.onDeferredHeartbeat?.();
|
|
4451
|
+
admissionLifecycle.onDeferredHeartbeat?.();
|
|
4452
|
+
},
|
|
4341
4453
|
onAbandoned: () => {
|
|
4342
4454
|
settlementHandedOff = true;
|
|
4343
4455
|
releaseClaims();
|
|
@@ -4401,7 +4513,7 @@ function createSlackMessageHandler(params) {
|
|
|
4401
4513
|
pendingKeys.add(debounceKey);
|
|
4402
4514
|
pendingTopLevelDebounceKeys.set(conversationKey, pendingKeys);
|
|
4403
4515
|
}
|
|
4404
|
-
const dispatchCompletion = opts.awaitDispatch ?
|
|
4516
|
+
const dispatchCompletion = opts.awaitDispatch ? createDeferred() : void 0;
|
|
4405
4517
|
await debouncer.enqueue({
|
|
4406
4518
|
message: resolvedMessage,
|
|
4407
4519
|
opts: {
|
|
@@ -4427,9 +4539,13 @@ const SLACK_PRESENCE_AUTO_MAX_PARTICIPANTS = 8;
|
|
|
4427
4539
|
const SLACK_PRESENCE_TARGET_TTL_MS = 1440 * 60 * 1e3;
|
|
4428
4540
|
const SLACK_PRESENCE_MAX_POLLS_PER_INTERVAL = 45;
|
|
4429
4541
|
const SLACK_PRESENCE_MAX_TARGETS = 2e3;
|
|
4542
|
+
const DEFAULT_SLACK_PRESENCE_EVENT_PROMPT = ["Before greeting, retrieve relevant memory and wiki context for this immutable user_id, including a known timezone when available. Use their local time; if their timezone is unknown, do not guess.", "Send at most one short, natural greeting in this Slack conversation. Do not reveal private memory. If no greeting is appropriate, stay silent."];
|
|
4430
4543
|
function resolveMode(channelConfig, accountConfig) {
|
|
4431
4544
|
return channelConfig?.mode ?? accountConfig?.mode ?? "off";
|
|
4432
4545
|
}
|
|
4546
|
+
function resolvePrompt(channelConfig, accountConfig) {
|
|
4547
|
+
return channelConfig?.prompt ?? accountConfig?.prompt;
|
|
4548
|
+
}
|
|
4433
4549
|
function hasSlackPresenceEventsEnabled(params) {
|
|
4434
4550
|
if (resolveMode(void 0, params.account) !== "off") return true;
|
|
4435
4551
|
return Object.values(params.channels ?? {}).some((entry) => resolveMode(entry?.presenceEvents, void 0) !== "off");
|
|
@@ -4442,12 +4558,12 @@ function isTargetEligible(target) {
|
|
|
4442
4558
|
function formatSlackPresenceEvent(target, userId, awayObservation) {
|
|
4443
4559
|
const { observedAwayAtMs, observedActiveAtMs } = awayObservation;
|
|
4444
4560
|
const observedAwayDurationMs = Math.max(0, observedActiveAtMs - observedAwayAtMs);
|
|
4561
|
+
const promptLines = target.prompt === void 0 ? DEFAULT_SLACK_PRESENCE_EVENT_PROMPT : target.prompt.length > 0 ? [target.prompt] : [];
|
|
4445
4562
|
return [
|
|
4446
4563
|
"Slack presence event:",
|
|
4447
4564
|
`A human participant became active on Slack after being observed away: user_id=${JSON.stringify(userId)}${target.teamId ? ` team_id=${JSON.stringify(target.teamId)}` : ""} channel_id=${JSON.stringify(target.channelId)}${target.threadId ? ` thread_ts=${JSON.stringify(target.threadId)}` : ""}.`,
|
|
4448
4565
|
`observed_away_at_ms=${observedAwayAtMs} observed_active_at_ms=${observedActiveAtMs} observed_away_duration_ms=${observedAwayDurationMs}`,
|
|
4449
|
-
|
|
4450
|
-
"Send at most one short, natural greeting in this Slack conversation. Do not reveal private memory. If no greeting is appropriate, stay silent."
|
|
4566
|
+
...promptLines
|
|
4451
4567
|
].join("\n");
|
|
4452
4568
|
}
|
|
4453
4569
|
function resolveObservedTarget(params) {
|
|
@@ -4470,6 +4586,7 @@ function resolveObservedTarget(params) {
|
|
|
4470
4586
|
key: `${teamId ? `team:${teamId}:` : ""}${channelId}${targetSuffix}`,
|
|
4471
4587
|
...teamId ? { teamId } : {},
|
|
4472
4588
|
mode,
|
|
4589
|
+
prompt: resolvePrompt(prepared.channelConfig?.presenceEvents, params.accountConfig),
|
|
4473
4590
|
channelId,
|
|
4474
4591
|
threadId,
|
|
4475
4592
|
to: formatSlackTarget({
|
|
@@ -4523,6 +4640,7 @@ function createSlackPresenceMonitor(params) {
|
|
|
4523
4640
|
const current = targets.get(observed.key);
|
|
4524
4641
|
if (current) {
|
|
4525
4642
|
current.mode = observed.mode;
|
|
4643
|
+
current.prompt = observed.prompt;
|
|
4526
4644
|
current.sessionKey = observed.sessionKey;
|
|
4527
4645
|
current.agentId = observed.agentId;
|
|
4528
4646
|
current.to = observed.to;
|
|
@@ -5119,7 +5237,7 @@ const SLACK_COMMAND_ARG_CONFIRM_TEXT_MAX = 300;
|
|
|
5119
5237
|
const SLACK_HEADER_TEXT_MAX = 150;
|
|
5120
5238
|
const SLACK_COMMAND_ARG_ACTION_BLOCKS_MAX = 47;
|
|
5121
5239
|
const loadSlashCommandsRuntime = createLazyRuntimeModule(() => import("./slash-commands.runtime-BTTMlmwy.js"));
|
|
5122
|
-
const loadSlashDispatchRuntime = createLazyRuntimeModule(() => import("./slash-dispatch.runtime-
|
|
5240
|
+
const loadSlashDispatchRuntime = createLazyRuntimeModule(() => import("./slash-dispatch.runtime-CilDmI0c.js"));
|
|
5123
5241
|
const loadSlashSkillCommandsRuntime = createLazyRuntimeModule(() => import("./slash-skill-commands.runtime-CD1J2ODY.js"));
|
|
5124
5242
|
const loadPluginCommandRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/plugin-command-runtime"));
|
|
5125
5243
|
function resolveSlackCommandMenuModelContext(params) {
|
|
@@ -5581,7 +5699,7 @@ async function registerSlackMonitorSlashCommands(params) {
|
|
|
5581
5699
|
}
|
|
5582
5700
|
const channelName = channelInfo?.name;
|
|
5583
5701
|
const roomLabel = channelName ? `#${channelName}` : `#${command.channel_id}`;
|
|
5584
|
-
const { deliverSlackSlashReplies, dispatchChannelInboundTurn, finalizeInboundContext, isChannelPartialDeliveryError, resolveAgentRoute, resolveChunkMode, resolveConversationLabel, resolveMarkdownTableMode } = await loadSlashDispatchRuntime();
|
|
5702
|
+
const { deliverSlackSlashReplies, dispatchChannelInboundTurn, finalizeInboundContext, isChannelPartialDeliveryError, resolveAgentRoute, resolveChunkMode, resolveConversationLabel, resolveMarkdownTableMode, sanitizeSlackMonitorReplyPayload } = await loadSlashDispatchRuntime();
|
|
5585
5703
|
const route = resolvedSlashRoute ?? resolveAgentRoute({
|
|
5586
5704
|
cfg,
|
|
5587
5705
|
channel: "slack",
|
|
@@ -5681,10 +5799,8 @@ async function registerSlackMonitorSlashCommands(params) {
|
|
|
5681
5799
|
sessionKey: ctxPayload.SessionKey ?? route.sessionKey
|
|
5682
5800
|
},
|
|
5683
5801
|
ctxPayload,
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
return payload;
|
|
5687
|
-
} },
|
|
5802
|
+
dispatchReplyFromConfig: ctx.dispatchReplyFromConfig,
|
|
5803
|
+
replyPipeline: { transformReplyPayload: sanitizeSlackMonitorReplyPayload },
|
|
5688
5804
|
dispatcherOptions: { onSettled: async () => {
|
|
5689
5805
|
if (pendingSlashReplies.length === 0) return;
|
|
5690
5806
|
const pending = pendingSlashReplies.splice(0);
|
|
@@ -5899,11 +6015,13 @@ async function registerSlackMonitorSlashCommands(params) {
|
|
|
5899
6015
|
const respondFn = respond ?? (async (message) => {
|
|
5900
6016
|
if (!body.channel?.id || !body.user?.id) return new Response(null, { status: 204 });
|
|
5901
6017
|
const payload = typeof message === "string" ? { text: message } : message;
|
|
6018
|
+
const threadTs = body.container?.thread_ts ?? body.message?.thread_ts;
|
|
5902
6019
|
await args.client.chat.postEphemeral({
|
|
5903
6020
|
token: ctx.botToken,
|
|
5904
6021
|
channel: body.channel.id,
|
|
5905
6022
|
user: body.user.id,
|
|
5906
6023
|
text: payload.text ?? "",
|
|
6024
|
+
...threadTs ? { thread_ts: threadTs } : {},
|
|
5907
6025
|
...payload.blocks ? { blocks: payload.blocks } : {},
|
|
5908
6026
|
...typeof payload.mrkdwn === "boolean" ? { mrkdwn: payload.mrkdwn } : {}
|
|
5909
6027
|
});
|
|
@@ -5978,12 +6096,12 @@ async function deliverSlackSlashResponseWithWebApi(params) {
|
|
|
5978
6096
|
const mrkdwn = "mrkdwn" in payload && typeof payload.mrkdwn === "boolean" ? payload.mrkdwn : void 0;
|
|
5979
6097
|
if (payload.response_type === "in_channel") {
|
|
5980
6098
|
const postSlackMessage = params.client.chat.postMessage;
|
|
5981
|
-
await postSlackMessage({
|
|
6099
|
+
requireSlackPostMessageTimestamp(await postSlackMessage({
|
|
5982
6100
|
channel: params.command.channel_id,
|
|
5983
6101
|
text,
|
|
5984
6102
|
...blocks ? { blocks } : {},
|
|
5985
6103
|
...mrkdwn !== void 0 ? { mrkdwn } : {}
|
|
5986
|
-
});
|
|
6104
|
+
}));
|
|
5987
6105
|
} else await params.client.chat.postEphemeral({
|
|
5988
6106
|
channel: params.command.channel_id,
|
|
5989
6107
|
user: params.command.user_id,
|
|
@@ -6015,7 +6133,7 @@ async function getSlackBoltInterop() {
|
|
|
6015
6133
|
}
|
|
6016
6134
|
return slackBoltInterop;
|
|
6017
6135
|
}
|
|
6018
|
-
const loadSlackRelaySource = createLazyRuntimeModule(() => import("./relay-source-
|
|
6136
|
+
const loadSlackRelaySource = createLazyRuntimeModule(() => import("./relay-source-BNGpsdwV.js"));
|
|
6019
6137
|
const SLACK_WEBHOOK_MAX_BODY_BYTES = 1024 * 1024;
|
|
6020
6138
|
const SLACK_WEBHOOK_BODY_TIMEOUT_MS = 3e4;
|
|
6021
6139
|
function resolveSlackRuntimeIdentity(params) {
|
|
@@ -6729,4 +6847,4 @@ function createSlackWorkspaceClientResolver(params) {
|
|
|
6729
6847
|
}
|
|
6730
6848
|
const resolveSlackRuntimeGroupPolicy = resolveOpenProviderRuntimeGroupPolicy$1;
|
|
6731
6849
|
//#endregion
|
|
6732
|
-
export {
|
|
6850
|
+
export { resolveStorePath$1 as C, stripSlackMentionsForCommandDetection as E, resolveChannelResetConfig as S, buildSlackSlashCommandMatcher as T, resolveSlackChatType as _, createSlackResponseUrlBudget as a, readSessionUpdatedAt as b, resolveSlackThreadTargets as c, authorizeSlackBotRoomMessage as d, resolveSlackCommandIngress as f, normalizeSlackChannelType as g, formatUnknownError as h, SlackResponseAlreadyReportedError as i, trackSlackDraftMessage as l, SLACK_SOCKET_RECONNECT_POLICY as m, resolveSlackRuntimeGroupPolicy as n, authorizeSlackDirectMessage as o, resolveSlackEffectiveAllowFrom as p, resolveSlackRoomContextHints as r, resolveSlackThreadContext as s, monitorSlackProvider as t, resolveConversationLabel$1 as u, buildSlackAssistantThreadMetadata as v, updateLastRoute as w, resolveChannelContextVisibilityMode as x, parseSlackAssistantThreadMetadata as y };
|